@datawheel/bespoke 0.7.15-rc.25 → 0.7.15-rc.26
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/dist/cms.js +1 -1
- package/dist/report.js +15 -12
- package/package.json +1 -1
package/dist/cms.js
CHANGED
|
@@ -102,7 +102,7 @@ return {
|
|
|
102
102
|
font-weight: bold;
|
|
103
103
|
color: hsl(`+Math.max(0,Math.min(120-120*m,120))+"deg 100% 31%);",o?.key);}return o==null||o.onChange==null||o.onChange(i),i}}function Eu(e,t){if(e===void 0)throw new Error("Unexpected undefined"+(t?": "+t:""));return e}var rT,nT=M(()=>{p();rT=function(t,o){return Math.abs(t-o)<1};});function N_(e){for(var t=e.measurements,o=e.outerSize,r=e.scrollOffset,n=t.length-1,i=function(u){return t[u].start},a=cT(0,n,i,r),s=a;s<n&&t[s].end<r+o;)s++;return {startIndex:a,endIndex:s}}var D_,Rl,iT,aT,__,sT,lT,cT,cf=M(()=>{p();oT();nT();D_=function(t){return t},Rl=function(t){for(var o=Math.max(t.startIndex-t.overscan,0),r=Math.min(t.endIndex+t.overscan,t.count-1),n=[],i=o;i<=r;i++)n.push(i);return n},iT=function(t,o){var r=t.scrollElement;if(r){var n=function(s){var l=s.width,u=s.height;o({width:Math.round(l),height:Math.round(u)});};n(r.getBoundingClientRect());var i=new ResizeObserver(function(a){var s=a[0];if(s!=null&&s.borderBoxSize){var l=s.borderBoxSize[0];if(l){n({width:l.inlineSize,height:l.blockSize});return}}n(r.getBoundingClientRect());});return i.observe(r,{box:"border-box"}),function(){i.unobserve(r);}}},aT=function(t,o){var r=t.scrollElement;if(r){var n=function(){o(r[t.options.horizontal?"scrollLeft":"scrollTop"]);};return n(),r.addEventListener("scroll",n,{passive:!0}),function(){r.removeEventListener("scroll",n);}}},__=function(t,o,r){if(o!=null&&o.borderBoxSize){var n=o.borderBoxSize[0];if(n){var i=Math.round(n[r.options.horizontal?"inlineSize":"blockSize"]);return i}}return Math.round(t.getBoundingClientRect()[r.options.horizontal?"width":"height"])},sT=function(t,o,r){var n,i,a=o.adjustments,s=a===void 0?0:a,l=o.behavior,u=t+s;(n=r.scrollElement)==null||n.scrollTo==null||n.scrollTo((i={},i[r.options.horizontal?"left":"top"]=u,i.behavior=l,i));},lT=function(t){var o=this;this.unsubs=[],this.scrollElement=null,this.isScrolling=!1,this.isScrollingTimeoutId=null,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=function(){var r=null,n=function(){return r||(typeof ResizeObserver<"u"?r=new ResizeObserver(function(a){a.forEach(function(s){o._measureElement(s.target,s);});}):null)};return {disconnect:function(){var a;return (a=n())==null?void 0:a.disconnect()},observe:function(a){var s;return (s=n())==null?void 0:s.observe(a,{box:"border-box"})},unobserve:function(a){var s;return (s=n())==null?void 0:s.unobserve(a)}}}(),this.range={startIndex:0,endIndex:0},this.setOptions=function(r){Object.entries(r).forEach(function(n){var i=n[0],a=n[1];typeof a>"u"&&delete r[i];}),o.options=wl({debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:D_,rangeExtractor:Rl,onChange:function(){},measureElement:__,initialRect:{width:0,height:0},scrollMargin:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1},r);},this.notify=function(){o.options.onChange==null||o.options.onChange(o);},this.cleanup=function(){o.unsubs.filter(Boolean).forEach(function(r){return r()}),o.unsubs=[],o.scrollElement=null;},this._didMount=function(){return o.measureElementCache.forEach(o.observer.observe),function(){o.observer.disconnect(),o.cleanup();}},this._willUpdate=function(){var r=o.options.getScrollElement();o.scrollElement!==r&&(o.cleanup(),o.scrollElement=r,o._scrollToOffset(o.scrollOffset,{adjustments:void 0,behavior:void 0}),o.unsubs.push(o.options.observeElementRect(o,function(n){var i=o.scrollRect;o.scrollRect=n,(o.options.horizontal?n.width!==i.width:n.height!==i.height)&&o.maybeNotify();})),o.unsubs.push(o.options.observeElementOffset(o,function(n){o.scrollAdjustments=0,o.scrollOffset!==n&&(o.isScrollingTimeoutId!==null&&(clearTimeout(o.isScrollingTimeoutId),o.isScrollingTimeoutId=null),o.isScrolling=!0,o.scrollDirection=o.scrollOffset<n?"forward":"backward",o.scrollOffset=n,o.maybeNotify(),o.isScrollingTimeoutId=setTimeout(function(){o.isScrollingTimeoutId=null,o.isScrolling=!1,o.scrollDirection=null,o.maybeNotify();},o.options.scrollingDelay));})));},this.getSize=function(){return o.scrollRect[o.options.horizontal?"width":"height"]},this.memoOptions=Di(function(){return [o.options.count,o.options.paddingStart,o.options.scrollMargin,o.options.getItemKey]},function(r,n,i,a){return o.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:n,scrollMargin:i,getItemKey:a}},{key:!1}),this.getFurthestMeasurement=function(r,n){for(var i=new Map,a=new Map,s=n-1;s>=0;s--){var l=r[s];if(!i.has(l.lane)){var u=a.get(l.lane);if(u==null||l.end>u.end?a.set(l.lane,l):l.end<u.end&&i.set(l.lane,!0),i.size===o.options.lanes)break}}return a.size===o.options.lanes?Array.from(a.values()).sort(function(c,d){return c.end-d.end})[0]:void 0},this.getMeasurements=Di(function(){return [o.memoOptions(),o.itemSizeCache]},function(r,n){var i=r.count,a=r.paddingStart,s=r.scrollMargin,l=r.getItemKey,u=o.pendingMeasuredCacheIndexes.length>0?Math.min.apply(Math,o.pendingMeasuredCacheIndexes):0;o.pendingMeasuredCacheIndexes=[];for(var c=o.measurementsCache.slice(0,u),d=u;d<i;d++){var m=l(d),g=o.options.lanes===1?c[d-1]:o.getFurthestMeasurement(c,d),f=g?g.end:a+s,h=n.get(m),b=typeof h=="number"?h:o.options.estimateSize(d),x=f+b,T=g?g.lane:d%o.options.lanes;c[d]={index:d,start:f,size:b,end:x,key:m,lane:T};}return o.measurementsCache=c,c},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:function(){return o.options.debug}}),this.calculateRange=Di(function(){return [o.getMeasurements(),o.getSize(),o.scrollOffset]},function(r,n,i){return o.range=N_({measurements:r,outerSize:n,scrollOffset:i})},{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:function(){return o.options.debug}}),this.maybeNotify=Di(function(){var r=o.calculateRange();return [r.startIndex,r.endIndex,o.isScrolling]},function(){o.notify();},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:function(){return o.options.debug},initialDeps:[this.range.startIndex,this.range.endIndex,this.isScrolling]}),this.getIndexes=Di(function(){return [o.options.rangeExtractor,o.calculateRange(),o.options.overscan,o.options.count,o.getSize()]},function(r,n,i,a,s){return s===0?[]:r(wl({},n,{overscan:i,count:a}))},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return o.options.debug}}),this.indexFromElement=function(r){var n=o.options.indexAttribute,i=r.getAttribute(n);return i?parseInt(i,10):(console.warn("Missing attribute name '"+n+"={index}' on measured element."),-1)},this._measureElement=function(r,n){var i=o.measurementsCache[o.indexFromElement(r)];if(!i||!r.isConnected){o.measureElementCache.forEach(function(l,u){l===r&&(o.observer.unobserve(r),o.measureElementCache.delete(u));});return}var a=o.measureElementCache.get(i.key);a!==r&&(a&&o.observer.unobserve(a),o.observer.observe(r),o.measureElementCache.set(i.key,r));var s=o.options.measureElement(r,n,o);o.resizeItem(i,s);},this.resizeItem=function(r,n){var i,a=(i=o.itemSizeCache.get(r.key))!=null?i:r.size,s=n-a;s!==0&&(r.start<o.scrollOffset&&(process.env.NODE_ENV!=="production"&&o.options.debug&&console.info("correction",s),o._scrollToOffset(o.scrollOffset,{adjustments:o.scrollAdjustments+=s,behavior:void 0})),o.pendingMeasuredCacheIndexes.push(r.index),o.itemSizeCache=new Map(o.itemSizeCache.set(r.key,n)),o.notify());},this.measureElement=function(r){r&&o._measureElement(r,void 0);},this.getVirtualItems=Di(function(){return [o.getIndexes(),o.getMeasurements()]},function(r,n){for(var i=[],a=0,s=r.length;a<s;a++){var l=r[a],u=n[l];i.push(u);}return i},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:function(){return o.options.debug}}),this.getVirtualItemForOffset=function(r){var n=o.getMeasurements();return Eu(n[cT(0,n.length-1,function(i){return Eu(n[i]).start},r)])},this.getOffsetForAlignment=function(r,n){var i=o.getSize();n==="auto"&&(r<=o.scrollOffset?n="start":r>=o.scrollOffset+i?n="end":n="start"),n==="start"?r=r:n==="end"?r=r-i:n==="center"&&(r=r-i/2);var a=o.options.horizontal?"scrollWidth":"scrollHeight",s=o.scrollElement?"document"in o.scrollElement?o.scrollElement.document.documentElement[a]:o.scrollElement[a]:0,l=s-o.getSize();return Math.max(Math.min(l,r),0)},this.getOffsetForIndex=function(r,n){n===void 0&&(n="auto"),r=Math.max(0,Math.min(r,o.options.count-1));var i=Eu(o.getMeasurements()[r]);if(n==="auto")if(i.end>=o.scrollOffset+o.getSize()-o.options.scrollPaddingEnd)n="end";else if(i.start<=o.scrollOffset+o.options.scrollPaddingStart)n="start";else return [o.scrollOffset,n];var a=n==="end"?i.end+o.options.scrollPaddingEnd:i.start-o.options.scrollPaddingStart;return [o.getOffsetForAlignment(a,n),n]},this.isDynamicMode=function(){return o.measureElementCache.size>0},this.cancelScrollToIndex=function(){o.scrollToIndexTimeoutId!==null&&(clearTimeout(o.scrollToIndexTimeoutId),o.scrollToIndexTimeoutId=null);},this.scrollToOffset=function(r,n){var i=n===void 0?{}:n,a=i.align,s=a===void 0?"start":a,l=i.behavior;o.cancelScrollToIndex(),l==="smooth"&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),o._scrollToOffset(o.getOffsetForAlignment(r,s),{adjustments:void 0,behavior:l});},this.scrollToIndex=function(r,n){var i=n===void 0?{}:n,a=i.align,s=a===void 0?"auto":a,l=i.behavior;r=Math.max(0,Math.min(r,o.options.count-1)),o.cancelScrollToIndex(),l==="smooth"&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var u=o.getOffsetForIndex(r,s),c=u[0],d=u[1];o._scrollToOffset(c,{adjustments:void 0,behavior:l}),l!=="smooth"&&o.isDynamicMode()&&(o.scrollToIndexTimeoutId=setTimeout(function(){o.scrollToIndexTimeoutId=null;var m=o.measureElementCache.has(o.options.getItemKey(r));if(m){var g=o.getOffsetForIndex(r,d),f=g[0];rT(f,o.scrollOffset)||o.scrollToIndex(r,{align:d,behavior:l});}else o.scrollToIndex(r,{align:d,behavior:l});}));},this.scrollBy=function(r,n){var i=n===void 0?{}:n,a=i.behavior;o.cancelScrollToIndex(),a==="smooth"&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),o._scrollToOffset(o.scrollOffset+r,{adjustments:void 0,behavior:a});},this.getTotalSize=function(){var r;return (((r=o.getMeasurements()[o.options.count-1])==null?void 0:r.end)||o.options.paddingStart)-o.options.scrollMargin+o.options.paddingEnd},this._scrollToOffset=function(r,n){var i=n.adjustments,a=n.behavior;o.options.scrollToFn(r,{behavior:a,adjustments:i},o);},this.measure=function(){o.itemSizeCache=new Map,o.notify();},this.setOptions(t),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(function(r){o.itemSizeCache.set(r.key,r.size);}),this.maybeNotify();},cT=function(t,o,r,n){for(;t<=o;){var i=(t+o)/2|0,a=r(i);if(a<n)t=i+1;else if(a>n)o=i-1;else return i}return t>0?t-1:0};});function z_(e){var t=on.useReducer(function(){return {}},{})[1],o=El({},e,{onChange:function(a){t(),e.onChange==null||e.onChange(a);}}),r=on.useState(function(){return new lT(o)}),n=r[0];return n.setOptions(o),on.useEffect(function(){return n._didMount()},[]),F_(function(){return n._willUpdate()}),n}function wu(e){return z_(El({observeElementRect:iT,observeElementOffset:aT,scrollToFn:sT},e))}var F_,uf=M(()=>{p();tT();cf();cf();F_=typeof document<"u"?on.useLayoutEffect:on.useEffect;});function pf(e,t,o,r,n=!1){let i=useRouter(),{query:a,locale:s}=i,l=$(P=>P),u=useDispatch(),c=sr(),d=$(P=>r&&c.variables?c?.variables?.attributes:P.variables.attributes),m=Ei(l),g=Na(l),f=Cn(g,s),h=qe(e,r&&c.active?c?.variables.variables:void 0,r&&c.active?c?.variables.attributes:void 0),b=$(P=>r?c.variables.variables:P.variables.variables),x=$(P=>r?c.variables.status:P.variables.status),T=Ar(),{sectionVariables:E,resetSectionVariables:y}=ot(t),{addRunConsumersRunning:A,removeRunConsumersRunning:C}=rl(),w=r&&c.active?`${o}-valueCompare`:`${o}-value`,B=r&&c.active?`${o}-typeCompare`:`${o}-type`,L=r&&c.active?Object.fromEntries(Object.entries(a).filter(([P])=>P.match(G_)).map(([P,_])=>[P.replace("Compare",""),_])):Object.fromEntries(Object.entries(a).filter(([P])=>P.match(H_)).map(([P,_])=>[P.replace("Compare",""),_]));return useCallback((P,_)=>{let R={locale:s,query:{...L,[`${o}-type`]:_,[`${o}-value`]:P},variables:h},O=new URLSearchParams(window.location.search);P&&_?(O.set(w,P.join(",")),O.set(B,_)):(O.delete(w),O.delete(B)),window.history.replaceState(null,null,`?${O.toString()}`),A([t]),wn(m,void 0,e,f,R,{variables:b,status:x},T,"report").then(I=>{n&&E&&y(),c.active&&r?c.setComparisonVariables({attributes:d,variables:I.variables,status:I.status}):u(di.setVariableChange({attributes:d,variables:I.variables,status:I.status})),C([t]);});},[r,d,e,m,c,u,f,x,b,s,L,T,o,B,w,h,E,n,y])}var G_,H_,uT=M(()=>{p();Mn();Bi();Yr();ce();Se();kn();Jr();Sa();G_=/\w*Compare\b/,H_=/multihierarchySelector\d+(id|-(type|value))/;});function ff(e){let{allLabel:t,asComparison:o,colorKey:r,data:n,defaultValue:i,defaultValueType:a,hideLabel:s,resetSectionVars:l,iconKey:u,id:c,levels:d,limit:m,placeholder:g,searchIndexKey:f,searchIndexSeparator:h,section:b,settings:x}=e,{print:T}=zo(),E=nN(c),y=pf(c,b,E,o,l==="true"),A=o?`${E}-valueCompare`:`${E}-value`,C=o?`${E}-typeCompare`:`${E}-type`,w=useMantineTheme(),[B,L]=useState(!1),[D,P]=useState(!0),[_,R]=useState(""),[O,I]=useState(!1),[N,U]=useState([""].slice(1)),[G,Z]=useState([]),[H,ee]=useState(""),ie=useMemo(()=>T?Array.from(new Set(n.filter(F=>G.includes(F[`${H} ID`])))).map(F=>F?.[H]).join(", "):"",[T]),z=s==="true"||!e.label?jsx(Fragment,{}):jsx(Ce,{component:"div",html:e.label,size:"sm",style:x}),j=useRef(null),J=useRef(!1),V=useRef(!!m&&m<G.length),q=N.length,le=d[q],W=N.filter(Boolean);N.length>0&&W.length===0&&W.push(`${t} ${le?.label}`),useEffect(()=>{let Y=new URLSearchParams(window.location.search),F=Y.get(A)||i,X=Y.get(C)||a;F&&X?(Z(iN(F,i)),ee(X)):(Z([]),ee(""));},[window.location.search,i,a]),useEffect(()=>{let Y=()=>{P(!0);};return window.addEventListener("touchmove",Y),()=>{window.removeEventListener("touchmove",Y);}},[]);let te=useMemo(()=>tN(n,d,r,u,f,h),[r,n,u,d,f,h]),ne=useMemo(()=>{let Y=oN(_),F=Array.from(rN(te,Y)).reverse();return O?F:N.reduce((X,me)=>X.filter(ge=>!me||ge.searchindex.indexOf(me)>-1),F.filter(X=>X.type===le?.value))},[le,te,_,O,N]),pe=useRef(null),ve=wu({count:B?ne.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>pe.current,[]),overscan:10,rangeExtractor:useCallback(Y=>Rl(Y),[])}),[K,re]=useState(-1),fe=Math.min(K,ne.length-1),De=useCallback(Y=>{let F=N.concat(Y);O&&I(!1),U(F);},[O,N]),Oe=useCallback(()=>{let Y=N.slice(0,q-1);O&&I(!1),U(Y);},[O,N,q]),We=useCallback(Y=>{R(Y.currentTarget.value),!V.current&&n.length>0&&L(!0);},[n,R,V,L]),Tt=useCallback(()=>{R(""),y([],""),j.current?.focus(),m&&(V.current=!1);},[R,y,j,m,V]),Bt=useCallback(Y=>{let F=G.filter(X=>X!==Y);F.length>0?y(F,H):y([],""),m&&F.length<m&&(V.current=!1);},[G,H,y,m,V]),Xo=useCallback(Y=>{H!==Y.type?y([Y.value],Y.type):G.includes(Y.value)?Bt(Y.value):m?(G.length<m&&y([...G,Y.value],H),G.length===m&&y([...G.slice(1),Y.value],H)):y([...G,Y.value],H),R("");},[y,H,G,Bt,m]),Jo=useCallback(()=>{G.length>0&&_.length===0&&(y(G.slice(0,-1),H),L(!0),m&&(V.current=!1)),_.length>0&&R(_.slice(0,-1));},[y,G,H,_,R,L,m,V]),Hr=useCallback(()=>{P(Y=>Y&&(J.current=Y,!Y)),re(Y=>Y+1>=ne.length?Y:Y+1);},[re,ne]),yn=useCallback(()=>{let Y=ne[fe];Y&&Xo(Y);},[ne,fe,Xo]),vn=useCallback(()=>{L(!1);},[L]),Sn=useCallback(()=>{Oe(),re(0);},[re,Oe]),xn=useCallback(()=>{let Y=ne[fe];!O&&Y&&Y.type!==d[d.length-1]?.value&&(De(Y.name),re(0));},[ne,fe,O,d,re,De]),Ns=useCallback(()=>{P(Y=>Y&&(J.current=Y,!Y)),re(Y=>Y-1<0?0:Y-1);},[re]),Fs=({label:Y,onRemove:F,...X})=>jsxs("div",{style:{alignItems:"center",backgroundColor:w.colorScheme==="dark"?w.colors.dark[7]:w.colors.gray[1],borderRadius:w.radius.sm,cursor:"default",color:w.colorScheme==="dark"?w.colors.dark[0]:w.colors.gray[7],display:"flex",fontSize:rem(12),fontWeight:500,height:rem(22),margin:`calc(${w.spacing.xs} / 2 - ${rem(2)}) calc(${w.spacing.xs} / 2)`,maxWidth:`calc(100% - ${rem(10)})`,paddingLeft:`calc(${w.spacing.sm} / 1.5)`,paddingRight:0,userSelect:"none"},...X,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Y}),jsx(CloseButton,{"aria-hidden":!0,iconSize:"70%",onMouseDown:F,radius:2,size:"sm",sx:{color:w.colorScheme==="dark"?w.colors.dark[0]:w.colors.gray[7],marginLeft:`calc(${w.spacing.sm} / 6)`},tabIndex:-1})]}),oe=useMemo(()=>G.map(Y=>te.find(F=>F.value===Y)).filter(Y=>!!Y).map((Y,F)=>createElement(Fs,{...Y,index:F,label:Y.label,key:Y.value,onRemove:X=>{X.preventDefault(),X.stopPropagation(),Bt(Y.value);}})),[G]),Re=forwardRef(function({color:F,icon:X,label:me,value:ge,...Ee},Ct){return jsx("div",{ref:Ct,style:{cursor:"pointer",width:"100%"},...Ee,children:jsxs(Group,{align:"center",noWrap:!0,spacing:"xs",w:"100%",children:[X&&jsx(Box,{bg:F??"transparent",component:"img",w:20,h:20,src:X}),jsx(Text,{lineClamp:1,size:"sm",children:me||ge})]})})});return jsxs(Fragment,{children:[jsx(MediaQuery,{query:"print",styles:{display:"none"},children:jsx(Input.Wrapper,{label:z,children:jsxs(Popover,{closeOnClickOutside:!0,keepMounted:!0,opened:B,onChange:L,onClose:()=>{re(0),R("");},onOpen:()=>{ne.length>0&&ve.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:!0,children:[jsx(Popover.Target,{children:jsxs(Box,{"aria-haspopup":"listbox",component:"div",onMouseLeave:()=>re(0),sx:{position:"relative","& .defaultValue":{backgroundColor:w.colorScheme==="dark"?w.colors.dark[5]:w.colors.gray[3],color:w.colorScheme==="dark"?w.colors.dark[1]:w.colors.gray[7]}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:G.join(",")}),jsx(Input,{component:"div",multiline:!0,onMouseDown:Y=>{Y.preventDefault(),!V.current&&n.length>0&&L(!B),j.current?.focus();},rightSection:G.length>0?jsx(CloseButton,{onClick:Tt,onMouseDown:Y=>Y.preventDefault(),variant:"transparent"}):jsx(IconSelector,{color:w.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{component:"div","data-clearable":!0,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${w.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:w.colorScheme==="dark"?w.colors.dark[3]:w.colors.gray[5],opacity:1}},children:[oe,jsx("input",{autoComplete:"off","data-mantine-stop-propagation":B,onChange:We,onKeyDown:getHotkeyHandler([["ArrowDown",Hr],["ArrowLeft",Sn],["ArrowRight",xn],["ArrowUp",Ns],["Backspace",Jo],["Enter",yn],["Escape",vn]]),placeholder:G.length===0&&g||"",ref:j,readOnly:V.current,style:{appearance:"none",backgroundColor:"transparent",border:0,color:"inherit",flex:1,fontSize:w.fontSizes.sm,marginLeft:`calc(${w.spacing.xs} / 2)`,maxHeight:rem(22),minWidth:rem(60),outline:0,padding:0},type:"search",value:_})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:Y=>Y.preventDefault(),p:0,children:jsx("div",{style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{component:"div","data-combobox-popover":!0,onMouseDown:Y=>Y.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",spacing:"xs",w:"100%",children:[d.length>1&&jsxs(Stack,{spacing:"xs",children:[jsxs(Group,{onClick:Y=>{Y.stopPropagation();},px:"xs",position:"center",spacing:"xs",children:[jsx(Button,{onClick:()=>{re(0),I(!0),U([]),ne.length>0&&ve.scrollToIndex(0);},size:"xs",variant:O?"filled":"outline",children:t}),d.map((Y,F)=>jsx(Button,{onClick:()=>{O&&I(!1);let X=[""].slice(1),me=F;for(;me--;)X[me]=N[me]||"";re(0),U(X),ne.length>0&&ve.scrollToIndex(0);},size:"xs",variant:!O&&N.length===d.findIndex(X=>X.value===Y?.value)?"filled":"outline",children:Y?.label},Y?.value))]}),jsx(Divider,{})]}),q>0&&jsxs(Group,{align:"center",noWrap:!0,px:"xs",children:[jsx(ActionIcon,{onClick:Oe,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:W.map(Y=>jsx(Text,{lineClamp:1,size:"xs",children:Y},`${Y}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>P(!0),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:pe,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${ve.getTotalSize()}px`,position:"relative",width:"100%"},children:ve.getVirtualItems().map(Y=>{let F=ne[Y.index],X=fe===Y.index,me=G.includes(F.value);return ne.length>0&&X&&!D&&ve.scrollToIndex(fe),jsxs(Group,{"aria-selected":X,align:"center","data-hovered":X||void 0,"data-index":Y.index,"data-selected":me,id:F.vale,noWrap:!0,onMouseEnter:ge=>{ge.preventDefault(),ge.stopPropagation(),D&&(re(Y.index),P(!1));},onMouseMove:ge=>{ge.preventDefault(),ge.stopPropagation(),P(!0);},onMouseDown:ge=>{ge.preventDefault(),Xo(F);},position:"apart",ref:ve.measureElement,role:"option",spacing:"xs",sx:ge=>({borderRadius:ge.radius.xs,padding:"15px 5px 15px",paddingLeft:O&&10*d.findIndex(Ee=>Ee?.value===F.type)||5,position:"absolute",top:0,left:0,height:`${Y.size}px`,transform:`translateY(${Y.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:ge.colorScheme==="dark"?ge.colors.dark[4]:ge.colors.gray[1]},"&:hover":{backgroundColor:ge.colorScheme==="dark"?ge.colors.dark[4]:ge.colors.gray[1]}}),tabIndex:-1,children:[jsx(Re,{index:Y.index,...F}),!O&&F.type!==d[d.length-1]?.value&&jsx(ActionIcon,{onMouseDown:ge=>{ge.preventDefault(),ge.stopPropagation(),De(F.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},F.value)})})})]})})})})]})})}),T&&jsxs(Text,{children:[z,": ",ie]})]})}var tN,oN,rN,nN,iN,yT=M(()=>{p();uf();bt();Bn();uT();tN=(e=[],t=[],o="",r="",n="",i="|")=>{let a=t.map(h=>h.value).slice(),s=`${a.pop()}`,l=h=>h[o],u=h=>h[r],c=h=>{if(h[n])return typeof h[n]=="string"?h[n].split(i):h[n]},d=new Set,m=[],g=[],f=nest().rollup(h=>{let b=h[0],x=L=>L&&L.value&&!d.has(L.value),T=a.map(L=>b[`${L} ID`]),E=a.map(L=>b[L]),y=a.map((L,D)=>{if(g[D]!==E[D]){g[D]=E[D];let P=l[D]||l[l.length-1]||l,_=u[D]||u[u.length-1]||u,R=c[D]||c[c.length-1]||c;return {color:P(b,L)||void 0,icon:_(b,L)||void 0,value:`${T[D]}`,label:E[D],name:E[D],type:L,searchindex:E.slice(0,D+1).concat(R(b,L)).join("|")}}return {}}).filter(x);y.forEach(L=>d.add(L.value));let A=l[l.length-1]||l,C=u[u.length-1]||u,w=c[c.length-1]||c,B=h.map(L=>({color:A(L,s)||void 0,icon:C(L,s)||void 0,value:`${L[`${s} ID`]}`,label:L[s],name:L[s],type:s,searchindex:E.concat(L[s]).concat(w(L,s)).join("|")}));m.push(...y.concat(B));});return a.forEach(h=>{f.key(b=>`${b[`${h} ID`]}|${b[h]}`);}),f.entries(e),m},oN=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},rN=(e,t)=>{let o=e.length,r,n=s=>r&&r.searchindex.includes(s.searchindex),a={next:()=>{for(let s=o-1;s>-1;s--){let l=e[s];if(t.test(`${l.value} ${l.label} ${l.searchindex}`)||n(l))return r=l,o=s,{done:!1,value:l}}return {done:!0,value:void 0}},[Symbol.iterator]:()=>a};return a},nN=e=>`multihierarchySelector${e}`,iN=(e,t)=>e&&typeof e=="string"?e.split(","):t;});var vT=M(()=>{p();ce();Jr();Jr();kn();Ys();Yr();ce();Sa();Bi();Se();});var gf=M(()=>{p();});var ST=M(()=>{p();vT();of();gf();lm();});function Ou(){let e=useContext(pN);if(e===void 0)throw new Error("usePdf must be used within a PdfProvider");return e}var uN,pN,hf=M(()=>{p();ce();uN={active:!1,pdfParam:!1,position:"DEFAULT",XlsxVizActive:!1},pN=createContext(uN);});function bf(e,t){let o=$(l=>t?l.records.entities[e][t]:null),r=o?.settings,[n,i]=useSetState(o?.settings||{}),a=se(),s=useCallback((l,u)=>{o&&(i({[l]:u}),a(Q.updateEntity(e,{id:o.id,settings:{...o.settings,[l]:u}})));},[a,o]);return useEffect(()=>{r&&i(r);},[r,i]),{settings:n,updateSettings:s}}var rn,Lu,_i=M(()=>{p();ce();rn=e=>bf("section",e),Lu=e=>bf("report",e);});function Co({target:e,dropdown:t}){let[o,{open:r,close:n}]=useDisclosure(!1),i=useRef(!0),a=()=>{setTimeout(()=>{i.current&&n();},1e3);},s=()=>{i.current=!1;},l=()=>{i.current=!0,n();};return jsxs(Group,{children:[e,jsxs(Popover,{opened:o,trapFocus:!0,children:[jsx(Popover.Target,{children:jsx(ActionIcon,{variant:"subtle",color:"blue",onMouseEnter:r,onMouseLeave:a,children:jsx(IconInfoCircle,{})})}),jsx(Popover.Dropdown,{maw:350,onMouseEnter:s,onMouseLeave:l,children:jsxs(Group,{align:"flex-start",noWrap:!0,children:[jsx("div",{children:jsx(ThemeIcon,{variant:"outline",sx:{border:"none"},children:jsx(IconInfoCircle,{})})}),jsx("div",{children:t})]})})]})]})}var Mu=M(()=>{p();});function Sf(e,t){return e===t}function xf(){let e=so(),t=Number.parseInt(e.params[0]),o=Ht(t).data,{settings:r,updateSettings:n}=Lu(t),{handlers:i}=io("reportEditor"),a=o?.dimensions&&o.dimensions.length>0;return jsx(Fragment,{children:jsxs(Stack,{children:[jsx(Button,{variant:"outline",radius:0,onClick:i.open,children:"Edit Report"}),a&&jsxs(Accordion,{children:[jsxs(Accordion.Item,{value:"comparison",children:[jsx(Accordion.Control,{children:"Profile Comparison"}),jsxs(Accordion.Panel,{children:[jsx(Co,{target:jsx(Switch,{label:"Enable comparison",checked:!!r.comparison,onChange:s=>n("comparison",s.currentTarget.checked)}),dropdown:jsxs(Fragment,{children:[jsx(Text,{fw:700,children:"Comparisons"}),jsx(Text,{fw:400,children:"This feature will allow user visiting this profile to compare it side by side to another choosen profile"})]})}),r.comparison&&jsx(Co,{target:jsx(Switch,{label:"With different levels",checked:!!r.compareLevels,onChange:s=>n("compareLevels",s.currentTarget.checked)}),dropdown:jsxs(Fragment,{children:[jsx(Text,{fw:700,children:"Compare with different Levels"}),jsx(Text,{fw:400,children:"Allow users to compare profiles from differet Levels."})]})})]})]}),jsxs(Accordion.Item,{value:"pdf",children:[jsx(Accordion.Control,{children:"PDF Export"}),jsx(Accordion.Panel,{children:jsx(Co,{target:jsx(Switch,{label:"Enable PDF export",checked:!!r.pdf,onChange:s=>n("pdf",s.currentTarget.checked)}),dropdown:jsxs(Fragment,{children:[jsx(Text,{fw:700,children:"PDF Exports"}),jsx(Text,{fw:400,children:"This feature will allow user to download the PDF version of the report with a single click."})]})})})]}),jsxs(Accordion.Item,{value:"xlsx",children:[jsx(Accordion.Control,{children:"XLSX Export"}),jsx(Accordion.Panel,{children:jsx(Co,{target:jsx(Switch,{label:"Enable XLSX export",checked:!!r.XlsxViz,onChange:s=>n("XlsxViz",s.currentTarget.checked)}),dropdown:jsxs(Fragment,{children:[jsx(Text,{fw:700,children:"Xlsx Exports"}),jsx(Text,{fw:400,children:"This feature will allow user to download the XlSX version of the report visualizations."})]})})})]})]})]})})}var Du=M(()=>{p();Se();_i();Mu();wi();});var ET,Tf,wT,Nu=M(()=>{p();ET=(e,t,o,r=null)=>{let[n,i]=useState(!1),[a,s]=useState(null);return {print:u=>{i(!0),s(null);let c=process.env.NEXT_PUBLIC_REPORTS_BASE_URL,d=new URLSearchParams(window.location.search),m=u?"&transparent=true":"",g=r?`/embeds/${t}/${o}?section=${e}&block=${r}${d.toString()?"&"+d.toString():""}`:`/embeds/${t}/${o}?section=${e}${d.toString()?"&"+d.toString():""}`,f=encodeURIComponent(`${c}${g}&print=true`);Vc.get(`${process.env.NEXT_PUBLIC_PDF_API_URL}/screenshot?url=${f}${m}`,{responseType:"blob"}).then(h=>{let b=r?`section${e}_block${r}.png`:`section${e}.png`;saveAs(h.data,b);}).catch(h=>{s(h.response?.data?.message||"Failed to download image. Please try again.");}).finally(()=>{i(!1);});},downloadLoading:n,error:a}},Tf=()=>{let{asPath:e}=useRouter(),[t,o]=useState(!1),[r,n]=useState(null);return {printReport:()=>{o(!0),n(null);let a=process.env.NEXT_PUBLIC_REPORTS_BASE_URL,s=e.replace(/[&?]printBtn=[^&]+/,""),l=s.includes("?")?"&":"?",u=encodeURIComponent(`${a}${s}${l}print=true`);return Vc.get(`${process.env.NEXT_PUBLIC_PDF_API_URL}/pdf?url=${u}`,{responseType:"blob"}).then(c=>{let m=c.headers["content-disposition"]?.match(/filename[^;=\n]*=(['"]?)(.*?)\1/),g=m&&m[2]?m[2]:"report.pdf";saveAs(c.data,g);}).catch(c=>{n(c.response?.data?.message||"Failed to generate PDF. Please try again.");}).finally(()=>{o(!1);})},error:r,setError:n,downloadLoading:t}},wT=()=>!!process.env.NEXT_PUBLIC_PDF_API_URL;});function OT({contentOutline:e=[]}){return jsx(Menu,{children:LT(e)})}function LT(e,t=!0){return e.map((o,r)=>t?jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${o.id}`,children:jsx(Group,{children:jsx(Text,{dangerouslySetInnerHTML:{__html:o.label}})})})}),o.children.length?jsx(Box,{ml:"md",children:LT(o.children,!1)}):null]},r):jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${o.id}`,children:jsx(Text,{dangerouslySetInnerHTML:{__html:o.label}})})},r))}function kf({headings:e,settings:t,type:o}){let{min:r="1",max:n="6",icons:i="yes"}=t||{},a=Fa(parseInt(r,10),parseInt(n,10),e),s=i==="yes",u=`(max-width: ${useMantineTheme().breakpoints.md})`,c=useMediaQuery(u),d=Ja(t&&t.align?String(t.align):"left");return c?jsx(ON,{contentOutline:a,showIcons:s}):o==="multilevel"?jsx(LN,{contentOutline:a,showIcons:s,align:d}):jsx(PN,{contentOutline:a,showIcons:s,align:d})}var IT,PN,MT,ON,LN,BT=M(()=>{p();ST();Oi();$t();hf();Du();Nu();IT=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"});PN=({contentOutline:e,showIcons:t,align:o})=>{let{active:r,position:n,pdfParam:i}=Ou(),{downloadLoading:a,printReport:s}=Tf(),[l,u]=useState(null);if(useEffect(()=>{let d=()=>{let m=document.querySelector(".bespoke-nav");if(!m)return;let g=m.getBoundingClientRect(),f=!1;e.forEach(h=>{let b=document.getElementById(`bespoke-title-${h.id}`);b&&b.getBoundingClientRect().top<=g.bottom&&(u(h.id),f=!0);}),f||u(null);};return window.addEventListener("scroll",d),()=>{window.removeEventListener("scroll",d);}},[e]),r&&i)return jsx(OT,{contentOutline:e});let c=d=>!d||!d?.length?null:jsx(Fragment,{children:d.map(m=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${m.id}`,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(nt,{...m.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:m.label}})]})})}),jsx(Box,{pl:"xs",children:c(m.children)})]},m.id))});return jsxs(Box,{component:"nav",className:"bespoke-nav",children:[jsx(List,{sx:d=>({display:"flex",gap:d.spacing.md,justifyContent:o,listStyleType:"none"}),children:e?.map(d=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${d.id}`,"data-active":d.id===l,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(nt,{...d.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:d.label}})]})})}),d?.children?.length?jsx(Menu.Dropdown,{children:c(d.children)}):null]})},d.id))}),Sf(n,"NAV")&&r&&e.length>=1&&jsx(List.Item,{children:jsx(Button,{variant:"outline",onClick:s,children:a?"Downloading":"Download PDF"})})]})},MT=({contentOutline:e,closeNav:t,showIcons:o})=>{let[r,n]=useState(null);return jsx(Stack,{children:e.map(i=>i.children.length?jsxs(Fragment,{children:[jsxs(Group,{spacing:0,noWrap:!0,children:[jsx(UnstyledButton,{w:"100%",component:"a",onClick:t,href:`#bespoke-title-${i.id}`,children:jsxs(Group,{spacing:"sm",noWrap:!0,children:[o&&jsx(nt,{...i.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{dangerouslySetInnerHTML:{__html:i.label}})]})},i.id),jsx(ActionIcon,{component:"a",size:"lg",onClick:()=>n(a=>a===i.id?null:i.id),children:jsx(IconChevronDown,{style:{transition:"transform 0.2s",transform:r===i.id?"rotate(-180deg)":"none"},stroke:1})})]},i.id),jsx(Collapse,{in:r===i.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(MT,{contentOutline:i.children,closeNav:t,showIcons:o})})]}):jsx(Group,{noWrap:!0,children:jsx(UnstyledButton,{display:"flex",w:"100%",component:"a",href:`#bespoke-title-${i.id}`,children:jsxs(Group,{spacing:"sm",children:[o&&jsx(nt,{...i.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:i.label}})]})},i.id)},i.id))})},ON=({contentOutline:e,showIcons:t})=>{let[o,{toggle:r}]=useDisclosure(!1),n=o?"Close content outline":"Open content outline",{active:i,pdfParam:a}=Ou();return i&&a?jsx(OT,{contentOutline:e}):jsxs(Box,{component:"nav",children:[jsx(Group,{children:jsx(Burger,{opened:o,onClick:r,"aria-label":n,size:"md"})}),jsx(Collapse,{in:o,mt:"md",children:jsx(MT,{contentOutline:e,closeNav:r,showIcons:t})})]})},LN=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null),[i,a]=useState(null);useEffect(()=>{let l=()=>{let u=document.querySelector(".bespoke-nav");if(!u)return;let c=u.getBoundingClientRect(),d=!1;e.forEach(m=>{let g=document.getElementById(`bespoke-title-${m.id}`);g&&(g.getBoundingClientRect().top<=c.bottom&&(n(m.id),a(null),d=!0),m.children.forEach(h=>{let b=document.getElementById(`bespoke-title-${h.id}`);b&&b.getBoundingClientRect().top<=c.bottom&&(a(h.id),n(m.id),d=!0);}));}),d||(n(null),a(null));};return window.addEventListener("scroll",l),()=>{window.removeEventListener("scroll",l);}},[e]);let s=l=>!l||!l?.length?null:jsx(Fragment,{children:l.map(u=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${u.id}`,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(nt,{...u.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:u.label}})]})})}),jsx(Box,{pl:"xs",children:s(u.children)})]},u.id))});return jsxs(Box,{component:"nav",className:"bespoke-nav",children:[jsx(List,{className:"bespoke-nav-level1",sx:IT(o),children:e?.map(l=>jsx(List.Item,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,"data-active":r===l.id,onClick:()=>n(l.id),children:jsxs(Group,{spacing:"sm",children:[t&&jsx(nt,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})},l.id))}),r&&e.find(l=>l.id===r)?.children.length>0&&jsx(List,{className:"bespoke-nav-level2",sx:IT(o),children:e.find(l=>l.id===r)?.children.map(l=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,"data-active":l.id===i,children:jsxs(Group,{spacing:"sm",children:[t&&jsx(nt,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})}),l?.children?.length?jsx(Menu.Dropdown,{children:s(l.children)}):null]})},l.id))})]})};});function Rf(e){let{related_reports:t,settings:o}=e,r=$(m=>m.status.currentLocale),n=$(m=>m.status.localeDefault),i=Aa(),a=useRouter(),{components:s}=No();if(!t?.length)return;let l=r===n?"":`/${r}`,u=m=>{a.push(`${m}`);},c=s?.ReportTile?s.ReportTile:qm,d=kr(o&&o.align?String(o.align):"center");return jsx(Grid,{justify:d,children:t.map(m=>{let g=`${l}${i}${m.link}`,f=m.entities.map(E=>({original_id:E.id,name:E.name,id:E.content_id,variant:E.variant_name,variant_id:E.variant_id,dimension:E.dimension_name,dimension_id:E.dimension_id,image:{src:`/api/cms/member/image?member=${E.content_id}&size=thumb`,alt:E.name}})),h=m.entities.map(E=>E.id).join("-"),b=m.entities.map(E=>E.name).join(" & "),x=m.entities[0]?m.entities[0].report_id:null,T=E=>{E.preventDefault(),u(g);};return jsx(Grid.Col,{xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(c,{reportId:x,reportName:b,members:f,href:g,onClick:T})},h)})})}var _T=M(()=>{p();ce();Se();Ym();Li();$t();});function If({id:e,label:t,settings:o,showIcon:r,fullWidth:n,showWhenDisabled:i}){let a=Ke(e).data,{sectionVariables:s,resetSectionVariables:l}=ot(a?.section_id),u=!!Object.keys(s).length,c=kr(o&&o.align?o.align:"left");return !u&&!i?null:jsx(Button,{onClick:()=>l(),disabled:!u,fullWidth:n,sx:{justifySelf:c},children:jsxs(Group,{align:"center",children:[t,r&&jsx(IconRefresh,{})]})})}var FT=M(()=>{p();Se();Se();$t();});function Af({settings:e,label:t,removeLabel:o,showIcon:r,position:n="center",asComparison:i=!1}){let a=$(E=>E.records.entities.report),s=$(E=>E.variables.attributes),l=e&&e.search?e.search:"inline",u=Object.values(a)[0].settings,c=useRouter(),{comparisonLoaded:d,loading:m}=sr(),g=Object.keys(c.query).includes("compare"),h=d&&g?jsx(Button,{onClick:()=>{let E={...c.query};delete E.compare,c.push({pathname:c.pathname,query:E},void 0,{shallow:!0});},rightIcon:jsx(IconX,{}),children:o||"Remove Comparison"}):jsx(Button,{loading:m,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",r&&jsx(IconPlus,{})]})}),b={searchReportParams:{report:[Number(Object.keys(a)[0])],variant:u.compareLevels?[]:[s.variant_id1]}},T=Cl(h,l,E=>{c.push({pathname:c.pathname,query:{...c.query,compare:E.reportPath}});},b);return i?null:jsx(Group,{position:n,children:g?h:T})}var $T=M(()=>{p();Zm();ce();Mn();});function Of({columns:e=[],data:t=[],tableProps:o={},sectionId:r=null}){let[n,i]=useState(!1),[a,s]=useState({}),l=useMemo(()=>e.map(m=>m.accessorKey),[e]),u=useMemo(()=>t.filter(m=>typeof m=="object"&&m!==null&&!Array.isArray(m)&&Object.keys(m).some(g=>l.includes(g))),[l,t]),c=useMemo(()=>e.map(m=>({...m,Cell:({renderedCellValue:g})=>jsx(Ce,{html:`${g}`}),filterFn:"contains"})),[e]),{locale:d}=useRouter();return useEffect(()=>{(async()=>{try{let g=d||"en",f=`${g.toUpperCase()}`,h=await import(`mantine-react-table/locales/${g}.js`);s(h[`MRT_Localization_${f}`]);}catch(g){console.error("Error loading translations:",g);}})();},[d]),jsx(MantineReactTable,{...o,autoResetPageIndex:!1,columns:c,data:u,enableColumnFilterModes:!0,enableFilterMatchHighlighting:!1,globalFilterFn:"contains",layoutMode:"grid",localization:a,onIsFullScreenChange:m=>{let g=document.getElementById(`section-${r}`);g&&(m?g.style.zIndex="10":g.style.zIndex="1"),i(m);},state:{...o.state,isFullScreen:n}})}var HT=M(()=>{p();bt();});function Lf({label:e,url:t,settings:o}){let{align:r}=o;return e?jsx(Group,{position:r,grow:r==="justify",children:jsx(Button,{component:"a",target:"_blank",href:t||"",children:e||"Button"})}):null}var WT=M(()=>{p();});function JN({block:e}){let{id:t}=e;return jsxs(Stack,{align:"center",spacing:"sm",children:[jsx(ThemeIcon,{radius:"md",size:100,children:jsx(IconCircleKey,{size:100})}),jsxs(Title,{order:5,children:["Private content (Block ",t,")"]}),jsx(Text,{children:"Sorry, you do not have sufficient permissions to view this block."}),jsx(Text,{children:"Contact your account manager to check your access role."})]})}function Mf(e){let t=QN();return jsx(t,{block:e})}var QN,YT=M(()=>{p();Li();QN=()=>{let{components:e}=No(),t=JN;return e?.CustomFallback&&(t=e.CustomFallback),t};});var e1,t1,XT,o1,zi,Ol=M(()=>{p();Ic();e1=process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT||"en",t1="Error Rendering Visualization",XT={data:[],dataFormat:e=>e,type:"Treemap",noDataHTML:`<p style="font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;">
|
|
104
104
|
<strong>${t1}</strong>
|
|
105
|
-
</p>`},o1=(e,t,o={},r=e1,n=null,i={},a={})=>{let s;try{s=pa({vars:["variables"],logic:e},t,r,i,a)(o);}catch(m){return console.error(`Parsing Error in propify (ID: ${n})`),console.error(`Error message: ${m.message}`),{error:`${m}`,config:XT}}if(typeof s!="object")return {error:"Visualization JS code must return an object",config:XT};let l=s.dataFormat?s.dataFormat:m=>{let f=Array.isArray(s.data)&&s.data.length>1&&s.data.some(h=>typeof h=="string")?m:[m];return dataConcat(f,"data")};delete s.dataFormat;let u=s.linksFormat||void 0;delete s.linksFormat;let c=s.nodesFormat||void 0;delete s.nodesFormat;let d=s.topojsonFormat||void 0;return delete s.topojsonFormat,{config:s,dataFormat:l,linksFormat:u,nodesFormat:c,topojsonFormat:d}},zi=o1;});var an,zu=M(()=>{p();an=class extends on__default.Component{constructor(t){super(t),this.state={hasError:!1};}static getDerivedStateFromError(t){return {hasError:!0}}componentDidCatch(t,o){console.log("Error information:",o.componentStack),notifications.show({autoClose:!1,color:"red",id:"revalidate-error",message:"Check the console for more details",title:t.message});}render(){return this.state.hasError?this.props.fallback:this.props.children}};});function Ll({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var Bf=M(()=>{p();});var ZT={};pd(ZT,{default:()=>QT});function QT(e){let{print:t}=zo(),{block:o,active:r,locale:n,variables:i,configOverride:a={}}=e,s=ro(o),l=no(n),u={variables:i},c=useRouter(),{sectionVariables:d,setSectionVariables:m,resetSectionVariables:g}=ot(o.section_id),f=JSON.stringify(d),h=useMemo(()=>{if(!s?.logic)return {error:"Add a Configuration"};let A=er({logic:s.logic},l,u).logic,C={router:c,section:{variables:d,setVariables:m,resetVariables:g}};return zi(A,l,i,n,o.id,{},C)},[o,r,i,f]),{type:b}=h.config||{},x=b&&Df[b]?b:"Treemap";Df[b]||(h.config={error:`"${b}" is not a valid Visualization Type`});let T=Df[x],E=useMemo(()=>{let{_data:A,...C}=h.config;return l1(C,t)},[h,t]),y={locale:n,variables:i,...E,...a};return console.log("vizConfig",y._printIgnore),jsx("div",{className:"bespoke-Viz","data-ignore-print":y._printIgnore?"true":void 0,children:jsx("div",{style:{display:"flex",flex:"1 1 100%",minHeight:b==="HTML"?void 0:400},children:jsx(an,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(T,{style:{flex:1},dataFormat:A=>{h.data&&Array.isArray(h.data)&&h.data.length>1&&h.data.some(L=>typeof L=="string")?A:[A];let B;try{B=h.dataFormat(A);}catch(L){console.log("Error in dataFormat: ",L),B=[];}return B},linksFormat:h.linksFormat,nodesFormat:h.nodesFormat,topojsonFormat:h.topojsonFormat,config:{...y,sectionVariables:f}},"viz-key")})})})}var Df,l1,eC=M(()=>{p();ho();Ol();ci();Se();Se();zu();Bn();Bf();Df={...a1,HTML:Ll},l1=(e,t)=>{let o={...e};return t&&(o.detectResize=!1,o.detectResizeDelay=0,o.detectVisible=!1,o.detectVisibleInterval=0,o.duration=0,o.shapeConfig={...o.shapeConfig,duration:0}),o};});var u1,tC=M(()=>{p();ye();sx();cx();px();qx();Qx();Zx();eT();yT();BT();_T();FT();$T();HT();WT();YT();u1=c1(()=>Promise.resolve().then(()=>(eC(),ZT)),{ssr:!1}),{[k.PARAGRAPH]:Gm,[k.STAT]:jm,[k.SUBTITLE]:Wm,[k.TITLE]:tf,[k.SELECTOR]:sf,[k.VIZ]:u1,[k.GENERATOR]:ku,[k.SECTION_FLAG]:ku,[k.IMAGE]:lf,[k.NAV]:kf,[k.RELATED]:Rf,[k.RESET_BUTTON]:If,[k.COMPARISON_BUTTON]:Af,[k.TABLE]:Of,[k.BUTTON]:Lf,[k.MULTIHIERARCHY_SELECTOR]:ff,[k.FALLBACK]:Mf};});var oC=M(()=>{p();ye();tC();Bl();ho();Se();ya();li();Ys();kd();wd();Mn();});var Vi,p1,Vu,Dl=M(()=>{p();Vi={margin:{label:"Content Margin",defaultValue:"md",options:[{label:"None",value:"0px"},{label:"Small",value:"sm"},{label:"Medium",value:"md"},{label:"Large",value:"lg"}]},columnGutter:{label:"Column Gutter",defaultValue:"md",options:[{label:"None",value:"0px"},{label:"Small",value:"sm"},{label:"Medium",value:"md"},{label:"Large",value:"lg"}]},width:{label:"Width",defaultValue:"full",options:[{label:"Full Width",value:"full"},{label:"Center",value:"center"}]},position:{label:"Position",defaultValue:"normal",options:[{label:"Normal",value:"normal"},{label:"Sticky",value:"sticky"}]},style:{label:"Style",defaultValue:"none",options:[{label:"None",value:"none"},{label:"Card",value:"card"}]}},p1=Object.keys(Vi).reduce((e,t)=>(e[t]=Vi[t].defaultValue,e),{}),{memberImageBg:!1,optionsMenu:!1,optionData:!0,optionImage:!0,optionShare:!0,showAnchor:!1,...p1},Vu=e=>({data:typeof e.optionData=="boolean"?e.optionData:!0,image:typeof e.optionImage=="boolean"?e.optionImage:!0,share:typeof e.optionShare=="boolean"?e.optionShare:!0});});function Nf({previews:e}){let t=e.map((o,r)=>({key:o?`bg-${o.content_id}`:`bg-${r}`,src:o?`/api/cms/member/image?member=${o.content_id}&size=splash`:""}));return jsxs(Fragment,{children:[jsx(Group,{className:"cms-section-bg",grow:!0,spacing:0,style:{position:"absolute",width:"100%",height:"100%"},children:t.map(o=>jsx("div",{className:"cms-section-member-bg",style:{backgroundImage:`url(${o.src})`,backgroundSize:"cover",backgroundPosition:"center center",height:"100%",width:"100%"}},o.key))}),jsx("div",{className:"cms-section-gradient-bg",style:{background:"white",position:"absolute",width:"100%",height:"100%",opacity:.33}})]})}var Ff=M(()=>{p();});function $u({data:e}){let r=(e&&Array.isArray(e)&&e[0]?Object.keys(e[0]):[]).filter(n=>!n.startsWith("_")).map(n=>({accessorKey:n,header:n,enableSorting:!0,mantineTableBodyCellProps:{sx:{textWrap:"wrap"}}}));return jsx(MantineReactTable,{columns:r,data:e,enableBottomToolbar:!1,enableColumnActions:!1,enablePagination:!1,enableSorting:!0,enableTopToolbar:!1,initialState:{density:"xs"},layoutMode:"grid",mantineTableContainerProps:{sx:{minHeight:100,maxHeight:350}}})}var zf=M(()=>{p();});function lC(e){let{section:t}=e,o=Ar(),r=useRouter(),n=$(V=>V.status.isCMS),i=$(V=>V.status.currentLocale),a=r.locale,s=n?i:a,l=50,u=no(s),c=Yt("options"),d={...sC,...c.data_tab},[m,g]=useState([]),[f,h]=useState([]),[b,x]=useState(),[T,E]=useState(),[y,A]=useState(!1),[C,w]=useState({}),[B,L]=useState(!0),[D,P]=useState(!0),{sectionVariables:_,setSectionVariables:R,resetSectionVariables:O}=ot(t.id),I=t.blocks||[],N=$(V=>V),U=useMemo(()=>I.reduce((V,q)=>{let le=N.records.entities.block[q],W=N.variables.variables[q],te=N.variables.status[q];return (k.GENERATOR===le.type&&W._downloadEnabled===!0&&te.allowed||k.VIZ===le.type&&te.allowed)&&(V[q]={entity:le,variables:N.variables.variables[q],status:N.variables.status[q],inputVariablesFlat:le.inputs.reduce((ne,pe)=>({...ne,...N.variables.variables[pe]}),N.variables.attributes)}),V},{}),[I]),G=V=>{h(q=>q.includes(V)?q:[...q,V]);},Z=V=>{g(q=>(q.find(W=>W.ix===V.ix)?q:[...q,V]).sort((W,te)=>W.ix>te.ix?1:-1));};function H(V){!b&&V[0]&&ee(V[0]);}function ee(V){x(V),E("0");}useEffect(()=>{let V=async(q,le,W)=>{let te=dataLoad.bind({});return new Promise((ne,pe)=>{te(le,null,null,(ve,K)=>{if(ve)pe(ve);else {let re=W instanceof Function?W(K):K;q.data.unshift(re),Z(q),ne(K);}});})};if(m.length===0&&f.length===0){let q=0;for(let le of Object.values(U)){let W=le.entity;if([k.GENERATOR,k.SECTION_FLAG].includes(W.type)){let te=le.variables._downloadData||le.variables._downloadUrl||le.status.api;if(te){let ne=[];typeof te=="string"?ne=te.split(Kr):ne=[te];let pe=le.variables._downloadTitle||`${d.data_source} ${q+1}`,ve=le.variables._downloadFileName||pe;Z({ix:q,id:W.id,title:jt(pe),fileName:ve,data:Array.isArray(ne)?ne:[ne],loading:!1,type:k.GENERATOR}),G(q),q++;}}else if(W.type===k.VIZ){let te=ro(W),ne=le.inputVariablesFlat,pe={variables:ne},ve=er({logic:te.logic},u,pe).logic,K={router:r,section:{variables:_,setVariables:R,resetVariables:O}},re=zi(ve,u,ne,s,W.id,{},K),fe=re.config._downloadTitle||re.config.title||`${d.viz_source} ${q+1}`,De=re.config._downloadFileName||fe;if(re.config._downloadEnabled!==!1)try{let Oe=re.config._downloadUrl||re.config.data,We=typeof Oe=="string"?[Oe]:Oe,Tt=re.dataFormat instanceof Function?re.dataFormat:!1,Bt=re.config._downloadDataFormat instanceof Function?re.config._downloadDataFormat:!1;V({ix:q,id:W.id,title:jt(fe),fileName:De,data:We,loading:!1,type:k.VIZ},Oe,Bt||Tt),G(q),q++;}catch(Oe){console.error("DataLoad catch",Oe);}}}P(!1);}},[U]),useEffect(()=>{m.length===f.length&&H(m);},[m]),useEffect(()=>{if(b&&T){let V=parseInt(T,10);if(b.data[V]&&(!C[b.ix]||!C[b.ix][T])){L(!0);let q=b.data[T];typeof q=="string"?Ad(q,o,s).then(le=>{let W=F1(le);w({...C,[b.ix]:{...C[b.ix],[V]:W}});}).catch(le=>{console.error(le);}).finally(()=>{L(!1);}):(w({...C,[b.ix]:{...C[b.ix],[V]:q}}),L(!1));}}},[T,b]);let ie=(V,q)=>{let le=V===q?"":`-${V}`.toLowerCase();if(b){let W=b.data.length>1&&T?`-${parseInt(T,10)+1}`:"";return `${lo(b.fileName)}${le}${W}.${q.toLowerCase()}`}return `${le}.${q}`},z=async V=>{if(b){A(!0);let q=new k1,le=ie(V,V);try{switch(V){case Gu.json.extension:q.file(le,JSON.stringify(j));break;case Gu.csv.extension:q.file(le,csvFormat(j));break;case Gu.xlsx.extension:let{utils:W,write:te}=await import('xlsx'),ne=W.book_new();W.book_append_sheet(ne,W.json_to_sheet(j),le.substring(0,30));let pe=te(ne,{bookType:"xlsx",bookSST:!0,type:"binary"});q.file(le,pe,{binary:!0});break;default:break}q.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(W=>{A(!1),saveAs(W,ie(V,"zip"));});}catch(W){console.error(d.error_generating,W),A(!1);}}},j=useMemo(()=>b&&C[b.ix]&&C[b.ix][T]?C[b.ix][T]:[],[C,b,T]),J=useMemo(()=>m&&m.length>0&&m.length===f.length&&m.map((V,q)=>jsx(Button,{leftIcon:jsx(IconDatabase,{size:16}),onClick:()=>ee(V),variant:b?.ix===q?"filled":"default",loading:V.loading,disabled:V.loading,children:V.title},`source-${V.id}-${q}`)),[m,b,f]);return jsxs(Stack,{className:"cms-section-options-data",children:[jsx(Space,{h:"xs"}),jsx(LoadingOverlay,{visible:D,overlayBlur:2}),m.length===0&&!D&&jsxs(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:[d.no_data_src," awa"]}),m.length>1&&m.length===f.length&&!D&&jsx(Input.Wrapper,{label:`${d.choose_data_src}:`,children:jsx(Group,{spacing:"xs",children:J})}),b&&T&&jsx(Stack,{spacing:"xs",children:jsx(Input.Wrapper,{label:`${d.preview}
|
|
105
|
+
</p>`},o1=(e,t,o={},r=e1,n=null,i={},a={})=>{let s;try{s=pa({vars:["variables"],logic:e},t,r,i,a)(o);}catch(m){return console.error(`Parsing Error in propify (ID: ${n})`),console.error(`Error message: ${m.message}`),{error:`${m}`,config:XT}}if(typeof s!="object")return {error:"Visualization JS code must return an object",config:XT};let l=s.dataFormat?s.dataFormat:m=>{let f=Array.isArray(s.data)&&s.data.length>1&&s.data.some(h=>typeof h=="string")?m:[m];return dataConcat(f,"data")};delete s.dataFormat;let u=s.linksFormat||void 0;delete s.linksFormat;let c=s.nodesFormat||void 0;delete s.nodesFormat;let d=s.topojsonFormat||void 0;return delete s.topojsonFormat,{config:s,dataFormat:l,linksFormat:u,nodesFormat:c,topojsonFormat:d}},zi=o1;});var an,zu=M(()=>{p();an=class extends on__default.Component{constructor(t){super(t),this.state={hasError:!1};}static getDerivedStateFromError(t){return {hasError:!0}}componentDidCatch(t,o){console.log("Error information:",o.componentStack),notifications.show({autoClose:!1,color:"red",id:"revalidate-error",message:"Check the console for more details",title:t.message});}render(){return this.state.hasError?this.props.fallback:this.props.children}};});function Ll({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var Bf=M(()=>{p();});var ZT={};pd(ZT,{default:()=>QT});function QT(e){let{print:t}=zo(),{block:o,active:r,locale:n,variables:i,configOverride:a={}}=e,s=ro(o),l=no(n),u={variables:i},c=useRouter(),{sectionVariables:d,setSectionVariables:m,resetSectionVariables:g}=ot(o.section_id),f=JSON.stringify(d),h=useMemo(()=>{if(!s?.logic)return {error:"Add a Configuration"};let A=er({logic:s.logic},l,u).logic,C={router:c,section:{variables:d,setVariables:m,resetVariables:g}};return zi(A,l,i,n,o.id,{},C)},[o,r,i,f]),{type:b}=h.config||{},x=b&&Df[b]?b:"Treemap";Df[b]||(h.config={error:`"${b}" is not a valid Visualization Type`});let T=Df[x],E=useMemo(()=>{let{_data:A,...C}=h.config;return l1(C,t)},[h,t]),y={locale:n,variables:i,...E,...a};return jsx("div",{className:"bespoke-Viz",children:jsx("div",{style:{display:"flex",flex:"1 1 100%",minHeight:b==="HTML"?void 0:400},children:jsx(an,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(T,{style:{flex:1},dataFormat:A=>{h.data&&Array.isArray(h.data)&&h.data.length>1&&h.data.some(L=>typeof L=="string")?A:[A];let B;try{B=h.dataFormat(A);}catch(L){console.log("Error in dataFormat: ",L),B=[];}return B},linksFormat:h.linksFormat,nodesFormat:h.nodesFormat,topojsonFormat:h.topojsonFormat,config:{...y,sectionVariables:f}},"viz-key")})})})}var Df,l1,eC=M(()=>{p();ho();Ol();ci();Se();Se();zu();Bn();Bf();Df={...a1,HTML:Ll},l1=(e,t)=>{let o={...e};return t&&(o.detectResize=!1,o.detectResizeDelay=0,o.detectVisible=!1,o.detectVisibleInterval=0,o.duration=0,o.shapeConfig={...o.shapeConfig,duration:0}),o};});var u1,tC=M(()=>{p();ye();sx();cx();px();qx();Qx();Zx();eT();yT();BT();_T();FT();$T();HT();WT();YT();u1=c1(()=>Promise.resolve().then(()=>(eC(),ZT)),{ssr:!1}),{[k.PARAGRAPH]:Gm,[k.STAT]:jm,[k.SUBTITLE]:Wm,[k.TITLE]:tf,[k.SELECTOR]:sf,[k.VIZ]:u1,[k.GENERATOR]:ku,[k.SECTION_FLAG]:ku,[k.IMAGE]:lf,[k.NAV]:kf,[k.RELATED]:Rf,[k.RESET_BUTTON]:If,[k.COMPARISON_BUTTON]:Af,[k.TABLE]:Of,[k.BUTTON]:Lf,[k.MULTIHIERARCHY_SELECTOR]:ff,[k.FALLBACK]:Mf};});var oC=M(()=>{p();ye();tC();Bl();ho();Se();ya();li();Ys();kd();wd();Mn();});var Vi,p1,Vu,Dl=M(()=>{p();Vi={margin:{label:"Content Margin",defaultValue:"md",options:[{label:"None",value:"0px"},{label:"Small",value:"sm"},{label:"Medium",value:"md"},{label:"Large",value:"lg"}]},columnGutter:{label:"Column Gutter",defaultValue:"md",options:[{label:"None",value:"0px"},{label:"Small",value:"sm"},{label:"Medium",value:"md"},{label:"Large",value:"lg"}]},width:{label:"Width",defaultValue:"full",options:[{label:"Full Width",value:"full"},{label:"Center",value:"center"}]},position:{label:"Position",defaultValue:"normal",options:[{label:"Normal",value:"normal"},{label:"Sticky",value:"sticky"}]},style:{label:"Style",defaultValue:"none",options:[{label:"None",value:"none"},{label:"Card",value:"card"}]}},p1=Object.keys(Vi).reduce((e,t)=>(e[t]=Vi[t].defaultValue,e),{}),{memberImageBg:!1,optionsMenu:!1,optionData:!0,optionImage:!0,optionShare:!0,showAnchor:!1,...p1},Vu=e=>({data:typeof e.optionData=="boolean"?e.optionData:!0,image:typeof e.optionImage=="boolean"?e.optionImage:!0,share:typeof e.optionShare=="boolean"?e.optionShare:!0});});function Nf({previews:e}){let t=e.map((o,r)=>({key:o?`bg-${o.content_id}`:`bg-${r}`,src:o?`/api/cms/member/image?member=${o.content_id}&size=splash`:""}));return jsxs(Fragment,{children:[jsx(Group,{className:"cms-section-bg",grow:!0,spacing:0,style:{position:"absolute",width:"100%",height:"100%"},children:t.map(o=>jsx("div",{className:"cms-section-member-bg",style:{backgroundImage:`url(${o.src})`,backgroundSize:"cover",backgroundPosition:"center center",height:"100%",width:"100%"}},o.key))}),jsx("div",{className:"cms-section-gradient-bg",style:{background:"white",position:"absolute",width:"100%",height:"100%",opacity:.33}})]})}var Ff=M(()=>{p();});function $u({data:e}){let r=(e&&Array.isArray(e)&&e[0]?Object.keys(e[0]):[]).filter(n=>!n.startsWith("_")).map(n=>({accessorKey:n,header:n,enableSorting:!0,mantineTableBodyCellProps:{sx:{textWrap:"wrap"}}}));return jsx(MantineReactTable,{columns:r,data:e,enableBottomToolbar:!1,enableColumnActions:!1,enablePagination:!1,enableSorting:!0,enableTopToolbar:!1,initialState:{density:"xs"},layoutMode:"grid",mantineTableContainerProps:{sx:{minHeight:100,maxHeight:350}}})}var zf=M(()=>{p();});function lC(e){let{section:t}=e,o=Ar(),r=useRouter(),n=$(V=>V.status.isCMS),i=$(V=>V.status.currentLocale),a=r.locale,s=n?i:a,l=50,u=no(s),c=Yt("options"),d={...sC,...c.data_tab},[m,g]=useState([]),[f,h]=useState([]),[b,x]=useState(),[T,E]=useState(),[y,A]=useState(!1),[C,w]=useState({}),[B,L]=useState(!0),[D,P]=useState(!0),{sectionVariables:_,setSectionVariables:R,resetSectionVariables:O}=ot(t.id),I=t.blocks||[],N=$(V=>V),U=useMemo(()=>I.reduce((V,q)=>{let le=N.records.entities.block[q],W=N.variables.variables[q],te=N.variables.status[q];return (k.GENERATOR===le.type&&W._downloadEnabled===!0&&te.allowed||k.VIZ===le.type&&te.allowed)&&(V[q]={entity:le,variables:N.variables.variables[q],status:N.variables.status[q],inputVariablesFlat:le.inputs.reduce((ne,pe)=>({...ne,...N.variables.variables[pe]}),N.variables.attributes)}),V},{}),[I]),G=V=>{h(q=>q.includes(V)?q:[...q,V]);},Z=V=>{g(q=>(q.find(W=>W.ix===V.ix)?q:[...q,V]).sort((W,te)=>W.ix>te.ix?1:-1));};function H(V){!b&&V[0]&&ee(V[0]);}function ee(V){x(V),E("0");}useEffect(()=>{let V=async(q,le,W)=>{let te=dataLoad.bind({});return new Promise((ne,pe)=>{te(le,null,null,(ve,K)=>{if(ve)pe(ve);else {let re=W instanceof Function?W(K):K;q.data.unshift(re),Z(q),ne(K);}});})};if(m.length===0&&f.length===0){let q=0;for(let le of Object.values(U)){let W=le.entity;if([k.GENERATOR,k.SECTION_FLAG].includes(W.type)){let te=le.variables._downloadData||le.variables._downloadUrl||le.status.api;if(te){let ne=[];typeof te=="string"?ne=te.split(Kr):ne=[te];let pe=le.variables._downloadTitle||`${d.data_source} ${q+1}`,ve=le.variables._downloadFileName||pe;Z({ix:q,id:W.id,title:jt(pe),fileName:ve,data:Array.isArray(ne)?ne:[ne],loading:!1,type:k.GENERATOR}),G(q),q++;}}else if(W.type===k.VIZ){let te=ro(W),ne=le.inputVariablesFlat,pe={variables:ne},ve=er({logic:te.logic},u,pe).logic,K={router:r,section:{variables:_,setVariables:R,resetVariables:O}},re=zi(ve,u,ne,s,W.id,{},K),fe=re.config._downloadTitle||re.config.title||`${d.viz_source} ${q+1}`,De=re.config._downloadFileName||fe;if(re.config._downloadEnabled!==!1)try{let Oe=re.config._downloadUrl||re.config.data,We=typeof Oe=="string"?[Oe]:Oe,Tt=re.dataFormat instanceof Function?re.dataFormat:!1,Bt=re.config._downloadDataFormat instanceof Function?re.config._downloadDataFormat:!1;V({ix:q,id:W.id,title:jt(fe),fileName:De,data:We,loading:!1,type:k.VIZ},Oe,Bt||Tt),G(q),q++;}catch(Oe){console.error("DataLoad catch",Oe);}}}P(!1);}},[U]),useEffect(()=>{m.length===f.length&&H(m);},[m]),useEffect(()=>{if(b&&T){let V=parseInt(T,10);if(b.data[V]&&(!C[b.ix]||!C[b.ix][T])){L(!0);let q=b.data[T];typeof q=="string"?Ad(q,o,s).then(le=>{let W=F1(le);w({...C,[b.ix]:{...C[b.ix],[V]:W}});}).catch(le=>{console.error(le);}).finally(()=>{L(!1);}):(w({...C,[b.ix]:{...C[b.ix],[V]:q}}),L(!1));}}},[T,b]);let ie=(V,q)=>{let le=V===q?"":`-${V}`.toLowerCase();if(b){let W=b.data.length>1&&T?`-${parseInt(T,10)+1}`:"";return `${lo(b.fileName)}${le}${W}.${q.toLowerCase()}`}return `${le}.${q}`},z=async V=>{if(b){A(!0);let q=new k1,le=ie(V,V);try{switch(V){case Gu.json.extension:q.file(le,JSON.stringify(j));break;case Gu.csv.extension:q.file(le,csvFormat(j));break;case Gu.xlsx.extension:let{utils:W,write:te}=await import('xlsx'),ne=W.book_new();W.book_append_sheet(ne,W.json_to_sheet(j),le.substring(0,30));let pe=te(ne,{bookType:"xlsx",bookSST:!0,type:"binary"});q.file(le,pe,{binary:!0});break;default:break}q.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:9}}).then(W=>{A(!1),saveAs(W,ie(V,"zip"));});}catch(W){console.error(d.error_generating,W),A(!1);}}},j=useMemo(()=>b&&C[b.ix]&&C[b.ix][T]?C[b.ix][T]:[],[C,b,T]),J=useMemo(()=>m&&m.length>0&&m.length===f.length&&m.map((V,q)=>jsx(Button,{leftIcon:jsx(IconDatabase,{size:16}),onClick:()=>ee(V),variant:b?.ix===q?"filled":"default",loading:V.loading,disabled:V.loading,children:V.title},`source-${V.id}-${q}`)),[m,b,f]);return jsxs(Stack,{className:"cms-section-options-data",children:[jsx(Space,{h:"xs"}),jsx(LoadingOverlay,{visible:D,overlayBlur:2}),m.length===0&&!D&&jsxs(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:[d.no_data_src," awa"]}),m.length>1&&m.length===f.length&&!D&&jsx(Input.Wrapper,{label:`${d.choose_data_src}:`,children:jsx(Group,{spacing:"xs",children:J})}),b&&T&&jsx(Stack,{spacing:"xs",children:jsx(Input.Wrapper,{label:`${d.preview}
|
|
106
106
|
${j.length>l?d.rows_preview.replace("{nrows}",l):""}:`,children:jsxs(Group,{spacing:"xs",children:[jsx(Select,{disabled:!(b.data.length>1),style:{flex:"1"},value:T,onChange:V=>E(V),data:b.data.map((V,q)=>({value:`${q}`,group:typeof V=="string"?d.raw_group:d.formatted_group,label:typeof V=="string"?V:d.formatted_src.replace("{src}",b.title)})),icon:typeof b.data[T]=="string"?jsx(IconLink,{}):jsx(IconSparkles,{})}),jsx(CopyButton,{value:typeof b.data[T]=="string"?b.data[T]:"",timeout:2e3,children:({copied:V,copy:q})=>jsx(Tooltip,{label:V?d.copied:d.copy,withArrow:!0,position:"top",children:jsx(ActionIcon,{variant:V?"filled":"subtle",onClick:q,disabled:typeof b.data[T]!="string",children:V?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})]})})}),b&&!B&&j.length===0&&jsx(Alert,{icon:jsx(IconAlertCircle,{size:"1rem"}),title:"Oops!",children:d.error_preview}),b&&T&&!B&&j.length===0&&jsx("a",{href:b.data[T],target:"_blank",rel:"noreferrer",children:jsx(Button,{leftIcon:jsx(IconExternalLink,{size:16}),fullWidth:!0,children:d.open_in_window.replace("{src}",b.title)})}),jsxs(Stack,{pos:"relative",mih:"430px",children:[jsx(LoadingOverlay,{visible:B&&m.length>0,overlayBlur:2}),b&&!B&&j.length>0&&jsxs(Fragment,{children:[jsx(Box,{h:"350px",children:jsx($u,{data:j.slice(0,l)})}),jsx(Input.Wrapper,{label:`${d.download}:`,children:jsx(Button.Group,{children:Object.values(Gu).map(V=>jsx(Button,{leftIcon:jsx(V.icon,{size:24}),onClick:()=>z(V.extension),loading:y,fullWidth:!0,children:V.extension},`format-${V.extension}`))})})]})]})]})}var Gu,sC,F1,Hf=M(()=>{p();ce();zf();ye();Ol();An();ll();ho();Se();ci();Yr();Bi();qr();wr();Gu={csv:{extension:"CSV",icon:IconFileTypeCsv},json:{extension:"JSON",icon:IconFileTypeJs},xlsx:{extension:"XLSX",icon:IconFileTypeXls}},sC={data_source:"Data Source",no_data_src:"No data sources defined",viz_source:"Visualization Source",error_generating:"Error generating file.",choose_data_src:"Choose data source",original_src:"Original {src}",loading:"Loading...",error_preview:`Sorry. We could not generate the data preview as a table.
|
|
107
107
|
Try to open the source and check the data directly.`,open_in_window:"Open {src} response in a new window",formatted_src:"Formatted {src}",formatted_group:"Formatted Data",raw_group:"Raw Data",rows_preview:"(First {nrows} rows as preview)",choose_format:"Choose format",processing_file:"Processing file...",download:"Download data as",preview:"Preview",copy:"Click to copy",copied:"Copied!"},F1=e=>{let t=[];return e&&e.data&&(e.data&&Array.isArray(e.data)?t=e.data:e.data&&e.data.data&&Array.isArray(e.data.data)?t=e.data.data:e.data&&e.data.data&&e.data.data.results&&Array.isArray(e.data.data.results)?t=e.data.data.results:e.data&&e.data.results&&Array.isArray(e.data.results)&&(t=e.data.results)),t};});function dC(e){let{section:t}=e,o=t.blocks||[],r=$(W=>o.map(te=>W.records.entities.block[te]).filter(te=>te.type===k.VIZ&&W.variables.status[te.id].allowed)),{variant_slug1:n,slug1:i}=$(W=>W.variables.attributes),a=wT(),[s,l]=useState(ur.section),[u,c]=useState(pr.png),[d,m]=useState(!1),[g,f]=useState(!1),[h,b]=useState([]),[x,T]=useState(r.length>0?r[0].id:null),E=s!==ur.section,{print:y,downloadLoading:A,error:C}=ET(t.id,n,i,E?x:null),[w,B]=useState(!0),[L,D]=useState(!1),P=Yt("options"),_={...nF,...P.image_tab},{siteProps:R}=Ba(),O=R?.logoSrc&&typeof R.logoSrc=="string",I=t?.settings?.name||`section-${t.id}`,N=`#${I}`,U=useMantineTheme(),G=()=>{let W=ee(x);return select(W).select("svg").size()===1},Z=()=>`${lo(I)}`,H=()=>{let W=document.getElementById(I);return select(W).select(".bespoke-section-content").node()},ee=W=>{let te=H();return select(te).select(`#bespoke-visualization-${W}.bespoke-block-area`).node()},ie=()=>new Promise(W=>{let te;s===ur.section?te=H():s===ur.viz&&(te=ee(x));let ne=document.createElement("div");ne.style.display="flex",ne.style.justifyContent="space-between",ne.classList.add("bespoke-Viz-source"),ne.style.padding=U.spacing.xs,ne.style.width="100%";let pe=document.createElement("div");if(pe.innerText=_.source.replace("{src}",`${window.location}${N}`),pe.style.fontSize=U.fontSizes.xs,ne.appendChild(pe),O){let ve=document.createElement("img");ve.src=R.logoSrc,ve.style.height="30px",ve.onload=()=>W(te),ve.onerror=()=>{ve.remove(),W(te);},ne.appendChild(ve),te.appendChild(ne);}else te.appendChild(ne),W(te);}),z=W=>{if(w)return "transparent";let te=select(W).style("background-color");return te!=="rgba(0, 0, 0, 0)"&&te!=="transparent"?te:W===document.body?"white":z(W.parentNode)},j=async(W,te)=>{let{toPng:ne}=await import('html-to-image');ne(W,{backgroundColor:te.background,cacheBust:!0,filter:pe=>pe&&pe.classList?!te.exclusionClasses.some(ve=>pe.classList.contains(ve)):!0}).then(pe=>{let ve=document.createElement("a");ve.download=`${te.filename}.png`,ve.href=pe,ve.click(),rF(),m(!1);}).catch(pe=>{console.log(pe);});},J=(W,te)=>{saveElement(W,{filename:te.filename,type:"svg",callback:()=>m(!1)},{background:te.background});},V=async()=>{m(!0);let W=await ie(),te={background:z(W),exclusionClasses:["export-hidden"],filename:Z()},ne=u===pr.png?j:J;try{if(W)ne(W,te);else throw new Error(_.wrong_node)}catch{m(!1);}},q=async()=>{let{toCanvas:W}=await import('html-to-image');Promise.all(r.map(te=>{let ne=ee(te.id),pe=ne.querySelector("g.d3plus-geomap-tileGroup");return pe.style.display="none",W(ne).then(ve=>(pe.style.display="block",ve))})).then(te=>{b(te.map(ne=>ne.toDataURL())),D(!1);});};useEffect(()=>{s===ur.viz&&r.length>0?(T(r[0].id),D(!0),q()):s===ur.section&&b([]);},[s]),useEffect(()=>{x&&(G()?f(!0):(f(!1),c(pr.png)));},[x]);useRouter();return jsxs(Stack,{className:"cms-section-options-image",children:[jsx(Space,{h:"xs"}),r.length>0?jsx(Input.Wrapper,{label:`${_.choose_area}:`,children:jsx(SegmentedControl,{fullWidth:!0,value:s,data:[{value:ur.section,label:jsxs(Center,{children:[jsx(IconTemplate,{size:"1rem"}),jsx(Box,{ml:10,children:_.entire_section})]})},{value:ur.viz,label:jsxs(Center,{children:[jsx(IconChartBar,{size:"1rem"}),jsx(Box,{ml:10,children:_.viz_only})]})}],onChange:W=>{l(W),W===ur.section&&c(pr.png);}})}):jsx(Text,{fw:"700",color:"gray.7",children:`${_.entire_section}:`}),s===ur.viz&&r.length>0&&jsxs(Input.Wrapper,{label:`${_.choose_viz}:`,style:{minHeight:"161px",position:"relative"},children:[!L&&h.length>0&&jsx(ScrollArea,{style:{height:250},children:jsx(SimpleGrid,{cols:3,children:r.map((W,te)=>jsx(Image,{alt:`Viz ${W.id}`,onClick:()=>{T(W.id);},style:{cursor:"pointer",border:x===W.id?"4px solid #228be6":"4px solid #eee"},radius:0,src:h[te],withPlaceholder:!0},`viz-option-${W.id}`))})}),jsx(LoadingOverlay,{visible:L})]}),g&&s!==ur.section&&jsx(Input.Wrapper,{label:`${_.choose_format}:`,children:jsxs(Button.Group,{children:[jsx(Button,{leftIcon:jsx(IconPolaroid,{size:16}),onClick:()=>c(pr.png),variant:u===pr.png?"filled":"default",fullWidth:!0,children:pr.png}),jsx(Button,{leftIcon:jsx(IconCode,{size:16}),onClick:()=>c(pr.svg),variant:u===pr.svg?"filled":"default",fullWidth:!0,children:pr.svg})]})}),jsx(Checkbox,{checked:w,label:`${_.transparent_bg}`,onChange:()=>B(!w),radius:"xl"}),jsx(Button,{leftIcon:jsx(IconDownload,{size:16}),loading:d||A,onClick:a&&u!==pr.svg?()=>y(w):V,fullWidth:!0,children:jsx("span",{children:d||A?_.processing:_.download.replace("{imageFormat}",u)})})]})}var ur,pr,rF,nF,mC=M(()=>{p();An();ce();wr();Et();Nu();ye();ur={viz:"viz",section:"section"},pr={png:"PNG",svg:"SVG"},rF=()=>{let e=document.getElementsByClassName("bespoke-Viz-source");Array.from(e).forEach(t=>t.remove());},nF={wrong_node:"Wrong node in export",choose_area:"Choose image area",choose_viz:"Choose visualization",choose_format:"Choose format",transparent_bg:"Transparent background",processing:"Processing image...",download:"Download {imageFormat}",entire_section:"Entire section",viz_only:"Visualization only",source:"Source: {src}"};});function gC(e){let{title:t,url:o,disabled:r=!1}=e,n=r?IconCode:IconLink;return jsx(Input.Wrapper,{label:t,children:jsx(Input,{icon:jsx(n,{}),value:o,disabled:r,readOnly:!0,rightSection:jsx(CopyButton,{value:o,timeout:2e3,children:({copied:i,copy:a})=>jsx(Tooltip,{label:i?"Copied":"Copy",withArrow:!0,position:"right",children:jsx(ActionIcon,{variant:i?"filled":"subtle",onClick:a,disabled:r,children:i?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})})})}var hC=M(()=>{p();});function yC(e){let{section:t}=e,[o,r]=useState(""),[n,i]=useState(""),[a,s]=useState(!0),l=Yt("options"),u={...OF,...l.share_tab};return useEffect(()=>{i(document.title);let{origin:c,pathname:d}=window.location,m=`${c}${d}`,g=a?t.settings?.name?.length?`#${lo(t.settings.name)}`:`#section-${t.id}`:"";r(`${m}${g}`);},[a]),jsxs(Stack,{className:"cms-section-options-share",children:[jsx(Space,{h:"xs"}),jsx(gC,{title:`${u.title}: ${n}`,url:o}),jsx(Checkbox,{checked:a,label:u.include_section,onChange:()=>s(!a),radius:"xl"}),jsxs(Group,{position:"center",children:[jsx(FacebookShareButton,{url:o,quote:n,children:jsx(FacebookIcon,{size:32,round:!0})}),jsx(TwitterShareButton,{url:o,title:n,children:jsx(TwitterIcon,{size:32,round:!0})}),jsx(TelegramShareButton,{url:o,title:n,children:jsx(TelegramIcon,{size:32,round:!0})}),jsx(WhatsappShareButton,{url:o,title:n,separator:":: ",children:jsx(WhatsappIcon,{size:32,round:!0})}),jsx(LinkedinShareButton,{url:o,children:jsx(LinkedinIcon,{size:32,round:!0})}),jsx(RedditShareButton,{url:o,title:n,windowWidth:660,windowHeight:460,children:jsx(RedditIcon,{size:32,round:!0})}),jsx(EmailShareButton,{url:o,subject:n,children:jsx(EmailIcon,{size:32,round:!0})})]})]})}var OF,vC=M(()=>{p();hC();wr();An();OF={title:"Title",include_section:"Include Section"};});function TC(e){let{section:t,initialMode:o,onEnds:r,open:n,title:i}=e,a=Vu(t.settings),s=useMemo(()=>DF.filter(g=>a[g]),[a]),[l,u]=useState(o||s[0]||"data"),c=Yt("options");useEffect(()=>{o!==l&&u(o);},[o]);let d={...Kf,...c},m=useMemo(()=>jsxs(Fragment,{children:[jsxs(Tabs.List,{children:[a.data&&jsx(Tabs.Tab,{value:"data",children:d.download_title}),a.image&&jsx(Tabs.Tab,{value:"image",children:d.image_title}),a.share&&jsx(Tabs.Tab,{value:"share",children:d.share_title})]}),a.data&&jsx(Tabs.Panel,{value:"data",children:jsx(lC,{section:t})}),a.image&&jsx(Tabs.Panel,{value:"image",children:jsx(dC,{section:t})}),a.share&&jsx(Tabs.Panel,{value:"share",children:jsx(yC,{section:t})})]}),[a,t,d]);return jsx("div",{className:"cms-section-options-modal",children:n&&jsx(Modal,{className:"bespoke-options-modal",opened:!0,onClose:()=>r(),size:"xl",title:i,children:jsx(Tabs,{onTabChange:u,value:l,keepMounted:!1,children:m})})})}var Kf,DF,CC=M(()=>{p();Hf();mC();vC();wr();Dl();Kf={download_title:"Download Data",image_title:"Save Image",share_title:"Share Link"},DF=["data","image","share"];});function qf(e){let{sectionId:t,disabled:o=!1}=e,[r,n]=useState(!1),[i,a]=useState("data"),s=ir(t),l=Yt("options"),u={...Kf,...l},c=Vu(s.isSuccess?s.data.settings:{}),d=g=>{a(g),n(!0);},m=()=>{n(!1);};return jsxs("div",{className:"cms-section-options",children:[jsxs(Button.Group,{children:[c.data&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>d("data"),"aria-label":u.download_title,disabled:o,children:jsx(IconTable,{size:16})}),c.image&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>d("image"),"aria-label":u.image_title,disabled:o,children:jsx(IconCamera,{size:16})}),c.share&&jsx(Button,{variant:"default",size:"xs",compact:!0,onClick:()=>d("share"),"aria-label":u.share_title,disabled:o,children:jsx(IconShare,{size:16})})]}),s.isSuccess&&jsx(TC,{section:s.data,initialMode:i,open:r,onEnds:m})]})}var Yf=M(()=>{p();CC();ce();wr();Dl();});function jF({children:e,containerProps:t},o){return jsx(Flex,{ref:o,className:"bespoke-section-content",pos:"relative",align:"stretch",p:0,direction:{base:"column",md:"row"},wrap:"wrap",...t,children:e})}var Xf,IC,Jf,Qf=M(()=>{p();ce();_i();Xf=on__default.forwardRef(function({children:t,column:o,basis:r,columnSettings:n={},sx:i={},...a},s){let l=Object.values(o).some(m=>m.settings?.display==="inline"),u=n?.width?`${n.width}px`:r,c=n?.width?`${n?.width}px`:"100%",d=n?.full?"100%":c;return jsx(Flex,{ref:s,className:"bespoke-section-col",align:"flex-start",direction:l?"row":"column",wrap:l?"wrap":"nowrap",maw:{base:"100%",md:d},miw:{base:"none",md:300},p:0,pos:"relative",sx:[{flexGrow:1,flexShrink:n?.full?0:1,flexBasis:n?.full?"100%":u},...packSx(i)],...a,children:t})}),IC=({sectionId:e,columnIndex:t})=>{let o=se(),r=ir(e).data,{settings:n,updateSettings:i}=rn(e);if(!r)return null;let{columnSettings:a={}}=n,{width:s=void 0}=a[t]?a[t]:{},l=d=>{r&&i("columnSettings",{...a,[t]:{width:parseInt(d.target.value,10)}});},u=()=>{r&&o(Q.updateEntity("section",{id:e,settings:{...r.settings,columnSettings:{...a,[t]:{width:void 0}}}}));};return jsxs(Group,{className:"bespoke-resize-col",pos:"absolute",top:-12,left:"50%",sx:{borderRadius:"4px",transform:"translate(-50%, 0%)",zIndex:20},py:0,px:"xs",maw:180,bg:"white",noWrap:!0,children:[jsx(Checkbox,{label:"100%",size:"xs",onChange:d=>{i("columnSettings",{...a,[t]:{...a[t]||{},full:d.currentTarget.checked}});},checked:a[t]?.full}),jsx(Input,{placeholder:"auto",w:"fit-content",miw:"none",variant:"filled",type:"number",value:s||"auto",maw:110,onChange:l,size:"xs",p:0,rightSection:jsx(IconX,{onClick:u,size:8})})]})},Jf=on__default.forwardRef(jF);});var Un,Ku=M(()=>{p();Un={backgroundColor:"#fafafa",block:{padding:10},column:{padding:12},section:{backgroundColor:"white",borderRadius:10,boxShadow:"0px 6px 10px rgba(12, 32, 50, 0.14), 0px 1px 15px rgba(12, 32, 50, 0.12), 0px 3px 5px rgba(12, 32, 50, 0.15)",margin:8,padding:32}};});var AC=M(()=>{p();Bn();});var PC=M(()=>{p();});var OC=M(()=>{p();ce();Jr();oC();Dl();Qo();Ff();Yf();Li();ye();Qf();yl();Ku();Bn();wr();AC();Mn();An();Et();PC();});var LC=M(()=>{p();Te();ae({name:"abbreviate",description:"Abbreviates a number into a smaller more human-readable number.",logicFactory(e){return t=>e.d3plus.formatAbbreviate(t)},inputType:"number",testValue:"123456",type:"formatter"});});var MC=M(()=>{p();Te();ae({name:"abs",description:"Simple Absolute Value.",logicFactory(e){return t=>Math.abs(t)},inputType:"number",testValue:"-123",type:"formatter"});});var YF,BC=M(()=>{p();Te();YF=()=>function(t){let r=new RegExp(/([\$0-9\,]+)[A-z\-\s\&]*([\$0-9\,]*)/g).exec(t);return r?(r=r.slice(1).filter(n=>n.length).map(n=>(n.includes(",")&&(n.indexOf(",")===n.length-4?n=n.replace(/,000$/g,"k").replace(/([0-9]+)(,999$)/g,i=>`${parseInt(i)+1}k`):n.indexOf(",")===n.length-8&&(n=n.replace(/,000,000$/g,"M").replace(/([0-9]+)(,999,999$)/g,i=>`${parseInt(i)+1}M`))),n)),r.length===2?r.join(" - "):t.toLowerCase().match(/under|less|\</g)?`< ${r[0]}`:t.toLowerCase().match(/over|more|\+|\>/g)?`${r[0]}+`:`${r[0]}`):"None"},ae({name:"bucket",description:"Sanitizes bucket strings to '< n', 'n1 - n2', and 'n+'",logicFactory:YF,inputType:"number",testValue:"1234",type:"formatter"});});var DC=M(()=>{p();Te();ae({name:"commas",description:"* Rounds to nearest whole number and adds commas.",logicFactory(e){return t=>e.d3.format(",")(Math.round(t))},inputType:"number",testValue:"1234.6",type:"formatter"});});var _C=M(()=>{p();Te();ae({name:"date",description:"Formats a date into '%B %d, %Y' format.",logicFactory(e){return t=>(typeof t=="string"&&(t=e.d3plus.date(t)),e.d3.timeFormat("%B %d, %Y")(t))},inputType:"date",testValue:"2022-01-01",type:"formatter"});});var NC=M(()=>{p();Te();ae({name:"dollar",description:"Adds a US dollar sign to the beginning of a String or Number.",logicFactory(e){return t=>(typeof t=="number"&&(t=e.d3plus.formatAbbreviate(t)),t.charAt(0)==="-"?t.replace("-","-$"):`$${t}`)},inputType:"number",testValue:"123",type:"formatter"});});var FC=M(()=>{p();Te();ae({name:"formatFieldName",description:"Based on field name returns a string",logicFactory(e){return t=>{if(t.contentType.toLowerCase()==="stat"){if(t.field==="title")return "Stat label";if(t.field==="value")return "Stat value";if(t.field==="subtitle")return "Stat subtitle";if(t.field==="tooltip")return "Tooltip text"}return t.contentType.toLowerCase()==="section"&&t.field==="short"?"Short title":t.contentType.toLowerCase()==="description"&&t.field==="description"?"Paragraph":t.field}},inputType:"object",testValue:'{"field":"title","contentType":"stat"}',type:"formatter"});});var zC=M(()=>{p();Te();ae({name:"grewTo",description:"Returns the text with grow direction: 'declined from', 'grew to' o 'stayed at'",logicFactory(e){return t=>t<0?"declined from":t>0?"grew to":"stayed at"},inputType:"number",testValue:"-1234",type:"formatter"});});var VC=M(()=>{p();Te();ae({name:"grewWord",description:"Returns either 'grew', 'declined', or 'stayed' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"declined":t>0?"grew":"stayed"},inputType:"number",testValue:"-1234",type:"formatter"});});var $C=M(()=>{p();Te();ae({name:"growing",description:"Returns either 'declining', 'growing' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"declining":"growing"},inputType:"number",testValue:"-1234",type:"formatter"});});var nz,UC=M(()=>{p();Te();nz=()=>function(t){let{curr:o,currMoe:r=0,prev:n,prevMoe:i=0}=t,a;if(r||i){let s=(-n/o**2)**2*r**2,l=(1/o)**2*i**2;a=Math.sqrt(s+l);}else a=(o-n)/n;return a*100},ae({name:"growth",description:"Calculates the growth percentage between two numbers provided the following object format: {curr, prev}. Also supports calculating the growth between two margin of errors using this format: {curr, currMoe, prev, prevMoe}",logicFactory:nz,inputType:"object",testValue:'{"curr":10,"currMoe":0,"prev":13,"prevMoe":0}',type:"formatter"});});var GC=M(()=>{p();Te();ae({name:"growthPct",description:"Abbreviates a growth value, turns it absolute, and adds a percent sign.",logicFactory(e){return t=>`${e.d3plus.formatAbbreviate(Math.abs(t))}%`},inputType:"number",testValue:"12345",type:"formatter"});});var HC=M(()=>{p();Te();ae({name:"growthWord",description:"Returns either 'growth' or 'decline' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decline":"growth"},inputType:"number",testValue:"-1234",type:"formatter"});});var jC=M(()=>{p();Te();ae({name:"highWord",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"lower than":t>0?"higher than":"approximately the same as"},inputType:"number",testValue:"0",type:"formatter"});});var WC=M(()=>{p();Te();ae({name:"increaseWord",description:"Returns either 'increase', 'decrease', or 'change' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decrease":t>0?"increase":"change"},inputType:"number",testValue:"1234",type:"formatter"});});var KC=M(()=>{p();Te();ae({name:"increasedWord",description:"Returns either 'increased', 'decreased', or 'remained the same' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decreased":t>0?"increased":"remained the same"},inputType:"number",testValue:"0",type:"formatter"});});var qC=M(()=>{p();Te();ae({name:"increasing",description:"Returns either 'decreasing', 'increasing' or 'maintaining' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"decreasing":t>0?"increasing":"maintaining"},inputType:"number",testValue:"-1234",type:"formatter"});});var YC=M(()=>{p();Te();ae({name:"largerThan",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign",logicFactory(e){return t=>t<0?"smaller than":t>0?"larger than":"the same as"},inputType:"number",testValue:"-1234",type:"formatter"});});var XC=M(()=>{p();Te();ae({name:"list",description:"Joins an array of strings together, adding commas and 'and' when necessary.",logicFactory(e){return t=>t.reduce((o,r,n)=>(n?n===t.length-1&&n===1?o+=` and ${r}`:n===t.length-1?o+=`, and ${r}`:o+=`, ${r}`:o+=r,o),"")},inputType:"object",testValue:'["foo","bar","bee"]',type:"formatter"});});var JC=M(()=>{p();Te();ae({name:"longWord",description:"",logicFactory(e){return t=>t<0?"shorter":t>0?"longer":"similar"},inputType:"number",testValue:"5",type:"formatter"});});var QC=M(()=>{p();Te();ae({name:"lowerCaseFirst",description:"Converts the first letter of a string to lowercase",logicFactory(e){return t=>typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t},inputType:"string",testValue:"foo",type:"formatter"});});var ZC=M(()=>{p();Te();ae({name:"moreFewerWord",description:"",logicFactory(e){return t=>t<0?"fewer":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var ek=M(()=>{p();Te();ae({name:"moreLess",description:"Returns either 'more' or 'less' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"less":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var tk=M(()=>{p();Te();ae({name:"moreLess",description:"Returns either 'more than', 'less than', or 'approximately the same' depending on the provided number's sign.",logicFactory(e){return t=>t<0?"less than":t>0?"more than":"approximately the same"},inputType:"number",testValue:"-5",type:"formatter"});});var ok=M(()=>{p();Te();ae({name:"olderWord",description:"",logicFactory(e){return t=>t<0?"getting younger":t>0?"getting older":"staying the same age"},inputType:"number",testValue:"-5",type:"formatter"});});var rk=M(()=>{p();Te();ae({name:"olderYounger",description:"",logicFactory(e){return t=>t<0?"younger than":t>0?"older than":"the same age as"},inputType:"number",testValue:"-5",type:"formatter"});});var nk=M(()=>{p();Te();ae({name:"plural",description:"Pluralizes a word.",logicFactory(e){return t=>t.replace(/\w$/g,o=>o==="y"?"ies":`${o}s`)},inputType:"string",testValue:"Foo",type:"formatter"});});var ik=M(()=>{p();Te();ae({name:"pxToInt",description:"Takes a pixel value and converts it to an integer",logicFactory(e){return t=>parseInt(t.replace(/\D+/g,""),10)},inputType:"string",testValue:"12px",type:"formatter"});});var ak=M(()=>{p();Te();ae({name:"salary",description:"Displays salary values with proper precision (ie. '$74,200' instead of '$74.2k')",logicFactory(e){return t=>{let o;return t<1e6?o=e.d3.format(",")(t.toFixed(0)):o=e.d3plus.formatAbbreviate(t),`$${o}`}},inputType:"number",testValue:"1000000",type:"formatter"});});var sk=M(()=>{p();Te();ae({name:"stripEntities",description:"Removes non breaking spaces & other html entities from a string",logicFactory(e){return t=>typeof t=="string"?String(t).replace(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/ig," "):t},inputType:"string",testValue:"<b>MyText</b>",type:"formatter"});});var ck=M(()=>{p();Te();ae({name:"stripHTML",description:"Converts html tags to spaces, then removes redundant spaces",logicFactory(e){return t=>{let o={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"," ":""},r=`(?:${Object.keys(o).join("|")})`,n=RegExp(r),i=RegExp(r,"g"),a=String(t).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return n.test(a)?a.replace(i,s=>o[s]):a}},inputType:"string",testValue:"<b>My text</b>",type:"formatter"});});var uk=M(()=>{p();Te();ae({name:"stripOL",description:"Removes ordered list wrapper tags from a string.",logicFactory(e){return t=>t.replace(/<ol>/g,"").replace(/<\/ol>/g,"")},inputType:"string",testValue:"<ol><li>My list</li></ol>",type:"formatter"});});var pk=M(()=>{p();Te();ae({name:"stripP",description:"Removes all paragraph tags from a string.",logicFactory(e){return t=>t.replace(/<p>/g,"").replace(/<\/p>/g,"")},inputType:"string",testValue:"<p>My p</p>",type:"formatter"});});var dk=M(()=>{p();Te();ae({name:"stripUL",description:"Removes unordered list wrapper tags from a string.",logicFactory(e){return t=>t.replace(/<ul>/g,"").replace(/<\/ul>/g,"")},inputType:"string",testValue:"<ul><li>My list</li></ul>",type:"formatter"});});var mk=M(()=>{p();Te();ae({name:"toKebabCase",description:"Takes a camelCase or PascalCase string and converts it to kebab-case.",logicFactory(e){return t=>typeof t=="string"?(t=t.charAt(0).toLowerCase()+t.substring(1),t.replace(/([A-Z])/g,"-$1").toLowerCase()):"invalid string passed to toKebabCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var fk=M(()=>{p();Te();ae({name:"toSpacedCase",description:"Takes a camelCase or PascalCase string and adds spaces (I know Spaced Case isn't a thing, deal with it).",logicFactory(e){return t=>typeof t=="string"?t.replace(/([A-Z])/g," $1").toLowerCase().trim():"invalid string passed to toSpacedCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var gk=M(()=>{p();Te();ae({name:"upperCaseFirst",description:"Converts the first letter of a string to uppercase",logicFactory(e){return t=>t.charAt(0).toUpperCase()+t.slice(1)},inputType:"string",testValue:"my name",type:"formatter"});});var hk=M(()=>{p();LC();MC();BC();DC();_C();NC();FC();zC();VC();$C();UC();GC();HC();jC();WC();KC();qC();YC();XC();JC();QC();ZC();ek();tk();ok();rk();nk();ik();ak();sk();ck();uk();pk();dk();mk();fk();gk();});var bk=M(()=>{"use client";p();wr();});var vk=M(()=>{p();});function zo(){let e=useContext(Mz);if(e===void 0)throw new Error("usePrint must be used within a PrintContext");return e}var Mz,Bn=M(()=>{p();ce();Qo();OC();Mn();hf();gf();Nu();Du();ye();ho();ci();Se();Ol();hk();wr();bk();vk();Hf();Mz=createContext({print:!1,isEmbed:!1});});function It(e){let{content:t,style:o={}}=e,{print:r}=zo(),n=jsx(Ce,{component:"span",html:t,isPreview:!0}),i=useMemo(()=>r?jsx("div",{className:"bespoke-inner-tooltip-notification",children:jsx(Notification,{icon:jsx(IconInfoCircle,{size:"1.1rem"}),withCloseButton:!1,withBorder:!0,styles:{root:{boxShadow:"none"}},children:n})},"tooltip-notification"):jsx("div",{className:"bespoke-inner-tooltip",style:o,children:jsx(Tooltip,{label:n,withArrow:!0,withinPortal:!0,multiline:!0,maw:220,children:jsx(ActionIcon,{size:"1.5rem",children:jsx(IconInfoCircle,{})})})},"tooltip"),[r,t,o]);return jsx(Fragment,{children:i})}var tn=M(()=>{p();Bn();bt();});function eg({paragraph:e,tooltip:t,settings:o}){return jsx(Ce,{component:"p",html:e||`Lorem ipsum dolor sit amet,
|
|
108
108
|
consectetur adipiscing elit. Etiam justo purus, placerat ac turpis at,
|