@flourish/sdk 5.2.1 → 5.2.2

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/site/script.js CHANGED
@@ -1,4 +1,4 @@
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)}const a=window.sessionStorage;let s,l,u=!1;function c(){const t=document.querySelector(".settings-block[aria-expanded=true] > h2"),e=document.querySelector("#editor-custom"),n=document.querySelector("#editor-custom-width"),r=document.querySelector("#editor-custom-height"),i=e.classList.contains("selected"),o=parseFloat(n.value),a=i?parseFloat(r.value):"auto";return{template_store_key:s.visualisation.template_store_key,setting_expanded:t&&t.innerText,width:o||800,height:a||"auto",settings:s.visualisation.settings}}function d(){return l}function f(){p(!1),a.removeItem(s.store_key)}function p(t){u=t}function h(){const t=s.visualisation.template_store_key,e=a.getItem(s.store_key),n=JSON.parse(e);return n&&n.template_store_key===t?n:null}function m(){const t=d();s.visualisation.settings=t.settings,v()}function g(){const t=Boolean(h());p(!0),function(){const t=document.querySelector("iframe#preview").contentWindow;t.addEventListener("beforeunload",b),t.addEventListener("keyup",b),t.addEventListener("pointerup",b)}(),v(),s.logInfo("Settings restored."),s.showStatusMessage(t?"Settings restored.":"Settings reset to defaults.")}function v(){const t=d(),e=[...document.querySelectorAll(".settings-block[aria-expanded=false] > h2")].find((e=>e.innerText===t.setting_expanded));e&&e.click()}function y(){const t=d();return{width:t.width,height:t.height}}function _(){var t;l=c(),t=l,a.setItem(s.store_key,JSON.stringify(t))}function b(){u&&_()}function w(t){return s=t,l=h()||c(),window.addEventListener("beforeunload",b),window.addEventListener("keyup",b),window.addEventListener("pointerup",b),{getPreviewSize:y,clearSession:f,prepareSession:m,applySession:g}}var T="http://www.w3.org/1999/xhtml",x={svg:"http://www.w3.org/2000/svg",xhtml:T,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function A(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),x.hasOwnProperty(e)?{space:x[e],local:t}:t}function E(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===T&&e.documentElement.namespaceURI===T?e.createElement(t):e.createElementNS(n,t)}}function C(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function S(t){var e=A(t);return(e.local?C:E)(e)}function k(){}function D(t){return null==t?k:function(){return this.querySelector(t)}}function N(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function M(){return[]}function L(t){return null==t?M:function(){return this.querySelectorAll(t)}}function F(t){return function(){return this.matches(t)}}function O(t){return function(e){return e.matches(t)}}var U=Array.prototype.find;function R(){return this.firstElementChild}var I=Array.prototype.filter;function H(){return this.children}function B(t){return new Array(t.length)}function P(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function z(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 P(t,o[s]);for(;s<l;++s)(a=e[s])&&(i[s]=a)}function j(t,e,n,r,i,o,a){var s,l,u,c=new Map,d=e.length,f=o.length,p=new Array(d);for(s=0;s<d;++s)(l=e[s])&&(p[s]=u=a.call(l,l.__data__,s,e)+"",c.has(u)?i[s]=l:c.set(u,l));for(s=0;s<f;++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 P(t,o[s]);for(s=0;s<d;++s)(l=e[s])&&c.get(p[s])===l&&(i[s]=l)}function Y(t){return t.__data__}function $(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function q(t){return function(){this.removeAttribute(t)}}function W(t){return function(){this.removeAttributeNS(t.space,t.local)}}function G(t,e){return function(){this.setAttribute(t,e)}}function V(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function X(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function Z(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 J(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function K(t){return function(){this.style.removeProperty(t)}}function Q(t,e,n){return function(){this.style.setProperty(t,e,n)}}function tt(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function et(t,e){return t.style.getPropertyValue(e)||J(t).getComputedStyle(t,null).getPropertyValue(e)}function nt(t){return function(){delete this[t]}}function rt(t,e){return function(){this[t]=e}}function it(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ot(t){return t.trim().split(/^|\s+/)}function at(t){return t.classList||new st(t)}function st(t){this._node=t,this._names=ot(t.getAttribute("class")||"")}function lt(t,e){for(var n=at(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function ut(t,e){for(var n=at(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function ct(t){return function(){lt(this,t)}}function dt(t){return function(){ut(this,t)}}function ft(t,e){return function(){(e.apply(this,arguments)?lt:ut)(this,t)}}function pt(){this.textContent=""}function ht(t){return function(){this.textContent=t}}function mt(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function gt(){this.innerHTML=""}function vt(t){return function(){this.innerHTML=t}}function yt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function _t(){this.nextSibling&&this.parentNode.appendChild(this)}function bt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function wt(){return null}function Tt(){var t=this.parentNode;t&&t.removeChild(this)}function xt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function At(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Et(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 Ct(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 St(t,e,n){var r=J(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 kt(t,e){return function(){return St(this,t,e)}}function Dt(t,e){return function(){return St(this,t,e.apply(this,arguments))}}P.prototype={constructor:P,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)}},st.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 Nt,Mt,Lt,Ft,Ot,Ut=[null];function Rt(t,e){this._groups=t,this._parents=e}function It(){return new Rt([[document.documentElement]],Ut)}function Ht(t){return"string"==typeof t?new Rt([[document.querySelector(t)]],[document.documentElement]):new Rt([[t]],Ut)}function Bt(t){return Ht(S(t).call(document.documentElement))}function Pt(t){return"string"==typeof t?new Rt([document.querySelectorAll(t)],[document.documentElement]):new Rt([null==t?[]:N(t)],Ut)}function zt(){if(!Lt)return null;var t=Lt.nodes()[1].value;if("custom"===Ft&&""!=t){var e=parseInt(t,10);return isNaN(e)?null:e}return null}function jt(){Ot&&Ot.preview_pane&&Ot.preview_pane.setFixedHeight&&Ot.preview_pane.setFixedHeight(zt())}function Yt(t,e=!1,n=null){if(Ft=t,n||jt(),"custom"===t){let t=parseFloat(n?.width),e=parseFloat(n?.height);t&&(t=Math.round(t),Lt.nodes()[0].value=t,Ht(".preview-holder").style("max-width",t+"px")),e?(e=Math.round(e),Lt.nodes()[1].value=e,Ht("iframe").style("height",e+"px"),Ot.preview_pane.setFixedHeight(e)):jt(),Ht("#editor-custom-inputs").style("opacity",1),Ht(".preview-holder").style("width",Lt.nodes()[0].value+"px").select("iframe").style("width",Lt.nodes()[0].value+"px")}else Ht("#editor-custom-inputs").style("opacity",0),Ht(".preview-holder").attr("style",null).select("iframe").style("width",null);e||Ht(".preview-holder").style("max-width","none"),Pt("#preview-menu .preview-mode").classed("selected",(function(){return this.id=="editor-"+t})),Ht("#editor-rotate").classed("active",(function(){return"auto"!==t})),Ht(".row.editor").classed("mobile",(function(){return"mobile"==t})),Ht(".row.editor").classed("tablet",(function(){return"tablet"==t})),Ht(".preview-holder").on("webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd transitionend",qt),Nt=t}function $t(t,e){return Ot=t,Lt=Pt("#editor-custom-inputs input"),qt(),Pt("#preview-menu .preview-mode").on("click",(function(){Yt(this.getAttribute("data-target"))})),Lt.on("change",(function(){Yt(this.getAttribute("data-target"))})),e?Yt("custom",!0,e):Yt("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,Ht(".preview-holder").style("transition","none"),Yt("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",qt(),Ot.preview_pane.resize()}function a(){t=r.getBoundingClientRect().width,Ht(".preview-holder").style("transition",null),n.parentElement.parentElement.querySelector("#resize-overlay").classList.remove("dragging"),n.parentElement.classList.remove("dragging"),qt(),Ot.preview_pane.resize(),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a)}n.addEventListener("mousedown",i)}
2
2
  /*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */(),window.innerWidth<=768&&(Mt="auto"),window.addEventListener("resize",(function(){Nt&&qt(),window.innerWidth<=768?Mt||(Mt=Nt,Yt("auto")):Mt&&(Yt(Mt),Mt=null),Ot.preview_pane.resize()})),{getHeightSetting:zt,selectPreviewState:Yt}}function qt(){var t=Ht(".preview-holder").node().getBoundingClientRect();Lt.nodes()[0].value=Math.round(t.width),""!==Lt.nodes()[1].value&&"custom"===Ft&&(Lt.nodes()[1].value=Math.round(t.height))}Rt.prototype=It.prototype={constructor:Rt,select:function(t){"function"!=typeof t&&(t=D(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 Rt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);return null==e?[]:N(e)}}(t):L(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 Rt(r,i)},selectChild:function(t){return this.select(null==t?R:function(t){return function(){return U.call(this.children,t)}}("function"==typeof t?t:O(t)))},selectChildren:function(t){return this.selectAll(null==t?H:function(t){return function(){return I.call(this.children,t)}}("function"==typeof t?t:O(t)))},filter: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=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 Rt(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,Y);var n,r=e?j:z,i=this._parents,o=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=o.length,s=new Array(a),l=new Array(a),u=new Array(a),c=0;c<a;++c){var d=i[c],f=o[c],p=f.length,h=N(t.call(d,d&&d.__data__,c,i)),m=h.length,g=l[c]=new Array(m),v=s[c]=new Array(m);r(d,f,g,v,u[c]=new Array(p),h,e);for(var y,_,b=0,w=0;b<m;++b)if(y=g[b]){for(b>=w&&(w=b+1);!(_=v[w])&&++w<m;);y._next=_||null}}return(s=new Rt(s,i))._enter=l,s._exit=u,s},enter:function(){return new Rt(this._enter||this._groups.map(B),this._parents)},exit:function(){return new Rt(this._exit||this._groups.map(B),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 Rt))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,f=a[s]=new Array(d),p=0;p<d;++p)(l=u[p]||c[p])&&(f[p]=l);for(;s<r;++s)a[s]=e[s];return new Rt(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=$);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 Rt(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=A(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?W:q:"function"==typeof e?n.local?Z:X:n.local?V:G)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?K:"function"==typeof e?tt:Q)(t,e,null==n?"":n)):et(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?nt:"function"==typeof e?it:rt)(t,e)):this.node()[t]},classed:function(t,e){var n=ot(t+"");if(arguments.length<2){for(var r=at(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?ft:e?ct:dt)(n,e))},text:function(t){return arguments.length?this.each(null==t?pt:("function"==typeof t?mt:ht)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?gt:("function"==typeof t?yt:vt)(t)):this.node().innerHTML},raise:function(){return this.each(_t)},lower:function(){return this.each(bt)},append:function(t){var e="function"==typeof t?t:S(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:S(t),r=null==e?wt:"function"==typeof e?e:D(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Tt)},clone:function(t){return this.select(t?At:xt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=function(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}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?Ct:Et,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?Dt:kt)(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)}};const{entries:Wt,setPrototypeOf:Gt,isFrozen:Vt,getPrototypeOf:Xt,getOwnPropertyDescriptor:Zt}=Object;let{freeze:Jt,seal:Kt,create:Qt}=Object,{apply:te,construct:ee}="undefined"!=typeof Reflect&&Reflect;Jt||(Jt=function(t){return t}),Kt||(Kt=function(t){return t}),te||(te=function(t,e,n){return t.apply(e,n)}),ee||(ee=function(t,e){return new t(...e)});const ne=ve(Array.prototype.forEach),re=ve(Array.prototype.lastIndexOf),ie=ve(Array.prototype.pop),oe=ve(Array.prototype.push),ae=ve(Array.prototype.splice),se=ve(String.prototype.toLowerCase),le=ve(String.prototype.toString),ue=ve(String.prototype.match),ce=ve(String.prototype.replace),de=ve(String.prototype.indexOf),fe=ve(String.prototype.trim),pe=ve(Object.prototype.hasOwnProperty),he=ve(RegExp.prototype.test),me=(ge=TypeError,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return ee(ge,e)});var ge;function ve(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return te(t,e,r)}}function ye(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:se;Gt&&Gt(t,null);let r=e.length;for(;r--;){let i=e[r];if("string"==typeof i){const t=n(i);t!==i&&(Vt(e)||(e[r]=t),i=t)}t[i]=!0}return t}function _e(t){for(let e=0;e<t.length;e++){pe(t,e)||(t[e]=null)}return t}function be(t){const e=Qt(null);for(const[n,r]of Wt(t)){pe(t,n)&&(Array.isArray(r)?e[n]=_e(r):r&&"object"==typeof r&&r.constructor===Object?e[n]=be(r):e[n]=r)}return e}function we(t,e){for(;null!==t;){const n=Zt(t,e);if(n){if(n.get)return ve(n.get);if("function"==typeof n.value)return ve(n.value)}t=Xt(t)}return function(){return null}}const Te=Jt(["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"]),xe=Jt(["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=Jt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ee=Jt(["animate","color-profile","cursor","discard","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"]),Ce=Jt(["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","mprescripts"]),Se=Jt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ke=Jt(["#text"]),De=Jt(["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","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","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","wrap","xmlns","slot"]),Ne=Jt(["accent-height","accumulate","additive","alignment-baseline","amplitude","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","exponent","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","intercept","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","slope","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","tablevalues","targetx","targety","transform","transform-origin","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"]),Me=Jt(["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"]),Le=Jt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Fe=Kt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Oe=Kt(/<%[\w\W]*|[\w\W]*%>/gm),Ue=Kt(/\$\{[\w\W]*/gm),Re=Kt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ie=Kt(/^aria-[\-\w]+$/),He=Kt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Be=Kt(/^(?:\w+script|data):/i),Pe=Kt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ze=Kt(/^html$/i),je=Kt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ye=Object.freeze({__proto__:null,ARIA_ATTR:Ie,ATTR_WHITESPACE:Pe,CUSTOM_ELEMENT:je,DATA_ATTR:Re,DOCTYPE_NAME:ze,ERB_EXPR:Oe,IS_ALLOWED_URI:He,IS_SCRIPT_OR_DATA:Be,MUSTACHE_EXPR:Fe,TMPLIT_EXPR:Ue});const $e=1,qe=3,We=7,Ge=8,Ve=9,Xe=function(){return"undefined"==typeof window?null:window};var Ze,Je,Ke=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xe();const n=e=>t(e);if(n.version="3.2.4",n.removed=[],!e||!e.document||e.document.nodeType!==Ve||!e.Element)return n.isSupported=!1,n;let{document:r}=e;const i=r,o=i.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:u,NodeFilter:c,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=e,m=u.prototype,g=we(m,"cloneNode"),v=we(m,"remove"),y=we(m,"nextSibling"),_=we(m,"childNodes"),b=we(m,"parentNode");if("function"==typeof s){const t=r.createElement("template");t.content&&t.content.ownerDocument&&(r=t.content.ownerDocument)}let w,T="";const{implementation:x,createNodeIterator:A,createDocumentFragment:E,getElementsByTagName:C}=r,{importNode:S}=i;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Wt&&"function"==typeof b&&x&&void 0!==x.createHTMLDocument;const{MUSTACHE_EXPR:D,ERB_EXPR:N,TMPLIT_EXPR:M,DATA_ATTR:L,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:O,ATTR_WHITESPACE:U,CUSTOM_ELEMENT:R}=Ye;let{IS_ALLOWED_URI:I}=Ye,H=null;const B=ye({},[...Te,...xe,...Ae,...Ce,...ke]);let P=null;const z=ye({},[...De,...Ne,...Me,...Le]);let j=Object.seal(Qt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Y=null,$=null,q=!0,W=!0,G=!1,V=!0,X=!1,Z=!0,J=!1,K=!1,Q=!1,tt=!1,et=!1,nt=!1,rt=!0,it=!1,ot=!0,at=!1,st={},lt=null;const ut=ye({},["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"]);let ct=null;const dt=ye({},["audio","video","img","source","image","track"]);let ft=null;const pt=ye({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ht="http://www.w3.org/1998/Math/MathML",mt="http://www.w3.org/2000/svg",gt="http://www.w3.org/1999/xhtml";let vt=gt,yt=!1,_t=null;const bt=ye({},[ht,mt,gt],le);let wt=ye({},["mi","mo","mn","ms","mtext"]),Tt=ye({},["annotation-xml"]);const xt=ye({},["title","style","font","a","script"]);let At=null;const Et=["application/xhtml+xml","text/html"];let Ct=null,St=null;const kt=r.createElement("form"),Dt=function(t){return t instanceof RegExp||t instanceof Function},Nt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!St||St!==t){if(t&&"object"==typeof t||(t={}),t=be(t),At=-1===Et.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Ct="application/xhtml+xml"===At?le:se,H=pe(t,"ALLOWED_TAGS")?ye({},t.ALLOWED_TAGS,Ct):B,P=pe(t,"ALLOWED_ATTR")?ye({},t.ALLOWED_ATTR,Ct):z,_t=pe(t,"ALLOWED_NAMESPACES")?ye({},t.ALLOWED_NAMESPACES,le):bt,ft=pe(t,"ADD_URI_SAFE_ATTR")?ye(be(pt),t.ADD_URI_SAFE_ATTR,Ct):pt,ct=pe(t,"ADD_DATA_URI_TAGS")?ye(be(dt),t.ADD_DATA_URI_TAGS,Ct):dt,lt=pe(t,"FORBID_CONTENTS")?ye({},t.FORBID_CONTENTS,Ct):ut,Y=pe(t,"FORBID_TAGS")?ye({},t.FORBID_TAGS,Ct):{},$=pe(t,"FORBID_ATTR")?ye({},t.FORBID_ATTR,Ct):{},st=!!pe(t,"USE_PROFILES")&&t.USE_PROFILES,q=!1!==t.ALLOW_ARIA_ATTR,W=!1!==t.ALLOW_DATA_ATTR,G=t.ALLOW_UNKNOWN_PROTOCOLS||!1,V=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,X=t.SAFE_FOR_TEMPLATES||!1,Z=!1!==t.SAFE_FOR_XML,J=t.WHOLE_DOCUMENT||!1,tt=t.RETURN_DOM||!1,et=t.RETURN_DOM_FRAGMENT||!1,nt=t.RETURN_TRUSTED_TYPE||!1,Q=t.FORCE_BODY||!1,rt=!1!==t.SANITIZE_DOM,it=t.SANITIZE_NAMED_PROPS||!1,ot=!1!==t.KEEP_CONTENT,at=t.IN_PLACE||!1,I=t.ALLOWED_URI_REGEXP||He,vt=t.NAMESPACE||gt,wt=t.MATHML_TEXT_INTEGRATION_POINTS||wt,Tt=t.HTML_INTEGRATION_POINTS||Tt,j=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&Dt(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(j.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&Dt(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(j.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(j.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(W=!1),et&&(tt=!0),st&&(H=ye({},ke),P=[],!0===st.html&&(ye(H,Te),ye(P,De)),!0===st.svg&&(ye(H,xe),ye(P,Ne),ye(P,Le)),!0===st.svgFilters&&(ye(H,Ae),ye(P,Ne),ye(P,Le)),!0===st.mathMl&&(ye(H,Ce),ye(P,Me),ye(P,Le))),t.ADD_TAGS&&(H===B&&(H=be(H)),ye(H,t.ADD_TAGS,Ct)),t.ADD_ATTR&&(P===z&&(P=be(P)),ye(P,t.ADD_ATTR,Ct)),t.ADD_URI_SAFE_ATTR&&ye(ft,t.ADD_URI_SAFE_ATTR,Ct),t.FORBID_CONTENTS&&(lt===ut&&(lt=be(lt)),ye(lt,t.FORBID_CONTENTS,Ct)),ot&&(H["#text"]=!0),J&&ye(H,["html","head","body"]),H.table&&(ye(H,["tbody"]),delete Y.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw me('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw me('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=t.TRUSTED_TYPES_POLICY,T=w.createHTML("")}else void 0===w&&(w=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";e&&e.hasAttribute(r)&&(n=e.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(h,o)),null!==w&&"string"==typeof T&&(T=w.createHTML(""));Jt&&Jt(t),St=t}},Mt=ye({},[...xe,...Ae,...Ee]),Lt=ye({},[...Ce,...Se]),Ft=function(t){oe(n.removed,{element:t});try{b(t).removeChild(t)}catch(e){v(t)}},Ot=function(t,e){try{oe(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){oe(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(tt||et)try{Ft(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Ut=function(t){let e=null,n=null;if(Q)t="<remove></remove>"+t;else{const e=ue(t,/^[\r\n\t ]+/);n=e&&e[0]}"application/xhtml+xml"===At&&vt===gt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const i=w?w.createHTML(t):t;if(vt===gt)try{e=(new p).parseFromString(i,At)}catch(t){}if(!e||!e.documentElement){e=x.createDocument(vt,"template",null);try{e.documentElement.innerHTML=yt?T:i}catch(t){}}const o=e.body||e.documentElement;return t&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),vt===gt?C.call(e,J?"html":"body")[0]:J?e.documentElement:o},Rt=function(t){return A.call(t.ownerDocument||t,t,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},It=function(t){return 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||"function"!=typeof t.hasChildNodes)},Ht=function(t){return"function"==typeof l&&t instanceof l};function Bt(t,e,r){ne(t,(t=>{t.call(n,e,r,St)}))}const Pt=function(t){let e=null;if(Bt(k.beforeSanitizeElements,t,null),It(t))return Ft(t),!0;const r=Ct(t.nodeName);if(Bt(k.uponSanitizeElement,t,{tagName:r,allowedTags:H}),t.hasChildNodes()&&!Ht(t.firstElementChild)&&he(/<[/\w]/g,t.innerHTML)&&he(/<[/\w]/g,t.textContent))return Ft(t),!0;if(t.nodeType===We)return Ft(t),!0;if(Z&&t.nodeType===Ge&&he(/<[/\w]/g,t.data))return Ft(t),!0;if(!H[r]||Y[r]){if(!Y[r]&&jt(r)){if(j.tagNameCheck instanceof RegExp&&he(j.tagNameCheck,r))return!1;if(j.tagNameCheck instanceof Function&&j.tagNameCheck(r))return!1}if(ot&&!lt[r]){const e=b(t)||t.parentNode,n=_(t)||t.childNodes;if(n&&e){for(let r=n.length-1;r>=0;--r){const i=g(n[r],!0);i.__removalCount=(t.__removalCount||0)+1,e.insertBefore(i,y(t))}}}return Ft(t),!0}return t instanceof u&&!function(t){let e=b(t);e&&e.tagName||(e={namespaceURI:vt,tagName:"template"});const n=se(t.tagName),r=se(e.tagName);return!!_t[t.namespaceURI]&&(t.namespaceURI===mt?e.namespaceURI===gt?"svg"===n:e.namespaceURI===ht?"svg"===n&&("annotation-xml"===r||wt[r]):Boolean(Mt[n]):t.namespaceURI===ht?e.namespaceURI===gt?"math"===n:e.namespaceURI===mt?"math"===n&&Tt[r]:Boolean(Lt[n]):t.namespaceURI===gt?!(e.namespaceURI===mt&&!Tt[r])&&!(e.namespaceURI===ht&&!wt[r])&&!Lt[n]&&(xt[n]||!Mt[n]):!("application/xhtml+xml"!==At||!_t[t.namespaceURI]))}(t)?(Ft(t),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!he(/<\/no(script|embed|frames)/i,t.innerHTML)?(X&&t.nodeType===qe&&(e=t.textContent,ne([D,N,M],(t=>{e=ce(e,t," ")})),t.textContent!==e&&(oe(n.removed,{element:t.cloneNode()}),t.textContent=e)),Bt(k.afterSanitizeElements,t,null),!1):(Ft(t),!0)},zt=function(t,e,n){if(rt&&("id"===e||"name"===e)&&(n in r||n in kt))return!1;if(W&&!$[e]&&he(L,e));else if(q&&he(F,e));else if(!P[e]||$[e]){if(!(jt(t)&&(j.tagNameCheck instanceof RegExp&&he(j.tagNameCheck,t)||j.tagNameCheck instanceof Function&&j.tagNameCheck(t))&&(j.attributeNameCheck instanceof RegExp&&he(j.attributeNameCheck,e)||j.attributeNameCheck instanceof Function&&j.attributeNameCheck(e))||"is"===e&&j.allowCustomizedBuiltInElements&&(j.tagNameCheck instanceof RegExp&&he(j.tagNameCheck,n)||j.tagNameCheck instanceof Function&&j.tagNameCheck(n))))return!1}else if(ft[e]);else if(he(I,ce(n,U,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==de(n,"data:")||!ct[t]){if(G&&!he(O,ce(n,U,"")));else if(n)return!1}else;return!0},jt=function(t){return"annotation-xml"!==t&&ue(t,R)},Yt=function(t){Bt(k.beforeSanitizeAttributes,t,null);const{attributes:e}=t;if(!e||It(t))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:P,forceKeepAttr:void 0};let i=e.length;for(;i--;){const o=e[i],{name:a,namespaceURI:s,value:l}=o,u=Ct(a);let c="value"===a?l:fe(l);if(r.attrName=u,r.attrValue=c,r.keepAttr=!0,r.forceKeepAttr=void 0,Bt(k.uponSanitizeAttribute,t,r),c=r.attrValue,!it||"id"!==u&&"name"!==u||(Ot(a,t),c="user-content-"+c),Z&&he(/((--!?|])>)|<\/(style|title)/i,c)){Ot(a,t);continue}if(r.forceKeepAttr)continue;if(Ot(a,t),!r.keepAttr)continue;if(!V&&he(/\/>/i,c)){Ot(a,t);continue}X&&ne([D,N,M],(t=>{c=ce(c,t," ")}));const d=Ct(t.nodeName);if(zt(d,u,c)){if(w&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(d,u)){case"TrustedHTML":c=w.createHTML(c);break;case"TrustedScriptURL":c=w.createScriptURL(c)}try{s?t.setAttributeNS(s,a,c):t.setAttribute(a,c),It(t)?Ft(t):ie(n.removed)}catch(t){}}}Bt(k.afterSanitizeAttributes,t,null)},$t=function t(e){let n=null;const r=Rt(e);for(Bt(k.beforeSanitizeShadowDOM,e,null);n=r.nextNode();)Bt(k.uponSanitizeShadowNode,n,null),Pt(n),Yt(n),n.content instanceof a&&t(n.content);Bt(k.afterSanitizeShadowDOM,e,null)};return n.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,s=null,u=null;if(yt=!t,yt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!Ht(t)){if("function"!=typeof t.toString)throw me("toString is not a function");if("string"!=typeof(t=t.toString()))throw me("dirty is not a string, aborting")}if(!n.isSupported)return t;if(K||Nt(e),n.removed=[],"string"==typeof t&&(at=!1),at){if(t.nodeName){const e=Ct(t.nodeName);if(!H[e]||Y[e])throw me("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof l)r=Ut("\x3c!----\x3e"),o=r.ownerDocument.importNode(t,!0),o.nodeType===$e&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!tt&&!X&&!J&&-1===t.indexOf("<"))return w&&nt?w.createHTML(t):t;if(r=Ut(t),!r)return tt?null:nt?T:""}r&&Q&&Ft(r.firstChild);const c=Rt(at?t:r);for(;s=c.nextNode();)Pt(s),Yt(s),s.content instanceof a&&$t(s.content);if(at)return t;if(tt){if(et)for(u=E.call(r.ownerDocument);r.firstChild;)u.appendChild(r.firstChild);else u=r;return(P.shadowroot||P.shadowrootmode)&&(u=S.call(i,u,!0)),u}let d=J?r.outerHTML:r.innerHTML;return J&&H["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&he(ze,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),X&&ne([D,N,M],(t=>{d=ce(d,t," ")})),w&&nt?w.createHTML(d):d},n.setConfig=function(){Nt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),K=!0},n.clearConfig=function(){St=null,K=!1},n.isValidAttribute=function(t,e,n){St||Nt({});const r=Ct(t),i=Ct(e);return zt(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&oe(k[t],e)},n.removeHook=function(t,e){if(void 0!==e){const n=re(k[t],e);return-1===n?void 0:ae(k[t],n,1)[0]}return ie(k[t])},n.removeHooks=function(t){k[t]=[]},n.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Qe=25,tn=10,en=10,nn={};function rn(t,e,n,r,i,o,a){var s=n-t/2-en,l=n+t/2+en,u=t/2+Math.min(0,s-i.left)+Math.max(0,l-i.right);return{pos:[u,a],shape:u-tn<5?[-u,-15*o,Math.max(tn,5-u),-10*o]:u+tn>t-5?[Math.min(-10,t-u-5),-10*o,Math.min(tn,t-u),-15*o]:[-10,-10*o,tn,-10*o]}}function on(t,e,n,r,i,o,a){var s=r-e/2-en,l=r+e/2+en,u=e/2+Math.min(0,s-i.top)+Math.max(0,l-i.bottom);return{pos:[a,u],shape:u-tn<5?[-15*o,-u,-10*o,Math.max(tn,5-u)]:u+tn>e-5?[-10*o,Math.min(-10,e-u-5),-15*o,Math.min(tn,e-u)]:[-10*o,-10,-10*o,tn]}}function an(t,e,n,r,i,o){var a=nn[t](e,n,r,i,o),s=r-Qe-a.pos[0],l=i-Qe-a.pos[1];return{left:s,top:l,right:s+e+2*Qe,bottom:l+n+2*Qe}}function sn(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 ln(){return Ze||((Ze=document.createElement("div")).id="flourish-popup-constrainer",(Je=Ze.style).overflow="hidden",Je.pointerEvents="none",Je.position="absolute",Je.left="0",Je.top="0",Je.margin="0",Je.padding="0",document.body.appendChild(Ze),this._resizeConstrainer(),Ze)}nn.bottom=function(t,e){return{shape:[-10,-10,tn,-10],pos:[t/2,e+en]}},nn.top=function(t,e){return{shape:[-10,en,tn,en],pos:[t/2,-10]}},nn.left=function(t,e){return{shape:[en,tn,en,-10],pos:[-10,e/2]}},nn.right=function(t,e){return{shape:[-10,tn,-10,-10],pos:[t+en,e/2]}},nn.topLeft=function(t,e){return{shape:[15,en,en,15],pos:[-10,-10]}},nn.bottomLeft=function(t,e){return{shape:[15,-10,en,-15],pos:[-10,e+en]}},nn.topRight=function(t,e){return{shape:[-15,en,-10,15],pos:[t+en,-10]}},nn.bottomRight=function(t,e){return{shape:[-15,-10,-10,-15],pos:[t+en,e+en]}},nn.bottomFlexible=function(t,e,n,r,i){return rn(t,0,n,0,i,1,e+en)},nn.topFlexible=function(t,e,n,r,i){return rn(t,0,n,0,i,-1,-10)},nn.rightFlexible=function(t,e,n,r,i){return on(0,e,0,r,i,1,t+en)},nn.leftFlexible=function(t,e,n,r,i){return on(0,e,0,r,i,-1,-10)};var un,cn=1,dn={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 fn(){for(var t in this.unique_id=cn++,this.is_visible=!0,dn)this["_"+t]=dn[t];this.handlers={click:[]}}function pn(t){fn.prototype[t]=function(e){return void 0===e?this["_"+t]:(this["_"+t]=e,this)}}for(var hn in dn)pn(hn);function mn(){return new fn}function gn(){un=mn().container(document.body),function(t){t.each((function(){var t=Ht(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")}Ht(this).on("mouseenter focus",(function(t){vn.call(this,t,!0)})).on("mouseover",vn).on("mouseout focusout",yn)}))}(Pt(".popup"))}function vn(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+=Bt("span").classed("popup-content-header",!0).html(Ke.sanitize(s)).node().outerHTML),l&&(u+=Bt("span").classed("popup-content-body",!0).html(Ke.sanitize(l)).node().outerHTML),n){r&&["top","bottom"].includes(r)||(r="top");Ht(this).select(".popup-content-outer").style("display","inline-block"),Ht(this).select(".popup-content-inner").style("display","inline-block"),Ht(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&&Ht(this).select(".popup-content-inner").html(u);var c=this.getAttribute("data-popup-constrainer")||"body",d=Ht(c).size()?Ht(c).node().getBoundingClientRect():document.body,f=Ht(this).select(".popup-content-inner").node().getBoundingClientRect().width,p=o,h=-f/2,m=p+f/2-(d.right-15),g=d.left+15-(p-f/2);m>0?h-=m:g>0&&(h+=g),Ht(this).select(".popup-content-wrapper").style("left",i.width/2+h+"px");Ht(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)),un.point(o,a).html(u).directions(v).draw()}}}function yn(t){document.activeElement===this||this.contains(t.relatedTarget)||(this.getAttribute("data-popup-allow-interaction")&&Ht(this).select(".popup-content-wrapper").style("display","none"),un.hide())}fn.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},fn.prototype.directions=function(t){return void 0===t?this._directions:("string"==typeof t&&(t=[t]),this._directions=t.slice(),this)},fn.prototype.text=function(t){return this._html=function(t){return t.replace(/[&<>]/g,(function(t){return{"&":"&amp;","<":"&lt;",">":"&gt;"}[t]}))}(t),this},fn.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},fn.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},fn.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=sn("svg",{class:"flourish-popup-svg"},{position:"absolute",top:0,left:0,bottom:0,right:0}),o=sn("filter",{id:"dropshadow-"+t.unique_id,height:"130%"});o.appendChild(sn("feGaussianBlur",{in:"SourceAlpha",stdDeviation:5})),o.appendChild(sn("feOffset",{dx:0,dy:2,result:"offsetblur"}));var a=sn("feComponentTransfer");a.appendChild(sn("feFuncA",{type:"linear",slope:.2})),o.appendChild(a);var s=sn("feMerge");o.appendChild(s),s.appendChild(sn("feMergeNode")),s.appendChild(sn("feMergeNode",{in:"SourceGraphic"})),i.appendChild(o);var l=sn("g",{filter:"url(#dropshadow-"+t.unique_id+")",fill:"white",stroke:"none"});l.appendChild(sn("rect",{x:Qe,y:Qe,rx:5})),l.appendChild(sn("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=Qe+"px",r.padding="10px",n.appendChild(u),t._getConstrainer().appendChild(n)}return t._resizeConstrainer(),n},fn.prototype._getConstrainer=ln,fn.prototype._resizeConstrainer=function(){Ze||ln.call(this);var t=Je.display;Je.display="none",Je.width=document.documentElement.scrollWidth+"px",Je.height=document.documentElement.scrollHeight+"px",Je.display=t},fn.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"),f=c.querySelector("path"),p=s.querySelector(".flourish-popup-content");l.display="block",p.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&&(p.innerHTML=t._inner_html=t._html);var h,m,g=p.getBoundingClientRect();do{h=Math.ceil(g.width),m=Math.ceil(g.height),l.width=h+2*Qe+"px",l.height=m+2*Qe+"px",g=p.getBoundingClientRect()}while(h!=Math.ceil(g.width)||m!=Math.ceil(g.height));d.setAttribute("width",h),d.setAttribute("height",m),u.setAttribute("width",h+2*Qe),u.setAttribute("height",m+2*Qe);for(var v,y,_=Qe-en,b=null,w=null,T=null,x=1/0,A=1/0,E=0;E<t._directions.length;E++){var C=t._directions[E],S=an(C,h,m,n,r,i),k=Math.max(0,Math.floor(i.left)-S.left-_)+Math.max(0,S.right-Math.ceil(i.right)-_),D=Math.max(0,Math.floor(i.top)-S.top-_)+Math.max(0,S.bottom-Math.ceil(i.bottom)-_);if(0==k&&0==D){b=C;break}(k<x||k==x&&D<v)&&(x=k,v=D,w=C),(D<A||D==A&&k<y)&&(A=D,y=k,T=C)}return b?C=b:"horizontal"==t._fallbackFit?C=w:"vertical"==t._fallbackFit?C=T:(console.warn("Popup: failed to point box of size ("+h+", "+m+") at ("+n+", "+r+") within ("+i.left+", "+i.top+", "+i.right+", "+i.bottom+")"),C=t._directions[0]),function(t,e,n,r,i,o,a,s,l,u){var c=nn[t](r,i,s,l,u);e.left=o-Qe-c.pos[0]+"px",e.top=a-Qe-c.pos[1]+"px",n.setAttribute("d","M0,0L"+c.shape.join(",")+"Z"),n.setAttribute("transform","translate("+(c.pos[0]+Qe)+","+(c.pos[1]+Qe)+")")}(C,l,f,h,m,o,a,n,r,i),t}console.error("Popup: cannot draw popup till point() has been specified")},fn.prototype.hide=function(){return this.is_visible?(this.is_visible=!1,this._getElement().style.display="none",this):this},mn.version="2.1.5";const _n=Math.pow(2,31)-1,bn=Math.pow(2,15);function wn(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{En(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>_n&&console.warn("Column index out of range"),Math.min(n-1,_n)}function Tn(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 xn(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=wn(n),o=wn(r),a=[],s=o>=i?1:-1,l=Math.abs(o-i)+1;l>bn&&(console.warn("Truncating excessively long range"),l=bn);for(var u=0;u<l;u++)a.push(i+u*s);return a}function An(t,e){return Tn(t)+"-"+Tn(e)}function En(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(wn(i)):Array.prototype.push.apply(e,xn(i))}return e}function Cn(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(Tn(i[0])):n.push(An(i[0],i[1]))}return n.join(",")}function Sn(t,e,n,r){if("column"in t)return""+Tn(t.column);if("columns"in t)return""+Cn(t.columns);if(r)return"";throw new Error("Data binding must have .column or .columns")}var kn=new Date,Dn=new Date;function Nn(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 Nn((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 kn.setTime(+e),Dn.setTime(+r),t(kn),t(Dn),Math.floor(n(kn,Dn))},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 Mn=864e5,Ln=6048e5,Fn=Nn((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()))/Mn}),(function(t){return t.getDate()-1}));function On(t){return Nn((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}))}Fn.range;var Un=On(0),Rn=On(1),In=On(2),Hn=On(3),Bn=On(4),Pn=On(5),zn=On(6);Un.range,Rn.range,In.range,Hn.range,Bn.range,Pn.range,zn.range;var jn=Nn((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()}));jn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Nn((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},jn.range;var Yn=Nn((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/Mn}),(function(t){return t.getUTCDate()-1}));function $n(t){return Nn((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}))}Yn.range;var qn=$n(0),Wn=$n(1),Gn=$n(2),Vn=$n(3),Xn=$n(4),Zn=$n(5),Jn=$n(6);qn.range,Wn.range,Gn.range,Vn.range,Xn.range,Zn.range,Jn.range;var Kn=Nn((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()}));function Qn(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 tr(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 er(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}Kn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Nn((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},Kn.range;var nr,rr,ir,or={"-":"",_:" ",0:"0"},ar=/^\s*\d+/,sr=/^%/,lr=/[\\^$*+?|[\]().{}]/g;function ur(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 cr(t){return t.replace(lr,"\\$&")}function dr(t){return new RegExp("^(?:"+t.map(cr).join("|")+")","i")}function fr(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function pr(t,e,n){var r=ar.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function hr(t,e,n){var r=ar.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function mr(t,e,n){var r=ar.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function gr(t,e,n){var r=ar.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function vr(t,e,n){var r=ar.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function yr(t,e,n){var r=ar.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function _r(t,e,n){var r=ar.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function br(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 wr(t,e,n){var r=ar.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Tr(t,e,n){var r=ar.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function xr(t,e,n){var r=ar.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Ar(t,e,n){var r=ar.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Er(t,e,n){var r=ar.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Cr(t,e,n){var r=ar.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Sr(t,e,n){var r=ar.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function kr(t,e,n){var r=ar.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Dr(t,e,n){var r=ar.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Nr(t,e,n){var r=sr.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Mr(t,e,n){var r=ar.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Lr(t,e,n){var r=ar.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Fr(t,e){return ur(t.getDate(),e,2)}function Or(t,e){return ur(t.getHours(),e,2)}function Ur(t,e){return ur(t.getHours()%12||12,e,2)}function Rr(t,e){return ur(1+Fn.count(jn(t),t),e,3)}function Ir(t,e){return ur(t.getMilliseconds(),e,3)}function Hr(t,e){return Ir(t,e)+"000"}function Br(t,e){return ur(t.getMonth()+1,e,2)}function Pr(t,e){return ur(t.getMinutes(),e,2)}function zr(t,e){return ur(t.getSeconds(),e,2)}function jr(t){var e=t.getDay();return 0===e?7:e}function Yr(t,e){return ur(Un.count(jn(t)-1,t),e,2)}function $r(t){var e=t.getDay();return e>=4||0===e?Bn(t):Bn.ceil(t)}function qr(t,e){return t=$r(t),ur(Bn.count(jn(t),t)+(4===jn(t).getDay()),e,2)}function Wr(t){return t.getDay()}function Gr(t,e){return ur(Rn.count(jn(t)-1,t),e,2)}function Vr(t,e){return ur(t.getFullYear()%100,e,2)}function Xr(t,e){return ur((t=$r(t)).getFullYear()%100,e,2)}function Zr(t,e){return ur(t.getFullYear()%1e4,e,4)}function Jr(t,e){var n=t.getDay();return ur((t=n>=4||0===n?Bn(t):Bn.ceil(t)).getFullYear()%1e4,e,4)}function Kr(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ur(e/60|0,"0",2)+ur(e%60,"0",2)}function Qr(t,e){return ur(t.getUTCDate(),e,2)}function ti(t,e){return ur(t.getUTCHours(),e,2)}function ei(t,e){return ur(t.getUTCHours()%12||12,e,2)}function ni(t,e){return ur(1+Yn.count(Kn(t),t),e,3)}function ri(t,e){return ur(t.getUTCMilliseconds(),e,3)}function ii(t,e){return ri(t,e)+"000"}function oi(t,e){return ur(t.getUTCMonth()+1,e,2)}function ai(t,e){return ur(t.getUTCMinutes(),e,2)}function si(t,e){return ur(t.getUTCSeconds(),e,2)}function li(t){var e=t.getUTCDay();return 0===e?7:e}function ui(t,e){return ur(qn.count(Kn(t)-1,t),e,2)}function ci(t){var e=t.getUTCDay();return e>=4||0===e?Xn(t):Xn.ceil(t)}function di(t,e){return t=ci(t),ur(Xn.count(Kn(t),t)+(4===Kn(t).getUTCDay()),e,2)}function fi(t){return t.getUTCDay()}function pi(t,e){return ur(Wn.count(Kn(t)-1,t),e,2)}function hi(t,e){return ur(t.getUTCFullYear()%100,e,2)}function mi(t,e){return ur((t=ci(t)).getUTCFullYear()%100,e,2)}function gi(t,e){return ur(t.getUTCFullYear()%1e4,e,4)}function vi(t,e){var n=t.getUTCDay();return ur((t=n>=4||0===n?Xn(t):Xn.ceil(t)).getUTCFullYear()%1e4,e,4)}function yi(){return"+0000"}function _i(){return"%"}function bi(t){return+t}function wi(t){return Math.floor(+t/1e3)}function Ti(t){throw new TypeError("Expected a value of type string but got a value of type "+typeof t)}function xi(t){return function(e){return"string"!=typeof e&&Ti(e),(e=e.trim())?t(e):null}}nr=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=dr(i),c=fr(i),d=dr(o),f=fr(o),p=dr(a),h=fr(a),m=dr(s),g=fr(s),v=dr(l),y=fr(l),_={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:Hr,g:Xr,G:Jr,H:Or,I:Ur,j:Rr,L:Ir,m:Br,M:Pr,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:bi,s:wi,S:zr,u:jr,U:Yr,V:qr,w:Wr,W:Gr,x:null,X:null,y:Vr,Y:Zr,Z:Kr,"%":_i},b={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:Qr,e:Qr,f:ii,g:mi,G:vi,H:ti,I:ei,j:ni,L:ri,m:oi,M:ai,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:bi,s:wi,S:si,u:li,U:ui,V:di,w:fi,W:pi,x:null,X:null,y:hi,Y:gi,Z:yi,"%":_i},w={a:function(t,e,n){var r=p.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=f[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:xr,e:xr,f:Dr,g:_r,G:yr,H:Er,I:Er,j:Ar,L:kr,m:Tr,M:Cr,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:wr,Q:Mr,s:Lr,S:Sr,u:hr,U:mr,V:gr,w:pr,W:vr,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:_r,Y:yr,Z:br,"%":Nr};function T(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=or[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 x(t,e){return function(n){var r,i,o=er(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=tr(er(o.y,0,1))).getUTCDay(),r=i>4||0===i?Wn.ceil(r):Wn(r),r=Yn.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Qn(er(o.y,0,1))).getDay(),r=i>4||0===i?Rn.ceil(r):Rn(r),r=Fn.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?tr(er(o.y,0,1)).getUTCDay():Qn(er(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,tr(o)):Qn(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 or?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return _.x=T(n,_),_.X=T(r,_),_.c=T(e,_),b.x=T(n,b),b.X=T(r,b),b.c=T(e,b),{format:function(t){var e=T(t+="",_);return e.toString=function(){return t},e},parse:function(t){var e=x(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=T(t+="",b);return e.toString=function(){return t},e},utcParse:function(t){var e=x(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"]}),nr.format,nr.parse,rr=nr.utcFormat,ir=nr.utcParse;var Ai=new Date(1972,3,27,19,45,5),Ei={"%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 Ci(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=ir(t),i=rr(t);return n=xi("function"==typeof e?function(t){return e(t,null!==r(t))}:function(t){return null!==r(t)}),Object.freeze({test:n,parse:xi((function(e){return r(e)||(Ei[t]?Ci(Ei[t])(e):null)})),format:function(t){return i(t)},type:"datetime",description:t,id:"datetime$"+t,example:i(Ai)})}var ki=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("%Y%m",(function(t,e){if(!e)return!1;var n=parseFloat(t.slice(0,4)),r=parseFloat(t.slice(4));return n>1e3&&r>0&&r<=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 ’%y"),Si("%B %-d %Y"),Si("%d %b",(function(t,e){return!!e||!!Ci(Ei["%d %b"])(t)})),Si("%d %B"),Si("%b %d",(function(t,e){return!!e||!!Ci(Ei["%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})),Si("%YM%m",(function(t,e){if(!e)return!1;var n=t.split("M").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12})),Si("%YQ%q",(function(t,e){if(!e)return!1;var n=t.split("Q").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=4})),Si("%YÁ%q",(function(t,e){if(!e)return!1;var n=t.split("Á").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=4}))]);function Di(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 Ni,Mi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Li(t){if(!(e=Mi.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 Oi(t,e){var n=Di(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")}Li.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 Ui={"%":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 Oi(100*t,e)},r:Oi,s:function(t,e){var n=Di(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Ni=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")+Di(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 Ri(t){return t}var Ii=Array.prototype.map,Hi=["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?Ri:(e=Ii.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?Ri:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Ii.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=Li(t)).fill,n=t.align,d=t.sign,f=t.symbol,p=t.zero,h=t.width,m=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(m=!0,y="g"):Ui[y]||(void 0===g&&(g=12),v=!0,y="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var _="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",b="$"===f?o:/[%p]/.test(y)?l:"",w=Ui[y],T=/[defgprs%]/.test(y);function x(t){var i,o,l,f=_,x=b;if("c"===y)x=w(t)+x,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),f=(A?"("===d?d:u:"-"===d||"("===d?"":d)+f,x=("s"===y?Hi[8+Ni/3]:"")+x+(A&&"("===d?")":""),T)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){x=(46===l?a+t.slice(i+1):t.slice(i))+x,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var E=f.length+t.length+x.length,C=E<h?new Array(h-E+1).join(e):"";switch(m&&p&&(t=r(C+t,C.length?h-x.length:1/0),C=""),n){case"<":t=f+t+x+C;break;case"=":t=f+C+t+x;break;case"^":t=C.slice(0,E=C.length>>1)+f+t+x+C.slice(E);break;default:t=C+f+t+x}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)),x.toString=function(){return t+""},x}return{format:d,formatPrefix:function(t,e){var n,r=d(((t=Li(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=Di(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),a=Hi[8+i/3];return function(t){return r(o*t)+a}}}}var Pi={test:xi((function(t){return/^(\+|-)?\d{1,3}(,\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:xi((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"},zi={test:xi((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:xi((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"},ji={test:xi((function(t){return/^(\+|-)?\d+(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:xi((function(t){return parseFloat(t)})),description:"No thousand separator, point decimal mark",thousand_separator:"",decimal_mark:".",id:"number$none_point",example:"12235.56"},Yi={test:xi((function(t){return/^(\+|-)?\d{1,3}(\.\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:xi((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"},$i={test:xi((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:xi((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"},qi={test:xi((function(t){return/^(\+|-)?\d+(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:xi((function(t){return parseFloat(t.replace(/,/,"."))})),description:"No thousand separator, comma decimal mark",thousand_separator:"",decimal_mark:",",id:"number$none_comma",example:"12235,56"},Wi=Object.freeze([Pi,zi,Yi,$i,ji,qi]);Wi.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 Gi,Vi=Object.freeze({test:function(t){return"string"==typeof t||Ti(t)},parse:function(t){return"string"==typeof t?t:Ti(t)},format:function(t){if("string"==typeof t)return t},type:"string",description:"Arbitrary string",id:"string$arbitrary_string"}),Xi=Object.freeze({datetime:ki,number:Wi}),Zi=Object.freeze(["datetime","number","string"]),Ji=Object.freeze({n_max:250,n_failing_values:0,failure_fraction:.05,sort:!0}),Ki=Object.freeze(Object.keys(Ji));function Qi(t,e){return t.index-e.index}function to(t,e){return e.n_success-t.n_success||Qi(t,e)}function eo(t){return(""+t).trim()}function no(t){return void 0===t?function(t){return eo(t)}:"function"==typeof t?function(e,n){return eo(t(e,n))}:function(e){return eo(e[""+t])}}function ro(t){t?Array.isArray(t)||(t=[t]):t=Zi;var e=t.reduce((function(t,e){var n=Xi[e];return n&&Array.prototype.push.apply(t,n),t}),[]),n=-1!==t.indexOf("string"),r=Ki.reduce((function(t,e){return t[e]=Ji[e],t}),{}),i=function(t,i){i=no(i);var o=t.map(i).filter(Boolean);if(!o.length)return n?[Vi]:[];var a=Math.min(r.n_max,o.length),s=Math.floor(a*r.failure_fraction),l=r.n_failing_values,u=r.sort?to:Qi,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(Vi),c};return Ki.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 io(t,e,n,r,i){var o=[],a=[],s=0,l=Object.assign([],{column_names:{},metadata:{},timestamps:{}}),u={};if(!r)return l;function c(t,e){if(!u[t])return{};var n=u[t];return n[e]?n[e]:{}}for(var d in n){var f={},p=n[d];if(p){for(var h=0;h<p.length;h++){var m=p[h].type_id,g=p[h].output_format_id,v=g&&"auto"!==g?g:m;f[p[h].index]={type_id:m,output_format_id:v}}u[d]=f}}var y,_,b,w=function(){if(null===t[T])return"continue";if(void 0===t[T].columns&&void 0===t[T].column)return"continue";if((y=t[T]).template_data_binding=r[T],y.key=T,!(y.data_table_id in e)){for(var n in _=[],e)_.push(n);return console.error("Data table id "+y.data_table_id+" not in "+JSON.stringify(_)),"continue"}var i=e[y.data_table_id];if(null==i)throw new Error("[BUG] The data from the data table with ID ".concat(y.data_table_id," was missing"));if(0==i.length)return console.warn("Empty data table"),"continue";if("columns"in y&&null!=y.columns)b=i[0].length,y.columns=y.columns.filter((function(t){return t<b})),l.column_names[T]=y.columns.map((function(t){return i[0][t]})),l.metadata[T]=y.columns.map((function(t){var e=c(y.data_table_id,t);if("type_id"in e){var n=e.type_id,r=e.output_format_id;return{type:n.split("$")[0],type_id:n,output_format_id:r}}return null}));else{if(!("column"in y)||null==y.column)throw new Error("Data binding includes no column(s) specification: "+JSON.stringify(y));l.column_names[T]=i[0][y.column];var u=c(y.data_table_id,y.column);if("type_id"in u){var d=u.type_id,f=u.output_format_id;l.metadata[T]={type:d.split("$")[0],type_id:d,output_format_id:f}}}-1==a.indexOf(y.data_table_id)&&(a.push(y.data_table_id),s=Math.max(s,i.length-1)),o.push(y)};for(var T in t)w();function x(t,e,n){var r;if(!(null===(r=t.template_data_binding)||void 0===r?void 0:r.data_type))return n;var i=function(t,e){var n=c(t,e);if("type_id"in n)return ro.getInterpretation(n.type_id)}(t.data_table_id,e);i&&"number"==i.type&&(n=(n||"").replace(/[€£$¥%º]/g,""));var o=i?i.parse(n):n;return Number.isNaN(o)&&(o=null),o}l.timestamps=function(t){var e={},n=t.map((function(t){var e;return null===(e=t.last_updated)||void 0===e?void 0:e.getTime()})).filter(Boolean);if(n.length){var r=Math.max.apply(Math,n);e.last_updated=new Date(r)}return e}(a.map((function(t){return i.per_data_table[t]})));for(var A=0;A<s;A++){for(var E={},C=function(){y=o[S];var t=e[y.data_table_id];if(null==t)throw new Error("[BUG] The data from the data table with ID ".concat(y.data_table_id," was missing"));if(A+1>=t.length)return"continue";if(null==y.key)throw new Error("BUG: 'key' was ".concat(y.key," in ").concat(y));"columns"in y&&null!=y.columns?E[y.key]=y.columns.filter((function(e){return e<t[A+1].length})).map((function(e){return x(y,e,t[A+1][e])})):"column"in y&&null!=y.column&&(y.column>=t[A+1].length?E[y.key]=x(y,y.column,""):E[y.key]=x(y,y.column,t[A+1][y.column]))},S=0;S<o.length;S++)C();l.push(E)}return l}function oo(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}ro.DATETIME_IDS=Object.freeze(ki.map((function(t){return t.id}))),ro.NUMBER_IDS=Object.freeze(Wi.map((function(t){return t.id}))),ro.STRING_IDS=Object.freeze([Vi.id]),ro.getInterpretation=(Gi=ki.concat(Wi,Vi).reduce((function(t,e){return t[e.id]=e,t}),{}),function(t){return Gi[t]}),ro._createAccessorFunction=no,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}),ro().nMax(1/0).nFailingValues(8).failureFraction(.1);let ao,so={};const lo=t=>{const e=Ht(".dialog");if(t.which in so){var n=so[t.which];n.callback&&n.callback(ao.node().value),e.remove(),t.preventDefault()}};function uo(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,footer:l=null}={}){var u=Ht("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(),u.remove())})),c=u.append("div").attr("class","dialog-inner").style("width",a).on("click",(function(t){t.stopPropagation()})),d=c.append("div").attr("class","text"+(o?" loading":""));if("string"==typeof t?d.append("h1").text(t):t instanceof HTMLElement&&d.append("h1").append((()=>t)),"string"==typeof e)ao=r?d.append("div").classed("loading-spinner",o).html(e):d.append("p").text(e);else if(e instanceof HTMLElement)ao=d.append((()=>e));else if("object"==typeof e){if(ao=d.append(e.type),e.value&&(ao.node().value=e.value),e.attributes)for(var f in e.attributes)ao.attr(f,e.attributes[f]);ao.node().focus()}var p=c;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 h=p.append("div").attr("class","btns"+(o?" loading":""));if(so={},n.forEach((function(t){var e=h.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(ao.node().value,u),u.remove()}));t.class&&e.classed(t.class,!0),t.keyCode&&(so[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)})),u.node().addEventListener("keydown",lo),u.node().focus(),l){const t=c.append("div").attr("class","dialog-footer");"string"==typeof l?t.html(l):l instanceof HTMLElement&&t.append((()=>l))}return u}const co={allow_other_option:!1,match_anywhere:!1,custom_renderer:null,autocomplete:!0};function fo({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(ho),this.selected_options=[],this.options_config={...co,...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 po(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 ho(t){return Array.isArray(t)?t.map(String):[String(t),String(t)]}fo.prototype.setSelectedOptions=function(t){this.selected_options=Array.isArray(t)?t:[t],this.updateInput()},fo.prototype.setOptions=function(t){this.options=t.map(ho),this.autocomplete.renderOptions()},fo.prototype.select=function(t){"multi"==this.mode?this.selected_options.push(t):this.selected_options=[t],this.updateInput()},fo.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()}},fo.prototype.getValue=function(t){var e=po(this).map((t=>t[1]));return"multi"===this.mode?t?e.join(", "):e:e[0]},fo.prototype.getOptions=function(){return this.options},fo.prototype.getDisplayValue=function(){return po(this).map((t=>t[0])).join(", ")},fo.prototype.updateInput=function(){this.input.value=this.getDisplayValue(),this.input.setAttribute("data-value",this.getValue(!0))},fo.prototype.isSelected=function(t){return this.selected_options.includes(t)},fo.prototype.onChange=function(t){this.changeCallback=t};fo.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=Bt("i").classed("fa fa-chevron-down clickable",!0),e=Bt("div").classed("dropdown autocomplete",!0).attr("id",this.id);n.insertAdjacentHTML("afterend",t.node().outerHTML+e.node().outerHTML)}var r=[],i=Ht(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=Ht(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");Ht(r).classed("current")&&"multi"===t.mode?t.deselect(i):t.select(i),l(),Ht(n).dispatch("change")}else e.preventDefault()}return i.on("mousedown",(function(t){u(t,t.target)})),Ht(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),Ht(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),Ht(r).classed("selected",!0))})).on("input.autocomplete",(function(){var r,i,o=n.value,a=o.toLowerCase(),l=!1,u=t.options;if(Ht(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 mo={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"}};ro.STRING_IDS[0];var go={ALLOWED_TAGS:["p","b","i","em","strong","a","br","span","ul","ol","li","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","th","td"],ALLOWED_ATTR:["class","id","href","title","target","colspan","rowspan"],FORBID_TAGS:["form","input","button","iframe","script","style"],FORBID_ATTR:["action","formaction","on*","srcset"],ALLOWED_URI_REGEXP:/^(?:(?:f|ht)tps?|mailto|tel|callto|sms):/i,ADD_ATTR:[],ADD_TAGS:[],ALLOW_ARIA_ATTR:!1,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1,FORCE_BODY:!1,KEEP_CONTENT:!0,RETURN_DOM:!1,RETURN_DOM_FRAGMENT:!1,SANITIZE_DOM:!0},vo=[{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"}],yo={},_o={};let bo,wo,To,xo=0;function Ao(t,e){xo=0;let n=!1;t.template_id&&t.dataTables((function(r,i){if(r)return console.error("Failed to get data tables: "+r);_o={};const o=t.dataBindingsForCurrentTemplate(),a=t.getDataTableNames(),s=Ht(".sheet-tab.selected").size()>0?Ht(".sheet-tab.selected").datum().id:null;wo.html("");let l=null;"string"!=typeof e[0]&&(e=["Data"].concat(e));const u=[];let c;for(let t=0;t<e.length;t++){const n=e[t],r=e[t-1],i=!(!r||"string"==typeof r||r.dataset===n.dataset),s=(n.columns||n.column||"").split("::")[0],l="string"==typeof n;if((l||i)&&(void 0!==c&&u.push(c),c={title:l?n:s,description:null,bindings:[],template_sheet:null,visualisation_sheet:null}),l){if(t<e.length-1){const n=e[t+1];"string"==typeof n&&(c.description=n,t+=1)}}else{if(null===c.template_sheet&&s)for(const t in a)if(a[t]===s){c.template_sheet=+t;break}if(null===c.visualisation_sheet){const t=o[n.dataset]&&o[n.dataset][n.key];t&&(c.visualisation_sheet=t.data_table_id)}c.bindings.push(n),t===e.length-1&&u.push(c)}}for(let t=0;t<u.length;t++){const e=u[t],r=e.bindings,c=e.visualisation_sheet||e.template_sheet||i[0].id;l=wo.append("div").attr("class","data-block").attr("data-sheet",a[c]).style("display",c===s?null:"none");const d=l.append("h2").attr("class","no-select");d.append("i").attr("class","fa fa-table"),d.append("span").text(" "+e.title),e.description&&l.append("p").text(e.description);const f=l.append("div").attr("class","data-bindings-header");f.append("p").attr("class","data-bindings-title").text("Select columns to visualise");for(let t=0;t<r.length;t++){const e=r[t];e.data_type&&(n=!0);const i=o[e.dataset]&&o[e.dataset][e.key],u=i?i.data_table_id:c;_o[e.dataset]||(_o[e.dataset]={}),_o[e.dataset][e.key]=u;u!==c&&u===s&&l.style("display",null);Eo(l.append("div"),e,i,a,u!==s)}n&&f.append("p").attr("class","data-bindings-reset clickable").html("<i class='fa fa-magic'></i> <span style='text-decoration: underline'>Auto set columns</span>").on("click",(function(){uo("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(){bo.spreadsheet.inferDataBindings()}},{text:"Cancel",keyCode:27,class:"secondary"}]})}))}bo.spreadsheet&&(bo.spreadsheet.updateHighlights(),bo.spreadsheet.updateTabs())}))}function Eo(t,e,n,r,i){vo[xo]||(xo=0),t.attr("class","settings-option option-type-"+e.type).style("display",i?"none":null);const o=void 0===n?"":Sn(n,0,0,e.optional);yo[e.dataset]||(yo[e.dataset]={}),yo[e.dataset][e.key]=xo;const a="column"===e.type&&!e.optional,s=a&&!n;t.classed("empty-required-binding",s);const l=t.append("div").attr("class","data-binding-title").on("click",(function(){Ht(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",!bo.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(){un.hide(),function(t,e){const 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;const o=t.getBoundingClientRect(),a=[o.left-5,o.top+.5*o.height];let s;if(t.value||"column"!==i.type){try{s=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=wn(o,t.optional);else{if("columns"!=t.type)throw new Error("Unknown data binding type: "+t.type);n.columns=En(o)}return n}(i,bo.visualisation.getDataTableIds());const n=Sn(s,bo.visualisation.getDataTableNames(),0,e.optional);t.value.toUpperCase()!==n&&(t.value=n)}catch(e){return console.error("Failed to parse data binding",e),un.point(a).text(e.message).draw(),t.value=t.getAttribute("data-value"),void(To=!0)}if(Ht(t.parentElement.parentElement).classed("empty-required-binding",!1),!s.data_table_id)return t.value=t.getAttribute("data-value"),un.point(a).text("No such data table").draw(),void(To=!0);if(e.data_type){const n=bo.spreadsheet.getTypeAnnotatedColumns();if("column"===i.type){const r=n[s.column];if(!r)return un.point(a).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(To=!0);if(So(e,r))return t.value=t.getAttribute("data-value"),un.point(a).html(`\n\t\t\t\t\t\t<span class="popup-content-header">This column selection does not accept ${ko([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;">${ko(e.data_type)}</div>\n\t\t\t\t\t`).draw(),void(To=!0)}else{const r=n.filter((t=>s.columns.includes(t.index))).filter((t=>So(e,t)));if(r.length){t.value=t.getAttribute("data-value");const n=r.map((t=>t.type)).reduce(((t,e)=>t.includes(e)?t:[...t,e]),[]),i=n.reduce(((t,e,n,r)=>1===r.length?ko([e]):(n<r.length-1?t+=`${n>0?",":""} ${ko([e])}`:t+=`or ${ko([e])}`,t)),"");return un.point(a).html(`\n\t\t\t\t\t\t<span class="popup-content-header">This column selection does not accept ${i} 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;">${ko(e.data_type)}</div>\n\t\t\t\t\t`).draw(),void(To=!0)}}}}else if(s=null,!e.optional)return t.value=t.getAttribute("data-value"),un.point(a).text("This column selection is required").draw(),void(To=!0);bo.spreadsheet.updateTabs();const l={};l[e.dataset]={},l[e.dataset][e.key]=s,Co(l,(function(){t.setAttribute("data-value",t.value);const e=Do();e?(Ht(".publish-btn").classed("disabled",!0),Ht(".republish-btn").classed("disabled",!0),Pt(".download-btn").classed("disabled",!0),Ht("body").classed("impossible",!0)):(Ht(".publish-btn").classed("disabled",!1),Ht(".republish-btn").classed("disabled",!1),Pt(".download-btn").classed("disabled",!1),Ht("body").classed("impossible",!1),bo.visualisation.getState((function(t){bo.visualisation.prepareData((function(e,n){e?console.error("Failed to prepare data for template"):bo.preview_pane.getDrawCalled()?bo.preview_pane.sync({data:n,state:t,update:!0}):(bo.preview_pane.sync({data:n,state:t,draw:!0}),bo.preview_pane.setDrawCalled(!0))}))}))),bo.spreadsheet&&bo.spreadsheet.updateHighlights(),bo.template_settings&&(e?bo.template_settings.setReadOnly():bo.template_settings.unsetReadOnly(),bo.template_settings.populate()),bo.theme_chooser.enableOrDisable()}))}(this,t)})).on("keydown",(function(){bo.confirm.blank()})).on("focus",(function(){To||un.hide(),To=!1,Pt(".data-bindings .settings-option").classed("open",!1),Ht(this.parentElement.parentElement).classed("open",!0)}))}}(e)).style("background",vo[xo].light).style("border-color",vo[xo].full),s&&bo.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.");const u=t.append("div").attr("class","data-binding-description");let c;if(e.description&&u.append("p").html(Ke.sanitize(e.description,go)),e.data_type){const t=u.append("div").attr("class","data-binding-data-types");t.append("p").text("Accepted column types");const n=Array.isArray(e.data_type)?e.data_type:[e.data_type];for(let e=0;e<n.length;e++)c="string"==typeof n[e]?n[e]:n[e].type,t.append("span").attr("class","type-symbol data-binding-type-symbol").attr("title",mo[c].text+" column.").style("background-image","url("+mo[c].symbol+")")}xo++}function Co(t,e){bo.confirm.saving(),bo.visualisation.updateDataBindings(t,(function(t){if(t)return bo.confirm.error(t),console.error("Failed to save data binding:",t),void bo.analytics("event","exception",{description:t.message||t,fatal:!0});bo.analytics("event","visualisation",{change_data_binding:bo.visualisation.id}),bo.confirm.saved(),No(),e&&e()}))}function So(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 ko(t){return t.map((t=>`\n\t\t<span class="column-type">\n\t\t<span class="type-symbol" title="${mo[t].text} column" style="background-image: url(${mo[t].symbol});"></span>\n\t\t<h2>${mo[t].text}</h2>\n\t\t</span>\n\t\t`)).join("")}function Do(){const t=bo.visualisation.dataBindingsForCurrentTemplate(),e=bo.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 No(t=!0){if(Do())Ht("body").classed("impossible",!0),Ht(".empty-label").html("<i class='fa fa-exclamation-triangle'></i> Oops! It looks like one of the required column selections is empty."),Ht(".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(Ht("body").classed("impossible")){const e=bo.visualisation?bo.visualisation:bo.story;e.status&&e.status.requested_by?bo.confirm_published.awaitingReview(e.status,e.can_review,bo.user):bo.visualisation.embed_url&&t?bo.confirm_published.edited():(bo.confirm_published.unpublished(),Ht("body").classed("impossible",!1),Ht(".empty-label").text(""),Ht(".empty-details").text(""))}}var Mo=!1;function Lo(t){if(Mo&&window.top!==window.self){var e=window;"srcdoc"===e.location.pathname&&(e=e.parent);var n=function(){var t={};return window._Flourish_template_id&&(t.template_id=window._Flourish_template_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_template_id&&(t.template_id=window.Flourish.app.loaded_template_id),window._Flourish_visualisation_id&&(t.visualisation_id=window._Flourish_visualisation_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_visualisation&&(t.visualisation_id=window.Flourish.app.loaded_visualisation.id),window.Flourish&&window.Flourish.app&&window.Flourish.app.story&&(t.story_id=window.Flourish.app.story.id,t.slide_count=window.Flourish.app.story.slides.length),window.Flourish&&window.Flourish.app&&window.Flourish.app.current_slide&&(t.slide_index=window.Flourish.app.current_slide.index+1),t}(),r={sender:"Flourish",method:"customerAnalytics"};for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i]);for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);e.parent.postMessage(JSON.stringify(r),"*")}}function Fo(t){if("function"!=typeof t)throw new Error("Analytics callback is not a function");window.Flourish._analytics_listeners.push(t)}function Oo(){Mo=!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(){Lo({action:t.action_name})}),t.use_capture)}))}
3
- /*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */const{entries:Uo,setPrototypeOf:Ro,isFrozen:Io,getPrototypeOf:Ho,getOwnPropertyDescriptor:Bo}=Object;let{freeze:Po,seal:zo,create:jo}=Object,{apply:Yo,construct:$o}="undefined"!=typeof Reflect&&Reflect;Po||(Po=function(t){return t}),zo||(zo=function(t){return t}),Yo||(Yo=function(t,e,n){return t.apply(e,n)}),$o||($o=function(t,e){return new t(...e)});const qo=oa(Array.prototype.forEach),Wo=oa(Array.prototype.lastIndexOf),Go=oa(Array.prototype.pop),Vo=oa(Array.prototype.push),Xo=oa(Array.prototype.splice),Zo=oa(String.prototype.toLowerCase),Jo=oa(String.prototype.toString),Ko=oa(String.prototype.match),Qo=oa(String.prototype.replace),ta=oa(String.prototype.indexOf),ea=oa(String.prototype.trim),na=oa(Object.prototype.hasOwnProperty),ra=oa(RegExp.prototype.test),ia=function(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return $o(t,n)}}(TypeError);function oa(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Yo(t,e,r)}}function aa(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Zo;Ro&&Ro(t,null);let r=e.length;for(;r--;){let i=e[r];if("string"==typeof i){const t=n(i);t!==i&&(Io(e)||(e[r]=t),i=t)}t[i]=!0}return t}function sa(t){for(let e=0;e<t.length;e++){na(t,e)||(t[e]=null)}return t}function la(t){const e=jo(null);for(const[n,r]of Uo(t)){na(t,n)&&(Array.isArray(r)?e[n]=sa(r):r&&"object"==typeof r&&r.constructor===Object?e[n]=la(r):e[n]=r)}return e}function ua(t,e){for(;null!==t;){const n=Bo(t,e);if(n){if(n.get)return oa(n.get);if("function"==typeof n.value)return oa(n.value)}t=Ho(t)}return function(){return null}}const ca=Po(["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"]),da=Po(["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"]),fa=Po(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),pa=Po(["animate","color-profile","cursor","discard","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"]),ha=Po(["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","mprescripts"]),ma=Po(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ga=Po(["#text"]),va=Po(["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","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","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","wrap","xmlns","slot"]),ya=Po(["accent-height","accumulate","additive","alignment-baseline","amplitude","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","exponent","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","intercept","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","slope","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","tablevalues","targetx","targety","transform","transform-origin","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"]),_a=Po(["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"]),ba=Po(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),wa=zo(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ta=zo(/<%[\w\W]*|[\w\W]*%>/gm),xa=zo(/\$\{[\w\W]*/gm),Aa=zo(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ea=zo(/^aria-[\-\w]+$/),Ca=zo(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Sa=zo(/^(?:\w+script|data):/i),ka=zo(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Da=zo(/^html$/i),Na=zo(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ma=Object.freeze({__proto__:null,ARIA_ATTR:Ea,ATTR_WHITESPACE:ka,CUSTOM_ELEMENT:Na,DATA_ATTR:Aa,DOCTYPE_NAME:Da,ERB_EXPR:Ta,IS_ALLOWED_URI:Ca,IS_SCRIPT_OR_DATA:Sa,MUSTACHE_EXPR:wa,TMPLIT_EXPR:xa});const La=1,Fa=3,Oa=7,Ua=8,Ra=9,Ia=function(){return"undefined"==typeof window?null:window};var Ha,Ba,Pa,za,ja,Ya,$a,qa,Wa,Ga=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ia();const n=e=>t(e);if(n.version="3.2.4",n.removed=[],!e||!e.document||e.document.nodeType!==Ra||!e.Element)return n.isSupported=!1,n;let{document:r}=e;const i=r,o=i.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:u,NodeFilter:c,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=e,m=u.prototype,g=ua(m,"cloneNode"),v=ua(m,"remove"),y=ua(m,"nextSibling"),_=ua(m,"childNodes"),b=ua(m,"parentNode");if("function"==typeof s){const t=r.createElement("template");t.content&&t.content.ownerDocument&&(r=t.content.ownerDocument)}let w,T="";const{implementation:x,createNodeIterator:A,createDocumentFragment:E,getElementsByTagName:C}=r,{importNode:S}=i;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Uo&&"function"==typeof b&&x&&void 0!==x.createHTMLDocument;const{MUSTACHE_EXPR:D,ERB_EXPR:N,TMPLIT_EXPR:M,DATA_ATTR:L,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:O,ATTR_WHITESPACE:U,CUSTOM_ELEMENT:R}=Ma;let{IS_ALLOWED_URI:I}=Ma,H=null;const B=aa({},[...ca,...da,...fa,...ha,...ga]);let P=null;const z=aa({},[...va,...ya,..._a,...ba]);let j=Object.seal(jo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Y=null,$=null,q=!0,W=!0,G=!1,V=!0,X=!1,Z=!0,J=!1,K=!1,Q=!1,tt=!1,et=!1,nt=!1,rt=!0,it=!1,ot=!0,at=!1,st={},lt=null;const ut=aa({},["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"]);let ct=null;const dt=aa({},["audio","video","img","source","image","track"]);let ft=null;const pt=aa({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ht="http://www.w3.org/1998/Math/MathML",mt="http://www.w3.org/2000/svg",gt="http://www.w3.org/1999/xhtml";let vt=gt,yt=!1,_t=null;const bt=aa({},[ht,mt,gt],Jo);let wt=aa({},["mi","mo","mn","ms","mtext"]),Tt=aa({},["annotation-xml"]);const xt=aa({},["title","style","font","a","script"]);let At=null;const Et=["application/xhtml+xml","text/html"];let Ct=null,St=null;const kt=r.createElement("form"),Dt=function(t){return t instanceof RegExp||t instanceof Function},Nt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!St||St!==t){if(t&&"object"==typeof t||(t={}),t=la(t),At=-1===Et.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Ct="application/xhtml+xml"===At?Jo:Zo,H=na(t,"ALLOWED_TAGS")?aa({},t.ALLOWED_TAGS,Ct):B,P=na(t,"ALLOWED_ATTR")?aa({},t.ALLOWED_ATTR,Ct):z,_t=na(t,"ALLOWED_NAMESPACES")?aa({},t.ALLOWED_NAMESPACES,Jo):bt,ft=na(t,"ADD_URI_SAFE_ATTR")?aa(la(pt),t.ADD_URI_SAFE_ATTR,Ct):pt,ct=na(t,"ADD_DATA_URI_TAGS")?aa(la(dt),t.ADD_DATA_URI_TAGS,Ct):dt,lt=na(t,"FORBID_CONTENTS")?aa({},t.FORBID_CONTENTS,Ct):ut,Y=na(t,"FORBID_TAGS")?aa({},t.FORBID_TAGS,Ct):{},$=na(t,"FORBID_ATTR")?aa({},t.FORBID_ATTR,Ct):{},st=!!na(t,"USE_PROFILES")&&t.USE_PROFILES,q=!1!==t.ALLOW_ARIA_ATTR,W=!1!==t.ALLOW_DATA_ATTR,G=t.ALLOW_UNKNOWN_PROTOCOLS||!1,V=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,X=t.SAFE_FOR_TEMPLATES||!1,Z=!1!==t.SAFE_FOR_XML,J=t.WHOLE_DOCUMENT||!1,tt=t.RETURN_DOM||!1,et=t.RETURN_DOM_FRAGMENT||!1,nt=t.RETURN_TRUSTED_TYPE||!1,Q=t.FORCE_BODY||!1,rt=!1!==t.SANITIZE_DOM,it=t.SANITIZE_NAMED_PROPS||!1,ot=!1!==t.KEEP_CONTENT,at=t.IN_PLACE||!1,I=t.ALLOWED_URI_REGEXP||Ca,vt=t.NAMESPACE||gt,wt=t.MATHML_TEXT_INTEGRATION_POINTS||wt,Tt=t.HTML_INTEGRATION_POINTS||Tt,j=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&Dt(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(j.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&Dt(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(j.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(j.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(W=!1),et&&(tt=!0),st&&(H=aa({},ga),P=[],!0===st.html&&(aa(H,ca),aa(P,va)),!0===st.svg&&(aa(H,da),aa(P,ya),aa(P,ba)),!0===st.svgFilters&&(aa(H,fa),aa(P,ya),aa(P,ba)),!0===st.mathMl&&(aa(H,ha),aa(P,_a),aa(P,ba))),t.ADD_TAGS&&(H===B&&(H=la(H)),aa(H,t.ADD_TAGS,Ct)),t.ADD_ATTR&&(P===z&&(P=la(P)),aa(P,t.ADD_ATTR,Ct)),t.ADD_URI_SAFE_ATTR&&aa(ft,t.ADD_URI_SAFE_ATTR,Ct),t.FORBID_CONTENTS&&(lt===ut&&(lt=la(lt)),aa(lt,t.FORBID_CONTENTS,Ct)),ot&&(H["#text"]=!0),J&&aa(H,["html","head","body"]),H.table&&(aa(H,["tbody"]),delete Y.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw ia('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw ia('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=t.TRUSTED_TYPES_POLICY,T=w.createHTML("")}else void 0===w&&(w=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";e&&e.hasAttribute(r)&&(n=e.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(h,o)),null!==w&&"string"==typeof T&&(T=w.createHTML(""));Po&&Po(t),St=t}},Mt=aa({},[...da,...fa,...pa]),Lt=aa({},[...ha,...ma]),Ft=function(t){Vo(n.removed,{element:t});try{b(t).removeChild(t)}catch(e){v(t)}},Ot=function(t,e){try{Vo(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){Vo(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(tt||et)try{Ft(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Ut=function(t){let e=null,n=null;if(Q)t="<remove></remove>"+t;else{const e=Ko(t,/^[\r\n\t ]+/);n=e&&e[0]}"application/xhtml+xml"===At&&vt===gt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const i=w?w.createHTML(t):t;if(vt===gt)try{e=(new p).parseFromString(i,At)}catch(t){}if(!e||!e.documentElement){e=x.createDocument(vt,"template",null);try{e.documentElement.innerHTML=yt?T:i}catch(t){}}const o=e.body||e.documentElement;return t&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),vt===gt?C.call(e,J?"html":"body")[0]:J?e.documentElement:o},Rt=function(t){return A.call(t.ownerDocument||t,t,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},It=function(t){return 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||"function"!=typeof t.hasChildNodes)},Ht=function(t){return"function"==typeof l&&t instanceof l};function Bt(t,e,r){qo(t,(t=>{t.call(n,e,r,St)}))}const Pt=function(t){let e=null;if(Bt(k.beforeSanitizeElements,t,null),It(t))return Ft(t),!0;const r=Ct(t.nodeName);if(Bt(k.uponSanitizeElement,t,{tagName:r,allowedTags:H}),t.hasChildNodes()&&!Ht(t.firstElementChild)&&ra(/<[/\w]/g,t.innerHTML)&&ra(/<[/\w]/g,t.textContent))return Ft(t),!0;if(t.nodeType===Oa)return Ft(t),!0;if(Z&&t.nodeType===Ua&&ra(/<[/\w]/g,t.data))return Ft(t),!0;if(!H[r]||Y[r]){if(!Y[r]&&jt(r)){if(j.tagNameCheck instanceof RegExp&&ra(j.tagNameCheck,r))return!1;if(j.tagNameCheck instanceof Function&&j.tagNameCheck(r))return!1}if(ot&&!lt[r]){const e=b(t)||t.parentNode,n=_(t)||t.childNodes;if(n&&e){for(let r=n.length-1;r>=0;--r){const i=g(n[r],!0);i.__removalCount=(t.__removalCount||0)+1,e.insertBefore(i,y(t))}}}return Ft(t),!0}return t instanceof u&&!function(t){let e=b(t);e&&e.tagName||(e={namespaceURI:vt,tagName:"template"});const n=Zo(t.tagName),r=Zo(e.tagName);return!!_t[t.namespaceURI]&&(t.namespaceURI===mt?e.namespaceURI===gt?"svg"===n:e.namespaceURI===ht?"svg"===n&&("annotation-xml"===r||wt[r]):Boolean(Mt[n]):t.namespaceURI===ht?e.namespaceURI===gt?"math"===n:e.namespaceURI===mt?"math"===n&&Tt[r]:Boolean(Lt[n]):t.namespaceURI===gt?!(e.namespaceURI===mt&&!Tt[r])&&!(e.namespaceURI===ht&&!wt[r])&&!Lt[n]&&(xt[n]||!Mt[n]):!("application/xhtml+xml"!==At||!_t[t.namespaceURI]))}(t)?(Ft(t),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!ra(/<\/no(script|embed|frames)/i,t.innerHTML)?(X&&t.nodeType===Fa&&(e=t.textContent,qo([D,N,M],(t=>{e=Qo(e,t," ")})),t.textContent!==e&&(Vo(n.removed,{element:t.cloneNode()}),t.textContent=e)),Bt(k.afterSanitizeElements,t,null),!1):(Ft(t),!0)},zt=function(t,e,n){if(rt&&("id"===e||"name"===e)&&(n in r||n in kt))return!1;if(W&&!$[e]&&ra(L,e));else if(q&&ra(F,e));else if(!P[e]||$[e]){if(!(jt(t)&&(j.tagNameCheck instanceof RegExp&&ra(j.tagNameCheck,t)||j.tagNameCheck instanceof Function&&j.tagNameCheck(t))&&(j.attributeNameCheck instanceof RegExp&&ra(j.attributeNameCheck,e)||j.attributeNameCheck instanceof Function&&j.attributeNameCheck(e))||"is"===e&&j.allowCustomizedBuiltInElements&&(j.tagNameCheck instanceof RegExp&&ra(j.tagNameCheck,n)||j.tagNameCheck instanceof Function&&j.tagNameCheck(n))))return!1}else if(ft[e]);else if(ra(I,Qo(n,U,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==ta(n,"data:")||!ct[t]){if(G&&!ra(O,Qo(n,U,"")));else if(n)return!1}else;return!0},jt=function(t){return"annotation-xml"!==t&&Ko(t,R)},Yt=function(t){Bt(k.beforeSanitizeAttributes,t,null);const{attributes:e}=t;if(!e||It(t))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:P,forceKeepAttr:void 0};let i=e.length;for(;i--;){const o=e[i],{name:a,namespaceURI:s,value:l}=o,u=Ct(a);let c="value"===a?l:ea(l);if(r.attrName=u,r.attrValue=c,r.keepAttr=!0,r.forceKeepAttr=void 0,Bt(k.uponSanitizeAttribute,t,r),c=r.attrValue,!it||"id"!==u&&"name"!==u||(Ot(a,t),c="user-content-"+c),Z&&ra(/((--!?|])>)|<\/(style|title)/i,c)){Ot(a,t);continue}if(r.forceKeepAttr)continue;if(Ot(a,t),!r.keepAttr)continue;if(!V&&ra(/\/>/i,c)){Ot(a,t);continue}X&&qo([D,N,M],(t=>{c=Qo(c,t," ")}));const d=Ct(t.nodeName);if(zt(d,u,c)){if(w&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(d,u)){case"TrustedHTML":c=w.createHTML(c);break;case"TrustedScriptURL":c=w.createScriptURL(c)}try{s?t.setAttributeNS(s,a,c):t.setAttribute(a,c),It(t)?Ft(t):Go(n.removed)}catch(t){}}}Bt(k.afterSanitizeAttributes,t,null)},$t=function t(e){let n=null;const r=Rt(e);for(Bt(k.beforeSanitizeShadowDOM,e,null);n=r.nextNode();)Bt(k.uponSanitizeShadowNode,n,null),Pt(n),Yt(n),n.content instanceof a&&t(n.content);Bt(k.afterSanitizeShadowDOM,e,null)};return n.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,s=null,u=null;if(yt=!t,yt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!Ht(t)){if("function"!=typeof t.toString)throw ia("toString is not a function");if("string"!=typeof(t=t.toString()))throw ia("dirty is not a string, aborting")}if(!n.isSupported)return t;if(K||Nt(e),n.removed=[],"string"==typeof t&&(at=!1),at){if(t.nodeName){const e=Ct(t.nodeName);if(!H[e]||Y[e])throw ia("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof l)r=Ut("\x3c!----\x3e"),o=r.ownerDocument.importNode(t,!0),o.nodeType===La&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!tt&&!X&&!J&&-1===t.indexOf("<"))return w&&nt?w.createHTML(t):t;if(r=Ut(t),!r)return tt?null:nt?T:""}r&&Q&&Ft(r.firstChild);const c=Rt(at?t:r);for(;s=c.nextNode();)Pt(s),Yt(s),s.content instanceof a&&$t(s.content);if(at)return t;if(tt){if(et)for(u=E.call(r.ownerDocument);r.firstChild;)u.appendChild(r.firstChild);else u=r;return(P.shadowroot||P.shadowrootmode)&&(u=S.call(i,u,!0)),u}let d=J?r.outerHTML:r.innerHTML;return J&&H["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&ra(Da,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),X&&qo([D,N,M],(t=>{d=Qo(d,t," ")})),w&&nt?w.createHTML(d):d},n.setConfig=function(){Nt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),K=!0},n.clearConfig=function(){St=null,K=!1},n.isValidAttribute=function(t,e,n){St||Nt({});const r=Ct(t),i=Ct(e);return zt(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&Vo(k[t],e)},n.removeHook=function(t,e){if(void 0!==e){const n=Wo(k[t],e);return-1===n?void 0:Xo(k[t],n,1)[0]}return Go(k[t])},n.removeHooks=function(t){k[t]=[]},n.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function Va(){if(null==Ha){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}();Ha="referrer"in t?/^https:\/\/medium.com\//.test(t.referrer):!("auto"in t)}return Ha}function Xa(t){var e=t||window.innerWidth;return e>999?650:e>599?575:400}function Za(t){if(t&&window.top!==window.self){var e=window;"srcdoc"==e.location.pathname&&(e=e.parent);var n={sender:"Flourish",method:"scrolly",captions:t.captions,hasScrollyTransformFix:t.hasScrollyTransformFix};e.parent.postMessage(JSON.stringify(n),"*")}}function Ja(t,e){if(window.top!==window.self){var n=window;if("srcdoc"==n.location.pathname&&(n=n.parent),Ba)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 Ka(){return(-1!==navigator.userAgent.indexOf("Safari")||-1!==navigator.userAgent.indexOf("iPhone"))&&-1==navigator.userAgent.indexOf("Chrome")}function Qa(t){return"string"==typeof t||t instanceof String}function ts(t){return"warn"!==t.method?(console.warn("BUG: validateWarnMessage called for method"+t.method),!1):!(null!=t.message&&!Qa(t.message))&&!(null!=t.explanation&&!Qa(t.explanation))}function es(t){return"resize"!==t.method?(console.warn("BUG: validateResizeMessage called for method"+t.method),!1):!!Qa(t.src)&&(!!Qa(t.context)&&!!("number"==typeof(e=t.height)?!isNaN(e)&&e>=0:Qa(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 ns(t){throw new Error("Validation for setSetting is not implemented yet; see issue #4328")}function rs(t){return"scrolly"!==t.method?(console.warn("BUG: validateScrolly called for method"+t.method),!1):!!Array.isArray(t.captions)}function is(t){return"customerAnalytics"===t.method||(console.warn("BUG: validateCustomerAnalyticsMessage called for method"+t.method),!1)}function os(t){return"request-upload"!==t.method?(console.warn("BUG: validateResizeMessage called for method"+t.method),!1):!!Qa(t.name)&&!(null!=t.accept&&!Qa(t.accept))}function as(t,e,n){var r=function(t){for(var e={warn:ts,resize:es,setSetting:ns,customerAnalytics:is,"request-upload":os,scrolly:rs},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)}})),Ka()&&(window.addEventListener("resize",ss),ss())}function ss(){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 ls(t,e,n){var r=t.parentNode;if(r.classList.contains("fl-scrolly-wrapper"))return void console.warn("createScrolly is being called more than once per story. This should not happen.");r.classList.add("fl-scrolly-wrapper"),r.style.position="relative",r.style.paddingBottom="1px",r.style.transform="translate3d(0, 0, 0)";const i=navigator.platform.indexOf("Win")>-1,o=!!window.chrome&&(navigator.userAgent.indexOf("Chrome")>-1||navigator.userAgent.indexOf("Edg")>-1||navigator.userAgent.indexOf("OPR")>-1);if(i&&o&&n){let t,e=0;window.addEventListener("scroll",(function(){clearTimeout(t),t=setTimeout((()=>{e=0===e?1:0,r.style.transform=`translateZ(${e}px)`}),100)}))}t.style.position="sticky";var a=r.getAttribute("data-height")||null;a||(a="80vh",t.style.height=a),t.style.top="calc(50vh - "+a+"/2)";var s=r.querySelector(".flourish-credit");s&&(s.style.position="sticky",s.style.top="calc(50vh + "+a+"/2)"),e.forEach((function(t,e){var n="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=n?"100vh":"50vh",i.style.marginLeft="auto",i.style.marginRight="auto";var o=document.createElement("div");o.innerHTML=Ga.sanitize(t,{ADD_ATTR:["target"]}),o.style.visibility=n?"":"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),r.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%"}))}(r)}function us(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)cs(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||(cs(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 cs(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:Ka()?n.style.width=e.offsetWidth+"px":n.style.width="100%",!!i||(t.match(/\?/)?t+="&auto=1":t+="?auto=1",i=Xa(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 ds(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=Object.create(null));var r=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}([],e,!0);for(var i in t){r.push(i);var o=t[i];"object"==typeof o&&ds(o,r,n),n[r.join(".")]=t[i],r.pop()}return n}function fs(t){var e=Object.create(null);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]=Object.create(null)),r=r[a]}r[n.substring(o)]=t[n]}return e}function ps(t){if(null==t)return t;var e,n=Object.create(null);for(var r in t){var i=t[r];Array.isArray(i)?n[r]=i.slice():(e=t[r],Array.isArray(e)||"object"!=typeof e||null==e?n[r]=t[r]:n[r]=ps(t[r]))}return n}"function"==typeof SuppressedError&&SuppressedError;var hs,ms=null;function gs(){return"MessageChannel"in window}var vs=null;function ys(){vs&&Pa.removeEventListener("load",vs),vs=null}function _s(t){ys(),Pa.addEventListener("load",t),vs=t}function bs(t,e,n){return Ps(!1),Wa=t?t.visualisation?t.visualisation:t.current_slide.visualisation:null,ms=null,Wa&&Wa.template_id?(_s(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(){jt(),!Wa||Wa.template_id!=r||t.current_slide&&t.current_slide.id!==i||(ys(),ks((function(o,a){o?console.error("Failed to get default state"):!Wa||Wa.template_id!=r||t.current_slide&&t.current_slide.id!==i||Ds((function(o,s){if(o)console.error("Failed to call hasData");else if(Wa&&Wa.template_id==r&&(!t.current_slide||t.current_slide.id===i)){var l=!1;t.visualisation&&(l=t.data_bindings.requiredBindingsAreUnset()),s?Wa.refreshDataBindings((function(o){o?console.error("Failed to refresh data bindings"):!Wa||Wa.template_id!=r||t.current_slide&&t.current_slide.id!==i||Wa.prepareData((function(o,s){o?console.error("Failed to prepare data for template"):!Wa||Wa.template_id!=r||t.current_slide&&t.current_slide.id!==i||Hs({data:s,state:e,draw:!l},(function(t,e){ms=a,n(t,e)}))}))})):Hs({state:e,draw:!l},(function(t,e){ms=a,n(t,e)}))}}))})))}}(t,e,n)),Pa.src="/template/"+Wa.template_id+"/embed/?auto=1&environment="+za+"&is_read_only="+(t.is_read_only?"1":"0"),Pa):(ys(),Pa.src="about:blank",Pa)}function ws(t){ks((function(e,n){e?console.error("Failed to get default state"):(ms=n,t())}))}function Ts(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(Wa&&Wa.template_id==n)return t?(console.error("Failed to prepare data for template"),void e(t)):void e(void 0,r)}))}))}function xs(t,e){Ts(t,(function(t,n){if(t)return e(t);Hs({data:n,update:!0},e)}))}function As(t,e){Ts(t,(function(t,n){if(t)return e(t);Hs({data:n,update:!1},e)}))}function Es(t,e,n){Ts(t,(function(t,r){if(t)return n(t);Hs({data:r,state:e,overwrite_state:!0,update:!0},n)}))}function Cs(t,e,n,r=Pa){if(gs()){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 Ss(t,e){Cs("setState",fs(t),e)}function ks(t,e){"function"!=typeof t?Cs("getState",t,e):Cs("getState",void 0,t)}function Ds(t){Cs("hasData",void 0,t)}function Ns(t,e){Cs("setData",t,e)}function Ms(t){Cs("getData",void 0,t)}function Ls(t){Cs("draw",void 0,t),Ps(!0)}function Fs(t){$a&&$a.clear(),Bs()&&Cs("update",void 0,t)}function Os(t,e,n){Cs("snapshot",t,e,n)}function Us(){return ps(ms)}function Rs(t,e){Cs("setFixedHeight",t,e)}function Is(t){if(Pa.parentNode.offsetWidth){if(void 0!==t)hs=null!=t;else if(hs)return;var e=t||Ya&&Ya.responsive_menu&&Ya.responsive_menu.getHeightSetting()||ja.getHeightForBreakpoint(Pa.offsetWidth),n=typeof e;("number"===n||"string"===n&&!isNaN(e))&&(e+="px"),Pa.style.height=e}}function Hs(t,e,n=Pa){Bs()?delete t.draw:t.draw&&Ps(!0),t.state&&(t.state=fs(t.state)),$a&&$a.clear(),Cs("sync",t,(function(n,r){null!=n||"success"!==r?(t.draw&&Ps(!1),function n(r){r?e&&e(r):function(t,e){return t.data?(Ns(t.data,e),delete t.data,!1):t.state?(Ss(t.state,e),delete t.state,!1):t.draw?(Ls(e),delete t.draw,!1):!t.update||(Fs(e),delete t.update,!1)}(t,n)&&e&&e(void 0)}(n)):e&&e(void 0)}),n)}function Bs(){return qa}function Ps(t){qa=t}function zs(t,e,n,r,i){return Pa=document.querySelector(t),za=e,Ya=n,$a=r,i||(i={}),Ba="#amp=1"==window.location.hash,ja={createEmbedIframe:us,isFixedHeight:Va,getHeightForBreakpoint:Xa,startEventListeners:as,notifyParentWindow:Ja,initScrolly:Za,createScrolly:ls,isSafari:Ka,initCustomerAnalytics:Oo,addAnalyticsListener:Fo,sendCustomerAnalyticsMessage:Lo},Pa.style.height=ja.getHeightForBreakpoint(Pa.offsetWidth)+"px",ja.startEventListeners((function(t){"resize"==t.method?Is(t.height):"warn"==t.method?($a&&$a.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"]),gs()||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)}}(Pa.parentNode),{loadVisualisation:bs,updateData:xs,updateDataAndState:Es,updateDataNotPreview:As,setState:Ss,getState:ks,getDefaultState:Us,hasData:Ds,setData:Ns,getData:Ms,draw:Ls,update:Fs,snapshot:Os,setFixedHeight:Rs,resize:Is,sync:Hs,getDrawCalled:Bs,setDrawCalled:Ps,setFrameLoadListener:_s,updateDefaultState:ws}}var js={start:function(t=document.body){t.classList.add("loading")},clear:function(t=document.body){t.classList.remove("loading")}};const Ys=new Set([1,274,282,283,296,34675,40961,42240]);function $s(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,!Ys.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 f;if(d<=4)f=new DataView(new ArrayBuffer(4),0,4),f.setUint32(0,a,o);else{f=new DataView(new ArrayBuffer(d));for(let t=0;t<d;t++)f.setInt8(t,r.getInt8(a+t))}e.push({code:t,type:n,num_values:i,data:f})}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),f=new DataView(d.buffer);d.set((new TextEncoder).encode("MM\0*\0\0\0\b"),0),f.setUint16(8,e.length);let p=10,h=10+12*e.length+4;for(const{code:t,type:n,num_values:r,data:i}of e){if(f.setUint16(p,t),f.setUint16(p+2,n),f.setUint32(p+4,r),i.byteLength<=4)for(let t=0;t<i.byteLength;t++)f.setInt8(p+8+t,i.getInt8(t));else{f.setUint32(p+8,h);for(let t=0;t<i.byteLength;t++)f.setInt8(h+t,i.getInt8(t));h+=i.byteLength}p+=12}const m=new Uint8Array(10),g=new DataView(m.buffer);g.setUint8(0,255),g.setUint8(1,225),g.setUint16(2,f.byteLength+8),m.set(a,4),yield m,yield f}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,f=!1;for(;null!=(c=n());){if(d&&217===c.getUint8(0)){f=!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)),f=!0;break}o(c),d=c.byteLength>0&&255===c.getUint8(c.byteLength-1)}return f||o(u),r}function qs(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 Ws="⬆︎",Gs="/api/file/upload";function Vs(t){(t||document).querySelectorAll("input[type=url]").forEach((function(t){Xs(t)}))}function Xs(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=Ws,t.insertAdjacentElement("afterend",n),e||(n.onclick=Zs)}function Zs(){var t=this.previousSibling,e=t.getAttribute("accept");t.disabled=!0,t.classList.toggle("uploading",!0),Js({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 Js(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(){js.start(),await async function(t,e,n){const r=await async function(t){try{if("image/png"===t.type)return new File([qs(await t.arrayBuffer())],t.name,{type:t.type});if("image/jpeg"===t.type)return new File([$s(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};Ks(Gs,n,(function(t,n){return t?e(t):e(null,JSON.parse(n.responseText))}))}(r,(function(t,i){if(t)return js.clear(),uo("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);Ks(i.upload_url,o,(function(t,r){js.clear(),t?(uo("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 Ks(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 Qs="https://fonts.googleapis.com/css?family=",tl=["Source Sans Pro","Roboto Condensed","Merriweather","Lora","Playfair Display","Coda","Lobster","Cabin Sketch"],el="Same as parent",nl=[],rl=[],il={};function ol(t){return Qs+t.replace(/ /g,"+")+":400,700"}function al(t){var e=rl.concat(nl,tl.map((function(t){return{name:t,url:ol(t)}})));return t&&e.unshift({name:el}),e}function sl(t){return al(!0).find((function(e){return e.name==t}))}var ll=!1;function ul(t){return t.substr(t.lastIndexOf("=")+1).replace(/\+/g," ")}function cl(t){var e=t.target,n=e.value;if(n&&(0==n.indexOf(Qs)&&(n=e.value=ul(n)),!sl(n))){if(/^https?:\/\//.test(n)){ll||(dl(n),e.value="");var r=n;return n=e.value=ul(r),rl.push({name:n,url:r}),void fl()}var i=ol(n);try{var o=new XMLHttpRequest;if(o.open("HEAD",i,!1),o.send(),404==o.status)throw"Font not found";rl.push({name:n,url:i}),fl()}catch(t){dl(n),e.value=""}}}function dl(t){uo("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 fl(){var t,e,n=Object.keys(il);for(t=0;t<n.length;++t)(e=il[n[t]]).dropdown.setOptions(al(e.can_inherit).map((function(t){return t.name})))}var pl={initialize:function(t,e,n){var r=!!e.optional;ll=n,t.classList.add("font-menu");var i=new fo({input:t,id:e.property+"-dropdown",options:al(r).map((t=>t.name)),mode:"single",options_config:{allow_other_option:!0}});t._dropdown=i,il[e.property]={dropdown:i,can_inherit:r},t.addEventListener("change",cl)},update:function(t,e){var n=e?e.name:el;t._dropdown.setSelectedOptions(n),sl(n)||(n!=el&&rl.push({name:n,url:e.url}),fl())},getValue:function(t){if(/^https?:\/\//.test(t.value))return{name:ul(t.value),url:t.value};var e=t.value;if(e==el)return null;var n=sl(e);return n||{name:e,url:ol(e)}},replaceThemeFonts:function(t){nl=(t||[]).map((function(t){return{name:t.name,url:t.url}})),fl()}},hl="$";function ml(){}function gl(t,e){var n=new ml;if(t instanceof ml)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 vl(){}ml.prototype=gl.prototype={constructor:ml,has:function(t){return hl+t in this},get:function(t){return this[hl+t]},set:function(t,e){return this[hl+t]=e,this},remove:function(t){var e=hl+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===hl&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===hl&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===hl&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===hl&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===hl&&++t;return t},empty:function(){for(var t in this)if(t[0]===hl)return!1;return!0},each:function(t){for(var e in this)e[0]===hl&&t(this[e],e.slice(1),this)}};var yl=gl.prototype;vl.prototype={constructor:vl,has:yl.has,add:function(t){return this[hl+(t+="")]=t,this},remove:yl.remove,clear:yl.clear,values:yl.keys,size:yl.size,empty:yl.empty,each:yl.each};var _l={value:function(){}};function bl(){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 wl(r)}function wl(t){this._=t}function Tl(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function xl(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=_l,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function Al(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]}wl.prototype=bl.prototype={constructor:wl,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=xl(i[n],t.name,e);else if(null==e)for(n in i)i[n]=xl(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=Tl(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new wl(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 El={};function Cl(t){t.running||(t.running=!0,Sl(t,(function(){t.running=!1})))}function Sl(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&&kl(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())&&kl(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=bl("beforesend","progress","load","error"),s=gl(),l=new XMLHttpRequest,u=null,c=null,d=0;function f(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)}return"undefined"!=typeof XDomainRequest&&!("withCredentials"in l)&&/^(http(s)?:)?\/\//.test(t)&&(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=l.ontimeout=f:l.onreadystatechange=function(t){l.readyState>3&&f(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,f){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==f&&"function"==typeof i&&(f=i,i=null),null!=f&&1===f.length&&(f=function(t){return function(e,n){t(null==e?n:null)}}(f)),null!=f&&n.on("error",f).on("load",(function(t){f(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}},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():Sl(t,e)}))}function kl(t){return["POST","PUT","DELETE"].includes(t)}function Dl(t,e){void 0===e&&(e="default"),e in El||(El[e]={items:[],running:!1,name:e}),El[e].items.push(t),Cl(El[e])}function Nl(t,e){for(var n in e)t[n]=e[n];return t}function Ml(t,e,n,r){"function"==typeof n&&(r=n,n=!1),n&&Nl(t,e),Dl({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||Nl(t,e),t.setVersionNumber(o.version_number),r(void 0)}})}function Ll(t,e){t.delete_requested=!0,Dl({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)}})}function Fl(t){Dl({url:"/api/history",method:"POST",payload:function(){return t},callback:function(){}})}var Ol={addApiKey:function(t){Dl({url:"/api/user/api_keys",method:"PUT",callback:t})},addFolder:function(t,e,n,r){Dl({url:`/api/user/folder/${encodeURIComponent(t)}`,method:"PUT",payload:()=>({share:e,parent_id:n}),callback:r})},addTag:function(t,e){Dl({url:"/api/user/tag/"+encodeURIComponent(t),method:"PUT",callback:e})},deleteApiKey:function(t,e){Dl({url:"/api/user/api_keys/"+t,method:"DELETE",callback:e})},fetchFolders:function(t){Dl({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("filter="+encodeURIComponent(n)),r&&u.push("offset="+encodeURIComponent(r)),i&&u.push("limit="+encodeURIComponent(i)),o&&u.push("search="+encodeURIComponent(o)),a&&u.push("is_recent=true"),s&&u.push("shared=true"),e&&(l+="/folder/"+encodeURIComponent(e)),u.length&&(l+="?"+u.join("&")),Dl({url:l,method:"GET",callback:t})},generateSdkToken:function(t){Dl({url:"/api/user/generate_sdk_token",method:"GET",callback:t})},getApiKeys:function(t){Dl({url:"/api/user/api_keys",method:"GET",callback:t})},getReviewCount:function(t){Dl({url:"/api/reviews/count",method:"GET",callback:t})},isUsernameAvailable:function(t,e){Dl({url:"/api/user/username?u="+encodeURIComponent(t),method:"GET",callback:e})},logHistory:Fl,removeFolder:function(t,e){Dl({url:"/api/user/folder/"+encodeURIComponent(t)+"?use_id=1",method:"DELETE",callback:e})},removeTag:function(t,e){Dl({url:"/api/user/tag/"+encodeURIComponent(t),method:"DELETE",callback:e})},renameFolder:function(t,e,n){Dl({url:"/api/user/folder/"+encodeURIComponent(t)+"/"+encodeURIComponent(e)+"?use_id=1",method:"PUT",callback:n})},renameTag:function(t,e,n){Dl({url:"/api/user/tag/"+encodeURIComponent(t)+"/"+encodeURIComponent(e),method:"PUT",callback:n})},revokeSdkToken:function(t,e){Dl({url:"/api/user/sdk_token/"+encodeURIComponent(t),method:"DELETE",callback:e})},setSamlProviderId:function(t,e,n){Dl({url:"/api/user/"+encodeURIComponent(t)+"/change_saml_provider_id",method:"POST",payload:function(){return{saml_provider_id:e}},callback:n})},moveFolder:function(t,e=!0,n){return new Promise(((r,i)=>{Dl({url:`/api/folder/${t}/nest`,method:"PUT",payload:()=>({share:e,parent_id:n}),callback:(t,o)=>{if(t)return i(t);Fl({category:"folders",action:"nest",detail:{share:e,parent_id:n}}),r(o)}})}))},update:function(t,e){Dl({url:"/api/user",method:"POST",payload:function(){return{fields:t}},callback:e})}};var Ul={};function Rl(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Il(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Hl(){}var Bl=.7,Pl=1/Bl,zl="\\s*([+-]?\\d+)\\s*",jl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Yl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$l=/^#([0-9a-f]{3,8})$/,ql=new RegExp(`^rgb\\(${zl},${zl},${zl}\\)$`),Wl=new RegExp(`^rgb\\(${Yl},${Yl},${Yl}\\)$`),Gl=new RegExp(`^rgba\\(${zl},${zl},${zl},${jl}\\)$`),Vl=new RegExp(`^rgba\\(${Yl},${Yl},${Yl},${jl}\\)$`),Xl=new RegExp(`^hsl\\(${jl},${Yl},${Yl}\\)$`),Zl=new RegExp(`^hsla\\(${jl},${Yl},${Yl},${jl}\\)$`),Jl={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 Kl(){return this.rgb().formatHex()}function Ql(){return this.rgb().formatRgb()}function tu(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=$l.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?eu(e):3===n?new iu(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?nu(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?nu(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=ql.exec(t))?new iu(e[1],e[2],e[3],1):(e=Wl.exec(t))?new iu(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Gl.exec(t))?nu(e[1],e[2],e[3],e[4]):(e=Vl.exec(t))?nu(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Xl.exec(t))?cu(e[1],e[2]/100,e[3]/100,1):(e=Zl.exec(t))?cu(e[1],e[2]/100,e[3]/100,e[4]):Jl.hasOwnProperty(t)?eu(Jl[t]):"transparent"===t?new iu(NaN,NaN,NaN,0):null}function eu(t){return new iu(t>>16&255,t>>8&255,255&t,1)}function nu(t,e,n,r){return r<=0&&(t=e=n=NaN),new iu(t,e,n,r)}function ru(t,e,n,r){return 1===arguments.length?((i=t)instanceof Hl||(i=tu(i)),i?new iu((i=i.rgb()).r,i.g,i.b,i.opacity):new iu):new iu(t,e,n,null==r?1:r);var i}function iu(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function ou(){return`#${uu(this.r)}${uu(this.g)}${uu(this.b)}`}function au(){const t=su(this.opacity);return`${1===t?"rgb(":"rgba("}${lu(this.r)}, ${lu(this.g)}, ${lu(this.b)}${1===t?")":`, ${t})`}`}function su(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function lu(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function uu(t){return((t=lu(t))<16?"0":"")+t.toString(16)}function cu(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new fu(t,e,n,r)}function du(t){if(t instanceof fu)return new fu(t.h,t.s,t.l,t.opacity);if(t instanceof Hl||(t=tu(t)),!t)return new fu;if(t instanceof fu)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 fu(a,s,l,t.opacity)}function fu(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function pu(t){return(t=(t||0)%360)<0?t+360:t}function hu(t){return Math.max(0,Math.min(1,t||0))}function mu(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 gu(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}Rl(Hl,tu,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Kl,formatHex:Kl,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return du(this).formatHsl()},formatRgb:Ql,toString:Ql}),Rl(iu,ru,Il(Hl,{brighter(t){return t=null==t?Pl:Math.pow(Pl,t),new iu(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Bl:Math.pow(Bl,t),new iu(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new iu(lu(this.r),lu(this.g),lu(this.b),su(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:ou,formatHex:ou,formatHex8:function(){return`#${uu(this.r)}${uu(this.g)}${uu(this.b)}${uu(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:au,toString:au})),Rl(fu,(function(t,e,n,r){return 1===arguments.length?du(t):new fu(t,e,n,null==r?1:r)}),Il(Hl,{brighter(t){return t=null==t?Pl:Math.pow(Pl,t),new fu(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Bl:Math.pow(Bl,t),new fu(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 iu(mu(t>=240?t-240:t+120,i,r),mu(t,i,r),mu(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new fu(pu(this.h),hu(this.s),hu(this.l),su(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=su(this.opacity);return`${1===t?"hsl(":"hsla("}${pu(this.h)}, ${100*hu(this.s)}%, ${100*hu(this.l)}%${1===t?")":`, ${t})`}`}}));var vu=gu("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),yu=gu("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),_u=gu("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),bu=gu("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),wu=t=>()=>t;function Tu(t){return 1==(t=+t)?xu: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):wu(isNaN(e)?n:e)}}function xu(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):wu(isNaN(t)?e:t)}var Au=function t(e){var n=Tu(e);function r(t,e){var r=n((t=ru(t)).r,(e=ru(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=xu(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 Eu(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Cu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Su=new RegExp(Cu.source,"g");function ku(t,e){var n,r,i,o=Cu.lastIndex=Su.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=Cu.exec(t))&&(r=Su.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:Eu(n,r)})),o=Su.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 Du,Nu=180/Math.PI,Mu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Lu(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)*Nu,skewX:Math.atan(l)*Nu,scaleX:a,scaleY:s}}function Fu(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:Eu(t,i)},{i:l-2,x:Eu(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:Eu(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:Eu(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:Eu(t,n)},{i:s-2,x:Eu(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 Ou,Uu,Ru=Fu((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Mu:Lu(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Iu=Fu((function(t){return null==t?Mu:(Du||(Du=document.createElementNS("http://www.w3.org/2000/svg","g")),Du.setAttribute("transform",t),(t=Du.transform.baseVal.consolidate())?Lu((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Mu)}),", ",")",")"),Hu=0,Bu=0,Pu=0,zu=1e3,ju=0,Yu=0,$u=0,qu="object"==typeof performance&&performance.now?performance:Date,Wu="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Gu(){return Yu||(Wu(Vu),Yu=qu.now()+$u)}function Vu(){Yu=0}function Xu(){this._call=this._time=this._next=null}function Zu(t,e,n){var r=new Xu;return r.restart(t,e,n),r}function Ju(){Yu=(ju=qu.now())+$u,Hu=Bu=0;try{!function(){Gu(),++Hu;for(var t,e=Ou;e;)(t=Yu-e._time)>=0&&e._call.call(null,t),e=e._next;--Hu}()}finally{Hu=0,function(){var t,e,n=Ou,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:Ou=e);Uu=t,Qu(r)}(),Yu=0}}function Ku(){var t=qu.now(),e=t-ju;e>zu&&($u-=e,ju=t)}function Qu(t){Hu||(Bu&&(Bu=clearTimeout(Bu)),t-Yu>24?(t<1/0&&(Bu=setTimeout(Ju,t-qu.now()-$u)),Pu&&(Pu=clearInterval(Pu))):(Pu||(ju=qu.now(),Pu=setInterval(Ku,zu)),Hu=1,Wu(Ju)))}function tc(t,e,n){var r=new Xu;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Xu.prototype=Zu.prototype={constructor:Xu,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Gu():+n)+(null==e?0:+e),this._next||Uu===this||(Uu?Uu._next=this:Ou=this,Uu=this),this._call=t,this._time=n,Qu()},stop:function(){this._call&&(this._call=null,this._time=1/0,Qu())}};var ec=bl("start","end","cancel","interrupt"),nc=[],rc=0,ic=1,oc=2,ac=3,sc=4,lc=5,uc=6;function cc(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=ic,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var u,c,d,f;if(n.state!==ic)return l();for(u in i)if((f=i[u]).name===n.name){if(f.state===ac)return tc(a);f.state===sc?(f.state=uc,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[u]):+u<e&&(f.state=uc,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[u])}if(tc((function(){n.state===ac&&(n.state=sc,n.timer.restart(s,n.delay,n.time),s(o))})),n.state=oc,n.on.call("start",t,t.__data__,n.index,n.group),n.state===oc){for(n.state=ac,r=new Array(d=n.tween.length),u=0,c=-1;u<d;++u)(f=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=f);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=lc,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);n.state===lc&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=uc,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Zu(o,0,n.time)}(t,n,{name:e,index:r,group:i,on:ec,tween:nc,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:rc})}function dc(t,e){var n=pc(t,e);if(n.state>rc)throw new Error("too late; already scheduled");return n}function fc(t,e){var n=pc(t,e);if(n.state>ac)throw new Error("too late; already running");return n}function pc(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function hc(t,e){var n,r;return function(){var i=fc(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 mc(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=fc(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 gc(t,e,n){var r=t._id;return t.each((function(){var t=fc(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return pc(t,r).value[e]}}function vc(t,e){var n;return("number"==typeof e?Eu:e instanceof tu?Au:(n=tu(e))?(e=n,Au):ku)(t,e)}function yc(t){return function(){this.removeAttribute(t)}}function _c(t){return function(){this.removeAttributeNS(t.space,t.local)}}function bc(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 wc(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 Tc(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 xc(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 Ac(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Ec(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Cc(t,e){return function(){dc(this,t).delay=+e.apply(this,arguments)}}function Sc(t,e){return e=+e,function(){dc(this,t).delay=e}}function kc(t,e){return function(){fc(this,t).duration=+e.apply(this,arguments)}}function Dc(t,e){return e=+e,function(){fc(this,t).duration=e}}var Nc=It.prototype.constructor;function Mc(t){return function(){this.style.removeProperty(t)}}var Lc=0;function Fc(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Oc(){return++Lc}var Uc=It.prototype;Fc.prototype={constructor:Fc,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=D(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),f=0;f<c;++f)(s=u[f])&&(l=t.call(s,s.__data__,f,u))&&("__data__"in s&&(l.__data__=s.__data__),d[f]=l,cc(d[f],e,n,f,d,pc(s,n)));return new Fc(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=L(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 f,p=t.call(l,l.__data__,d,u),h=pc(l,n),m=0,g=p.length;m<g;++m)(f=p[m])&&cc(f,e,n,m,p,h);o.push(p),a.push(l)}return new Fc(o,a,e,n)},selectChild:Uc.selectChild,selectChildren:Uc.selectChildren,filter: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=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 Fc(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,f=a[s]=new Array(d),p=0;p<d;++p)(l=u[p]||c[p])&&(f[p]=l);for(;s<r;++s)a[s]=e[s];return new Fc(a,this._parents,this._name,this._id)},selection:function(){return new Nc(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Oc(),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=pc(a,e);cc(a,t,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Fc(r,this._parents,t,n)},call:Uc.call,nodes:Uc.nodes,node:Uc.node,size:Uc.size,empty:Uc.empty,each:Uc.each,on:function(t,e){var n=this._id;return arguments.length<2?pc(this.node(),n).on.on(t):this.each(function(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)?dc:fc;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=A(t),r="transform"===n?Iu:vc;return this.attrTween(t,"function"==typeof e?(n.local?xc:Tc)(n,r,gc(this,"attr."+t,e)):null==e?(n.local?_c:yc)(n):(n.local?wc:bc)(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=A(t);return this.tween(n,(r.local?Ac:Ec)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Ru:vc;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=et(this,t),a=(this.style.removeProperty(t),et(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,Mc(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=et(this,t),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(t),l=s=et(this,t)),a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s))}}(t,r,gc(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var l=fc(this,t),u=l.on,c=null==l.value[a]?o||(o=Mc(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=et(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(gc(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=pc(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?hc:mc)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Cc:Sc)(e,t)):pc(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?kc:Dc)(e,t)):pc(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){fc(this,t).ease=e}}(e,t)):pc(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;fc(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=fc(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]:Uc[Symbol.iterator]};var Rc,Ic,Hc={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Bc(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 Pc(t){var e;if(Rc=Ht(".detailed-settings"),(Ic=Rc.append("div").attr("class","settings-block")).append("h2").text("Back to settings").on("click",(function(){Rc.transition().duration(100).style("opacity",0).on("end",(function(){Ht(this).html("").style("display","none"),Ht(".template-settings").style("display","block").style("opacity",0).transition().duration(200).style("opacity",1),Ht(".template-settings-search").style("display",null).style("opacity",0).transition().duration(200).style("opacity",1)})),Rc.node()})),"string"==typeof t)e=Ic.append("div").html(t);else if("object"==typeof t&&(e=Ic.append(t.type),t.value&&(Ic.node().value=t.value),t.attributes))for(var n in t.attributes)e.attr(n,t.attributes[n]);return e.node().focus(),Ht(".template-settings-search").style("display","none"),Ht(".template-settings").style("display","none"),Rc.style("display","block").style("opacity",0).transition().duration(200).style("opacity",1),Rc.node()}It.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>oc&&n.state<lc,n.state=uc,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)}))},It.prototype.transition=function(t){var e,n;t instanceof Fc?(e=t._id,t=t._name):(e=Oc(),(n=Hc).time=Gu(),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])&&cc(a,t,e,u,s,n||Bc(a,e));return new Fc(r,this._parents,t,e)};var zc,jc,Yc,$c,qc={},Wc={},Gc={Flourish:{colors:["#135ae1","#2197ff","#9852d9","#f54e8b","#fa6502","#f2b90f","#058896","#09aa64","#de2c35","#a7abaf","#808080"]},"Flourish Alternate":{colors:["#135ae1","#f54e8b","#2197ff","#f2b90f","#9852d9","#058896","#fa6502","#09aa64","#de2c35","#a7abaf","#808080"]},"Flourish Light":{colors:["#3873e0","#69b9ff","#b568d9","#ff7895","#fa9a5a","#f2c43a","#3e9ea8","#57c193","#de5d5d","#a7abaf","#808080"]},"Flourish Light Alternate":{colors:["#3873e0","#ff7895","#69b9ff","#f2c43a","#b568d9","#3e9ea8","#fa9a5a","#57c193","#de5d5d","#a7abaf","#808080"]},"Flourish Blues":{colors:["#132856","#1354d9","#3f8bed","#76b7f7","#b3dcfd"]},"Flourish Light Blues":{colors:["#093a60","#1869b8","#2196f5","#4bc3fe","#91e8ff"]},"Flourish Purples":{colors:["#451059","#8835ab","#b964e2","#d49df3","#ebd2f9"]},"Flourish Pinks":{colors:["#560017","#a32048","#e43f77","#ff7db7","#ffc0de"]},"Flourish Oranges":{colors:["#451603","#9a370a","#e25501","#ff942c","#ffd393"]},"Flourish Yellows":{colors:["#3f1d07","#864e17","#be7c18","#e8ac0e","#fae06d"]},"Flourish Teals":{colors:["#023d49","#007686","#34a7b1","#68d1d4","#97f9f3"]},"Flourish Greens":{colors:["#00321a","#017339","#26aa5e","#6dd597","#acfacf"]},"Flourish Reds":{colors:["#440909","#a21014","#e63633","#ff7f7b","#ffc0c0"]},"Flourish Greys":{colors:["#333536","#616467","#8a8e91","#b1b4b8","#d7d8da"]},"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:["#4328e7","#9654e5","#ff6283","#ff8800","#ffc502","#007d8e","#1aa7ee","#29dae4","#88e99a","#019c00","#c11f1f","#730000"]},"Flourish Legacy Alternate":{scheme:"flourish_default_2",colors:["#4328e7","#9654e5","#ff6283","#ff8800","#ffc502","#88e99a","#29dae4","#1aa7ee","#019c00","#007d8e","#c11f1f","#730000"]},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:vu},Dark:{scheme:"schemeDark2",colors:yu},Paired:{scheme:"schemePaired",colors:_u},Pale:{scheme:"schemePastel1",colors:bu},"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"]}},Vc={};function Xc(){var t,e={};for(t in Vc)e[t]=Vc[t];for(t in Gc)e[t]=Gc[t];return e}var Zc="Edit color palette";function Jc(t){t&&t.length?(Vc={},t.forEach((function(t){var e=Object.keys(t)[0];Vc[e]={colors:t[e]}}))):Vc={},function(){for(var t in qc){qc[t].setOptions(Qc())}}()}function Kc(){if(void 0!==zc)return zc;var t=document.createElement("input");return t.setAttribute("type","color"),t.setAttribute("value","!"),zc="color"==t.type&&"!"!==t.value}function Qc(){var t=[],e=Xc();for(var n in t.push([Zc,""]),e)t.push([n,e[n].colors.join("|")]);return t}function td(t,e){var n=t[0],r=t[1];if(!r){const t=Bt("em");return t.append("i").classed("fa fa-pencil",!0),t.node().append(Zc),t.node()}Array.isArray(r)||(r=r.split("|"));const i=[];if(e&&n){const t=Bt("label").text(n);i.push(t.node())}return r.forEach((function(t,e){const n=Bt("span").attr("data-index",e).style("background-color",t);i.push(n.node())})),i}function ed(t,e){var n,r,i=Xc(),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(...td([null,r])),t.setAttribute("data-value",r.join("|"))}function nd(t){$c=t.target,t.dataTransfer.setData("text/plain","x"),event.dataTransfer.effectAllowed="move",Ht($c).classed("dragging",!0),Pt(".palette p:not(.dragging) input").style("pointer-events","none")}function rd(t){t.preventDefault();var e=Ht(".palette").selectAll("[draggable='true']").style("border-color",null),n=Ht(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")}Ht(t.target).style("border-"+r,"1px solid black")}}function id(t){if($c){for(var e=t.target;e&&("P"!==e.tagName||!e.nextSibling);)e=e.parentNode;if(e){var n=e.nextSibling;if(e===Ht(".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($c,n),$c=!1,sd()}}}function od(){Ht($c).classed("dragging",!1),Pt(".palette *").style("border-bottom",null).style("border-top",null),Pt(".palette p input").style("pointer-events",null)}function ad(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=ld("#000000");e.insertAdjacentHTML("beforebegin",n),sd()}(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");sd()}(e.parentNode))}function sd(){for(var t=Yc.getAttribute("data-autocomplete"),e=qc[t],n=[],r=jc.querySelectorAll(".palette input[type=text]"),i=0;i<r.length;i++)n.push(r[i].value);var o=e.getOptions();Wc[t]?o[0][1]=n.join("|"):o.unshift(["Custom",n.join("|")]),Wc[t]=n,e.setOptions(o),ed(Yc,n),Ht(Yc).dispatch("change")}function ld(t){const e=Bt("p").attr("draggable",!0);return e.append("span").classed("swatch-handle",!0).text(".. .. .."),Kc()?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 ud(t){var e=t.target,n=e.value,r=e.parentNode;if(!n)return r.parentNode.removeChild(r),void sd();var i=tu(n);if(!i)return console.warn("bad color",n),"color"==e.type?e.value=e.nextSibling.value:Kc()?e.value=e.previousSibling.value:e.value=e.previousSibling.style.backgroundColor,void(un.point(e).text(n+" is not a valid color").draw()._getElement().style.zIndex=115);"color"==e.type?e.nextSibling.value=n:Kc()?e.previousSibling.value=i.hex():e.previousSibling.style.backgroundColor=n,sd()}var cd,dd,fd={initialize:function(t,e){e.choices&&Jc(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";qc[r]=new fo({input:t,id:r,mode:"single",options:Qc(),options_config:{custom_renderer:td}}),t.addEventListener("change",(function(e){t.value==Zc?(e.stopImmediatePropagation(),t.value="",function(t){Yc=t;var e=(jc=Pc({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=tu(i);o?n.push(o.hex()):(console.warn("Bad color",i),n.push("#000000"))}return n}(t),r="";n.forEach((function(t){r+=ld(t)})),r+="<p><button class='fa fa-plus-square clickable'></button></p>",e.innerHTML=r,e.addEventListener("change",ud),e.addEventListener("dragstart",nd),e.addEventListener("dragover",rd),e.addEventListener("drop",id),e.addEventListener("dragend",od),e.addEventListener("click",ad)}(t)):ed(t,(t.getAttribute("data-value")||"").split("|"))}))},update:ed,getValue:function(t){var e=t.getAttribute("data-value");return e?e.split("|"):null},replaceThemeColors:Jc},pd={};const hd={style:!0,url:!0,flourish_embed:!0};var md={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 gd(t,e){pd=e||hd;var n=Ht(dd=Pc({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,Ht(t).dispatch("change")})),pd)pd[r]&&vd(r);(pd.bindings||pd.bindings_custom)&&(n.append("div").attr("class","text-bindings"),yd()),gn()}function vd(t){if("bindings"!=t&&"bindings_custom"!=t){var e=Ht(dd).select(".text-settings").append("div").attr("class","editor-section");if("style"==t){["h1","h2","bold","italic","line_break"].forEach((function(t){var n=md[t].description?md[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",_d).append("svg").attr("height",md[t].height).attr("width",md[t].width).attr("viewBox","0 0 "+md[t].width+" "+md[t].height).append("path").attr("fill","#333333").attr("d",md[t].path)}))}else{var n=md[t].description?md[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",_d).append("svg").attr("height",md[t].height).attr("width",md[t].width).attr("viewBox","0 0 "+md[t].width+" "+md[t].height).append("path").attr("fill","#333333").attr("d",md[t].path)}}}function yd(){if(pd.bindings||pd.bindings_custom){var t;if(Array.isArray(pd.bindings))t={},pd.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===pd.bindings)t=null;else if(!Array.isArray(pd.bindings_custom))return;var e=cd.visualisation.data_bindings[cd.visualisation.template_id],n={},r=[];cd.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)}))}}pd.bindings_custom&&Array.isArray(pd.bindings_custom)&&pd.bindings_custom.forEach((function(t){t[0]&&t[1]&&r.push({name:t[0],binding:t[1],type:"dynamic"})})),Ht(".text-bindings").html("").style("display",r.length?null:"none").append("p").text("Click to add values from your data"),Ht(".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",_d).text((function(t){return"object"==typeof t?t.name:t}))}}function _d(){var t,e=Ht(".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=Ht(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=bd(a,"<b>","</b>");else if("italic"==s)t=bd(a,"<i>","</i>");else if("h1"==s)t=bd(a,"<h1>","</h1>");else if("h2"==s)t=bd(a,"<h2>","</h2>");else if("line_break"==s)t=bd(a,"<br>","");else if("url"==s)t=bd(a,'<a href ="">',"</a>",10);else if("flourish_embed"==s)t=bd(l,'<iframe src="https://flo.uri.sh/','/embed" frameborder="0" scrolling="no" style="width:100%;height:400px;"></iframe>');else if("binding"==s){var u=Ht(this).attr("data-binding");t=bd(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 bd(t,e,n,r){return e=e||"",n=n||"",t=t||"",{cursor:r||e.length+t.length,text:e+t+n}}var wd,Td,xd,Ad={initialize:function(t,e,n){cd=t,Ht(e.parentElement).append("div").attr("class","text-editor-btn").attr("tabindex","0").on("click",(function(){gd(e,n.editor)})).on("keydown",(function(t){13==t.keyCode&&gd(e,n.editor)})).append("i").attr("class","fa fa-paint-brush")},updateDataBindings:yd},Ed=void 0,Cd=/fa-(\S*)/g,Sd=/^data:image\/(svg|svg\+xml|png|jpg);base64,[A-Z-a-z0-9+/=]*$/,kd=/^gradient:/g;function Dd(t){var e=!Ht(t.parentNode).classed("open");Pt(".template-settings .settings-block").classed("open",!1).attr("aria-expanded",!1),e&&Ht(t.parentNode).classed("open",!0).attr("aria-expanded",!0)}function Nd(t){if(t){Ed={};for(var e=0,n=null,r=null,i=wd&&wd.user?wd.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=xd.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}Ed[a.property]=a.type,Md(s.append("div"),a,i)}}else r=null,(n=xd.append("div").attr("class","settings-block")).append("h2").attr("class","no-select").attr("tabindex","0").text(a).on("click",(function(){Dd(this)})).on("keyup",(function(t){13===t.keyCode&&Dd(this)})),n.classed("open",e<1),n.attr("aria-expanded",e<1),"State documentation"===a&&n.style("display","none"),e++}Pt(".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,upgrade_source:r}),Ol.logHistory({category:"upgrade",action:"clicked",detail:r})}},{text:"Maybe later",keyCode:27,class:"secondary",callback:function(){t.analytics("event","upgrade-close",{upgrade_id:l,upgrade_source:r}),Ol.logHistory({category:"upgrade",action:"closed",detail:r})}}];t.analytics("event","upgrade-open",{upgrade_id:l,upgrade_source:r}),Ol.logHistory({category:"upgrade",action:"viewed",detail:r}),uo(e,n,{buttons:u,is_html:!0,upgrade:{message:i[a],list:o[s],is_business:!0}})}(wd,"This is a premium feature","Upgrade your plan to change this setting.","upgrade-settings")})),gn()}}function Md(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,Ht(this.parentNode).select("textarea").attr("wrap",s?null:"off"),Ht(this).classed("selected",s)}))}var l=t.append(a).attr("id","setting-"+e.property).attr("class","setting").attr("name",e.property).attr("disabled",!wd.visualisation.can_edit||null),u=l.node();if("colors"==e.type)fd.initialize(u,e);else if("font"==e.type)pl.initialize(u,e,wd.user&&null!=wd.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"),Td.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],f=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",!wd.visualisation.can_edit||null).call(Ld(e)),Ud(t,l.append("label").attr("for",e.property+"_"+n).style("width",100/f.column_count+"%").style("border-radius",(function(){var t=f.column_count,e=Math.ceil(f.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),Ad.initialize(wd,u,e)),e.choices&&"string"==e.type&&"buttons"!=e.style&&(u._dropdown=new fo({input:u,id:e.property+"-dropdown",options:e.choices,options_config:{allow_other_option:e.choices_other,custom_renderer:Ud},mode:"single"})),"color"==e.type){Ht(u).classed("color",!0).style("display","none");var p=Ht(u.parentNode).append("div").attr("class","color-picker"),h=p.append("div").attr("class","color-wrapper");e.optional&&p.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"),Ht(this.parentNode).classed("is-null",!0))})),h.append("input").attr("type","color").on("change",(function(){u.value=this.value,l.dispatch("change"),Ht(this.parentNode.parentNode).classed("is-null",!1)})).on("focus",(function(){Ht(this.parentNode.parentNode).classed("active",!0)})).on("blur",(function(){Ht(this.parentNode.parentNode).classed("active",!1)}))}e.placeholder&&u.setAttribute("placeholder",e.placeholder),e.size&&u.classList.add("size-"+e.size),l.call(Ld(e))}function Ld(t){return function(e){var n=!1;e.on("change",(function(){var e=this;un.hide(),n=!0,wd.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||(un.point(t).text("A value is required").draw(),!1);var n=parseFloat(t.value);return Object.prototype.hasOwnProperty.call(e,"min")&&n<e.min?(un.point(t).text("Value cannot be less than "+e.min).draw(),t.value=e.min):e.hasOwnProperty("max")&&n>e.max&&(un.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=Rd,a=[t,e,n],clearTimeout(Ul[r]),Ul[r]=setTimeout((function(){o.apply(window,a),delete Ul[r]}),i);var r,i,o,a}(e,t,(function(r){if(!r)return n=!1,void("SELECT"==e.tagName&&Ht(e).dispatch("blur"));var o="radio"==e.type?e.nextSibling:e;un.point(o).text("Not changed: "+(r.message||r)).draw();var a={};a[t.property]=i,wd.preview_pane.setState(a,(function(r){if(r)return console.error("Failed to revert setting "+t.property+" to value: "+i),void(n=!1);wd.preview_pane.update((function(r){if(r)return console.error("Failed to update after reverting setting "+t.property+" to value: "+i),void(n=!1);Od(e,i),n=!1}))}))})):(e.value=i,void(n=!1))}))})).on("keydown",(function(t){wd.confirm.blank(),13==t.keyCode&&un.hide()})).on("blur",(function(){if(!n){var e=this;un.hide(),wd.preview_pane.getState(t.property,(function(n,r){n?console.error("Failed to get state property "+t.property,n):Od(e,r)}))}}))}}function Fd(t,e,n){if(t.classList.contains("colors"))return fd.getValue(t);if(t.classList.contains("font-menu")){var r=pl.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 Od(t,e){if(t.classList.contains("colors"))fd.update(t,e);else if(t.classList.contains("font-menu"))pl.update(t,e);else if("checkbox"==t.getAttribute("type"))t.checked=e;else if(t.classList.contains("color"))t.value=e,Ht(t.parentNode).select(".color-picker").classed("is-null",null===e),Ht(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<wd.settings.length;e++){var n=wd.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 Ud(t,e){var n=Ht(e);if("string"!=typeof t){var r=t[2];if(r)if(r.match(Cd))n.append("i").attr("class","fa "+r);else if(r.match(Sd))n.append("img").attr("src",r);else if(r.match(kd)){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(Cd)?n.append("i").attr("class","fa "+o):o.match(Sd)?n.append("img").attr("src",o):n.node().append(o)}else n.text(t)}function Rd(t,e,n){var r={},i=Fd(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)){wd.confirm.saving();var o=!1,a={};a[e.property]=Fd(t,e.optional,!0),wd.preview_pane.setState(a,(function(t){if(t)return s(t);wd.preview_pane.update((function(t){if(t)return s(t);wd.visualisation.updateSettings(r,(function(t){if(t)return s(t);wd.analytics("event","visualisation",{change_setting:wd.visualisation.id}),Bd(),wd.confirm.saved(),n&&n()}))}))}))}else n&&n("You can only choose values from the list");function s(r){o||(wd.preview_pane.getState(e.property,(function(e,i){if(e)return console.error("Failed to get state",e),void wd.confirm.error(e);Od(t,i),Bd(),wd.confirm.blank(),n&&n(r)})),o=!0)}}function Id(t,e){return/^data\./.test(t)?function(t,e){var n=t.split(".");if(wd.visualisation.__sdk__)return function(t,e){if(t.length>=4)return;for(var n=null,r=wd.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);return 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=wd.visualisation.template_id,r=wd.visualisation.data_bindings[n][t[1]],i=r[t[2]];if(null==i)return!1;for(var o,a=wd.visualisation.data_tables,s=i.data_table_id,l=i.columns||[i.column],u=0;u<a.length;u++)if(a[u].id===s){o=a[u].column_types;break}var c=!1;for(u=0;u<l.length;u++){var d=o[l[u]].type_id.split("$")[0];if(c=-1!==(Array.isArray(e)?e:[e]).indexOf(d))break}return c}(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=Fd(n);if(e instanceof Array)return-1!==e.indexOf(r);return r===e}(t,e)}function Hd(t){if("boolean"==typeof t)return t;if("string"==typeof t)return Id(t,!0);if("object"==typeof t){for(var e in t)if(!Id(e,t[e]))return!1;return!0}}function Bd(){wd.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(Hd(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(Ht(r).classed("hidden",!e),t.new_section)for(var i=r.previousSibling;i&&(Ht(i).classed("settings-divider")||Ht(i).classed("settings-subhead"));)Ht(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 Pd(t,e,n){return wd=t,Td={setup:Vs,addButton:Xs,startUpload:Js},(xd=Ht(".side-panel .template-settings")).on("submit",(function(t){t.preventDefault()})),fd.replaceThemeColors(e),pl.replaceThemeFonts(n),Nd(wd.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()}Ht(".side-panel .template-settings-search").on("input",(function(n){var r=e(n.target.value),i=!r,o=Ht(".side-panel .template-settings").selectAll(".settings-block:not(.hidden) > h2, .settings-option:not(.hidden) h3, .settings-subhead:not(.hidden)");Ht(".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=Ht(this);if("H2"==this.tagName)e&&Ht(e).selectAll("h2, .settings-option, .settings-subhead, .settings-divider").classed("search-filtered-out",!1);else if("H3"==this.tagName)if(e&&Ht(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"))}}}))}))}(),Ht(".side-panel-scrollbox").on("scroll",(function(){un.hide()})),{update:function(t){xd.html(""),Ht(".current-template").style("opacity","1"),Nd(wd.settings=t)},populate:function(){wd.preview_pane.getState((function(t,e){if(t)console.error("Failed to get state",t);else{var n=ds(e);for(var r in n){var i=document.getElementById("setting-"+r);i&&Od(i,n[r])}Ad.updateDataBindings(),Bd()}}))},getSettingsForCurrentTemplate:function(){return Ed},setReadOnly:function(){Pt(".setting").each((function(){Ht(this).attr("disabled",!0)}))},unsetReadOnly:function(){Pt(".setting").each((function(){Ht(this).attr("disabled",null)}))}}}var zd,jd,Yd=!1,$d=[],qd=100;function Wd(){Ht(".flourish-warn-list").classed("visible",!1),Yd=!1}function Gd(){return Ht(".flourish-warn-btn").on("click",(function(){Yd?Wd():(Ht(".flourish-warn-list").classed("visible",!0),Yd=!0)})),{clear:Xd,warn:Zd}}function Vd(){Ht(".flourish-warn-container").classed("visible",$d.length),$d.length>qd&&($d.length=qd);var t=Ht(".flourish-warn-list ul").selectAll("li").data($d),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 Xd(){$d=[],Vd(),Wd()}function Zd(t){$d.unshift(t),Vd()}function Jd(t){var e=zd.visualisation,n=e.getTemplate(),r=!1,i=!1,o=!1;function a(){var e=zd.template_settings.getSettingsForCurrentTemplate(),n=zd.visualisation.settingsForCurrentTemplate(),r={};for(var i in n)i in e&&(r[i]=n[i]);jd.loadVisualisation(zd,r,(function(){zd.template_settings.populate(),zd.data_bindings.updateRequiredBindingsOverlay(!1),js.clear(),t&&t()})),qt()}n.getSettings((function(t,e){t?console.error("Failed to get template settings: "+t):(zd.template_settings.update(e),r=!0,i&&o&&a())})),n.getDataBindings((function(t,e){t?console.error("Failed to get template data bindings: "+t):(zd.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 Kd(t){jd.updateData(zd.visualisation,t)}function Qd(t){jd.updateDataNotPreview(zd.visualisation,t)}function tf(t){zd=t;var e=Gd();return{loadTemplate:Jd,updateData:Kd,updateDataNotPreview:Qd,sync:(jd=zs("iframe#preview","editor",zd,e,{setSetting({name:t,value:e}){const n=function(t){return document.getElementById("setting-"+t)}(t);n?(Od(n,e),n.dispatchEvent(new Event("change"))):console.log(`Could not find setting ${t}`)}})).sync,setState:jd.setState,getState:jd.getState,hasData:jd.hasData,setData:jd.setData,getData:jd.getData,draw:jd.draw,update:jd.update,getDefaultState:jd.getDefaultState,snapshot:jd.snapshot,setFixedHeight:jd.setFixedHeight,resize:jd.resize,getDrawCalled:jd.getDrawCalled,setDrawCalled:jd.setDrawCalled}}var ef={},nf={};function rf(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function of(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 af(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function sf(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+af(-t,6):t>9999?"+"+af(t,6):af(t,4)}(t.getUTCFullYear())+"-"+af(t.getUTCMonth()+1,2)+"-"+af(t.getUTCDate(),2)+(i?"T"+af(e,2)+":"+af(n,2)+":"+af(r,2)+"."+af(i,3)+"Z":r?"T"+af(e,2)+":"+af(n,2)+":"+af(r,2)+"Z":n||e?"T"+af(e,2)+":"+af(n,2)+"Z":"")}var lf=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 nf;if(u)return u=!1,ef;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())!==nf;){for(var d=[];r!==ef&&r!==nf;)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?sf(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=rf(t);return function(r,i){return e(n(r),i,t)}}(t,e):rf(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=of(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=of(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}(","),uf=lf.parseRows,cf=lf.formatRows;function df(t){return null==t?null:new Date(t)}function ff(t,e,n){Al(this,"object"==typeof e?(n=e).id:e,void 0,n,{getVersionNumber:function(){return t.version_number},setVersionNumber:function(e){t.version_number=e},getTimestamps:function(){var t=df(this.t_created);return{last_updated:df(this.t_updated)||t}}}),this.visualisation=t,this.api_prefix="/api/data_table"}function pf(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?pf(t):t}))}function hf(t){this.id=t}function mf(t,e,n,r=null){if(Al(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 ff(i,t)}))}}function gf(t,e,n){Dl({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 vf(t,e,n){Dl({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 yf(t,e,n,r){Dl({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 _f(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]:_f(t[n],e[n])}function bf(t,e,n,r){function i(){}this.visualisation=t,this.store_key="flourish_sdk",this.settings=e,this.template_data_bindings=n,this.public_url_prefix=r,this.is_read_only=!1,this.session_manager=w(this),this.template_settings=Pd(this),this.data_bindings=(bo=this,wo=Ht(".data-bindings"),{update:function(t){t&&(bo.template_data_bindings=t),Ao(bo.visualisation,bo.template_data_bindings)},modify:function(t,e=!1){Co(t,(function(){Ao(bo.visualisation,bo.template_data_bindings),e&&bo.preview_pane.updateData((t=>{if(t)return console.error("Failed to update preview pane: "+t)}))}))},requiredBindingsAreUnset:Do,updateRequiredBindingsOverlay:No}),this.preview_pane=tf(this),this.status_label={status_label:document.querySelector(".sdk-status-label")},this.session_reset_button=function(t){const e=document.querySelector(".sdk-session-reset-button");return e.addEventListener("click",(e=>{t.session_manager.clearSession(),e.preventDefault(),e.stopPropagation(),window.location.reload()})),{session_reset_button:e}}(this),this.responsive_menu=$t(this,this.session_manager.getPreviewSize()),this.confirm={on:i,blank:i,saved:i,saving:i,error:i},this.analytics=i,this.tour={fireEvent:i},window.addEventListener("hashchange",(()=>{this.loadFromUrlHash()}))}let wf;ff.prototype.getColumnTypes=function(t){Dl({url:this.api_prefix+"/"+this.id,method:"GET",callback:function(e,n){if(e)return t(e);t(void 0,pf(n.column_types||[]))}},"load-data")},ff.prototype.csv=function(t,e=null){this.cached_data?t(void 0,pf(this.cached_data)):this.csvPromise(e).then((e=>t(null,e)),(e=>t(e)))},ff.prototype.csvPromise=async function(t=null){if(this.cached_data)return pf(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)=>{Dl({url:n,response_type:"text/csv; charset=utf-8",method:"GET",callback(n,i){if(n)return r(n);e.cached_data=uf(i),t(pf(e.cached_data))}},"load-data")}))},ff.prototype.saveData=function(t,e){var n=this,r=oo(pf(t));Dl({url:this.api_prefix+"/"+this.id+"/csv",payload:function(){return{version_number:n.getVersionNumber(),data:cf(r)}},callback:function(t,i){if(t)return e(t);n.setVersionNumber(i.version_number),n.cached_data=r,n.t_updated=i.t_updated,n.t_last_checked=i.t_last_checked,e(void 0)}})},ff.prototype.updateFromUrl=function(t,e){var n=this;Dl({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.message,e(t.message);var i=function(t){oo(t);for(var e=0,n=t;e<n.length;e++)for(var r=n[e],i=0;i<r.length;i++){var o=r[i];if(null==o&&(o=""),"string"!=typeof o&&(o=""+o),"string"!=typeof o)throw new Error("BUG: somehow value was not a string");r[i]=o.trim()}return t}(uf(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))}})},ff.prototype.updateFromLiveCsvUrl=function(t){var e=this;Dl({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)}})},ff.prototype.save=function(t,e){return Ml(this,t,e)},ff.prototype.delete=function(t){return Ll(this,t)},hf.prototype.getSettings=function(t){if(this.settings)t(void 0,this.settings);else{var e=this;Dl({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)}})}},hf.prototype.getDataBindings=function(t){Dl({url:"/api/template/"+this.id+"/data_bindings",method:"GET",callback:t})},mf.prototype.save=function(t,e){this.is_listed||(t.is_listed=!0),Ml(this,t,e)},mf.prototype.setTemplateId=function(t,e){Ml(this,{template_id:t},e)},mf.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new hf(this.template_id)),this._template):null},mf.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},mf.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(fs(i))}))},mf.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},mf.prototype.refreshDataBindings=function(t){var e=this;let n=this.api_prefix+"/"+this.id;this.slide_id&&(n="/api/slide/"+this.slide_id+"/visualisation"),Dl({url:n+"/data_bindings",method:"GET",callback:function(n,r){if(n)return t(n);e.data_bindings=r,t()}})},mf.prototype.resetToTheme=function(t){var e=this;Dl({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)}})},mf.prototype.updateDataBindings=function(t,e){var n=this;if(this.is_listed)return gf(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):gf(n,t,e)}))},mf.prototype.updateSettings=function(t,e){var n=this;if(this.is_listed)return vf(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):vf(n,t,e)}))},mf.prototype.refreshSettings=function(t){var e=this;Dl({url:this.api_prefix+"/"+this.id+"/settings",method:"GET",callback:function(n,r){if(n)return t(n);e.settings=r,t()}})},mf.prototype.getThemeFontsAndColors=function(t){Dl({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)}})},mf.prototype.getDataTables=function(t){let e=this.api_prefix+"/"+this.id;this.slide_id&&(e="/api/slide/"+this.slide_id+"/visualisation"),Dl({url:e+"/data",method:"GET",callback:function(e,n){return e?t(e):t(void 0,n.data)}})},mf.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 ff(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=[]}})))},mf.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},mf.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=i.reduce(((t,e)=>(t.per_data_table[e.id]=e.getTimestamps(),t)),{per_data_table:{}}),u=0;u<i.length;u++)!function(r){a[r.id]=r.column_types,r.csv((function(u,c){if(u)throw u;e.template_id==n&&(o[r.id]=c,++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={},u=e.dataBindingsForCurrentTemplate();for(var c in u)s[c]=io(u[c],o,a,i[c],l);for(c in i)s[c]||(s[c]=[],s[c].column_names={},s[c].metadata={});t(void 0,s)})))}),e.slide_id)}(i[u]);0==i.length&&t(void 0,{})}}))},mf.prototype.delete=function(t){Ll(this,t)},mf.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},mf.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},mf.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0},mf.prototype.duplicate=function(t,e){Dl({url:this.api_prefix+"/"+this.id+"/duplicate",callback:e})},mf.prototype.deleteCanvaEmbed=function(t){Dl({url:this.api_prefix+"/"+this.id+"/delete_canva_embed",callback:t})},mf.prototype.publish=function(t,e,n){var r=this;if(this.is_listed)return yf(r,t,e,n);this.save({is_listed:!0},(function(i){return i?t(i):yf(r,t,e,n)}))},mf.prototype.unpublish=function(t){var e=this;Dl({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)}})},mf.prototype.published=function(){return!!this.showcase_url},mf.prototype.sendForReview=function(t,e,n){var r=this;Dl({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)}})},mf.prototype.approve=function(t,e){var n=this;Dl({url:"/api/review/"+t+"/approve",callback:function(t,r){return n.status=r,e(t,r)}})},mf.prototype.decline=function(t,e,n){var r=this;Dl({url:"/api/review/"+t+"/decline",payload:function(){return{message:e}},callback:function(t,e){r.status=e,n(t,e)}})},mf.prototype.cancelReview=function(t,e){var n=this;Dl({url:"/api/review/"+t+"/cancel",callback:function(t,r){n.status=r,e(t,r)}})},mf.list=function(t){Dl({url:"/api/visualisations",method:"GET",callback:t})},mf.getById=function(t,e){Dl({url:"/api/visualisation/"+t,method:"GET",callback:function(n,r){if(n)return e(n);e(void 0,new mf(t,r.version_number,r))}})},mf.getPublishedJson=function(t,e,n){Dl({url:`${e}visualisation/${t}/visualisation.json`,method:"GET",callback(t,e){if(t)return n(t);n(void 0,e)}})},mf.createFromTemplate=function(t,e){Dl({url:"/api/template/"+t+"/visualisations",method:"PUT",callback:e})},mf.createFromVisualisation=function(t,e){Dl({url:"/api/visualisation/"+t+"/duplicate",callback:e})},mf.setAsStaffPick=function(t,e){Dl({url:"/api/visualisation/"+t+"/set_staff_pick",method:"POST",callback:e})},mf.unsetAsStaffPick=function(t,e){Dl({url:"/api/visualisation/"+t+"/unset_staff_pick",method:"POST",callback:e})},mf.setFolder=function(t,e,n){Dl({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e)+"?use_id=1",method:"PUT",callback:n})},mf.removeFolder=function(t,e,n){Dl({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e)+"?use_id=1",method:"DELETE",callback:n})},mf.removeTag=function(t,e,n){Dl({url:"/api/visualisation/"+t+"/tag/"+encodeURIComponent(e),method:"DELETE",callback:n})},mf.prototype.updateCompanyAccess=function(t,e,n={}){Dl({url:"/api/visualisation/"+this.id+"/company_access",method:"POST",callback:e,payload:function(){return{company_access:t,options:n}}})},mf.prototype.getTags=function(t){Dl({url:"/api/visualisation/"+this.id+"/tags",method:"GET",callback:t})},mf.prototype.setTags=function(t,e){Dl({url:"/api/visualisation/"+this.id+"/tags",method:"PUT",callback:e,payload:function(){return{tags:t}}})},bf.prototype.initTemplate=function(){window.location.hash?this.preview_pane.loadTemplate((()=>{this.loadFromUrlHash()})):(this.session_manager.prepareSession(),this.preview_pane.loadTemplate((()=>{this.session_manager.applySession()})))},bf.prototype.showStatusMessage=function(t){const e=this.status_label.status_label;e.innerText=t,e.style.opacity=1,e.style.transform="translate(0, 0)",wf&&(clearTimeout(wf),wf=null),wf=setTimeout((()=>{e.style.opacity=0,e.style.transform="translate(0, 20%)",wf=null}),4e3)},bf.prototype.logInfo=function(...t){const e=new Intl.DateTimeFormat("default",{hour:"numeric",minute:"numeric",second:"numeric"}).format(new Date);console.info("🔹 flourish-sdk:",...t,`[${e}]`)},bf.prototype.loadFromUrlHash=async function(){if(!window.location.hash)return;this.session_manager.clearSession();const t=window.location.hash.slice(1),e=(n=mf.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)}},bf.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={};_f(i,this.preview_pane.getDefaultState()),_f(i,t),this.preview_pane.sync({state:i,data:r,overwrite_state:!0,update:!0},(()=>this.template_settings.populate()))};var Tf={},xf={};function Af(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Ef(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 Cf(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Sf(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+Cf(-t,6):t>9999?"+"+Cf(t,6):Cf(t,4)}(t.getUTCFullYear())+"-"+Cf(t.getUTCMonth()+1,2)+"-"+Cf(t.getUTCDate(),2)+(i?"T"+Cf(e,2)+":"+Cf(n,2)+":"+Cf(r,2)+"."+Cf(i,3)+"Z":r?"T"+Cf(e,2)+":"+Cf(n,2)+":"+Cf(r,2)+"Z":n||e?"T"+Cf(e,2)+":"+Cf(n,2)+"Z":"")}var kf=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 xf;if(u)return u=!1,Tf;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())!==xf;){for(var d=[];r!==Tf&&r!==xf;)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?Sf(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=Af(t);return function(r,i){return e(n(r),i,t)}}(t,e):Af(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=Ef(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Ef(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}(","),Df=kf.parseRows,Nf="$";function Mf(){}function Lf(t,e){var n=new Mf;if(t instanceof Mf)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 Ff(){}Mf.prototype=Lf.prototype={constructor:Mf,has:function(t){return Nf+t in this},get:function(t){return this[Nf+t]},set:function(t,e){return this[Nf+t]=e,this},remove:function(t){var e=Nf+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===Nf&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===Nf&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===Nf&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===Nf&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===Nf&&++t;return t},empty:function(){for(var t in this)if(t[0]===Nf)return!1;return!0},each:function(t){for(var e in this)e[0]===Nf&&t(this[e],e.slice(1),this)}};var Of=Lf.prototype;Ff.prototype={constructor:Ff,has:Of.has,add:function(t){return this[Nf+(t+="")]=t,this},remove:Of.remove,clear:Of.clear,values:Of.keys,size:Of.size,empty:Of.empty,each:Of.each};var Uf={value:function(){}};function Rf(){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 If(r)}function If(t){this._=t}function Hf(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Bf(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Uf,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function Pf(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 zf(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?zf(t):t}))}function jf(t){this.id=t}If.prototype=Rf.prototype={constructor:If,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=Bf(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Bf(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=Hf(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new If(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)}},Pf.prototype.csv=function(t){if(this.cached_data)t(void 0,zf(this.cached_data));else{var e=this;!function(t,e){var n,r,i,o,a=Rf("beforesend","progress","load","error"),s=Lf(),l=new XMLHttpRequest,u=null,c=null,d=0;function f(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=f:l.onreadystatechange=function(t){l.readyState>3&&f(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,f){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==f&&"function"==typeof i&&(f=i,i=null),null!=f&&1===f.length&&(f=function(t){return function(e,n){t(null==e?n:null)}}(f)),null!=f&&n.on("error",f).on("load",(function(t){f(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){const i=r.getResponseHeader("Last-Modified");e.cached_data=Df(r.response),e.timestamps={last_updated:i?new Date(i):new Date},t(void 0,zf(e.cached_data))}))}},Pf.prototype.saveData=function(t,e){e()},Pf.prototype.save=function(t,e){e()},Pf.prototype.delete=function(t){t()},jf.prototype.getSettings=function(t){t(void 0,window.Flourish.app.settings)},jf.prototype.getDataBindings=function(t){t(void 0,window.Flourish.app.template_data_bindings)},jf.prototype.refreshDataBindings=function(t){t(void 0)};var Yf={},$f={},qf=new Date,Wf=new Date;function Gf(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 Gf((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 qf.setTime(+e),Wf.setTime(+r),t(qf),t(Wf),Math.floor(n(qf,Wf))},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 Vf=864e5,Xf=6048e5,Zf=Gf((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()))/Vf}),(function(t){return t.getDate()-1}));function Jf(t){return Gf((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()))/Xf}))}Zf.range;var Kf=Jf(0),Qf=Jf(1),tp=Jf(2),ep=Jf(3),np=Jf(4),rp=Jf(5),ip=Jf(6);Kf.range,Qf.range,tp.range,ep.range,np.range,rp.range,ip.range;var op=Gf((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()}));op.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Gf((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},op.range;var ap=Gf((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/Vf}),(function(t){return t.getUTCDate()-1}));function sp(t){return Gf((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)/Xf}))}ap.range;var lp=sp(0),up=sp(1),cp=sp(2),dp=sp(3),fp=sp(4),pp=sp(5),hp=sp(6);lp.range,up.range,cp.range,dp.range,fp.range,pp.range,hp.range;var mp=Gf((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()}));function gp(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 vp(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 yp(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}mp.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Gf((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},mp.range;var _p,bp,wp,Tp={"-":"",_:" ",0:"0"},xp=/^\s*\d+/,Ap=/^%/,Ep=/[\\^$*+?|[\]().{}]/g;function Cp(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 Sp(t){return t.replace(Ep,"\\$&")}function kp(t){return new RegExp("^(?:"+t.map(Sp).join("|")+")","i")}function Dp(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function Np(t,e,n){var r=xp.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Mp(t,e,n){var r=xp.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Lp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Fp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Op(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Up(t,e,n){var r=xp.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Rp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Ip(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 Hp(t,e,n){var r=xp.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Bp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Pp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function zp(t,e,n){var r=xp.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function jp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Yp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function $p(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function qp(t,e,n){var r=xp.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Wp(t,e,n){var r=xp.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Gp(t,e,n){var r=Ap.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Vp(t,e,n){var r=xp.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Xp(t,e,n){var r=xp.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Zp(t,e){return Cp(t.getDate(),e,2)}function Jp(t,e){return Cp(t.getHours(),e,2)}function Kp(t,e){return Cp(t.getHours()%12||12,e,2)}function Qp(t,e){return Cp(1+Zf.count(op(t),t),e,3)}function th(t,e){return Cp(t.getMilliseconds(),e,3)}function eh(t,e){return th(t,e)+"000"}function nh(t,e){return Cp(t.getMonth()+1,e,2)}function rh(t,e){return Cp(t.getMinutes(),e,2)}function ih(t,e){return Cp(t.getSeconds(),e,2)}function oh(t){var e=t.getDay();return 0===e?7:e}function ah(t,e){return Cp(Kf.count(op(t)-1,t),e,2)}function sh(t){var e=t.getDay();return e>=4||0===e?np(t):np.ceil(t)}function lh(t,e){return t=sh(t),Cp(np.count(op(t),t)+(4===op(t).getDay()),e,2)}function uh(t){return t.getDay()}function ch(t,e){return Cp(Qf.count(op(t)-1,t),e,2)}function dh(t,e){return Cp(t.getFullYear()%100,e,2)}function fh(t,e){return Cp((t=sh(t)).getFullYear()%100,e,2)}function ph(t,e){return Cp(t.getFullYear()%1e4,e,4)}function hh(t,e){var n=t.getDay();return Cp((t=n>=4||0===n?np(t):np.ceil(t)).getFullYear()%1e4,e,4)}function mh(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Cp(e/60|0,"0",2)+Cp(e%60,"0",2)}function gh(t,e){return Cp(t.getUTCDate(),e,2)}function vh(t,e){return Cp(t.getUTCHours(),e,2)}function yh(t,e){return Cp(t.getUTCHours()%12||12,e,2)}function _h(t,e){return Cp(1+ap.count(mp(t),t),e,3)}function bh(t,e){return Cp(t.getUTCMilliseconds(),e,3)}function wh(t,e){return bh(t,e)+"000"}function Th(t,e){return Cp(t.getUTCMonth()+1,e,2)}function xh(t,e){return Cp(t.getUTCMinutes(),e,2)}function Ah(t,e){return Cp(t.getUTCSeconds(),e,2)}function Eh(t){var e=t.getUTCDay();return 0===e?7:e}function Ch(t,e){return Cp(lp.count(mp(t)-1,t),e,2)}function Sh(t){var e=t.getUTCDay();return e>=4||0===e?fp(t):fp.ceil(t)}function kh(t,e){return t=Sh(t),Cp(fp.count(mp(t),t)+(4===mp(t).getUTCDay()),e,2)}function Dh(t){return t.getUTCDay()}function Nh(t,e){return Cp(up.count(mp(t)-1,t),e,2)}function Mh(t,e){return Cp(t.getUTCFullYear()%100,e,2)}function Lh(t,e){return Cp((t=Sh(t)).getUTCFullYear()%100,e,2)}function Fh(t,e){return Cp(t.getUTCFullYear()%1e4,e,4)}function Oh(t,e){var n=t.getUTCDay();return Cp((t=n>=4||0===n?fp(t):fp.ceil(t)).getUTCFullYear()%1e4,e,4)}function Uh(){return"+0000"}function Rh(){return"%"}function Ih(t){return+t}function Hh(t){return Math.floor(+t/1e3)}function Bh(t){throw new TypeError("Expected a value of type string but got a value of type "+typeof t)}function Ph(t){return function(e){return"string"!=typeof e&&Bh(e),(e=e.trim())?t(e):null}}!function(t){_p=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=kp(i),c=Dp(i),d=kp(o),f=Dp(o),p=kp(a),h=Dp(a),m=kp(s),g=Dp(s),v=kp(l),y=Dp(l),_={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:Zp,e:Zp,f:eh,g:fh,G:hh,H:Jp,I:Kp,j:Qp,L:th,m:nh,M:rh,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ih,s:Hh,S:ih,u:oh,U:ah,V:lh,w:uh,W:ch,x:null,X:null,y:dh,Y:ph,Z:mh,"%":Rh},b={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:gh,e:gh,f:wh,g:Lh,G:Oh,H:vh,I:yh,j:_h,L:bh,m:Th,M:xh,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ih,s:Hh,S:Ah,u:Eh,U:Ch,V:kh,w:Dh,W:Nh,x:null,X:null,y:Mh,Y:Fh,Z:Uh,"%":Rh},w={a:function(t,e,n){var r=p.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=f[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:Pp,e:Pp,f:Wp,g:Rp,G:Up,H:jp,I:jp,j:zp,L:qp,m:Bp,M:Yp,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:Hp,Q:Vp,s:Xp,S:$p,u:Mp,U:Lp,V:Fp,w:Np,W:Op,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:Rp,Y:Up,Z:Ip,"%":Gp};function T(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=Tp[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 x(t,e){return function(n){var r,i,o=yp(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=vp(yp(o.y,0,1))).getUTCDay(),r=i>4||0===i?up.ceil(r):up(r),r=ap.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=gp(yp(o.y,0,1))).getDay(),r=i>4||0===i?Qf.ceil(r):Qf(r),r=Zf.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?vp(yp(o.y,0,1)).getUTCDay():gp(yp(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,vp(o)):gp(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 Tp?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return _.x=T(n,_),_.X=T(r,_),_.c=T(e,_),b.x=T(n,b),b.X=T(r,b),b.c=T(e,b),{format:function(t){var e=T(t+="",_);return e.toString=function(){return t},e},parse:function(t){var e=x(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=T(t+="",b);return e.toString=function(){return t},e},utcParse:function(t){var e=x(t+="",!0);return e.toString=function(){return t},e}}}(t),_p.format,_p.parse,bp=_p.utcFormat,wp=_p.utcParse}({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"]});var zh=new Date(1972,3,27,19,45,5),jh={"%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 Yh(t){return function(e){var n=null;return t.forEach((function(t){e.match(t.regex)&&(n=t.toDate(e))})),n}}function $h(t,e){var n,r=wp(t),i=bp(t);return n=Ph("function"==typeof e?function(t){return e(t,null!==r(t))}:function(t){return null!==r(t)}),Object.freeze({test:n,parse:Ph((function(e){return r(e)||(jh[t]?Yh(jh[t])(e):null)})),format:function(t){return i(t)},type:"datetime",description:t,id:"datetime$"+t,example:i(zh)})}var qh=Object.freeze([$h("%Y-%m-%dT%H:%M:%S.%LZ"),$h("%Y-%m-%d %H:%M:%S"),$h("%Y-%m-%dT%H:%M:%S"),$h("%Y-%m-%dT%H:%M:%SZ"),$h("%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})),$h("%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})),$h("%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])})),$h("%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})),$h("%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})),$h("%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])})),$h("%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})),$h("%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})),$h("%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])})),$h("%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})),$h("%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])})),$h("%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})),$h("%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])})),$h("%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})),$h("%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})),$h("%Y%m",(function(t,e){if(!e)return!1;var n=parseFloat(t.slice(0,4)),r=parseFloat(t.slice(4));return n>1e3&&r>0&&r<=12})),$h("%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})),$h("%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})),$h("%d %b %y"),$h("%-d %b ’%y"),$h("%d %B %y"),$h("%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})),$h("%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})),$h("%d-%b-%y"),$h("%d-%B-%y"),$h("%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})),$h("%m/%y"),$h("%b %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),$h("%B %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),$h("%b-%y"),$h("%b %y"),$h("%B %y"),$h("%b '%y"),$h("%b ’%y"),$h("%B %-d %Y"),$h("%d %b",(function(t,e){return!!e||!!Yh(jh["%d %b"])(t)})),$h("%d %B"),$h("%b %d",(function(t,e){return!!e||!!Yh(jh["%b %d"])(t)})),$h("%B %d"),$h("%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})),$h("%m-%d"),$h("%d/%m"),$h("%m/%d"),$h("%b %d %Y"),$h("%b %d %Y, %-I.%M%p"),$h("%Y",(function(t,e){if(!e)return!1;var n=parseFloat(t);return n>1499&&n<2200})),$h("%B"),$h("%b"),$h("%X"),$h("%I:%M %p"),$h("%-I.%M%p"),$h("%H:%M",(function(t,e){if(!e)return!1;var n=t.split(":").map(parseFloat);return n[0]>=0&&n[0]<24})),$h("%H:%M:%S"),$h("%M:%S"),$h("%-I%p"),$h("Q%q %Y",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length})),$h("%Y Q%q",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length})),$h("%YM%m",(function(t,e){if(!e)return!1;var n=t.split("M").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12})),$h("%YQ%q",(function(t,e){if(!e)return!1;var n=t.split("Q").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=4})),$h("%YÁ%q",(function(t,e){if(!e)return!1;var n=t.split("Á").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=4}))]);function Wh(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 Gh,Vh=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Xh(t){if(!(e=Vh.exec(t)))throw new Error("invalid format: "+t);var e;return new Zh({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 Zh(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 Jh(t,e){var n=Wh(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")}Xh.prototype=Zh.prototype,Zh.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 Kh={"%":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 Jh(100*t,e)},r:Jh,s:function(t,e){var n=Wh(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Gh=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")+Wh(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 Qh(t){return t}var tm=Array.prototype.map,em=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nm(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Qh:(e=tm.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?Qh:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(tm.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=Xh(t)).fill,n=t.align,d=t.sign,f=t.symbol,p=t.zero,h=t.width,m=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(m=!0,y="g"):Kh[y]||(void 0===g&&(g=12),v=!0,y="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var _="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",b="$"===f?o:/[%p]/.test(y)?l:"",w=Kh[y],T=/[defgprs%]/.test(y);function x(t){var i,o,l,f=_,x=b;if("c"===y)x=w(t)+x,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),f=(A?"("===d?d:u:"-"===d||"("===d?"":d)+f,x=("s"===y?em[8+Gh/3]:"")+x+(A&&"("===d?")":""),T)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){x=(46===l?a+t.slice(i+1):t.slice(i))+x,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var E=f.length+t.length+x.length,C=E<h?new Array(h-E+1).join(e):"";switch(m&&p&&(t=r(C+t,C.length?h-x.length:1/0),C=""),n){case"<":t=f+t+x+C;break;case"=":t=f+C+t+x;break;case"^":t=C.slice(0,E=C.length>>1)+f+t+x+C.slice(E);break;default:t=C+f+t+x}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)),x.toString=function(){return t+""},x}return{format:d,formatPrefix:function(t,e){var n,r=d(((t=Xh(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=Wh(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),a=em[8+i/3];return function(t){return r(o*t)+a}}}}var rm={test:Ph((function(t){return/^(\+|-)?\d{1,3}(,\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ph((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"},im={test:Ph((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ph((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"},om={test:Ph((function(t){return/^(\+|-)?\d+(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ph((function(t){return parseFloat(t)})),description:"No thousand separator, point decimal mark",thousand_separator:"",decimal_mark:".",id:"number$none_point",example:"12235.56"},am={test:Ph((function(t){return/^(\+|-)?\d{1,3}(\.\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ph((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"},sm={test:Ph((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ph((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"},lm={test:Ph((function(t){return/^(\+|-)?\d+(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ph((function(t){return parseFloat(t.replace(/,/,"."))})),description:"No thousand separator, comma decimal mark",thousand_separator:"",decimal_mark:",",id:"number$none_comma",example:"12235,56"},um=Object.freeze([rm,im,am,sm,om,lm]);um.forEach((function(t){t.type="number",t.format=function(t){var e,n,r=nm({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 cm=Object.freeze({test:function(t){return"string"==typeof t||Bh(t)},parse:function(t){return"string"==typeof t?t:Bh(t)},format:function(t){if("string"==typeof t)return t},type:"string",description:"Arbitrary string",id:"string$arbitrary_string"}),dm=Object.freeze({datetime:qh,number:um}),fm=Object.freeze(["datetime","number","string"]),pm=Object.freeze({n_max:250,n_failing_values:0,failure_fraction:.05,sort:!0}),hm=Object.freeze(Object.keys(pm));function mm(t,e){return t.index-e.index}function gm(t,e){return e.n_success-t.n_success||mm(t,e)}function vm(t){return(""+t).trim()}function ym(t){return void 0===t?function(t){return vm(t)}:"function"==typeof t?function(e,n){return vm(t(e,n))}:function(e){return vm(e[""+t])}}function _m(t){t?Array.isArray(t)||(t=[t]):t=fm;var e=t.reduce((function(t,e){var n=dm[e];return n&&Array.prototype.push.apply(t,n),t}),[]),n=-1!==t.indexOf("string"),r=hm.reduce((function(t,e){return t[e]=pm[e],t}),{}),i=function(t,i){i=ym(i);var o=t.map(i).filter(Boolean);if(!o.length)return n?[cm]:[];var a=Math.min(r.n_max,o.length),s=Math.floor(a*r.failure_fraction),l=r.n_failing_values,u=r.sort?gm:mm,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(cm),c};return hm.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}_m.DATETIME_IDS=Object.freeze(qh.map((function(t){return t.id}))),_m.NUMBER_IDS=Object.freeze(um.map((function(t){return t.id}))),_m.STRING_IDS=Object.freeze([cm.id]),_m.getInterpretation=function(){var t=qh.concat(um,cm).reduce((function(t,e){return t[e.id]=e,t}),{});return function(e){return t[e]}}(),_m._createAccessorFunction=ym;var bm,wm,Tm=dm;function xm(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,r.template_store_key=n.template_store_key,n.data_tables&&(this.data_tables=n.data_tables.map((function(t){return new Pf(r,t)}))),n.data_bindings&&(this.data_bindings=n.data_bindings)}$f.createInterpreter=_m,$f.recognised_formats=Tm,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}),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createInterpreter=void 0,t.extractData=function(t,n,r,i,o){var a=[],s=[],u=0,c=Object.assign([],{column_names:{},metadata:{},timestamps:{}}),d={};if(!i)return c;function f(t,e){if(!d[t])return{};var n=d[t];return n[e]?n[e]:{}}for(var p in r){var h={},m=r[p];if(m){for(let t=0;t<m.length;t++){const e=m[t].type_id,n=m[t].output_format_id,r=n&&"auto"!==n?n:e;h[m[t].index]={type_id:e,output_format_id:r}}d[p]=h}}for(var g in t){if(null===t[g])continue;if(void 0===t[g].columns&&void 0===t[g].column)continue;var v=t[g];if(v.template_data_binding=i[g],v.key=g,!(v.data_table_id in n)){var y=[];for(var _ in n)y.push(_);console.error("Data table id "+v.data_table_id+" not in "+JSON.stringify(y));continue}const e=n[v.data_table_id];if(null==e)throw new Error(`[BUG] The data from the data table with ID ${v.data_table_id} was missing`);if(0!=e.length){if("columns"in v&&null!=v.columns){var b=e[0].length;v.columns=v.columns.filter((function(t){return t<b})),c.column_names[g]=v.columns.map((function(t){return e[0][t]})),c.metadata[g]=v.columns.map((function(t){const e=f(v.data_table_id,t);if("type_id"in e){const{type_id:t,output_format_id:n}=e;return{type:t.split("$")[0],type_id:t,output_format_id:n}}return null}))}else{if(!("column"in v)||null==v.column)throw new Error("Data binding includes no column(s) specification: "+JSON.stringify(v));{c.column_names[g]=e[0][v.column];const t=f(v.data_table_id,v.column);if("type_id"in t){const{type_id:e,output_format_id:n}=t;c.metadata[g]={type:e.split("$")[0],type_id:e,output_format_id:n}}}}-1==s.indexOf(v.data_table_id)&&(s.push(v.data_table_id),u=Math.max(u,e.length-1)),a.push(v)}else console.warn("Empty data table")}function w(t,n,r){if(!t.template_data_binding?.data_type)return r;var i=function(t,n){const r=f(t,n);if("type_id"in r)return e.createInterpreter.getInterpretation(r.type_id)}(t.data_table_id,n);i&&"number"==i.type&&(r=l(r));var o=i?i.parse(r):r;return Number.isNaN(o)&&(o=null),o}c.timestamps=function(t){const e={},n=t.map((t=>t.last_updated?.getTime())).filter(Boolean);if(n.length){const t=Math.max(...n);e.last_updated=new Date(t)}return e}(s.map((t=>o.per_data_table[t])));for(var T=0;T<u;T++){for(var x={},A=0;A<a.length;A++){const t=n[(v=a[A]).data_table_id];if(null==t)throw new Error(`[BUG] The data from the data table with ID ${v.data_table_id} was missing`);if(!(T+1>=t.length)){if(null==v.key)throw new Error(`BUG: 'key' was ${v.key} in ${v}`);"columns"in v&&null!=v.columns?x[v.key]=v.columns.filter((function(e){return e<t[T+1].length})).map((function(e){return w(v,e,t[T+1][e])})):"column"in v&&null!=v.column&&(v.column>=t[T+1].length?x[v.key]=w(v,v.column,""):x[v.key]=w(v,v.column,t[T+1][v.column]))}}c.push(x)}return c},t.getColumnTypesForData=function(t){return u(t).map((function(t,e){const n=c(t);let i;i=n.length>2e3?r(n,1e3):n;const o=d(i)[0].id;return{type_id:o,index:e,output_format_id:o}}))},t.getRandomSeededSample=r,t.mulberry32=i,t.trimTrailingEmptyRows=o,t.dropReturnCharacters=function(t){for(const e of t)for(let t=0;t<e.length;t++)e[t]=e[t].replace(/(\r\n|\n|\r) {2}/g," ");return t},t.tidyTable=function(t){o(t);for(let e of t)for(let t=0;t<e.length;t++){let n=e[t];if(null==n&&(n=""),"string"!=typeof n&&(n=""+n),"string"!=typeof n)throw new Error("BUG: somehow value was not a string");e[t]=n.trim()}return t},t.stripCommonFixes=l,t.transposeNestedArray=u,t.getSlicedData=c,t.interpretColumn=d,t.sortDataTables=function(t,e){if(!e||!e.length)return;if(!t||!t.length)return;var n=[];return e.forEach((function(t){if("string"==typeof t)return;let e;if("column"in t?e=t.column:"columns"in t&&(e=t.columns),e){var r=e.match(/^(?:[^:]|:[^:])*/);r&&-1==n.indexOf(r[0])&&n.push(r[0])}})),t.sort((function(t,e){var r=n.indexOf(t.name),i=n.indexOf(e.name);return(-1==r?1/0:r)<(-1==i?1/0:i)?-1:1}))};const e=$f;var n=$f;function r(t,e){if(t.length<=2*e)return t;const n=i(t.length);for(;t.length>e;){const e=Math.floor(n()*t.length);t.splice(e,1)}return t}function i(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}}function o(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}Object.defineProperty(t,"createInterpreter",{enumerable:!0,get:function(){return n.createInterpreter}});var a=["#DIV/0","#N/A","#NAME?","#NULL!","#NUM!","#REF!","#VALUE!","#ERROR!"],s=(0,e.createInterpreter)().nMax(1/0).nFailingValues(8).failureFraction(.1);function l(t){return(t=t||"").replace(/[€£$¥%º]/g,"")}function u(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}function c(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)}function d(t){var e=t.filter((function(t){return t&&!a.includes(t.trim())})).map(l);return s(e)}}(Yf),xm.prototype.save=function(t,e){this.version_number++,e(void 0)},xm.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new jf(this.template_id)),this._template):null},xm.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},xm.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},xm.prototype.refreshDataBindings=function(t){t()},xm.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)},xm.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)},xm.prototype.getDataTables=function(t){t(void 0,window.Flourish.app.data_tables)},xm.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 Pf(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=[]}})))},xm.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},xm.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]=Yf.getColumnTypesForData(u),o[r.id]=u,++s==i.length&&e.getTemplate().getDataBindings((function(n,r){if(n)throw n;var s={};r.forEach((function(t){"string"!=typeof t&&(t.dataset in s||(s[t.dataset]={}),s[t.dataset][t.key]=t)}));var l={per_data_table:{}};for(const t of i)l.per_data_table[t.id]=t.timestamps;var u={},c=e.dataBindingsForCurrentTemplate();for(var d in c)u[d]=Yf.extractData(c[d],o,a,s[d],l);for(d in s)u[d]||(u[d]=[],u[d].column_names={},u[d].metadata={});t(void 0,u)})))}))}(i[l]);0==i.length&&t(void 0,{})}}))},xm.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},xm.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},xm.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0};var Am=!1;function Em(){bm&&bm.classList.remove("shown")}function Cm(){this.close(),Am||(bm&&setTimeout((function(){bm.classList.add("shown")}),1e3),setTimeout(Sm,250))}function Sm(){km().addEventListener("open",(function(){window.location.reload()}))}function km(){var t=new window.WebSocket(wm);return t.addEventListener("open",Em),t.addEventListener("close",Cm),t}return t.Visualisation=xm,t.initSDK=function(t,e,n,r){return gn(),window.Flourish=window.Flourish||{},window.Flourish.app=new bf(t,e,n,r),window.Flourish.app},t.talkToServer=function(){bm=document.getElementById("error-server-down"),wm=window.location.origin.replace(/^http(s?):\/\//,"ws$1://"),window.addEventListener("beforeunload",(function(){Am=!0})),km()},t}({});
3
+ /*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */const{entries:Uo,setPrototypeOf:Ro,isFrozen:Io,getPrototypeOf:Ho,getOwnPropertyDescriptor:Bo}=Object;let{freeze:Po,seal:zo,create:jo}=Object,{apply:Yo,construct:$o}="undefined"!=typeof Reflect&&Reflect;Po||(Po=function(t){return t}),zo||(zo=function(t){return t}),Yo||(Yo=function(t,e,n){return t.apply(e,n)}),$o||($o=function(t,e){return new t(...e)});const qo=oa(Array.prototype.forEach),Wo=oa(Array.prototype.lastIndexOf),Go=oa(Array.prototype.pop),Vo=oa(Array.prototype.push),Xo=oa(Array.prototype.splice),Zo=oa(String.prototype.toLowerCase),Jo=oa(String.prototype.toString),Ko=oa(String.prototype.match),Qo=oa(String.prototype.replace),ta=oa(String.prototype.indexOf),ea=oa(String.prototype.trim),na=oa(Object.prototype.hasOwnProperty),ra=oa(RegExp.prototype.test),ia=function(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return $o(t,n)}}(TypeError);function oa(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Yo(t,e,r)}}function aa(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Zo;Ro&&Ro(t,null);let r=e.length;for(;r--;){let i=e[r];if("string"==typeof i){const t=n(i);t!==i&&(Io(e)||(e[r]=t),i=t)}t[i]=!0}return t}function sa(t){for(let e=0;e<t.length;e++){na(t,e)||(t[e]=null)}return t}function la(t){const e=jo(null);for(const[n,r]of Uo(t)){na(t,n)&&(Array.isArray(r)?e[n]=sa(r):r&&"object"==typeof r&&r.constructor===Object?e[n]=la(r):e[n]=r)}return e}function ua(t,e){for(;null!==t;){const n=Bo(t,e);if(n){if(n.get)return oa(n.get);if("function"==typeof n.value)return oa(n.value)}t=Ho(t)}return function(){return null}}const ca=Po(["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"]),da=Po(["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"]),fa=Po(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),pa=Po(["animate","color-profile","cursor","discard","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"]),ha=Po(["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","mprescripts"]),ma=Po(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ga=Po(["#text"]),va=Po(["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","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","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","wrap","xmlns","slot"]),ya=Po(["accent-height","accumulate","additive","alignment-baseline","amplitude","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","exponent","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","intercept","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","slope","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","tablevalues","targetx","targety","transform","transform-origin","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"]),_a=Po(["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"]),ba=Po(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),wa=zo(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ta=zo(/<%[\w\W]*|[\w\W]*%>/gm),xa=zo(/\$\{[\w\W]*/gm),Aa=zo(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ea=zo(/^aria-[\-\w]+$/),Ca=zo(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Sa=zo(/^(?:\w+script|data):/i),ka=zo(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Da=zo(/^html$/i),Na=zo(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ma=Object.freeze({__proto__:null,ARIA_ATTR:Ea,ATTR_WHITESPACE:ka,CUSTOM_ELEMENT:Na,DATA_ATTR:Aa,DOCTYPE_NAME:Da,ERB_EXPR:Ta,IS_ALLOWED_URI:Ca,IS_SCRIPT_OR_DATA:Sa,MUSTACHE_EXPR:wa,TMPLIT_EXPR:xa});const La=1,Fa=3,Oa=7,Ua=8,Ra=9,Ia=function(){return"undefined"==typeof window?null:window};var Ha,Ba,Pa,za,ja,Ya,$a,qa,Wa,Ga=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ia();const n=e=>t(e);if(n.version="3.2.4",n.removed=[],!e||!e.document||e.document.nodeType!==Ra||!e.Element)return n.isSupported=!1,n;let{document:r}=e;const i=r,o=i.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:u,NodeFilter:c,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=e,m=u.prototype,g=ua(m,"cloneNode"),v=ua(m,"remove"),y=ua(m,"nextSibling"),_=ua(m,"childNodes"),b=ua(m,"parentNode");if("function"==typeof s){const t=r.createElement("template");t.content&&t.content.ownerDocument&&(r=t.content.ownerDocument)}let w,T="";const{implementation:x,createNodeIterator:A,createDocumentFragment:E,getElementsByTagName:C}=r,{importNode:S}=i;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Uo&&"function"==typeof b&&x&&void 0!==x.createHTMLDocument;const{MUSTACHE_EXPR:D,ERB_EXPR:N,TMPLIT_EXPR:M,DATA_ATTR:L,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:O,ATTR_WHITESPACE:U,CUSTOM_ELEMENT:R}=Ma;let{IS_ALLOWED_URI:I}=Ma,H=null;const B=aa({},[...ca,...da,...fa,...ha,...ga]);let P=null;const z=aa({},[...va,...ya,..._a,...ba]);let j=Object.seal(jo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Y=null,$=null,q=!0,W=!0,G=!1,V=!0,X=!1,Z=!0,J=!1,K=!1,Q=!1,tt=!1,et=!1,nt=!1,rt=!0,it=!1,ot=!0,at=!1,st={},lt=null;const ut=aa({},["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"]);let ct=null;const dt=aa({},["audio","video","img","source","image","track"]);let ft=null;const pt=aa({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ht="http://www.w3.org/1998/Math/MathML",mt="http://www.w3.org/2000/svg",gt="http://www.w3.org/1999/xhtml";let vt=gt,yt=!1,_t=null;const bt=aa({},[ht,mt,gt],Jo);let wt=aa({},["mi","mo","mn","ms","mtext"]),Tt=aa({},["annotation-xml"]);const xt=aa({},["title","style","font","a","script"]);let At=null;const Et=["application/xhtml+xml","text/html"];let Ct=null,St=null;const kt=r.createElement("form"),Dt=function(t){return t instanceof RegExp||t instanceof Function},Nt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!St||St!==t){if(t&&"object"==typeof t||(t={}),t=la(t),At=-1===Et.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Ct="application/xhtml+xml"===At?Jo:Zo,H=na(t,"ALLOWED_TAGS")?aa({},t.ALLOWED_TAGS,Ct):B,P=na(t,"ALLOWED_ATTR")?aa({},t.ALLOWED_ATTR,Ct):z,_t=na(t,"ALLOWED_NAMESPACES")?aa({},t.ALLOWED_NAMESPACES,Jo):bt,ft=na(t,"ADD_URI_SAFE_ATTR")?aa(la(pt),t.ADD_URI_SAFE_ATTR,Ct):pt,ct=na(t,"ADD_DATA_URI_TAGS")?aa(la(dt),t.ADD_DATA_URI_TAGS,Ct):dt,lt=na(t,"FORBID_CONTENTS")?aa({},t.FORBID_CONTENTS,Ct):ut,Y=na(t,"FORBID_TAGS")?aa({},t.FORBID_TAGS,Ct):{},$=na(t,"FORBID_ATTR")?aa({},t.FORBID_ATTR,Ct):{},st=!!na(t,"USE_PROFILES")&&t.USE_PROFILES,q=!1!==t.ALLOW_ARIA_ATTR,W=!1!==t.ALLOW_DATA_ATTR,G=t.ALLOW_UNKNOWN_PROTOCOLS||!1,V=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,X=t.SAFE_FOR_TEMPLATES||!1,Z=!1!==t.SAFE_FOR_XML,J=t.WHOLE_DOCUMENT||!1,tt=t.RETURN_DOM||!1,et=t.RETURN_DOM_FRAGMENT||!1,nt=t.RETURN_TRUSTED_TYPE||!1,Q=t.FORCE_BODY||!1,rt=!1!==t.SANITIZE_DOM,it=t.SANITIZE_NAMED_PROPS||!1,ot=!1!==t.KEEP_CONTENT,at=t.IN_PLACE||!1,I=t.ALLOWED_URI_REGEXP||Ca,vt=t.NAMESPACE||gt,wt=t.MATHML_TEXT_INTEGRATION_POINTS||wt,Tt=t.HTML_INTEGRATION_POINTS||Tt,j=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&Dt(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(j.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&Dt(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(j.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(j.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(W=!1),et&&(tt=!0),st&&(H=aa({},ga),P=[],!0===st.html&&(aa(H,ca),aa(P,va)),!0===st.svg&&(aa(H,da),aa(P,ya),aa(P,ba)),!0===st.svgFilters&&(aa(H,fa),aa(P,ya),aa(P,ba)),!0===st.mathMl&&(aa(H,ha),aa(P,_a),aa(P,ba))),t.ADD_TAGS&&(H===B&&(H=la(H)),aa(H,t.ADD_TAGS,Ct)),t.ADD_ATTR&&(P===z&&(P=la(P)),aa(P,t.ADD_ATTR,Ct)),t.ADD_URI_SAFE_ATTR&&aa(ft,t.ADD_URI_SAFE_ATTR,Ct),t.FORBID_CONTENTS&&(lt===ut&&(lt=la(lt)),aa(lt,t.FORBID_CONTENTS,Ct)),ot&&(H["#text"]=!0),J&&aa(H,["html","head","body"]),H.table&&(aa(H,["tbody"]),delete Y.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw ia('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw ia('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=t.TRUSTED_TYPES_POLICY,T=w.createHTML("")}else void 0===w&&(w=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";e&&e.hasAttribute(r)&&(n=e.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(h,o)),null!==w&&"string"==typeof T&&(T=w.createHTML(""));Po&&Po(t),St=t}},Mt=aa({},[...da,...fa,...pa]),Lt=aa({},[...ha,...ma]),Ft=function(t){Vo(n.removed,{element:t});try{b(t).removeChild(t)}catch(e){v(t)}},Ot=function(t,e){try{Vo(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){Vo(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(tt||et)try{Ft(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Ut=function(t){let e=null,n=null;if(Q)t="<remove></remove>"+t;else{const e=Ko(t,/^[\r\n\t ]+/);n=e&&e[0]}"application/xhtml+xml"===At&&vt===gt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const i=w?w.createHTML(t):t;if(vt===gt)try{e=(new p).parseFromString(i,At)}catch(t){}if(!e||!e.documentElement){e=x.createDocument(vt,"template",null);try{e.documentElement.innerHTML=yt?T:i}catch(t){}}const o=e.body||e.documentElement;return t&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),vt===gt?C.call(e,J?"html":"body")[0]:J?e.documentElement:o},Rt=function(t){return A.call(t.ownerDocument||t,t,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},It=function(t){return 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||"function"!=typeof t.hasChildNodes)},Ht=function(t){return"function"==typeof l&&t instanceof l};function Bt(t,e,r){qo(t,(t=>{t.call(n,e,r,St)}))}const Pt=function(t){let e=null;if(Bt(k.beforeSanitizeElements,t,null),It(t))return Ft(t),!0;const r=Ct(t.nodeName);if(Bt(k.uponSanitizeElement,t,{tagName:r,allowedTags:H}),t.hasChildNodes()&&!Ht(t.firstElementChild)&&ra(/<[/\w]/g,t.innerHTML)&&ra(/<[/\w]/g,t.textContent))return Ft(t),!0;if(t.nodeType===Oa)return Ft(t),!0;if(Z&&t.nodeType===Ua&&ra(/<[/\w]/g,t.data))return Ft(t),!0;if(!H[r]||Y[r]){if(!Y[r]&&jt(r)){if(j.tagNameCheck instanceof RegExp&&ra(j.tagNameCheck,r))return!1;if(j.tagNameCheck instanceof Function&&j.tagNameCheck(r))return!1}if(ot&&!lt[r]){const e=b(t)||t.parentNode,n=_(t)||t.childNodes;if(n&&e){for(let r=n.length-1;r>=0;--r){const i=g(n[r],!0);i.__removalCount=(t.__removalCount||0)+1,e.insertBefore(i,y(t))}}}return Ft(t),!0}return t instanceof u&&!function(t){let e=b(t);e&&e.tagName||(e={namespaceURI:vt,tagName:"template"});const n=Zo(t.tagName),r=Zo(e.tagName);return!!_t[t.namespaceURI]&&(t.namespaceURI===mt?e.namespaceURI===gt?"svg"===n:e.namespaceURI===ht?"svg"===n&&("annotation-xml"===r||wt[r]):Boolean(Mt[n]):t.namespaceURI===ht?e.namespaceURI===gt?"math"===n:e.namespaceURI===mt?"math"===n&&Tt[r]:Boolean(Lt[n]):t.namespaceURI===gt?!(e.namespaceURI===mt&&!Tt[r])&&!(e.namespaceURI===ht&&!wt[r])&&!Lt[n]&&(xt[n]||!Mt[n]):!("application/xhtml+xml"!==At||!_t[t.namespaceURI]))}(t)?(Ft(t),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!ra(/<\/no(script|embed|frames)/i,t.innerHTML)?(X&&t.nodeType===Fa&&(e=t.textContent,qo([D,N,M],(t=>{e=Qo(e,t," ")})),t.textContent!==e&&(Vo(n.removed,{element:t.cloneNode()}),t.textContent=e)),Bt(k.afterSanitizeElements,t,null),!1):(Ft(t),!0)},zt=function(t,e,n){if(rt&&("id"===e||"name"===e)&&(n in r||n in kt))return!1;if(W&&!$[e]&&ra(L,e));else if(q&&ra(F,e));else if(!P[e]||$[e]){if(!(jt(t)&&(j.tagNameCheck instanceof RegExp&&ra(j.tagNameCheck,t)||j.tagNameCheck instanceof Function&&j.tagNameCheck(t))&&(j.attributeNameCheck instanceof RegExp&&ra(j.attributeNameCheck,e)||j.attributeNameCheck instanceof Function&&j.attributeNameCheck(e))||"is"===e&&j.allowCustomizedBuiltInElements&&(j.tagNameCheck instanceof RegExp&&ra(j.tagNameCheck,n)||j.tagNameCheck instanceof Function&&j.tagNameCheck(n))))return!1}else if(ft[e]);else if(ra(I,Qo(n,U,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==ta(n,"data:")||!ct[t]){if(G&&!ra(O,Qo(n,U,"")));else if(n)return!1}else;return!0},jt=function(t){return"annotation-xml"!==t&&Ko(t,R)},Yt=function(t){Bt(k.beforeSanitizeAttributes,t,null);const{attributes:e}=t;if(!e||It(t))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:P,forceKeepAttr:void 0};let i=e.length;for(;i--;){const o=e[i],{name:a,namespaceURI:s,value:l}=o,u=Ct(a);let c="value"===a?l:ea(l);if(r.attrName=u,r.attrValue=c,r.keepAttr=!0,r.forceKeepAttr=void 0,Bt(k.uponSanitizeAttribute,t,r),c=r.attrValue,!it||"id"!==u&&"name"!==u||(Ot(a,t),c="user-content-"+c),Z&&ra(/((--!?|])>)|<\/(style|title)/i,c)){Ot(a,t);continue}if(r.forceKeepAttr)continue;if(Ot(a,t),!r.keepAttr)continue;if(!V&&ra(/\/>/i,c)){Ot(a,t);continue}X&&qo([D,N,M],(t=>{c=Qo(c,t," ")}));const d=Ct(t.nodeName);if(zt(d,u,c)){if(w&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(d,u)){case"TrustedHTML":c=w.createHTML(c);break;case"TrustedScriptURL":c=w.createScriptURL(c)}try{s?t.setAttributeNS(s,a,c):t.setAttribute(a,c),It(t)?Ft(t):Go(n.removed)}catch(t){}}}Bt(k.afterSanitizeAttributes,t,null)},$t=function t(e){let n=null;const r=Rt(e);for(Bt(k.beforeSanitizeShadowDOM,e,null);n=r.nextNode();)Bt(k.uponSanitizeShadowNode,n,null),Pt(n),Yt(n),n.content instanceof a&&t(n.content);Bt(k.afterSanitizeShadowDOM,e,null)};return n.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,s=null,u=null;if(yt=!t,yt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!Ht(t)){if("function"!=typeof t.toString)throw ia("toString is not a function");if("string"!=typeof(t=t.toString()))throw ia("dirty is not a string, aborting")}if(!n.isSupported)return t;if(K||Nt(e),n.removed=[],"string"==typeof t&&(at=!1),at){if(t.nodeName){const e=Ct(t.nodeName);if(!H[e]||Y[e])throw ia("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof l)r=Ut("\x3c!----\x3e"),o=r.ownerDocument.importNode(t,!0),o.nodeType===La&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!tt&&!X&&!J&&-1===t.indexOf("<"))return w&&nt?w.createHTML(t):t;if(r=Ut(t),!r)return tt?null:nt?T:""}r&&Q&&Ft(r.firstChild);const c=Rt(at?t:r);for(;s=c.nextNode();)Pt(s),Yt(s),s.content instanceof a&&$t(s.content);if(at)return t;if(tt){if(et)for(u=E.call(r.ownerDocument);r.firstChild;)u.appendChild(r.firstChild);else u=r;return(P.shadowroot||P.shadowrootmode)&&(u=S.call(i,u,!0)),u}let d=J?r.outerHTML:r.innerHTML;return J&&H["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&ra(Da,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),X&&qo([D,N,M],(t=>{d=Qo(d,t," ")})),w&&nt?w.createHTML(d):d},n.setConfig=function(){Nt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),K=!0},n.clearConfig=function(){St=null,K=!1},n.isValidAttribute=function(t,e,n){St||Nt({});const r=Ct(t),i=Ct(e);return zt(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&Vo(k[t],e)},n.removeHook=function(t,e){if(void 0!==e){const n=Wo(k[t],e);return-1===n?void 0:Xo(k[t],n,1)[0]}return Go(k[t])},n.removeHooks=function(t){k[t]=[]},n.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function Va(){if(null==Ha){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}();Ha="referrer"in t?/^https:\/\/medium.com\//.test(t.referrer):!("auto"in t)}return Ha}function Xa(t){var e=t||window.innerWidth;return e>999?650:e>599?575:400}function Za(t){if(t&&window.top!==window.self){var e=window;"srcdoc"==e.location.pathname&&(e=e.parent);var n={sender:"Flourish",method:"scrolly",captions:t.captions,hasScrollyTransformFix:t.hasScrollyTransformFix};e.parent.postMessage(JSON.stringify(n),"*")}}function Ja(t,e){if(window.top!==window.self){var n=window;if("srcdoc"==n.location.pathname&&(n=n.parent),Ba)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 Ka(){return(-1!==navigator.userAgent.indexOf("Safari")||-1!==navigator.userAgent.indexOf("iPhone"))&&-1==navigator.userAgent.indexOf("Chrome")}function Qa(t){return"string"==typeof t||t instanceof String}function ts(t){return"warn"!==t.method?(console.warn("BUG: validateWarnMessage called for method"+t.method),!1):!(null!=t.message&&!Qa(t.message))&&!(null!=t.explanation&&!Qa(t.explanation))}function es(t){return"resize"!==t.method?(console.warn("BUG: validateResizeMessage called for method"+t.method),!1):!!Qa(t.src)&&(!!Qa(t.context)&&!!("number"==typeof(e=t.height)?!isNaN(e)&&e>=0:Qa(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 ns(t){throw new Error("Validation for setSetting is not implemented yet; see issue #4328")}function rs(t){return"scrolly"!==t.method?(console.warn("BUG: validateScrolly called for method"+t.method),!1):!!Array.isArray(t.captions)}function is(t){return"customerAnalytics"===t.method||(console.warn("BUG: validateCustomerAnalyticsMessage called for method"+t.method),!1)}function os(t){return"request-upload"!==t.method?(console.warn("BUG: validateResizeMessage called for method"+t.method),!1):!!Qa(t.name)&&!(null!=t.accept&&!Qa(t.accept))}function as(t,e,n){var r=function(t){for(var e={warn:ts,resize:es,setSetting:ns,customerAnalytics:is,"request-upload":os,scrolly:rs},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)}})),Ka()&&(window.addEventListener("resize",ss),ss())}function ss(){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 ls(t,e,n){var r=t.parentNode;if(r.classList.contains("fl-scrolly-wrapper"))return void console.warn("createScrolly is being called more than once per story. This should not happen.");r.classList.add("fl-scrolly-wrapper"),r.style.position="relative",r.style.paddingBottom="1px",r.style.transform="translate3d(0, 0, 0)";const i=navigator.platform.indexOf("Win")>-1,o=!!window.chrome&&(navigator.userAgent.indexOf("Chrome")>-1||navigator.userAgent.indexOf("Edg")>-1||navigator.userAgent.indexOf("OPR")>-1);if(i&&o&&n){let t,e=0;window.addEventListener("scroll",(function(){clearTimeout(t),t=setTimeout((()=>{e=0===e?1:0,r.style.transform=`translateZ(${e}px)`}),100)}))}t.style.position="sticky";var a=r.getAttribute("data-height")||null;a||(a="80vh",t.style.height=a),t.style.top="calc(50vh - "+a+"/2)";var s=r.querySelector(".flourish-credit");s&&(s.style.position="sticky",s.style.top="calc(50vh + "+a+"/2)"),e.forEach((function(t,e){var n="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=n?"100vh":"50vh",i.style.marginLeft="auto",i.style.marginRight="auto";var o=document.createElement("div");o.innerHTML=Ga.sanitize(t,{ADD_ATTR:["target"]}),o.style.visibility=n?"":"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),r.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%"}))}(r)}function us(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)cs(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||(cs(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 cs(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:Ka()?n.style.width=e.offsetWidth+"px":n.style.width="100%",!!i||(t.match(/\?/)?t+="&auto=1":t+="?auto=1",i=Xa(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 ds(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=Object.create(null));var r=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}([],e,!0);for(var i in t){r.push(i);var o=t[i];"object"==typeof o&&ds(o,r,n),n[r.join(".")]=t[i],r.pop()}return n}function fs(t){var e=Object.create(null);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]=Object.create(null)),r=r[a]}r[n.substring(o)]=t[n]}return e}function ps(t){if(null==t)return t;var e,n=Object.create(null);for(var r in t){var i=t[r];Array.isArray(i)?n[r]=i.slice():(e=t[r],Array.isArray(e)||"object"!=typeof e||null==e?n[r]=t[r]:n[r]=ps(t[r]))}return n}"function"==typeof SuppressedError&&SuppressedError;var hs,ms=null;function gs(){return"MessageChannel"in window}var vs=null;function ys(){vs&&Pa.removeEventListener("load",vs),vs=null}function _s(t){ys(),Pa.addEventListener("load",t),vs=t}function bs(t,e,n){return Ps(!1),Wa=t?t.visualisation?t.visualisation:t.current_slide.visualisation:null,ms=null,Wa&&Wa.template_id?(_s(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(){jt(),!Wa||Wa.template_id!=r||t.current_slide&&t.current_slide.id!==i||(ys(),ks((function(o,a){o?console.error("Failed to get default state"):!Wa||Wa.template_id!=r||t.current_slide&&t.current_slide.id!==i||Ds((function(o,s){if(o)console.error("Failed to call hasData");else if(Wa&&Wa.template_id==r&&(!t.current_slide||t.current_slide.id===i)){var l=!1;t.visualisation&&(l=t.data_bindings.requiredBindingsAreUnset()),s?Wa.refreshDataBindings((function(o){o?console.error("Failed to refresh data bindings"):!Wa||Wa.template_id!=r||t.current_slide&&t.current_slide.id!==i||Wa.prepareData((function(o,s){o?console.error("Failed to prepare data for template"):!Wa||Wa.template_id!=r||t.current_slide&&t.current_slide.id!==i||Hs({data:s,state:e,draw:!l},(function(t,e){ms=a,n(t,e)}))}))})):Hs({state:e,draw:!l},(function(t,e){ms=a,n(t,e)}))}}))})))}}(t,e,n)),Pa.src="/template/"+Wa.template_id+"/embed/?auto=1&environment="+za+"&is_read_only="+(t.is_read_only?"1":"0"),Pa):(ys(),Pa.src="about:blank",Pa)}function ws(t){ks((function(e,n){e?console.error("Failed to get default state"):(ms=n,t())}))}function Ts(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(Wa&&Wa.template_id==n)return t?(console.error("Failed to prepare data for template"),void e(t)):void e(void 0,r)}))}))}function xs(t,e){Ts(t,(function(t,n){if(t)return e(t);Hs({data:n,update:!0},e)}))}function As(t,e){Ts(t,(function(t,n){if(t)return e(t);Hs({data:n,update:!1},e)}))}function Es(t,e,n){Ts(t,(function(t,r){if(t)return n(t);Hs({data:r,state:e,overwrite_state:!0,update:!0},n)}))}function Cs(t,e,n,r=Pa){if(gs()){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 Ss(t,e){Cs("setState",fs(t),e)}function ks(t,e){"function"!=typeof t?Cs("getState",t,e):Cs("getState",void 0,t)}function Ds(t){Cs("hasData",void 0,t)}function Ns(t,e){Cs("setData",t,e)}function Ms(t){Cs("getData",void 0,t)}function Ls(t){Cs("draw",void 0,t),Ps(!0)}function Fs(t){$a&&$a.clear(),Bs()&&Cs("update",void 0,t)}function Os(t,e,n){Cs("snapshot",t,e,n)}function Us(){return ps(ms)}function Rs(t,e){Cs("setFixedHeight",t,e)}function Is(t){if(Pa.parentNode.offsetWidth){if(void 0!==t)hs=null!=t;else if(hs)return;var e=t||Ya&&Ya.responsive_menu&&Ya.responsive_menu.getHeightSetting()||ja.getHeightForBreakpoint(Pa.offsetWidth),n=typeof e;("number"===n||"string"===n&&!isNaN(e))&&(e+="px"),Pa.style.height=e}}function Hs(t,e,n=Pa){Bs()?delete t.draw:t.draw&&Ps(!0),t.state&&(t.state=fs(t.state)),$a&&$a.clear(),Cs("sync",t,(function(n,r){null!=n||"success"!==r?(t.draw&&Ps(!1),function n(r){r?e&&e(r):function(t,e){return t.data?(Ns(t.data,e),delete t.data,!1):t.state?(Ss(t.state,e),delete t.state,!1):t.draw?(Ls(e),delete t.draw,!1):!t.update||(Fs(e),delete t.update,!1)}(t,n)&&e&&e(void 0)}(n)):e&&e(void 0)}),n)}function Bs(){return qa}function Ps(t){qa=t}function zs(t,e,n,r,i){return Pa=document.querySelector(t),za=e,Ya=n,$a=r,i||(i={}),Ba="#amp=1"==window.location.hash,ja={createEmbedIframe:us,isFixedHeight:Va,getHeightForBreakpoint:Xa,startEventListeners:as,notifyParentWindow:Ja,initScrolly:Za,createScrolly:ls,isSafari:Ka,initCustomerAnalytics:Oo,addAnalyticsListener:Fo,sendCustomerAnalyticsMessage:Lo},Pa.style.height=ja.getHeightForBreakpoint(Pa.offsetWidth)+"px",ja.startEventListeners((function(t){"resize"==t.method?Is(t.height):"warn"==t.method?($a&&$a.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"]),gs()||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)}}(Pa.parentNode),{loadVisualisation:bs,updateData:xs,updateDataAndState:Es,updateDataNotPreview:As,setState:Ss,getState:ks,getDefaultState:Us,hasData:Ds,setData:Ns,getData:Ms,draw:Ls,update:Fs,snapshot:Os,setFixedHeight:Rs,resize:Is,sync:Hs,getDrawCalled:Bs,setDrawCalled:Ps,setFrameLoadListener:_s,updateDefaultState:ws}}var js={start:function(t=document.body){t.classList.add("loading")},clear:function(t=document.body){t.classList.remove("loading")}};const Ys=new Set([1,274,282,283,296,34675,40961,42240]);function $s(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,!Ys.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 f;if(d<=4)f=new DataView(new ArrayBuffer(4),0,4),f.setUint32(0,a,o);else{f=new DataView(new ArrayBuffer(d));for(let t=0;t<d;t++)f.setInt8(t,r.getInt8(a+t))}e.push({code:t,type:n,num_values:i,data:f})}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),f=new DataView(d.buffer);d.set((new TextEncoder).encode("MM\0*\0\0\0\b"),0),f.setUint16(8,e.length);let p=10,h=10+12*e.length+4;for(const{code:t,type:n,num_values:r,data:i}of e){if(f.setUint16(p,t),f.setUint16(p+2,n),f.setUint32(p+4,r),i.byteLength<=4)for(let t=0;t<i.byteLength;t++)f.setInt8(p+8+t,i.getInt8(t));else{f.setUint32(p+8,h);for(let t=0;t<i.byteLength;t++)f.setInt8(h+t,i.getInt8(t));h+=i.byteLength}p+=12}const m=new Uint8Array(10),g=new DataView(m.buffer);g.setUint8(0,255),g.setUint8(1,225),g.setUint16(2,f.byteLength+8),m.set(a,4),yield m,yield f}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,f=!1;for(;null!=(c=n());){if(d&&217===c.getUint8(0)){f=!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)),f=!0;break}o(c),d=c.byteLength>0&&255===c.getUint8(c.byteLength-1)}return f||o(u),r}function qs(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 Ws="⬆︎",Gs="/api/file/upload";function Vs(t){(t||document).querySelectorAll("input[type=url]").forEach((function(t){Xs(t)}))}function Xs(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=Ws,t.insertAdjacentElement("afterend",n),e||(n.onclick=Zs)}function Zs(){var t=this.previousSibling,e=t.getAttribute("accept");t.disabled=!0,t.classList.toggle("uploading",!0),Js({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 Js(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(){js.start(),await async function(t,e,n){const r=await async function(t){try{if("image/png"===t.type)return new File([qs(await t.arrayBuffer())],t.name,{type:t.type});if("image/jpeg"===t.type)return new File([$s(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};Ks(Gs,n,(function(t,n){return t?e(t):e(null,JSON.parse(n.responseText))}))}(r,(function(t,i){if(t)return js.clear(),uo("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);Ks(i.upload_url,o,(function(t,r){js.clear(),t?(uo("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 Ks(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 Qs="https://fonts.googleapis.com/css?family=",tl=["Source Sans Pro","Roboto Condensed","Merriweather","Lora","Playfair Display","Coda","Lobster","Cabin Sketch"],el="Same as parent",nl=[],rl=[],il={};function ol(t){return Qs+t.replace(/ /g,"+")+":400,700"}function al(t){var e=rl.concat(nl,tl.map((function(t){return{name:t,url:ol(t)}})));return t&&e.unshift({name:el}),e}function sl(t){return al(!0).find((function(e){return e.name==t}))}var ll=!1;function ul(t){return t.substr(t.lastIndexOf("=")+1).replace(/\+/g," ")}function cl(t){var e=t.target,n=e.value;if(n&&(0==n.indexOf(Qs)&&(n=e.value=ul(n)),!sl(n))){if(/^https?:\/\//.test(n)){ll||(dl(n),e.value="");var r=n;return n=e.value=ul(r),rl.push({name:n,url:r}),void fl()}var i=ol(n);try{var o=new XMLHttpRequest;if(o.open("HEAD",i,!1),o.send(),404==o.status)throw"Font not found";rl.push({name:n,url:i}),fl()}catch(t){dl(n),e.value=""}}}function dl(t){uo("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 fl(){var t,e,n=Object.keys(il);for(t=0;t<n.length;++t)(e=il[n[t]]).dropdown.setOptions(al(e.can_inherit).map((function(t){return t.name})))}var pl={initialize:function(t,e,n){var r=!!e.optional;ll=n,t.classList.add("font-menu");var i=new fo({input:t,id:e.property+"-dropdown",options:al(r).map((t=>t.name)),mode:"single",options_config:{allow_other_option:!0}});t._dropdown=i,il[e.property]={dropdown:i,can_inherit:r},t.addEventListener("change",cl)},update:function(t,e){var n=e?e.name:el;t._dropdown.setSelectedOptions(n),sl(n)||(n!=el&&rl.push({name:n,url:e.url}),fl())},getValue:function(t){if(/^https?:\/\//.test(t.value))return{name:ul(t.value),url:t.value};var e=t.value;if(e==el)return null;var n=sl(e);return n||{name:e,url:ol(e)}},replaceThemeFonts:function(t){nl=(t||[]).map((function(t){return{name:t.name,url:t.url}})),fl()}},hl="$";function ml(){}function gl(t,e){var n=new ml;if(t instanceof ml)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 vl(){}ml.prototype=gl.prototype={constructor:ml,has:function(t){return hl+t in this},get:function(t){return this[hl+t]},set:function(t,e){return this[hl+t]=e,this},remove:function(t){var e=hl+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===hl&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===hl&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===hl&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===hl&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===hl&&++t;return t},empty:function(){for(var t in this)if(t[0]===hl)return!1;return!0},each:function(t){for(var e in this)e[0]===hl&&t(this[e],e.slice(1),this)}};var yl=gl.prototype;vl.prototype={constructor:vl,has:yl.has,add:function(t){return this[hl+(t+="")]=t,this},remove:yl.remove,clear:yl.clear,values:yl.keys,size:yl.size,empty:yl.empty,each:yl.each};var _l={value:function(){}};function bl(){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 wl(r)}function wl(t){this._=t}function Tl(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function xl(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=_l,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function Al(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]}wl.prototype=bl.prototype={constructor:wl,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=xl(i[n],t.name,e);else if(null==e)for(n in i)i[n]=xl(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=Tl(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new wl(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 El={};function Cl(t){t.running||(t.running=!0,Sl(t,(function(){t.running=!1})))}function Sl(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&&kl(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())&&kl(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=bl("beforesend","progress","load","error"),s=gl(),l=new XMLHttpRequest,u=null,c=null,d=0;function f(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)}return"undefined"!=typeof XDomainRequest&&!("withCredentials"in l)&&/^(http(s)?:)?\/\//.test(t)&&(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=l.ontimeout=f:l.onreadystatechange=function(t){l.readyState>3&&f(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,f){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==f&&"function"==typeof i&&(f=i,i=null),null!=f&&1===f.length&&(f=function(t){return function(e,n){t(null==e?n:null)}}(f)),null!=f&&n.on("error",f).on("load",(function(t){f(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}},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():Sl(t,e)}))}function kl(t){return["POST","PUT","DELETE"].includes(t)}function Dl(t,e){void 0===e&&(e="default"),e in El||(El[e]={items:[],running:!1,name:e}),El[e].items.push(t),Cl(El[e])}function Nl(t,e){for(var n in e)t[n]=e[n];return t}function Ml(t,e,n,r){"function"==typeof n&&(r=n,n=!1),n&&Nl(t,e),Dl({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||Nl(t,e),t.setVersionNumber(o.version_number),r(void 0)}})}function Ll(t,e){t.delete_requested=!0,Dl({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)}})}function Fl(t){Dl({url:"/api/history",method:"POST",payload:function(){return t},callback:function(){}})}var Ol={addApiKey:function(t){Dl({url:"/api/user/api_keys",method:"PUT",callback:t})},addFolder:function(t,e,n,r){Dl({url:`/api/user/folder/${encodeURIComponent(t)}`,method:"PUT",payload:()=>({share:e,parent_id:n}),callback:r})},addTag:function(t,e){Dl({url:"/api/user/tag/"+encodeURIComponent(t),method:"PUT",callback:e})},deleteApiKey:function(t,e){Dl({url:"/api/user/api_keys/"+t,method:"DELETE",callback:e})},fetchFolders:function(t){Dl({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("filter="+encodeURIComponent(n)),r&&u.push("offset="+encodeURIComponent(r)),i&&u.push("limit="+encodeURIComponent(i)),o&&u.push("search="+encodeURIComponent(o)),a&&u.push("is_recent=true"),s&&u.push("shared=true"),e&&(l+="/folder/"+encodeURIComponent(e)),u.length&&(l+="?"+u.join("&")),Dl({url:l,method:"GET",callback:t})},generateSdkToken:function(t){Dl({url:"/api/user/generate_sdk_token",method:"GET",callback:t})},getApiKeys:function(t){Dl({url:"/api/user/api_keys",method:"GET",callback:t})},getReviewCount:function(t){Dl({url:"/api/reviews/count",method:"GET",callback:t})},isUsernameAvailable:function(t,e){Dl({url:"/api/user/username?u="+encodeURIComponent(t),method:"GET",callback:e})},logHistory:Fl,removeFolder:function(t,e){Dl({url:"/api/user/folder/"+encodeURIComponent(t)+"?use_id=1",method:"DELETE",callback:e})},removeTag:function(t,e){Dl({url:"/api/user/tag/"+encodeURIComponent(t),method:"DELETE",callback:e})},renameFolder:function(t,e,n){Dl({url:"/api/user/folder/"+encodeURIComponent(t)+"/"+encodeURIComponent(e)+"?use_id=1",method:"PUT",callback:n})},renameTag:function(t,e,n){Dl({url:"/api/user/tag/"+encodeURIComponent(t)+"/"+encodeURIComponent(e),method:"PUT",callback:n})},revokeSdkToken:function(t,e){Dl({url:"/api/user/sdk_token/"+encodeURIComponent(t),method:"DELETE",callback:e})},setSamlProviderId:function(t,e,n){Dl({url:"/api/user/"+encodeURIComponent(t)+"/change_saml_provider_id",method:"POST",payload:function(){return{saml_provider_id:e}},callback:n})},moveFolder:function(t,e=!0,n){return new Promise(((r,i)=>{Dl({url:`/api/folder/${t}/nest`,method:"PUT",payload:()=>({share:e,parent_id:n}),callback:(t,o)=>{if(t)return i(t);Fl({category:"folders",action:"nest",detail:{share:e,parent_id:n}}),r(o)}})}))},update:function(t,e){Dl({url:"/api/user",method:"POST",payload:function(){return{fields:t}},callback:e})}};var Ul={};function Rl(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Il(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Hl(){}var Bl=.7,Pl=1/Bl,zl="\\s*([+-]?\\d+)\\s*",jl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Yl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$l=/^#([0-9a-f]{3,8})$/,ql=new RegExp(`^rgb\\(${zl},${zl},${zl}\\)$`),Wl=new RegExp(`^rgb\\(${Yl},${Yl},${Yl}\\)$`),Gl=new RegExp(`^rgba\\(${zl},${zl},${zl},${jl}\\)$`),Vl=new RegExp(`^rgba\\(${Yl},${Yl},${Yl},${jl}\\)$`),Xl=new RegExp(`^hsl\\(${jl},${Yl},${Yl}\\)$`),Zl=new RegExp(`^hsla\\(${jl},${Yl},${Yl},${jl}\\)$`),Jl={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 Kl(){return this.rgb().formatHex()}function Ql(){return this.rgb().formatRgb()}function tu(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=$l.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?eu(e):3===n?new iu(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?nu(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?nu(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=ql.exec(t))?new iu(e[1],e[2],e[3],1):(e=Wl.exec(t))?new iu(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Gl.exec(t))?nu(e[1],e[2],e[3],e[4]):(e=Vl.exec(t))?nu(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Xl.exec(t))?cu(e[1],e[2]/100,e[3]/100,1):(e=Zl.exec(t))?cu(e[1],e[2]/100,e[3]/100,e[4]):Jl.hasOwnProperty(t)?eu(Jl[t]):"transparent"===t?new iu(NaN,NaN,NaN,0):null}function eu(t){return new iu(t>>16&255,t>>8&255,255&t,1)}function nu(t,e,n,r){return r<=0&&(t=e=n=NaN),new iu(t,e,n,r)}function ru(t,e,n,r){return 1===arguments.length?((i=t)instanceof Hl||(i=tu(i)),i?new iu((i=i.rgb()).r,i.g,i.b,i.opacity):new iu):new iu(t,e,n,null==r?1:r);var i}function iu(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function ou(){return`#${uu(this.r)}${uu(this.g)}${uu(this.b)}`}function au(){const t=su(this.opacity);return`${1===t?"rgb(":"rgba("}${lu(this.r)}, ${lu(this.g)}, ${lu(this.b)}${1===t?")":`, ${t})`}`}function su(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function lu(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function uu(t){return((t=lu(t))<16?"0":"")+t.toString(16)}function cu(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new fu(t,e,n,r)}function du(t){if(t instanceof fu)return new fu(t.h,t.s,t.l,t.opacity);if(t instanceof Hl||(t=tu(t)),!t)return new fu;if(t instanceof fu)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 fu(a,s,l,t.opacity)}function fu(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function pu(t){return(t=(t||0)%360)<0?t+360:t}function hu(t){return Math.max(0,Math.min(1,t||0))}function mu(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 gu(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}Rl(Hl,tu,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Kl,formatHex:Kl,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return du(this).formatHsl()},formatRgb:Ql,toString:Ql}),Rl(iu,ru,Il(Hl,{brighter(t){return t=null==t?Pl:Math.pow(Pl,t),new iu(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Bl:Math.pow(Bl,t),new iu(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new iu(lu(this.r),lu(this.g),lu(this.b),su(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:ou,formatHex:ou,formatHex8:function(){return`#${uu(this.r)}${uu(this.g)}${uu(this.b)}${uu(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:au,toString:au})),Rl(fu,(function(t,e,n,r){return 1===arguments.length?du(t):new fu(t,e,n,null==r?1:r)}),Il(Hl,{brighter(t){return t=null==t?Pl:Math.pow(Pl,t),new fu(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Bl:Math.pow(Bl,t),new fu(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 iu(mu(t>=240?t-240:t+120,i,r),mu(t,i,r),mu(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new fu(pu(this.h),hu(this.s),hu(this.l),su(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=su(this.opacity);return`${1===t?"hsl(":"hsla("}${pu(this.h)}, ${100*hu(this.s)}%, ${100*hu(this.l)}%${1===t?")":`, ${t})`}`}}));var vu=gu("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),yu=gu("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),_u=gu("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),bu=gu("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),wu=t=>()=>t;function Tu(t){return 1==(t=+t)?xu: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):wu(isNaN(e)?n:e)}}function xu(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):wu(isNaN(t)?e:t)}var Au=function t(e){var n=Tu(e);function r(t,e){var r=n((t=ru(t)).r,(e=ru(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=xu(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 Eu(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Cu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Su=new RegExp(Cu.source,"g");function ku(t,e){var n,r,i,o=Cu.lastIndex=Su.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=Cu.exec(t))&&(r=Su.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:Eu(n,r)})),o=Su.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 Du,Nu=180/Math.PI,Mu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Lu(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)*Nu,skewX:Math.atan(l)*Nu,scaleX:a,scaleY:s}}function Fu(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:Eu(t,i)},{i:l-2,x:Eu(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:Eu(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:Eu(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:Eu(t,n)},{i:s-2,x:Eu(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 Ou,Uu,Ru=Fu((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Mu:Lu(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Iu=Fu((function(t){return null==t?Mu:(Du||(Du=document.createElementNS("http://www.w3.org/2000/svg","g")),Du.setAttribute("transform",t),(t=Du.transform.baseVal.consolidate())?Lu((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Mu)}),", ",")",")"),Hu=0,Bu=0,Pu=0,zu=1e3,ju=0,Yu=0,$u=0,qu="object"==typeof performance&&performance.now?performance:Date,Wu="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Gu(){return Yu||(Wu(Vu),Yu=qu.now()+$u)}function Vu(){Yu=0}function Xu(){this._call=this._time=this._next=null}function Zu(t,e,n){var r=new Xu;return r.restart(t,e,n),r}function Ju(){Yu=(ju=qu.now())+$u,Hu=Bu=0;try{!function(){Gu(),++Hu;for(var t,e=Ou;e;)(t=Yu-e._time)>=0&&e._call.call(null,t),e=e._next;--Hu}()}finally{Hu=0,function(){var t,e,n=Ou,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:Ou=e);Uu=t,Qu(r)}(),Yu=0}}function Ku(){var t=qu.now(),e=t-ju;e>zu&&($u-=e,ju=t)}function Qu(t){Hu||(Bu&&(Bu=clearTimeout(Bu)),t-Yu>24?(t<1/0&&(Bu=setTimeout(Ju,t-qu.now()-$u)),Pu&&(Pu=clearInterval(Pu))):(Pu||(ju=qu.now(),Pu=setInterval(Ku,zu)),Hu=1,Wu(Ju)))}function tc(t,e,n){var r=new Xu;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Xu.prototype=Zu.prototype={constructor:Xu,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Gu():+n)+(null==e?0:+e),this._next||Uu===this||(Uu?Uu._next=this:Ou=this,Uu=this),this._call=t,this._time=n,Qu()},stop:function(){this._call&&(this._call=null,this._time=1/0,Qu())}};var ec=bl("start","end","cancel","interrupt"),nc=[],rc=0,ic=1,oc=2,ac=3,sc=4,lc=5,uc=6;function cc(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=ic,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var u,c,d,f;if(n.state!==ic)return l();for(u in i)if((f=i[u]).name===n.name){if(f.state===ac)return tc(a);f.state===sc?(f.state=uc,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[u]):+u<e&&(f.state=uc,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[u])}if(tc((function(){n.state===ac&&(n.state=sc,n.timer.restart(s,n.delay,n.time),s(o))})),n.state=oc,n.on.call("start",t,t.__data__,n.index,n.group),n.state===oc){for(n.state=ac,r=new Array(d=n.tween.length),u=0,c=-1;u<d;++u)(f=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=f);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=lc,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);n.state===lc&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=uc,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Zu(o,0,n.time)}(t,n,{name:e,index:r,group:i,on:ec,tween:nc,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:rc})}function dc(t,e){var n=pc(t,e);if(n.state>rc)throw new Error("too late; already scheduled");return n}function fc(t,e){var n=pc(t,e);if(n.state>ac)throw new Error("too late; already running");return n}function pc(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function hc(t,e){var n,r;return function(){var i=fc(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 mc(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=fc(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 gc(t,e,n){var r=t._id;return t.each((function(){var t=fc(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return pc(t,r).value[e]}}function vc(t,e){var n;return("number"==typeof e?Eu:e instanceof tu?Au:(n=tu(e))?(e=n,Au):ku)(t,e)}function yc(t){return function(){this.removeAttribute(t)}}function _c(t){return function(){this.removeAttributeNS(t.space,t.local)}}function bc(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 wc(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 Tc(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 xc(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 Ac(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Ec(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Cc(t,e){return function(){dc(this,t).delay=+e.apply(this,arguments)}}function Sc(t,e){return e=+e,function(){dc(this,t).delay=e}}function kc(t,e){return function(){fc(this,t).duration=+e.apply(this,arguments)}}function Dc(t,e){return e=+e,function(){fc(this,t).duration=e}}var Nc=It.prototype.constructor;function Mc(t){return function(){this.style.removeProperty(t)}}var Lc=0;function Fc(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Oc(){return++Lc}var Uc=It.prototype;Fc.prototype={constructor:Fc,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=D(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),f=0;f<c;++f)(s=u[f])&&(l=t.call(s,s.__data__,f,u))&&("__data__"in s&&(l.__data__=s.__data__),d[f]=l,cc(d[f],e,n,f,d,pc(s,n)));return new Fc(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=L(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 f,p=t.call(l,l.__data__,d,u),h=pc(l,n),m=0,g=p.length;m<g;++m)(f=p[m])&&cc(f,e,n,m,p,h);o.push(p),a.push(l)}return new Fc(o,a,e,n)},selectChild:Uc.selectChild,selectChildren:Uc.selectChildren,filter: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=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 Fc(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,f=a[s]=new Array(d),p=0;p<d;++p)(l=u[p]||c[p])&&(f[p]=l);for(;s<r;++s)a[s]=e[s];return new Fc(a,this._parents,this._name,this._id)},selection:function(){return new Nc(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Oc(),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=pc(a,e);cc(a,t,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Fc(r,this._parents,t,n)},call:Uc.call,nodes:Uc.nodes,node:Uc.node,size:Uc.size,empty:Uc.empty,each:Uc.each,on:function(t,e){var n=this._id;return arguments.length<2?pc(this.node(),n).on.on(t):this.each(function(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)?dc:fc;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=A(t),r="transform"===n?Iu:vc;return this.attrTween(t,"function"==typeof e?(n.local?xc:Tc)(n,r,gc(this,"attr."+t,e)):null==e?(n.local?_c:yc)(n):(n.local?wc:bc)(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=A(t);return this.tween(n,(r.local?Ac:Ec)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Ru:vc;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=et(this,t),a=(this.style.removeProperty(t),et(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,Mc(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=et(this,t),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(t),l=s=et(this,t)),a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s))}}(t,r,gc(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var l=fc(this,t),u=l.on,c=null==l.value[a]?o||(o=Mc(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=et(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(gc(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=pc(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?hc:mc)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Cc:Sc)(e,t)):pc(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?kc:Dc)(e,t)):pc(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){fc(this,t).ease=e}}(e,t)):pc(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;fc(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=fc(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]:Uc[Symbol.iterator]};var Rc,Ic,Hc={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Bc(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 Pc(t){var e;if(Rc=Ht(".detailed-settings"),(Ic=Rc.append("div").attr("class","settings-block")).append("h2").text("Back to settings").on("click",(function(){Rc.transition().duration(100).style("opacity",0).on("end",(function(){Ht(this).html("").style("display","none"),Ht(".template-settings").style("display","block").style("opacity",0).transition().duration(200).style("opacity",1),Ht(".template-settings-search").style("display",null).style("opacity",0).transition().duration(200).style("opacity",1)})),Rc.node()})),"string"==typeof t)e=Ic.append("div").html(t);else if("object"==typeof t&&(e=Ic.append(t.type),t.value&&(Ic.node().value=t.value),t.attributes))for(var n in t.attributes)e.attr(n,t.attributes[n]);return e.node().focus(),Ht(".template-settings-search").style("display","none"),Ht(".template-settings").style("display","none"),Rc.style("display","block").style("opacity",0).transition().duration(200).style("opacity",1),Rc.node()}It.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>oc&&n.state<lc,n.state=uc,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)}))},It.prototype.transition=function(t){var e,n;t instanceof Fc?(e=t._id,t=t._name):(e=Oc(),(n=Hc).time=Gu(),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])&&cc(a,t,e,u,s,n||Bc(a,e));return new Fc(r,this._parents,t,e)};var zc,jc,Yc,$c,qc={},Wc={},Gc={Flourish:{colors:["#135ae1","#2197ff","#9852d9","#f54e8b","#fa6502","#f2b90f","#058896","#09aa64","#de2c35","#a7abaf","#808080"]},"Flourish Alternate":{colors:["#135ae1","#f54e8b","#2197ff","#f2b90f","#9852d9","#058896","#fa6502","#09aa64","#de2c35","#a7abaf","#808080"]},"Flourish Light":{colors:["#3873e0","#69b9ff","#b568d9","#ff7895","#fa9a5a","#f2c43a","#3e9ea8","#57c193","#de5d5d","#a7abaf","#808080"]},"Flourish Light Alternate":{colors:["#3873e0","#ff7895","#69b9ff","#f2c43a","#b568d9","#3e9ea8","#fa9a5a","#57c193","#de5d5d","#a7abaf","#808080"]},"Flourish Blues":{colors:["#132856","#1354d9","#3f8bed","#76b7f7","#b3dcfd"]},"Flourish Light Blues":{colors:["#093a60","#1869b8","#2196f5","#4bc3fe","#91e8ff"]},"Flourish Purples":{colors:["#451059","#8835ab","#b964e2","#d49df3","#ebd2f9"]},"Flourish Pinks":{colors:["#560017","#a32048","#e43f77","#ff7db7","#ffc0de"]},"Flourish Oranges":{colors:["#451603","#9a370a","#e25501","#ff942c","#ffd393"]},"Flourish Yellows":{colors:["#3f1d07","#864e17","#be7c18","#e8ac0e","#fae06d"]},"Flourish Teals":{colors:["#023d49","#007686","#34a7b1","#68d1d4","#97f9f3"]},"Flourish Greens":{colors:["#00321a","#017339","#26aa5e","#6dd597","#acfacf"]},"Flourish Reds":{colors:["#440909","#a21014","#e63633","#ff7f7b","#ffc0c0"]},"Flourish Greys":{colors:["#333536","#616467","#8a8e91","#b1b4b8","#d7d8da"]},"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:["#4328e7","#9654e5","#ff6283","#ff8800","#ffc502","#007d8e","#1aa7ee","#29dae4","#88e99a","#019c00","#c11f1f","#730000"]},"Flourish Legacy Alternate":{scheme:"flourish_default_2",colors:["#4328e7","#9654e5","#ff6283","#ff8800","#ffc502","#88e99a","#29dae4","#1aa7ee","#019c00","#007d8e","#c11f1f","#730000"]},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:vu},Dark:{scheme:"schemeDark2",colors:yu},Paired:{scheme:"schemePaired",colors:_u},Pale:{scheme:"schemePastel1",colors:bu},"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"]}},Vc={};function Xc(){var t,e={};for(t in Vc)e[t]=Vc[t];for(t in Gc)e[t]=Gc[t];return e}var Zc="Edit color palette";function Jc(t){t&&t.length?(Vc={},t.forEach((function(t){var e=Object.keys(t)[0];Vc[e]={colors:t[e]}}))):Vc={},function(){for(var t in qc){qc[t].setOptions(Qc())}}()}function Kc(){if(void 0!==zc)return zc;var t=document.createElement("input");return t.setAttribute("type","color"),t.setAttribute("value","!"),zc="color"==t.type&&"!"!==t.value}function Qc(){var t=[],e=Xc();for(var n in t.push([Zc,""]),e)t.push([n,e[n].colors.join("|")]);return t}function td(t,e){var n=t[0],r=t[1];if(!r){const t=Bt("em");return t.append("i").classed("fa fa-pencil",!0),t.node().append(Zc),t.node()}Array.isArray(r)||(r=r.split("|"));const i=[];if(e&&n){const t=Bt("label").text(n);i.push(t.node())}return r.forEach((function(t,e){const n=Bt("span").attr("data-index",e).style("background-color",t);i.push(n.node())})),i}function ed(t,e){var n,r,i=Xc(),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(...td([null,r])),t.setAttribute("data-value",r.join("|"))}function nd(t){$c=t.target,t.dataTransfer.setData("text/plain","x"),event.dataTransfer.effectAllowed="move",Ht($c).classed("dragging",!0),Pt(".palette p:not(.dragging) input").style("pointer-events","none")}function rd(t){t.preventDefault();var e=Ht(".palette").selectAll("[draggable='true']").style("border-color",null),n=Ht(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")}Ht(t.target).style("border-"+r,"1px solid black")}}function id(t){if($c){for(var e=t.target;e&&("P"!==e.tagName||!e.nextSibling);)e=e.parentNode;if(e){var n=e.nextSibling;if(e===Ht(".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($c,n),$c=!1,sd()}}}function od(){Ht($c).classed("dragging",!1),Pt(".palette *").style("border-bottom",null).style("border-top",null),Pt(".palette p input").style("pointer-events",null)}function ad(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=ld("#000000");e.insertAdjacentHTML("beforebegin",n),sd()}(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");sd()}(e.parentNode))}function sd(){for(var t=Yc.getAttribute("data-autocomplete"),e=qc[t],n=[],r=jc.querySelectorAll(".palette input[type=text]"),i=0;i<r.length;i++)n.push(r[i].value);var o=e.getOptions();Wc[t]?o[0][1]=n.join("|"):o.unshift(["Custom",n.join("|")]),Wc[t]=n,e.setOptions(o),ed(Yc,n),Ht(Yc).dispatch("change")}function ld(t){const e=Bt("p").attr("draggable",!0);return e.append("span").classed("swatch-handle",!0).text(".. .. .."),Kc()?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 ud(t){var e=t.target,n=e.value,r=e.parentNode;if(!n)return r.parentNode.removeChild(r),void sd();var i=tu(n);if(!i)return console.warn("bad color",n),"color"==e.type?e.value=e.nextSibling.value:Kc()?e.value=e.previousSibling.value:e.value=e.previousSibling.style.backgroundColor,void(un.point(e).text(n+" is not a valid color").draw()._getElement().style.zIndex=115);"color"==e.type?e.nextSibling.value=n:Kc()?e.previousSibling.value=i.hex():e.previousSibling.style.backgroundColor=n,sd()}var cd,dd,fd={initialize:function(t,e){e.choices&&Jc(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";qc[r]=new fo({input:t,id:r,mode:"single",options:Qc(),options_config:{custom_renderer:td}}),t.addEventListener("change",(function(e){t.value==Zc?(e.stopImmediatePropagation(),t.value="",function(t){Yc=t;var e=(jc=Pc({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=tu(i);o?n.push(o.hex()):(console.warn("Bad color",i),n.push("#000000"))}return n}(t),r="";n.forEach((function(t){r+=ld(t)})),r+="<p><button class='fa fa-plus-square clickable'></button></p>",e.innerHTML=r,e.addEventListener("change",ud),e.addEventListener("dragstart",nd),e.addEventListener("dragover",rd),e.addEventListener("drop",id),e.addEventListener("dragend",od),e.addEventListener("click",ad)}(t)):ed(t,(t.getAttribute("data-value")||"").split("|"))}))},update:ed,getValue:function(t){var e=t.getAttribute("data-value");return e?e.split("|"):null},replaceThemeColors:Jc},pd={};const hd={style:!0,url:!0,flourish_embed:!0};var md={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 gd(t,e){pd=e||hd;var n=Ht(dd=Pc({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,Ht(t).dispatch("change")})),pd)pd[r]&&vd(r);(pd.bindings||pd.bindings_custom)&&(n.append("div").attr("class","text-bindings"),yd()),gn()}function vd(t){if("bindings"!=t&&"bindings_custom"!=t){var e=Ht(dd).select(".text-settings").append("div").attr("class","editor-section");if("style"==t){["h1","h2","bold","italic","line_break"].forEach((function(t){var n=md[t].description?md[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",_d).append("svg").attr("height",md[t].height).attr("width",md[t].width).attr("viewBox","0 0 "+md[t].width+" "+md[t].height).append("path").attr("fill","#333333").attr("d",md[t].path)}))}else{var n=md[t].description?md[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",_d).append("svg").attr("height",md[t].height).attr("width",md[t].width).attr("viewBox","0 0 "+md[t].width+" "+md[t].height).append("path").attr("fill","#333333").attr("d",md[t].path)}}}function yd(){if(pd.bindings||pd.bindings_custom){var t;if(Array.isArray(pd.bindings))t={},pd.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===pd.bindings)t=null;else if(!Array.isArray(pd.bindings_custom))return;var e=cd.visualisation.data_bindings[cd.visualisation.template_id],n={},r=[];cd.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)}))}}pd.bindings_custom&&Array.isArray(pd.bindings_custom)&&pd.bindings_custom.forEach((function(t){t[0]&&t[1]&&r.push({name:t[0],binding:t[1],type:"dynamic"})})),Ht(".text-bindings").html("").style("display",r.length?null:"none").append("p").text("Click to add values from your data"),Ht(".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",_d).text((function(t){return"object"==typeof t?t.name:t}))}}function _d(){var t,e=Ht(".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=Ht(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=bd(a,"<b>","</b>");else if("italic"==s)t=bd(a,"<i>","</i>");else if("h1"==s)t=bd(a,"<h1>","</h1>");else if("h2"==s)t=bd(a,"<h2>","</h2>");else if("line_break"==s)t=bd(a,"<br>","");else if("url"==s)t=bd(a,'<a href ="">',"</a>",10);else if("flourish_embed"==s)t=bd(l,'<iframe src="https://flo.uri.sh/','/embed" frameborder="0" scrolling="no" style="width:100%;height:400px;"></iframe>');else if("binding"==s){var u=Ht(this).attr("data-binding");t=bd(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 bd(t,e,n,r){return e=e||"",n=n||"",t=t||"",{cursor:r||e.length+t.length,text:e+t+n}}var wd,Td,xd,Ad={initialize:function(t,e,n){cd=t,Ht(e.parentElement).append("div").attr("class","text-editor-btn").attr("tabindex","0").on("click",(function(){gd(e,n.editor)})).on("keydown",(function(t){13==t.keyCode&&gd(e,n.editor)})).append("i").attr("class","fa fa-paint-brush")},updateDataBindings:yd},Ed=void 0,Cd=/fa-(\S*)/g,Sd=/^data:image\/(svg|svg\+xml|png|jpg);base64,[A-Z-a-z0-9+/=]*$/,kd=/^gradient:/g;function Dd(t){var e=!Ht(t.parentNode).classed("open");Pt(".template-settings .settings-block").classed("open",!1).attr("aria-expanded",!1),e&&Ht(t.parentNode).classed("open",!0).attr("aria-expanded",!0)}function Nd(t){if(t){Ed={};for(var e=0,n=null,r=null,i=wd&&wd.user?wd.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=xd.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}Ed[a.property]=a.type,Md(s.append("div"),a,i)}}else r=null,(n=xd.append("div").attr("class","settings-block")).append("h2").attr("class","no-select").attr("tabindex","0").text(a).on("click",(function(){Dd(this)})).on("keyup",(function(t){13===t.keyCode&&Dd(this)})),n.classed("open",e<1),n.attr("aria-expanded",e<1),"State documentation"===a&&n.style("display","none"),e++}Pt(".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,upgrade_source:r}),Ol.logHistory({category:"upgrade",action:"clicked",detail:r})}},{text:"Maybe later",keyCode:27,class:"secondary",callback:function(){t.analytics("event","upgrade-close",{upgrade_id:l,upgrade_source:r}),Ol.logHistory({category:"upgrade",action:"closed",detail:r})}}];t.analytics("event","upgrade-open",{upgrade_id:l,upgrade_source:r}),Ol.logHistory({category:"upgrade",action:"viewed",detail:r}),uo(e,n,{buttons:u,is_html:!0,upgrade:{message:i[a],list:o[s],is_business:!0}})}(wd,"This is a premium feature","Upgrade your plan to change this setting.","upgrade-settings")})),gn()}}function Md(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?Ke.sanitize(e.description.replace(/\[\[/g,"").replace(/\]\]/g,""),go):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,Ht(this.parentNode).select("textarea").attr("wrap",s?null:"off"),Ht(this).classed("selected",s)}))}var l=t.append(a).attr("id","setting-"+e.property).attr("class","setting").attr("name",e.property).attr("disabled",!wd.visualisation.can_edit||null),u=l.node();if("colors"==e.type)fd.initialize(u,e);else if("font"==e.type)pl.initialize(u,e,wd.user&&null!=wd.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"),Td.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],f=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",!wd.visualisation.can_edit||null).call(Ld(e)),Ud(t,l.append("label").attr("for",e.property+"_"+n).style("width",100/f.column_count+"%").style("border-radius",(function(){var t=f.column_count,e=Math.ceil(f.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),Ad.initialize(wd,u,e)),e.choices&&"string"==e.type&&"buttons"!=e.style&&(u._dropdown=new fo({input:u,id:e.property+"-dropdown",options:e.choices,options_config:{allow_other_option:e.choices_other,custom_renderer:Ud},mode:"single"})),"color"==e.type){Ht(u).classed("color",!0).style("display","none");var p=Ht(u.parentNode).append("div").attr("class","color-picker"),h=p.append("div").attr("class","color-wrapper");e.optional&&p.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"),Ht(this.parentNode).classed("is-null",!0))})),h.append("input").attr("type","color").on("change",(function(){u.value=this.value,l.dispatch("change"),Ht(this.parentNode.parentNode).classed("is-null",!1)})).on("focus",(function(){Ht(this.parentNode.parentNode).classed("active",!0)})).on("blur",(function(){Ht(this.parentNode.parentNode).classed("active",!1)}))}e.placeholder&&u.setAttribute("placeholder",e.placeholder),e.size&&u.classList.add("size-"+e.size),l.call(Ld(e))}function Ld(t){return function(e){var n=!1;e.on("change",(function(){var e=this;un.hide(),n=!0,wd.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||(un.point(t).text("A value is required").draw(),!1);var n=parseFloat(t.value);return Object.prototype.hasOwnProperty.call(e,"min")&&n<e.min?(un.point(t).text("Value cannot be less than "+e.min).draw(),t.value=e.min):e.hasOwnProperty("max")&&n>e.max&&(un.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=Rd,a=[t,e,n],clearTimeout(Ul[r]),Ul[r]=setTimeout((function(){o.apply(window,a),delete Ul[r]}),i);var r,i,o,a}(e,t,(function(r){if(!r)return n=!1,void("SELECT"==e.tagName&&Ht(e).dispatch("blur"));var o="radio"==e.type?e.nextSibling:e;un.point(o).text("Not changed: "+(r.message||r)).draw();var a={};a[t.property]=i,wd.preview_pane.setState(a,(function(r){if(r)return console.error("Failed to revert setting "+t.property+" to value: "+i),void(n=!1);wd.preview_pane.update((function(r){if(r)return console.error("Failed to update after reverting setting "+t.property+" to value: "+i),void(n=!1);Od(e,i),n=!1}))}))})):(e.value=i,void(n=!1))}))})).on("keydown",(function(t){wd.confirm.blank(),13==t.keyCode&&un.hide()})).on("blur",(function(){if(!n){var e=this;un.hide(),wd.preview_pane.getState(t.property,(function(n,r){n?console.error("Failed to get state property "+t.property,n):Od(e,r)}))}}))}}function Fd(t,e,n){if(t.classList.contains("colors"))return fd.getValue(t);if(t.classList.contains("font-menu")){var r=pl.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 Od(t,e){if(t.classList.contains("colors"))fd.update(t,e);else if(t.classList.contains("font-menu"))pl.update(t,e);else if("checkbox"==t.getAttribute("type"))t.checked=e;else if(t.classList.contains("color"))t.value=e,Ht(t.parentNode).select(".color-picker").classed("is-null",null===e),Ht(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<wd.settings.length;e++){var n=wd.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 Ud(t,e){var n=Ht(e);if("string"!=typeof t){var r=t[2];if(r)if(r.match(Cd))n.append("i").attr("class","fa "+r);else if(r.match(Sd))n.append("img").attr("src",r);else if(r.match(kd)){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(Cd)?n.append("i").attr("class","fa "+o):o.match(Sd)?n.append("img").attr("src",o):n.node().append(o)}else n.text(t)}function Rd(t,e,n){var r={},i=Fd(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)){wd.confirm.saving();var o=!1,a={};a[e.property]=Fd(t,e.optional,!0),wd.preview_pane.setState(a,(function(t){if(t)return s(t);wd.preview_pane.update((function(t){if(t)return s(t);wd.visualisation.updateSettings(r,(function(t){if(t)return s(t);wd.analytics("event","visualisation",{change_setting:wd.visualisation.id}),Bd(),wd.confirm.saved(),n&&n()}))}))}))}else n&&n("You can only choose values from the list");function s(r){o||(wd.preview_pane.getState(e.property,(function(e,i){if(e)return console.error("Failed to get state",e),void wd.confirm.error(e);Od(t,i),Bd(),wd.confirm.blank(),n&&n(r)})),o=!0)}}function Id(t,e){return/^data\./.test(t)?function(t,e){var n=t.split(".");if(wd.visualisation.__sdk__)return function(t,e){if(t.length>=4)return;for(var n=null,r=wd.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);return 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=wd.visualisation.template_id,r=wd.visualisation.data_bindings[n][t[1]],i=r[t[2]];if(null==i)return!1;for(var o,a=wd.visualisation.data_tables,s=i.data_table_id,l=i.columns||[i.column],u=0;u<a.length;u++)if(a[u].id===s){o=a[u].column_types;break}var c=!1;for(u=0;u<l.length;u++){var d=o[l[u]].type_id.split("$")[0];if(c=-1!==(Array.isArray(e)?e:[e]).indexOf(d))break}return c}(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=Fd(n);if(e instanceof Array)return-1!==e.indexOf(r);return r===e}(t,e)}function Hd(t){if("boolean"==typeof t)return t;if("string"==typeof t)return Id(t,!0);if("object"==typeof t){for(var e in t)if(!Id(e,t[e]))return!1;return!0}}function Bd(){wd.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(Hd(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(Ht(r).classed("hidden",!e),t.new_section)for(var i=r.previousSibling;i&&(Ht(i).classed("settings-divider")||Ht(i).classed("settings-subhead"));)Ht(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 Pd(t,e,n){return wd=t,Td={setup:Vs,addButton:Xs,startUpload:Js},(xd=Ht(".side-panel .template-settings")).on("submit",(function(t){t.preventDefault()})),fd.replaceThemeColors(e),pl.replaceThemeFonts(n),Nd(wd.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()}Ht(".side-panel .template-settings-search").on("input",(function(n){var r=e(n.target.value),i=!r,o=Ht(".side-panel .template-settings").selectAll(".settings-block:not(.hidden) > h2, .settings-option:not(.hidden) h3, .settings-subhead:not(.hidden)");Ht(".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=Ht(this);if("H2"==this.tagName)e&&Ht(e).selectAll("h2, .settings-option, .settings-subhead, .settings-divider").classed("search-filtered-out",!1);else if("H3"==this.tagName)if(e&&Ht(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"))}}}))}))}(),Ht(".side-panel-scrollbox").on("scroll",(function(){un.hide()})),{update:function(t){xd.html(""),Ht(".current-template").style("opacity","1"),Nd(wd.settings=t)},populate:function(){wd.preview_pane.getState((function(t,e){if(t)console.error("Failed to get state",t);else{var n=ds(e);for(var r in n){var i=document.getElementById("setting-"+r);i&&Od(i,n[r])}Ad.updateDataBindings(),Bd()}}))},getSettingsForCurrentTemplate:function(){return Ed},setReadOnly:function(){Pt(".setting").each((function(){Ht(this).attr("disabled",!0)}))},unsetReadOnly:function(){Pt(".setting").each((function(){Ht(this).attr("disabled",null)}))}}}var zd,jd,Yd=!1,$d=[],qd=100;function Wd(){Ht(".flourish-warn-list").classed("visible",!1),Yd=!1}function Gd(){return Ht(".flourish-warn-btn").on("click",(function(){Yd?Wd():(Ht(".flourish-warn-list").classed("visible",!0),Yd=!0)})),{clear:Xd,warn:Zd}}function Vd(){Ht(".flourish-warn-container").classed("visible",$d.length),$d.length>qd&&($d.length=qd);var t=Ht(".flourish-warn-list ul").selectAll("li").data($d),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 Xd(){$d=[],Vd(),Wd()}function Zd(t){$d.unshift(t),Vd()}function Jd(t){var e=zd.visualisation,n=e.getTemplate(),r=!1,i=!1,o=!1;function a(){var e=zd.template_settings.getSettingsForCurrentTemplate(),n=zd.visualisation.settingsForCurrentTemplate(),r={};for(var i in n)i in e&&(r[i]=n[i]);jd.loadVisualisation(zd,r,(function(){zd.template_settings.populate(),zd.data_bindings.updateRequiredBindingsOverlay(!1),js.clear(),t&&t()})),qt()}n.getSettings((function(t,e){t?console.error("Failed to get template settings: "+t):(zd.template_settings.update(e),r=!0,i&&o&&a())})),n.getDataBindings((function(t,e){t?console.error("Failed to get template data bindings: "+t):(zd.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 Kd(t){jd.updateData(zd.visualisation,t)}function Qd(t){jd.updateDataNotPreview(zd.visualisation,t)}function tf(t){zd=t;var e=Gd();return{loadTemplate:Jd,updateData:Kd,updateDataNotPreview:Qd,sync:(jd=zs("iframe#preview","editor",zd,e,{setSetting({name:t,value:e}){const n=function(t){return document.getElementById("setting-"+t)}(t);n?(Od(n,e),n.dispatchEvent(new Event("change"))):console.log(`Could not find setting ${t}`)}})).sync,setState:jd.setState,getState:jd.getState,hasData:jd.hasData,setData:jd.setData,getData:jd.getData,draw:jd.draw,update:jd.update,getDefaultState:jd.getDefaultState,snapshot:jd.snapshot,setFixedHeight:jd.setFixedHeight,resize:jd.resize,getDrawCalled:jd.getDrawCalled,setDrawCalled:jd.setDrawCalled}}var ef={},nf={};function rf(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function of(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 af(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function sf(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+af(-t,6):t>9999?"+"+af(t,6):af(t,4)}(t.getUTCFullYear())+"-"+af(t.getUTCMonth()+1,2)+"-"+af(t.getUTCDate(),2)+(i?"T"+af(e,2)+":"+af(n,2)+":"+af(r,2)+"."+af(i,3)+"Z":r?"T"+af(e,2)+":"+af(n,2)+":"+af(r,2)+"Z":n||e?"T"+af(e,2)+":"+af(n,2)+"Z":"")}var lf=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 nf;if(u)return u=!1,ef;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())!==nf;){for(var d=[];r!==ef&&r!==nf;)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?sf(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=rf(t);return function(r,i){return e(n(r),i,t)}}(t,e):rf(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=of(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=of(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}(","),uf=lf.parseRows,cf=lf.formatRows;function df(t){return null==t?null:new Date(t)}function ff(t,e,n){Al(this,"object"==typeof e?(n=e).id:e,void 0,n,{getVersionNumber:function(){return t.version_number},setVersionNumber:function(e){t.version_number=e},getTimestamps:function(){var t=df(this.t_created);return{last_updated:df(this.t_updated)||t}}}),this.visualisation=t,this.api_prefix="/api/data_table"}function pf(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?pf(t):t}))}function hf(t){this.id=t}function mf(t,e,n,r=null){if(Al(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 ff(i,t)}))}}function gf(t,e,n){Dl({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 vf(t,e,n){Dl({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 yf(t,e,n,r){Dl({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 _f(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]:_f(t[n],e[n])}function bf(t,e,n,r){function i(){}this.visualisation=t,this.store_key="flourish_sdk",this.settings=e,this.template_data_bindings=n,this.public_url_prefix=r,this.is_read_only=!1,this.session_manager=w(this),this.template_settings=Pd(this),this.data_bindings=(bo=this,wo=Ht(".data-bindings"),{update:function(t){t&&(bo.template_data_bindings=t),Ao(bo.visualisation,bo.template_data_bindings)},modify:function(t,e=!1){Co(t,(function(){Ao(bo.visualisation,bo.template_data_bindings),e&&bo.preview_pane.updateData((t=>{if(t)return console.error("Failed to update preview pane: "+t)}))}))},requiredBindingsAreUnset:Do,updateRequiredBindingsOverlay:No}),this.preview_pane=tf(this),this.status_label={status_label:document.querySelector(".sdk-status-label")},this.session_reset_button=function(t){const e=document.querySelector(".sdk-session-reset-button");return e.addEventListener("click",(e=>{t.session_manager.clearSession(),e.preventDefault(),e.stopPropagation(),window.location.reload()})),{session_reset_button:e}}(this),this.responsive_menu=$t(this,this.session_manager.getPreviewSize()),this.confirm={on:i,blank:i,saved:i,saving:i,error:i},this.analytics=i,this.tour={fireEvent:i},window.addEventListener("hashchange",(()=>{this.loadFromUrlHash()}))}let wf;ff.prototype.getColumnTypes=function(t){Dl({url:this.api_prefix+"/"+this.id,method:"GET",callback:function(e,n){if(e)return t(e);t(void 0,pf(n.column_types||[]))}},"load-data")},ff.prototype.csv=function(t,e=null){this.cached_data?t(void 0,pf(this.cached_data)):this.csvPromise(e).then((e=>t(null,e)),(e=>t(e)))},ff.prototype.csvPromise=async function(t=null){if(this.cached_data)return pf(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)=>{Dl({url:n,response_type:"text/csv; charset=utf-8",method:"GET",callback(n,i){if(n)return r(n);e.cached_data=uf(i),t(pf(e.cached_data))}},"load-data")}))},ff.prototype.saveData=function(t,e){var n=this,r=oo(pf(t));Dl({url:this.api_prefix+"/"+this.id+"/csv",payload:function(){return{version_number:n.getVersionNumber(),data:cf(r)}},callback:function(t,i){if(t)return e(t);n.setVersionNumber(i.version_number),n.cached_data=r,n.t_updated=i.t_updated,n.t_last_checked=i.t_last_checked,e(void 0)}})},ff.prototype.updateFromUrl=function(t,e){var n=this;Dl({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.message,e(t.message);var i=function(t){oo(t);for(var e=0,n=t;e<n.length;e++)for(var r=n[e],i=0;i<r.length;i++){var o=r[i];if(null==o&&(o=""),"string"!=typeof o&&(o=""+o),"string"!=typeof o)throw new Error("BUG: somehow value was not a string");r[i]=o.trim()}return t}(uf(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))}})},ff.prototype.updateFromLiveCsvUrl=function(t){var e=this;Dl({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)}})},ff.prototype.save=function(t,e){return Ml(this,t,e)},ff.prototype.delete=function(t){return Ll(this,t)},hf.prototype.getSettings=function(t){if(this.settings)t(void 0,this.settings);else{var e=this;Dl({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)}})}},hf.prototype.getDataBindings=function(t){Dl({url:"/api/template/"+this.id+"/data_bindings",method:"GET",callback:t})},mf.prototype.save=function(t,e){this.is_listed||(t.is_listed=!0),Ml(this,t,e)},mf.prototype.setTemplateId=function(t,e){Ml(this,{template_id:t},e)},mf.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new hf(this.template_id)),this._template):null},mf.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},mf.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(fs(i))}))},mf.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},mf.prototype.refreshDataBindings=function(t){var e=this;let n=this.api_prefix+"/"+this.id;this.slide_id&&(n="/api/slide/"+this.slide_id+"/visualisation"),Dl({url:n+"/data_bindings",method:"GET",callback:function(n,r){if(n)return t(n);e.data_bindings=r,t()}})},mf.prototype.resetToTheme=function(t){var e=this;Dl({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)}})},mf.prototype.updateDataBindings=function(t,e){var n=this;if(this.is_listed)return gf(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):gf(n,t,e)}))},mf.prototype.updateSettings=function(t,e){var n=this;if(this.is_listed)return vf(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):vf(n,t,e)}))},mf.prototype.refreshSettings=function(t){var e=this;Dl({url:this.api_prefix+"/"+this.id+"/settings",method:"GET",callback:function(n,r){if(n)return t(n);e.settings=r,t()}})},mf.prototype.getThemeFontsAndColors=function(t){Dl({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)}})},mf.prototype.getDataTables=function(t){let e=this.api_prefix+"/"+this.id;this.slide_id&&(e="/api/slide/"+this.slide_id+"/visualisation"),Dl({url:e+"/data",method:"GET",callback:function(e,n){return e?t(e):t(void 0,n.data)}})},mf.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 ff(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=[]}})))},mf.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},mf.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=i.reduce(((t,e)=>(t.per_data_table[e.id]=e.getTimestamps(),t)),{per_data_table:{}}),u=0;u<i.length;u++)!function(r){a[r.id]=r.column_types,r.csv((function(u,c){if(u)throw u;e.template_id==n&&(o[r.id]=c,++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={},u=e.dataBindingsForCurrentTemplate();for(var c in u)s[c]=io(u[c],o,a,i[c],l);for(c in i)s[c]||(s[c]=[],s[c].column_names={},s[c].metadata={});t(void 0,s)})))}),e.slide_id)}(i[u]);0==i.length&&t(void 0,{})}}))},mf.prototype.delete=function(t){Ll(this,t)},mf.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},mf.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},mf.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0},mf.prototype.duplicate=function(t,e){Dl({url:this.api_prefix+"/"+this.id+"/duplicate",callback:e})},mf.prototype.deleteCanvaEmbed=function(t){Dl({url:this.api_prefix+"/"+this.id+"/delete_canva_embed",callback:t})},mf.prototype.publish=function(t,e,n){var r=this;if(this.is_listed)return yf(r,t,e,n);this.save({is_listed:!0},(function(i){return i?t(i):yf(r,t,e,n)}))},mf.prototype.unpublish=function(t){var e=this;Dl({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)}})},mf.prototype.published=function(){return!!this.showcase_url},mf.prototype.sendForReview=function(t,e,n){var r=this;Dl({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)}})},mf.prototype.approve=function(t,e){var n=this;Dl({url:"/api/review/"+t+"/approve",callback:function(t,r){return n.status=r,e(t,r)}})},mf.prototype.decline=function(t,e,n){var r=this;Dl({url:"/api/review/"+t+"/decline",payload:function(){return{message:e}},callback:function(t,e){r.status=e,n(t,e)}})},mf.prototype.cancelReview=function(t,e){var n=this;Dl({url:"/api/review/"+t+"/cancel",callback:function(t,r){n.status=r,e(t,r)}})},mf.list=function(t){Dl({url:"/api/visualisations",method:"GET",callback:t})},mf.getById=function(t,e){Dl({url:"/api/visualisation/"+t,method:"GET",callback:function(n,r){if(n)return e(n);e(void 0,new mf(t,r.version_number,r))}})},mf.getPublishedJson=function(t,e,n){Dl({url:`${e}visualisation/${t}/visualisation.json`,method:"GET",callback(t,e){if(t)return n(t);n(void 0,e)}})},mf.createFromTemplate=function(t,e){Dl({url:"/api/template/"+t+"/visualisations",method:"PUT",callback:e})},mf.createFromVisualisation=function(t,e){Dl({url:"/api/visualisation/"+t+"/duplicate",callback:e})},mf.setAsStaffPick=function(t,e){Dl({url:"/api/visualisation/"+t+"/set_staff_pick",method:"POST",callback:e})},mf.unsetAsStaffPick=function(t,e){Dl({url:"/api/visualisation/"+t+"/unset_staff_pick",method:"POST",callback:e})},mf.setFolder=function(t,e,n){Dl({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e)+"?use_id=1",method:"PUT",callback:n})},mf.removeFolder=function(t,e,n){Dl({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e)+"?use_id=1",method:"DELETE",callback:n})},mf.removeTag=function(t,e,n){Dl({url:"/api/visualisation/"+t+"/tag/"+encodeURIComponent(e),method:"DELETE",callback:n})},mf.prototype.updateCompanyAccess=function(t,e,n={}){Dl({url:"/api/visualisation/"+this.id+"/company_access",method:"POST",callback:e,payload:function(){return{company_access:t,options:n}}})},mf.prototype.getTags=function(t){Dl({url:"/api/visualisation/"+this.id+"/tags",method:"GET",callback:t})},mf.prototype.setTags=function(t,e){Dl({url:"/api/visualisation/"+this.id+"/tags",method:"PUT",callback:e,payload:function(){return{tags:t}}})},bf.prototype.initTemplate=function(){window.location.hash?this.preview_pane.loadTemplate((()=>{this.loadFromUrlHash()})):(this.session_manager.prepareSession(),this.preview_pane.loadTemplate((()=>{this.session_manager.applySession()})))},bf.prototype.showStatusMessage=function(t){const e=this.status_label.status_label;e.innerText=t,e.style.opacity=1,e.style.transform="translate(0, 0)",wf&&(clearTimeout(wf),wf=null),wf=setTimeout((()=>{e.style.opacity=0,e.style.transform="translate(0, 20%)",wf=null}),4e3)},bf.prototype.logInfo=function(...t){const e=new Intl.DateTimeFormat("default",{hour:"numeric",minute:"numeric",second:"numeric"}).format(new Date);console.info("🔹 flourish-sdk:",...t,`[${e}]`)},bf.prototype.loadFromUrlHash=async function(){if(!window.location.hash)return;this.session_manager.clearSession();const t=window.location.hash.slice(1),e=(n=mf.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)}},bf.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={};_f(i,this.preview_pane.getDefaultState()),_f(i,t),this.preview_pane.sync({state:i,data:r,overwrite_state:!0,update:!0},(()=>this.template_settings.populate()))};var Tf={},xf={};function Af(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Ef(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 Cf(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Sf(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+Cf(-t,6):t>9999?"+"+Cf(t,6):Cf(t,4)}(t.getUTCFullYear())+"-"+Cf(t.getUTCMonth()+1,2)+"-"+Cf(t.getUTCDate(),2)+(i?"T"+Cf(e,2)+":"+Cf(n,2)+":"+Cf(r,2)+"."+Cf(i,3)+"Z":r?"T"+Cf(e,2)+":"+Cf(n,2)+":"+Cf(r,2)+"Z":n||e?"T"+Cf(e,2)+":"+Cf(n,2)+"Z":"")}var kf=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 xf;if(u)return u=!1,Tf;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())!==xf;){for(var d=[];r!==Tf&&r!==xf;)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?Sf(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=Af(t);return function(r,i){return e(n(r),i,t)}}(t,e):Af(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=Ef(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Ef(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}(","),Df=kf.parseRows,Nf="$";function Mf(){}function Lf(t,e){var n=new Mf;if(t instanceof Mf)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 Ff(){}Mf.prototype=Lf.prototype={constructor:Mf,has:function(t){return Nf+t in this},get:function(t){return this[Nf+t]},set:function(t,e){return this[Nf+t]=e,this},remove:function(t){var e=Nf+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===Nf&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===Nf&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===Nf&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===Nf&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===Nf&&++t;return t},empty:function(){for(var t in this)if(t[0]===Nf)return!1;return!0},each:function(t){for(var e in this)e[0]===Nf&&t(this[e],e.slice(1),this)}};var Of=Lf.prototype;Ff.prototype={constructor:Ff,has:Of.has,add:function(t){return this[Nf+(t+="")]=t,this},remove:Of.remove,clear:Of.clear,values:Of.keys,size:Of.size,empty:Of.empty,each:Of.each};var Uf={value:function(){}};function Rf(){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 If(r)}function If(t){this._=t}function Hf(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Bf(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Uf,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function Pf(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 zf(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?zf(t):t}))}function jf(t){this.id=t}If.prototype=Rf.prototype={constructor:If,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=Bf(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Bf(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=Hf(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new If(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)}},Pf.prototype.csv=function(t){if(this.cached_data)t(void 0,zf(this.cached_data));else{var e=this;!function(t,e){var n,r,i,o,a=Rf("beforesend","progress","load","error"),s=Lf(),l=new XMLHttpRequest,u=null,c=null,d=0;function f(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=f:l.onreadystatechange=function(t){l.readyState>3&&f(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,f){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==f&&"function"==typeof i&&(f=i,i=null),null!=f&&1===f.length&&(f=function(t){return function(e,n){t(null==e?n:null)}}(f)),null!=f&&n.on("error",f).on("load",(function(t){f(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){const i=r.getResponseHeader("Last-Modified");e.cached_data=Df(r.response),e.timestamps={last_updated:i?new Date(i):new Date},t(void 0,zf(e.cached_data))}))}},Pf.prototype.saveData=function(t,e){e()},Pf.prototype.save=function(t,e){e()},Pf.prototype.delete=function(t){t()},jf.prototype.getSettings=function(t){t(void 0,window.Flourish.app.settings)},jf.prototype.getDataBindings=function(t){t(void 0,window.Flourish.app.template_data_bindings)},jf.prototype.refreshDataBindings=function(t){t(void 0)};var Yf={},$f={},qf=new Date,Wf=new Date;function Gf(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 Gf((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 qf.setTime(+e),Wf.setTime(+r),t(qf),t(Wf),Math.floor(n(qf,Wf))},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 Vf=864e5,Xf=6048e5,Zf=Gf((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()))/Vf}),(function(t){return t.getDate()-1}));function Jf(t){return Gf((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()))/Xf}))}Zf.range;var Kf=Jf(0),Qf=Jf(1),tp=Jf(2),ep=Jf(3),np=Jf(4),rp=Jf(5),ip=Jf(6);Kf.range,Qf.range,tp.range,ep.range,np.range,rp.range,ip.range;var op=Gf((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()}));op.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Gf((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},op.range;var ap=Gf((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/Vf}),(function(t){return t.getUTCDate()-1}));function sp(t){return Gf((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)/Xf}))}ap.range;var lp=sp(0),up=sp(1),cp=sp(2),dp=sp(3),fp=sp(4),pp=sp(5),hp=sp(6);lp.range,up.range,cp.range,dp.range,fp.range,pp.range,hp.range;var mp=Gf((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()}));function gp(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 vp(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 yp(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}mp.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Gf((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},mp.range;var _p,bp,wp,Tp={"-":"",_:" ",0:"0"},xp=/^\s*\d+/,Ap=/^%/,Ep=/[\\^$*+?|[\]().{}]/g;function Cp(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 Sp(t){return t.replace(Ep,"\\$&")}function kp(t){return new RegExp("^(?:"+t.map(Sp).join("|")+")","i")}function Dp(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function Np(t,e,n){var r=xp.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Mp(t,e,n){var r=xp.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Lp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Fp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Op(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Up(t,e,n){var r=xp.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Rp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Ip(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 Hp(t,e,n){var r=xp.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Bp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Pp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function zp(t,e,n){var r=xp.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function jp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Yp(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function $p(t,e,n){var r=xp.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function qp(t,e,n){var r=xp.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Wp(t,e,n){var r=xp.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Gp(t,e,n){var r=Ap.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Vp(t,e,n){var r=xp.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Xp(t,e,n){var r=xp.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Zp(t,e){return Cp(t.getDate(),e,2)}function Jp(t,e){return Cp(t.getHours(),e,2)}function Kp(t,e){return Cp(t.getHours()%12||12,e,2)}function Qp(t,e){return Cp(1+Zf.count(op(t),t),e,3)}function th(t,e){return Cp(t.getMilliseconds(),e,3)}function eh(t,e){return th(t,e)+"000"}function nh(t,e){return Cp(t.getMonth()+1,e,2)}function rh(t,e){return Cp(t.getMinutes(),e,2)}function ih(t,e){return Cp(t.getSeconds(),e,2)}function oh(t){var e=t.getDay();return 0===e?7:e}function ah(t,e){return Cp(Kf.count(op(t)-1,t),e,2)}function sh(t){var e=t.getDay();return e>=4||0===e?np(t):np.ceil(t)}function lh(t,e){return t=sh(t),Cp(np.count(op(t),t)+(4===op(t).getDay()),e,2)}function uh(t){return t.getDay()}function ch(t,e){return Cp(Qf.count(op(t)-1,t),e,2)}function dh(t,e){return Cp(t.getFullYear()%100,e,2)}function fh(t,e){return Cp((t=sh(t)).getFullYear()%100,e,2)}function ph(t,e){return Cp(t.getFullYear()%1e4,e,4)}function hh(t,e){var n=t.getDay();return Cp((t=n>=4||0===n?np(t):np.ceil(t)).getFullYear()%1e4,e,4)}function mh(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Cp(e/60|0,"0",2)+Cp(e%60,"0",2)}function gh(t,e){return Cp(t.getUTCDate(),e,2)}function vh(t,e){return Cp(t.getUTCHours(),e,2)}function yh(t,e){return Cp(t.getUTCHours()%12||12,e,2)}function _h(t,e){return Cp(1+ap.count(mp(t),t),e,3)}function bh(t,e){return Cp(t.getUTCMilliseconds(),e,3)}function wh(t,e){return bh(t,e)+"000"}function Th(t,e){return Cp(t.getUTCMonth()+1,e,2)}function xh(t,e){return Cp(t.getUTCMinutes(),e,2)}function Ah(t,e){return Cp(t.getUTCSeconds(),e,2)}function Eh(t){var e=t.getUTCDay();return 0===e?7:e}function Ch(t,e){return Cp(lp.count(mp(t)-1,t),e,2)}function Sh(t){var e=t.getUTCDay();return e>=4||0===e?fp(t):fp.ceil(t)}function kh(t,e){return t=Sh(t),Cp(fp.count(mp(t),t)+(4===mp(t).getUTCDay()),e,2)}function Dh(t){return t.getUTCDay()}function Nh(t,e){return Cp(up.count(mp(t)-1,t),e,2)}function Mh(t,e){return Cp(t.getUTCFullYear()%100,e,2)}function Lh(t,e){return Cp((t=Sh(t)).getUTCFullYear()%100,e,2)}function Fh(t,e){return Cp(t.getUTCFullYear()%1e4,e,4)}function Oh(t,e){var n=t.getUTCDay();return Cp((t=n>=4||0===n?fp(t):fp.ceil(t)).getUTCFullYear()%1e4,e,4)}function Uh(){return"+0000"}function Rh(){return"%"}function Ih(t){return+t}function Hh(t){return Math.floor(+t/1e3)}function Bh(t){throw new TypeError("Expected a value of type string but got a value of type "+typeof t)}function Ph(t){return function(e){return"string"!=typeof e&&Bh(e),(e=e.trim())?t(e):null}}!function(t){_p=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=kp(i),c=Dp(i),d=kp(o),f=Dp(o),p=kp(a),h=Dp(a),m=kp(s),g=Dp(s),v=kp(l),y=Dp(l),_={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:Zp,e:Zp,f:eh,g:fh,G:hh,H:Jp,I:Kp,j:Qp,L:th,m:nh,M:rh,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ih,s:Hh,S:ih,u:oh,U:ah,V:lh,w:uh,W:ch,x:null,X:null,y:dh,Y:ph,Z:mh,"%":Rh},b={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:gh,e:gh,f:wh,g:Lh,G:Oh,H:vh,I:yh,j:_h,L:bh,m:Th,M:xh,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ih,s:Hh,S:Ah,u:Eh,U:Ch,V:kh,w:Dh,W:Nh,x:null,X:null,y:Mh,Y:Fh,Z:Uh,"%":Rh},w={a:function(t,e,n){var r=p.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=f[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:Pp,e:Pp,f:Wp,g:Rp,G:Up,H:jp,I:jp,j:zp,L:qp,m:Bp,M:Yp,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:Hp,Q:Vp,s:Xp,S:$p,u:Mp,U:Lp,V:Fp,w:Np,W:Op,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:Rp,Y:Up,Z:Ip,"%":Gp};function T(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=Tp[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 x(t,e){return function(n){var r,i,o=yp(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=vp(yp(o.y,0,1))).getUTCDay(),r=i>4||0===i?up.ceil(r):up(r),r=ap.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=gp(yp(o.y,0,1))).getDay(),r=i>4||0===i?Qf.ceil(r):Qf(r),r=Zf.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?vp(yp(o.y,0,1)).getUTCDay():gp(yp(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,vp(o)):gp(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 Tp?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return _.x=T(n,_),_.X=T(r,_),_.c=T(e,_),b.x=T(n,b),b.X=T(r,b),b.c=T(e,b),{format:function(t){var e=T(t+="",_);return e.toString=function(){return t},e},parse:function(t){var e=x(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=T(t+="",b);return e.toString=function(){return t},e},utcParse:function(t){var e=x(t+="",!0);return e.toString=function(){return t},e}}}(t),_p.format,_p.parse,bp=_p.utcFormat,wp=_p.utcParse}({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"]});var zh=new Date(1972,3,27,19,45,5),jh={"%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 Yh(t){return function(e){var n=null;return t.forEach((function(t){e.match(t.regex)&&(n=t.toDate(e))})),n}}function $h(t,e){var n,r=wp(t),i=bp(t);return n=Ph("function"==typeof e?function(t){return e(t,null!==r(t))}:function(t){return null!==r(t)}),Object.freeze({test:n,parse:Ph((function(e){return r(e)||(jh[t]?Yh(jh[t])(e):null)})),format:function(t){return i(t)},type:"datetime",description:t,id:"datetime$"+t,example:i(zh)})}var qh=Object.freeze([$h("%Y-%m-%dT%H:%M:%S.%LZ"),$h("%Y-%m-%d %H:%M:%S"),$h("%Y-%m-%dT%H:%M:%S"),$h("%Y-%m-%dT%H:%M:%SZ"),$h("%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})),$h("%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})),$h("%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])})),$h("%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})),$h("%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})),$h("%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])})),$h("%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})),$h("%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})),$h("%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])})),$h("%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})),$h("%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])})),$h("%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})),$h("%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])})),$h("%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})),$h("%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})),$h("%Y%m",(function(t,e){if(!e)return!1;var n=parseFloat(t.slice(0,4)),r=parseFloat(t.slice(4));return n>1e3&&r>0&&r<=12})),$h("%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})),$h("%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})),$h("%d %b %y"),$h("%-d %b ’%y"),$h("%d %B %y"),$h("%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})),$h("%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})),$h("%d-%b-%y"),$h("%d-%B-%y"),$h("%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})),$h("%m/%y"),$h("%b %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),$h("%B %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),$h("%b-%y"),$h("%b %y"),$h("%B %y"),$h("%b '%y"),$h("%b ’%y"),$h("%B %-d %Y"),$h("%d %b",(function(t,e){return!!e||!!Yh(jh["%d %b"])(t)})),$h("%d %B"),$h("%b %d",(function(t,e){return!!e||!!Yh(jh["%b %d"])(t)})),$h("%B %d"),$h("%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})),$h("%m-%d"),$h("%d/%m"),$h("%m/%d"),$h("%b %d %Y"),$h("%b %d %Y, %-I.%M%p"),$h("%Y",(function(t,e){if(!e)return!1;var n=parseFloat(t);return n>1499&&n<2200})),$h("%B"),$h("%b"),$h("%X"),$h("%I:%M %p"),$h("%-I.%M%p"),$h("%H:%M",(function(t,e){if(!e)return!1;var n=t.split(":").map(parseFloat);return n[0]>=0&&n[0]<24})),$h("%H:%M:%S"),$h("%M:%S"),$h("%-I%p"),$h("Q%q %Y",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length})),$h("%Y Q%q",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length})),$h("%YM%m",(function(t,e){if(!e)return!1;var n=t.split("M").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12})),$h("%YQ%q",(function(t,e){if(!e)return!1;var n=t.split("Q").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=4})),$h("%YÁ%q",(function(t,e){if(!e)return!1;var n=t.split("Á").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=4}))]);function Wh(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 Gh,Vh=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Xh(t){if(!(e=Vh.exec(t)))throw new Error("invalid format: "+t);var e;return new Zh({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 Zh(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 Jh(t,e){var n=Wh(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")}Xh.prototype=Zh.prototype,Zh.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 Kh={"%":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 Jh(100*t,e)},r:Jh,s:function(t,e){var n=Wh(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Gh=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")+Wh(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 Qh(t){return t}var tm=Array.prototype.map,em=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nm(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Qh:(e=tm.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?Qh:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(tm.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=Xh(t)).fill,n=t.align,d=t.sign,f=t.symbol,p=t.zero,h=t.width,m=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(m=!0,y="g"):Kh[y]||(void 0===g&&(g=12),v=!0,y="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var _="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",b="$"===f?o:/[%p]/.test(y)?l:"",w=Kh[y],T=/[defgprs%]/.test(y);function x(t){var i,o,l,f=_,x=b;if("c"===y)x=w(t)+x,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),f=(A?"("===d?d:u:"-"===d||"("===d?"":d)+f,x=("s"===y?em[8+Gh/3]:"")+x+(A&&"("===d?")":""),T)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){x=(46===l?a+t.slice(i+1):t.slice(i))+x,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var E=f.length+t.length+x.length,C=E<h?new Array(h-E+1).join(e):"";switch(m&&p&&(t=r(C+t,C.length?h-x.length:1/0),C=""),n){case"<":t=f+t+x+C;break;case"=":t=f+C+t+x;break;case"^":t=C.slice(0,E=C.length>>1)+f+t+x+C.slice(E);break;default:t=C+f+t+x}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)),x.toString=function(){return t+""},x}return{format:d,formatPrefix:function(t,e){var n,r=d(((t=Xh(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=Wh(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),a=em[8+i/3];return function(t){return r(o*t)+a}}}}var rm={test:Ph((function(t){return/^(\+|-)?\d{1,3}(,\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ph((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"},im={test:Ph((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ph((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"},om={test:Ph((function(t){return/^(\+|-)?\d+(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ph((function(t){return parseFloat(t)})),description:"No thousand separator, point decimal mark",thousand_separator:"",decimal_mark:".",id:"number$none_point",example:"12235.56"},am={test:Ph((function(t){return/^(\+|-)?\d{1,3}(\.\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ph((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"},sm={test:Ph((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ph((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"},lm={test:Ph((function(t){return/^(\+|-)?\d+(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ph((function(t){return parseFloat(t.replace(/,/,"."))})),description:"No thousand separator, comma decimal mark",thousand_separator:"",decimal_mark:",",id:"number$none_comma",example:"12235,56"},um=Object.freeze([rm,im,am,sm,om,lm]);um.forEach((function(t){t.type="number",t.format=function(t){var e,n,r=nm({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 cm=Object.freeze({test:function(t){return"string"==typeof t||Bh(t)},parse:function(t){return"string"==typeof t?t:Bh(t)},format:function(t){if("string"==typeof t)return t},type:"string",description:"Arbitrary string",id:"string$arbitrary_string"}),dm=Object.freeze({datetime:qh,number:um}),fm=Object.freeze(["datetime","number","string"]),pm=Object.freeze({n_max:250,n_failing_values:0,failure_fraction:.05,sort:!0}),hm=Object.freeze(Object.keys(pm));function mm(t,e){return t.index-e.index}function gm(t,e){return e.n_success-t.n_success||mm(t,e)}function vm(t){return(""+t).trim()}function ym(t){return void 0===t?function(t){return vm(t)}:"function"==typeof t?function(e,n){return vm(t(e,n))}:function(e){return vm(e[""+t])}}function _m(t){t?Array.isArray(t)||(t=[t]):t=fm;var e=t.reduce((function(t,e){var n=dm[e];return n&&Array.prototype.push.apply(t,n),t}),[]),n=-1!==t.indexOf("string"),r=hm.reduce((function(t,e){return t[e]=pm[e],t}),{}),i=function(t,i){i=ym(i);var o=t.map(i).filter(Boolean);if(!o.length)return n?[cm]:[];var a=Math.min(r.n_max,o.length),s=Math.floor(a*r.failure_fraction),l=r.n_failing_values,u=r.sort?gm:mm,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(cm),c};return hm.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}_m.DATETIME_IDS=Object.freeze(qh.map((function(t){return t.id}))),_m.NUMBER_IDS=Object.freeze(um.map((function(t){return t.id}))),_m.STRING_IDS=Object.freeze([cm.id]),_m.getInterpretation=function(){var t=qh.concat(um,cm).reduce((function(t,e){return t[e.id]=e,t}),{});return function(e){return t[e]}}(),_m._createAccessorFunction=ym;var bm,wm,Tm=dm;function xm(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,r.template_store_key=n.template_store_key,n.data_tables&&(this.data_tables=n.data_tables.map((function(t){return new Pf(r,t)}))),n.data_bindings&&(this.data_bindings=n.data_bindings)}$f.createInterpreter=_m,$f.recognised_formats=Tm,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}),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createInterpreter=void 0,t.extractData=function(t,n,r,i,o){var a=[],s=[],u=0,c=Object.assign([],{column_names:{},metadata:{},timestamps:{}}),d={};if(!i)return c;function f(t,e){if(!d[t])return{};var n=d[t];return n[e]?n[e]:{}}for(var p in r){var h={},m=r[p];if(m){for(let t=0;t<m.length;t++){const e=m[t].type_id,n=m[t].output_format_id,r=n&&"auto"!==n?n:e;h[m[t].index]={type_id:e,output_format_id:r}}d[p]=h}}for(var g in t){if(null===t[g])continue;if(void 0===t[g].columns&&void 0===t[g].column)continue;var v=t[g];if(v.template_data_binding=i[g],v.key=g,!(v.data_table_id in n)){var y=[];for(var _ in n)y.push(_);console.error("Data table id "+v.data_table_id+" not in "+JSON.stringify(y));continue}const e=n[v.data_table_id];if(null==e)throw new Error(`[BUG] The data from the data table with ID ${v.data_table_id} was missing`);if(0!=e.length){if("columns"in v&&null!=v.columns){var b=e[0].length;v.columns=v.columns.filter((function(t){return t<b})),c.column_names[g]=v.columns.map((function(t){return e[0][t]})),c.metadata[g]=v.columns.map((function(t){const e=f(v.data_table_id,t);if("type_id"in e){const{type_id:t,output_format_id:n}=e;return{type:t.split("$")[0],type_id:t,output_format_id:n}}return null}))}else{if(!("column"in v)||null==v.column)throw new Error("Data binding includes no column(s) specification: "+JSON.stringify(v));{c.column_names[g]=e[0][v.column];const t=f(v.data_table_id,v.column);if("type_id"in t){const{type_id:e,output_format_id:n}=t;c.metadata[g]={type:e.split("$")[0],type_id:e,output_format_id:n}}}}-1==s.indexOf(v.data_table_id)&&(s.push(v.data_table_id),u=Math.max(u,e.length-1)),a.push(v)}else console.warn("Empty data table")}function w(t,n,r){if(!t.template_data_binding?.data_type)return r;var i=function(t,n){const r=f(t,n);if("type_id"in r)return e.createInterpreter.getInterpretation(r.type_id)}(t.data_table_id,n);i&&"number"==i.type&&(r=l(r));var o=i?i.parse(r):r;return Number.isNaN(o)&&(o=null),o}c.timestamps=function(t){const e={},n=t.map((t=>t.last_updated?.getTime())).filter(Boolean);if(n.length){const t=Math.max(...n);e.last_updated=new Date(t)}return e}(s.map((t=>o.per_data_table[t])));for(var T=0;T<u;T++){for(var x={},A=0;A<a.length;A++){const t=n[(v=a[A]).data_table_id];if(null==t)throw new Error(`[BUG] The data from the data table with ID ${v.data_table_id} was missing`);if(!(T+1>=t.length)){if(null==v.key)throw new Error(`BUG: 'key' was ${v.key} in ${v}`);"columns"in v&&null!=v.columns?x[v.key]=v.columns.filter((function(e){return e<t[T+1].length})).map((function(e){return w(v,e,t[T+1][e])})):"column"in v&&null!=v.column&&(v.column>=t[T+1].length?x[v.key]=w(v,v.column,""):x[v.key]=w(v,v.column,t[T+1][v.column]))}}c.push(x)}return c},t.getColumnTypesForData=function(t){return u(t).map((function(t,e){const n=c(t);let i;i=n.length>2e3?r(n,1e3):n;const o=d(i)[0].id;return{type_id:o,index:e,output_format_id:o}}))},t.getRandomSeededSample=r,t.mulberry32=i,t.trimTrailingEmptyRows=o,t.dropReturnCharacters=function(t){for(const e of t)for(let t=0;t<e.length;t++)e[t]=e[t].replace(/(\r\n|\n|\r) {2}/g," ");return t},t.tidyTable=function(t){o(t);for(let e of t)for(let t=0;t<e.length;t++){let n=e[t];if(null==n&&(n=""),"string"!=typeof n&&(n=""+n),"string"!=typeof n)throw new Error("BUG: somehow value was not a string");e[t]=n.trim()}return t},t.stripCommonFixes=l,t.transposeNestedArray=u,t.getSlicedData=c,t.interpretColumn=d,t.sortDataTables=function(t,e){if(!e||!e.length)return;if(!t||!t.length)return;var n=[];return e.forEach((function(t){if("string"==typeof t)return;let e;if("column"in t?e=t.column:"columns"in t&&(e=t.columns),e){var r=e.match(/^(?:[^:]|:[^:])*/);r&&-1==n.indexOf(r[0])&&n.push(r[0])}})),t.sort((function(t,e){var r=n.indexOf(t.name),i=n.indexOf(e.name);return(-1==r?1/0:r)<(-1==i?1/0:i)?-1:1}))};const e=$f;var n=$f;function r(t,e){if(t.length<=2*e)return t;const n=i(t.length);for(;t.length>e;){const e=Math.floor(n()*t.length);t.splice(e,1)}return t}function i(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}}function o(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}Object.defineProperty(t,"createInterpreter",{enumerable:!0,get:function(){return n.createInterpreter}});var a=["#DIV/0","#N/A","#NAME?","#NULL!","#NUM!","#REF!","#VALUE!","#ERROR!"],s=(0,e.createInterpreter)().nMax(1/0).nFailingValues(8).failureFraction(.1);function l(t){return(t=t||"").replace(/[€£$¥%º]/g,"")}function u(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}function c(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)}function d(t){var e=t.filter((function(t){return t&&!a.includes(t.trim())})).map(l);return s(e)}}(Yf),xm.prototype.save=function(t,e){this.version_number++,e(void 0)},xm.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new jf(this.template_id)),this._template):null},xm.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},xm.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},xm.prototype.refreshDataBindings=function(t){t()},xm.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)},xm.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)},xm.prototype.getDataTables=function(t){t(void 0,window.Flourish.app.data_tables)},xm.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 Pf(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=[]}})))},xm.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},xm.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]=Yf.getColumnTypesForData(u),o[r.id]=u,++s==i.length&&e.getTemplate().getDataBindings((function(n,r){if(n)throw n;var s={};r.forEach((function(t){"string"!=typeof t&&(t.dataset in s||(s[t.dataset]={}),s[t.dataset][t.key]=t)}));var l={per_data_table:{}};for(const t of i)l.per_data_table[t.id]=t.timestamps;var u={},c=e.dataBindingsForCurrentTemplate();for(var d in c)u[d]=Yf.extractData(c[d],o,a,s[d],l);for(d in s)u[d]||(u[d]=[],u[d].column_names={},u[d].metadata={});t(void 0,u)})))}))}(i[l]);0==i.length&&t(void 0,{})}}))},xm.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},xm.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},xm.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0};var Am=!1;function Em(){bm&&bm.classList.remove("shown")}function Cm(){this.close(),Am||(bm&&setTimeout((function(){bm.classList.add("shown")}),1e3),setTimeout(Sm,250))}function Sm(){km().addEventListener("open",(function(){window.location.reload()}))}function km(){var t=new window.WebSocket(wm);return t.addEventListener("open",Em),t.addEventListener("close",Cm),t}return t.Visualisation=xm,t.initSDK=function(t,e,n,r){return gn(),window.Flourish=window.Flourish||{},window.Flourish.app=new bf(t,e,n,r),window.Flourish.app},t.talkToServer=function(){bm=document.getElementById("error-server-down"),wm=window.location.origin.replace(/^http(s?):\/\//,"ws$1://"),window.addEventListener("beforeunload",(function(){Am=!0})),km()},t}({});
4
4
  //# sourceMappingURL=script.js.map