@datawheel/bespoke 1.0.0-rc.8 → 1.0.0-rc.9

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 CHANGED
@@ -38,7 +38,7 @@ return {
38
38
  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!"},Iz=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};});var Oz,_u=N(()=>{u();le();Nr();pr();lt();Oz={active:false,pdfParam:false,position:"DEFAULT",XlsxVizActive:false,pdfVariants:[],xlsxVariants:[],currentVariantPdfEnabled:false,currentVariantXlsxEnabled:false,isLoading:false,pdfAccessAllowed:false,xlsxAccessAllowed:false,sectionSelection:false,navBlockId:void 0},createContext(Oz);});var uC=N(()=>{u();le();he();Ko();qi();Te();wc();tC();Ur();Cg();_u();Ln();Wo();});var dC=N(()=>{u();});var mC=N(()=>{u();Mt();le();Cn();ni();Nr();lt();});function zu(e,t,o,r,n=false){let i=useRouter(),{query:s,locale:l}=i,a=re(),p=$r(),c=V(M=>r&&p.variables?p?.variables?.attributes:M.variables.attributes),d=V(ps),m=V(va),f=V(Sa),g=useMemo(()=>ri(m,l),[m,l]),h=ot(e,r&&p.active?p?.variables.variables:void 0,r&&p.active?p?.variables.attributes:void 0),v=V(M=>r?p.variables.variables:M.variables.variables),y=V(M=>r?p.variables.status:M.variables.status),S=_r(),{sectionVariables:C,resetSectionVariables:b}=dt(t),{addRunConsumersRunning:w,removeRunConsumersRunning:k}=lc(),R=r&&p.active?`${o}-valueCompare`:`${o}-value`,L=r&&p.active?`${o}-typeCompare`:`${o}-type`,I=r&&p.active?Object.fromEntries(Object.entries(s).filter(([M])=>M.match(Dz)).map(([M,D])=>[M.replace("Compare",""),D])):Object.fromEntries(Object.entries(s).filter(([M])=>M.match(Nz)).map(([M,D])=>[M.replace("Compare",""),D]));return useCallback((M,D)=>{let P={locale:l,query:{...I,[`${o}-type`]:D,[`${o}-value`]:M},variables:h},O=new URLSearchParams(window.location.search);M&&D?(O.set(R,M.join(",")),O.set(L,D)):(O.delete(R),O.delete(L)),window.history.replaceState(null,null,`?${O.toString()}`),w([t]),ci(d,void 0,e,g,P,{variables:v,status:y},S,"report",f).then(B=>{n&&C&&b(),p.active&&r?p.setComparisonVariables({attributes:c,variables:B.variables,status:B.status}):a(Ji.setVariableChange({attributes:c,variables:B.variables,status:B.status})),k([t]);});},[r,c,e,d,p,a,g,y,v,l,I,S,o,L,R,h,C,n,b])}var Dz,Nz,fC=N(()=>{u();hi();lt();Cn();le();Te();ni();Nr();ua();Dz=/\w*Compare\b/,Nz=/multihierarchySelector\d+(id|-(type|value))/;});var gC,hC=N(()=>{u();gC=createContext({});});function fr(e){let t=useContext(gC);if(t==null)throw new Error("useBespokeStyles must be used within a BespokeStylesProvider");return e?t[e]:t}var bC=N(()=>{u();hC();});var yC=N(()=>{u();});var $z,Uz,yi,Ec=N(()=>{u();$z={try_another:"Try another search or filter.",search:"Search",filters_all:"All",no_results:"No Results",load_more:"Load more",select_report:"Select Report",select_variant:"Select Variant",count_format:".2s",report:{},dimension:{},variant:{}},Uz=createContext({metadata:[],loadingItems:false,setLoadingItems:()=>null,loadingMetadata:false,setLoadingMetadata:()=>null,resultCount:{},totalCount:{},setResultCount:()=>null,activePage:1,setActivePage:()=>null,pageSize:10,results:[],filters:{},doQuery:()=>null,setFilters:()=>null,query:"",setQuery:()=>null,debouncedQuery:"",currentPageTotal:10,selectorStructure:[],translations:$z,setTranslations:()=>null,showSelectors:true}),yi=()=>useContext(Uz);});function Hz({translations:e}){let{loadingItems:t,setFilters:o,selectorStructure:r,filters:n,showSelectors:i}=yi(),s=g=>{let h=g===null||Number.isNaN(g)?void 0:parseInt(g,10);h!==n.profile?o({profile:h,variant:void 0}):h&&o({profile:void 0,variant:void 0});},l=g=>{let h=g===null?void 0:typeof g=="string"&&g.includes(",")?g:parseInt(g,10);h!==n.variant?o({...n,variant:h}):h&&o({...n,variant:void 0});},a=g=>g<1e3?g:format$1(e.count_format)(g).replace(/\.0+([a-zA-Z]*)$/,"$1"),p=r.length===2?r[1].id:n.profile,c=p?r.find(g=>g.id===p):void 0,d=c&&c.variants&&n.variant?c.variants.find(g=>g.id===n.variant):void 0,m=useMemo(()=>r.map(g=>({value:String(g.id||""),label:(e?.dimensionIcon?.[g.name]?`${e?.dimensionIcon?.[g.name]} `:"")+(e?.dimension[g.name]||g.name)+(!t&&(!c||g.id===c?.id)?` (${a(g.members_count)})`:"")})),[e,c,r]),f=useMemo(()=>c?.variants?.map(g=>({value:String(g.id||""),label:(e?.variantIcon?.[g.name]?`${e?.variantIcon?.[g.name]} `:"")+(e?.variant[g.name]||g.name)+(!t&&(!d||g.id===d?.id)?` (${a(g.members_count)})`:"")}))??[],[e,d,r]);return jsx(Fragment,{children:i&&jsxs(Fragment,{children:[jsx(Box,{className:"bespoke-explore-reports-select-container",mb:"md",sx:{display:"block","@media (min-width: 1000px)":{display:"none"}},children:jsxs(Group,{justify:"center",children:[jsx(Select,{className:"bespoke-explore-reports-select",data:m,value:String(c?.id||""),onChange:g=>s(g),label:e.select_report||"Select Report",placeholder:e.select_report||"Select Report",clearable:typeof c?.id<"u",style:{width:"450px"}}),c?.variants&&c.variants.length>2&&jsx(Select,{className:"bespoke-explore-variant-select",data:f,value:String(d?.id||""),onChange:g=>l(g),label:e.select_variant||"Select Variant",placeholder:e.select_variant||"Select Variant",clearable:typeof d?.id<"u",style:{width:"450px"}})]})}),jsx(Box,{sx:{display:"none","@media (min-width: 1000px)":{display:"block"}},children:jsxs("div",{children:[jsx(Group,{justify:"center",className:"bespoke-explore-reports-selector",mb:"md",children:r.map(g=>jsxs(Button,{"data-selected":g.id===c?.id?"true":"false","data-report-name":g.name,variant:g.id===c?.id?"outline":"subtle",onClick:()=>s(g.id),rightSection:g.id&&g.id===c?.id?jsx(IconX,{size:"1rem"}):void 0,leftSection:e?.dimensionIcon?.[g.name]??void 0,children:[jsx(Text,{span:true,className:"bespoke-explore-reports-name",dangerouslySetInnerHTML:{__html:e?.dimension[g.name]??g.name}}),!t&&(!c||g.id===c?.id)&&jsx(Text,{span:true,size:"xs",ml:"0.2rem",className:"bespoke-explore-reports-count",children:`(${a(g.members_count)})`})]},`p-${g.id}`))}),c&&c.variants&&c.variants.length>2&&jsx(Group,{justify:"center",style:{minHeight:"36px"},className:"bespoke-explore-variant-selector",mb:"md",children:c.variants.map(g=>jsxs(Button,{"data-selected":g.id===d?.id?"true":"false","data-variant-name":g.name,variant:g.id===d?.id?"outline":"subtle",onClick:()=>l(g.id),rightSection:g.id&&g.id===d?.id?jsx(IconX,{size:"1rem"}):void 0,leftSection:e?.variantIcon?.[g.name]?jsx(Text,{span:true,dangerouslySetInnerHTML:{__html:e.variantIcon[g.name]}}):void 0,children:[jsx(Text,{span:true,className:"bespoke-explore-variant-name",dangerouslySetInnerHTML:{__html:e?.variant[g.name]??g.name}}),!t&&(!d||g.id===d?.id)&&jsx(Text,{span:true,size:"xs",ml:"0.2rem",className:"bespoke-explore-variant-count",children:`(${a(g.members_count)})`})]},`v-${g.id}`))})]})})]})})}var wC,EC=N(()=>{u();Ec();wC=Hz;});function Eg({reportId:e,reportName:t,members:o,href:r,onClick:n}){let i=o.map(l=>jsx(Image,{src:l.image.src,height:160,loading:"lazy",alt:l.name},l.id)),s=o.map(l=>jsxs(Stack,{children:[jsx(Text,{fw:500,children:l.name}),jsx(Badge,{color:"green",variant:"light",w:"fit-content",children:l.variant})]},l.id));return jsxs(Card,{className:`report-${e}-tile`,shadow:"sm",p:"lg",radius:"md",withBorder:true,children:[jsx(Card.Section,{children:jsx(Group,{grow:true,gap:0,children:i})}),jsx(Group,{justify:"space-between",mt:"md",mb:"xs",children:s}),jsx("a",{href:r,onClick:n,children:jsx(Button,{variant:"light",color:"blue",fullWidth:true,mt:"md",radius:"md",children:`See ${t} Report`})})]})}function Zz({profile:e,profilePrefix:t,onSelect:o,reportTile:r}){let n=useRouter(),i=n.locale,{localeDefault:s}=qe(),a=`${i===s?"":`/${i}`}${t}${e.path}`,p=e.members.map(f=>({original_id:f.metadata.id,name:f.name,id:f.id,dimension_id:f.metadata.dimension.id,dimension:f.metadata.dimension.name,variant_id:f.metadata.variant.id,variant:f.metadata.variant.name,image:{src:`/api/cms/member/image?member=${f.id}&size=thumb`,alt:f.name}})),c=f=>{n.push(`${f}`),o&&o();},d=f=>{f.preventDefault(),c(a);},m=Qz(r);return jsx(Grid.Col,{span:{base:12,sm:6,md:4,lg:4,xl:3},children:jsx(m,{reportId:e.report.id,reportName:e.report.name,members:p,href:a,onClick:d})},e.id)}var Qz,PC,Rg=N(()=>{u();co();jo();Qz=e=>{let{components:t}=fr(),o=Eg;return t?.ReportTile&&(o=t?.ReportTile),e&&(o=e),o};PC=Zz;});function iF({profilePrefix:e,onSelect:t=()=>{},reportTile:o}){let[r,n]=useState(500),i=useRef(null),{results:s}=yi(),l=i.current?.offsetTop||0,a=50;return useEffect(()=>{let{innerHeight:p}=window;n(p-l-a);},[l]),jsx(ScrollArea,{offsetScrollbars:true,type:"always",h:r,ref:i,children:jsx(Grid,{align:"stretch",children:s.map(p=>jsx(PC,{profile:p,profilePrefix:e,reportTile:o,onSelect:t},p.id))})})}var OC,LC=N(()=>{u();Rg();Ec();OC=iF;});function lF(){let{activePage:e,setActivePage:t,pageSize:o,currentPageTotal:r}=yi();return jsx(Group,{justify:"center",children:jsx(Pagination,{value:e,onChange:i=>{t(i);},total:Math.ceil(r/o),size:"sm",py:"xs"})})}var BC,DC=N(()=>{u();Ec();BC=lF;});function vF({profilePrefix:e,initialReportId:t,initialVariantId:o,translations:r,onSelect:n,reportTile:i,initialQuery:s}){let l=useRef(),a=yi(),{query:p,setQuery:c,results:d,loadingItems:m,loadingMetadata:f,translations:g,setTranslations:h,initExplore:v}=a;useEffect(()=>{v&&v(t,o,s);},[v]),useEffect(()=>{m||l.current?.focus();},[m]),useEffect(()=>{r&&h(r);},[r]);let y=()=>{c("");};return jsxs(Container,{fluid:true,pt:"1em",children:[jsx(TextInput,{placeholder:g.search,mb:"md",size:"xl",onChange:S=>c(S.target.value),readOnly:f||m,leftSection:jsx(IconSearch,{size:24}),value:p,rightSectionWidth:100,rightSectionProps:{style:{justifyContent:"flex-end",padding:"0 15px 0 0"}},rightSection:jsxs(Group,{align:"center",children:[(f||m)&&jsx(Loader,{size:28}),p&&p!==""&&jsx(ActionIcon,{variant:"transparent",onClick:y,children:jsx(IconTrash,{size:24})})]}),ref:l}),jsx(wC,{translations:g}),jsx(LoadingOverlay,{visible:f||m}),!m&&d.length===0&&jsx(Alert,{title:g.no_results,color:"blue",children:g.try_another}),jsx(OC,{profilePrefix:e,onSelect:n,reportTile:i}),jsx(BC,{})]})}var _C,zC=N(()=>{u();EC();LC();DC();Ec();_C=vF;});function RF({exploreProps:e={profilePrefix:"/",locale:EF},icon:t=jsx(IconSearch,{size:20}),actionIconProps:o={},modalProps:r={},tooltipProps:n={},tooltipText:i="Click to Explore",showIcon:s=true,showTooltip:l=false,children:a}){let[p,c]=useState(false),d={variant:"light",size:"md",radius:"md",...o},m={fullScreen:true,opened:p,onClose:()=>c(false)},f=jsx(ActionIcon,{...d,onClick:()=>c(true),children:t}),g=s?jsxs(Group,{gap:"sm",style:{cursor:"pointer"},children:[a,f]}):a;return l&&(g=jsx(Tooltip,{label:i,...n,children:g})),jsxs(Fragment,{children:[jsx(Modal,{...m,...r,children:p&&jsx(_C,{...e,onSelect:()=>c(false)})}),jsx("div",{onClick:()=>c(true),children:a?g:jsx(Fragment,{children:f})})]})}var EF,$C,UC=N(()=>{u();zC();jo();({localeDefault:EF}=qe());$C=RF;});var MF,GC,HC=N(()=>{u();MF=forwardRef(({id:e,members:t=[],...o},r)=>{let n=t.map(i=>jsxs(Stack,{align:"center",children:[jsx(Text,{fw:500,children:i.name}),jsx(Badge,{color:"green",variant:"light",children:i.variant})]},i.id));return jsx("div",{ref:r,style:{width:"100%"},children:jsx(Group,{justify:"space-between",grow:true,children:n})},e)}),GC=MF;});function jF({locale:e,profilePrefix:t="/report",autocompleteProps:o={},tooltipProps:r={},tooltipText:n="Click to search",searchReportParams:i={},callback:s,children:l}){let a=useRouter(),p=a.locale,{localeDefault:c}=qe(),d=p===c?"":`/${p}`,m=HF(null),[f,g]=useState(""),[h,v]=useDebouncedValue(f,500),[y,S]=useState([]),[C,b]=useState(false),[w,k]=useState(false),[R,L]=useState(false),[I,A]=useState(!l),M=()=>{A(false);},D=()=>{A(true),F();},P=useRef(),O=useClickOutside(M),B=o?.searchConfig?.searchLimit??10,F=()=>{b(true);let Y={query:h,format:"profiles",locale:e,limit:B,visible:true,includes:true,noImage:false,variant:[],dimension:[],report:[],all:false,...i};ou.get("/api/cms/search/reports",{params:Y}).then(q=>{q&&q.data&&q.data.data&&q.data.data.results&&S(q.data.data.results.map(ie=>{let pe=ie.report?.name??ie.name??`${ie.id}`;return {id:ie.id,reportName:pe,label:pe,href:`${d}${t}${ie.path}`,reportPath:`${ie.path}`,profilePrefix:t,value:ie.id,members:(ie.members||[]).map(de=>({original_id:String(de?.metadata?.id??de.id),name:de?.name??"",id:de.id??0,variant:de?.metadata?.variant?.name??"",image:{src:`/api/cms/member/image?member=${de.id}&size=thumb`,alt:de?.name??""}}))}})),b(false),P.current?.focus();}).catch(q=>{console.error(q),b(false);});};useEffect(()=>{R&&h.length>=(o.searchConfig?.queryThreshold??0)&&F();},[R,h,o.searchConfig?.queryThreshold]),useEffect(()=>{v(),I&&L(true);},[]),useEffect(()=>{v(),I&&L(true);},[I]);let z=Y=>{A(false),s?s(Y):(a.push(Y.href),k(true));},G=Y=>{g(Y);},{searchConfig:U,renderOption:j,data:H,...K}=o??{},_=useMemo(()=>y.map(Y=>({value:Y.value,label:Y.reportName})),[y]),Q=useMemo(()=>Object.fromEntries(y.map(Y=>[Y.value,Y])),[y]),ae=useMemo(()=>j||m,[j,m]),oe=useMemo(()=>({placeholder:"Search",size:"md",leftSection:jsx(IconSearch,{}),value:f,onChange:G,disabled:(C||w)&&!R,limit:B,maxDropdownHeight:250,filter:Y=>Y.options,rightSection:jsx(Group,{gap:0,justify:"right",children:C?jsx(Loader,{size:20}):jsx(Fragment,{})}),renderOption:Y=>{let q=Y.option,ie=Q[q.value];return ie?jsx(ae,{...ie}):q.label},onOptionSubmit:Y=>{let q=Q[Y];q&&z(q);},comboboxProps:{withinPortal:false},...K,data:_}),[f,C,w,R,B,_,Q,j,z,K]),ee=jsx(Autocomplete,{ref:P,...oe});return l?jsx(Tooltip,{label:n,disabled:I,...r,children:jsxs(Group,{ref:O,gap:"sm",align:"center",style:{cursor:"pointer"},children:[!I&&jsx("div",{onClick:()=>A(true),children:l}),I&&jsx(Fragment,{children:ee}),I?jsx(ActionIcon,{variant:"light",onClick:M,children:jsx(IconX,{size:20})}):jsx(ActionIcon,{variant:"light",onClick:D,children:jsx(IconSearch,{size:20})})]})}):ee}var HF,YC,XC=N(()=>{u();co();HC();jo();HF=e=>{let{components:t}=fr(),o=GC;return t?.ReportItem&&(o=t?.ReportItem),e&&(o=e),o};YC=jF;});function qF(){let e=fr("components");return useMemo(()=>{let{modal:t,inline:o}=e?.search??{};return {modal:t,inline:o}},[e?.search])}function Wa(e,t,o,r,n){let i=qF(),s=V(g=>g.variables.attributes.report_id),l=V(g=>g.variables.attributes.variant_id1),a=V(g=>g.variables.attributes.name1),p=useMemo(()=>({reportId:s,variantId:l,title:a}),[s,l,a]),c=useRouter(),d=fa(),m=Ht();return useMemo(()=>{let g=e;return t==="modal"?g=jsx($C,{exploreProps:{locale:c.locale||JC,profilePrefix:d,translations:m.explore,initialReportId:p.reportId,initialVariantId:p.variantId,initialQuery:p.title},tooltipText:m.explore?.tooltip,modalProps:i.modal,...n,children:e}):t==="inline"&&(g=jsx(YC,{locale:c.locale||JC,profilePrefix:d,callback:o,tooltipText:m.explore?.tooltip,...r,autocompleteProps:i.inline,children:e})),g},[t,e,c.locale,d,m,p,i,o,r,n])}var JC,ZC=N(()=>{u();Ur();le();Te();UC();XC();jo();co();({localeDefault:JC}=qe());});var co=N(()=>{u();dk();mk();fk();uC();If();dC();mC();fC();bC();yC();ZC();});function Mg({title:e,tooltip:t,slug:o,_iconType:r,_iconVariant:n,_icon:i,settings:s,_iconRadius:l,_iconSize:a,_iconPadding:p,asComparison:c=false}){let{print:d}=gr(),m=We(e)||"<span class='cr-block-placeholder'>Title</span>",f=s&&s.order?parseInt(s.order,10):1,g=f<=6?f:1,h=s&&s.search?s.search:"off",v=s&&s.align?s.align:"left",y=$r(),S=V(I=>I.status.previews),b=(c?y.status.previews:S).map(I=>I.name).join(" | "),w=jsxs(Group,{className:"bespoke-Title-content",children:[jsx(Ye,{blockType:"title",iconType:r,iconVariant:n,iconRadius:l,iconSize:a,icon:i,iconPadding:p}),jsx(xe,{className:"bespoke-Title-text",id:o||void 0,component:"h",order:g,style:s,html:m})]}),k=Wa(w,h),R=s&&s.addComparisonName==="yes"&&y.active,L=R?Box:Fragment$2;return jsxs(Group,{className:"bespoke-Title-root",gap:"sm",justify:ao(v),children:[jsxs(L,{className:"bespoke-Title-wrapper",children:[d?w:k,R&&jsx(Text,{className:"bespoke-Title-comparison",children:b})]}),t&&jsx(Gt,{content:t})]})}var tw=N(()=>{u();on();On();ft();co();hi();le();Ln();Pn();lo();});function _g(e){let{name:t,settings:o,options:r,id:n,defaultValue:i,section:s,component:l,asComparison:a,hideLabel:p,resetSectionVars:c}=e,{print:d}=gr(),m=pV(n),f=Lu(n,s,m,a,c==="true"),g=a?`${m}Compare`:m,[h,v]=useState(i),[y,S]=useState(rw(i,[])),C=JSON.stringify(r),b=o[Lt.DISABLED]||false,w=useMemo(()=>r?.map(M=>({value:M.id,label:M.label,imageUrl:M.imageUrl}))||[],[C]),k=d?r.filter(M=>y.includes(M.id)).map(M=>M.label).join(", "):"",R=d&&h&&r.find(M=>M.id===h)?.label||"",L=e.hideLabel==="true"?jsx(Fragment,{}):jsx(xe,{className:"bespoke-Selector-label",component:"span",html:t,size:"sm",style:o});if(useEffect(()=>{if(!b){let D=new URLSearchParams(window.location.search).get(g)||i;D&&(e.type===Tt.SINGLE?v(D):S(rw(D,i)));}},[window.location.search,i]),w.length<=1)return jsx(Fragment,{});let I=M=>{S(M),f(M.join(","));},A=M=>{v(M),f(M);};return jsx(Fragment,{children:d?jsxs(Box,{className:"bespoke-Selector-root",style:{display:"flex",alignItems:"center"},children:[L,jsx(Button,{className:"bespoke-Selector-button",ml:"sm",radius:"xl",variant:"outline",children:e.type===Tt.SINGLE?R:k})]}):jsx(Box,{className:"bespoke-Selector-root",children:{[Tt.SINGLE]:l===qp.SEGMENTED_CONTROL?jsxs("div",{className:"bespoke-Selector-container",children:[jsx(Text,{className:"bespoke-Selector-label",size:"sm",fw:500,display:p==="true"?"none":"block",children:L}),jsx(SegmentedControl,{className:"bespoke-Selector-segmentedControl",data:w,disabled:b,value:w.map(M=>M.value).includes(h)?h:"",onChange:A,fullWidth:true})]}):jsx(Select,{className:"bespoke-Selector-select",label:L,data:w,disabled:b,value:h,renderOption:M=>jsx(uV,{...w.find(D=>D.value===M.option.value)||{}}),onChange:A,styles:{label:{display:p==="true"?"none":"block"}}}),[Tt.MULTI]:jsx(MultiSelect,{className:"bespoke-Selector-multiSelect",label:L,data:w,value:y,onChange:I,disabled:b,styles:{label:{display:p==="true"?"none":"block"}}})}[e.type]})})}var pV,rw,uV,iw=N(()=>{u();ft();he();co();Ln();pV=e=>`selector${e}id`,rw=(e,t)=>e&&typeof e=="string"?e.split(","):t,uV=forwardRef(function({imageUrl:t,label:o,...r},n){return jsx("div",{ref:n,...r,children:jsxs(Group,{wrap:"nowrap",children:[t&&!["","undefined"].includes(t)&&jsx(Box,{component:"img",w:25,h:25,src:t}),jsx("div",{children:jsx(Text,{size:"sm",children:o})})]})})});});function Uu(){return jsx("div",{children:"Generator"})}var sw=N(()=>{u();});function zg(e){let{alt:t,src:o,desc:r,title:n,settings:i,...s}=e,l=We(t),a=We(o),p=We(r),c=jsx("img",{src:a,alt:l,style:s}),d=i&&i.align?String(i.align):"left";return (p&&p.length||n&&n.length)&&(c=jsxs(Stack,{className:"bespoke-Image-wrapper",align:No(d),gap:"sm",children:[n&&jsx(xe,{className:"bespoke-Image-title",component:"p",html:n,style:i}),c,r&&jsx(xe,{className:"bespoke-Image-desc",component:"p",size:"sm",html:r,style:i})]})),a&&l?c:jsx(Center,{className:"bespoke-Image-placeholder",mih:100,bg:"white",children:jsx(Badge,{color:"gray",variant:"outline",children:"IMAGE"},"type")})}var aw=N(()=>{u();on();ft();lo();});function Ss(e,t,o){let r=o.initialDeps??[],n;return ()=>{var i,s,l,a;let p;o.key&&((i=o.debug)!=null&&i.call(o))&&(p=Date.now());let c=e();if(!(c.length!==r.length||c.some((f,g)=>r[g]!==f)))return n;r=c;let m;if(o.key&&((s=o.debug)!=null&&s.call(o))&&(m=Date.now()),n=t(...c),o.key&&((l=o.debug)!=null&&l.call(o))){let f=Math.round((Date.now()-p)*100)/100,g=Math.round((Date.now()-m)*100)/100,h=g/16,v=(y,S)=>{for(y=String(y);y.length<S;)y=" "+y;return y};console.info(`%c\u23F1 ${v(g,5)} /${v(f,5)} ms`,`
39
39
  font-size: .6rem;
40
40
  font-weight: bold;
41
- color: hsl(${Math.max(0,Math.min(120-120*h,120))}deg 100% 31%);`,o?.key);}return (a=o?.onChange)==null||a.call(o,n),n}}function Gu(e,t){if(e===void 0)throw new Error(`Unexpected undefined${""}`);return e}var lw,cw,pw=N(()=>{u();lw=(e,t)=>Math.abs(e-t)<1,cw=(e,t,o)=>{let r;return function(...n){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,n),o);}};});function SV({measurements:e,outerSize:t,scrollOffset:o}){let r=e.length-1,i=gw(0,r,l=>e[l].start,o),s=i;for(;s<r&&e[s].end<o+t;)s++;return {startIndex:i,endIndex:s}}var bV,Pc,dw,uw,yV,mw,vV,fw,Hu,gw,Fg=N(()=>{u();pw();bV=e=>e,Pc=e=>{let t=Math.max(e.startIndex-e.overscan,0),o=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let n=t;n<=o;n++)r.push(n);return r},dw=(e,t)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let n=s=>{let{width:l,height:a}=s;t({width:Math.round(l),height:Math.round(a)});};if(n(o.getBoundingClientRect()),!r.ResizeObserver)return ()=>{};let i=new r.ResizeObserver(s=>{let l=s[0];if(l?.borderBoxSize){let a=l.borderBoxSize[0];if(a){n({width:a.inlineSize,height:a.blockSize});return}}n(o.getBoundingClientRect());});return i.observe(o,{box:"border-box"}),()=>{i.unobserve(o);}},uw={passive:true},yV=typeof window>"u"?true:"onscrollend"in window,mw=(e,t)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let n=0,i=e.options.useScrollendEvent&&yV?()=>{}:cw(r,()=>{t(n,false);},e.options.isScrollingResetDelay),s=p=>()=>{let{horizontal:c,isRtl:d}=e.options;n=c?o.scrollLeft*(d&&-1||1):o.scrollTop,i(),t(n,p);},l=s(true),a=s(false);return a(),o.addEventListener("scroll",l,uw),o.addEventListener("scrollend",a,uw),()=>{o.removeEventListener("scroll",l),o.removeEventListener("scrollend",a);}},vV=(e,t,o)=>{if(t?.borderBoxSize){let r=t.borderBoxSize[0];if(r)return Math.round(r[o.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[o.options.horizontal?"width":"height"])},fw=(e,{adjustments:t=0,behavior:o},r)=>{var n,i;let s=e+t;(i=(n=r.scrollElement)==null?void 0:n.scrollTo)==null||i.call(n,{[r.options.horizontal?"left":"top"]:s,behavior:o});},Hu=class{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=false,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let o=null,r=()=>o||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:o=new this.targetWindow.ResizeObserver(n=>{n.forEach(i=>{this._measureElement(i.target,i);});}));return {disconnect:()=>{var n;(n=r())==null||n.disconnect(),o=null;},observe:n=>{var i;return (i=r())==null?void 0:i.observe(n,{box:"border-box"})},unobserve:n=>{var i;return (i=r())==null?void 0:i.unobserve(n)}}})(),this.range=null,this.setOptions=o=>{Object.entries(o).forEach(([r,n])=>{typeof n>"u"&&delete o[r];}),this.options={debug:false,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:false,getItemKey:bV,rangeExtractor:Pc,onChange:()=>{},measureElement:vV,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:true,isRtl:false,useScrollendEvent:true,...o};},this.notify=o=>{var r,n;(n=(r=this.options).onChange)==null||n.call(r,this,o);},this.maybeNotify=Ss(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),o=>{this.notify(o);},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(o=>o()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null;},this._didMount=()=>()=>{this.cleanup();},this._willUpdate=()=>{var o;let r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((o=this.scrollElement)==null?void 0:o.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n);}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify();})),this.unsubs.push(this.options.observeElementOffset(this,(n,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<n?"forward":"backward":null,this.scrollOffset=n,this.isScrolling=i,this.maybeNotify();}));}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(o,r)=>{let n=new Map,i=new Map;for(let s=r-1;s>=0;s--){let l=o[s];if(n.has(l.lane))continue;let a=i.get(l.lane);if(a==null||l.end>a.end?i.set(l.lane,l):l.end<a.end&&n.set(l.lane,true),n.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((s,l)=>s.end===l.end?s.index-l.index:s.end-l.end)[0]:void 0},this.getMeasurementOptions=Ss(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(o,r,n,i,s)=>(this.pendingMeasuredCacheIndexes=[],{count:o,paddingStart:r,scrollMargin:n,getItemKey:i,enabled:s}),{key:false}),this.getMeasurements=Ss(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:o,paddingStart:r,scrollMargin:n,getItemKey:i,enabled:s},l)=>{if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(c=>{this.itemSizeCache.set(c.key,c.size);}));let a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];let p=this.measurementsCache.slice(0,a);for(let c=a;c<o;c++){let d=i(c),m=this.options.lanes===1?p[c-1]:this.getFurthestMeasurement(p,c),f=m?m.end+this.options.gap:r+n,g=l.get(d),h=typeof g=="number"?g:this.options.estimateSize(c),v=f+h,y=m?m.lane:c%this.options.lanes;p[c]={index:c,start:f,size:h,end:v,key:d,lane:y};}return this.measurementsCache=p,p},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Ss(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(o,r,n)=>this.range=o.length>0&&r>0?SV({measurements:o,outerSize:r,scrollOffset:n}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getIndexes=Ss(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(o,r,n,i)=>r===null?[]:o({startIndex:r.startIndex,endIndex:r.endIndex,overscan:n,count:i}),{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:()=>this.options.debug}),this.indexFromElement=o=>{let r=this.options.indexAttribute,n=o.getAttribute(r);return n?parseInt(n,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(o,r)=>{let n=this.indexFromElement(o),i=this.measurementsCache[n];if(!i)return;let s=i.key,l=this.elementsCache.get(s);l!==o&&(l&&this.observer.unobserve(l),this.observer.observe(o),this.elementsCache.set(s,o)),o.isConnected&&this.resizeItem(n,this.options.measureElement(o,r,this));},this.resizeItem=(o,r)=>{let n=this.measurementsCache[o];if(!n)return;let i=this.itemSizeCache.get(n.key)??n.size,s=r-i;s!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(n,s,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",s),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=s,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,r)),this.notify(false));},this.measureElement=o=>{if(!o){this.elementsCache.forEach((r,n)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(n));});return}this._measureElement(o,void 0);},this.getVirtualItems=Ss(()=>[this.getIndexes(),this.getMeasurements()],(o,r)=>{let n=[];for(let i=0,s=o.length;i<s;i++){let l=o[i],a=r[l];n.push(a);}return n},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=o=>{let r=this.getMeasurements();if(r.length!==0)return Gu(r[gw(0,r.length-1,n=>Gu(r[n]).start,o)])},this.getOffsetForAlignment=(o,r)=>{let n=this.getSize(),i=this.getScrollOffset();r==="auto"&&o>=i+n&&(r="end"),r==="end"&&(o-=n);let s=this.options.horizontal?"scrollWidth":"scrollHeight",a=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[s]:this.scrollElement[s]:0)-n;return Math.max(Math.min(a,o),0)},this.getOffsetForIndex=(o,r="auto")=>{o=Math.max(0,Math.min(o,this.options.count-1));let n=this.measurementsCache[o];if(!n)return;let i=this.getSize(),s=this.getScrollOffset();if(r==="auto")if(n.end>=s+i-this.options.scrollPaddingEnd)r="end";else if(n.start<=s+this.options.scrollPaddingStart)r="start";else return [s,r];let l=n.start-this.options.scrollPaddingStart+(n.size-i)/2;switch(r){case "center":return [this.getOffsetForAlignment(l,r),r];case "end":return [this.getOffsetForAlignment(n.end+this.options.scrollPaddingEnd,r),r];default:return [this.getOffsetForAlignment(n.start-this.options.scrollPaddingStart,r),r]}},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null);},this.scrollToOffset=(o,{align:r="start",behavior:n}={})=>{this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(o,r),{adjustments:void 0,behavior:n});},this.scrollToIndex=(o,{align:r="auto",behavior:n}={})=>{o=Math.max(0,Math.min(o,this.options.count-1)),this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");let i=this.getOffsetForIndex(o,r);if(!i)return;let[s,l]=i;this._scrollToOffset(s,{adjustments:void 0,behavior:n}),n!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(o))){let[p]=Gu(this.getOffsetForIndex(o,l));lw(p,this.getScrollOffset())||this.scrollToIndex(o,{align:l,behavior:n});}else this.scrollToIndex(o,{align:l,behavior:n});}));},this.scrollBy=(o,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+o,{adjustments:void 0,behavior:r});},this.getTotalSize=()=>{var o;let r=this.getMeasurements(),n;return r.length===0?n=this.options.paddingStart:n=this.options.lanes===1?((o=r[r.length-1])==null?void 0:o.end)??0:Math.max(...r.slice(-this.options.lanes).map(i=>i.end)),Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(o,{adjustments:r,behavior:n})=>{this.options.scrollToFn(o,{behavior:n,adjustments:r},this);},this.measure=()=>{this.itemSizeCache=new Map,this.notify(false);},this.setOptions(t);}},gw=(e,t,o,r)=>{for(;e<=t;){let n=(e+t)/2|0,i=o(n);if(i<r)e=n+1;else if(i>r)t=n-1;else return n}return e>0?e-1:0};});function TV(e){let t=vi.useReducer(()=>({}),{})[1],o={...e,onChange:(n,i)=>{var s;i?flushSync(t):t(),(s=e.onChange)==null||s.call(e,n,i);}},[r]=vi.useState(()=>new Hu(o));return r.setOptions(o),hw(()=>r._didMount(),[]),hw(()=>r._willUpdate()),r}function ju(e){return TV({observeElementRect:dw,observeElementOffset:mw,scrollToFn:fw,...e})}var hw,Vg=N(()=>{u();Fg();Fg();hw=typeof document<"u"?vi.useLayoutEffect:vi.useEffect;});function Gg(e){let{allLabel:t,asComparison:o,colorKey:r,data:n,defaultValue:i,defaultValueType:s,hideLabel:l,resetSectionVars:a,iconKey:p,id:c,levels:d,limit:m,placeholder:f,searchIndexKey:g,searchIndexSeparator:h,section:v,settings:y}=e,{print:S}=gr(),C=NV(c),b=zu(c,v,C,o,a==="true"),w=o?`${C}-valueCompare`:`${C}-value`,k=o?`${C}-typeCompare`:`${C}-type`,R=useMantineTheme(),{colorScheme:L}=useMantineColorScheme(),[I,A]=useState(false),[M,D]=useState(true),[P,O]=useState(""),[B,F]=useState(false),[z,G]=useState([""].slice(1)),[U,j]=useState([]),[H,K]=useState(""),_=y[Lt.DISABLED]||false,Q=useMemo(()=>S?Array.from(new Set(n.filter(te=>U.includes(te[`${H} ID`])))).map(te=>te?.[H]).join(", "):"",[S]),ae=l==="true"||!e.label?jsx(Fragment,{}):jsx(xe,{component:"div",html:e.label,size:"sm",style:y}),oe=useRef(null),ee=useRef(false),J=useRef(!!m&&m<U.length),Y=z.length,q=d[Y],ie=z.filter(Boolean);z.length>0&&ie.length===0&&ie.push(`${t} ${q?.label}`),useEffect(()=>{if(!_){let $=new URLSearchParams(window.location.search),te=$.get(w)||i,fe=$.get(k)||s;te&&fe?(j(_V(te,i)),K(fe)):(j([]),K(""));}},[window.location.search,i,s,_]),useEffect(()=>{let $=()=>{D(true);};return window.addEventListener("touchmove",$),()=>{window.removeEventListener("touchmove",$);}},[]);let pe=useMemo(()=>MV(n,d,r,p,g,h),[r,n,p,d,g,h]),de=useMemo(()=>{let $=BV(P),te=Array.from(DV(pe,$)).reverse();return B?te:z.reduce((fe,ve)=>fe.filter(Me=>!ve||Me.searchindex.indexOf(ve)>-1),te.filter(fe=>fe.type===q?.value))},[q,pe,P,B,z]),X=useRef(null),se=ju({count:I?de.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>X.current,[]),overscan:10,rangeExtractor:useCallback($=>Pc($),[])}),[be,Ce]=useState(-1),Ee=Math.min(be,de.length-1),Ge=useCallback($=>{let te=z.concat($);B&&F(false),G(te);},[B,z]),St=useCallback(()=>{let $=z.slice(0,Y-1);B&&F(false),G($);},[B,z,Y]),xt=useCallback($=>{O($.currentTarget.value),!J.current&&n.length>0&&A(true);},[n,O,J,A]),Rr=useCallback(()=>{O(""),b([],""),oe.current?.focus(),m&&(J.current=false);},[O,b,oe,m,J]),ho=useCallback($=>{let te=U.filter(fe=>fe!==$);te.length>0?b(te,H):b([],""),m&&te.length<m&&(J.current=false);},[U,H,b,m,J]),Ho=useCallback($=>{H!==$.type?b([$.value],$.type):U.includes($.value)?ho($.value):m?(U.length<m&&b([...U,$.value],H),U.length===m&&b([...U.slice(1),$.value],H)):b([...U,$.value],H),O("");},[b,H,U,ho,m]),Yn=useCallback(()=>{U.length>0&&P.length===0&&(b(U.slice(0,-1),H),A(true),m&&(J.current=false)),P.length>0&&O(P.slice(0,-1));},[b,U,H,P,O,A,m,J]),Xn=useCallback(()=>{D($=>$&&(ee.current=$,!$)),Ce($=>$+1>=de.length?$:$+1);},[Ce,de]),Jn=useCallback(()=>{let $=de[Ee];$&&Ho($);},[de,Ee,Ho]),Qn=useCallback(()=>{A(false);},[A]),Dl=useCallback(()=>{St(),Ce(0);},[Ce,St]),Nl=useCallback(()=>{let $=de[Ee];!B&&$&&$.type!==d[d.length-1]?.value&&(Ge($.name),Ce(0));},[de,Ee,B,d,Ce,Ge]),_l=useCallback(()=>{D($=>$&&(ee.current=$,!$)),Ce($=>$-1<0?0:$-1);},[Ce]),ne=({label:$,onRemove:te,...fe})=>jsxs("div",{className:"bespoke-MultiHierarchySelector-selectedItem",style:{alignItems:"center",backgroundColor:L==="dark"?"var(--mantine-color-dark-7)":"var(--mantine-color-gray-1)",borderRadius:R.radius.sm,cursor:"default",color:L==="dark"?"var(--mantine-color-dark-0)":"var(--mantine-color-gray-7)",display:"flex",fontSize:rem(12),fontWeight:500,height:rem(22),margin:`calc(${R.spacing.xs} / 2 - ${rem(2)}) calc(${R.spacing.xs} / 2)`,maxWidth:`calc(100% - ${rem(10)})`,paddingLeft:`calc(${R.spacing.sm} / 1.5)`,paddingRight:0,userSelect:"none"},...fe,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:$}),jsx(CloseButton,{className:"bespoke-MultiHierarchySelector-itemCloseButton","aria-hidden":true,iconSize:"70%",onMouseDown:te,radius:2,size:"sm",sx:{color:L==="dark"?"var(--mantine-color-dark-0)":"var(--mantine-color-gray-7)",marginLeft:`calc(${R.spacing.sm} / 6)`},tabIndex:-1})]}),Le=useMemo(()=>U.map($=>pe.find(te=>te.value===$)).filter($=>!!$).map(($,te)=>createElement(ne,{...$,index:te,label:$.label,key:$.value,onRemove:fe=>{fe.preventDefault(),fe.stopPropagation(),ho($.value);}})),[U]),W=forwardRef(function({color:te,icon:fe,label:ve,value:Me,...Yt},Zn){return jsx("div",{className:"bespoke-MultiHierarchySelector-item",ref:Zn,style:{cursor:"pointer",width:"100%"},...Yt,children:jsxs(Group,{className:"bespoke-MultiHierarchySelector-itemWrapper",align:"center",wrap:"nowrap",gap:"xs",w:"100%",children:[fe&&jsx(Box,{className:"bespoke-MultiHierarchySelector-itemIcon",bg:te??"transparent",component:"img",w:20,h:20,src:fe}),jsx(Text,{lineClamp:1,size:"sm",className:"bespoke-MultiHierarchySelector-itemLabel",children:ve||Me})]})})});return jsxs(Fragment,{children:[jsx("div",{className:"bespoke-MultiHierarchySelector-root no-print",children:jsx(Input.Wrapper,{className:"bespoke-MultiHierarchySelector-inputWrapper",label:ae,children:jsxs(Popover,{closeOnClickOutside:true,disabled:_,keepMounted:true,opened:I,onChange:A,onClose:()=>{Ce(0),O("");},onOpen:()=>{de.length>0&&se.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:true,children:[jsx(Popover.Target,{children:jsxs(Box,{className:"bespoke-MultiHierarchySelector-content","aria-haspopup":"listbox",component:"div",onMouseLeave:()=>Ce(0),sx:{position:"relative","& .defaultValue":{backgroundColor:L==="dark"?"var(--mantine-color-dark-5)":"var(--mantine-color-gray-3)",color:L==="dark"?"var(--mantine-color-dark-1)":"var(--mantine-color-gray-7)"}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:U.join(",")}),jsx(Input,{className:"bespoke-MultiHierarchySelector-input",component:"div",disabled:_,multiline:true,onMouseDown:$=>{$.preventDefault(),!J.current&&n.length>0&&A(!I),oe.current?.focus();},rightSection:U.length>0?jsx(CloseButton,{className:"bespoke-MultiHierarchySelector-closeButton",disabled:_,onClick:Rr,onMouseDown:$=>$.preventDefault(),variant:"transparent"}):jsx(IconSelector,{className:"bespoke-MultiHierarchySelector-icon",color:R.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{className:"bespoke-MultiHierarchySelector-selectedItems",component:"div","data-clearable":true,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${R.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:L==="dark"?"var(--mantine-color-dark-3)":"var(--mantine-color-gray-5)",opacity:1}},children:[Le,jsx("input",{className:"bespoke-MultiHierarchySelector-search",autoComplete:"off","data-mantine-stop-propagation":I,onChange:xt,onKeyDown:getHotkeyHandler([["ArrowDown",Xn],["ArrowLeft",Dl],["ArrowRight",Nl],["ArrowUp",_l],["Backspace",Yn],["Enter",Jn],["Escape",Qn]]),placeholder:U.length===0&&f||"",ref:oe,readOnly:J.current,style:{appearance:"none",backgroundColor:"transparent",border:0,color:"inherit",flex:1,fontSize:R.fontSizes.sm,marginLeft:`calc(${R.spacing.xs} / 2)`,maxHeight:rem(22),minWidth:rem(60),outline:0,padding:0},type:"search",value:P})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:$=>$.preventDefault(),p:0,children:jsx("div",{className:"bespoke-MultiHierarchySelector-dropdown",style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{className:"bespoke-MultiHierarchySelector-dropdownContent",component:"div","data-combobox-popover":true,onMouseDown:$=>$.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",gap:"xs",w:"100%",children:[d.length>1&&jsxs(Stack,{gap:"xs",children:[jsxs(Group,{onClick:$=>{$.stopPropagation();},px:"xs",justify:"center",gap:"xs",children:[jsx(Button,{onClick:()=>{Ce(0),F(true),G([]),de.length>0&&se.scrollToIndex(0);},size:"xs",variant:B?"filled":"outline",children:t}),d.map(($,te)=>jsx(Button,{onClick:()=>{B&&F(false);let fe=[""].slice(1),ve=te;for(;ve--;)fe[ve]=z[ve]||"";Ce(0),G(fe),de.length>0&&se.scrollToIndex(0);},size:"xs",variant:!B&&z.length===d.findIndex(fe=>fe.value===$?.value)?"filled":"outline",children:$?.label},$?.value))]}),jsx(Divider,{})]}),Y>0&&jsxs(Group,{align:"center",wrap:"nowrap",px:"xs",children:[jsx(ActionIcon,{onClick:St,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:ie.map($=>jsx(Text,{lineClamp:1,size:"xs",children:$},`${$}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>D(true),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:X,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${se.getTotalSize()}px`,position:"relative",width:"100%"},children:se.getVirtualItems().map($=>{let te=de[$.index],fe=Ee===$.index,ve=U.includes(te.value);return de.length>0&&fe&&!M&&se.scrollToIndex(Ee),jsxs(Group,{"aria-selected":fe,align:"center","data-hovered":fe||void 0,"data-index":$.index,"data-selected":ve,id:te.vale,wrap:"nowrap",onMouseEnter:Me=>{Me.preventDefault(),Me.stopPropagation(),M&&(Ce($.index),D(false));},onMouseMove:Me=>{Me.preventDefault(),Me.stopPropagation(),D(true);},onMouseDown:Me=>{Me.preventDefault(),Ho(te);},justify:"space-between",ref:se.measureElement,role:"option",gap:"xs",sx:Me=>({borderRadius:Me.radius.xs,padding:"15px 5px 15px",paddingLeft:B&&10*d.findIndex(Yt=>Yt?.value===te.type)||5,position:"absolute",top:0,left:0,height:`${$.size}px`,transform:`translateY(${$.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:L==="dark"?"var(--mantine-color-dark-4)":"var(--mantine-color-gray-1)"},"&:hover":{backgroundColor:L==="dark"?"var(--mantine-color-dark-4)":"var(--mantine-color-gray-1)"}}),tabIndex:-1,children:[jsx(W,{index:$.index,...te}),!B&&te.type!==d[d.length-1]?.value&&jsx(ActionIcon,{onMouseDown:Me=>{Me.preventDefault(),Me.stopPropagation(),Ge(te.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},te.value)})})})]})})})})]})})}),S&&jsxs(Text,{children:[ae,": ",Q]})]})}var MV,BV,DV,NV,_V,Cw=N(()=>{u();Vg();ft();Ln();co();he();MV=(e=[],t=[],o="",r="",n="",i="|")=>{let s=t.map(h=>h.value).slice(),l=`${s.pop()}`,a=h=>h[o],p=h=>h[r],c=h=>{if(h[n])return typeof h[n]=="string"?h[n].split(i):h[n]},d=new Set,m=[],f=[],g=nest().rollup(h=>{let v=h[0],y=I=>I&&I.value&&!d.has(I.value),S=s.map(I=>v[`${I} ID`]),C=s.map(I=>v[I]),b=s.map((I,A)=>{if(f[A]!==C[A]){f[A]=C[A];let M=a[A]||a[a.length-1]||a,D=p[A]||p[p.length-1]||p,P=c[A]||c[c.length-1]||c;return {color:M(v,I)||void 0,icon:D(v,I)||void 0,value:`${S[A]}`,label:C[A],name:C[A],type:I,searchindex:C.slice(0,A+1).concat(P(v,I)).join("|")}}return {}}).filter(y);b.forEach(I=>d.add(I.value));let w=a[a.length-1]||a,k=p[p.length-1]||p,R=c[c.length-1]||c,L=h.map(I=>({color:w(I,l)||void 0,icon:k(I,l)||void 0,value:`${I[`${l} ID`]}`,label:I[l],name:I[l],type:l,searchindex:C.concat(I[l]).concat(R(I,l)).join("|")}));m.push(...b.concat(L));});return s.forEach(h=>{g.key(v=>`${v[`${h} ID`]}|${v[h]}`);}),g.entries(e),m},BV=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},DV=(e,t)=>{let o=e.length,r,n=l=>r&&r.searchindex.includes(l.searchindex),s={next:()=>{for(let l=o-1;l>-1;l--){let a=e[l];if(t.test(`${a.value} ${a.label} ${a.searchindex}`)||n(a))return r=a,o=l,{done:false,value:a}}return {done:true,value:void 0}},[Symbol.iterator]:()=>s};return s},NV=e=>`multihierarchySelector${e}`,_V=(e,t)=>e&&typeof e=="string"?e.split(","):t;});function Hg({headings:e,settings:t,type:o,title:r,shortTitle:n,_iconType:i,_iconVariant:s,_icon:l,_iconRadius:a,_iconSize:p,_iconPadding:c}){let{min:d="1",max:m="6",icons:f="yes"}=t||{},g=us(parseInt(d,10),parseInt(m,10),e),h=f==="yes",v=We(r)||"",y=We(n||r)||"",S=v&&v.length>0,C=i&&i!=="none",w=`(max-width: ${useMantineTheme().breakpoints.md})`,k=useMediaQuery(w),R=k?y:v,L=t&&t.align?String(t.align):"left",I=Va(L),A=ao(L),M=No(L),D=t&&t.titlePosition?String(t.titlePosition):"left",P=useMemo(()=>{let z={right:"left",left:"right"},G=S&&["left","right"].includes(D),U={};if(G){let j=D==="right";U={gap:"xs",justify:j&&z[A]?z[A]:A,style:{flexDirection:j?"row-reverse":"row"},wrap:"nowrap"};}else U={gap:"xs",align:M,justify:"center",style:{flexDirection:D==="bottom"?"column-reverse":"column"}};return {element:G?Group:Stack,props:U}},[S,A,M,D]),O=useMemo(()=>S?jsxs(Group,{className:"bespoke-Nav-title",gap:"xs",justify:A,wrap:"nowrap",children:[C&&jsx(Ye,{blockType:"title",iconType:i,iconVariant:s,iconRadius:a,iconSize:p,icon:l,iconPadding:c}),jsx(xe,{className:"bespoke-Nav-titleText",style:{...t},html:R,lineClamp:1})]}):null,[S,C,A,R]),B=useMemo(()=>k?jsx(HV,{contentOutline:g,showIcons:h,titleElement:O,wrapper:P}):null,[k,O,P]),F=useMemo(()=>k?null:o==="multilevel"?jsx(jV,{contentOutline:g,showIcons:h,align:I}):jsx(GV,{contentOutline:g,showIcons:h,align:I}),[g,h,I,k]);return jsxs(Fragment,{children:[k&&B,!k&&jsxs(P.element,{className:"bespoke-Nav-wrapper",pos:"relative",...P.props,children:[S&&O,F]})]})}var Ew,GV,Mw,HV,jV,Bw=N(()=>{u();co();On();lo();on();On();ft();Ew=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"}),GV=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null);useEffect(()=>{let s=()=>{let l=document.querySelector(".bespoke-nav");if(!l)return;let a=l.getBoundingClientRect(),p=false;e.forEach(c=>{let d=document.getElementById(`bespoke-title-${c.id}`);d&&d.getBoundingClientRect().top<=a.bottom&&(n(c.id),p=true);}),p||n(null);};return window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s);}},[e]);let i=s=>!s||!s?.length?null:jsx(Fragment,{children:s.map(l=>jsxs(Fragment$2,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(Ye,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})}),jsx(Box,{pl:"xs",children:i(l.children)})]},l.id))});return jsx(Fragment,{children:jsx(Box,{component:"nav",className:"bespoke-nav",children:jsx(List,{sx:s=>({display:"flex",gap:s.spacing.md,justifyContent:o,listStyleType:"none"}),children:e?.map(s=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${s.id}`,"data-active":s.id===r,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(Ye,{...s.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:s.label}})]})})}),s?.children?.length?jsx(Menu.Dropdown,{children:i(s.children)}):null]})},s.id))})})})},Mw=({contentOutline:e,closeNav:t,showIcons:o})=>{let[r,n]=useState(null);return jsx(Stack,{className:"bespoke-MobileNav-accordion",children:e.map(i=>i.children.length?jsxs(Fragment,{children:[jsxs(Group,{className:"bespoke-MobileNav-group",gap:0,wrap:"nowrap",children:[jsx(UnstyledButton,{className:"bespoke-MobileNav-button",w:"100%",component:"a",onClick:t,href:`#bespoke-title-${i.id}`,children:jsxs(Group,{className:"bespoke-MobileNav-buttonContent",gap:"sm",wrap:"nowrap",children:[o&&jsx(Ye,{...i.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{className:"bespoke-MobileNav-buttonText",dangerouslySetInnerHTML:{__html:i.label}})]})},i.id),jsx(ActionIcon,{className:"bespoke-MobileNav-chevron",component:"a",size:"lg",onClick:()=>n(s=>s===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,{className:"bespoke-MobileNav-collapse",in:r===i.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(Mw,{contentOutline:i.children,closeNav:t,showIcons:o})})]}):jsx(Group,{className:"bespoke-MobileNav-group",wrap:"nowrap",children:jsx(UnstyledButton,{className:"bespoke-MobileNav-button",display:"flex",w:"100%",component:"a",href:`#bespoke-title-${i.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[o&&jsx(Ye,{...i.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:i.label}})]})},i.id)},i.id))})},HV=({contentOutline:e,showIcons:t,titleElement:o,wrapper:r})=>{let[n,{toggle:i}]=useDisclosure(false),s=n?"Close content outline":"Open content outline";return jsxs(Box,{className:"bespoke-MobileNav-root",component:"nav",children:[jsxs(r.element,{className:"bespoke-MobileNav-header",...r.props,onClick:i,children:[o&&o,jsx(ActionIcon,{className:"bespoke-MobileNav-toggle","aria-label":s,size:"lg",variant:"subtle",children:n?jsx(IconChevronUp,{size:"xl",stroke:1.5}):jsx(IconChevronDown,{size:"xl",stroke:1.5})})]}),jsx(Collapse,{in:n,mt:"md",className:"bespoke-MobileNav-body",children:jsx(Mw,{contentOutline:e,closeNav:i,showIcons:t})})]})},jV=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null),[i,s]=useState(null);useEffect(()=>{let a=()=>{let p=document.querySelector(".bespoke-nav");if(!p)return;let c=p.getBoundingClientRect(),d=false;e.forEach(m=>{let f=document.getElementById(`bespoke-title-${m.id}`);f&&(f.getBoundingClientRect().top<=c.bottom&&(n(m.id),s(null),d=true),m.children.forEach(h=>{let v=document.getElementById(`bespoke-title-${h.id}`);v&&v.getBoundingClientRect().top<=c.bottom&&(s(h.id),n(m.id),d=true);}));}),d||(n(null),s(null));};return window.addEventListener("scroll",a),()=>{window.removeEventListener("scroll",a);}},[e]);let l=a=>!a||!a?.length?null:jsx(Fragment,{children:a.map(p=>jsxs(Fragment$2,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${p.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(Ye,{...p.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:p.label}})]})})}),jsx(Box,{pl:"xs",children:l(p.children)})]},p.id))});return jsxs(Box,{component:"nav",className:"bespoke-Nav-root",children:[jsx(List,{className:"bespoke-Nav-level","data-level":"1",sx:Ew(o),children:e?.map(a=>jsx(List.Item,{className:"bespoke-Nav-levelItem",children:jsx(Anchor,{className:"bespoke-Nav-itemAnchor",href:`#bespoke-title-${a.id}`,"data-active":r===a.id,onClick:()=>n(a.id),children:jsxs(Group,{className:"bespoke-Nav-itemGroup",gap:"sm",wrap:"nowrap",children:[t&&jsx(Ye,{...a.iconProps,iconSize:"sm"}),jsx(Text,{className:"bespoke-Nav-itemLabel",dangerouslySetInnerHTML:{__html:a.label}})]})})},a.id))}),r&&e.find(a=>a.id===r)?.children.length>0&&jsx(List,{className:"bespoke-Nav-level","data-level":"2",sx:Ew(o),children:e.find(a=>a.id===r)?.children.map(a=>jsx(List.Item,{className:"bespoke-Nav-levelItem",children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{className:"bespoke-Nav-itemAnchor",href:`#bespoke-title-${a.id}`,"data-active":a.id===i,children:jsxs(Group,{className:"bespoke-Nav-itemGroup",gap:"sm",wrap:"nowrap",children:[t&&jsx(Ye,{...a.iconProps,iconSize:"sm"}),jsx(Text,{className:"bespoke-Nav-itemLabel",dangerouslySetInnerHTML:{__html:a.label}})]})})}),a?.children?.length?jsx(Menu.Dropdown,{className:"bespoke-Nav-levelMenuDropdown",children:l(a.children)}):null]})},a.id))})]})};});function Wg(e){let{related_reports:t,settings:o}=e,r=V(m=>m.status.currentLocale),n=V(m=>m.status.localeDefault),i=fa(),s=useRouter(),l=fr("components");if(!t?.length)return;let a=r===n?"":`/${r}`,p=m=>{s.push(`${m}`);},c=l?.ReportTile?l.ReportTile:Eg,d=No(o&&o.align?String(o.align):"center");return jsx(Grid,{className:"bespoke-Related-root",justify:d,children:t.map(m=>{let f=`${a}${i}${m.link}`,g=m.entities.map(C=>({original_id:C.id,name:C.name,id:C.content_id,variant:C.variant_name,variant_id:C.variant_id,dimension:C.dimension_name,dimension_id:C.dimension_id,image:{src:`/api/cms/member/image?member=${C.content_id}&size=thumb`,alt:C.name}})),h=m.entities.map(C=>C.id).join("-"),v=m.entities.map(C=>C.name).join(" & "),y=m.entities[0]?m.entities[0].report_id:null,S=C=>{C.preventDefault(),p(f);};return jsx(Grid.Col,{className:"bespoke-Related-col",xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(c,{reportId:y,reportName:v,members:g,href:f,onClick:S})},h)})})}var Nw=N(()=>{u();le();Te();Rg();co();lo();});function Kg({id:e,label:t,settings:o,showIcon:r,fullWidth:n,showWhenDisabled:i}){let s=tt(e).data,{sectionVariables:l,resetSectionVariables:a}=dt(s?.section_id),p=!!Object.keys(l).length,c=No(o&&o.align?o.align:"left");return !p&&!i?null:jsx(Button,{className:"bespoke-ResetButton-root",onClick:()=>a(),disabled:!p,fullWidth:n,sx:{justifySelf:c},children:jsxs(Group,{className:"bespoke-ResetButton-content",align:"center",children:[t,r&&jsx(IconRefresh,{className:"bespoke-ResetButton-icon"})]})})}var zw=N(()=>{u();Te();lo();});function qg({settings:e,label:t,removeLabel:o,showIcon:r,position:n="center",asComparison:i=false}){let s=V(C=>C.records.entities.report),l=V(C=>C.variables.attributes),a=e&&e.search?e.search:"inline",p=Object.values(s)[0].settings,c=useRouter(),{comparisonLoaded:d,loading:m}=$r(),f=Object.keys(c.query).includes("compare"),h=d&&f?jsx(Button,{onClick:()=>{let C={...c.query};delete C.compare,c.push({pathname:c.pathname,query:C},void 0,{shallow:true});},rightIcon:jsx(IconX,{}),children:o||"Remove Comparison"}):jsx(Button,{loading:m,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",r&&jsx(IconPlus,{})]})}),v={searchReportParams:{report:[Number(Object.keys(s)[0])],variant:p.compareLevels?[]:[l.variant_id1]}},S=Wa(h,a,C=>{c.push({pathname:c.pathname,query:{...c.query,compare:C.reportPath}});},v);return i?null:jsx(Group,{className:"bespoke-ComparisonButton-root",align:n,children:f?h:S})}var $w=N(()=>{u();co();le();hi();});function Xg({columns:e=[],data:t=[],tableProps:o={},sectionId:r=null}){let[n,i]=useState(false),s=useMemo(()=>e.map(d=>d.accessorKey),[e]),l=useMemo(()=>t.filter(d=>typeof d=="object"&&d!==null&&!Array.isArray(d)&&Object.keys(d).some(m=>s.includes(m))),[s,t]),a=useMemo(()=>e.map(d=>({...d,Cell:({renderedCellValue:m})=>jsx(xe,{html:`${m}`}),filterFn:"contains"})),[e]),p=Ht("table"),c={...MRT_Localization_EN,...p};return jsx(MantineReactTable,{className:"bespoke-Table-root",...o,autoResetPageIndex:false,columns:a,data:l,enableColumnFilterModes:true,enableFilterMatchHighlighting:false,globalFilterFn:"contains",layoutMode:"grid",localization:c,onIsFullScreenChange:d=>{let m=document.getElementById(`section-${r}`);m&&(d?m.style.zIndex="10":m.style.zIndex="1"),i(d);},state:{...o.state,isFullScreen:n}})}var Gw=N(()=>{u();ft();Ur();});function Jg({label:e,url:t,settings:o}){let{align:r}=o;return e?jsx(Group,{className:"bespoke-Button-root",align:r,grow:r==="justify",children:jsx(Button,{className:"bespoke-Button-button",component:"a",target:"_blank",href:t||"",children:e||"Button"})}):null}var jw=N(()=>{u();});function p$({block:e}){let{id:t}=e;return jsxs(Stack,{className:"bespoke-Fallback-root",align:"center",gap:"sm",children:[jsx(ThemeIcon,{className:"bespoke-Fallback-themeIcon",radius:"md",size:100,children:jsx(IconCircleKey,{size:100})}),jsxs(Title,{className:"bespoke-Fallback-title",order:5,children:["Private content (Block ",t,")"]}),jsx(Text,{className:"bespoke-Fallback-text",children:"Sorry, you do not have sufficient permissions to view this block."}),jsx(Text,{className:"bespoke-Fallback-text",children:"Contact your account manager to check your access role."})]})}function Qg(e){let t=u$();return jsx(t,{block:e})}var u$,qw=N(()=>{u();co();u$=()=>{let e=fr("components"),t=p$;return e?.CustomFallback&&(t=e.CustomFallback),t};});var Mn,Qu=N(()=>{u();Mn=class extends Component{constructor(t){super(t),this.state={hasError:false};}static getDerivedStateFromError(t){return console.info("getDerivedStateFromError",t),{hasError:true}}componentDidCatch(t,o){console.error("Error information:",o.componentStack),notifications.show({autoClose:false,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 Nc({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var Zg=N(()=>{u();});var Jw={};Dm(Jw,{default:()=>Xw});function Xw(e){let{print:t}=gr(),{block:o,active:r,locale:n,variables:i,configOverride:s={}}=e,l=Po(o),a=Mo(n),p={variables:i},c=useRouter(),{sectionVariables:d,setSectionVariables:m,resetSectionVariables:f}=dt(o.section_id),g=En(),h=JSON.stringify(d),v=useMemo(()=>{if(!l?.logic)return {error:"Add a Configuration"};let R=Ar({logic:l.logic},a,p).logic,L={router:c,section:{variables:d,setVariables:m,resetVariables:f}};return ys(R,a,i,n,o.id,{},L,g)},[o,r,i,h]),{type:y}=v.config||{},S=y&&eh[y]?y:"Treemap";eh[y]||(v.config={error:`"${y}" is not a valid Visualization Type`});let C=eh[S],b=useMemo(()=>{let{_data:R,...L}=v.config;return y$(L,t)},[v,t]),w={locale:n,variables:i,...b,...s},k=R=>{let L;try{L=v.dataFormat(R);}catch(I){console.error("Error in dataFormat: ",I),L=[];}return L};return jsx(Box,{className:"bespoke-Viz-root","data-ignore-print":w._printIgnore?"true":void 0,sx:{display:"flex",minHeight:y==="HTML"?void 0:400,"& .chart":{flex:"1 1 100%"}},children:jsx(Mn,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(C,{style:{flex:1},dataFormat:R=>{let L;try{L=v.dataFormat(R);}catch(I){console.error("Error in dataFormat: ",I),L=[];}return L},config:{...w,dataFormat:k,sectionVariables:h}},"viz-key")})})}var eh,y$,Qw=N(()=>{u();Ko();wc();qi();Te();Qu();Ln();Zg();eh={...g$,HTML:Nc},y$=(e,t)=>{let o={...e};return t&&(o.detectResize=false,o.detectResizeDelay=0,o.detectVisible=false,o.detectVisibleInterval=0,o.duration=0,o.shapeConfig={...o.shapeConfig,duration:0}),o};});var S$,Zw=N(()=>{u();he();ak();ck();uk();tw();iw();sw();aw();Cw();Bw();Nw();zw();$w();Gw();jw();qw();S$=v$(()=>Promise.resolve().then(()=>(Qw(),Jw)),{ssr:false}),{[E.PARAGRAPH]:mg,[E.STAT]:gg,[E.SUBTITLE]:hg,[E.TITLE]:Mg,[E.SELECTOR]:_g,[E.VIZ]:S$,[E.GENERATOR]:Uu,[E.SECTION_FLAG]:Uu,[E.IMAGE]:zg,[E.NAV]:Hg,[E.RELATED]:Wg,[E.RESET_BUTTON]:Kg,[E.COMPARISON_BUTTON]:qg,[E.TABLE]:Xg,[E.BUTTON]:Jg,[E.MULTIHIERARCHY_SELECTOR]:Gg,[E.FALLBACK]:Qg};});var Ti,ed=N(()=>{u();Ti={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 eE=N(()=>{u();he();Zw();Ya();Ko();Te();Zr();ca();Ql();of();nf();hi();Tc();ed();});var Ts,x$,td,_c=N(()=>{u();Ts={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"}]}},x$=Object.keys(Ts).reduce((e,t)=>(e[t]=Ts[t].defaultValue,e),{}),{memberImageBg:false,optionsMenu:false,optionData:true,optionImage:true,optionShare:true,showAnchor:false,...x$},td=e=>({data:typeof e.optionData=="boolean"?e.optionData:true,image:typeof e.optionImage=="boolean"?e.optionImage:true,share:typeof e.optionShare=="boolean"?e.optionShare:true});});function oh({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:true,gap: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 rh=N(()=>{u();});function nE(e){let{section:t}=e,o=t.blocks||[],r=V(ee=>o.map(J=>({...ee.records.entities.block[J],status:ee.variables.status[J]})).filter(J=>J.type===E.VIZ&&J.status.allowed)),{variant_slug1:n,slug1:i}=V(ee=>ee.variables.attributes),s=di(),[l,a]=useState(Hr.section),[p,c]=useState(jr.png),[d,m]=useState(false),[f,g]=useState(false),[h,v]=useState([]),[y,S]=useState(r.length>0?r[0].id:null),C=l!==Hr.section,{print:b,downloadLoading:w}=Pf(t.id,n,i,C?y:null),[k,R]=useState(true),[L,I]=useState(false),A=Ht("options"),M={...U$,...A.image_tab},{siteProps:D}=ba(),P=D?.logoSrc&&typeof D.logoSrc=="string",O=t?.settings?.name||`section-${t.id}`,B=`#${O}`,F=useMantineTheme(),z=()=>{let ee=j(y);return select(ee).select("svg").size()===1},G=()=>`${Bo(O)}`,U=()=>{let ee=document.getElementById(O);return select(ee).select(".bespoke-Section-content").node()},j=ee=>{let J=U();return select(J).select(`[data-block-type="visualization"][data-block-id="${ee}"]`).node()},H=()=>new Promise(ee=>{let J;l===Hr.section?J=U():l===Hr.viz&&(J=j(y));let Y=document.createElement("div");Y.style.display="flex",Y.style.justifyContent="space-between",Y.classList.add("bespoke-share-source"),Y.style.padding=F.spacing.xs,Y.style.width="100%";let q=document.createElement("div");if(q.innerText=M.source.replace("{src}",`${window.location}${B}`),q.style.fontSize=F.fontSizes.xs,Y.appendChild(q),P){let ie=document.createElement("img");ie.src=D.logoSrc,ie.style.height="30px",ie.onload=()=>ee(J),ie.onerror=()=>{ie.remove(),ee(J);},Y.appendChild(ie),J.appendChild(Y);}else J.appendChild(Y),ee(J);}),K=ee=>{if(k)return "transparent";let J=select(ee).style("background-color");return J!=="rgba(0, 0, 0, 0)"&&J!=="transparent"?J:ee===document.body?"white":K(ee.parentNode)},_=async(ee,J)=>{let{toPng:Y}=await import('html-to-image');Y(ee,{backgroundColor:J.background,cacheBust:true,filter:q=>q&&q.classList?!J.exclusionClasses.some(ie=>q.classList.contains(ie)):true}).then(q=>{let ie=document.createElement("a");ie.download=`${J.filename}.png`,ie.href=q,ie.click();}).catch(q=>{console.error("Error generating image",q);}).finally(()=>{$$(),m(false);});},Q=(ee,J)=>{saveElement(ee,{filename:J.filename,type:"svg",callback:()=>m(false)},{background:J.background});},ae=async()=>{m(true);let ee=await H(),J={background:K(ee),exclusionClasses:["export-hidden"],filename:G()},Y=p===jr.png?_:Q;try{if(ee)Y(ee,J);else throw new Error(M.wrong_node)}catch{m(false);}},oe=async()=>{let{toCanvas:ee}=await import('html-to-image');Promise.all(r.map(J=>{let Y=j(J.id),q=Y.querySelector("g.d3plus-geomap-tileGroup");q&&(q.style.display="none");let pe=select(Y).select("svg").select("g").size()>0?Y:G$();return ee(pe).then(de=>(q&&(q.style.display="block"),de))})).then(J=>{v(J.map(Y=>Y.toDataURL())),I(false);});};return useEffect(()=>{l===Hr.viz&&r.length>0?(S(r[0].id),I(true),oe()):l===Hr.section&&v([]);},[l]),useEffect(()=>{y&&(z()?g(true):(g(false),c(jr.png)));},[y]),jsxs(Stack,{className:"cms-section-options-image",children:[r.length>0?jsx(Input.Wrapper,{label:`${M.choose_area}:`,children:jsx(SegmentedControl,{fullWidth:true,value:l,data:[{value:Hr.section,label:jsxs(Center,{children:[jsx(IconTemplate,{size:"1rem"}),jsx(Box,{ml:10,children:M.entire_section})]})},{value:Hr.viz,label:jsxs(Center,{children:[jsx(IconChartBar,{size:"1rem"}),jsx(Box,{ml:10,children:M.viz_only})]})}],onChange:ee=>{a(ee),ee===Hr.section&&c(jr.png);}})}):jsx(Text,{fw:"700",color:"gray.7",children:`${M.entire_section}:`}),l===Hr.viz&&r.length>0&&jsxs(Input.Wrapper,{label:`${M.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((ee,J)=>jsx(Image,{alt:`Viz ${ee.id}`,onClick:()=>{S(ee.id);},style:{cursor:"pointer",border:y===ee.id?"4px solid #228be6":"4px solid #eee"},radius:0,src:h[J],styles:()=>({figure:{height:"100%"},imageWrapper:{height:"100%"}})},`viz-option-${ee.id}`))})}),jsx(LoadingOverlay,{visible:L})]}),f&&l!==Hr.section&&jsx(Input.Wrapper,{label:`${M.choose_format}:`,children:jsxs(Button.Group,{children:[jsx(Button,{leftSection:jsx(IconPolaroid,{size:16}),onClick:()=>c(jr.png),variant:p===jr.png?"filled":"default",fullWidth:true,children:jr.png}),jsx(Button,{leftSection:jsx(IconCode,{size:16}),onClick:()=>c(jr.svg),variant:p===jr.svg?"filled":"default",fullWidth:true,children:jr.svg})]})}),jsx(Checkbox,{checked:k,label:`${M.transparent_bg}`,onChange:()=>R(!k),radius:"xl"}),jsx(Button,{leftSection:jsx(IconDownload,{size:16}),loading:d||w,onClick:s&&p!==jr.svg?()=>b(k):ae,fullWidth:true,children:jsx("span",{children:d||w?M.processing:M.download.replace("{imageFormat}",p)})})]})}var Hr,jr,$$,U$,G$,iE=N(()=>{u();fi();le();Ur();Mt();lt();he();Hr={viz:"viz",section:"section"},jr={png:"PNG",svg:"SVG"},$$=()=>{let e=document.getElementsByClassName("bespoke-share-source");Array.from(e).forEach(t=>t.remove());},U$={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}"},G$=()=>document.createElement("div");});function aE(e){let{title:t,url:o,disabled:r=false}=e,n=r?IconCode:IconLink;return jsx(Input.Wrapper,{label:t,children:jsx(Input,{icon:jsx(n,{}),value:o,disabled:r,readOnly:true,rightSection:jsx(CopyButton,{value:o,timeout:2e3,children:({copied:i,copy:s})=>jsx(Tooltip,{label:i?"Copied":"Copy",withArrow:true,position:"right",children:jsx(ActionIcon,{variant:i?"filled":"subtle",onClick:s,disabled:r,children:i?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})})})}var lE=N(()=>{u();});function pE(e){let{section:t}=e,[o,r]=useState(""),[n,i]=useState(""),[s,l]=useState(true),a=Ht("options"),p={...gU,...a.share_tab};return useEffect(()=>{i(document.title);let{origin:c,pathname:d}=window.location,m=`${c}${d}`,f=s?t.settings?.name?.length?`#${Bo(t.settings.name)}`:`#section-${t.id}`:"";r(`${m}${f}`);},[s]),jsxs(Stack,{className:"cms-section-options-share",children:[jsx(aE,{title:`${p.title}: ${n}`,url:o}),jsx(Checkbox,{checked:s,label:p.include_section,onChange:()=>l(!s),radius:"xl"}),jsxs(Group,{justify:"center",children:[jsx(FacebookShareButton,{url:o,children:jsx(FacebookIcon,{size:32,round:true})}),jsx(TwitterShareButton,{url:o,title:n,children:jsx(TwitterIcon,{size:32,round:true})}),jsx(TelegramShareButton,{url:o,title:n,children:jsx(TelegramIcon,{size:32,round:true})}),jsx(WhatsappShareButton,{url:o,title:n,separator:":: ",children:jsx(WhatsappIcon,{size:32,round:true})}),jsx(LinkedinShareButton,{url:o,children:jsx(LinkedinIcon,{size:32,round:true})}),jsx(RedditShareButton,{url:o,title:n,windowWidth:660,windowHeight:460,children:jsx(RedditIcon,{size:32,round:true})}),jsx(EmailShareButton,{url:o,subject:n,children:jsx(EmailIcon,{size:32,round:true})})]})]})}var gU,uE=N(()=>{u();lE();Ur();fi();gU={title:"Title",include_section:"Include Section"};});function kU({panels:e,value:t,onTabChange:o}){let r=useRef(null),[n,i]=useState(false),[s,l]=useState(false),a=Object.keys(e),p=()=>{let d=r.current;if(!d)return;let{scrollLeft:m,scrollWidth:f,clientWidth:g}=d;i(m>0),l(m<f-g);};useEffect(()=>{let d=r.current;if(d)return p(),d.addEventListener("scroll",p),()=>{d.removeEventListener("scroll",p);}},[]);let c=d=>{let m=r.current;if(!m)return;let f=d==="left"?-150:150;m.scrollBy({left:f,behavior:"smooth"});};return jsxs(Box,{className:"bespoke-report-modal-tabs-container",pos:"relative",sx:{flexGrow:1,maxWidth:"calc(100% - 38px)"},children:[jsx(Box,{"data-direction":"left",display:n?"flex":"none",sx:mE,children:jsx(ActionIcon,{onClick:()=>c("left"),children:jsx(IconChevronLeft,{size:20})})}),jsx(Tabs,{ref:r,value:t,onChange:o,sx:TU,children:jsx(Tabs.List,{className:"bespoke-report-modal-tabs",sx:{flexWrap:"nowrap",width:"fit-content"},children:a.map(d=>jsx(Tabs.Tab,{className:"bespoke-report-modal-tab",value:d,children:e[d].label},d))})}),jsx(Box,{display:s?"flex":"none","data-direction":"right",sx:mE,children:jsx(ActionIcon,{onClick:()=>c("right"),children:jsx(IconChevronRight,{size:20})})})]})}function CU({className:e,opened:t,onClose:o,panels:r}){let[n,i]=useState(Object.keys(r)[0]);return jsxs(Modal.Root,{className:clsx("bespoke-report-modal",e),opened:t,onClose:o,size:"xl",centered:true,children:[jsx(Modal.Overlay,{className:"bespoke-report-modal-overlay"}),jsxs(Modal.Content,{children:[jsx(Modal.Header,{className:"bespoke-report-modal-header",children:jsxs(Group,{w:"100%",justify:"space-between",gap:"md",wrap:"nowrap",children:[jsx(kU,{panels:r,value:n,onTabChange:s=>s&&i(s)}),jsx(Modal.CloseButton,{className:"bespoke-report-modal-close-btn",ml:0})]})}),jsx(Modal.Body,{className:"bespoke-report-modal-body",children:r[n].component})]})]})}var TU,mE,ch,ph=N(()=>{u();TU={overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch",flexWrap:"nowrap"},mE={height:"100%",zIndex:1,top:0,width:50,position:"absolute",backgroundSize:"cover",display:"flex",alignItems:"center","&[data-direction='left']":{background:"linear-gradient(to right, rgba(255, 255, 255, 1) 15px, rgba(255, 255, 255, 0))",left:0,justifyContent:"flex-start"},"&[data-direction='right']":{background:"linear-gradient(to left, rgba(255, 255, 255, 1) 15px, rgba(255, 255, 255, 0))",right:0,justifyContent:"flex-end"}};ch=CU;});function fE(e){let{section:t,initialMode:o,onEnds:r,open:n,title:i}=e,s=td(t.settings),l=useMemo(()=>IU.filter(m=>s[m]),[s]),[a,p]=useState(o||l[0]||"data"),c=Ht("options");useEffect(()=>{o!==a&&p(o);},[o]);let d={...uh,...c};return jsx(ch,{className:"cms-section-options-modal",opened:n,onClose:()=>r(),panels:{data:{label:d.download_title,component:jsx(cC,{section:t})},image:{label:d.image_title,component:jsx(nE,{section:t})},share:{label:d.share_title,component:jsx(pE,{section:t})}}})}var uh,IU,gE=N(()=>{u();Cg();iE();uE();Ur();_c();ph();uh={download_title:"Download Data",image_title:"Save Image",share_title:"Share Link"},IU=["data","image","share"];});function dh(e){let{sectionId:t,disabled:o=false}=e,[r,n]=useState(false),[i,s]=useState("data"),l=qo(t),a=Ht("options"),p={...uh,...a},c=td(l.isSuccess?l.data.settings:{}),d=f=>{s(f),n(true);},m=()=>{n(false);};return jsxs("div",{className:"cms-section-options",children:[jsxs(Button.Group,{children:[c.data&&jsx(Button,{variant:"default",size:"compact-xs",onClick:()=>d("data"),"aria-label":p.download_title,disabled:o,children:jsx(IconTable,{size:16})}),c.image&&jsx(Button,{variant:"default",size:"compact-xs",onClick:()=>d("image"),"aria-label":p.image_title,disabled:o,children:jsx(IconCamera,{size:16})}),c.share&&jsx(Button,{variant:"default",size:"compact-xs",onClick:()=>d("share"),"aria-label":p.share_title,disabled:o,children:jsx(IconShare,{size:16})})]}),l.isSuccess&&jsx(fE,{section:l.data,initialMode:i,open:r,onEnds:m})]})}var mh=N(()=>{u();gE();le();Ur();_c();});function NU({children:e,containerProps:t,"data-section-id":o},r){return jsx(Flex,{ref:r,className:"bespoke-Section-content","data-section-id":o,pos:"relative",align:"stretch",p:0,direction:{base:"column",md:"row"},wrap:"wrap",...t,children:e})}var fh,SE,gh,hh=N(()=>{u();le();Rn();fh=vi__default.forwardRef(function({children:t,column:o,basis:r,columnSettings:n={},sx:i={},"data-section-id":s,...l},a){let p=Object.values(o).some(f=>f.settings?.display==="inline"),c=n?.width?`${n.width}px`:r,d=n?.width?`${n?.width}px`:"100%",m=n?.full?"100%":d;return jsx(Flex,{ref:a,className:"bespoke-Section-column","data-section-id":s,align:"flex-start",direction:p?"row":"column",wrap:p?"wrap":"nowrap",maw:{base:"100%",md:m},miw:{base:"none",md:300},p:0,pos:"relative",sx:[{flexGrow:1,flexShrink:n?.full?0:1,flexBasis:n?.full?"100%":c},...Array.isArray(i)?i:i?[i]:[]],...l,children:t})}),SE=({sectionId:e,columnIndex:t})=>{let o=re(),r=qo(e).data,{settings:n,updateSettings:i}=zr(e);if(!r)return null;let{columnSettings:s={}}=n,{width:l=void 0}=s[t]?s[t]:{},a=d=>{r&&i("columnSettings",{...s,[t]:{width:parseInt(d.target.value,10)}});},p=()=>{r&&o(Z.updateEntity("section",{id:e,settings:{...r.settings,columnSettings:{...s,[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",wrap:"nowrap",children:[jsx(Checkbox,{label:"100%",size:"xs",onChange:d=>{i("columnSettings",{...s,[t]:{...s[t]||{},full:d.currentTarget.checked}});},checked:s[t]?.full}),jsx(Input,{placeholder:"auto",w:"fit-content",miw:"none",variant:"filled",type:"number",value:l||"auto",maw:110,onChange:a,size:"xs",p:0,rightSection:jsx(IconX,{onClick:p,size:8})})]})},gh=vi__default.forwardRef(NU);});var xE=N(()=>{u();Ln();});var TE=N(()=>{u();le();Nr();eE();_c();Wo();rh();mh();co();he();hh();Ln();Ur();xE();hi();fi();Mt();da();co();});function Fo({target:e,dropdown:t}){let[o,{open:r,close:n}]=useDisclosure(false),i=useRef(true),s=()=>{setTimeout(()=>{i.current&&n();},1e3);},l=()=>{i.current=false;},a=()=>{i.current=true,n();};return jsxs(Group,{children:[e,jsxs(Popover,{opened:o,trapFocus:true,children:[jsx(Popover.Target,{children:jsx(ActionIcon,{variant:"subtle",color:"blue",onMouseEnter:r,onMouseLeave:s,children:jsx(IconInfoCircle,{})})}),jsx(Popover.Dropdown,{maw:350,onMouseEnter:l,onMouseLeave:a,children:jsxs(Group,{align:"flex-start",wrap:"nowrap",children:[jsx("div",{children:jsx(ThemeIcon,{variant:"outline",sx:{border:"none"},children:jsx(IconInfoCircle,{})})}),jsx("div",{children:t})]})})]})]})}var sd=N(()=>{u();});function Cs({value:e,onChange:t,item:o="block"}){let r=re(),[n,i]=useState([]),s=useMemo(()=>[{value:"public",label:`Public ${o}, (all visitors)`},{value:"guest",label:`Guest only ${o}, (non logged visitors)`},{value:"private",label:`Private ${o}, (session required, any role)`}],[o]),l=useMemo(()=>{let p=[{group:"Exclusive",items:s}],c=n.reduce((d,m)=>{let f=`${m.type} Roles`;return d[f]||(d[f]=[]),d[f].push({value:`role.${m.name}`,label:`Role ${m.name} (${m.type})`}),d},{});return Object.entries(c).forEach(([d,m])=>{p.push({group:d,items:m});}),p},[s,n]);useEffect(()=>{r(Z.searchRole()).then(p=>{i(p.roles);});},[r]);let a=p=>{let c=[];if(p.length===0)c=[s[0].value];else {let d=p.slice(-1)[0],m=s.map(g=>g.value);c=m.includes(d)?[d]:p.filter(g=>!m.includes(g));}t(c);};return jsx(MultiSelect,{label:"Privacy",description:`This ${o} will be shown based on the selected roles.`,data:l,value:e,onChange:a})}var ad=N(()=>{u();le();});function vh(){let e=eo(),t=Number.parseInt(e.params[0]),o=Vt(t).data,n=V(du).filter(D=>D.type===E.NAV),{settings:i,updateSettings:s}=pc(t),{handlers:l}=$t("reportEditor"),a=di(),p=o?.dimensions&&o.dimensions.length>0,c=nc(o?.dimensions||[]),d=useMemo(()=>c.isSuccess?c.data.flatMap(D=>D.variants||[]):[],[c.data,c.isSuccess]),m=ic(d),f=useMemo(()=>{if(!c.isSuccess||!m.isSuccess)return [];let D=c.data,P=m.data;return D.length===1?P.map(O=>({value:O.id.toString(),label:O.name,dimensionName:D[0].name})):D.length>1?D.map(F=>P.filter(z=>F.variants?.includes(z.id)||false)).reduce((F,z)=>F.flatMap(G=>z.map(U=>[...G,U])),[[]]).filter(F=>F.length>0).map(F=>({value:F.map(z=>z.id).join(","),label:F.map(z=>z.name).join(" / "),dimensionName:F.map((z,G)=>`${D[G]?.name}: ${z.name}`).join(" | ")})):[]},[c.data,c.isSuccess,m.data,m.isSuccess]),g=i.pdf?.variants||[],h=i.pdf?.privacy||["public"],v=i.pdf?.navBlockId||(n.length>0?n[0].id:""),y=!!i.pdf?.sectionSelection,S=D=>{s("pdf",{...i.pdf,enabled:true,variants:D});},C=D=>{s("pdf",{...i.pdf,enabled:true,privacy:D});},b=D=>{let P=n.length>0?n[0].id:void 0;s("pdf",{...i.pdf,sectionSelection:D,navBlockId:D?i.pdf?.navBlockId||P:void 0});},w=D=>{s("pdf",{...i.pdf,navBlockId:D?parseInt(D):void 0});},k=D=>{if(D){let P=f.map(O=>O.value);s("pdf",{enabled:true,variants:P,privacy:["public"]});}else s("pdf",{enabled:false,variants:[],privacy:[],sectionSelection:false,navBlockId:void 0});},R=i.xlsx?.variants||[],L=i.xlsx?.privacy||["public"],I=D=>{s("xlsx",{...i.xlsx,enabled:true,variants:D});},A=D=>{s("xlsx",{...i.xlsx,enabled:true,privacy:D});},M=D=>{if(D){let P=f.map(O=>O.value);s("xlsx",{enabled:true,variants:P,privacy:["public"]});}else s("xlsx",{enabled:false,variants:[],privacy:[]});};return jsx(Fragment,{children:jsxs(Stack,{children:[jsx(Button,{variant:"outline",radius:0,onClick:l.open,children:"Edit Report"}),p&&jsxs(Accordion,{children:[jsxs(Accordion.Item,{value:"comparison",children:[jsx(Accordion.Control,{children:"Profile Comparison"}),jsxs(Accordion.Panel,{children:[jsx(Fo,{target:jsx(Switch,{label:"Enable comparison",checked:!!i.comparison,onChange:D=>s("comparison",D.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"})]})}),i.comparison&&jsx(Fo,{target:jsx(Switch,{label:"With different levels",checked:!!i.compareLevels,onChange:D=>s("compareLevels",D.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(Tooltip,{label:"PDF Export is not configured",disabled:a,children:jsx("span",{children:jsx(Accordion.Control,{disabled:!a,children:"PDF Export"})})}),jsxs(Accordion.Panel,{children:[jsx(Fo,{target:jsx(Switch,{label:"Enable PDF export",checked:!!i.pdf?.enabled,onChange:D=>k(D.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."})]})}),i.pdf?.enabled&&jsxs(Stack,{mt:"md",children:[n.length>0&&jsxs(Fragment,{children:[jsx(Switch,{label:"Enable Section selection in PDF export",checked:y,onChange:D=>b(D.currentTarget.checked)}),y&&jsx(Select,{data:n.map(D=>({value:D.id.toString(),label:`Nav Block #${D.id}`})),label:"Select Navigation Block for PDF sections",description:"The PDF export selection should be based on a Navigation block.",placeholder:"Select Nav Block",ml:"xl",size:"xs",value:v.toString(),onChange:w})]}),jsx(Cs,{value:h,onChange:C,item:"PDF export"}),f.length>0&&jsxs(Fragment,{children:[jsx(Text,{fw:500,size:"sm",children:"Select variants to enable PDF export:"}),jsx(Checkbox.Group,{value:g,onChange:S,children:jsx(Stack,{spacing:"xs",children:f.map(D=>jsx(Checkbox,{value:D.value,label:D.label,description:D.dimensionName,size:"sm"},D.value))})})]})]})]})]}),jsxs(Accordion.Item,{value:"xlsx",children:[jsx(Accordion.Control,{children:"XLSX Export"}),jsxs(Accordion.Panel,{children:[jsx(Fo,{target:jsx(Switch,{label:"Enable XLSX export",checked:!!i.xlsx?.enabled,onChange:D=>M(D.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."})]})}),i.xlsx?.enabled&&jsxs(Stack,{mt:"md",children:[jsx(Cs,{value:L,onChange:A,item:"XLSX export"}),f.length>0&&jsxs(Fragment,{children:[jsx(Text,{fw:500,size:"sm",children:"Select variants to enable XLSX export:"}),jsx(Checkbox.Group,{value:R,onChange:I,children:jsx(Stack,{spacing:"xs",children:f.map(D=>jsx(Checkbox,{value:D.value,label:D.label,description:D.dimensionName,size:"sm"},D.value))})})]})]})]})]})]})]})})}var Sh=N(()=>{u();Te();Rn();sd();lt();ad();Nr();he();});var RE=N(()=>{u();Ur();_u();le();lt();co();Ca();ph();});var AE=N(()=>{u();});function gr(){let e=useContext(JU);if(e===void 0)throw new Error("usePrint must be used within a PrintContext");return e}var JU,Ln=N(()=>{u();le();Wo();TE();hi();_u();co();lt();Sh();RE();AE();JU=createContext({print:false,isEmbed:false});});function Gt(e){let{content:t,style:o={}}=e,{print:r}=gr(),n=jsx(xe,{component:"span",html:t,isPreview:true}),i=useMemo(()=>r?jsx("div",{className:"bespoke-InnerTooltip-root",children:jsx(Notification,{className:"bespoke-InnerTooltip-notification",icon:jsx(IconInfoCircle,{size:"1.1rem"}),withCloseButton:false,withBorder:true,styles:{root:{boxShadow:"none"}},children:n})},"tooltip-notification"):jsx("div",{className:"bespoke-InnerTooltip-root",style:o,children:jsx(Tooltip,{className:"bespoke-InnerTooltip-tooltip",label:n,withArrow:true,withinPortal:true,multiline:true,maw:220,children:jsx(ActionIcon,{className:"bespoke-InnerTooltip-icon",size:"1.5rem",children:jsx(IconInfoCircle,{})})})},"tooltip"),[r,t,o]);return jsx(Fragment,{children:i})}var Pn=N(()=>{u();Ln();ft();});function Th({paragraph:e,tooltip:t,settings:o}){return jsx(xe,{component:"p",html:e||`Lorem ipsum dolor sit amet,
41
+ color: hsl(${Math.max(0,Math.min(120-120*h,120))}deg 100% 31%);`,o?.key);}return (a=o?.onChange)==null||a.call(o,n),n}}function Gu(e,t){if(e===void 0)throw new Error(`Unexpected undefined${""}`);return e}var lw,cw,pw=N(()=>{u();lw=(e,t)=>Math.abs(e-t)<1,cw=(e,t,o)=>{let r;return function(...n){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,n),o);}};});function SV({measurements:e,outerSize:t,scrollOffset:o}){let r=e.length-1,i=gw(0,r,l=>e[l].start,o),s=i;for(;s<r&&e[s].end<o+t;)s++;return {startIndex:i,endIndex:s}}var bV,Pc,dw,uw,yV,mw,vV,fw,Hu,gw,Fg=N(()=>{u();pw();bV=e=>e,Pc=e=>{let t=Math.max(e.startIndex-e.overscan,0),o=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let n=t;n<=o;n++)r.push(n);return r},dw=(e,t)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let n=s=>{let{width:l,height:a}=s;t({width:Math.round(l),height:Math.round(a)});};if(n(o.getBoundingClientRect()),!r.ResizeObserver)return ()=>{};let i=new r.ResizeObserver(s=>{let l=s[0];if(l?.borderBoxSize){let a=l.borderBoxSize[0];if(a){n({width:a.inlineSize,height:a.blockSize});return}}n(o.getBoundingClientRect());});return i.observe(o,{box:"border-box"}),()=>{i.unobserve(o);}},uw={passive:true},yV=typeof window>"u"?true:"onscrollend"in window,mw=(e,t)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let n=0,i=e.options.useScrollendEvent&&yV?()=>{}:cw(r,()=>{t(n,false);},e.options.isScrollingResetDelay),s=p=>()=>{let{horizontal:c,isRtl:d}=e.options;n=c?o.scrollLeft*(d&&-1||1):o.scrollTop,i(),t(n,p);},l=s(true),a=s(false);return a(),o.addEventListener("scroll",l,uw),o.addEventListener("scrollend",a,uw),()=>{o.removeEventListener("scroll",l),o.removeEventListener("scrollend",a);}},vV=(e,t,o)=>{if(t?.borderBoxSize){let r=t.borderBoxSize[0];if(r)return Math.round(r[o.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[o.options.horizontal?"width":"height"])},fw=(e,{adjustments:t=0,behavior:o},r)=>{var n,i;let s=e+t;(i=(n=r.scrollElement)==null?void 0:n.scrollTo)==null||i.call(n,{[r.options.horizontal?"left":"top"]:s,behavior:o});},Hu=class{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=false,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let o=null,r=()=>o||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:o=new this.targetWindow.ResizeObserver(n=>{n.forEach(i=>{this._measureElement(i.target,i);});}));return {disconnect:()=>{var n;(n=r())==null||n.disconnect(),o=null;},observe:n=>{var i;return (i=r())==null?void 0:i.observe(n,{box:"border-box"})},unobserve:n=>{var i;return (i=r())==null?void 0:i.unobserve(n)}}})(),this.range=null,this.setOptions=o=>{Object.entries(o).forEach(([r,n])=>{typeof n>"u"&&delete o[r];}),this.options={debug:false,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:false,getItemKey:bV,rangeExtractor:Pc,onChange:()=>{},measureElement:vV,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:true,isRtl:false,useScrollendEvent:true,...o};},this.notify=o=>{var r,n;(n=(r=this.options).onChange)==null||n.call(r,this,o);},this.maybeNotify=Ss(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),o=>{this.notify(o);},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(o=>o()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null;},this._didMount=()=>()=>{this.cleanup();},this._willUpdate=()=>{var o;let r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((o=this.scrollElement)==null?void 0:o.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n);}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify();})),this.unsubs.push(this.options.observeElementOffset(this,(n,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<n?"forward":"backward":null,this.scrollOffset=n,this.isScrolling=i,this.maybeNotify();}));}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(o,r)=>{let n=new Map,i=new Map;for(let s=r-1;s>=0;s--){let l=o[s];if(n.has(l.lane))continue;let a=i.get(l.lane);if(a==null||l.end>a.end?i.set(l.lane,l):l.end<a.end&&n.set(l.lane,true),n.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((s,l)=>s.end===l.end?s.index-l.index:s.end-l.end)[0]:void 0},this.getMeasurementOptions=Ss(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(o,r,n,i,s)=>(this.pendingMeasuredCacheIndexes=[],{count:o,paddingStart:r,scrollMargin:n,getItemKey:i,enabled:s}),{key:false}),this.getMeasurements=Ss(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:o,paddingStart:r,scrollMargin:n,getItemKey:i,enabled:s},l)=>{if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(c=>{this.itemSizeCache.set(c.key,c.size);}));let a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];let p=this.measurementsCache.slice(0,a);for(let c=a;c<o;c++){let d=i(c),m=this.options.lanes===1?p[c-1]:this.getFurthestMeasurement(p,c),f=m?m.end+this.options.gap:r+n,g=l.get(d),h=typeof g=="number"?g:this.options.estimateSize(c),v=f+h,y=m?m.lane:c%this.options.lanes;p[c]={index:c,start:f,size:h,end:v,key:d,lane:y};}return this.measurementsCache=p,p},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Ss(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(o,r,n)=>this.range=o.length>0&&r>0?SV({measurements:o,outerSize:r,scrollOffset:n}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getIndexes=Ss(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(o,r,n,i)=>r===null?[]:o({startIndex:r.startIndex,endIndex:r.endIndex,overscan:n,count:i}),{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:()=>this.options.debug}),this.indexFromElement=o=>{let r=this.options.indexAttribute,n=o.getAttribute(r);return n?parseInt(n,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(o,r)=>{let n=this.indexFromElement(o),i=this.measurementsCache[n];if(!i)return;let s=i.key,l=this.elementsCache.get(s);l!==o&&(l&&this.observer.unobserve(l),this.observer.observe(o),this.elementsCache.set(s,o)),o.isConnected&&this.resizeItem(n,this.options.measureElement(o,r,this));},this.resizeItem=(o,r)=>{let n=this.measurementsCache[o];if(!n)return;let i=this.itemSizeCache.get(n.key)??n.size,s=r-i;s!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(n,s,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",s),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=s,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,r)),this.notify(false));},this.measureElement=o=>{if(!o){this.elementsCache.forEach((r,n)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(n));});return}this._measureElement(o,void 0);},this.getVirtualItems=Ss(()=>[this.getIndexes(),this.getMeasurements()],(o,r)=>{let n=[];for(let i=0,s=o.length;i<s;i++){let l=o[i],a=r[l];n.push(a);}return n},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=o=>{let r=this.getMeasurements();if(r.length!==0)return Gu(r[gw(0,r.length-1,n=>Gu(r[n]).start,o)])},this.getOffsetForAlignment=(o,r)=>{let n=this.getSize(),i=this.getScrollOffset();r==="auto"&&o>=i+n&&(r="end"),r==="end"&&(o-=n);let s=this.options.horizontal?"scrollWidth":"scrollHeight",a=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[s]:this.scrollElement[s]:0)-n;return Math.max(Math.min(a,o),0)},this.getOffsetForIndex=(o,r="auto")=>{o=Math.max(0,Math.min(o,this.options.count-1));let n=this.measurementsCache[o];if(!n)return;let i=this.getSize(),s=this.getScrollOffset();if(r==="auto")if(n.end>=s+i-this.options.scrollPaddingEnd)r="end";else if(n.start<=s+this.options.scrollPaddingStart)r="start";else return [s,r];let l=n.start-this.options.scrollPaddingStart+(n.size-i)/2;switch(r){case "center":return [this.getOffsetForAlignment(l,r),r];case "end":return [this.getOffsetForAlignment(n.end+this.options.scrollPaddingEnd,r),r];default:return [this.getOffsetForAlignment(n.start-this.options.scrollPaddingStart,r),r]}},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null);},this.scrollToOffset=(o,{align:r="start",behavior:n}={})=>{this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(o,r),{adjustments:void 0,behavior:n});},this.scrollToIndex=(o,{align:r="auto",behavior:n}={})=>{o=Math.max(0,Math.min(o,this.options.count-1)),this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");let i=this.getOffsetForIndex(o,r);if(!i)return;let[s,l]=i;this._scrollToOffset(s,{adjustments:void 0,behavior:n}),n!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(o))){let[p]=Gu(this.getOffsetForIndex(o,l));lw(p,this.getScrollOffset())||this.scrollToIndex(o,{align:l,behavior:n});}else this.scrollToIndex(o,{align:l,behavior:n});}));},this.scrollBy=(o,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+o,{adjustments:void 0,behavior:r});},this.getTotalSize=()=>{var o;let r=this.getMeasurements(),n;return r.length===0?n=this.options.paddingStart:n=this.options.lanes===1?((o=r[r.length-1])==null?void 0:o.end)??0:Math.max(...r.slice(-this.options.lanes).map(i=>i.end)),Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(o,{adjustments:r,behavior:n})=>{this.options.scrollToFn(o,{behavior:n,adjustments:r},this);},this.measure=()=>{this.itemSizeCache=new Map,this.notify(false);},this.setOptions(t);}},gw=(e,t,o,r)=>{for(;e<=t;){let n=(e+t)/2|0,i=o(n);if(i<r)e=n+1;else if(i>r)t=n-1;else return n}return e>0?e-1:0};});function TV(e){let t=vi.useReducer(()=>({}),{})[1],o={...e,onChange:(n,i)=>{var s;i?flushSync(t):t(),(s=e.onChange)==null||s.call(e,n,i);}},[r]=vi.useState(()=>new Hu(o));return r.setOptions(o),hw(()=>r._didMount(),[]),hw(()=>r._willUpdate()),r}function ju(e){return TV({observeElementRect:dw,observeElementOffset:mw,scrollToFn:fw,...e})}var hw,Vg=N(()=>{u();Fg();Fg();hw=typeof document<"u"?vi.useLayoutEffect:vi.useEffect;});function Gg(e){let{allLabel:t,asComparison:o,colorKey:r,data:n,defaultValue:i,defaultValueType:s,hideLabel:l,resetSectionVars:a,iconKey:p,id:c,levels:d,limit:m,placeholder:f,searchIndexKey:g,searchIndexSeparator:h,section:v,settings:y}=e,{print:S}=gr(),C=NV(c),b=zu(c,v,C,o,a==="true"),w=o?`${C}-valueCompare`:`${C}-value`,k=o?`${C}-typeCompare`:`${C}-type`,R=useMantineTheme(),{colorScheme:L}=useMantineColorScheme(),[I,A]=useState(false),[M,D]=useState(true),[P,O]=useState(""),[B,F]=useState(false),[z,G]=useState([""].slice(1)),[U,j]=useState([]),[H,K]=useState(""),_=y[Lt.DISABLED]||false,Q=useMemo(()=>S?Array.from(new Set(n.filter(te=>U.includes(te[`${H} ID`])))).map(te=>te?.[H]).join(", "):"",[S]),ae=l==="true"||!e.label?jsx(Fragment,{}):jsx(xe,{component:"div",html:e.label,size:"sm",style:y}),oe=useRef(null),ee=useRef(false),J=useRef(!!m&&m<U.length),Y=z.length,q=d[Y],ie=z.filter(Boolean);z.length>0&&ie.length===0&&ie.push(`${t} ${q?.label}`),useEffect(()=>{if(!_){let $=new URLSearchParams(window.location.search),te=$.get(w)||i,fe=$.get(k)||s;te&&fe?(j(_V(te,i)),K(fe)):(j([]),K(""));}},[window.location.search,i,s,_]),useEffect(()=>{let $=()=>{D(true);};return window.addEventListener("touchmove",$),()=>{window.removeEventListener("touchmove",$);}},[]);let pe=useMemo(()=>MV(n,d,r,p,g,h),[r,n,p,d,g,h]),de=useMemo(()=>{let $=BV(P),te=Array.from(DV(pe,$)).reverse();return B?te:z.reduce((fe,ve)=>fe.filter(Me=>!ve||Me.searchindex.indexOf(ve)>-1),te.filter(fe=>fe.type===q?.value))},[q,pe,P,B,z]),X=useRef(null),se=ju({count:I?de.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>X.current,[]),overscan:10,rangeExtractor:useCallback($=>Pc($),[])}),[be,Ce]=useState(-1),Ee=Math.min(be,de.length-1),Ge=useCallback($=>{let te=z.concat($);B&&F(false),G(te);},[B,z]),St=useCallback(()=>{let $=z.slice(0,Y-1);B&&F(false),G($);},[B,z,Y]),xt=useCallback($=>{O($.currentTarget.value),!J.current&&n.length>0&&A(true);},[n,O,J,A]),Rr=useCallback(()=>{O(""),b([],""),oe.current?.focus(),m&&(J.current=false);},[O,b,oe,m,J]),ho=useCallback($=>{let te=U.filter(fe=>fe!==$);te.length>0?b(te,H):b([],""),m&&te.length<m&&(J.current=false);},[U,H,b,m,J]),Ho=useCallback($=>{H!==$.type?b([$.value],$.type):U.includes($.value)?ho($.value):m?(U.length<m&&b([...U,$.value],H),U.length===m&&b([...U.slice(1),$.value],H)):b([...U,$.value],H),O("");},[b,H,U,ho,m]),Yn=useCallback(()=>{U.length>0&&P.length===0&&(b(U.slice(0,-1),H),A(true),m&&(J.current=false)),P.length>0&&O(P.slice(0,-1));},[b,U,H,P,O,A,m,J]),Xn=useCallback(()=>{D($=>$&&(ee.current=$,!$)),Ce($=>$+1>=de.length?$:$+1);},[Ce,de]),Jn=useCallback(()=>{let $=de[Ee];$&&Ho($);},[de,Ee,Ho]),Qn=useCallback(()=>{A(false);},[A]),Dl=useCallback(()=>{St(),Ce(0);},[Ce,St]),Nl=useCallback(()=>{let $=de[Ee];!B&&$&&$.type!==d[d.length-1]?.value&&(Ge($.name),Ce(0));},[de,Ee,B,d,Ce,Ge]),_l=useCallback(()=>{D($=>$&&(ee.current=$,!$)),Ce($=>$-1<0?0:$-1);},[Ce]),ne=({label:$,onRemove:te,...fe})=>jsxs("div",{className:"bespoke-MultiHierarchySelector-selectedItem",style:{alignItems:"center",backgroundColor:L==="dark"?"var(--mantine-color-dark-7)":"var(--mantine-color-gray-1)",borderRadius:R.radius.sm,cursor:"default",color:L==="dark"?"var(--mantine-color-dark-0)":"var(--mantine-color-gray-7)",display:"flex",fontSize:rem(12),fontWeight:500,height:rem(22),margin:`calc(${R.spacing.xs} / 2 - ${rem(2)}) calc(${R.spacing.xs} / 2)`,maxWidth:`calc(100% - ${rem(10)})`,paddingLeft:`calc(${R.spacing.sm} / 1.5)`,paddingRight:0,userSelect:"none"},...fe,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:$}),jsx(CloseButton,{className:"bespoke-MultiHierarchySelector-itemCloseButton","aria-hidden":true,iconSize:"70%",onMouseDown:te,radius:2,size:"sm",sx:{color:L==="dark"?"var(--mantine-color-dark-0)":"var(--mantine-color-gray-7)",marginLeft:`calc(${R.spacing.sm} / 6)`},tabIndex:-1})]}),Le=useMemo(()=>U.map($=>pe.find(te=>te.value===$)).filter($=>!!$).map(($,te)=>createElement(ne,{...$,index:te,label:$.label,key:$.value,onRemove:fe=>{fe.preventDefault(),fe.stopPropagation(),ho($.value);}})),[U]),W=forwardRef(function({color:te,icon:fe,label:ve,value:Me,...Yt},Zn){return jsx("div",{className:"bespoke-MultiHierarchySelector-item",ref:Zn,style:{cursor:"pointer",width:"100%"},...Yt,children:jsxs(Group,{className:"bespoke-MultiHierarchySelector-itemWrapper",align:"center",wrap:"nowrap",gap:"xs",w:"100%",children:[fe&&jsx(Box,{className:"bespoke-MultiHierarchySelector-itemIcon",bg:te??"transparent",component:"img",w:20,h:20,src:fe}),jsx(Text,{lineClamp:1,size:"sm",className:"bespoke-MultiHierarchySelector-itemLabel",children:ve||Me})]})})});return jsxs(Fragment,{children:[jsx("div",{className:"bespoke-MultiHierarchySelector-root no-print",children:jsx(Input.Wrapper,{className:"bespoke-MultiHierarchySelector-inputWrapper",label:ae,children:jsxs(Popover,{closeOnClickOutside:true,disabled:_,keepMounted:true,opened:I,onChange:A,onClose:()=>{Ce(0),O("");},onOpen:()=>{de.length>0&&se.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:true,children:[jsx(Popover.Target,{children:jsxs(Box,{className:"bespoke-MultiHierarchySelector-content","aria-haspopup":"listbox",component:"div",onMouseLeave:()=>Ce(0),sx:{position:"relative","& .defaultValue":{backgroundColor:L==="dark"?"var(--mantine-color-dark-5)":"var(--mantine-color-gray-3)",color:L==="dark"?"var(--mantine-color-dark-1)":"var(--mantine-color-gray-7)"}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:U.join(",")}),jsx(Input,{className:"bespoke-MultiHierarchySelector-input",component:"div",disabled:_,multiline:true,onMouseDown:$=>{$.preventDefault(),!J.current&&n.length>0&&A(!I),oe.current?.focus();},rightSection:U.length>0?jsx(CloseButton,{className:"bespoke-MultiHierarchySelector-closeButton",disabled:_,onClick:Rr,onMouseDown:$=>$.preventDefault(),variant:"transparent"}):jsx(IconSelector,{className:"bespoke-MultiHierarchySelector-icon",color:R.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{className:"bespoke-MultiHierarchySelector-selectedItems",component:"div","data-clearable":true,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${R.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:L==="dark"?"var(--mantine-color-dark-3)":"var(--mantine-color-gray-5)",opacity:1}},children:[Le,jsx("input",{className:"bespoke-MultiHierarchySelector-search",autoComplete:"off","data-mantine-stop-propagation":I,onChange:xt,onKeyDown:getHotkeyHandler([["ArrowDown",Xn],["ArrowLeft",Dl],["ArrowRight",Nl],["ArrowUp",_l],["Backspace",Yn],["Enter",Jn],["Escape",Qn]]),placeholder:U.length===0&&f||"",ref:oe,readOnly:J.current,style:{appearance:"none",backgroundColor:"transparent",border:0,color:"inherit",flex:1,fontSize:R.fontSizes.sm,marginLeft:`calc(${R.spacing.xs} / 2)`,maxHeight:rem(22),minWidth:rem(60),outline:0,padding:0},type:"search",value:P})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:$=>$.preventDefault(),p:0,children:jsx("div",{className:"bespoke-MultiHierarchySelector-dropdown",style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{className:"bespoke-MultiHierarchySelector-dropdownContent",component:"div","data-combobox-popover":true,onMouseDown:$=>$.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",gap:"xs",w:"100%",children:[d.length>1&&jsxs(Stack,{gap:"xs",children:[jsxs(Group,{onClick:$=>{$.stopPropagation();},px:"xs",justify:"center",gap:"xs",children:[jsx(Button,{onClick:()=>{Ce(0),F(true),G([]),de.length>0&&se.scrollToIndex(0);},size:"xs",variant:B?"filled":"outline",children:t}),d.map(($,te)=>jsx(Button,{onClick:()=>{B&&F(false);let fe=[""].slice(1),ve=te;for(;ve--;)fe[ve]=z[ve]||"";Ce(0),G(fe),de.length>0&&se.scrollToIndex(0);},size:"xs",variant:!B&&z.length===d.findIndex(fe=>fe.value===$?.value)?"filled":"outline",children:$?.label},$?.value))]}),jsx(Divider,{})]}),Y>0&&jsxs(Group,{align:"center",wrap:"nowrap",px:"xs",children:[jsx(ActionIcon,{onClick:St,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:ie.map($=>jsx(Text,{lineClamp:1,size:"xs",children:$},`${$}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>D(true),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:X,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${se.getTotalSize()}px`,position:"relative",width:"100%"},children:se.getVirtualItems().map($=>{let te=de[$.index],fe=Ee===$.index,ve=U.includes(te.value);return de.length>0&&fe&&!M&&se.scrollToIndex(Ee),jsxs(Group,{"aria-selected":fe,align:"center","data-hovered":fe||void 0,"data-index":$.index,"data-selected":ve,id:te.vale,wrap:"nowrap",onMouseEnter:Me=>{Me.preventDefault(),Me.stopPropagation(),M&&(Ce($.index),D(false));},onMouseMove:Me=>{Me.preventDefault(),Me.stopPropagation(),D(true);},onMouseDown:Me=>{Me.preventDefault(),Ho(te);},justify:"space-between",ref:se.measureElement,role:"option",gap:"xs",sx:Me=>({borderRadius:Me.radius.xs,padding:"15px 5px 15px",paddingLeft:B&&10*d.findIndex(Yt=>Yt?.value===te.type)||5,position:"absolute",top:0,left:0,height:`${$.size}px`,transform:`translateY(${$.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:L==="dark"?"var(--mantine-color-dark-4)":"var(--mantine-color-gray-1)"},"&:hover":{backgroundColor:L==="dark"?"var(--mantine-color-dark-4)":"var(--mantine-color-gray-1)"}}),tabIndex:-1,children:[jsx(W,{index:$.index,...te}),!B&&te.type!==d[d.length-1]?.value&&jsx(ActionIcon,{onMouseDown:Me=>{Me.preventDefault(),Me.stopPropagation(),Ge(te.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},te.value)})})})]})})})})]})})}),S&&jsxs(Text,{children:[ae,": ",Q]})]})}var MV,BV,DV,NV,_V,Cw=N(()=>{u();Vg();ft();Ln();co();he();MV=(e=[],t=[],o="",r="",n="",i="|")=>{let s=t.map(h=>h.value).slice(),l=`${s.pop()}`,a=h=>h[o],p=h=>h[r],c=h=>{if(h[n])return typeof h[n]=="string"?h[n].split(i):h[n]},d=new Set,m=[],f=[],g=nest().rollup(h=>{let v=h[0],y=I=>I&&I.value&&!d.has(I.value),S=s.map(I=>v[`${I} ID`]),C=s.map(I=>v[I]),b=s.map((I,A)=>{if(f[A]!==C[A]){f[A]=C[A];let M=a[A]||a[a.length-1]||a,D=p[A]||p[p.length-1]||p,P=c[A]||c[c.length-1]||c;return {color:M(v,I)||void 0,icon:D(v,I)||void 0,value:`${S[A]}`,label:C[A],name:C[A],type:I,searchindex:C.slice(0,A+1).concat(P(v,I)).join("|")}}return {}}).filter(y);b.forEach(I=>d.add(I.value));let w=a[a.length-1]||a,k=p[p.length-1]||p,R=c[c.length-1]||c,L=h.map(I=>({color:w(I,l)||void 0,icon:k(I,l)||void 0,value:`${I[`${l} ID`]}`,label:I[l],name:I[l],type:l,searchindex:C.concat(I[l]).concat(R(I,l)).join("|")}));m.push(...b.concat(L));});return s.forEach(h=>{g.key(v=>`${v[`${h} ID`]}|${v[h]}`);}),g.entries(e),m},BV=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},DV=(e,t)=>{let o=e.length,r,n=l=>r&&r.searchindex.includes(l.searchindex),s={next:()=>{for(let l=o-1;l>-1;l--){let a=e[l];if(t.test(`${a.value} ${a.label} ${a.searchindex}`)||n(a))return r=a,o=l,{done:false,value:a}}return {done:true,value:void 0}},[Symbol.iterator]:()=>s};return s},NV=e=>`multihierarchySelector${e}`,_V=(e,t)=>e&&typeof e=="string"?e.split(","):t;});function Hg({headings:e,settings:t,type:o,title:r,shortTitle:n,_iconType:i,_iconVariant:s,_icon:l,_iconRadius:a,_iconSize:p,_iconPadding:c}){let{min:d="1",max:m="6",icons:f="yes"}=t||{},g=us(parseInt(d,10),parseInt(m,10),e),h=f==="yes",v=We(r)||"",y=We(n||r)||"",S=v&&v.length>0,C=i&&i!=="none",w=`(max-width: ${useMantineTheme().breakpoints.md})`,k=useMediaQuery(w),R=k?y:v,L=t&&t.align?String(t.align):"left",I=Va(L),A=ao(L),M=No(L),D=t&&t.titlePosition?String(t.titlePosition):"left",P=useMemo(()=>{let z={right:"left",left:"right"},G=S&&["left","right"].includes(D),U={};if(G){let j=D==="right";U={gap:"xs",justify:j&&z[A]?z[A]:A,style:{flexDirection:j?"row-reverse":"row"},wrap:"nowrap"};}else U={gap:"xs",align:M,justify:"center",style:{flexDirection:D==="bottom"?"column-reverse":"column"}};return {element:G?Group:Stack,props:U}},[S,A,M,D]),O=useMemo(()=>S?jsxs(Group,{className:"bespoke-Nav-title",gap:"xs",justify:A,wrap:"nowrap",children:[C&&jsx(Ye,{blockType:"title",iconType:i,iconVariant:s,iconRadius:a,iconSize:p,icon:l,iconPadding:c}),jsx(xe,{className:"bespoke-Nav-titleText",style:{...t},html:R,lineClamp:1})]}):null,[S,C,A,R]),B=useMemo(()=>k?jsx(HV,{contentOutline:g,showIcons:h,titleElement:O,wrapper:P}):null,[k,O,P]),F=useMemo(()=>k?null:o==="multilevel"?jsx(jV,{contentOutline:g,showIcons:h,align:I}):jsx(GV,{contentOutline:g,showIcons:h,align:I}),[g,h,I,k]);return jsxs(Fragment,{children:[k&&B,!k&&jsxs(P.element,{className:"bespoke-Nav-root",pos:"relative",...P.props,children:[S&&O,F]})]})}var Ew,GV,Mw,HV,jV,Bw=N(()=>{u();co();On();lo();on();On();ft();Ew=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"}),GV=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null);useEffect(()=>{let s=()=>{let l=document.querySelector(".bespoke-Nav-root");if(!l)return;let a=l.getBoundingClientRect(),p=false;e.forEach(c=>{let d=document.getElementById(`bespoke-title-${c.id}`);d&&d.getBoundingClientRect().top<=a.bottom&&(n(c.id),p=true);}),p||n(null);};return window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s);}},[e]);let i=s=>!s||!s?.length?null:jsx(Fragment,{children:s.map(l=>jsxs(Fragment$2,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(Ye,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})}),jsx(Box,{pl:"xs",children:i(l.children)})]},l.id))});return jsx(Fragment,{children:jsx(Box,{component:"nav",className:"bespoke-nav",children:jsx(List,{sx:s=>({display:"flex",gap:s.spacing.md,justifyContent:o,listStyleType:"none"}),children:e?.map(s=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${s.id}`,"data-active":s.id===r,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(Ye,{...s.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:s.label}})]})})}),s?.children?.length?jsx(Menu.Dropdown,{children:i(s.children)}):null]})},s.id))})})})},Mw=({contentOutline:e,closeNav:t,showIcons:o})=>{let[r,n]=useState(null);return jsx(Stack,{className:"bespoke-MobileNav-accordion",children:e.map(i=>i.children.length?jsxs(Fragment,{children:[jsxs(Group,{className:"bespoke-MobileNav-group",gap:0,wrap:"nowrap",children:[jsx(UnstyledButton,{className:"bespoke-MobileNav-button",w:"100%",component:"a",onClick:t,href:`#bespoke-title-${i.id}`,children:jsxs(Group,{className:"bespoke-MobileNav-buttonContent",gap:"sm",wrap:"nowrap",children:[o&&jsx(Ye,{...i.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{className:"bespoke-MobileNav-buttonText",dangerouslySetInnerHTML:{__html:i.label}})]})},i.id),jsx(ActionIcon,{className:"bespoke-MobileNav-chevron",component:"a",size:"lg",onClick:()=>n(s=>s===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,{className:"bespoke-MobileNav-collapse",in:r===i.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(Mw,{contentOutline:i.children,closeNav:t,showIcons:o})})]}):jsx(Group,{className:"bespoke-MobileNav-group",wrap:"nowrap",children:jsx(UnstyledButton,{className:"bespoke-MobileNav-button",display:"flex",w:"100%",component:"a",href:`#bespoke-title-${i.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[o&&jsx(Ye,{...i.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:i.label}})]})},i.id)},i.id))})},HV=({contentOutline:e,showIcons:t,titleElement:o,wrapper:r})=>{let[n,{toggle:i}]=useDisclosure(false),s=n?"Close content outline":"Open content outline";return jsxs(Box,{className:"bespoke-MobileNav-root",component:"nav",children:[jsxs(r.element,{className:"bespoke-MobileNav-header",...r.props,onClick:i,children:[o&&o,jsx(ActionIcon,{className:"bespoke-MobileNav-toggle","aria-label":s,size:"lg",variant:"subtle",children:n?jsx(IconChevronUp,{size:"xl",stroke:1.5}):jsx(IconChevronDown,{size:"xl",stroke:1.5})})]}),jsx(Collapse,{in:n,mt:"md",className:"bespoke-MobileNav-body",children:jsx(Mw,{contentOutline:e,closeNav:i,showIcons:t})})]})},jV=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null),[i,s]=useState(null);useEffect(()=>{let a=()=>{let p=document.querySelector(".bespoke-nav");if(!p)return;let c=p.getBoundingClientRect(),d=false;e.forEach(m=>{let f=document.getElementById(`bespoke-title-${m.id}`);f&&(f.getBoundingClientRect().top<=c.bottom&&(n(m.id),s(null),d=true),m.children.forEach(h=>{let v=document.getElementById(`bespoke-title-${h.id}`);v&&v.getBoundingClientRect().top<=c.bottom&&(s(h.id),n(m.id),d=true);}));}),d||(n(null),s(null));};return window.addEventListener("scroll",a),()=>{window.removeEventListener("scroll",a);}},[e]);let l=a=>!a||!a?.length?null:jsx(Fragment,{children:a.map(p=>jsxs(Fragment$2,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${p.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(Ye,{...p.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:p.label}})]})})}),jsx(Box,{pl:"xs",children:l(p.children)})]},p.id))});return jsxs(Box,{component:"nav",className:"bespoke-Nav-root",children:[jsx(List,{className:"bespoke-Nav-level","data-level":"1",sx:Ew(o),children:e?.map(a=>jsx(List.Item,{className:"bespoke-Nav-levelItem",children:jsx(Anchor,{className:"bespoke-Nav-itemAnchor",href:`#bespoke-title-${a.id}`,"data-active":r===a.id,onClick:()=>n(a.id),children:jsxs(Group,{className:"bespoke-Nav-itemGroup",gap:"sm",wrap:"nowrap",children:[t&&jsx(Ye,{...a.iconProps,iconSize:"sm"}),jsx(Text,{className:"bespoke-Nav-itemLabel",dangerouslySetInnerHTML:{__html:a.label}})]})})},a.id))}),r&&e.find(a=>a.id===r)?.children.length>0&&jsx(List,{className:"bespoke-Nav-level","data-level":"2",sx:Ew(o),children:e.find(a=>a.id===r)?.children.map(a=>jsx(List.Item,{className:"bespoke-Nav-levelItem",children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{className:"bespoke-Nav-itemAnchor",href:`#bespoke-title-${a.id}`,"data-active":a.id===i,children:jsxs(Group,{className:"bespoke-Nav-itemGroup",gap:"sm",wrap:"nowrap",children:[t&&jsx(Ye,{...a.iconProps,iconSize:"sm"}),jsx(Text,{className:"bespoke-Nav-itemLabel",dangerouslySetInnerHTML:{__html:a.label}})]})})}),a?.children?.length?jsx(Menu.Dropdown,{className:"bespoke-Nav-levelMenuDropdown",children:l(a.children)}):null]})},a.id))})]})};});function Wg(e){let{related_reports:t,settings:o}=e,r=V(m=>m.status.currentLocale),n=V(m=>m.status.localeDefault),i=fa(),s=useRouter(),l=fr("components");if(!t?.length)return;let a=r===n?"":`/${r}`,p=m=>{s.push(`${m}`);},c=l?.ReportTile?l.ReportTile:Eg,d=No(o&&o.align?String(o.align):"center");return jsx(Grid,{className:"bespoke-Related-root",justify:d,children:t.map(m=>{let f=`${a}${i}${m.link}`,g=m.entities.map(C=>({original_id:C.id,name:C.name,id:C.content_id,variant:C.variant_name,variant_id:C.variant_id,dimension:C.dimension_name,dimension_id:C.dimension_id,image:{src:`/api/cms/member/image?member=${C.content_id}&size=thumb`,alt:C.name}})),h=m.entities.map(C=>C.id).join("-"),v=m.entities.map(C=>C.name).join(" & "),y=m.entities[0]?m.entities[0].report_id:null,S=C=>{C.preventDefault(),p(f);};return jsx(Grid.Col,{className:"bespoke-Related-col",xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(c,{reportId:y,reportName:v,members:g,href:f,onClick:S})},h)})})}var Nw=N(()=>{u();le();Te();Rg();co();lo();});function Kg({id:e,label:t,settings:o,showIcon:r,fullWidth:n,showWhenDisabled:i}){let s=tt(e).data,{sectionVariables:l,resetSectionVariables:a}=dt(s?.section_id),p=!!Object.keys(l).length,c=No(o&&o.align?o.align:"left");return !p&&!i?null:jsx(Button,{className:"bespoke-ResetButton-root",onClick:()=>a(),disabled:!p,fullWidth:n,sx:{justifySelf:c},children:jsxs(Group,{className:"bespoke-ResetButton-content",align:"center",children:[t,r&&jsx(IconRefresh,{className:"bespoke-ResetButton-icon"})]})})}var zw=N(()=>{u();Te();lo();});function qg({settings:e,label:t,removeLabel:o,showIcon:r,position:n="center",asComparison:i=false}){let s=V(C=>C.records.entities.report),l=V(C=>C.variables.attributes),a=e&&e.search?e.search:"inline",p=Object.values(s)[0].settings,c=useRouter(),{comparisonLoaded:d,loading:m}=$r(),f=Object.keys(c.query).includes("compare"),h=d&&f?jsx(Button,{onClick:()=>{let C={...c.query};delete C.compare,c.push({pathname:c.pathname,query:C},void 0,{shallow:true});},rightIcon:jsx(IconX,{}),children:o||"Remove Comparison"}):jsx(Button,{loading:m,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",r&&jsx(IconPlus,{})]})}),v={searchReportParams:{report:[Number(Object.keys(s)[0])],variant:p.compareLevels?[]:[l.variant_id1]}},S=Wa(h,a,C=>{c.push({pathname:c.pathname,query:{...c.query,compare:C.reportPath}});},v);return i?null:jsx(Group,{className:"bespoke-ComparisonButton-root",align:n,children:f?h:S})}var $w=N(()=>{u();co();le();hi();});function Xg({columns:e=[],data:t=[],tableProps:o={},sectionId:r=null}){let[n,i]=useState(false),s=useMemo(()=>e.map(d=>d.accessorKey),[e]),l=useMemo(()=>t.filter(d=>typeof d=="object"&&d!==null&&!Array.isArray(d)&&Object.keys(d).some(m=>s.includes(m))),[s,t]),a=useMemo(()=>e.map(d=>({...d,Cell:({renderedCellValue:m})=>jsx(xe,{html:`${m}`}),filterFn:"contains"})),[e]),p=Ht("table"),c={...MRT_Localization_EN,...p};return jsx(MantineReactTable,{className:"bespoke-Table-root",...o,autoResetPageIndex:false,columns:a,data:l,enableColumnFilterModes:true,enableFilterMatchHighlighting:false,globalFilterFn:"contains",layoutMode:"grid",localization:c,onIsFullScreenChange:d=>{let m=document.getElementById(`section-${r}`);m&&(d?m.style.zIndex="10":m.style.zIndex="1"),i(d);},state:{...o.state,isFullScreen:n}})}var Gw=N(()=>{u();ft();Ur();});function Jg({label:e,url:t,settings:o}){let{align:r}=o;return e?jsx(Group,{className:"bespoke-Button-root",align:r,grow:r==="justify",children:jsx(Button,{className:"bespoke-Button-button",component:"a",target:"_blank",href:t||"",children:e||"Button"})}):null}var jw=N(()=>{u();});function p$({block:e}){let{id:t}=e;return jsxs(Stack,{className:"bespoke-Fallback-root",align:"center",gap:"sm",children:[jsx(ThemeIcon,{className:"bespoke-Fallback-themeIcon",radius:"md",size:100,children:jsx(IconCircleKey,{size:100})}),jsxs(Title,{className:"bespoke-Fallback-title",order:5,children:["Private content (Block ",t,")"]}),jsx(Text,{className:"bespoke-Fallback-text",children:"Sorry, you do not have sufficient permissions to view this block."}),jsx(Text,{className:"bespoke-Fallback-text",children:"Contact your account manager to check your access role."})]})}function Qg(e){let t=u$();return jsx(t,{block:e})}var u$,qw=N(()=>{u();co();u$=()=>{let e=fr("components"),t=p$;return e?.CustomFallback&&(t=e.CustomFallback),t};});var Mn,Qu=N(()=>{u();Mn=class extends Component{constructor(t){super(t),this.state={hasError:false};}static getDerivedStateFromError(t){return console.info("getDerivedStateFromError",t),{hasError:true}}componentDidCatch(t,o){console.error("Error information:",o.componentStack),notifications.show({autoClose:false,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 Nc({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var Zg=N(()=>{u();});var Jw={};Dm(Jw,{default:()=>Xw});function Xw(e){let{print:t}=gr(),{block:o,active:r,locale:n,variables:i,configOverride:s={}}=e,l=Po(o),a=Mo(n),p={variables:i},c=useRouter(),{sectionVariables:d,setSectionVariables:m,resetSectionVariables:f}=dt(o.section_id),g=En(),h=JSON.stringify(d),v=useMemo(()=>{if(!l?.logic)return {error:"Add a Configuration"};let R=Ar({logic:l.logic},a,p).logic,L={router:c,section:{variables:d,setVariables:m,resetVariables:f}};return ys(R,a,i,n,o.id,{},L,g)},[o,r,i,h]),{type:y}=v.config||{},S=y&&eh[y]?y:"Treemap";eh[y]||(v.config={error:`"${y}" is not a valid Visualization Type`});let C=eh[S],b=useMemo(()=>{let{_data:R,...L}=v.config;return y$(L,t)},[v,t]),w={locale:n,variables:i,...b,...s},k=R=>{let L;try{L=v.dataFormat(R);}catch(I){console.error("Error in dataFormat: ",I),L=[];}return L};return jsx(Box,{className:"bespoke-Viz-root","data-ignore-print":w._printIgnore?"true":void 0,sx:{display:"flex",minHeight:y==="HTML"?void 0:400,"& .chart":{flex:"1 1 100%"}},children:jsx(Mn,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(C,{style:{flex:1},dataFormat:R=>{let L;try{L=v.dataFormat(R);}catch(I){console.error("Error in dataFormat: ",I),L=[];}return L},config:{...w,dataFormat:k,sectionVariables:h}},"viz-key")})})}var eh,y$,Qw=N(()=>{u();Ko();wc();qi();Te();Qu();Ln();Zg();eh={...g$,HTML:Nc},y$=(e,t)=>{let o={...e};return t&&(o.detectResize=false,o.detectResizeDelay=0,o.detectVisible=false,o.detectVisibleInterval=0,o.duration=0,o.shapeConfig={...o.shapeConfig,duration:0}),o};});var S$,Zw=N(()=>{u();he();ak();ck();uk();tw();iw();sw();aw();Cw();Bw();Nw();zw();$w();Gw();jw();qw();S$=v$(()=>Promise.resolve().then(()=>(Qw(),Jw)),{ssr:false}),{[E.PARAGRAPH]:mg,[E.STAT]:gg,[E.SUBTITLE]:hg,[E.TITLE]:Mg,[E.SELECTOR]:_g,[E.VIZ]:S$,[E.GENERATOR]:Uu,[E.SECTION_FLAG]:Uu,[E.IMAGE]:zg,[E.NAV]:Hg,[E.RELATED]:Wg,[E.RESET_BUTTON]:Kg,[E.COMPARISON_BUTTON]:qg,[E.TABLE]:Xg,[E.BUTTON]:Jg,[E.MULTIHIERARCHY_SELECTOR]:Gg,[E.FALLBACK]:Qg};});var Ti,ed=N(()=>{u();Ti={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 eE=N(()=>{u();he();Zw();Ya();Ko();Te();Zr();ca();Ql();of();nf();hi();Tc();ed();});var Ts,x$,td,_c=N(()=>{u();Ts={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"}]}},x$=Object.keys(Ts).reduce((e,t)=>(e[t]=Ts[t].defaultValue,e),{}),{memberImageBg:false,optionsMenu:false,optionData:true,optionImage:true,optionShare:true,showAnchor:false,...x$},td=e=>({data:typeof e.optionData=="boolean"?e.optionData:true,image:typeof e.optionImage=="boolean"?e.optionImage:true,share:typeof e.optionShare=="boolean"?e.optionShare:true});});function oh({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:true,gap: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 rh=N(()=>{u();});function nE(e){let{section:t}=e,o=t.blocks||[],r=V(ee=>o.map(J=>({...ee.records.entities.block[J],status:ee.variables.status[J]})).filter(J=>J.type===E.VIZ&&J.status.allowed)),{variant_slug1:n,slug1:i}=V(ee=>ee.variables.attributes),s=di(),[l,a]=useState(Hr.section),[p,c]=useState(jr.png),[d,m]=useState(false),[f,g]=useState(false),[h,v]=useState([]),[y,S]=useState(r.length>0?r[0].id:null),C=l!==Hr.section,{print:b,downloadLoading:w}=Pf(t.id,n,i,C?y:null),[k,R]=useState(true),[L,I]=useState(false),A=Ht("options"),M={...U$,...A.image_tab},{siteProps:D}=ba(),P=D?.logoSrc&&typeof D.logoSrc=="string",O=t?.settings?.name||`section-${t.id}`,B=`#${O}`,F=useMantineTheme(),z=()=>{let ee=j(y);return select(ee).select("svg").size()===1},G=()=>`${Bo(O)}`,U=()=>{let ee=document.getElementById(O);return select(ee).select(".bespoke-Section-content").node()},j=ee=>{let J=U();return select(J).select(`[data-block-type="visualization"][data-block-id="${ee}"]`).node()},H=()=>new Promise(ee=>{let J;l===Hr.section?J=U():l===Hr.viz&&(J=j(y));let Y=document.createElement("div");Y.style.display="flex",Y.style.justifyContent="space-between",Y.classList.add("bespoke-share-source"),Y.style.padding=F.spacing.xs,Y.style.width="100%";let q=document.createElement("div");if(q.innerText=M.source.replace("{src}",`${window.location}${B}`),q.style.fontSize=F.fontSizes.xs,Y.appendChild(q),P){let ie=document.createElement("img");ie.src=D.logoSrc,ie.style.height="30px",ie.onload=()=>ee(J),ie.onerror=()=>{ie.remove(),ee(J);},Y.appendChild(ie),J.appendChild(Y);}else J.appendChild(Y),ee(J);}),K=ee=>{if(k)return "transparent";let J=select(ee).style("background-color");return J!=="rgba(0, 0, 0, 0)"&&J!=="transparent"?J:ee===document.body?"white":K(ee.parentNode)},_=async(ee,J)=>{let{toPng:Y}=await import('html-to-image');Y(ee,{backgroundColor:J.background,cacheBust:true,filter:q=>q&&q.classList?!J.exclusionClasses.some(ie=>q.classList.contains(ie)):true}).then(q=>{let ie=document.createElement("a");ie.download=`${J.filename}.png`,ie.href=q,ie.click();}).catch(q=>{console.error("Error generating image",q);}).finally(()=>{$$(),m(false);});},Q=(ee,J)=>{saveElement(ee,{filename:J.filename,type:"svg",callback:()=>m(false)},{background:J.background});},ae=async()=>{m(true);let ee=await H(),J={background:K(ee),exclusionClasses:["export-hidden"],filename:G()},Y=p===jr.png?_:Q;try{if(ee)Y(ee,J);else throw new Error(M.wrong_node)}catch{m(false);}},oe=async()=>{let{toCanvas:ee}=await import('html-to-image');Promise.all(r.map(J=>{let Y=j(J.id),q=Y.querySelector("g.d3plus-geomap-tileGroup");q&&(q.style.display="none");let pe=select(Y).select("svg").select("g").size()>0?Y:G$();return ee(pe).then(de=>(q&&(q.style.display="block"),de))})).then(J=>{v(J.map(Y=>Y.toDataURL())),I(false);});};return useEffect(()=>{l===Hr.viz&&r.length>0?(S(r[0].id),I(true),oe()):l===Hr.section&&v([]);},[l]),useEffect(()=>{y&&(z()?g(true):(g(false),c(jr.png)));},[y]),jsxs(Stack,{className:"cms-section-options-image",children:[r.length>0?jsx(Input.Wrapper,{label:`${M.choose_area}:`,children:jsx(SegmentedControl,{fullWidth:true,value:l,data:[{value:Hr.section,label:jsxs(Center,{children:[jsx(IconTemplate,{size:"1rem"}),jsx(Box,{ml:10,children:M.entire_section})]})},{value:Hr.viz,label:jsxs(Center,{children:[jsx(IconChartBar,{size:"1rem"}),jsx(Box,{ml:10,children:M.viz_only})]})}],onChange:ee=>{a(ee),ee===Hr.section&&c(jr.png);}})}):jsx(Text,{fw:"700",color:"gray.7",children:`${M.entire_section}:`}),l===Hr.viz&&r.length>0&&jsxs(Input.Wrapper,{label:`${M.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((ee,J)=>jsx(Image,{alt:`Viz ${ee.id}`,onClick:()=>{S(ee.id);},style:{cursor:"pointer",border:y===ee.id?"4px solid #228be6":"4px solid #eee"},radius:0,src:h[J],styles:()=>({figure:{height:"100%"},imageWrapper:{height:"100%"}})},`viz-option-${ee.id}`))})}),jsx(LoadingOverlay,{visible:L})]}),f&&l!==Hr.section&&jsx(Input.Wrapper,{label:`${M.choose_format}:`,children:jsxs(Button.Group,{children:[jsx(Button,{leftSection:jsx(IconPolaroid,{size:16}),onClick:()=>c(jr.png),variant:p===jr.png?"filled":"default",fullWidth:true,children:jr.png}),jsx(Button,{leftSection:jsx(IconCode,{size:16}),onClick:()=>c(jr.svg),variant:p===jr.svg?"filled":"default",fullWidth:true,children:jr.svg})]})}),jsx(Checkbox,{checked:k,label:`${M.transparent_bg}`,onChange:()=>R(!k),radius:"xl"}),jsx(Button,{leftSection:jsx(IconDownload,{size:16}),loading:d||w,onClick:s&&p!==jr.svg?()=>b(k):ae,fullWidth:true,children:jsx("span",{children:d||w?M.processing:M.download.replace("{imageFormat}",p)})})]})}var Hr,jr,$$,U$,G$,iE=N(()=>{u();fi();le();Ur();Mt();lt();he();Hr={viz:"viz",section:"section"},jr={png:"PNG",svg:"SVG"},$$=()=>{let e=document.getElementsByClassName("bespoke-share-source");Array.from(e).forEach(t=>t.remove());},U$={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}"},G$=()=>document.createElement("div");});function aE(e){let{title:t,url:o,disabled:r=false}=e,n=r?IconCode:IconLink;return jsx(Input.Wrapper,{label:t,children:jsx(Input,{icon:jsx(n,{}),value:o,disabled:r,readOnly:true,rightSection:jsx(CopyButton,{value:o,timeout:2e3,children:({copied:i,copy:s})=>jsx(Tooltip,{label:i?"Copied":"Copy",withArrow:true,position:"right",children:jsx(ActionIcon,{variant:i?"filled":"subtle",onClick:s,disabled:r,children:i?jsx(IconClipboardCheck,{size:16}):jsx(IconClipboardCopy,{size:16})})})})})})}var lE=N(()=>{u();});function pE(e){let{section:t}=e,[o,r]=useState(""),[n,i]=useState(""),[s,l]=useState(true),a=Ht("options"),p={...gU,...a.share_tab};return useEffect(()=>{i(document.title);let{origin:c,pathname:d}=window.location,m=`${c}${d}`,f=s?t.settings?.name?.length?`#${Bo(t.settings.name)}`:`#section-${t.id}`:"";r(`${m}${f}`);},[s]),jsxs(Stack,{className:"cms-section-options-share",children:[jsx(aE,{title:`${p.title}: ${n}`,url:o}),jsx(Checkbox,{checked:s,label:p.include_section,onChange:()=>l(!s),radius:"xl"}),jsxs(Group,{justify:"center",children:[jsx(FacebookShareButton,{url:o,children:jsx(FacebookIcon,{size:32,round:true})}),jsx(TwitterShareButton,{url:o,title:n,children:jsx(TwitterIcon,{size:32,round:true})}),jsx(TelegramShareButton,{url:o,title:n,children:jsx(TelegramIcon,{size:32,round:true})}),jsx(WhatsappShareButton,{url:o,title:n,separator:":: ",children:jsx(WhatsappIcon,{size:32,round:true})}),jsx(LinkedinShareButton,{url:o,children:jsx(LinkedinIcon,{size:32,round:true})}),jsx(RedditShareButton,{url:o,title:n,windowWidth:660,windowHeight:460,children:jsx(RedditIcon,{size:32,round:true})}),jsx(EmailShareButton,{url:o,subject:n,children:jsx(EmailIcon,{size:32,round:true})})]})]})}var gU,uE=N(()=>{u();lE();Ur();fi();gU={title:"Title",include_section:"Include Section"};});function kU({panels:e,value:t,onTabChange:o}){let r=useRef(null),[n,i]=useState(false),[s,l]=useState(false),a=Object.keys(e),p=()=>{let d=r.current;if(!d)return;let{scrollLeft:m,scrollWidth:f,clientWidth:g}=d;i(m>0),l(m<f-g);};useEffect(()=>{let d=r.current;if(d)return p(),d.addEventListener("scroll",p),()=>{d.removeEventListener("scroll",p);}},[]);let c=d=>{let m=r.current;if(!m)return;let f=d==="left"?-150:150;m.scrollBy({left:f,behavior:"smooth"});};return jsxs(Box,{className:"bespoke-report-modal-tabs-container",pos:"relative",sx:{flexGrow:1,maxWidth:"calc(100% - 38px)"},children:[jsx(Box,{"data-direction":"left",display:n?"flex":"none",sx:mE,children:jsx(ActionIcon,{onClick:()=>c("left"),children:jsx(IconChevronLeft,{size:20})})}),jsx(Tabs,{ref:r,value:t,onChange:o,sx:TU,children:jsx(Tabs.List,{className:"bespoke-report-modal-tabs",sx:{flexWrap:"nowrap",width:"fit-content"},children:a.map(d=>jsx(Tabs.Tab,{className:"bespoke-report-modal-tab",value:d,children:e[d].label},d))})}),jsx(Box,{display:s?"flex":"none","data-direction":"right",sx:mE,children:jsx(ActionIcon,{onClick:()=>c("right"),children:jsx(IconChevronRight,{size:20})})})]})}function CU({className:e,opened:t,onClose:o,panels:r}){let[n,i]=useState(Object.keys(r)[0]);return jsxs(Modal.Root,{className:clsx("bespoke-report-modal",e),opened:t,onClose:o,size:"xl",centered:true,children:[jsx(Modal.Overlay,{className:"bespoke-report-modal-overlay"}),jsxs(Modal.Content,{children:[jsx(Modal.Header,{className:"bespoke-report-modal-header",children:jsxs(Group,{w:"100%",justify:"space-between",gap:"md",wrap:"nowrap",children:[jsx(kU,{panels:r,value:n,onTabChange:s=>s&&i(s)}),jsx(Modal.CloseButton,{className:"bespoke-report-modal-close-btn",ml:0})]})}),jsx(Modal.Body,{className:"bespoke-report-modal-body",children:r[n].component})]})]})}var TU,mE,ch,ph=N(()=>{u();TU={overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch",flexWrap:"nowrap"},mE={height:"100%",zIndex:1,top:0,width:50,position:"absolute",backgroundSize:"cover",display:"flex",alignItems:"center","&[data-direction='left']":{background:"linear-gradient(to right, rgba(255, 255, 255, 1) 15px, rgba(255, 255, 255, 0))",left:0,justifyContent:"flex-start"},"&[data-direction='right']":{background:"linear-gradient(to left, rgba(255, 255, 255, 1) 15px, rgba(255, 255, 255, 0))",right:0,justifyContent:"flex-end"}};ch=CU;});function fE(e){let{section:t,initialMode:o,onEnds:r,open:n,title:i}=e,s=td(t.settings),l=useMemo(()=>IU.filter(m=>s[m]),[s]),[a,p]=useState(o||l[0]||"data"),c=Ht("options");useEffect(()=>{o!==a&&p(o);},[o]);let d={...uh,...c};return jsx(ch,{className:"cms-section-options-modal",opened:n,onClose:()=>r(),panels:{data:{label:d.download_title,component:jsx(cC,{section:t})},image:{label:d.image_title,component:jsx(nE,{section:t})},share:{label:d.share_title,component:jsx(pE,{section:t})}}})}var uh,IU,gE=N(()=>{u();Cg();iE();uE();Ur();_c();ph();uh={download_title:"Download Data",image_title:"Save Image",share_title:"Share Link"},IU=["data","image","share"];});function dh(e){let{sectionId:t,disabled:o=false}=e,[r,n]=useState(false),[i,s]=useState("data"),l=qo(t),a=Ht("options"),p={...uh,...a},c=td(l.isSuccess?l.data.settings:{}),d=f=>{s(f),n(true);},m=()=>{n(false);};return jsxs("div",{className:"cms-section-options",children:[jsxs(Button.Group,{children:[c.data&&jsx(Button,{variant:"default",size:"compact-xs",onClick:()=>d("data"),"aria-label":p.download_title,disabled:o,children:jsx(IconTable,{size:16})}),c.image&&jsx(Button,{variant:"default",size:"compact-xs",onClick:()=>d("image"),"aria-label":p.image_title,disabled:o,children:jsx(IconCamera,{size:16})}),c.share&&jsx(Button,{variant:"default",size:"compact-xs",onClick:()=>d("share"),"aria-label":p.share_title,disabled:o,children:jsx(IconShare,{size:16})})]}),l.isSuccess&&jsx(fE,{section:l.data,initialMode:i,open:r,onEnds:m})]})}var mh=N(()=>{u();gE();le();Ur();_c();});function NU({children:e,containerProps:t,"data-section-id":o},r){return jsx(Flex,{ref:r,className:"bespoke-Section-content","data-section-id":o,pos:"relative",align:"stretch",p:0,direction:{base:"column",md:"row"},wrap:"wrap",...t,children:e})}var fh,SE,gh,hh=N(()=>{u();le();Rn();fh=vi__default.forwardRef(function({children:t,column:o,basis:r,columnSettings:n={},sx:i={},"data-section-id":s,...l},a){let p=Object.values(o).some(f=>f.settings?.display==="inline"),c=n?.width?`${n.width}px`:r,d=n?.width?`${n?.width}px`:"100%",m=n?.full?"100%":d;return jsx(Flex,{ref:a,className:"bespoke-Section-column","data-section-id":s,align:"flex-start",direction:p?"row":"column",wrap:p?"wrap":"nowrap",maw:{base:"100%",md:m},miw:{base:"none",md:300},p:0,pos:"relative",sx:[{flexGrow:1,flexShrink:n?.full?0:1,flexBasis:n?.full?"100%":c},...Array.isArray(i)?i:i?[i]:[]],...l,children:t})}),SE=({sectionId:e,columnIndex:t})=>{let o=re(),r=qo(e).data,{settings:n,updateSettings:i}=zr(e);if(!r)return null;let{columnSettings:s={}}=n,{width:l=void 0}=s[t]?s[t]:{},a=d=>{r&&i("columnSettings",{...s,[t]:{width:parseInt(d.target.value,10)}});},p=()=>{r&&o(Z.updateEntity("section",{id:e,settings:{...r.settings,columnSettings:{...s,[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",wrap:"nowrap",children:[jsx(Checkbox,{label:"100%",size:"xs",onChange:d=>{i("columnSettings",{...s,[t]:{...s[t]||{},full:d.currentTarget.checked}});},checked:s[t]?.full}),jsx(Input,{placeholder:"auto",w:"fit-content",miw:"none",variant:"filled",type:"number",value:l||"auto",maw:110,onChange:a,size:"xs",p:0,rightSection:jsx(IconX,{onClick:p,size:8})})]})},gh=vi__default.forwardRef(NU);});var xE=N(()=>{u();Ln();});var TE=N(()=>{u();le();Nr();eE();_c();Wo();rh();mh();co();he();hh();Ln();Ur();xE();hi();fi();Mt();da();co();});function Fo({target:e,dropdown:t}){let[o,{open:r,close:n}]=useDisclosure(false),i=useRef(true),s=()=>{setTimeout(()=>{i.current&&n();},1e3);},l=()=>{i.current=false;},a=()=>{i.current=true,n();};return jsxs(Group,{children:[e,jsxs(Popover,{opened:o,trapFocus:true,children:[jsx(Popover.Target,{children:jsx(ActionIcon,{variant:"subtle",color:"blue",onMouseEnter:r,onMouseLeave:s,children:jsx(IconInfoCircle,{})})}),jsx(Popover.Dropdown,{maw:350,onMouseEnter:l,onMouseLeave:a,children:jsxs(Group,{align:"flex-start",wrap:"nowrap",children:[jsx("div",{children:jsx(ThemeIcon,{variant:"outline",sx:{border:"none"},children:jsx(IconInfoCircle,{})})}),jsx("div",{children:t})]})})]})]})}var sd=N(()=>{u();});function Cs({value:e,onChange:t,item:o="block"}){let r=re(),[n,i]=useState([]),s=useMemo(()=>[{value:"public",label:`Public ${o}, (all visitors)`},{value:"guest",label:`Guest only ${o}, (non logged visitors)`},{value:"private",label:`Private ${o}, (session required, any role)`}],[o]),l=useMemo(()=>{let p=[{group:"Exclusive",items:s}],c=n.reduce((d,m)=>{let f=`${m.type} Roles`;return d[f]||(d[f]=[]),d[f].push({value:`role.${m.name}`,label:`Role ${m.name} (${m.type})`}),d},{});return Object.entries(c).forEach(([d,m])=>{p.push({group:d,items:m});}),p},[s,n]);useEffect(()=>{r(Z.searchRole()).then(p=>{i(p.roles);});},[r]);let a=p=>{let c=[];if(p.length===0)c=[s[0].value];else {let d=p.slice(-1)[0],m=s.map(g=>g.value);c=m.includes(d)?[d]:p.filter(g=>!m.includes(g));}t(c);};return jsx(MultiSelect,{label:"Privacy",description:`This ${o} will be shown based on the selected roles.`,data:l,value:e,onChange:a})}var ad=N(()=>{u();le();});function vh(){let e=eo(),t=Number.parseInt(e.params[0]),o=Vt(t).data,n=V(du).filter(D=>D.type===E.NAV),{settings:i,updateSettings:s}=pc(t),{handlers:l}=$t("reportEditor"),a=di(),p=o?.dimensions&&o.dimensions.length>0,c=nc(o?.dimensions||[]),d=useMemo(()=>c.isSuccess?c.data.flatMap(D=>D.variants||[]):[],[c.data,c.isSuccess]),m=ic(d),f=useMemo(()=>{if(!c.isSuccess||!m.isSuccess)return [];let D=c.data,P=m.data;return D.length===1?P.map(O=>({value:O.id.toString(),label:O.name,dimensionName:D[0].name})):D.length>1?D.map(F=>P.filter(z=>F.variants?.includes(z.id)||false)).reduce((F,z)=>F.flatMap(G=>z.map(U=>[...G,U])),[[]]).filter(F=>F.length>0).map(F=>({value:F.map(z=>z.id).join(","),label:F.map(z=>z.name).join(" / "),dimensionName:F.map((z,G)=>`${D[G]?.name}: ${z.name}`).join(" | ")})):[]},[c.data,c.isSuccess,m.data,m.isSuccess]),g=i.pdf?.variants||[],h=i.pdf?.privacy||["public"],v=i.pdf?.navBlockId||(n.length>0?n[0].id:""),y=!!i.pdf?.sectionSelection,S=D=>{s("pdf",{...i.pdf,enabled:true,variants:D});},C=D=>{s("pdf",{...i.pdf,enabled:true,privacy:D});},b=D=>{let P=n.length>0?n[0].id:void 0;s("pdf",{...i.pdf,sectionSelection:D,navBlockId:D?i.pdf?.navBlockId||P:void 0});},w=D=>{s("pdf",{...i.pdf,navBlockId:D?parseInt(D):void 0});},k=D=>{if(D){let P=f.map(O=>O.value);s("pdf",{enabled:true,variants:P,privacy:["public"]});}else s("pdf",{enabled:false,variants:[],privacy:[],sectionSelection:false,navBlockId:void 0});},R=i.xlsx?.variants||[],L=i.xlsx?.privacy||["public"],I=D=>{s("xlsx",{...i.xlsx,enabled:true,variants:D});},A=D=>{s("xlsx",{...i.xlsx,enabled:true,privacy:D});},M=D=>{if(D){let P=f.map(O=>O.value);s("xlsx",{enabled:true,variants:P,privacy:["public"]});}else s("xlsx",{enabled:false,variants:[],privacy:[]});};return jsx(Fragment,{children:jsxs(Stack,{children:[jsx(Button,{variant:"outline",radius:0,onClick:l.open,children:"Edit Report"}),p&&jsxs(Accordion,{children:[jsxs(Accordion.Item,{value:"comparison",children:[jsx(Accordion.Control,{children:"Profile Comparison"}),jsxs(Accordion.Panel,{children:[jsx(Fo,{target:jsx(Switch,{label:"Enable comparison",checked:!!i.comparison,onChange:D=>s("comparison",D.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"})]})}),i.comparison&&jsx(Fo,{target:jsx(Switch,{label:"With different levels",checked:!!i.compareLevels,onChange:D=>s("compareLevels",D.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(Tooltip,{label:"PDF Export is not configured",disabled:a,children:jsx("span",{children:jsx(Accordion.Control,{disabled:!a,children:"PDF Export"})})}),jsxs(Accordion.Panel,{children:[jsx(Fo,{target:jsx(Switch,{label:"Enable PDF export",checked:!!i.pdf?.enabled,onChange:D=>k(D.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."})]})}),i.pdf?.enabled&&jsxs(Stack,{mt:"md",children:[n.length>0&&jsxs(Fragment,{children:[jsx(Switch,{label:"Enable Section selection in PDF export",checked:y,onChange:D=>b(D.currentTarget.checked)}),y&&jsx(Select,{data:n.map(D=>({value:D.id.toString(),label:`Nav Block #${D.id}`})),label:"Select Navigation Block for PDF sections",description:"The PDF export selection should be based on a Navigation block.",placeholder:"Select Nav Block",ml:"xl",size:"xs",value:v.toString(),onChange:w})]}),jsx(Cs,{value:h,onChange:C,item:"PDF export"}),f.length>0&&jsxs(Fragment,{children:[jsx(Text,{fw:500,size:"sm",children:"Select variants to enable PDF export:"}),jsx(Checkbox.Group,{value:g,onChange:S,children:jsx(Stack,{spacing:"xs",children:f.map(D=>jsx(Checkbox,{value:D.value,label:D.label,description:D.dimensionName,size:"sm"},D.value))})})]})]})]})]}),jsxs(Accordion.Item,{value:"xlsx",children:[jsx(Accordion.Control,{children:"XLSX Export"}),jsxs(Accordion.Panel,{children:[jsx(Fo,{target:jsx(Switch,{label:"Enable XLSX export",checked:!!i.xlsx?.enabled,onChange:D=>M(D.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."})]})}),i.xlsx?.enabled&&jsxs(Stack,{mt:"md",children:[jsx(Cs,{value:L,onChange:A,item:"XLSX export"}),f.length>0&&jsxs(Fragment,{children:[jsx(Text,{fw:500,size:"sm",children:"Select variants to enable XLSX export:"}),jsx(Checkbox.Group,{value:R,onChange:I,children:jsx(Stack,{spacing:"xs",children:f.map(D=>jsx(Checkbox,{value:D.value,label:D.label,description:D.dimensionName,size:"sm"},D.value))})})]})]})]})]})]})]})})}var Sh=N(()=>{u();Te();Rn();sd();lt();ad();Nr();he();});var RE=N(()=>{u();Ur();_u();le();lt();co();Ca();ph();});var AE=N(()=>{u();});function gr(){let e=useContext(JU);if(e===void 0)throw new Error("usePrint must be used within a PrintContext");return e}var JU,Ln=N(()=>{u();le();Wo();TE();hi();_u();co();lt();Sh();RE();AE();JU=createContext({print:false,isEmbed:false});});function Gt(e){let{content:t,style:o={}}=e,{print:r}=gr(),n=jsx(xe,{component:"span",html:t,isPreview:true}),i=useMemo(()=>r?jsx("div",{className:"bespoke-InnerTooltip-root",children:jsx(Notification,{className:"bespoke-InnerTooltip-notification",icon:jsx(IconInfoCircle,{size:"1.1rem"}),withCloseButton:false,withBorder:true,styles:{root:{boxShadow:"none"}},children:n})},"tooltip-notification"):jsx("div",{className:"bespoke-InnerTooltip-root",style:o,children:jsx(Tooltip,{className:"bespoke-InnerTooltip-tooltip",label:n,withArrow:true,withinPortal:true,multiline:true,maw:220,children:jsx(ActionIcon,{className:"bespoke-InnerTooltip-icon",size:"1.5rem",children:jsx(IconInfoCircle,{})})})},"tooltip"),[r,t,o]);return jsx(Fragment,{children:i})}var Pn=N(()=>{u();Ln();ft();});function Th({paragraph:e,tooltip:t,settings:o}){return jsx(xe,{component:"p",html:e||`Lorem ipsum dolor sit amet,
42
42
  consectetur adipiscing elit. Etiam justo purus, placerat ac turpis at,
43
43
  dignissim interdum eros. Curabitur non tincidunt libero.
44
44
  Suspendisse quis nibh in massa tincidunt feugiat sit amet vitae nisl.
package/dist/explore.js CHANGED
@@ -7,7 +7,7 @@ import'path';import'url';import*as Ht from'react';import Ht__default,{createCont
7
7
  </p>`},ql=(e,t)=>t.find(r=>{let n=r.content?.pattern;if(!n||!r.content?.useProxy)return false;try{return new RegExp(n).test(e)}catch{return false}})?`${process.env.NEXT_PUBLIC_REPORTS_BASE_URL}/api/cms/url/proxy?url=${encodeURIComponent(e)}&wrapper=false`:e,Rs=(e,t)=>typeof e=="string"?ql(e,t):Array.isArray(e)?e.map(o=>typeof o=="string"?ql(o,t):o):e,Ng=(e,t,o={},r=_g,n=null,s={},i={},l=[])=>{let c;try{c=Gr({vars:["variables"],logic:e},t,r,s,i)(o),c.data=Rs(c.data,l),c._downloadUrl&&(c.__downloadUrl=Rs(c.__downloadUrl,l));}catch(u){return console.error(`Parsing Error in propify (ID: ${n})`),console.error(`Error message: ${u.message}`),{error:`${u}`,config:Hl}}if(typeof c!="object")return {error:"Visualization JS code must return an object",config:Hl};let p=c.dataFormat?c.dataFormat:u=>{let f=Array.isArray(c.data)&&c.data.length>1&&c.data.some(y=>typeof y=="string")?u:[u];return concat(f,"data")};return {config:c,dataFormat:p}},Do=Ng;});var Wl=g(()=>{a();te();V({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 jl=g(()=>{a();te();V({name:"abs",description:"Simple Absolute Value.",logicFactory(){return e=>Math.abs(e)},inputType:"number",testValue:"-123",type:"formatter"});});var Fg,Kl=g(()=>{a();te();Fg=()=>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,s=>`${parseInt(s)+1}k`):n.indexOf(",")===n.length-8&&(n=n.replace(/,000,000$/g,"M").replace(/([0-9]+)(,999,999$)/g,s=>`${parseInt(s)+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"},V({name:"bucket",description:"Sanitizes bucket strings to '< n', 'n1 - n2', and 'n+'",logicFactory:Fg,inputType:"number",testValue:"1234",type:"formatter"});});var Yl=g(()=>{a();te();V({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 Xl=g(()=>{a();te();V({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 Ql=g(()=>{a();te();V({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 Zl=g(()=>{a();te();V({name:"formatFieldName",description:"Based on field name returns a string",logicFactory(){return e=>{if(e.contentType.toLowerCase()==="stat"){if(e.field==="title")return "Stat label";if(e.field==="value")return "Stat value";if(e.field==="subtitle")return "Stat subtitle";if(e.field==="tooltip")return "Tooltip text"}return e.contentType.toLowerCase()==="section"&&e.field==="short"?"Short title":e.contentType.toLowerCase()==="description"&&e.field==="description"?"Paragraph":e.field}},inputType:"object",testValue:'{"field":"title","contentType":"stat"}',type:"formatter"});});var Jl=g(()=>{a();te();V({name:"grewTo",description:"Returns the text with grow direction: 'declined from', 'grew to' o 'stayed at'",logicFactory(){return e=>e<0?"declined from":e>0?"grew to":"stayed at"},inputType:"number",testValue:"-1234",type:"formatter"});});var ec=g(()=>{a();te();V({name:"grewWord",description:"Returns either 'grew', 'declined', or 'stayed' depending on the provided number's sign.",logicFactory(){return e=>e<0?"declined":e>0?"grew":"stayed"},inputType:"number",testValue:"-1234",type:"formatter"});});var tc=g(()=>{a();te();V({name:"growing",description:"Returns either 'declining', 'growing' depending on the provided number's sign.",logicFactory(){return e=>e<0?"declining":"growing"},inputType:"number",testValue:"-1234",type:"formatter"});});var jg,oc=g(()=>{a();te();jg=()=>function(t){let{curr:o,currMoe:r=0,prev:n,prevMoe:s=0}=t,i;if(r||s){let l=(-n/o**2)**2*r**2,c=(1/o)**2*s**2;i=Math.sqrt(l+c);}else i=(o-n)/n;return i*100},V({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:jg,inputType:"object",testValue:'{"curr":10,"currMoe":0,"prev":13,"prevMoe":0}',type:"formatter"});});var rc=g(()=>{a();te();V({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 nc=g(()=>{a();te();V({name:"growthWord",description:"Returns either 'growth' or 'decline' depending on the provided number's sign.",logicFactory(){return e=>e<0?"decline":"growth"},inputType:"number",testValue:"-1234",type:"formatter"});});var sc=g(()=>{a();te();V({name:"highWord",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign.",logicFactory(){return e=>e<0?"lower than":e>0?"higher than":"approximately the same as"},inputType:"number",testValue:"0",type:"formatter"});});var ac=g(()=>{a();te();V({name:"increaseWord",description:"Returns either 'increase', 'decrease', or 'change' depending on the provided number's sign.",logicFactory(){return e=>e<0?"decrease":e>0?"increase":"change"},inputType:"number",testValue:"1234",type:"formatter"});});var ic=g(()=>{a();te();V({name:"increasedWord",description:"Returns either 'increased', 'decreased', or 'remained the same' depending on the provided number's sign.",logicFactory(){return e=>e<0?"decreased":e>0?"increased":"remained the same"},inputType:"number",testValue:"0",type:"formatter"});});var lc=g(()=>{a();te();V({name:"increasing",description:"Returns either 'decreasing', 'increasing' or 'maintaining' depending on the provided number's sign.",logicFactory(){return e=>e<0?"decreasing":e>0?"increasing":"maintaining"},inputType:"number",testValue:"-1234",type:"formatter"});});var cc=g(()=>{a();te();V({name:"largerThan",description:"Returns either 'higher than', 'lower than', or 'approximately the same as' depending on the provided number's sign",logicFactory(){return e=>e<0?"smaller than":e>0?"larger than":"the same as"},inputType:"number",testValue:"-1234",type:"formatter"});});var pc=g(()=>{a();te();V({name:"list",description:"Joins an array of strings together, adding commas and 'and' when necessary.",logicFactory(){return e=>e.reduce((t,o,r)=>(r?r===e.length-1&&r===1?t+=` and ${o}`:r===e.length-1?t+=`, and ${o}`:t+=`, ${o}`:t+=o,t),"")},inputType:"object",testValue:'["foo","bar","bee"]',type:"formatter"});});var uc=g(()=>{a();te();V({name:"longWord",description:"",logicFactory(){return e=>e<0?"shorter":e>0?"longer":"similar"},inputType:"number",testValue:"5",type:"formatter"});});var dc=g(()=>{a();te();V({name:"lowerCaseFirst",description:"Converts the first letter of a string to lowercase",logicFactory(){return e=>typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e},inputType:"string",testValue:"foo",type:"formatter"});});var mc=g(()=>{a();te();V({name:"moreFewerWord",description:"",logicFactory(){return e=>e<0?"fewer":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var fc=g(()=>{a();te();V({name:"moreLess",description:"Returns either 'more' or 'less' depending on the provided number's sign.",logicFactory(){return e=>e<0?"less":"more"},inputType:"number",testValue:"-5",type:"formatter"});});var gc=g(()=>{a();te();V({name:"moreLess",description:"Returns either 'more than', 'less than', or 'approximately the same' depending on the provided number's sign.",logicFactory(){return e=>e<0?"less than":e>0?"more than":"approximately the same"},inputType:"number",testValue:"-5",type:"formatter"});});var hc=g(()=>{a();te();V({name:"olderWord",description:"",logicFactory(){return e=>e<0?"getting younger":e>0?"getting older":"staying the same age"},inputType:"number",testValue:"-5",type:"formatter"});});var bc=g(()=>{a();te();V({name:"olderYounger",description:"",logicFactory(){return e=>e<0?"younger than":e>0?"older than":"the same age as"},inputType:"number",testValue:"-5",type:"formatter"});});var yc=g(()=>{a();te();V({name:"plural",description:"Pluralizes a word.",logicFactory(){return e=>e.replace(/\w$/g,t=>t==="y"?"ies":`${t}s`)},inputType:"string",testValue:"Foo",type:"formatter"});});var Sc=g(()=>{a();te();V({name:"pxToInt",description:"Takes a pixel value and converts it to an integer",logicFactory(){return e=>parseInt(e.replace(/\D+/g,""),10)},inputType:"string",testValue:"12px",type:"formatter"});});var xc=g(()=>{a();te();V({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 Tc=g(()=>{a();te();V({name:"stripEntities",description:"Removes non breaking spaces & other html entities from a string",logicFactory(){return e=>typeof e=="string"?String(e).replace(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/ig," "):e},inputType:"string",testValue:"<b>MyText</b>",type:"formatter"});});var Rc=g(()=>{a();te();V({name:"stripHTML",description:"Converts html tags to spaces, then removes redundant spaces",logicFactory(){return e=>{let t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`","&nbsp;":""},o=`(?:${Object.keys(t).join("|")})`,r=RegExp(o),n=RegExp(o,"g"),s=String(e).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return r.test(s)?s.replace(n,i=>t[i]):s}},inputType:"string",testValue:"<b>My text</b>",type:"formatter"});});var Ec=g(()=>{a();te();V({name:"stripOL",description:"Removes ordered list wrapper tags from a string.",logicFactory(){return e=>e.replace(/<ol>/g,"").replace(/<\/ol>/g,"")},inputType:"string",testValue:"<ol><li>My list</li></ol>",type:"formatter"});});var kc=g(()=>{a();te();V({name:"stripP",description:"Removes all paragraph tags from a string.",logicFactory(){return e=>e.replace(/<p>/g,"").replace(/<\/p>/g,"")},inputType:"string",testValue:"<p>My p</p>",type:"formatter"});});var Cc=g(()=>{a();te();V({name:"stripUL",description:"Removes unordered list wrapper tags from a string.",logicFactory(){return e=>e.replace(/<ul>/g,"").replace(/<\/ul>/g,"")},inputType:"string",testValue:"<ul><li>My list</li></ul>",type:"formatter"});});var wc=g(()=>{a();te();V({name:"toKebabCase",description:"Takes a camelCase or PascalCase string and converts it to kebab-case.",logicFactory(){return e=>typeof e=="string"?(e=e.charAt(0).toLowerCase()+e.substring(1),e.replace(/([A-Z])/g,"-$1").toLowerCase()):"invalid string passed to toKebabCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var Ac=g(()=>{a();te();V({name:"toSpacedCase",description:"Takes a camelCase or PascalCase string and adds spaces (I know Spaced Case isn't a thing, deal with it).",logicFactory(){return e=>typeof e=="string"?e.replace(/([A-Z])/g," $1").toLowerCase().trim():"invalid string passed to toSpacedCase()"},inputType:"string",testValue:"camelCaseText",type:"formatter"});});var Pc=g(()=>{a();te();V({name:"upperCaseFirst",description:"Converts the first letter of a string to uppercase",logicFactory(){return e=>e.charAt(0).toUpperCase()+e.slice(1)},inputType:"string",testValue:"my name",type:"formatter"});});var Ic=g(()=>{a();Wl();jl();Kl();Yl();Xl();Ql();Zl();Jl();ec();tc();oc();rc();nc();sc();ac();ic();lc();cc();pc();uc();dc();mc();fc();gc();hc();bc();yc();Sc();xc();Tc();Rc();Ec();kc();Cc();wc();Ac();Pc();});function Ye(e){let t=useContext(vh);return e?t[e]??t:t}var vh,st=g(()=>{a();vh=createContext({});});var Lc=g(()=>{a();});var rn=g(()=>{a();});var Bc=g(()=>{a();});var Tr=g(()=>{a();rn();Bc();});var ks=g(()=>{a();re();Lc();me();xr();Tr();rn();eo();we();Zt();oo();Ge();es();st();});var Eh,nn=g(()=>{a();re();ft();Sr();Ge();Eh={active:false,pdfParam:false,position:"DEFAULT",XlsxVizActive:false,pdfVariants:[],xlsxVariants:[],currentVariantPdfEnabled:false,currentVariantXlsxEnabled:false,isLoading:false,pdfAccessAllowed:false,xlsxAccessAllowed:false,sectionSelection:false,navBlockId:void 0},createContext(Eh);});var kh,Ch,wh,Ah,Se,kt=g(()=>{a();kh=e=>typeof e=="string"?e.replace(/&nbsp;<\/p>/g,"</p>"):e,Ch=e=>typeof e=="string"&&e==="<p><br></p>"?"":e,wh=e=>typeof e=="string"?e.replace(/^<p>(.*)<\/p>$/,"$1"):e,Ah=e=>e&&wh(Ch(kh(e))),Se=Ah;});function Z({className:e="",id:t="",component:o="p",order:r=1,size:n="md",html:s,style:i={},append:l=jsx(Fragment,{}),isPreview:c=false,lineClamp:p="none"}){let u=Lh(s),m=Bh(s,c),f=i&&i.align?String(i.align):"left",y=Text,d={};return o==="h"?(y=Title,d={id:t,order:r}):d={component:o,size:n,lineClamp:p},jsxs(y,{align:f||u.align||"left",...d,className:e,children:[m,l]})}var Lh,Bh,ve=g(()=>{a();Lh=(e="<></>")=>{let t=null,o={replace:r=>(r instanceof Element&&!t&&(t=r.attribs,t.align=r.attribs.style?r.attribs.style.replace("text-align: ",""):"",delete t.children),r)};return e?(Nc(e,o),t):{}},Bh=(e="",t=false)=>{let o={replace:r=>{let{type:n}=r;if(r instanceof Element&&n==="tag"){let{name:s,attribs:i,children:l,parent:c}=r;if(s==="p"&&!c)return jsx(Fragment,{children:domToReact(l,o)});if(s==="a"){let{href:p,target:u}=i,m=p.indexOf("http")===0,f=!!(u&&u==="_blank"),y=jsx(Anchor,{...i,href:i.href,target:"_blank",children:domToReact(l,o)});return m||f||t?y:jsx(Anchor,{...i,href:i.href,children:domToReact(l,o)})}else {if(s==="strong")return jsx(Text,{component:"strong",children:domToReact(l,o)});if(s==="em")return jsx(Text,{component:"em",fs:"italic",children:domToReact(l,o)});if(s==="u")return jsx(Text,{component:"u",td:"underline",children:domToReact(l,o)});if(s==="sup")return jsx(Text,{component:"sup",style:{verticalAlign:"super",fontSize:"0.75em"},children:domToReact(l,o)});if(s==="sub")return jsx(Text,{component:"sub",style:{verticalAlign:"sub",fontSize:"0.75em"},children:domToReact(l,o)});if(s==="span")return jsx(Text,{component:"span",children:domToReact(l,o)});if(s==="br")return jsx("br",{})}return jsx(Fragment,{children:domToReact(l,o)})}else if(r instanceof Text$1&&r.type==="text")return jsx(Fragment,{children:r.data})}};return Nc(e,o)};});function Ie(e){let{content:t,style:o={}}=e,{print:r}=Xe(),n=jsx(Z,{component:"span",html:t,isPreview:true}),s=useMemo(()=>r?jsx("div",{className:"bespoke-InnerTooltip-root",children:jsx(Notification,{className:"bespoke-InnerTooltip-notification",icon:jsx(IconInfoCircle,{size:"1.1rem"}),withCloseButton:false,withBorder:true,styles:{root:{boxShadow:"none"}},children:n})},"tooltip-notification"):jsx("div",{className:"bespoke-InnerTooltip-root",style:o,children:jsx(Tooltip,{className:"bespoke-InnerTooltip-tooltip",label:n,withArrow:true,withinPortal:true,multiline:true,maw:220,children:jsx(ActionIcon,{className:"bespoke-InnerTooltip-icon",size:"1.5rem",children:jsx(IconInfoCircle,{})})})},"tooltip"),[r,t,o]);return jsx(Fragment,{children:s})}var wt=g(()=>{a();At();ve();});function ws({paragraph:e,tooltip:t,settings:o}){let r=Se(t);return jsx(Z,{className:"bespoke-Paragraph-root",component:"p",html:e,style:o,append:t?jsx(Ie,{content:r,style:{display:"inline-block",verticalAlign:"bottom"}}):jsx(Fragment,{})})}var Fc=g(()=>{a();kt();wt();ve();});function ge({iconType:e="none",iconVariant:t="transparent",icon:o="",iconRadius:r="md",iconSize:n="md",iconPadding:s="1",blockType:i}){let[l,c]=useState(void 0),p=e==="custom"?o:`/api/cms/read/icons/${e}/icon.svg?name=${o}`,u=/^.*\.svg*$/.test(p)||e==="tabler";return useEffect(()=>{u&&jr.get(p,{responseType:"text"}).then(f=>f.data).then(c).catch(()=>{});},[e,u,p]),jsx(Fragment,{children:e!=="none"&&o&&o!==""&&!!(l||!u)&&jsx(ThemeIcon,{className:`bespoke-${i.charAt(0).toUpperCase()+i.slice(1)}-iconWrapper`,variant:t,radius:r,size:n,p:parseInt(s),dangerouslySetInnerHTML:l&&u?{__html:l}:void 0,children:u?null:jsx(Image,{src:p,alt:"Title Icon"})})})}var Pt=g(()=>{a();});var Gt,Vc,zc,$c,Uc,Ue,Oe,Fo,Ne=g(()=>{a();me();Gt={display:{label:"Size",defaultValue:"block",options:[{label:"Full Width",value:"block"},{label:"Inline",value:"inline"}]}},Vc={useProxy:{label:"Use proxy (avoid CORS)",defaultValue:"false",options:[{label:"No",value:"false"},{label:"Yes",value:"true"}]}},{[S.IMAGE]:{...Gt},[S.PARAGRAPH]:{...Gt},[S.SUBTITLE]:{...Gt},[S.SELECTOR]:{...Gt},[S.STAT]:{...Gt},[S.VIZ]:{...Gt},[S.TITLE]:{order:{label:"Importance",defaultValue:"1",options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"},{label:"5",value:"5"},{label:"6",value:"6"}]},search:{label:"Search on Click",defaultValue:"off",options:[{label:"Off",value:"off"},{label:"Inline",value:"inline"},{label:"Modal",value:"modal"}]},addComparisonName:{label:"Show member name on comparison mode",defaultValue:"no",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]},...Gt},[S.GENERATOR]:{...Vc},[S.SECTION_FLAG]:{...Vc},[S.NAV]:{variant:{label:"Nav variant",defaultValue:"inline",options:[{label:"Inline",value:"inline"},{label:"Fixed",value:"fixed"},{label:"Jump",value:"jump"}]},min:{label:"Min Title level",defaultValue:"1",options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"},{label:"5",value:"5"},{label:"6",value:"6"}]},max:{label:"Max Title level",defaultValue:"6",options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"},{label:"5",value:"5"},{label:"6",value:"6"}]},icons:{label:"Show icons",defaultValue:"yes",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]},titlePosition:{label:"Title position",defaultValue:"left",options:[{label:"Left",value:"left"},{label:"Top",value:"top"},{label:"Right",value:"right"},{label:"Bottom",value:"bottom"}]}},[S.MULTIHIERARCHY_SELECTOR]:{...Gt}},zc={left:"flex-start",right:"flex-end",justify:"stretch"},$c={justify:"space-between"},Uc={justify:"space-between"},Ue=e=>zc[e]?zc[e]:e,Oe=e=>$c[e]?$c[e]:e,Fo=e=>Uc[e]?Uc[e]:e;});function Ps({subtitle:e,title:t,value:o,tooltip:r,settings:n,_iconType:s,_iconVariant:i,_icon:l,_iconRadius:c,_iconSize:p,_iconPadding:u}){if(!t&&!o&&!e)return null;let m=n&&n.align?n.align:"left";return jsxs(Group,{className:"bespoke-Stat-root",gap:"md",justify:Oe(m),children:[jsx(ge,{blockType:"stat",iconType:s,iconVariant:i,iconRadius:c,iconSize:p,icon:l,iconPadding:u}),jsxs(Stack,{gap:0,className:"bespoke-Stat-data",children:[t&&jsx(Z,{className:"bespoke-Stat-title",component:"div",size:"md",html:t,style:n}),o&&jsx(Z,{className:"bespoke-Stat-value",component:"div",size:"xl",html:o,style:n}),e&&jsx(Z,{className:"bespoke-Stat-subtitle",component:"div",size:"sm",html:e,style:n})]},"stat"),r&&jsx(Ie,{content:r})]})}var Hc=g(()=>{a();wt();Pt();ve();Ne();});function Is({subtitle:e,tooltip:t,settings:o}){let r=e||"<span class='cr-block-placeholder'>Small subtitle.</span>",n=o&&o.align?o.align:"left";return jsxs(Group,{className:"bespoke-Subtitle-root",gap:"sm",justify:Oe(n),children:[jsx(Z,{className:"bespoke-Subtitle-text",size:"sm",html:r}),t&&jsx(Ie,{content:t,style:{display:"inline-flex"}})]})}var Wc=g(()=>{a();wt();ve();Ne();});function Bs({title:e,tooltip:t,slug:o,_iconType:r,_iconVariant:n,_icon:s,settings:i,_iconRadius:l,_iconSize:c,_iconPadding:p,asComparison:u=false}){let{print:m}=Xe(),f=Se(e)||"<span class='cr-block-placeholder'>Title</span>",y=i&&i.order?parseInt(i.order,10):1,d=y<=6?y:1,T=i&&i.search?i.search:"off",x=i&&i.align?i.align:"left",P=nt(),C=H(v=>v.status.previews),D=(u?P.status.previews:C).map(v=>v.name).join(" | "),M=jsxs(Group,{className:"bespoke-Title-content",children:[jsx(ge,{blockType:"title",iconType:r,iconVariant:n,iconRadius:l,iconSize:c,icon:s,iconPadding:p}),jsx(Z,{className:"bespoke-Title-text",id:o||void 0,component:"h",order:d,style:i,html:f})]}),j=Vo(M,T),I=i&&i.addComparisonName==="yes"&&P.active,w=I?Box:Fragment$1;return jsxs(Group,{className:"bespoke-Title-root",gap:"sm",justify:Oe(x),children:[jsxs(w,{className:"bespoke-Title-wrapper",children:[m?M:j,I&&jsx(Text,{className:"bespoke-Title-comparison",children:D})]}),t&&jsx(Ie,{content:t})]})}var Kc=g(()=>{a();kt();Pt();ve();_e();Ut();re();At();wt();Ne();});function Ms(e){let{name:t,settings:o,options:r,id:n,defaultValue:s,section:i,component:l,asComparison:c,hideLabel:p,resetSectionVars:u}=e,{print:m}=Xe(),f=ib(n),y=on(n,i,f,c,u==="true"),d=c?`${f}Compare`:f,[T,x]=useState(s),[P,C]=useState(Xc(s,[])),k=JSON.stringify(r),D=o[Qt.DISABLED]||false,M=useMemo(()=>r?.map(R=>({value:R.id,label:R.label,imageUrl:R.imageUrl}))||[],[k]),j=m?r.filter(R=>P.includes(R.id)).map(R=>R.label).join(", "):"",I=m&&T&&r.find(R=>R.id===T)?.label||"",w=e.hideLabel==="true"?jsx(Fragment,{}):jsx(Z,{className:"bespoke-Selector-label",component:"span",html:t,size:"sm",style:o});if(useEffect(()=>{if(!D){let _=new URLSearchParams(window.location.search).get(d)||s;_&&(e.type===Ee.SINGLE?x(_):C(Xc(_,s)));}},[window.location.search,s]),M.length<=1)return jsx(Fragment,{});let v=R=>{C(R),y(R.join(","));},E=R=>{x(R),y(R);};return jsx(Fragment,{children:m?jsxs(Box,{className:"bespoke-Selector-root",style:{display:"flex",alignItems:"center"},children:[w,jsx(Button,{className:"bespoke-Selector-button",ml:"sm",radius:"xl",variant:"outline",children:e.type===Ee.SINGLE?I:j})]}):jsx(Box,{className:"bespoke-Selector-root",children:{[Ee.SINGLE]:l===Mr.SEGMENTED_CONTROL?jsxs("div",{className:"bespoke-Selector-container",children:[jsx(Text,{className:"bespoke-Selector-label",size:"sm",fw:500,display:p==="true"?"none":"block",children:w}),jsx(SegmentedControl,{className:"bespoke-Selector-segmentedControl",data:M,disabled:D,value:M.map(R=>R.value).includes(T)?T:"",onChange:E,fullWidth:true})]}):jsx(Select,{className:"bespoke-Selector-select",label:w,data:M,disabled:D,value:T,renderOption:R=>jsx(lb,{...M.find(_=>_.value===R.option.value)||{}}),onChange:E,styles:{label:{display:p==="true"?"none":"block"}}}),[Ee.MULTI]:jsx(MultiSelect,{className:"bespoke-Selector-multiSelect",label:w,data:M,value:P,onChange:v,disabled:D,styles:{label:{display:p==="true"?"none":"block"}}})}[e.type]})})}var ib,Xc,lb,Zc=g(()=>{a();ve();me();_e();At();ib=e=>`selector${e}id`,Xc=(e,t)=>e&&typeof e=="string"?e.split(","):t,lb=forwardRef(function({imageUrl:t,label:o,...r},n){return jsx("div",{ref:n,...r,children:jsxs(Group,{wrap:"nowrap",children:[t&&!["","undefined"].includes(t)&&jsx(Box,{component:"img",w:25,h:25,src:t}),jsx("div",{children:jsx(Text,{size:"sm",children:o})})]})})});});function ln(){return jsx("div",{children:"Generator"})}var Jc=g(()=>{a();});function Ds(e){let{alt:t,src:o,desc:r,title:n,settings:s,...i}=e,l=Se(t),c=Se(o),p=Se(r),u=jsx("img",{src:c,alt:l,style:i}),m=s&&s.align?String(s.align):"left";return (p&&p.length||n&&n.length)&&(u=jsxs(Stack,{className:"bespoke-Image-wrapper",align:Ue(m),gap:"sm",children:[n&&jsx(Z,{className:"bespoke-Image-title",component:"p",html:n,style:s}),u,r&&jsx(Z,{className:"bespoke-Image-desc",component:"p",size:"sm",html:r,style:s})]})),c&&l?u:jsx(Center,{className:"bespoke-Image-placeholder",mih:100,bg:"white",children:jsx(Badge,{color:"gray",variant:"outline",children:"IMAGE"},"type")})}var ep=g(()=>{a();kt();ve();Ne();});function To(e,t,o){let r=o.initialDeps??[],n;return ()=>{var s,i,l,c;let p;o.key&&((s=o.debug)!=null&&s.call(o))&&(p=Date.now());let u=e();if(!(u.length!==r.length||u.some((y,d)=>r[d]!==y)))return n;r=u;let f;if(o.key&&((i=o.debug)!=null&&i.call(o))&&(f=Date.now()),n=t(...u),o.key&&((l=o.debug)!=null&&l.call(o))){let y=Math.round((Date.now()-p)*100)/100,d=Math.round((Date.now()-f)*100)/100,T=d/16,x=(P,C)=>{for(P=String(P);P.length<C;)P=" "+P;return P};console.info(`%c\u23F1 ${x(d,5)} /${x(y,5)} ms`,`
8
8
  font-size: .6rem;
9
9
  font-weight: bold;
10
- color: hsl(${Math.max(0,Math.min(120-120*T,120))}deg 100% 31%);`,o?.key);}return (c=o?.onChange)==null||c.call(o,n),n}}function cn(e,t){if(e===void 0)throw new Error(`Unexpected undefined${""}`);return e}var tp,op,rp=g(()=>{a();tp=(e,t)=>Math.abs(e-t)<1,op=(e,t,o)=>{let r;return function(...n){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,n),o);}};});function bb({measurements:e,outerSize:t,scrollOffset:o}){let r=e.length-1,s=lp(0,r,l=>e[l].start,o),i=s;for(;i<r&&e[i].end<o+t;)i++;return {startIndex:s,endIndex:i}}var fb,Er,sp,np,gb,ap,hb,ip,pn,lp,Fs=g(()=>{a();rp();fb=e=>e,Er=e=>{let t=Math.max(e.startIndex-e.overscan,0),o=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let n=t;n<=o;n++)r.push(n);return r},sp=(e,t)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let n=i=>{let{width:l,height:c}=i;t({width:Math.round(l),height:Math.round(c)});};if(n(o.getBoundingClientRect()),!r.ResizeObserver)return ()=>{};let s=new r.ResizeObserver(i=>{let l=i[0];if(l?.borderBoxSize){let c=l.borderBoxSize[0];if(c){n({width:c.inlineSize,height:c.blockSize});return}}n(o.getBoundingClientRect());});return s.observe(o,{box:"border-box"}),()=>{s.unobserve(o);}},np={passive:true},gb=typeof window>"u"?true:"onscrollend"in window,ap=(e,t)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let n=0,s=e.options.useScrollendEvent&&gb?()=>{}:op(r,()=>{t(n,false);},e.options.isScrollingResetDelay),i=p=>()=>{let{horizontal:u,isRtl:m}=e.options;n=u?o.scrollLeft*(m&&-1||1):o.scrollTop,s(),t(n,p);},l=i(true),c=i(false);return c(),o.addEventListener("scroll",l,np),o.addEventListener("scrollend",c,np),()=>{o.removeEventListener("scroll",l),o.removeEventListener("scrollend",c);}},hb=(e,t,o)=>{if(t?.borderBoxSize){let r=t.borderBoxSize[0];if(r)return Math.round(r[o.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[o.options.horizontal?"width":"height"])},ip=(e,{adjustments:t=0,behavior:o},r)=>{var n,s;let i=e+t;(s=(n=r.scrollElement)==null?void 0:n.scrollTo)==null||s.call(n,{[r.options.horizontal?"left":"top"]:i,behavior:o});},pn=class{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=false,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let o=null,r=()=>o||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:o=new this.targetWindow.ResizeObserver(n=>{n.forEach(s=>{this._measureElement(s.target,s);});}));return {disconnect:()=>{var n;(n=r())==null||n.disconnect(),o=null;},observe:n=>{var s;return (s=r())==null?void 0:s.observe(n,{box:"border-box"})},unobserve:n=>{var s;return (s=r())==null?void 0:s.unobserve(n)}}})(),this.range=null,this.setOptions=o=>{Object.entries(o).forEach(([r,n])=>{typeof n>"u"&&delete o[r];}),this.options={debug:false,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:false,getItemKey:fb,rangeExtractor:Er,onChange:()=>{},measureElement:hb,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:true,isRtl:false,useScrollendEvent:true,...o};},this.notify=o=>{var r,n;(n=(r=this.options).onChange)==null||n.call(r,this,o);},this.maybeNotify=To(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),o=>{this.notify(o);},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(o=>o()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null;},this._didMount=()=>()=>{this.cleanup();},this._willUpdate=()=>{var o;let r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((o=this.scrollElement)==null?void 0:o.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n);}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify();})),this.unsubs.push(this.options.observeElementOffset(this,(n,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<n?"forward":"backward":null,this.scrollOffset=n,this.isScrolling=s,this.maybeNotify();}));}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(o,r)=>{let n=new Map,s=new Map;for(let i=r-1;i>=0;i--){let l=o[i];if(n.has(l.lane))continue;let c=s.get(l.lane);if(c==null||l.end>c.end?s.set(l.lane,l):l.end<c.end&&n.set(l.lane,true),n.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,l)=>i.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurementOptions=To(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(o,r,n,s,i)=>(this.pendingMeasuredCacheIndexes=[],{count:o,paddingStart:r,scrollMargin:n,getItemKey:s,enabled:i}),{key:false}),this.getMeasurements=To(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:o,paddingStart:r,scrollMargin:n,getItemKey:s,enabled:i},l)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size);}));let c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];let p=this.measurementsCache.slice(0,c);for(let u=c;u<o;u++){let m=s(u),f=this.options.lanes===1?p[u-1]:this.getFurthestMeasurement(p,u),y=f?f.end+this.options.gap:r+n,d=l.get(m),T=typeof d=="number"?d:this.options.estimateSize(u),x=y+T,P=f?f.lane:u%this.options.lanes;p[u]={index:u,start:y,size:T,end:x,key:m,lane:P};}return this.measurementsCache=p,p},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=To(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(o,r,n)=>this.range=o.length>0&&r>0?bb({measurements:o,outerSize:r,scrollOffset:n}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getIndexes=To(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(o,r,n,s)=>r===null?[]:o({startIndex:r.startIndex,endIndex:r.endIndex,overscan:n,count:s}),{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:()=>this.options.debug}),this.indexFromElement=o=>{let r=this.options.indexAttribute,n=o.getAttribute(r);return n?parseInt(n,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(o,r)=>{let n=this.indexFromElement(o),s=this.measurementsCache[n];if(!s)return;let i=s.key,l=this.elementsCache.get(i);l!==o&&(l&&this.observer.unobserve(l),this.observer.observe(o),this.elementsCache.set(i,o)),o.isConnected&&this.resizeItem(n,this.options.measureElement(o,r,this));},this.resizeItem=(o,r)=>{let n=this.measurementsCache[o];if(!n)return;let s=this.itemSizeCache.get(n.key)??n.size,i=r-s;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(n,i,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,r)),this.notify(false));},this.measureElement=o=>{if(!o){this.elementsCache.forEach((r,n)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(n));});return}this._measureElement(o,void 0);},this.getVirtualItems=To(()=>[this.getIndexes(),this.getMeasurements()],(o,r)=>{let n=[];for(let s=0,i=o.length;s<i;s++){let l=o[s],c=r[l];n.push(c);}return n},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=o=>{let r=this.getMeasurements();if(r.length!==0)return cn(r[lp(0,r.length-1,n=>cn(r[n]).start,o)])},this.getOffsetForAlignment=(o,r)=>{let n=this.getSize(),s=this.getScrollOffset();r==="auto"&&o>=s+n&&(r="end"),r==="end"&&(o-=n);let i=this.options.horizontal?"scrollWidth":"scrollHeight",c=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[i]:this.scrollElement[i]:0)-n;return Math.max(Math.min(c,o),0)},this.getOffsetForIndex=(o,r="auto")=>{o=Math.max(0,Math.min(o,this.options.count-1));let n=this.measurementsCache[o];if(!n)return;let s=this.getSize(),i=this.getScrollOffset();if(r==="auto")if(n.end>=i+s-this.options.scrollPaddingEnd)r="end";else if(n.start<=i+this.options.scrollPaddingStart)r="start";else return [i,r];let l=n.start-this.options.scrollPaddingStart+(n.size-s)/2;switch(r){case "center":return [this.getOffsetForAlignment(l,r),r];case "end":return [this.getOffsetForAlignment(n.end+this.options.scrollPaddingEnd,r),r];default:return [this.getOffsetForAlignment(n.start-this.options.scrollPaddingStart,r),r]}},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null);},this.scrollToOffset=(o,{align:r="start",behavior:n}={})=>{this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(o,r),{adjustments:void 0,behavior:n});},this.scrollToIndex=(o,{align:r="auto",behavior:n}={})=>{o=Math.max(0,Math.min(o,this.options.count-1)),this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");let s=this.getOffsetForIndex(o,r);if(!s)return;let[i,l]=s;this._scrollToOffset(i,{adjustments:void 0,behavior:n}),n!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(o))){let[p]=cn(this.getOffsetForIndex(o,l));tp(p,this.getScrollOffset())||this.scrollToIndex(o,{align:l,behavior:n});}else this.scrollToIndex(o,{align:l,behavior:n});}));},this.scrollBy=(o,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+o,{adjustments:void 0,behavior:r});},this.getTotalSize=()=>{var o;let r=this.getMeasurements(),n;return r.length===0?n=this.options.paddingStart:n=this.options.lanes===1?((o=r[r.length-1])==null?void 0:o.end)??0:Math.max(...r.slice(-this.options.lanes).map(s=>s.end)),Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(o,{adjustments:r,behavior:n})=>{this.options.scrollToFn(o,{behavior:n,adjustments:r},this);},this.measure=()=>{this.itemSizeCache=new Map,this.notify(false);},this.setOptions(t);}},lp=(e,t,o,r)=>{for(;e<=t;){let n=(e+t)/2|0,s=o(n);if(s<r)e=n+1;else if(s>r)t=n-1;else return n}return e>0?e-1:0};});function Sb(e){let t=Ht.useReducer(()=>({}),{})[1],o={...e,onChange:(n,s)=>{var i;s?flushSync(t):t(),(i=e.onChange)==null||i.call(e,n,s);}},[r]=Ht.useState(()=>new pn(o));return r.setOptions(o),cp(()=>r._didMount(),[]),cp(()=>r._willUpdate()),r}function un(e){return Sb({observeElementRect:sp,observeElementOffset:ap,scrollToFn:ip,...e})}var cp,Vs=g(()=>{a();Fs();Fs();cp=typeof document<"u"?Ht.useLayoutEffect:Ht.useEffect;});function Us(e){let{allLabel:t,asComparison:o,colorKey:r,data:n,defaultValue:s,defaultValueType:i,hideLabel:l,resetSectionVars:c,iconKey:p,id:u,levels:m,limit:f,placeholder:y,searchIndexKey:d,searchIndexSeparator:T,section:x,settings:P}=e,{print:C}=Xe(),k=_b(u),D=hn(u,x,k,o,c==="true"),M=o?`${k}-valueCompare`:`${k}-value`,j=o?`${k}-typeCompare`:`${k}-type`,I=useMantineTheme(),{colorScheme:w}=useMantineColorScheme(),[v,E]=useState(false),[R,_]=useState(true),[K,$]=useState(""),[q,X]=useState(false),[O,z]=useState([""].slice(1)),[B,G]=useState([]),[pe,De]=useState(""),F=P[Qt.DISABLED]||false,oe=useMemo(()=>C?Array.from(new Set(n.filter(Y=>B.includes(Y[`${pe} ID`])))).map(Y=>Y?.[pe]).join(", "):"",[C]),ie=l==="true"||!e.label?jsx(Fragment,{}):jsx(Z,{component:"div",html:e.label,size:"sm",style:P}),U=useRef(null),Q=useRef(false),N=useRef(!!f&&f<B.length),J=O.length,ee=m[J],ne=O.filter(Boolean);O.length>0&&ne.length===0&&ne.push(`${t} ${ee?.label}`),useEffect(()=>{if(!F){let A=new URLSearchParams(window.location.search),Y=A.get(M)||s,le=A.get(j)||i;Y&&le?(G(Ob(Y,s)),De(le)):(G([]),De(""));}},[window.location.search,s,i,F]),useEffect(()=>{let A=()=>{_(true);};return window.addEventListener("touchmove",A),()=>{window.removeEventListener("touchmove",A);}},[]);let Te=useMemo(()=>Ib(n,m,r,p,d,T),[r,n,p,m,d,T]),ue=useMemo(()=>{let A=Lb(K),Y=Array.from(Bb(Te,A)).reverse();return q?Y:O.reduce((le,We)=>le.filter(Be=>!We||Be.searchindex.indexOf(We)>-1),Y.filter(le=>le.type===ee?.value))},[ee,Te,K,q,O]),Co=useRef(null),Je=un({count:v?ue.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>Co.current,[]),overscan:10,rangeExtractor:useCallback(A=>Er(A),[])}),[Pn,Fe]=useState(-1),lt=Math.min(Pn,ue.length-1),Kt=useCallback(A=>{let Y=O.concat(A);q&&X(false),z(Y);},[q,O]),Yo=useCallback(()=>{let A=O.slice(0,J-1);q&&X(false),z(A);},[q,O,J]),In=useCallback(A=>{$(A.currentTarget.value),!N.current&&n.length>0&&E(true);},[n,$,N,E]),Ln=useCallback(()=>{$(""),D([],""),U.current?.focus(),f&&(N.current=false);},[$,D,U,f,N]),Xo=useCallback(A=>{let Y=B.filter(le=>le!==A);Y.length>0?D(Y,pe):D([],""),f&&Y.length<f&&(N.current=false);},[B,pe,D,f,N]),Qo=useCallback(A=>{pe!==A.type?D([A.value],A.type):B.includes(A.value)?Xo(A.value):f?(B.length<f&&D([...B,A.value],pe),B.length===f&&D([...B.slice(1),A.value],pe)):D([...B,A.value],pe),$("");},[D,pe,B,Xo,f]),Bn=useCallback(()=>{B.length>0&&K.length===0&&(D(B.slice(0,-1),pe),E(true),f&&(N.current=false)),K.length>0&&$(K.slice(0,-1));},[D,B,pe,K,$,E,f,N]),_n=useCallback(()=>{_(A=>A&&(Q.current=A,!A)),Fe(A=>A+1>=ue.length?A:A+1);},[Fe,ue]),On=useCallback(()=>{let A=ue[lt];A&&Qo(A);},[ue,lt,Qo]),Nn=useCallback(()=>{E(false);},[E]),Mn=useCallback(()=>{Yo(),Fe(0);},[Fe,Yo]),Dn=useCallback(()=>{let A=ue[lt];!q&&A&&A.type!==m[m.length-1]?.value&&(Kt(A.name),Fe(0));},[ue,lt,q,m,Fe,Kt]),Fn=useCallback(()=>{_(A=>A&&(Q.current=A,!A)),Fe(A=>A-1<0?0:A-1);},[Fe]),L=({label:A,onRemove:Y,...le})=>jsxs("div",{className:"bespoke-MultiHierarchySelector-selectedItem",style:{alignItems:"center",backgroundColor:w==="dark"?"var(--mantine-color-dark-7)":"var(--mantine-color-gray-1)",borderRadius:I.radius.sm,cursor:"default",color:w==="dark"?"var(--mantine-color-dark-0)":"var(--mantine-color-gray-7)",display:"flex",fontSize:rem(12),fontWeight:500,height:rem(22),margin:`calc(${I.spacing.xs} / 2 - ${rem(2)}) calc(${I.spacing.xs} / 2)`,maxWidth:`calc(100% - ${rem(10)})`,paddingLeft:`calc(${I.spacing.sm} / 1.5)`,paddingRight:0,userSelect:"none"},...le,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A}),jsx(CloseButton,{className:"bespoke-MultiHierarchySelector-itemCloseButton","aria-hidden":true,iconSize:"70%",onMouseDown:Y,radius:2,size:"sm",sx:{color:w==="dark"?"var(--mantine-color-dark-0)":"var(--mantine-color-gray-7)",marginLeft:`calc(${I.spacing.sm} / 6)`},tabIndex:-1})]}),se=useMemo(()=>B.map(A=>Te.find(Y=>Y.value===A)).filter(A=>!!A).map((A,Y)=>createElement(L,{...A,index:Y,label:A.label,key:A.value,onRemove:le=>{le.preventDefault(),le.stopPropagation(),Xo(A.value);}})),[B]),fe=forwardRef(function({color:Y,icon:le,label:We,value:Be,...Vn},Wd){return jsx("div",{className:"bespoke-MultiHierarchySelector-item",ref:Wd,style:{cursor:"pointer",width:"100%"},...Vn,children:jsxs(Group,{className:"bespoke-MultiHierarchySelector-itemWrapper",align:"center",wrap:"nowrap",gap:"xs",w:"100%",children:[le&&jsx(Box,{className:"bespoke-MultiHierarchySelector-itemIcon",bg:Y??"transparent",component:"img",w:20,h:20,src:le}),jsx(Text,{lineClamp:1,size:"sm",className:"bespoke-MultiHierarchySelector-itemLabel",children:We||Be})]})})});return jsxs(Fragment,{children:[jsx("div",{className:"bespoke-MultiHierarchySelector-root no-print",children:jsx(Input.Wrapper,{className:"bespoke-MultiHierarchySelector-inputWrapper",label:ie,children:jsxs(Popover,{closeOnClickOutside:true,disabled:F,keepMounted:true,opened:v,onChange:E,onClose:()=>{Fe(0),$("");},onOpen:()=>{ue.length>0&&Je.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:true,children:[jsx(Popover.Target,{children:jsxs(Box,{className:"bespoke-MultiHierarchySelector-content","aria-haspopup":"listbox",component:"div",onMouseLeave:()=>Fe(0),sx:{position:"relative","& .defaultValue":{backgroundColor:w==="dark"?"var(--mantine-color-dark-5)":"var(--mantine-color-gray-3)",color:w==="dark"?"var(--mantine-color-dark-1)":"var(--mantine-color-gray-7)"}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:B.join(",")}),jsx(Input,{className:"bespoke-MultiHierarchySelector-input",component:"div",disabled:F,multiline:true,onMouseDown:A=>{A.preventDefault(),!N.current&&n.length>0&&E(!v),U.current?.focus();},rightSection:B.length>0?jsx(CloseButton,{className:"bespoke-MultiHierarchySelector-closeButton",disabled:F,onClick:Ln,onMouseDown:A=>A.preventDefault(),variant:"transparent"}):jsx(IconSelector,{className:"bespoke-MultiHierarchySelector-icon",color:I.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{className:"bespoke-MultiHierarchySelector-selectedItems",component:"div","data-clearable":true,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${I.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:w==="dark"?"var(--mantine-color-dark-3)":"var(--mantine-color-gray-5)",opacity:1}},children:[se,jsx("input",{className:"bespoke-MultiHierarchySelector-search",autoComplete:"off","data-mantine-stop-propagation":v,onChange:In,onKeyDown:getHotkeyHandler([["ArrowDown",_n],["ArrowLeft",Mn],["ArrowRight",Dn],["ArrowUp",Fn],["Backspace",Bn],["Enter",On],["Escape",Nn]]),placeholder:B.length===0&&y||"",ref:U,readOnly:N.current,style:{appearance:"none",backgroundColor:"transparent",border:0,color:"inherit",flex:1,fontSize:I.fontSizes.sm,marginLeft:`calc(${I.spacing.xs} / 2)`,maxHeight:rem(22),minWidth:rem(60),outline:0,padding:0},type:"search",value:K})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:A=>A.preventDefault(),p:0,children:jsx("div",{className:"bespoke-MultiHierarchySelector-dropdown",style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{className:"bespoke-MultiHierarchySelector-dropdownContent",component:"div","data-combobox-popover":true,onMouseDown:A=>A.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",gap:"xs",w:"100%",children:[m.length>1&&jsxs(Stack,{gap:"xs",children:[jsxs(Group,{onClick:A=>{A.stopPropagation();},px:"xs",justify:"center",gap:"xs",children:[jsx(Button,{onClick:()=>{Fe(0),X(true),z([]),ue.length>0&&Je.scrollToIndex(0);},size:"xs",variant:q?"filled":"outline",children:t}),m.map((A,Y)=>jsx(Button,{onClick:()=>{q&&X(false);let le=[""].slice(1),We=Y;for(;We--;)le[We]=O[We]||"";Fe(0),z(le),ue.length>0&&Je.scrollToIndex(0);},size:"xs",variant:!q&&O.length===m.findIndex(le=>le.value===A?.value)?"filled":"outline",children:A?.label},A?.value))]}),jsx(Divider,{})]}),J>0&&jsxs(Group,{align:"center",wrap:"nowrap",px:"xs",children:[jsx(ActionIcon,{onClick:Yo,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:ne.map(A=>jsx(Text,{lineClamp:1,size:"xs",children:A},`${A}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>_(true),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:Co,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${Je.getTotalSize()}px`,position:"relative",width:"100%"},children:Je.getVirtualItems().map(A=>{let Y=ue[A.index],le=lt===A.index,We=B.includes(Y.value);return ue.length>0&&le&&!R&&Je.scrollToIndex(lt),jsxs(Group,{"aria-selected":le,align:"center","data-hovered":le||void 0,"data-index":A.index,"data-selected":We,id:Y.vale,wrap:"nowrap",onMouseEnter:Be=>{Be.preventDefault(),Be.stopPropagation(),R&&(Fe(A.index),_(false));},onMouseMove:Be=>{Be.preventDefault(),Be.stopPropagation(),_(true);},onMouseDown:Be=>{Be.preventDefault(),Qo(Y);},justify:"space-between",ref:Je.measureElement,role:"option",gap:"xs",sx:Be=>({borderRadius:Be.radius.xs,padding:"15px 5px 15px",paddingLeft:q&&10*m.findIndex(Vn=>Vn?.value===Y.type)||5,position:"absolute",top:0,left:0,height:`${A.size}px`,transform:`translateY(${A.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:w==="dark"?"var(--mantine-color-dark-4)":"var(--mantine-color-gray-1)"},"&:hover":{backgroundColor:w==="dark"?"var(--mantine-color-dark-4)":"var(--mantine-color-gray-1)"}}),tabIndex:-1,children:[jsx(fe,{index:A.index,...Y}),!q&&Y.type!==m[m.length-1]?.value&&jsx(ActionIcon,{onMouseDown:Be=>{Be.preventDefault(),Be.stopPropagation(),Kt(Y.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},Y.value)})})})]})})})})]})})}),C&&jsxs(Text,{children:[ie,": ",oe]})]})}var Ib,Lb,Bb,_b,Ob,bp=g(()=>{a();Vs();ve();At();_e();me();Ib=(e=[],t=[],o="",r="",n="",s="|")=>{let i=t.map(T=>T.value).slice(),l=`${i.pop()}`,c=T=>T[o],p=T=>T[r],u=T=>{if(T[n])return typeof T[n]=="string"?T[n].split(s):T[n]},m=new Set,f=[],y=[],d=nest().rollup(T=>{let x=T[0],P=v=>v&&v.value&&!m.has(v.value),C=i.map(v=>x[`${v} ID`]),k=i.map(v=>x[v]),D=i.map((v,E)=>{if(y[E]!==k[E]){y[E]=k[E];let R=c[E]||c[c.length-1]||c,_=p[E]||p[p.length-1]||p,K=u[E]||u[u.length-1]||u;return {color:R(x,v)||void 0,icon:_(x,v)||void 0,value:`${C[E]}`,label:k[E],name:k[E],type:v,searchindex:k.slice(0,E+1).concat(K(x,v)).join("|")}}return {}}).filter(P);D.forEach(v=>m.add(v.value));let M=c[c.length-1]||c,j=p[p.length-1]||p,I=u[u.length-1]||u,w=T.map(v=>({color:M(v,l)||void 0,icon:j(v,l)||void 0,value:`${v[`${l} ID`]}`,label:v[l],name:v[l],type:l,searchindex:k.concat(v[l]).concat(I(v,l)).join("|")}));f.push(...D.concat(w));});return i.forEach(T=>{d.key(x=>`${x[`${T} ID`]}|${x[T]}`);}),d.entries(e),f},Lb=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},Bb=(e,t)=>{let o=e.length,r,n=l=>r&&r.searchindex.includes(l.searchindex),i={next:()=>{for(let l=o-1;l>-1;l--){let c=e[l];if(t.test(`${c.value} ${c.label} ${c.searchindex}`)||n(c))return r=c,o=l,{done:false,value:c}}return {done:true,value:void 0}},[Symbol.iterator]:()=>i};return i},_b=e=>`multihierarchySelector${e}`,Ob=(e,t)=>e&&typeof e=="string"?e.split(","):t;});function Gs({headings:e,settings:t,type:o,title:r,shortTitle:n,_iconType:s,_iconVariant:i,_icon:l,_iconRadius:c,_iconSize:p,_iconPadding:u}){let{min:m="1",max:f="6",icons:y="yes"}=t||{},d=So(parseInt(m,10),parseInt(f,10),e),T=y==="yes",x=Se(r)||"",P=Se(n||r)||"",C=x&&x.length>0,k=s&&s!=="none",M=`(max-width: ${useMantineTheme().breakpoints.md})`,j=useMediaQuery(M),I=j?P:x,w=t&&t.align?String(t.align):"left",v=Fo(w),E=Oe(w),R=Ue(w),_=t&&t.titlePosition?String(t.titlePosition):"left",K=useMemo(()=>{let O={right:"left",left:"right"},z=C&&["left","right"].includes(_),B={};if(z){let G=_==="right";B={gap:"xs",justify:G&&O[E]?O[E]:E,style:{flexDirection:G?"row-reverse":"row"},wrap:"nowrap"};}else B={gap:"xs",align:R,justify:"center",style:{flexDirection:_==="bottom"?"column-reverse":"column"}};return {element:z?Group:Stack,props:B}},[C,E,R,_]),$=useMemo(()=>C?jsxs(Group,{className:"bespoke-Nav-title",gap:"xs",justify:E,wrap:"nowrap",children:[k&&jsx(ge,{blockType:"title",iconType:s,iconVariant:i,iconRadius:c,iconSize:p,icon:l,iconPadding:u}),jsx(Z,{className:"bespoke-Nav-titleText",style:{...t},html:I,lineClamp:1})]}):null,[C,k,E,I]),q=useMemo(()=>j?jsx($b,{contentOutline:d,showIcons:T,titleElement:$,wrapper:K}):null,[j,$,K]),X=useMemo(()=>j?null:o==="multilevel"?jsx(Ub,{contentOutline:d,showIcons:T,align:v}):jsx(zb,{contentOutline:d,showIcons:T,align:v}),[d,T,v,j]);return jsxs(Fragment,{children:[j&&q,!j&&jsxs(K.element,{className:"bespoke-Nav-wrapper",pos:"relative",...K.props,children:[C&&$,X]})]})}var Sp,zb,Cp,$b,Ub,wp=g(()=>{a();_e();Pt();Ne();kt();Pt();ve();Sp=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"}),zb=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null);useEffect(()=>{let i=()=>{let l=document.querySelector(".bespoke-nav");if(!l)return;let c=l.getBoundingClientRect(),p=false;e.forEach(u=>{let m=document.getElementById(`bespoke-title-${u.id}`);m&&m.getBoundingClientRect().top<=c.bottom&&(n(u.id),p=true);}),p||n(null);};return window.addEventListener("scroll",i),()=>{window.removeEventListener("scroll",i);}},[e]);let s=i=>!i||!i?.length?null:jsx(Fragment,{children:i.map(l=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(ge,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})}),jsx(Box,{pl:"xs",children:s(l.children)})]},l.id))});return jsx(Fragment,{children:jsx(Box,{component:"nav",className:"bespoke-nav",children:jsx(List,{sx:i=>({display:"flex",gap:i.spacing.md,justifyContent:o,listStyleType:"none"}),children:e?.map(i=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${i.id}`,"data-active":i.id===r,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(ge,{...i.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:i.label}})]})})}),i?.children?.length?jsx(Menu.Dropdown,{children:s(i.children)}):null]})},i.id))})})})},Cp=({contentOutline:e,closeNav:t,showIcons:o})=>{let[r,n]=useState(null);return jsx(Stack,{className:"bespoke-MobileNav-accordion",children:e.map(s=>s.children.length?jsxs(Fragment,{children:[jsxs(Group,{className:"bespoke-MobileNav-group",gap:0,wrap:"nowrap",children:[jsx(UnstyledButton,{className:"bespoke-MobileNav-button",w:"100%",component:"a",onClick:t,href:`#bespoke-title-${s.id}`,children:jsxs(Group,{className:"bespoke-MobileNav-buttonContent",gap:"sm",wrap:"nowrap",children:[o&&jsx(ge,{...s.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{className:"bespoke-MobileNav-buttonText",dangerouslySetInnerHTML:{__html:s.label}})]})},s.id),jsx(ActionIcon,{className:"bespoke-MobileNav-chevron",component:"a",size:"lg",onClick:()=>n(i=>i===s.id?null:s.id),children:jsx(IconChevronDown,{style:{transition:"transform 0.2s",transform:r===s.id?"rotate(-180deg)":"none"},stroke:1})})]},s.id),jsx(Collapse,{className:"bespoke-MobileNav-collapse",in:r===s.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(Cp,{contentOutline:s.children,closeNav:t,showIcons:o})})]}):jsx(Group,{className:"bespoke-MobileNav-group",wrap:"nowrap",children:jsx(UnstyledButton,{className:"bespoke-MobileNav-button",display:"flex",w:"100%",component:"a",href:`#bespoke-title-${s.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[o&&jsx(ge,{...s.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:s.label}})]})},s.id)},s.id))})},$b=({contentOutline:e,showIcons:t,titleElement:o,wrapper:r})=>{let[n,{toggle:s}]=useDisclosure(false),i=n?"Close content outline":"Open content outline";return jsxs(Box,{className:"bespoke-MobileNav-root",component:"nav",children:[jsxs(r.element,{className:"bespoke-MobileNav-header",...r.props,onClick:s,children:[o&&o,jsx(ActionIcon,{className:"bespoke-MobileNav-toggle","aria-label":i,size:"lg",variant:"subtle",children:n?jsx(IconChevronUp,{size:"xl",stroke:1.5}):jsx(IconChevronDown,{size:"xl",stroke:1.5})})]}),jsx(Collapse,{in:n,mt:"md",className:"bespoke-MobileNav-body",children:jsx(Cp,{contentOutline:e,closeNav:s,showIcons:t})})]})},Ub=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null),[s,i]=useState(null);useEffect(()=>{let c=()=>{let p=document.querySelector(".bespoke-nav");if(!p)return;let u=p.getBoundingClientRect(),m=false;e.forEach(f=>{let y=document.getElementById(`bespoke-title-${f.id}`);y&&(y.getBoundingClientRect().top<=u.bottom&&(n(f.id),i(null),m=true),f.children.forEach(T=>{let x=document.getElementById(`bespoke-title-${T.id}`);x&&x.getBoundingClientRect().top<=u.bottom&&(i(T.id),n(f.id),m=true);}));}),m||(n(null),i(null));};return window.addEventListener("scroll",c),()=>{window.removeEventListener("scroll",c);}},[e]);let l=c=>!c||!c?.length?null:jsx(Fragment,{children:c.map(p=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${p.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(ge,{...p.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:p.label}})]})})}),jsx(Box,{pl:"xs",children:l(p.children)})]},p.id))});return jsxs(Box,{component:"nav",className:"bespoke-Nav-root",children:[jsx(List,{className:"bespoke-Nav-level","data-level":"1",sx:Sp(o),children:e?.map(c=>jsx(List.Item,{className:"bespoke-Nav-levelItem",children:jsx(Anchor,{className:"bespoke-Nav-itemAnchor",href:`#bespoke-title-${c.id}`,"data-active":r===c.id,onClick:()=>n(c.id),children:jsxs(Group,{className:"bespoke-Nav-itemGroup",gap:"sm",wrap:"nowrap",children:[t&&jsx(ge,{...c.iconProps,iconSize:"sm"}),jsx(Text,{className:"bespoke-Nav-itemLabel",dangerouslySetInnerHTML:{__html:c.label}})]})})},c.id))}),r&&e.find(c=>c.id===r)?.children.length>0&&jsx(List,{className:"bespoke-Nav-level","data-level":"2",sx:Sp(o),children:e.find(c=>c.id===r)?.children.map(c=>jsx(List.Item,{className:"bespoke-Nav-levelItem",children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{className:"bespoke-Nav-itemAnchor",href:`#bespoke-title-${c.id}`,"data-active":c.id===s,children:jsxs(Group,{className:"bespoke-Nav-itemGroup",gap:"sm",wrap:"nowrap",children:[t&&jsx(ge,{...c.iconProps,iconSize:"sm"}),jsx(Text,{className:"bespoke-Nav-itemLabel",dangerouslySetInnerHTML:{__html:c.label}})]})})}),c?.children?.length?jsx(Menu.Dropdown,{className:"bespoke-Nav-levelMenuDropdown",children:l(c.children)}):null]})},c.id))})]})};});function qs(e){let{related_reports:t,settings:o}=e,r=H(f=>f.status.currentLocale),n=H(f=>f.status.localeDefault),s=tn(),i=useRouter(),l=Ze("components");if(!t?.length)return;let c=r===n?"":`/${r}`,p=f=>{i.push(`${f}`);},u=l?.ReportTile?l.ReportTile:Ws,m=Ue(o&&o.align?String(o.align):"center");return jsx(Grid,{className:"bespoke-Related-root",justify:m,children:t.map(f=>{let y=`${c}${s}${f.link}`,d=f.entities.map(k=>({original_id:k.id,name:k.name,id:k.content_id,variant:k.variant_name,variant_id:k.variant_id,dimension:k.dimension_name,dimension_id:k.dimension_id,image:{src:`/api/cms/member/image?member=${k.content_id}&size=thumb`,alt:k.name}})),T=f.entities.map(k=>k.id).join("-"),x=f.entities.map(k=>k.name).join(" & "),P=f.entities[0]?f.entities[0].report_id:null,C=k=>{k.preventDefault(),p(y);};return jsx(Grid.Col,{className:"bespoke-Related-col",xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(u,{reportId:P,reportName:x,members:d,href:y,onClick:C})},T)})})}var Pp=g(()=>{a();re();we();js();_e();Ne();});function Ks({id:e,label:t,settings:o,showIcon:r,fullWidth:n,showWhenDisabled:s}){let i=mt(e).data,{sectionVariables:l,resetSectionVariables:c}=Pe(i?.section_id),p=!!Object.keys(l).length,u=Ue(o&&o.align?o.align:"left");return !p&&!s?null:jsx(Button,{className:"bespoke-ResetButton-root",onClick:()=>c(),disabled:!p,fullWidth:n,sx:{justifySelf:u},children:jsxs(Group,{className:"bespoke-ResetButton-content",align:"center",children:[t,r&&jsx(IconRefresh,{className:"bespoke-ResetButton-icon"})]})})}var Lp=g(()=>{a();we();Ne();});function Ys({settings:e,label:t,removeLabel:o,showIcon:r,position:n="center",asComparison:s=false}){let i=H(k=>k.records.entities.report),l=H(k=>k.variables.attributes),c=e&&e.search?e.search:"inline",p=Object.values(i)[0].settings,u=useRouter(),{comparisonLoaded:m,loading:f}=nt(),y=Object.keys(u.query).includes("compare"),T=m&&y?jsx(Button,{onClick:()=>{let k={...u.query};delete k.compare,u.push({pathname:u.pathname,query:k},void 0,{shallow:true});},rightIcon:jsx(IconX,{}),children:o||"Remove Comparison"}):jsx(Button,{loading:f,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",r&&jsx(IconPlus,{})]})}),x={searchReportParams:{report:[Number(Object.keys(i)[0])],variant:p.compareLevels?[]:[l.variant_id1]}},C=Vo(T,c,k=>{u.push({pathname:u.pathname,query:{...u.query,compare:k.reportPath}});},x);return s?null:jsx(Group,{className:"bespoke-ComparisonButton-root",align:n,children:y?T:C})}var Op=g(()=>{a();_e();re();Ut();});function Qs({columns:e=[],data:t=[],tableProps:o={},sectionId:r=null}){let[n,s]=useState(false),i=useMemo(()=>e.map(m=>m.accessorKey),[e]),l=useMemo(()=>t.filter(m=>typeof m=="object"&&m!==null&&!Array.isArray(m)&&Object.keys(m).some(f=>i.includes(f))),[i,t]),c=useMemo(()=>e.map(m=>({...m,Cell:({renderedCellValue:f})=>jsx(Z,{html:`${f}`}),filterFn:"contains"})),[e]),p=Ye("table"),u={...MRT_Localization_EN,...p};return jsx(MantineReactTable,{className:"bespoke-Table-root",...o,autoResetPageIndex:false,columns:c,data:l,enableColumnFilterModes:true,enableFilterMatchHighlighting:false,globalFilterFn:"contains",layoutMode:"grid",localization:u,onIsFullScreenChange:m=>{let f=document.getElementById(`section-${r}`);f&&(m?f.style.zIndex="10":f.style.zIndex="1"),s(m);},state:{...o.state,isFullScreen:n}})}var Mp=g(()=>{a();ve();st();});function Zs({label:e,url:t,settings:o}){let{align:r}=o;return e?jsx(Group,{className:"bespoke-Button-root",align:r,grow:r==="justify",children:jsx(Button,{className:"bespoke-Button-button",component:"a",target:"_blank",href:t||"",children:e||"Button"})}):null}var Fp=g(()=>{a();});function iy({block:e}){let{id:t}=e;return jsxs(Stack,{className:"bespoke-Fallback-root",align:"center",gap:"sm",children:[jsx(ThemeIcon,{className:"bespoke-Fallback-themeIcon",radius:"md",size:100,children:jsx(IconCircleKey,{size:100})}),jsxs(Title,{className:"bespoke-Fallback-title",order:5,children:["Private content (Block ",t,")"]}),jsx(Text,{className:"bespoke-Fallback-text",children:"Sorry, you do not have sufficient permissions to view this block."}),jsx(Text,{className:"bespoke-Fallback-text",children:"Contact your account manager to check your access role."})]})}function Js(e){let t=ly();return jsx(t,{block:e})}var ly,$p=g(()=>{a();_e();ly=()=>{let e=Ze("components"),t=iy;return e?.CustomFallback&&(t=e.CustomFallback),t};});var Ro,ea=g(()=>{a();Ro=class extends Component{constructor(t){super(t),this.state={hasError:false};}static getDerivedStateFromError(t){return console.info("getDerivedStateFromError",t),{hasError:true}}componentDidCatch(t,o){console.error("Error information:",o.componentStack),notifications.show({autoClose:false,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 Ir({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var ta=g(()=>{a();});var Hp={};zn(Hp,{default:()=>Gp});function Gp(e){let{print:t}=Xe(),{block:o,active:r,locale:n,variables:s,configOverride:i={}}=e,l=vt(o),c=go(n),p={variables:s},u=useRouter(),{sectionVariables:m,setSectionVariables:f,resetSectionVariables:y}=Pe(o.section_id),d=_o(),T=JSON.stringify(m),x=useMemo(()=>{if(!l?.logic)return {error:"Add a Configuration"};let I=pt({logic:l.logic},c,p).logic,w={router:u,section:{variables:m,setVariables:f,resetVariables:y}};return Do(I,c,s,n,o.id,{},w,d)},[o,r,s,T]),{type:P}=x.config||{},C=P&&oa[P]?P:"Treemap";oa[P]||(x.config={error:`"${P}" is not a valid Visualization Type`});let k=oa[C],D=useMemo(()=>{let{_data:I,...w}=x.config;return gy(w,t)},[x,t]),M={locale:n,variables:s,...D,...i},j=I=>{let w;try{w=x.dataFormat(I);}catch(v){console.error("Error in dataFormat: ",v),w=[];}return w};return jsx(Box,{className:"bespoke-Viz-root","data-ignore-print":M._printIgnore?"true":void 0,sx:{display:"flex",minHeight:P==="HTML"?void 0:400,"& .chart":{flex:"1 1 100%"}},children:jsx(Ro,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(k,{style:{flex:1},dataFormat:I=>{let w;try{w=x.dataFormat(I);}catch(v){console.error("Error in dataFormat: ",v),w=[];}return w},config:{...M,dataFormat:j,sectionVariables:T}},"viz-key")})})}var oa,gy,qp=g(()=>{a();eo();xr();Zt();we();ea();At();ta();oa={...dy,HTML:Ir},gy=(e,t)=>{let o={...e};return t&&(o.detectResize=false,o.detectResizeDelay=0,o.detectVisible=false,o.detectVisibleInterval=0,o.duration=0,o.shapeConfig={...o.shapeConfig,duration:0}),o};});var by,Wp=g(()=>{a();me();Fc();Hc();Wc();Kc();Zc();Jc();ep();bp();wp();Pp();Lp();Op();Mp();Fp();$p();by=hy(()=>Promise.resolve().then(()=>(qp(),Hp)),{ssr:false}),{[S.PARAGRAPH]:ws,[S.STAT]:Ps,[S.SUBTITLE]:Is,[S.TITLE]:Bs,[S.SELECTOR]:Ms,[S.VIZ]:by,[S.GENERATOR]:ln,[S.SECTION_FLAG]:ln,[S.IMAGE]:Ds,[S.NAV]:Gs,[S.RELATED]:qs,[S.RESET_BUTTON]:Ks,[S.COMPARISON_BUTTON]:Ys,[S.TABLE]:Qs,[S.BUTTON]:Zs,[S.MULTIHIERARCHY_SELECTOR]:Us,[S.FALLBACK]:Js};});var yy,jp,Kp=g(()=>{a();yy=(e,t)=>{let o=e.allLabel||"All",r=e.colorKey||"",n=e.data||[],s=e.hideLabel||"false",i=e.resetSectionVars||"false",l=e.iconKey||"",c=e.label||"Unlabeled Multihierarchy Selector",p=e.levels||[],u=e.limit||void 0,m=e.placeholder||"",f=e.searchIndexKey||"",y=e.searchIndexSeparator||"",d,T;return e.defaultValue&&e.defaultValueType&&(d=e.defaultValue,T=e.defaultValueType),(!d||!T)&&(d=[],T=""),{allLabel:o,colorKey:r,data:n,defaultValue:d,defaultValueType:T,hideLabel:s,resetSectionVars:i,iconKey:l,id:t,label:c,levels:p,limit:u,placeholder:m,searchIndexKey:f,searchIndexSeparator:y}},jp=yy;});var Sy,Yp,xy,Xp,Qp=g(()=>{a();me();Vr();Sy=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{id:t,label:t}:t):[],Yp=(e,t)=>t===Ee.MULTI&&!Array.isArray(e)?[e]:e,xy=(e,t)=>{let o=e.type||Ee.SINGLE,r=e.component||"Selector",n=e.hideLabel||"false",s=e.resetSectionVars||"false",i=e.name||"Unlabeled Selector",l=Sy(e.options||[]),c;if(e.defaultValue){let p=Yp(e.defaultValue,o);Jt(o,p,l)&&(c=p);}if(!c){let p=l&&l[0]&&l[0].id||l[0]||"";c=Yp(p,o);}return {id:t,name:i,type:o,options:l,component:r,defaultValue:c,hideLabel:n,resetSectionVars:s}},Xp=xy;});var Ty,Lr,Zp=g(()=>{a();me();Kp();Qp();Ty={[S.SELECTOR]:Xp,[S.MULTIHIERARCHY_SELECTOR]:jp},Lr=Ty;});function na({paragraph:e,tooltip:t,settings:o}){return jsx(Z,{component:"p",html:e||`Lorem ipsum dolor sit amet,
10
+ color: hsl(${Math.max(0,Math.min(120-120*T,120))}deg 100% 31%);`,o?.key);}return (c=o?.onChange)==null||c.call(o,n),n}}function cn(e,t){if(e===void 0)throw new Error(`Unexpected undefined${""}`);return e}var tp,op,rp=g(()=>{a();tp=(e,t)=>Math.abs(e-t)<1,op=(e,t,o)=>{let r;return function(...n){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,n),o);}};});function bb({measurements:e,outerSize:t,scrollOffset:o}){let r=e.length-1,s=lp(0,r,l=>e[l].start,o),i=s;for(;i<r&&e[i].end<o+t;)i++;return {startIndex:s,endIndex:i}}var fb,Er,sp,np,gb,ap,hb,ip,pn,lp,Fs=g(()=>{a();rp();fb=e=>e,Er=e=>{let t=Math.max(e.startIndex-e.overscan,0),o=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let n=t;n<=o;n++)r.push(n);return r},sp=(e,t)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let n=i=>{let{width:l,height:c}=i;t({width:Math.round(l),height:Math.round(c)});};if(n(o.getBoundingClientRect()),!r.ResizeObserver)return ()=>{};let s=new r.ResizeObserver(i=>{let l=i[0];if(l?.borderBoxSize){let c=l.borderBoxSize[0];if(c){n({width:c.inlineSize,height:c.blockSize});return}}n(o.getBoundingClientRect());});return s.observe(o,{box:"border-box"}),()=>{s.unobserve(o);}},np={passive:true},gb=typeof window>"u"?true:"onscrollend"in window,ap=(e,t)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let n=0,s=e.options.useScrollendEvent&&gb?()=>{}:op(r,()=>{t(n,false);},e.options.isScrollingResetDelay),i=p=>()=>{let{horizontal:u,isRtl:m}=e.options;n=u?o.scrollLeft*(m&&-1||1):o.scrollTop,s(),t(n,p);},l=i(true),c=i(false);return c(),o.addEventListener("scroll",l,np),o.addEventListener("scrollend",c,np),()=>{o.removeEventListener("scroll",l),o.removeEventListener("scrollend",c);}},hb=(e,t,o)=>{if(t?.borderBoxSize){let r=t.borderBoxSize[0];if(r)return Math.round(r[o.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[o.options.horizontal?"width":"height"])},ip=(e,{adjustments:t=0,behavior:o},r)=>{var n,s;let i=e+t;(s=(n=r.scrollElement)==null?void 0:n.scrollTo)==null||s.call(n,{[r.options.horizontal?"left":"top"]:i,behavior:o});},pn=class{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=false,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let o=null,r=()=>o||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:o=new this.targetWindow.ResizeObserver(n=>{n.forEach(s=>{this._measureElement(s.target,s);});}));return {disconnect:()=>{var n;(n=r())==null||n.disconnect(),o=null;},observe:n=>{var s;return (s=r())==null?void 0:s.observe(n,{box:"border-box"})},unobserve:n=>{var s;return (s=r())==null?void 0:s.unobserve(n)}}})(),this.range=null,this.setOptions=o=>{Object.entries(o).forEach(([r,n])=>{typeof n>"u"&&delete o[r];}),this.options={debug:false,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:false,getItemKey:fb,rangeExtractor:Er,onChange:()=>{},measureElement:hb,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:true,isRtl:false,useScrollendEvent:true,...o};},this.notify=o=>{var r,n;(n=(r=this.options).onChange)==null||n.call(r,this,o);},this.maybeNotify=To(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),o=>{this.notify(o);},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(o=>o()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null;},this._didMount=()=>()=>{this.cleanup();},this._willUpdate=()=>{var o;let r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((o=this.scrollElement)==null?void 0:o.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n);}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify();})),this.unsubs.push(this.options.observeElementOffset(this,(n,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<n?"forward":"backward":null,this.scrollOffset=n,this.isScrolling=s,this.maybeNotify();}));}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(o,r)=>{let n=new Map,s=new Map;for(let i=r-1;i>=0;i--){let l=o[i];if(n.has(l.lane))continue;let c=s.get(l.lane);if(c==null||l.end>c.end?s.set(l.lane,l):l.end<c.end&&n.set(l.lane,true),n.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,l)=>i.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurementOptions=To(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(o,r,n,s,i)=>(this.pendingMeasuredCacheIndexes=[],{count:o,paddingStart:r,scrollMargin:n,getItemKey:s,enabled:i}),{key:false}),this.getMeasurements=To(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:o,paddingStart:r,scrollMargin:n,getItemKey:s,enabled:i},l)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size);}));let c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];let p=this.measurementsCache.slice(0,c);for(let u=c;u<o;u++){let m=s(u),f=this.options.lanes===1?p[u-1]:this.getFurthestMeasurement(p,u),y=f?f.end+this.options.gap:r+n,d=l.get(m),T=typeof d=="number"?d:this.options.estimateSize(u),x=y+T,P=f?f.lane:u%this.options.lanes;p[u]={index:u,start:y,size:T,end:x,key:m,lane:P};}return this.measurementsCache=p,p},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=To(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(o,r,n)=>this.range=o.length>0&&r>0?bb({measurements:o,outerSize:r,scrollOffset:n}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getIndexes=To(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(o,r,n,s)=>r===null?[]:o({startIndex:r.startIndex,endIndex:r.endIndex,overscan:n,count:s}),{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:()=>this.options.debug}),this.indexFromElement=o=>{let r=this.options.indexAttribute,n=o.getAttribute(r);return n?parseInt(n,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(o,r)=>{let n=this.indexFromElement(o),s=this.measurementsCache[n];if(!s)return;let i=s.key,l=this.elementsCache.get(i);l!==o&&(l&&this.observer.unobserve(l),this.observer.observe(o),this.elementsCache.set(i,o)),o.isConnected&&this.resizeItem(n,this.options.measureElement(o,r,this));},this.resizeItem=(o,r)=>{let n=this.measurementsCache[o];if(!n)return;let s=this.itemSizeCache.get(n.key)??n.size,i=r-s;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(n,i,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,r)),this.notify(false));},this.measureElement=o=>{if(!o){this.elementsCache.forEach((r,n)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(n));});return}this._measureElement(o,void 0);},this.getVirtualItems=To(()=>[this.getIndexes(),this.getMeasurements()],(o,r)=>{let n=[];for(let s=0,i=o.length;s<i;s++){let l=o[s],c=r[l];n.push(c);}return n},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=o=>{let r=this.getMeasurements();if(r.length!==0)return cn(r[lp(0,r.length-1,n=>cn(r[n]).start,o)])},this.getOffsetForAlignment=(o,r)=>{let n=this.getSize(),s=this.getScrollOffset();r==="auto"&&o>=s+n&&(r="end"),r==="end"&&(o-=n);let i=this.options.horizontal?"scrollWidth":"scrollHeight",c=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[i]:this.scrollElement[i]:0)-n;return Math.max(Math.min(c,o),0)},this.getOffsetForIndex=(o,r="auto")=>{o=Math.max(0,Math.min(o,this.options.count-1));let n=this.measurementsCache[o];if(!n)return;let s=this.getSize(),i=this.getScrollOffset();if(r==="auto")if(n.end>=i+s-this.options.scrollPaddingEnd)r="end";else if(n.start<=i+this.options.scrollPaddingStart)r="start";else return [i,r];let l=n.start-this.options.scrollPaddingStart+(n.size-s)/2;switch(r){case "center":return [this.getOffsetForAlignment(l,r),r];case "end":return [this.getOffsetForAlignment(n.end+this.options.scrollPaddingEnd,r),r];default:return [this.getOffsetForAlignment(n.start-this.options.scrollPaddingStart,r),r]}},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null);},this.scrollToOffset=(o,{align:r="start",behavior:n}={})=>{this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(o,r),{adjustments:void 0,behavior:n});},this.scrollToIndex=(o,{align:r="auto",behavior:n}={})=>{o=Math.max(0,Math.min(o,this.options.count-1)),this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");let s=this.getOffsetForIndex(o,r);if(!s)return;let[i,l]=s;this._scrollToOffset(i,{adjustments:void 0,behavior:n}),n!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(o))){let[p]=cn(this.getOffsetForIndex(o,l));tp(p,this.getScrollOffset())||this.scrollToIndex(o,{align:l,behavior:n});}else this.scrollToIndex(o,{align:l,behavior:n});}));},this.scrollBy=(o,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+o,{adjustments:void 0,behavior:r});},this.getTotalSize=()=>{var o;let r=this.getMeasurements(),n;return r.length===0?n=this.options.paddingStart:n=this.options.lanes===1?((o=r[r.length-1])==null?void 0:o.end)??0:Math.max(...r.slice(-this.options.lanes).map(s=>s.end)),Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(o,{adjustments:r,behavior:n})=>{this.options.scrollToFn(o,{behavior:n,adjustments:r},this);},this.measure=()=>{this.itemSizeCache=new Map,this.notify(false);},this.setOptions(t);}},lp=(e,t,o,r)=>{for(;e<=t;){let n=(e+t)/2|0,s=o(n);if(s<r)e=n+1;else if(s>r)t=n-1;else return n}return e>0?e-1:0};});function Sb(e){let t=Ht.useReducer(()=>({}),{})[1],o={...e,onChange:(n,s)=>{var i;s?flushSync(t):t(),(i=e.onChange)==null||i.call(e,n,s);}},[r]=Ht.useState(()=>new pn(o));return r.setOptions(o),cp(()=>r._didMount(),[]),cp(()=>r._willUpdate()),r}function un(e){return Sb({observeElementRect:sp,observeElementOffset:ap,scrollToFn:ip,...e})}var cp,Vs=g(()=>{a();Fs();Fs();cp=typeof document<"u"?Ht.useLayoutEffect:Ht.useEffect;});function Us(e){let{allLabel:t,asComparison:o,colorKey:r,data:n,defaultValue:s,defaultValueType:i,hideLabel:l,resetSectionVars:c,iconKey:p,id:u,levels:m,limit:f,placeholder:y,searchIndexKey:d,searchIndexSeparator:T,section:x,settings:P}=e,{print:C}=Xe(),k=_b(u),D=hn(u,x,k,o,c==="true"),M=o?`${k}-valueCompare`:`${k}-value`,j=o?`${k}-typeCompare`:`${k}-type`,I=useMantineTheme(),{colorScheme:w}=useMantineColorScheme(),[v,E]=useState(false),[R,_]=useState(true),[K,$]=useState(""),[q,X]=useState(false),[O,z]=useState([""].slice(1)),[B,G]=useState([]),[pe,De]=useState(""),F=P[Qt.DISABLED]||false,oe=useMemo(()=>C?Array.from(new Set(n.filter(Y=>B.includes(Y[`${pe} ID`])))).map(Y=>Y?.[pe]).join(", "):"",[C]),ie=l==="true"||!e.label?jsx(Fragment,{}):jsx(Z,{component:"div",html:e.label,size:"sm",style:P}),U=useRef(null),Q=useRef(false),N=useRef(!!f&&f<B.length),J=O.length,ee=m[J],ne=O.filter(Boolean);O.length>0&&ne.length===0&&ne.push(`${t} ${ee?.label}`),useEffect(()=>{if(!F){let A=new URLSearchParams(window.location.search),Y=A.get(M)||s,le=A.get(j)||i;Y&&le?(G(Ob(Y,s)),De(le)):(G([]),De(""));}},[window.location.search,s,i,F]),useEffect(()=>{let A=()=>{_(true);};return window.addEventListener("touchmove",A),()=>{window.removeEventListener("touchmove",A);}},[]);let Te=useMemo(()=>Ib(n,m,r,p,d,T),[r,n,p,m,d,T]),ue=useMemo(()=>{let A=Lb(K),Y=Array.from(Bb(Te,A)).reverse();return q?Y:O.reduce((le,We)=>le.filter(Be=>!We||Be.searchindex.indexOf(We)>-1),Y.filter(le=>le.type===ee?.value))},[ee,Te,K,q,O]),Co=useRef(null),Je=un({count:v?ue.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>Co.current,[]),overscan:10,rangeExtractor:useCallback(A=>Er(A),[])}),[Pn,Fe]=useState(-1),lt=Math.min(Pn,ue.length-1),Kt=useCallback(A=>{let Y=O.concat(A);q&&X(false),z(Y);},[q,O]),Yo=useCallback(()=>{let A=O.slice(0,J-1);q&&X(false),z(A);},[q,O,J]),In=useCallback(A=>{$(A.currentTarget.value),!N.current&&n.length>0&&E(true);},[n,$,N,E]),Ln=useCallback(()=>{$(""),D([],""),U.current?.focus(),f&&(N.current=false);},[$,D,U,f,N]),Xo=useCallback(A=>{let Y=B.filter(le=>le!==A);Y.length>0?D(Y,pe):D([],""),f&&Y.length<f&&(N.current=false);},[B,pe,D,f,N]),Qo=useCallback(A=>{pe!==A.type?D([A.value],A.type):B.includes(A.value)?Xo(A.value):f?(B.length<f&&D([...B,A.value],pe),B.length===f&&D([...B.slice(1),A.value],pe)):D([...B,A.value],pe),$("");},[D,pe,B,Xo,f]),Bn=useCallback(()=>{B.length>0&&K.length===0&&(D(B.slice(0,-1),pe),E(true),f&&(N.current=false)),K.length>0&&$(K.slice(0,-1));},[D,B,pe,K,$,E,f,N]),_n=useCallback(()=>{_(A=>A&&(Q.current=A,!A)),Fe(A=>A+1>=ue.length?A:A+1);},[Fe,ue]),On=useCallback(()=>{let A=ue[lt];A&&Qo(A);},[ue,lt,Qo]),Nn=useCallback(()=>{E(false);},[E]),Mn=useCallback(()=>{Yo(),Fe(0);},[Fe,Yo]),Dn=useCallback(()=>{let A=ue[lt];!q&&A&&A.type!==m[m.length-1]?.value&&(Kt(A.name),Fe(0));},[ue,lt,q,m,Fe,Kt]),Fn=useCallback(()=>{_(A=>A&&(Q.current=A,!A)),Fe(A=>A-1<0?0:A-1);},[Fe]),L=({label:A,onRemove:Y,...le})=>jsxs("div",{className:"bespoke-MultiHierarchySelector-selectedItem",style:{alignItems:"center",backgroundColor:w==="dark"?"var(--mantine-color-dark-7)":"var(--mantine-color-gray-1)",borderRadius:I.radius.sm,cursor:"default",color:w==="dark"?"var(--mantine-color-dark-0)":"var(--mantine-color-gray-7)",display:"flex",fontSize:rem(12),fontWeight:500,height:rem(22),margin:`calc(${I.spacing.xs} / 2 - ${rem(2)}) calc(${I.spacing.xs} / 2)`,maxWidth:`calc(100% - ${rem(10)})`,paddingLeft:`calc(${I.spacing.sm} / 1.5)`,paddingRight:0,userSelect:"none"},...le,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A}),jsx(CloseButton,{className:"bespoke-MultiHierarchySelector-itemCloseButton","aria-hidden":true,iconSize:"70%",onMouseDown:Y,radius:2,size:"sm",sx:{color:w==="dark"?"var(--mantine-color-dark-0)":"var(--mantine-color-gray-7)",marginLeft:`calc(${I.spacing.sm} / 6)`},tabIndex:-1})]}),se=useMemo(()=>B.map(A=>Te.find(Y=>Y.value===A)).filter(A=>!!A).map((A,Y)=>createElement(L,{...A,index:Y,label:A.label,key:A.value,onRemove:le=>{le.preventDefault(),le.stopPropagation(),Xo(A.value);}})),[B]),fe=forwardRef(function({color:Y,icon:le,label:We,value:Be,...Vn},Wd){return jsx("div",{className:"bespoke-MultiHierarchySelector-item",ref:Wd,style:{cursor:"pointer",width:"100%"},...Vn,children:jsxs(Group,{className:"bespoke-MultiHierarchySelector-itemWrapper",align:"center",wrap:"nowrap",gap:"xs",w:"100%",children:[le&&jsx(Box,{className:"bespoke-MultiHierarchySelector-itemIcon",bg:Y??"transparent",component:"img",w:20,h:20,src:le}),jsx(Text,{lineClamp:1,size:"sm",className:"bespoke-MultiHierarchySelector-itemLabel",children:We||Be})]})})});return jsxs(Fragment,{children:[jsx("div",{className:"bespoke-MultiHierarchySelector-root no-print",children:jsx(Input.Wrapper,{className:"bespoke-MultiHierarchySelector-inputWrapper",label:ie,children:jsxs(Popover,{closeOnClickOutside:true,disabled:F,keepMounted:true,opened:v,onChange:E,onClose:()=>{Fe(0),$("");},onOpen:()=>{ue.length>0&&Je.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:true,children:[jsx(Popover.Target,{children:jsxs(Box,{className:"bespoke-MultiHierarchySelector-content","aria-haspopup":"listbox",component:"div",onMouseLeave:()=>Fe(0),sx:{position:"relative","& .defaultValue":{backgroundColor:w==="dark"?"var(--mantine-color-dark-5)":"var(--mantine-color-gray-3)",color:w==="dark"?"var(--mantine-color-dark-1)":"var(--mantine-color-gray-7)"}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:B.join(",")}),jsx(Input,{className:"bespoke-MultiHierarchySelector-input",component:"div",disabled:F,multiline:true,onMouseDown:A=>{A.preventDefault(),!N.current&&n.length>0&&E(!v),U.current?.focus();},rightSection:B.length>0?jsx(CloseButton,{className:"bespoke-MultiHierarchySelector-closeButton",disabled:F,onClick:Ln,onMouseDown:A=>A.preventDefault(),variant:"transparent"}):jsx(IconSelector,{className:"bespoke-MultiHierarchySelector-icon",color:I.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{className:"bespoke-MultiHierarchySelector-selectedItems",component:"div","data-clearable":true,sx:{alignItems:"center",boxSizing:"border-box",display:"flex",flexWrap:"wrap",marginLeft:`calc(-${I.spacing.xs} / 2)`,minHeight:`calc(${rem(36)} - ${rem(2)})`,"&[data-clearable]":{marginRight:rem(36)},"&::placeholder":{color:w==="dark"?"var(--mantine-color-dark-3)":"var(--mantine-color-gray-5)",opacity:1}},children:[se,jsx("input",{className:"bespoke-MultiHierarchySelector-search",autoComplete:"off","data-mantine-stop-propagation":v,onChange:In,onKeyDown:getHotkeyHandler([["ArrowDown",_n],["ArrowLeft",Mn],["ArrowRight",Dn],["ArrowUp",Fn],["Backspace",Bn],["Enter",On],["Escape",Nn]]),placeholder:B.length===0&&y||"",ref:U,readOnly:N.current,style:{appearance:"none",backgroundColor:"transparent",border:0,color:"inherit",flex:1,fontSize:I.fontSizes.sm,marginLeft:`calc(${I.spacing.xs} / 2)`,maxHeight:rem(22),minWidth:rem(60),outline:0,padding:0},type:"search",value:K})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:A=>A.preventDefault(),p:0,children:jsx("div",{className:"bespoke-MultiHierarchySelector-dropdown",style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{className:"bespoke-MultiHierarchySelector-dropdownContent",component:"div","data-combobox-popover":true,onMouseDown:A=>A.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",gap:"xs",w:"100%",children:[m.length>1&&jsxs(Stack,{gap:"xs",children:[jsxs(Group,{onClick:A=>{A.stopPropagation();},px:"xs",justify:"center",gap:"xs",children:[jsx(Button,{onClick:()=>{Fe(0),X(true),z([]),ue.length>0&&Je.scrollToIndex(0);},size:"xs",variant:q?"filled":"outline",children:t}),m.map((A,Y)=>jsx(Button,{onClick:()=>{q&&X(false);let le=[""].slice(1),We=Y;for(;We--;)le[We]=O[We]||"";Fe(0),z(le),ue.length>0&&Je.scrollToIndex(0);},size:"xs",variant:!q&&O.length===m.findIndex(le=>le.value===A?.value)?"filled":"outline",children:A?.label},A?.value))]}),jsx(Divider,{})]}),J>0&&jsxs(Group,{align:"center",wrap:"nowrap",px:"xs",children:[jsx(ActionIcon,{onClick:Yo,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:ne.map(A=>jsx(Text,{lineClamp:1,size:"xs",children:A},`${A}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>_(true),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:Co,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${Je.getTotalSize()}px`,position:"relative",width:"100%"},children:Je.getVirtualItems().map(A=>{let Y=ue[A.index],le=lt===A.index,We=B.includes(Y.value);return ue.length>0&&le&&!R&&Je.scrollToIndex(lt),jsxs(Group,{"aria-selected":le,align:"center","data-hovered":le||void 0,"data-index":A.index,"data-selected":We,id:Y.vale,wrap:"nowrap",onMouseEnter:Be=>{Be.preventDefault(),Be.stopPropagation(),R&&(Fe(A.index),_(false));},onMouseMove:Be=>{Be.preventDefault(),Be.stopPropagation(),_(true);},onMouseDown:Be=>{Be.preventDefault(),Qo(Y);},justify:"space-between",ref:Je.measureElement,role:"option",gap:"xs",sx:Be=>({borderRadius:Be.radius.xs,padding:"15px 5px 15px",paddingLeft:q&&10*m.findIndex(Vn=>Vn?.value===Y.type)||5,position:"absolute",top:0,left:0,height:`${A.size}px`,transform:`translateY(${A.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:w==="dark"?"var(--mantine-color-dark-4)":"var(--mantine-color-gray-1)"},"&:hover":{backgroundColor:w==="dark"?"var(--mantine-color-dark-4)":"var(--mantine-color-gray-1)"}}),tabIndex:-1,children:[jsx(fe,{index:A.index,...Y}),!q&&Y.type!==m[m.length-1]?.value&&jsx(ActionIcon,{onMouseDown:Be=>{Be.preventDefault(),Be.stopPropagation(),Kt(Y.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},Y.value)})})})]})})})})]})})}),C&&jsxs(Text,{children:[ie,": ",oe]})]})}var Ib,Lb,Bb,_b,Ob,bp=g(()=>{a();Vs();ve();At();_e();me();Ib=(e=[],t=[],o="",r="",n="",s="|")=>{let i=t.map(T=>T.value).slice(),l=`${i.pop()}`,c=T=>T[o],p=T=>T[r],u=T=>{if(T[n])return typeof T[n]=="string"?T[n].split(s):T[n]},m=new Set,f=[],y=[],d=nest().rollup(T=>{let x=T[0],P=v=>v&&v.value&&!m.has(v.value),C=i.map(v=>x[`${v} ID`]),k=i.map(v=>x[v]),D=i.map((v,E)=>{if(y[E]!==k[E]){y[E]=k[E];let R=c[E]||c[c.length-1]||c,_=p[E]||p[p.length-1]||p,K=u[E]||u[u.length-1]||u;return {color:R(x,v)||void 0,icon:_(x,v)||void 0,value:`${C[E]}`,label:k[E],name:k[E],type:v,searchindex:k.slice(0,E+1).concat(K(x,v)).join("|")}}return {}}).filter(P);D.forEach(v=>m.add(v.value));let M=c[c.length-1]||c,j=p[p.length-1]||p,I=u[u.length-1]||u,w=T.map(v=>({color:M(v,l)||void 0,icon:j(v,l)||void 0,value:`${v[`${l} ID`]}`,label:v[l],name:v[l],type:l,searchindex:k.concat(v[l]).concat(I(v,l)).join("|")}));f.push(...D.concat(w));});return i.forEach(T=>{d.key(x=>`${x[`${T} ID`]}|${x[T]}`);}),d.entries(e),f},Lb=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},Bb=(e,t)=>{let o=e.length,r,n=l=>r&&r.searchindex.includes(l.searchindex),i={next:()=>{for(let l=o-1;l>-1;l--){let c=e[l];if(t.test(`${c.value} ${c.label} ${c.searchindex}`)||n(c))return r=c,o=l,{done:false,value:c}}return {done:true,value:void 0}},[Symbol.iterator]:()=>i};return i},_b=e=>`multihierarchySelector${e}`,Ob=(e,t)=>e&&typeof e=="string"?e.split(","):t;});function Gs({headings:e,settings:t,type:o,title:r,shortTitle:n,_iconType:s,_iconVariant:i,_icon:l,_iconRadius:c,_iconSize:p,_iconPadding:u}){let{min:m="1",max:f="6",icons:y="yes"}=t||{},d=So(parseInt(m,10),parseInt(f,10),e),T=y==="yes",x=Se(r)||"",P=Se(n||r)||"",C=x&&x.length>0,k=s&&s!=="none",M=`(max-width: ${useMantineTheme().breakpoints.md})`,j=useMediaQuery(M),I=j?P:x,w=t&&t.align?String(t.align):"left",v=Fo(w),E=Oe(w),R=Ue(w),_=t&&t.titlePosition?String(t.titlePosition):"left",K=useMemo(()=>{let O={right:"left",left:"right"},z=C&&["left","right"].includes(_),B={};if(z){let G=_==="right";B={gap:"xs",justify:G&&O[E]?O[E]:E,style:{flexDirection:G?"row-reverse":"row"},wrap:"nowrap"};}else B={gap:"xs",align:R,justify:"center",style:{flexDirection:_==="bottom"?"column-reverse":"column"}};return {element:z?Group:Stack,props:B}},[C,E,R,_]),$=useMemo(()=>C?jsxs(Group,{className:"bespoke-Nav-title",gap:"xs",justify:E,wrap:"nowrap",children:[k&&jsx(ge,{blockType:"title",iconType:s,iconVariant:i,iconRadius:c,iconSize:p,icon:l,iconPadding:u}),jsx(Z,{className:"bespoke-Nav-titleText",style:{...t},html:I,lineClamp:1})]}):null,[C,k,E,I]),q=useMemo(()=>j?jsx($b,{contentOutline:d,showIcons:T,titleElement:$,wrapper:K}):null,[j,$,K]),X=useMemo(()=>j?null:o==="multilevel"?jsx(Ub,{contentOutline:d,showIcons:T,align:v}):jsx(zb,{contentOutline:d,showIcons:T,align:v}),[d,T,v,j]);return jsxs(Fragment,{children:[j&&q,!j&&jsxs(K.element,{className:"bespoke-Nav-root",pos:"relative",...K.props,children:[C&&$,X]})]})}var Sp,zb,Cp,$b,Ub,wp=g(()=>{a();_e();Pt();Ne();kt();Pt();ve();Sp=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"}),zb=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null);useEffect(()=>{let i=()=>{let l=document.querySelector(".bespoke-Nav-root");if(!l)return;let c=l.getBoundingClientRect(),p=false;e.forEach(u=>{let m=document.getElementById(`bespoke-title-${u.id}`);m&&m.getBoundingClientRect().top<=c.bottom&&(n(u.id),p=true);}),p||n(null);};return window.addEventListener("scroll",i),()=>{window.removeEventListener("scroll",i);}},[e]);let s=i=>!i||!i?.length?null:jsx(Fragment,{children:i.map(l=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${l.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(ge,{...l.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:l.label}})]})})}),jsx(Box,{pl:"xs",children:s(l.children)})]},l.id))});return jsx(Fragment,{children:jsx(Box,{component:"nav",className:"bespoke-nav",children:jsx(List,{sx:i=>({display:"flex",gap:i.spacing.md,justifyContent:o,listStyleType:"none"}),children:e?.map(i=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${i.id}`,"data-active":i.id===r,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(ge,{...i.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:i.label}})]})})}),i?.children?.length?jsx(Menu.Dropdown,{children:s(i.children)}):null]})},i.id))})})})},Cp=({contentOutline:e,closeNav:t,showIcons:o})=>{let[r,n]=useState(null);return jsx(Stack,{className:"bespoke-MobileNav-accordion",children:e.map(s=>s.children.length?jsxs(Fragment,{children:[jsxs(Group,{className:"bespoke-MobileNav-group",gap:0,wrap:"nowrap",children:[jsx(UnstyledButton,{className:"bespoke-MobileNav-button",w:"100%",component:"a",onClick:t,href:`#bespoke-title-${s.id}`,children:jsxs(Group,{className:"bespoke-MobileNav-buttonContent",gap:"sm",wrap:"nowrap",children:[o&&jsx(ge,{...s.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{className:"bespoke-MobileNav-buttonText",dangerouslySetInnerHTML:{__html:s.label}})]})},s.id),jsx(ActionIcon,{className:"bespoke-MobileNav-chevron",component:"a",size:"lg",onClick:()=>n(i=>i===s.id?null:s.id),children:jsx(IconChevronDown,{style:{transition:"transform 0.2s",transform:r===s.id?"rotate(-180deg)":"none"},stroke:1})})]},s.id),jsx(Collapse,{className:"bespoke-MobileNav-collapse",in:r===s.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(Cp,{contentOutline:s.children,closeNav:t,showIcons:o})})]}):jsx(Group,{className:"bespoke-MobileNav-group",wrap:"nowrap",children:jsx(UnstyledButton,{className:"bespoke-MobileNav-button",display:"flex",w:"100%",component:"a",href:`#bespoke-title-${s.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[o&&jsx(ge,{...s.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:s.label}})]})},s.id)},s.id))})},$b=({contentOutline:e,showIcons:t,titleElement:o,wrapper:r})=>{let[n,{toggle:s}]=useDisclosure(false),i=n?"Close content outline":"Open content outline";return jsxs(Box,{className:"bespoke-MobileNav-root",component:"nav",children:[jsxs(r.element,{className:"bespoke-MobileNav-header",...r.props,onClick:s,children:[o&&o,jsx(ActionIcon,{className:"bespoke-MobileNav-toggle","aria-label":i,size:"lg",variant:"subtle",children:n?jsx(IconChevronUp,{size:"xl",stroke:1.5}):jsx(IconChevronDown,{size:"xl",stroke:1.5})})]}),jsx(Collapse,{in:n,mt:"md",className:"bespoke-MobileNav-body",children:jsx(Cp,{contentOutline:e,closeNav:s,showIcons:t})})]})},Ub=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null),[s,i]=useState(null);useEffect(()=>{let c=()=>{let p=document.querySelector(".bespoke-nav");if(!p)return;let u=p.getBoundingClientRect(),m=false;e.forEach(f=>{let y=document.getElementById(`bespoke-title-${f.id}`);y&&(y.getBoundingClientRect().top<=u.bottom&&(n(f.id),i(null),m=true),f.children.forEach(T=>{let x=document.getElementById(`bespoke-title-${T.id}`);x&&x.getBoundingClientRect().top<=u.bottom&&(i(T.id),n(f.id),m=true);}));}),m||(n(null),i(null));};return window.addEventListener("scroll",c),()=>{window.removeEventListener("scroll",c);}},[e]);let l=c=>!c||!c?.length?null:jsx(Fragment,{children:c.map(p=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${p.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(ge,{...p.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:p.label}})]})})}),jsx(Box,{pl:"xs",children:l(p.children)})]},p.id))});return jsxs(Box,{component:"nav",className:"bespoke-Nav-root",children:[jsx(List,{className:"bespoke-Nav-level","data-level":"1",sx:Sp(o),children:e?.map(c=>jsx(List.Item,{className:"bespoke-Nav-levelItem",children:jsx(Anchor,{className:"bespoke-Nav-itemAnchor",href:`#bespoke-title-${c.id}`,"data-active":r===c.id,onClick:()=>n(c.id),children:jsxs(Group,{className:"bespoke-Nav-itemGroup",gap:"sm",wrap:"nowrap",children:[t&&jsx(ge,{...c.iconProps,iconSize:"sm"}),jsx(Text,{className:"bespoke-Nav-itemLabel",dangerouslySetInnerHTML:{__html:c.label}})]})})},c.id))}),r&&e.find(c=>c.id===r)?.children.length>0&&jsx(List,{className:"bespoke-Nav-level","data-level":"2",sx:Sp(o),children:e.find(c=>c.id===r)?.children.map(c=>jsx(List.Item,{className:"bespoke-Nav-levelItem",children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{className:"bespoke-Nav-itemAnchor",href:`#bespoke-title-${c.id}`,"data-active":c.id===s,children:jsxs(Group,{className:"bespoke-Nav-itemGroup",gap:"sm",wrap:"nowrap",children:[t&&jsx(ge,{...c.iconProps,iconSize:"sm"}),jsx(Text,{className:"bespoke-Nav-itemLabel",dangerouslySetInnerHTML:{__html:c.label}})]})})}),c?.children?.length?jsx(Menu.Dropdown,{className:"bespoke-Nav-levelMenuDropdown",children:l(c.children)}):null]})},c.id))})]})};});function qs(e){let{related_reports:t,settings:o}=e,r=H(f=>f.status.currentLocale),n=H(f=>f.status.localeDefault),s=tn(),i=useRouter(),l=Ze("components");if(!t?.length)return;let c=r===n?"":`/${r}`,p=f=>{i.push(`${f}`);},u=l?.ReportTile?l.ReportTile:Ws,m=Ue(o&&o.align?String(o.align):"center");return jsx(Grid,{className:"bespoke-Related-root",justify:m,children:t.map(f=>{let y=`${c}${s}${f.link}`,d=f.entities.map(k=>({original_id:k.id,name:k.name,id:k.content_id,variant:k.variant_name,variant_id:k.variant_id,dimension:k.dimension_name,dimension_id:k.dimension_id,image:{src:`/api/cms/member/image?member=${k.content_id}&size=thumb`,alt:k.name}})),T=f.entities.map(k=>k.id).join("-"),x=f.entities.map(k=>k.name).join(" & "),P=f.entities[0]?f.entities[0].report_id:null,C=k=>{k.preventDefault(),p(y);};return jsx(Grid.Col,{className:"bespoke-Related-col",xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(u,{reportId:P,reportName:x,members:d,href:y,onClick:C})},T)})})}var Pp=g(()=>{a();re();we();js();_e();Ne();});function Ks({id:e,label:t,settings:o,showIcon:r,fullWidth:n,showWhenDisabled:s}){let i=mt(e).data,{sectionVariables:l,resetSectionVariables:c}=Pe(i?.section_id),p=!!Object.keys(l).length,u=Ue(o&&o.align?o.align:"left");return !p&&!s?null:jsx(Button,{className:"bespoke-ResetButton-root",onClick:()=>c(),disabled:!p,fullWidth:n,sx:{justifySelf:u},children:jsxs(Group,{className:"bespoke-ResetButton-content",align:"center",children:[t,r&&jsx(IconRefresh,{className:"bespoke-ResetButton-icon"})]})})}var Lp=g(()=>{a();we();Ne();});function Ys({settings:e,label:t,removeLabel:o,showIcon:r,position:n="center",asComparison:s=false}){let i=H(k=>k.records.entities.report),l=H(k=>k.variables.attributes),c=e&&e.search?e.search:"inline",p=Object.values(i)[0].settings,u=useRouter(),{comparisonLoaded:m,loading:f}=nt(),y=Object.keys(u.query).includes("compare"),T=m&&y?jsx(Button,{onClick:()=>{let k={...u.query};delete k.compare,u.push({pathname:u.pathname,query:k},void 0,{shallow:true});},rightIcon:jsx(IconX,{}),children:o||"Remove Comparison"}):jsx(Button,{loading:f,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",r&&jsx(IconPlus,{})]})}),x={searchReportParams:{report:[Number(Object.keys(i)[0])],variant:p.compareLevels?[]:[l.variant_id1]}},C=Vo(T,c,k=>{u.push({pathname:u.pathname,query:{...u.query,compare:k.reportPath}});},x);return s?null:jsx(Group,{className:"bespoke-ComparisonButton-root",align:n,children:y?T:C})}var Op=g(()=>{a();_e();re();Ut();});function Qs({columns:e=[],data:t=[],tableProps:o={},sectionId:r=null}){let[n,s]=useState(false),i=useMemo(()=>e.map(m=>m.accessorKey),[e]),l=useMemo(()=>t.filter(m=>typeof m=="object"&&m!==null&&!Array.isArray(m)&&Object.keys(m).some(f=>i.includes(f))),[i,t]),c=useMemo(()=>e.map(m=>({...m,Cell:({renderedCellValue:f})=>jsx(Z,{html:`${f}`}),filterFn:"contains"})),[e]),p=Ye("table"),u={...MRT_Localization_EN,...p};return jsx(MantineReactTable,{className:"bespoke-Table-root",...o,autoResetPageIndex:false,columns:c,data:l,enableColumnFilterModes:true,enableFilterMatchHighlighting:false,globalFilterFn:"contains",layoutMode:"grid",localization:u,onIsFullScreenChange:m=>{let f=document.getElementById(`section-${r}`);f&&(m?f.style.zIndex="10":f.style.zIndex="1"),s(m);},state:{...o.state,isFullScreen:n}})}var Mp=g(()=>{a();ve();st();});function Zs({label:e,url:t,settings:o}){let{align:r}=o;return e?jsx(Group,{className:"bespoke-Button-root",align:r,grow:r==="justify",children:jsx(Button,{className:"bespoke-Button-button",component:"a",target:"_blank",href:t||"",children:e||"Button"})}):null}var Fp=g(()=>{a();});function iy({block:e}){let{id:t}=e;return jsxs(Stack,{className:"bespoke-Fallback-root",align:"center",gap:"sm",children:[jsx(ThemeIcon,{className:"bespoke-Fallback-themeIcon",radius:"md",size:100,children:jsx(IconCircleKey,{size:100})}),jsxs(Title,{className:"bespoke-Fallback-title",order:5,children:["Private content (Block ",t,")"]}),jsx(Text,{className:"bespoke-Fallback-text",children:"Sorry, you do not have sufficient permissions to view this block."}),jsx(Text,{className:"bespoke-Fallback-text",children:"Contact your account manager to check your access role."})]})}function Js(e){let t=ly();return jsx(t,{block:e})}var ly,$p=g(()=>{a();_e();ly=()=>{let e=Ze("components"),t=iy;return e?.CustomFallback&&(t=e.CustomFallback),t};});var Ro,ea=g(()=>{a();Ro=class extends Component{constructor(t){super(t),this.state={hasError:false};}static getDerivedStateFromError(t){return console.info("getDerivedStateFromError",t),{hasError:true}}componentDidCatch(t,o){console.error("Error information:",o.componentStack),notifications.show({autoClose:false,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 Ir({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var ta=g(()=>{a();});var Hp={};zn(Hp,{default:()=>Gp});function Gp(e){let{print:t}=Xe(),{block:o,active:r,locale:n,variables:s,configOverride:i={}}=e,l=vt(o),c=go(n),p={variables:s},u=useRouter(),{sectionVariables:m,setSectionVariables:f,resetSectionVariables:y}=Pe(o.section_id),d=_o(),T=JSON.stringify(m),x=useMemo(()=>{if(!l?.logic)return {error:"Add a Configuration"};let I=pt({logic:l.logic},c,p).logic,w={router:u,section:{variables:m,setVariables:f,resetVariables:y}};return Do(I,c,s,n,o.id,{},w,d)},[o,r,s,T]),{type:P}=x.config||{},C=P&&oa[P]?P:"Treemap";oa[P]||(x.config={error:`"${P}" is not a valid Visualization Type`});let k=oa[C],D=useMemo(()=>{let{_data:I,...w}=x.config;return gy(w,t)},[x,t]),M={locale:n,variables:s,...D,...i},j=I=>{let w;try{w=x.dataFormat(I);}catch(v){console.error("Error in dataFormat: ",v),w=[];}return w};return jsx(Box,{className:"bespoke-Viz-root","data-ignore-print":M._printIgnore?"true":void 0,sx:{display:"flex",minHeight:P==="HTML"?void 0:400,"& .chart":{flex:"1 1 100%"}},children:jsx(Ro,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(k,{style:{flex:1},dataFormat:I=>{let w;try{w=x.dataFormat(I);}catch(v){console.error("Error in dataFormat: ",v),w=[];}return w},config:{...M,dataFormat:j,sectionVariables:T}},"viz-key")})})}var oa,gy,qp=g(()=>{a();eo();xr();Zt();we();ea();At();ta();oa={...dy,HTML:Ir},gy=(e,t)=>{let o={...e};return t&&(o.detectResize=false,o.detectResizeDelay=0,o.detectVisible=false,o.detectVisibleInterval=0,o.duration=0,o.shapeConfig={...o.shapeConfig,duration:0}),o};});var by,Wp=g(()=>{a();me();Fc();Hc();Wc();Kc();Zc();Jc();ep();bp();wp();Pp();Lp();Op();Mp();Fp();$p();by=hy(()=>Promise.resolve().then(()=>(qp(),Hp)),{ssr:false}),{[S.PARAGRAPH]:ws,[S.STAT]:Ps,[S.SUBTITLE]:Is,[S.TITLE]:Bs,[S.SELECTOR]:Ms,[S.VIZ]:by,[S.GENERATOR]:ln,[S.SECTION_FLAG]:ln,[S.IMAGE]:Ds,[S.NAV]:Gs,[S.RELATED]:qs,[S.RESET_BUTTON]:Ks,[S.COMPARISON_BUTTON]:Ys,[S.TABLE]:Qs,[S.BUTTON]:Zs,[S.MULTIHIERARCHY_SELECTOR]:Us,[S.FALLBACK]:Js};});var yy,jp,Kp=g(()=>{a();yy=(e,t)=>{let o=e.allLabel||"All",r=e.colorKey||"",n=e.data||[],s=e.hideLabel||"false",i=e.resetSectionVars||"false",l=e.iconKey||"",c=e.label||"Unlabeled Multihierarchy Selector",p=e.levels||[],u=e.limit||void 0,m=e.placeholder||"",f=e.searchIndexKey||"",y=e.searchIndexSeparator||"",d,T;return e.defaultValue&&e.defaultValueType&&(d=e.defaultValue,T=e.defaultValueType),(!d||!T)&&(d=[],T=""),{allLabel:o,colorKey:r,data:n,defaultValue:d,defaultValueType:T,hideLabel:s,resetSectionVars:i,iconKey:l,id:t,label:c,levels:p,limit:u,placeholder:m,searchIndexKey:f,searchIndexSeparator:y}},jp=yy;});var Sy,Yp,xy,Xp,Qp=g(()=>{a();me();Vr();Sy=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{id:t,label:t}:t):[],Yp=(e,t)=>t===Ee.MULTI&&!Array.isArray(e)?[e]:e,xy=(e,t)=>{let o=e.type||Ee.SINGLE,r=e.component||"Selector",n=e.hideLabel||"false",s=e.resetSectionVars||"false",i=e.name||"Unlabeled Selector",l=Sy(e.options||[]),c;if(e.defaultValue){let p=Yp(e.defaultValue,o);Jt(o,p,l)&&(c=p);}if(!c){let p=l&&l[0]&&l[0].id||l[0]||"";c=Yp(p,o);}return {id:t,name:i,type:o,options:l,component:r,defaultValue:c,hideLabel:n,resetSectionVars:s}},Xp=xy;});var Ty,Lr,Zp=g(()=>{a();me();Kp();Qp();Ty={[S.SELECTOR]:Xp,[S.MULTIHIERARCHY_SELECTOR]:jp},Lr=Ty;});function na({paragraph:e,tooltip:t,settings:o}){return jsx(Z,{component:"p",html:e||`Lorem ipsum dolor sit amet,
11
11
  consectetur adipiscing elit. Etiam justo purus, placerat ac turpis at,
12
12
  dignissim interdum eros. Curabitur non tincidunt libero.
13
13
  Suspendisse quis nibh in massa tincidunt feugiat sit amet vitae nisl.
package/dist/report.js CHANGED
@@ -12,7 +12,7 @@ import'path';import'url';import*as Vg from'd3-format';import {formatLocale,forma
12
12
  `),J=N.map(le=>le.trim()).filter(Boolean),te=M.map(le=>le.trim()).filter(Boolean),me=K.map(le=>le.trim()).filter(Boolean),xe=Math.max(J.length,te.length,me.length),nt=!1;for(let le=0;le<xe;le++){let Te=J[le]||J[J.length-1]||"",st=te[le]||te[te.length-1]||"",dt=me[le]||me[me.length-1]||"";!ne.has(dt)&&Te&&st&&dt&&(nt=!0,ne.add(dt),C.push({"Sheet Number":L,Name:ae?`${y(ae)} - ${Z}${re.length>1?` (${U+1})`:""}${xe>1?` - ${le+1}`:""}`:`${Z}${re.length>1?` (${U+1})`:""}${xe>1?` - ${le+1}`:""}`,Source:`${Te} - ${st} (${dt})`}));}nt&&L++;});}v.push(G),R++;}catch(G){console.error(`Error loading data for block ${P.id}:`,G);}}}let B=v,F={fileName:"Metadata",data:C.length>0?[C]:[]};return B.unshift(F),B},[t.XlsxVizActive,g,r,d,p,u,f,i,o,s])}var xu=S(()=>{l();pe();ye();Fo();Mo();De();on();au();ht();Wa();sn();zt();Lo();});function Ya(e=[]){function t(u){return u.reduce((f,g)=>(g.properties.sectionId!==void 0&&f.push(g.properties.sectionId),g.children&&g.children.length>0&&f.push(...t(g.children)),f),[])}let[o,r]=useState(new Set(t(e))),n=useCallback(u=>{let f=h=>{for(let v of h){if(v.properties.sectionId===u)return v;if(v.children){let C=f(v.children);if(C)return C}}return null},g=f(e);if(!g||!g.children)return [];let m=[],y=h=>{for(let v of h)v.properties.sectionId!==void 0&&m.push(v.properties.sectionId),v.children&&y(v.children);};return y(g.children),m},[e]),a=useCallback(u=>{let f=(g,m)=>{for(let y of g)if(y.children)for(let h of y.children){if(h.properties.sectionId===m)return y.properties.sectionId??null;let v=f(y.children,m);if(v!==null)return v}return null};return f(e,u)},[e]),s=useCallback(u=>{let f=m=>{for(let y of m){if(y.properties.sectionId===u)return y;if(y.children){let h=f(y.children);if(h)return h}}return null},g=f(e);return g?.children?g.children.map(m=>m.properties.sectionId).filter(m=>m!==void 0):[]},[e]),i=useCallback((u,f)=>{r(g=>{let m=new Set(g);if(f){m.add(u),n(u).forEach(v=>m.add(v));let h=a(u);h!==null&&m.add(h);}else {m.delete(u),n(u).forEach(v=>m.delete(v));let h=a(u);if(h!==null&&!s(h).some(R=>m.has(R))){m.delete(h);let R=h;for(;R!==null;){let L=a(R);if(L!==null)if(!s(L).some(w=>m.has(w)))m.delete(L),R=L;else break;else break}}}return m});},[n,a,s]),c=useCallback(()=>{let u=t(e);r(new Set(u));},[e]),p=useCallback(()=>{r(new Set);},[]),d=useCallback(u=>{let f=u.properties.sectionId!==void 0&&o.has(u.properties.sectionId),g=u.children&&u.children.length>0,m=f,y=false;if(g){let h=R=>R.reduce((L,B)=>(B.properties.sectionId!==void 0&&L.push(B.properties.sectionId),B.children&&B.children.length>0&&L.push(...h(B.children)),L),[]),v=h(u.children),C=v.filter(R=>o.has(R));C.length===0?(m=false,y=false):C.length===v.length?(m=true,y=false):(m=false,y=true);}return {isChecked:m,isIndeterminate:y}},[o]);return {selectedSections:o,handleToggleSection:i,handleSelectAll:c,handleDeselectAll:p,getSelectionState:d}}var vu=S(()=>{l();});function Qn(){let{query:e,locale:t,asPath:o}=useRouter(),{profilePrefix:r}=Xo(),{compare:n}=e,a=q(jn),s=q(Dt),i=q(fo),c=q(go),p=useMemo(()=>Lt(i,t),[i,t]),d=Et(),[u,f]=useState(null),[g,m]=useState(null),[y,h]=useState(!!n),[v,C]=useState(false),[R,L]=useState(false),B=a.settings;return useEffect(()=>{let F=false,w=Fn.CancelToken.source();if(B.comparison&&n&&!v){h(true);let P={cancelToken:w.token};Fn.get(`/api/cms/report?report=${n}&locale=${t}&prefix=${r}`,P).then(k=>{if(!F){let[,A]=o.split("?"),E=A?JSON.parse('{"'+decodeURI(A).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}'):{},_=Object.fromEntries(Object.entries(E).filter(([j])=>j.match(Eu)).map(([j,Z])=>[j.replace("Compare",""),Z])),W=Object.entries(E).filter(([j])=>j.match(Eu)).map(([j])=>Number(j.match(/\d+/))),V=k.data.data.variables;W.length?Promise.all(W.map(j=>{let D=s[j].consumers.reduce((O,Y)=>({...O,...V.variables[Y]}),{}),H={locale:t,query:_,variables:{...D,...V.attributes}};return _t(s,void 0,j,p,H,{variables:V.variables,status:V.status},d,"report",c)})).then(j=>{let Z=Object.assign({},...j.map(H=>H.variables)),D=Object.assign({},...j.map(H=>H.status));L(false),h(false),C(true),f({variables:Z,attributes:V.attributes,status:D}),m(k.data.data.status);}):(L(false),h(false),C(true),f(k.data.data.variables),m(k.data.data.status));}}).catch(()=>{F||(L(true),C(false),h(false),f(null));});}return n||(f(null),m(null),C(false)),()=>{F=true,w.cancel();}},[n,t,r,B.comparison,o,v,d]),{active:!!u,variables:u,status:g,setComparisonVariables:f,comparisonLoaded:v,loading:y,error:R}}var Eu,ku=S(()=>{l();Yt();pe();Vo();no();Ft();ct();Eu=/\w*Compare\b/;});function ns(e,t,o,r,n=false){let a=useRouter(),{query:s,locale:i}=a,c=ve(),p=tt(),d=q(E=>r&&p.variables?p?.variables?.attributes:E.variables.attributes),u=q(Dt),f=q(fo),g=q(go),m=useMemo(()=>Lt(f,i),[f,i]),y=Sr(e,r&&p.active?p?.variables.variables:void 0,r&&p.active?p?.variables.attributes:void 0),h=q(E=>r?p.variables.variables:E.variables.variables),v=q(E=>r?p.variables.status:E.variables.status),C=Et(),{sectionVariables:R,resetSectionVariables:L}=Me(t),{addRunConsumersRunning:B,removeRunConsumersRunning:F}=xr(),w=r&&p.active?`${o}-valueCompare`:`${o}-value`,P=r&&p.active?`${o}-typeCompare`:`${o}-type`,k=r&&p.active?Object.fromEntries(Object.entries(s).filter(([E])=>E.match(mx)).map(([E,_])=>[E.replace("Compare",""),_])):Object.fromEntries(Object.entries(s).filter(([E])=>E.match(fx)).map(([E,_])=>[E.replace("Compare",""),_]));return useCallback((E,_)=>{let W={locale:i,query:{...k,[`${o}-type`]:_,[`${o}-value`]:E},variables:y},V=new URLSearchParams(window.location.search);E&&_?(V.set(w,E.join(",")),V.set(P,_)):(V.delete(w),V.delete(P)),window.history.replaceState(null,null,`?${V.toString()}`),B([t]),_t(u,void 0,e,m,W,{variables:h,status:v},C,"report",g).then(j=>{n&&R&&L(),p.active&&r?p.setComparisonVariables({attributes:d,variables:j.variables,status:j.status}):c(lo.setVariableChange({attributes:d,variables:j.variables,status:j.status})),F([t]);});},[r,d,e,u,p,c,m,v,h,i,k,C,o,P,w,y,R,n,L])}var mx,fx,Cu=S(()=>{l();eo();ct();Vo();pe();De();no();Ft();hr();mx=/\w*Compare\b/,fx=/multihierarchySelector\d+(id|-(type|value))/;});function Qa({bespokeStyles:e,children:t}){return jsx(Xa.Provider,{value:e||{},children:t})}var Xa,Za=S(()=>{l();Xa=createContext({});});function pt(e){let t=useContext(Xa);if(t==null)throw new Error("useBespokeStyles must be used within a BespokeStylesProvider");return e?t[e]:t}var wu=S(()=>{l();Za();});function Ja(){let{locales:e}=useRouter(),t=location&&location.pathname.split("/").filter(o=>o.length>0)[0];return e?.includes(t)}var Au=S(()=>{l();});function _u({children:e,pageSize:t=10,sort:o=void 0}){let r={profile:void 0,variant:void 0},[n,a]=useState([]),[s,i]=useState(false),[c,p]=useState(false),[d,u]=useState({}),[f,g]=useState({}),[m,y]=useState(1),[h,v]=useState(r),[C,R]=useState(""),[L]=useDebouncedValue(C,750),[B,F]=useState([]),[w,P]=useState(ei),[k,A]=useState(false),{locale:E}=useRouter(),_=async()=>{try{p(!0),Fn.get("/api/cms/read/metadata").then(G=>{if(G&&G.data&&G.data.data&&G.data.data.data){let re=G.data.data.data.reduce((ne,Q)=>(Q.dimensions&&Q.dimensions.forEach(U=>{U.variants&&U.variants.forEach(I=>{ne[I.id]=I.members_count||0;});}),ne),{});a(G.data.data.data),u(re),g(re);}p(!1),A(!0);}).catch(G=>{console.error(G);});}catch(G){console.error("Error fetching metadata:",G),a([]),p(false),u({}),g({});}},W=G=>{u(G||f);},V=useCallback(async(G,re,ne)=>{!k&&n.length===0&&await _(),v({profile:G,variant:re}),ne!==""&&R(ne);},[]);useEffect(()=>{let G=false;return k&&(i(true),y(1),j(G,0)),()=>{G=false;}},[L,h,k]),useEffect(()=>{if(k){i(true);let G=(m-1)*t;j(false,G);}},[m]);let j=async(G,re)=>{let ne=h.profile&&!Number.isNaN(h.profile)?[h.profile]:[],Q=h.variant?typeof h.variant=="string"&&h.variant.includes(",")?h.variant.split(",").map(I=>parseInt(I,10)):[parseInt(h.variant,10)]:[],U={query:L,format:"profiles",locale:E,limit:t,offset:re,visible:true,includes:true,noImage:false,variant:Q,dimension:[],report:ne,all:false,origin:"typesense"};o&&(U.sort=o),Fn.get("/api/cms/search/reports",{params:U}).then(I=>{if(I&&I.data&&I.data.data&&I.data.data.results&&!G){let N=I.data.data.results;F(N),u(!C||C===""?false:I.data.data.meta.variantCount);}i(false);}).catch(I=>{console.error(I),i(false);});},Z=d||f,D={id:void 0,name:w.filters_all||"ALL"},H=G=>{let re=G.reduce((Q,U)=>Q.reduce((I,N)=>I.concat(U.map(M=>[].concat(N,M))),[])).map(Q=>{let U;return Array.isArray(Q)?U={id:Q.map(I=>I.id).join(","),name:Q.map(I=>I.name).join(" / "),members_count:Q.reduce((I,N)=>I*(Z[N.id]||1),1),ordering:Q.reduce((I,N)=>I+N.ordering,0)}:(Q.members_count=Z[Q.id]||0,U={...Q,members_count:Z[Q.id]||0}),U}),ne=re.reduce((Q,U)=>Q+(U.members_count||0),0);return [{...D,members_count:ne},...re]},O=n.length>1,Y=useMemo(()=>{let G=[];if(!c&&n.length>0&&Z){let re=n.filter(ne=>ne.dimensions.length>0).map(ne=>{let Q=false,U=H(ne.dimensions.map(I=>I.variants));return U&&U.length>2&&(Q=true),{id:ne.id,name:ne.dimensions.map(I=>I.name).join(" / "),variants:U,members_count:U.filter(I=>I.id).reduce((I,N)=>I+(N.members_count||0),0),show:Q}});G=[{...D,members_count:re.reduce((ne,Q)=>ne+(Q.members_count||0),0)},...re];}return G},[c,Z,n,D]),ae=useMemo(()=>{let G;return Y&&(h.profile?h.profile&&(G=Y.find(re=>re.id===h.profile),G&&h.variant&&G.variants&&(G=G.variants.find(re=>re.id===h.variant))):G=Y.find(re=>!re.id)),G?G.members_count:t},[h,Y]),ce={metadata:n,loadingMetadata:c,setLoadingMetadata:p,loadingItems:s,setLoadingItems:i,resultCount:d,totalCount:f,setResultCount:W,activePage:m,setActivePage:y,pageSize:t,filters:h,setFilters:v,doQuery:j,query:C,setQuery:R,debouncedQuery:L,results:B,currentPageTotal:ae,selectorStructure:Y,translations:w,setTranslations:G=>P({...ei,...G}),showSelectors:O,initExplore:V};return jsx(Bu.Provider,{value:ce,children:e})}var ei,Bu,To,kr=S(()=>{l();ei={try_another:"Try another search or filter.",search:"Search",filters_all:"All",no_results:"No Results",load_more:"Load more",select_report:"Select Report",select_variant:"Select Variant",count_format:".2s",report:{},dimension:{},variant:{}},Bu=createContext({metadata:[],loadingItems:false,setLoadingItems:()=>null,loadingMetadata:false,setLoadingMetadata:()=>null,resultCount:{},totalCount:{},setResultCount:()=>null,activePage:1,setActivePage:()=>null,pageSize:10,results:[],filters:{},doQuery:()=>null,setFilters:()=>null,query:"",setQuery:()=>null,debouncedQuery:"",currentPageTotal:10,selectorStructure:[],translations:ei,setTranslations:()=>null,showSelectors:true}),To=()=>useContext(Bu);});function Cx({translations:e}){let{loadingItems:t,setFilters:o,selectorStructure:r,filters:n,showSelectors:a}=To(),s=m=>{let y=m===null||Number.isNaN(m)?void 0:parseInt(m,10);y!==n.profile?o({profile:y,variant:void 0}):y&&o({profile:void 0,variant:void 0});},i=m=>{let y=m===null?void 0:typeof m=="string"&&m.includes(",")?m:parseInt(m,10);y!==n.variant?o({...n,variant:y}):y&&o({...n,variant:void 0});},c=m=>m<1e3?m:format$1(e.count_format)(m).replace(/\.0+([a-zA-Z]*)$/,"$1"),p=r.length===2?r[1].id:n.profile,d=p?r.find(m=>m.id===p):void 0,u=d&&d.variants&&n.variant?d.variants.find(m=>m.id===n.variant):void 0,f=useMemo(()=>r.map(m=>({value:String(m.id||""),label:(e?.dimensionIcon?.[m.name]?`${e?.dimensionIcon?.[m.name]} `:"")+(e?.dimension[m.name]||m.name)+(!t&&(!d||m.id===d?.id)?` (${c(m.members_count)})`:"")})),[e,d,r]),g=useMemo(()=>d?.variants?.map(m=>({value:String(m.id||""),label:(e?.variantIcon?.[m.name]?`${e?.variantIcon?.[m.name]} `:"")+(e?.variant[m.name]||m.name)+(!t&&(!u||m.id===u?.id)?` (${c(m.members_count)})`:"")}))??[],[e,u,r]);return jsx(Fragment,{children:a&&jsxs(Fragment,{children:[jsx(Box,{className:"bespoke-explore-reports-select-container",mb:"md",sx:{display:"block","@media (min-width: 1000px)":{display:"none"}},children:jsxs(Group,{justify:"center",children:[jsx(Select,{className:"bespoke-explore-reports-select",data:f,value:String(d?.id||""),onChange:m=>s(m),label:e.select_report||"Select Report",placeholder:e.select_report||"Select Report",clearable:typeof d?.id<"u",style:{width:"450px"}}),d?.variants&&d.variants.length>2&&jsx(Select,{className:"bespoke-explore-variant-select",data:g,value:String(u?.id||""),onChange:m=>i(m),label:e.select_variant||"Select Variant",placeholder:e.select_variant||"Select Variant",clearable:typeof u?.id<"u",style:{width:"450px"}})]})}),jsx(Box,{sx:{display:"none","@media (min-width: 1000px)":{display:"block"}},children:jsxs("div",{children:[jsx(Group,{justify:"center",className:"bespoke-explore-reports-selector",mb:"md",children:r.map(m=>jsxs(Button,{"data-selected":m.id===d?.id?"true":"false","data-report-name":m.name,variant:m.id===d?.id?"outline":"subtle",onClick:()=>s(m.id),rightSection:m.id&&m.id===d?.id?jsx(IconX,{size:"1rem"}):void 0,leftSection:e?.dimensionIcon?.[m.name]??void 0,children:[jsx(Text,{span:true,className:"bespoke-explore-reports-name",dangerouslySetInnerHTML:{__html:e?.dimension[m.name]??m.name}}),!t&&(!d||m.id===d?.id)&&jsx(Text,{span:true,size:"xs",ml:"0.2rem",className:"bespoke-explore-reports-count",children:`(${c(m.members_count)})`})]},`p-${m.id}`))}),d&&d.variants&&d.variants.length>2&&jsx(Group,{justify:"center",style:{minHeight:"36px"},className:"bespoke-explore-variant-selector",mb:"md",children:d.variants.map(m=>jsxs(Button,{"data-selected":m.id===u?.id?"true":"false","data-variant-name":m.name,variant:m.id===u?.id?"outline":"subtle",onClick:()=>i(m.id),rightSection:m.id&&m.id===u?.id?jsx(IconX,{size:"1rem"}):void 0,leftSection:e?.variantIcon?.[m.name]?jsx(Text,{span:true,dangerouslySetInnerHTML:{__html:e.variantIcon[m.name]}}):void 0,children:[jsx(Text,{span:true,className:"bespoke-explore-variant-name",dangerouslySetInnerHTML:{__html:e?.variant[m.name]??m.name}}),!t&&(!u||m.id===u?.id)&&jsx(Text,{span:true,size:"xs",ml:"0.2rem",className:"bespoke-explore-variant-count",children:`(${c(m.members_count)})`})]},`v-${m.id}`))})]})})]})})}var zu,$u=S(()=>{l();kr();zu=Cx;});function oi({reportId:e,reportName:t,members:o,href:r,onClick:n}){let a=o.map(i=>jsx(Image,{src:i.image.src,height:160,loading:"lazy",alt:i.name},i.id)),s=o.map(i=>jsxs(Stack,{children:[jsx(Text,{fw:500,children:i.name}),jsx(Badge,{color:"green",variant:"light",w:"fit-content",children:i.variant})]},i.id));return jsxs(Card,{className:`report-${e}-tile`,shadow:"sm",p:"lg",radius:"md",withBorder:true,children:[jsx(Card.Section,{children:jsx(Group,{grow:true,gap:0,children:a})}),jsx(Group,{justify:"space-between",mt:"md",mb:"xs",children:s}),jsx("a",{href:r,onClick:n,children:jsx(Button,{variant:"light",color:"blue",fullWidth:true,mt:"md",radius:"md",children:`See ${t} Report`})})]})}function Nx({profile:e,profilePrefix:t,onSelect:o,reportTile:r}){let n=useRouter(),a=n.locale,{localeDefault:s}=Be(),c=`${a===s?"":`/${a}`}${t}${e.path}`,p=e.members.map(g=>({original_id:g.metadata.id,name:g.name,id:g.id,dimension_id:g.metadata.dimension.id,dimension:g.metadata.dimension.name,variant_id:g.metadata.variant.id,variant:g.metadata.variant.name,image:{src:`/api/cms/member/image?member=${g.id}&size=thumb`,alt:g.name}})),d=g=>{n.push(`${g}`),o&&o();},u=g=>{g.preventDefault(),d(c);},f=Ox(r);return jsx(Grid.Col,{span:{base:12,sm:6,md:4,lg:4,xl:3},children:jsx(f,{reportId:e.report.id,reportName:e.report.name,members:p,href:c,onClick:u})},e.id)}var Ox,qu,ri=S(()=>{l();ze();St();Ox=e=>{let{components:t}=pt(),o=oi;return t?.ReportTile&&(o=t?.ReportTile),e&&(o=e),o};qu=Nx;});function $x({profilePrefix:e,onSelect:t=()=>{},reportTile:o}){let[r,n]=useState(500),a=useRef(null),{results:s}=To(),i=a.current?.offsetTop||0,c=50;return useEffect(()=>{let{innerHeight:p}=window;n(p-i-c);},[i]),jsx(ScrollArea,{offsetScrollbars:true,type:"always",h:r,ref:a,children:jsx(Grid,{align:"stretch",children:s.map(p=>jsx(qu,{profile:p,profilePrefix:e,reportTile:o,onSelect:t},p.id))})})}var Wu,ju=S(()=>{l();ri();kr();Wu=$x;});function Hx(){let{activePage:e,setActivePage:t,pageSize:o,currentPageTotal:r}=To();return jsx(Group,{justify:"center",children:jsx(Pagination,{value:e,onChange:a=>{t(a);},total:Math.ceil(r/o),size:"sm",py:"xs"})})}var Yu,Xu=S(()=>{l();kr();Yu=Hx;});function tT({profilePrefix:e,initialReportId:t,initialVariantId:o,translations:r,onSelect:n,reportTile:a,initialQuery:s}){let i=useRef(),c=To(),{query:p,setQuery:d,results:u,loadingItems:f,loadingMetadata:g,translations:m,setTranslations:y,initExplore:h}=c;useEffect(()=>{h&&h(t,o,s);},[h]),useEffect(()=>{f||i.current?.focus();},[f]),useEffect(()=>{r&&y(r);},[r]);let v=()=>{d("");};return jsxs(Container,{fluid:true,pt:"1em",children:[jsx(TextInput,{placeholder:m.search,mb:"md",size:"xl",onChange:C=>d(C.target.value),readOnly:g||f,leftSection:jsx(IconSearch,{size:24}),value:p,rightSectionWidth:100,rightSectionProps:{style:{justifyContent:"flex-end",padding:"0 15px 0 0"}},rightSection:jsxs(Group,{align:"center",children:[(g||f)&&jsx(Loader,{size:28}),p&&p!==""&&jsx(ActionIcon,{variant:"transparent",onClick:v,children:jsx(IconTrash,{size:24})})]}),ref:i}),jsx(zu,{translations:m}),jsx(LoadingOverlay,{visible:g||f}),!f&&u.length===0&&jsx(Alert,{title:m.no_results,color:"blue",children:m.try_another}),jsx(Wu,{profilePrefix:e,onSelect:n,reportTile:a}),jsx(Yu,{})]})}var Zu,Ju=S(()=>{l();$u();ju();Xu();kr();Zu=tT;});function cT({exploreProps:e={profilePrefix:"/",locale:lT},icon:t=jsx(IconSearch,{size:20}),actionIconProps:o={},modalProps:r={},tooltipProps:n={},tooltipText:a="Click to Explore",showIcon:s=true,showTooltip:i=false,children:c}){let[p,d]=useState(false),u={variant:"light",size:"md",radius:"md",...o},f={fullScreen:true,opened:p,onClose:()=>d(false)},g=jsx(ActionIcon,{...u,onClick:()=>d(true),children:t}),m=s?jsxs(Group,{gap:"sm",style:{cursor:"pointer"},children:[c,g]}):c;return i&&(m=jsx(Tooltip,{label:a,...n,children:m})),jsxs(Fragment,{children:[jsx(Modal,{...f,...r,children:p&&jsx(Zu,{...e,onSelect:()=>d(false)})}),jsx("div",{onClick:()=>d(true),children:c?m:jsx(Fragment,{children:g})})]})}var lT,od,rd=S(()=>{l();Ju();St();({localeDefault:lT}=Be());od=cT;});var gT,nd,sd=S(()=>{l();gT=forwardRef(({id:e,members:t=[],...o},r)=>{let n=t.map(a=>jsxs(Stack,{align:"center",children:[jsx(Text,{fw:500,children:a.name}),jsx(Badge,{color:"green",variant:"light",children:a.variant})]},a.id));return jsx("div",{ref:r,style:{width:"100%"},children:jsx(Group,{justify:"space-between",grow:true,children:n})},e)}),nd=gT;});function wT({locale:e,profilePrefix:t="/report",autocompleteProps:o={},tooltipProps:r={},tooltipText:n="Click to search",searchReportParams:a={},callback:s,children:i}){let c=useRouter(),p=c.locale,{localeDefault:d}=Be(),u=p===d?"":`/${p}`,f=CT(null),[g,m]=useState(""),[y,h]=useDebouncedValue(g,500),[v,C]=useState([]),[R,L]=useState(false),[B,F]=useState(false),[w,P]=useState(false),[k,A]=useState(!i),E=()=>{A(false);},_=()=>{A(true),Z();},W=useRef(),V=useClickOutside(E),j=o?.searchConfig?.searchLimit??10,Z=()=>{L(true);let N={query:y,format:"profiles",locale:e,limit:j,visible:true,includes:true,noImage:false,variant:[],dimension:[],report:[],all:false,...a};Fn.get("/api/cms/search/reports",{params:N}).then(M=>{M&&M.data&&M.data.data&&M.data.data.results&&C(M.data.data.results.map(K=>{let J=K.report?.name??K.name??`${K.id}`;return {id:K.id,reportName:J,label:J,href:`${u}${t}${K.path}`,reportPath:`${K.path}`,profilePrefix:t,value:K.id,members:(K.members||[]).map(te=>({original_id:String(te?.metadata?.id??te.id),name:te?.name??"",id:te.id??0,variant:te?.metadata?.variant?.name??"",image:{src:`/api/cms/member/image?member=${te.id}&size=thumb`,alt:te?.name??""}}))}})),L(false),W.current?.focus();}).catch(M=>{console.error(M),L(false);});};useEffect(()=>{w&&y.length>=(o.searchConfig?.queryThreshold??0)&&Z();},[w,y,o.searchConfig?.queryThreshold]),useEffect(()=>{h(),k&&P(true);},[]),useEffect(()=>{h(),k&&P(true);},[k]);let D=N=>{A(false),s?s(N):(c.push(N.href),F(true));},H=N=>{m(N);},{searchConfig:O,renderOption:Y,data:ae,...ce}=o??{},G=useMemo(()=>v.map(N=>({value:N.value,label:N.reportName})),[v]),re=useMemo(()=>Object.fromEntries(v.map(N=>[N.value,N])),[v]),ne=useMemo(()=>Y||f,[Y,f]),Q=useMemo(()=>({placeholder:"Search",size:"md",leftSection:jsx(IconSearch,{}),value:g,onChange:H,disabled:(R||B)&&!w,limit:j,maxDropdownHeight:250,filter:N=>N.options,rightSection:jsx(Group,{gap:0,justify:"right",children:R?jsx(Loader,{size:20}):jsx(Fragment,{})}),renderOption:N=>{let M=N.option,K=re[M.value];return K?jsx(ne,{...K}):M.label},onOptionSubmit:N=>{let M=re[N];M&&D(M);},comboboxProps:{withinPortal:false},...ce,data:G}),[g,R,B,w,j,G,re,Y,D,ce]),U=jsx(Autocomplete,{ref:W,...Q});return i?jsx(Tooltip,{label:n,disabled:k,...r,children:jsxs(Group,{ref:V,gap:"sm",align:"center",style:{cursor:"pointer"},children:[!k&&jsx("div",{onClick:()=>A(true),children:i}),k&&jsx(Fragment,{children:U}),k?jsx(ActionIcon,{variant:"light",onClick:E,children:jsx(IconX,{size:20})}):jsx(ActionIcon,{variant:"light",onClick:_,children:jsx(IconSearch,{size:20})})]})}):U}var CT,pd,ud=S(()=>{l();ze();sd();St();CT=e=>{let{components:t}=pt(),o=nd;return t?.ReportItem&&(o=t?.ReportItem),e&&(o=e),o};pd=wT;});function IT(){let e=pt("components");return useMemo(()=>{let{modal:t,inline:o}=e?.search??{};return {modal:t,inline:o}},[e?.search])}function wr(e,t,o,r,n){let a=IT(),s=q(m=>m.variables.attributes.report_id),i=q(m=>m.variables.attributes.variant_id1),c=q(m=>m.variables.attributes.name1),p=useMemo(()=>({reportId:s,variantId:i,title:c}),[s,i,c]),d=useRouter(),u=Wn(),f=Ie();return useMemo(()=>{let m=e;return t==="modal"?m=jsx(od,{exploreProps:{locale:d.locale||dd,profilePrefix:u,translations:f.explore,initialReportId:p.reportId,initialVariantId:p.variantId,initialQuery:p.title},tooltipText:f.explore?.tooltip,modalProps:a.modal,...n,children:e}):t==="inline"&&(m=jsx(pd,{locale:d.locale||dd,profilePrefix:u,callback:o,tooltipText:f.explore?.tooltip,...r,autocompleteProps:a.inline,children:e})),m},[t,e,d.locale,u,f,p,a,o,r,n])}var dd,fd=S(()=>{l();ht();pe();De();rd();ud();St();ze();({localeDefault:dd}=Be());});var ze=S(()=>{l();bp();Sp();xp();xu();Ia();vu();ku();Cu();wu();Au();fd();});function ci({title:e,tooltip:t,slug:o,_iconType:r,_iconVariant:n,_icon:a,settings:s,_iconRadius:i,_iconSize:c,_iconPadding:p,asComparison:d=false}){let{print:u}=Qe(),f=we(e)||"<span class='cr-block-placeholder'>Title</span>",g=s&&s.order?parseInt(s.order,10):1,m=g<=6?g:1,y=s&&s.search?s.search:"off",h=s&&s.align?s.align:"left",v=tt(),C=q(k=>k.status.previews),L=(d?v.status.previews:C).map(k=>k.name).join(" | "),B=jsxs(Group,{className:"bespoke-Title-content",children:[jsx(Ee,{blockType:"title",iconType:r,iconVariant:n,iconRadius:i,iconSize:c,icon:a,iconPadding:p}),jsx(se,{className:"bespoke-Title-text",id:o||void 0,component:"h",order:m,style:s,html:f})]}),F=wr(B,y),w=s&&s.addComparisonName==="yes"&&v.active,P=w?Box:Fragment$1;return jsxs(Group,{className:"bespoke-Title-root",gap:"sm",justify:qe(h),children:[jsxs(P,{className:"bespoke-Title-wrapper",children:[u?B:F,w&&jsx(Text,{className:"bespoke-Title-comparison",children:L})]}),t&&jsx(Ve,{content:t})]})}var hd=S(()=>{l();Xt();Jt();Pe();ze();eo();pe();zt();Zt();We();});function mi(e){let{name:t,settings:o,options:r,id:n,defaultValue:a,section:s,component:i,asComparison:c,hideLabel:p,resetSectionVars:d}=e,{print:u}=Qe(),f=UT(n),g=Zn(n,s,f,c,d==="true"),m=c?`${f}Compare`:f,[y,h]=useState(a),[v,C]=useState(yd(a,[])),R=JSON.stringify(r),L=o[jt.DISABLED]||false,B=useMemo(()=>r?.map(E=>({value:E.id,label:E.label,imageUrl:E.imageUrl}))||[],[R]),F=u?r.filter(E=>v.includes(E.id)).map(E=>E.label).join(", "):"",w=u&&y&&r.find(E=>E.id===y)?.label||"",P=e.hideLabel==="true"?jsx(Fragment,{}):jsx(se,{className:"bespoke-Selector-label",component:"span",html:t,size:"sm",style:o});if(useEffect(()=>{if(!L){let _=new URLSearchParams(window.location.search).get(m)||a;_&&(e.type===_e.SINGLE?h(_):C(yd(_,a)));}},[window.location.search,a]),B.length<=1)return jsx(Fragment,{});let k=E=>{C(E),g(E.join(","));},A=E=>{h(E),g(E);};return jsx(Fragment,{children:u?jsxs(Box,{className:"bespoke-Selector-root",style:{display:"flex",alignItems:"center"},children:[P,jsx(Button,{className:"bespoke-Selector-button",ml:"sm",radius:"xl",variant:"outline",children:e.type===_e.SINGLE?w:F})]}):jsx(Box,{className:"bespoke-Selector-root",children:{[_e.SINGLE]:i===On.SEGMENTED_CONTROL?jsxs("div",{className:"bespoke-Selector-container",children:[jsx(Text,{className:"bespoke-Selector-label",size:"sm",fw:500,display:p==="true"?"none":"block",children:P}),jsx(SegmentedControl,{className:"bespoke-Selector-segmentedControl",data:B,disabled:L,value:B.map(E=>E.value).includes(y)?y:"",onChange:A,fullWidth:true})]}):jsx(Select,{className:"bespoke-Selector-select",label:P,data:B,disabled:L,value:y,renderOption:E=>jsx(GT,{...B.find(_=>_.value===E.option.value)||{}}),onChange:A,styles:{label:{display:p==="true"?"none":"block"}}}),[_e.MULTI]:jsx(MultiSelect,{className:"bespoke-Selector-multiSelect",label:P,data:B,value:v,onChange:k,disabled:L,styles:{label:{display:p==="true"?"none":"block"}}})}[e.type]})})}var UT,yd,GT,xd=S(()=>{l();Pe();ye();ze();zt();UT=e=>`selector${e}id`,yd=(e,t)=>e&&typeof e=="string"?e.split(","):t,GT=forwardRef(function({imageUrl:t,label:o,...r},n){return jsx("div",{ref:n,...r,children:jsxs(Group,{wrap:"nowrap",children:[t&&!["","undefined"].includes(t)&&jsx(Box,{component:"img",w:25,h:25,src:t}),jsx("div",{children:jsx(Text,{size:"sm",children:o})})]})})});});function ls(){return jsx("div",{children:"Generator"})}var Td=S(()=>{l();});function fi(e){let{alt:t,src:o,desc:r,title:n,settings:a,...s}=e,i=we(t),c=we(o),p=we(r),d=jsx("img",{src:c,alt:i,style:s}),u=a&&a.align?String(a.align):"left";return (p&&p.length||n&&n.length)&&(d=jsxs(Stack,{className:"bespoke-Image-wrapper",align:et(u),gap:"sm",children:[n&&jsx(se,{className:"bespoke-Image-title",component:"p",html:n,style:a}),d,r&&jsx(se,{className:"bespoke-Image-desc",component:"p",size:"sm",html:r,style:a})]})),c&&i?d:jsx(Center,{className:"bespoke-Image-placeholder",mih:100,bg:"white",children:jsx(Badge,{color:"gray",variant:"outline",children:"IMAGE"},"type")})}var vd=S(()=>{l();Xt();Pe();We();});function rr(e,t,o){let r=o.initialDeps??[],n;return ()=>{var a,s,i,c;let p;o.key&&((a=o.debug)!=null&&a.call(o))&&(p=Date.now());let d=e();if(!(d.length!==r.length||d.some((g,m)=>r[m]!==g)))return n;r=d;let f;if(o.key&&((s=o.debug)!=null&&s.call(o))&&(f=Date.now()),n=t(...d),o.key&&((i=o.debug)!=null&&i.call(o))){let g=Math.round((Date.now()-p)*100)/100,m=Math.round((Date.now()-f)*100)/100,y=m/16,h=(v,C)=>{for(v=String(v);v.length<C;)v=" "+v;return v};console.info(`%c\u23F1 ${h(m,5)} /${h(g,5)} ms`,`
13
13
  font-size: .6rem;
14
14
  font-weight: bold;
15
- color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,o?.key);}return (c=o?.onChange)==null||c.call(o,n),n}}function cs(e,t){if(e===void 0)throw new Error(`Unexpected undefined${""}`);return e}var Rd,Ed,kd=S(()=>{l();Rd=(e,t)=>Math.abs(e-t)<1,Ed=(e,t,o)=>{let r;return function(...n){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,n),o);}};});function ZT({measurements:e,outerSize:t,scrollOffset:o}){let r=e.length-1,a=Id(0,r,i=>e[i].start,o),s=a;for(;s<r&&e[s].end<o+t;)s++;return {startIndex:a,endIndex:s}}var YT,un,wd,Cd,XT,Ad,QT,Pd,ps,Id,gi=S(()=>{l();kd();YT=e=>e,un=e=>{let t=Math.max(e.startIndex-e.overscan,0),o=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let n=t;n<=o;n++)r.push(n);return r},wd=(e,t)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let n=s=>{let{width:i,height:c}=s;t({width:Math.round(i),height:Math.round(c)});};if(n(o.getBoundingClientRect()),!r.ResizeObserver)return ()=>{};let a=new r.ResizeObserver(s=>{let i=s[0];if(i?.borderBoxSize){let c=i.borderBoxSize[0];if(c){n({width:c.inlineSize,height:c.blockSize});return}}n(o.getBoundingClientRect());});return a.observe(o,{box:"border-box"}),()=>{a.unobserve(o);}},Cd={passive:true},XT=typeof window>"u"?true:"onscrollend"in window,Ad=(e,t)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let n=0,a=e.options.useScrollendEvent&&XT?()=>{}:Ed(r,()=>{t(n,false);},e.options.isScrollingResetDelay),s=p=>()=>{let{horizontal:d,isRtl:u}=e.options;n=d?o.scrollLeft*(u&&-1||1):o.scrollTop,a(),t(n,p);},i=s(true),c=s(false);return c(),o.addEventListener("scroll",i,Cd),o.addEventListener("scrollend",c,Cd),()=>{o.removeEventListener("scroll",i),o.removeEventListener("scrollend",c);}},QT=(e,t,o)=>{if(t?.borderBoxSize){let r=t.borderBoxSize[0];if(r)return Math.round(r[o.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[o.options.horizontal?"width":"height"])},Pd=(e,{adjustments:t=0,behavior:o},r)=>{var n,a;let s=e+t;(a=(n=r.scrollElement)==null?void 0:n.scrollTo)==null||a.call(n,{[r.options.horizontal?"left":"top"]:s,behavior:o});},ps=class{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=false,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let o=null,r=()=>o||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:o=new this.targetWindow.ResizeObserver(n=>{n.forEach(a=>{this._measureElement(a.target,a);});}));return {disconnect:()=>{var n;(n=r())==null||n.disconnect(),o=null;},observe:n=>{var a;return (a=r())==null?void 0:a.observe(n,{box:"border-box"})},unobserve:n=>{var a;return (a=r())==null?void 0:a.unobserve(n)}}})(),this.range=null,this.setOptions=o=>{Object.entries(o).forEach(([r,n])=>{typeof n>"u"&&delete o[r];}),this.options={debug:false,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:false,getItemKey:YT,rangeExtractor:un,onChange:()=>{},measureElement:QT,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:true,isRtl:false,useScrollendEvent:true,...o};},this.notify=o=>{var r,n;(n=(r=this.options).onChange)==null||n.call(r,this,o);},this.maybeNotify=rr(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),o=>{this.notify(o);},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(o=>o()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null;},this._didMount=()=>()=>{this.cleanup();},this._willUpdate=()=>{var o;let r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((o=this.scrollElement)==null?void 0:o.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n);}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify();})),this.unsubs.push(this.options.observeElementOffset(this,(n,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<n?"forward":"backward":null,this.scrollOffset=n,this.isScrolling=a,this.maybeNotify();}));}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(o,r)=>{let n=new Map,a=new Map;for(let s=r-1;s>=0;s--){let i=o[s];if(n.has(i.lane))continue;let c=a.get(i.lane);if(c==null||i.end>c.end?a.set(i.lane,i):i.end<c.end&&n.set(i.lane,true),n.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((s,i)=>s.end===i.end?s.index-i.index:s.end-i.end)[0]:void 0},this.getMeasurementOptions=rr(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(o,r,n,a,s)=>(this.pendingMeasuredCacheIndexes=[],{count:o,paddingStart:r,scrollMargin:n,getItemKey:a,enabled:s}),{key:false}),this.getMeasurements=rr(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:o,paddingStart:r,scrollMargin:n,getItemKey:a,enabled:s},i)=>{if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size);}));let c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];let p=this.measurementsCache.slice(0,c);for(let d=c;d<o;d++){let u=a(d),f=this.options.lanes===1?p[d-1]:this.getFurthestMeasurement(p,d),g=f?f.end+this.options.gap:r+n,m=i.get(u),y=typeof m=="number"?m:this.options.estimateSize(d),h=g+y,v=f?f.lane:d%this.options.lanes;p[d]={index:d,start:g,size:y,end:h,key:u,lane:v};}return this.measurementsCache=p,p},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=rr(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(o,r,n)=>this.range=o.length>0&&r>0?ZT({measurements:o,outerSize:r,scrollOffset:n}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getIndexes=rr(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(o,r,n,a)=>r===null?[]:o({startIndex:r.startIndex,endIndex:r.endIndex,overscan:n,count:a}),{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:()=>this.options.debug}),this.indexFromElement=o=>{let r=this.options.indexAttribute,n=o.getAttribute(r);return n?parseInt(n,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(o,r)=>{let n=this.indexFromElement(o),a=this.measurementsCache[n];if(!a)return;let s=a.key,i=this.elementsCache.get(s);i!==o&&(i&&this.observer.unobserve(i),this.observer.observe(o),this.elementsCache.set(s,o)),o.isConnected&&this.resizeItem(n,this.options.measureElement(o,r,this));},this.resizeItem=(o,r)=>{let n=this.measurementsCache[o];if(!n)return;let a=this.itemSizeCache.get(n.key)??n.size,s=r-a;s!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(n,s,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",s),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=s,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,r)),this.notify(false));},this.measureElement=o=>{if(!o){this.elementsCache.forEach((r,n)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(n));});return}this._measureElement(o,void 0);},this.getVirtualItems=rr(()=>[this.getIndexes(),this.getMeasurements()],(o,r)=>{let n=[];for(let a=0,s=o.length;a<s;a++){let i=o[a],c=r[i];n.push(c);}return n},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=o=>{let r=this.getMeasurements();if(r.length!==0)return cs(r[Id(0,r.length-1,n=>cs(r[n]).start,o)])},this.getOffsetForAlignment=(o,r)=>{let n=this.getSize(),a=this.getScrollOffset();r==="auto"&&o>=a+n&&(r="end"),r==="end"&&(o-=n);let s=this.options.horizontal?"scrollWidth":"scrollHeight",c=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[s]:this.scrollElement[s]:0)-n;return Math.max(Math.min(c,o),0)},this.getOffsetForIndex=(o,r="auto")=>{o=Math.max(0,Math.min(o,this.options.count-1));let n=this.measurementsCache[o];if(!n)return;let a=this.getSize(),s=this.getScrollOffset();if(r==="auto")if(n.end>=s+a-this.options.scrollPaddingEnd)r="end";else if(n.start<=s+this.options.scrollPaddingStart)r="start";else return [s,r];let i=n.start-this.options.scrollPaddingStart+(n.size-a)/2;switch(r){case "center":return [this.getOffsetForAlignment(i,r),r];case "end":return [this.getOffsetForAlignment(n.end+this.options.scrollPaddingEnd,r),r];default:return [this.getOffsetForAlignment(n.start-this.options.scrollPaddingStart,r),r]}},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null);},this.scrollToOffset=(o,{align:r="start",behavior:n}={})=>{this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(o,r),{adjustments:void 0,behavior:n});},this.scrollToIndex=(o,{align:r="auto",behavior:n}={})=>{o=Math.max(0,Math.min(o,this.options.count-1)),this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");let a=this.getOffsetForIndex(o,r);if(!a)return;let[s,i]=a;this._scrollToOffset(s,{adjustments:void 0,behavior:n}),n!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(o))){let[p]=cs(this.getOffsetForIndex(o,i));Rd(p,this.getScrollOffset())||this.scrollToIndex(o,{align:i,behavior:n});}else this.scrollToIndex(o,{align:i,behavior:n});}));},this.scrollBy=(o,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+o,{adjustments:void 0,behavior:r});},this.getTotalSize=()=>{var o;let r=this.getMeasurements(),n;return r.length===0?n=this.options.paddingStart:n=this.options.lanes===1?((o=r[r.length-1])==null?void 0:o.end)??0:Math.max(...r.slice(-this.options.lanes).map(a=>a.end)),Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(o,{adjustments:r,behavior:n})=>{this.options.scrollToFn(o,{behavior:n,adjustments:r},this);},this.measure=()=>{this.itemSizeCache=new Map,this.notify(false);},this.setOptions(t);}},Id=(e,t,o,r)=>{for(;e<=t;){let n=(e+t)/2|0,a=o(n);if(a<r)e=n+1;else if(a>r)t=n-1;else return n}return e>0?e-1:0};});function ev(e){let t=vo.useReducer(()=>({}),{})[1],o={...e,onChange:(n,a)=>{var s;a?flushSync(t):t(),(s=e.onChange)==null||s.call(e,n,a);}},[r]=vo.useState(()=>new ps(o));return r.setOptions(o),Ld(()=>r._didMount(),[]),Ld(()=>r._willUpdate()),r}function us(e){return ev({observeElementRect:wd,observeElementOffset:Ad,scrollToFn:Pd,...e})}var Ld,hi=S(()=>{l();gi();gi();Ld=typeof document<"u"?vo.useLayoutEffect:vo.useEffect;});function Si(e){let{allLabel:t,asComparison:o,colorKey:r,data:n,defaultValue:a,defaultValueType:s,hideLabel:i,resetSectionVars:c,iconKey:p,id:d,levels:u,limit:f,placeholder:g,searchIndexKey:m,searchIndexSeparator:y,section:h,settings:v}=e,{print:C}=Qe(),R=fv(d),L=ns(d,h,R,o,c==="true"),B=o?`${R}-valueCompare`:`${R}-value`,F=o?`${R}-typeCompare`:`${R}-type`,w=useMantineTheme(),{colorScheme:P}=useMantineColorScheme(),[k,A]=useState(false),[E,_]=useState(true),[W,V]=useState(""),[j,Z]=useState(false),[D,H]=useState([""].slice(1)),[O,Y]=useState([]),[ae,ce]=useState(""),G=v[jt.DISABLED]||false,re=useMemo(()=>C?Array.from(new Set(n.filter(oe=>O.includes(oe[`${ae} ID`])))).map(oe=>oe?.[ae]).join(", "):"",[C]),ne=i==="true"||!e.label?jsx(Fragment,{}):jsx(se,{component:"div",html:e.label,size:"sm",style:v}),Q=useRef(null),U=useRef(false),I=useRef(!!f&&f<O.length),N=D.length,M=u[N],K=D.filter(Boolean);D.length>0&&K.length===0&&K.push(`${t} ${M?.label}`),useEffect(()=>{if(!G){let z=new URLSearchParams(window.location.search),oe=z.get(B)||a,fe=z.get(F)||s;oe&&fe?(Y(gv(oe,a)),ce(fe)):(Y([]),ce(""));}},[window.location.search,a,s,G]),useEffect(()=>{let z=()=>{_(true);};return window.addEventListener("touchmove",z),()=>{window.removeEventListener("touchmove",z);}},[]);let J=useMemo(()=>uv(n,u,r,p,m,y),[r,n,p,u,m,y]),te=useMemo(()=>{let z=dv(W),oe=Array.from(mv(J,z)).reverse();return j?oe:D.reduce((fe,mt)=>fe.filter(Ge=>!mt||Ge.searchindex.indexOf(mt)>-1),oe.filter(fe=>fe.type===M?.value))},[M,J,W,j,D]),me=useRef(null),xe=us({count:k?te.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>me.current,[]),overscan:10,rangeExtractor:useCallback(z=>un(z),[])}),[nt,le]=useState(-1),Te=Math.min(nt,te.length-1),st=useCallback(z=>{let oe=D.concat(z);j&&Z(false),H(oe);},[j,D]),dt=useCallback(()=>{let z=D.slice(0,N-1);j&&Z(false),H(z);},[j,D,N]),It=useCallback(z=>{V(z.currentTarget.value),!I.current&&n.length>0&&A(true);},[n,V,I,A]),Fr=useCallback(()=>{V(""),L([],""),Q.current?.focus(),f&&(I.current=false);},[V,L,Q,f,I]),Po=useCallback(z=>{let oe=O.filter(fe=>fe!==z);oe.length>0?L(oe,ae):L([],""),f&&oe.length<f&&(I.current=false);},[O,ae,L,f,I]),Io=useCallback(z=>{ae!==z.type?L([z.value],z.type):O.includes(z.value)?Po(z.value):f?(O.length<f&&L([...O,z.value],ae),O.length===f&&L([...O.slice(1),z.value],ae)):L([...O,z.value],ae),V("");},[L,ae,O,Po,f]),Ds=useCallback(()=>{O.length>0&&W.length===0&&(L(O.slice(0,-1),ae),A(true),f&&(I.current=false)),W.length>0&&V(W.slice(0,-1));},[L,O,ae,W,V,A,f,I]),Fs=useCallback(()=>{_(z=>z&&(U.current=z,!z)),le(z=>z+1>=te.length?z:z+1);},[le,te]),Vs=useCallback(()=>{let z=te[Te];z&&Io(z);},[te,Te,Io]),zs=useCallback(()=>{A(false);},[A]),$s=useCallback(()=>{dt(),le(0);},[le,dt]),Us=useCallback(()=>{let z=te[Te];!j&&z&&z.type!==u[u.length-1]?.value&&(st(z.name),le(0));},[te,Te,j,u,le,st]),Gs=useCallback(()=>{_(z=>z&&(U.current=z,!z)),le(z=>z-1<0?0:z-1);},[le]),$=({label:z,onRemove:oe,...fe})=>jsxs("div",{className:"bespoke-MultiHierarchySelector-selectedItem",style:{alignItems:"center",backgroundColor:P==="dark"?"var(--mantine-color-dark-7)":"var(--mantine-color-gray-1)",borderRadius:w.radius.sm,cursor:"default",color:P==="dark"?"var(--mantine-color-dark-0)":"var(--mantine-color-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"},...fe,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:z}),jsx(CloseButton,{className:"bespoke-MultiHierarchySelector-itemCloseButton","aria-hidden":true,iconSize:"70%",onMouseDown:oe,radius:2,size:"sm",sx:{color:P==="dark"?"var(--mantine-color-dark-0)":"var(--mantine-color-gray-7)",marginLeft:`calc(${w.spacing.sm} / 6)`},tabIndex:-1})]}),ue=useMemo(()=>O.map(z=>J.find(oe=>oe.value===z)).filter(z=>!!z).map((z,oe)=>createElement($,{...z,index:oe,label:z.label,key:z.value,onRemove:fe=>{fe.preventDefault(),fe.stopPropagation(),Po(z.value);}})),[O]),Re=forwardRef(function({color:oe,icon:fe,label:mt,value:Ge,...Hs},kg){return jsx("div",{className:"bespoke-MultiHierarchySelector-item",ref:kg,style:{cursor:"pointer",width:"100%"},...Hs,children:jsxs(Group,{className:"bespoke-MultiHierarchySelector-itemWrapper",align:"center",wrap:"nowrap",gap:"xs",w:"100%",children:[fe&&jsx(Box,{className:"bespoke-MultiHierarchySelector-itemIcon",bg:oe??"transparent",component:"img",w:20,h:20,src:fe}),jsx(Text,{lineClamp:1,size:"sm",className:"bespoke-MultiHierarchySelector-itemLabel",children:mt||Ge})]})})});return jsxs(Fragment,{children:[jsx("div",{className:"bespoke-MultiHierarchySelector-root no-print",children:jsx(Input.Wrapper,{className:"bespoke-MultiHierarchySelector-inputWrapper",label:ne,children:jsxs(Popover,{closeOnClickOutside:true,disabled:G,keepMounted:true,opened:k,onChange:A,onClose:()=>{le(0),V("");},onOpen:()=>{te.length>0&&xe.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:true,children:[jsx(Popover.Target,{children:jsxs(Box,{className:"bespoke-MultiHierarchySelector-content","aria-haspopup":"listbox",component:"div",onMouseLeave:()=>le(0),sx:{position:"relative","& .defaultValue":{backgroundColor:P==="dark"?"var(--mantine-color-dark-5)":"var(--mantine-color-gray-3)",color:P==="dark"?"var(--mantine-color-dark-1)":"var(--mantine-color-gray-7)"}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:O.join(",")}),jsx(Input,{className:"bespoke-MultiHierarchySelector-input",component:"div",disabled:G,multiline:true,onMouseDown:z=>{z.preventDefault(),!I.current&&n.length>0&&A(!k),Q.current?.focus();},rightSection:O.length>0?jsx(CloseButton,{className:"bespoke-MultiHierarchySelector-closeButton",disabled:G,onClick:Fr,onMouseDown:z=>z.preventDefault(),variant:"transparent"}):jsx(IconSelector,{className:"bespoke-MultiHierarchySelector-icon",color:w.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{className:"bespoke-MultiHierarchySelector-selectedItems",component:"div","data-clearable":true,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:P==="dark"?"var(--mantine-color-dark-3)":"var(--mantine-color-gray-5)",opacity:1}},children:[ue,jsx("input",{className:"bespoke-MultiHierarchySelector-search",autoComplete:"off","data-mantine-stop-propagation":k,onChange:It,onKeyDown:getHotkeyHandler([["ArrowDown",Fs],["ArrowLeft",$s],["ArrowRight",Us],["ArrowUp",Gs],["Backspace",Ds],["Enter",Vs],["Escape",zs]]),placeholder:O.length===0&&g||"",ref:Q,readOnly:I.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:W})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:z=>z.preventDefault(),p:0,children:jsx("div",{className:"bespoke-MultiHierarchySelector-dropdown",style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{className:"bespoke-MultiHierarchySelector-dropdownContent",component:"div","data-combobox-popover":true,onMouseDown:z=>z.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",gap:"xs",w:"100%",children:[u.length>1&&jsxs(Stack,{gap:"xs",children:[jsxs(Group,{onClick:z=>{z.stopPropagation();},px:"xs",justify:"center",gap:"xs",children:[jsx(Button,{onClick:()=>{le(0),Z(true),H([]),te.length>0&&xe.scrollToIndex(0);},size:"xs",variant:j?"filled":"outline",children:t}),u.map((z,oe)=>jsx(Button,{onClick:()=>{j&&Z(false);let fe=[""].slice(1),mt=oe;for(;mt--;)fe[mt]=D[mt]||"";le(0),H(fe),te.length>0&&xe.scrollToIndex(0);},size:"xs",variant:!j&&D.length===u.findIndex(fe=>fe.value===z?.value)?"filled":"outline",children:z?.label},z?.value))]}),jsx(Divider,{})]}),N>0&&jsxs(Group,{align:"center",wrap:"nowrap",px:"xs",children:[jsx(ActionIcon,{onClick:dt,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:K.map(z=>jsx(Text,{lineClamp:1,size:"xs",children:z},`${z}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>_(true),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:me,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${xe.getTotalSize()}px`,position:"relative",width:"100%"},children:xe.getVirtualItems().map(z=>{let oe=te[z.index],fe=Te===z.index,mt=O.includes(oe.value);return te.length>0&&fe&&!E&&xe.scrollToIndex(Te),jsxs(Group,{"aria-selected":fe,align:"center","data-hovered":fe||void 0,"data-index":z.index,"data-selected":mt,id:oe.vale,wrap:"nowrap",onMouseEnter:Ge=>{Ge.preventDefault(),Ge.stopPropagation(),E&&(le(z.index),_(false));},onMouseMove:Ge=>{Ge.preventDefault(),Ge.stopPropagation(),_(true);},onMouseDown:Ge=>{Ge.preventDefault(),Io(oe);},justify:"space-between",ref:xe.measureElement,role:"option",gap:"xs",sx:Ge=>({borderRadius:Ge.radius.xs,padding:"15px 5px 15px",paddingLeft:j&&10*u.findIndex(Hs=>Hs?.value===oe.type)||5,position:"absolute",top:0,left:0,height:`${z.size}px`,transform:`translateY(${z.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:P==="dark"?"var(--mantine-color-dark-4)":"var(--mantine-color-gray-1)"},"&:hover":{backgroundColor:P==="dark"?"var(--mantine-color-dark-4)":"var(--mantine-color-gray-1)"}}),tabIndex:-1,children:[jsx(Re,{index:z.index,...oe}),!j&&oe.type!==u[u.length-1]?.value&&jsx(ActionIcon,{onMouseDown:Ge=>{Ge.preventDefault(),Ge.stopPropagation(),st(oe.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},oe.value)})})})]})})})})]})})}),C&&jsxs(Text,{children:[ne,": ",re]})]})}var uv,dv,mv,fv,gv,Vd=S(()=>{l();hi();Pe();zt();ze();ye();uv=(e=[],t=[],o="",r="",n="",a="|")=>{let s=t.map(y=>y.value).slice(),i=`${s.pop()}`,c=y=>y[o],p=y=>y[r],d=y=>{if(y[n])return typeof y[n]=="string"?y[n].split(a):y[n]},u=new Set,f=[],g=[],m=nest().rollup(y=>{let h=y[0],v=k=>k&&k.value&&!u.has(k.value),C=s.map(k=>h[`${k} ID`]),R=s.map(k=>h[k]),L=s.map((k,A)=>{if(g[A]!==R[A]){g[A]=R[A];let E=c[A]||c[c.length-1]||c,_=p[A]||p[p.length-1]||p,W=d[A]||d[d.length-1]||d;return {color:E(h,k)||void 0,icon:_(h,k)||void 0,value:`${C[A]}`,label:R[A],name:R[A],type:k,searchindex:R.slice(0,A+1).concat(W(h,k)).join("|")}}return {}}).filter(v);L.forEach(k=>u.add(k.value));let B=c[c.length-1]||c,F=p[p.length-1]||p,w=d[d.length-1]||d,P=y.map(k=>({color:B(k,i)||void 0,icon:F(k,i)||void 0,value:`${k[`${i} ID`]}`,label:k[i],name:k[i],type:i,searchindex:R.concat(k[i]).concat(w(k,i)).join("|")}));f.push(...L.concat(P));});return s.forEach(y=>{m.key(h=>`${h[`${y} ID`]}|${h[y]}`);}),m.entries(e),f},dv=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},mv=(e,t)=>{let o=e.length,r,n=i=>r&&r.searchindex.includes(i.searchindex),s={next:()=>{for(let i=o-1;i>-1;i--){let c=e[i];if(t.test(`${c.value} ${c.label} ${c.searchindex}`)||n(c))return r=c,o=i,{done:false,value:c}}return {done:true,value:void 0}},[Symbol.iterator]:()=>s};return s},fv=e=>`multihierarchySelector${e}`,gv=(e,t)=>e&&typeof e=="string"?e.split(","):t;});function xi({headings:e,settings:t,type:o,title:r,shortTitle:n,_iconType:a,_iconVariant:s,_icon:i,_iconRadius:c,_iconSize:p,_iconPadding:d}){let{min:u="1",max:f="6",icons:g="yes"}=t||{},m=bo(parseInt(u,10),parseInt(f,10),e),y=g==="yes",h=we(r)||"",v=we(n||r)||"",C=h&&h.length>0,R=a&&a!=="none",B=`(max-width: ${useMantineTheme().breakpoints.md})`,F=useMediaQuery(B),w=F?v:h,P=t&&t.align?String(t.align):"left",k=vr(P),A=qe(P),E=et(P),_=t&&t.titlePosition?String(t.titlePosition):"left",W=useMemo(()=>{let D={right:"left",left:"right"},H=C&&["left","right"].includes(_),O={};if(H){let Y=_==="right";O={gap:"xs",justify:Y&&D[A]?D[A]:A,style:{flexDirection:Y?"row-reverse":"row"},wrap:"nowrap"};}else O={gap:"xs",align:E,justify:"center",style:{flexDirection:_==="bottom"?"column-reverse":"column"}};return {element:H?Group:Stack,props:O}},[C,A,E,_]),V=useMemo(()=>C?jsxs(Group,{className:"bespoke-Nav-title",gap:"xs",justify:A,wrap:"nowrap",children:[R&&jsx(Ee,{blockType:"title",iconType:a,iconVariant:s,iconRadius:c,iconSize:p,icon:i,iconPadding:d}),jsx(se,{className:"bespoke-Nav-titleText",style:{...t},html:w,lineClamp:1})]}):null,[C,R,A,w]),j=useMemo(()=>F?jsx(vv,{contentOutline:m,showIcons:y,titleElement:V,wrapper:W}):null,[F,V,W]),Z=useMemo(()=>F?null:o==="multilevel"?jsx(Rv,{contentOutline:m,showIcons:y,align:k}):jsx(Tv,{contentOutline:m,showIcons:y,align:k}),[m,y,k,F]);return jsxs(Fragment,{children:[F&&j,!F&&jsxs(W.element,{className:"bespoke-Nav-wrapper",pos:"relative",...W.props,children:[C&&V,Z]})]})}var $d,Tv,Kd,vv,Rv,Yd=S(()=>{l();ze();Jt();We();Xt();Jt();Pe();$d=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"}),Tv=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null);useEffect(()=>{let s=()=>{let i=document.querySelector(".bespoke-nav");if(!i)return;let c=i.getBoundingClientRect(),p=false;e.forEach(d=>{let u=document.getElementById(`bespoke-title-${d.id}`);u&&u.getBoundingClientRect().top<=c.bottom&&(n(d.id),p=true);}),p||n(null);};return window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s);}},[e]);let a=s=>!s||!s?.length?null:jsx(Fragment,{children:s.map(i=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${i.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(Ee,{...i.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:i.label}})]})})}),jsx(Box,{pl:"xs",children:a(i.children)})]},i.id))});return jsx(Fragment,{children:jsx(Box,{component:"nav",className:"bespoke-nav",children:jsx(List,{sx:s=>({display:"flex",gap:s.spacing.md,justifyContent:o,listStyleType:"none"}),children:e?.map(s=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${s.id}`,"data-active":s.id===r,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(Ee,{...s.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:s.label}})]})})}),s?.children?.length?jsx(Menu.Dropdown,{children:a(s.children)}):null]})},s.id))})})})},Kd=({contentOutline:e,closeNav:t,showIcons:o})=>{let[r,n]=useState(null);return jsx(Stack,{className:"bespoke-MobileNav-accordion",children:e.map(a=>a.children.length?jsxs(Fragment,{children:[jsxs(Group,{className:"bespoke-MobileNav-group",gap:0,wrap:"nowrap",children:[jsx(UnstyledButton,{className:"bespoke-MobileNav-button",w:"100%",component:"a",onClick:t,href:`#bespoke-title-${a.id}`,children:jsxs(Group,{className:"bespoke-MobileNav-buttonContent",gap:"sm",wrap:"nowrap",children:[o&&jsx(Ee,{...a.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{className:"bespoke-MobileNav-buttonText",dangerouslySetInnerHTML:{__html:a.label}})]})},a.id),jsx(ActionIcon,{className:"bespoke-MobileNav-chevron",component:"a",size:"lg",onClick:()=>n(s=>s===a.id?null:a.id),children:jsx(IconChevronDown,{style:{transition:"transform 0.2s",transform:r===a.id?"rotate(-180deg)":"none"},stroke:1})})]},a.id),jsx(Collapse,{className:"bespoke-MobileNav-collapse",in:r===a.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(Kd,{contentOutline:a.children,closeNav:t,showIcons:o})})]}):jsx(Group,{className:"bespoke-MobileNav-group",wrap:"nowrap",children:jsx(UnstyledButton,{className:"bespoke-MobileNav-button",display:"flex",w:"100%",component:"a",href:`#bespoke-title-${a.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[o&&jsx(Ee,{...a.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:a.label}})]})},a.id)},a.id))})},vv=({contentOutline:e,showIcons:t,titleElement:o,wrapper:r})=>{let[n,{toggle:a}]=useDisclosure(false),s=n?"Close content outline":"Open content outline";return jsxs(Box,{className:"bespoke-MobileNav-root",component:"nav",children:[jsxs(r.element,{className:"bespoke-MobileNav-header",...r.props,onClick:a,children:[o&&o,jsx(ActionIcon,{className:"bespoke-MobileNav-toggle","aria-label":s,size:"lg",variant:"subtle",children:n?jsx(IconChevronUp,{size:"xl",stroke:1.5}):jsx(IconChevronDown,{size:"xl",stroke:1.5})})]}),jsx(Collapse,{in:n,mt:"md",className:"bespoke-MobileNav-body",children:jsx(Kd,{contentOutline:e,closeNav:a,showIcons:t})})]})},Rv=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null),[a,s]=useState(null);useEffect(()=>{let c=()=>{let p=document.querySelector(".bespoke-nav");if(!p)return;let d=p.getBoundingClientRect(),u=false;e.forEach(f=>{let g=document.getElementById(`bespoke-title-${f.id}`);g&&(g.getBoundingClientRect().top<=d.bottom&&(n(f.id),s(null),u=true),f.children.forEach(y=>{let h=document.getElementById(`bespoke-title-${y.id}`);h&&h.getBoundingClientRect().top<=d.bottom&&(s(y.id),n(f.id),u=true);}));}),u||(n(null),s(null));};return window.addEventListener("scroll",c),()=>{window.removeEventListener("scroll",c);}},[e]);let i=c=>!c||!c?.length?null:jsx(Fragment,{children:c.map(p=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${p.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(Ee,{...p.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:p.label}})]})})}),jsx(Box,{pl:"xs",children:i(p.children)})]},p.id))});return jsxs(Box,{component:"nav",className:"bespoke-Nav-root",children:[jsx(List,{className:"bespoke-Nav-level","data-level":"1",sx:$d(o),children:e?.map(c=>jsx(List.Item,{className:"bespoke-Nav-levelItem",children:jsx(Anchor,{className:"bespoke-Nav-itemAnchor",href:`#bespoke-title-${c.id}`,"data-active":r===c.id,onClick:()=>n(c.id),children:jsxs(Group,{className:"bespoke-Nav-itemGroup",gap:"sm",wrap:"nowrap",children:[t&&jsx(Ee,{...c.iconProps,iconSize:"sm"}),jsx(Text,{className:"bespoke-Nav-itemLabel",dangerouslySetInnerHTML:{__html:c.label}})]})})},c.id))}),r&&e.find(c=>c.id===r)?.children.length>0&&jsx(List,{className:"bespoke-Nav-level","data-level":"2",sx:$d(o),children:e.find(c=>c.id===r)?.children.map(c=>jsx(List.Item,{className:"bespoke-Nav-levelItem",children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{className:"bespoke-Nav-itemAnchor",href:`#bespoke-title-${c.id}`,"data-active":c.id===a,children:jsxs(Group,{className:"bespoke-Nav-itemGroup",gap:"sm",wrap:"nowrap",children:[t&&jsx(Ee,{...c.iconProps,iconSize:"sm"}),jsx(Text,{className:"bespoke-Nav-itemLabel",dangerouslySetInnerHTML:{__html:c.label}})]})})}),c?.children?.length?jsx(Menu.Dropdown,{className:"bespoke-Nav-levelMenuDropdown",children:i(c.children)}):null]})},c.id))})]})};});function vi(e){let{related_reports:t,settings:o}=e,r=q(f=>f.status.currentLocale),n=q(f=>f.status.localeDefault),a=Wn(),s=useRouter(),i=pt("components");if(!t?.length)return;let c=r===n?"":`/${r}`,p=f=>{s.push(`${f}`);},d=i?.ReportTile?i.ReportTile:oi,u=et(o&&o.align?String(o.align):"center");return jsx(Grid,{className:"bespoke-Related-root",justify:u,children:t.map(f=>{let g=`${c}${a}${f.link}`,m=f.entities.map(R=>({original_id:R.id,name:R.name,id:R.content_id,variant:R.variant_name,variant_id:R.variant_id,dimension:R.dimension_name,dimension_id:R.dimension_id,image:{src:`/api/cms/member/image?member=${R.content_id}&size=thumb`,alt:R.name}})),y=f.entities.map(R=>R.id).join("-"),h=f.entities.map(R=>R.name).join(" & "),v=f.entities[0]?f.entities[0].report_id:null,C=R=>{R.preventDefault(),p(g);};return jsx(Grid.Col,{className:"bespoke-Related-col",xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(d,{reportId:v,reportName:h,members:m,href:g,onClick:C})},y)})})}var Qd=S(()=>{l();pe();De();ri();ze();We();});function Ri({id:e,label:t,settings:o,showIcon:r,fullWidth:n,showWhenDisabled:a}){let s=Rt(e).data,{sectionVariables:i,resetSectionVariables:c}=Me(s?.section_id),p=!!Object.keys(i).length,d=et(o&&o.align?o.align:"left");return !p&&!a?null:jsx(Button,{className:"bespoke-ResetButton-root",onClick:()=>c(),disabled:!p,fullWidth:n,sx:{justifySelf:d},children:jsxs(Group,{className:"bespoke-ResetButton-content",align:"center",children:[t,r&&jsx(IconRefresh,{className:"bespoke-ResetButton-icon"})]})})}var Jd=S(()=>{l();De();We();});function Ei({settings:e,label:t,removeLabel:o,showIcon:r,position:n="center",asComparison:a=false}){let s=q(R=>R.records.entities.report),i=q(R=>R.variables.attributes),c=e&&e.search?e.search:"inline",p=Object.values(s)[0].settings,d=useRouter(),{comparisonLoaded:u,loading:f}=tt(),g=Object.keys(d.query).includes("compare"),y=u&&g?jsx(Button,{onClick:()=>{let R={...d.query};delete R.compare,d.push({pathname:d.pathname,query:R},void 0,{shallow:true});},rightIcon:jsx(IconX,{}),children:o||"Remove Comparison"}):jsx(Button,{loading:f,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",r&&jsx(IconPlus,{})]})}),h={searchReportParams:{report:[Number(Object.keys(s)[0])],variant:p.compareLevels?[]:[i.variant_id1]}},C=wr(y,c,R=>{d.push({pathname:d.pathname,query:{...d.query,compare:R.reportPath}});},h);return a?null:jsx(Group,{className:"bespoke-ComparisonButton-root",align:n,children:g?y:C})}var om=S(()=>{l();ze();pe();eo();});function Ci({columns:e=[],data:t=[],tableProps:o={},sectionId:r=null}){let[n,a]=useState(false),s=useMemo(()=>e.map(u=>u.accessorKey),[e]),i=useMemo(()=>t.filter(u=>typeof u=="object"&&u!==null&&!Array.isArray(u)&&Object.keys(u).some(f=>s.includes(f))),[s,t]),c=useMemo(()=>e.map(u=>({...u,Cell:({renderedCellValue:f})=>jsx(se,{html:`${f}`}),filterFn:"contains"})),[e]),p=Ie("table"),d={...MRT_Localization_EN,...p};return jsx(MantineReactTable,{className:"bespoke-Table-root",...o,autoResetPageIndex:false,columns:c,data:i,enableColumnFilterModes:true,enableFilterMatchHighlighting:false,globalFilterFn:"contains",layoutMode:"grid",localization:d,onIsFullScreenChange:u=>{let f=document.getElementById(`section-${r}`);f&&(u?f.style.zIndex="10":f.style.zIndex="1"),a(u);},state:{...o.state,isFullScreen:n}})}var nm=S(()=>{l();Pe();ht();});function wi({label:e,url:t,settings:o}){let{align:r}=o;return e?jsx(Group,{className:"bespoke-Button-root",align:r,grow:r==="justify",children:jsx(Button,{className:"bespoke-Button-button",component:"a",target:"_blank",href:t||"",children:e||"Button"})}):null}var am=S(()=>{l();});function Uv({block:e}){let{id:t}=e;return jsxs(Stack,{className:"bespoke-Fallback-root",align:"center",gap:"sm",children:[jsx(ThemeIcon,{className:"bespoke-Fallback-themeIcon",radius:"md",size:100,children:jsx(IconCircleKey,{size:100})}),jsxs(Title,{className:"bespoke-Fallback-title",order:5,children:["Private content (Block ",t,")"]}),jsx(Text,{className:"bespoke-Fallback-text",children:"Sorry, you do not have sufficient permissions to view this block."}),jsx(Text,{className:"bespoke-Fallback-text",children:"Contact your account manager to check your access role."})]})}function Ai(e){let t=Gv();return jsx(t,{block:e})}var Gv,cm=S(()=>{l();ze();Gv=()=>{let e=pt("components"),t=Uv;return e?.CustomFallback&&(t=e.CustomFallback),t};});var sr,Pi=S(()=>{l();sr=class extends Component{constructor(t){super(t),this.state={hasError:false};}static getDerivedStateFromError(t){return console.info("getDerivedStateFromError",t),{hasError:true}}componentDidCatch(t,o){console.error("Error information:",o.componentStack),notifications.show({autoClose:false,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 bn({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var Ii=S(()=>{l();});var dm={};qs(dm,{default:()=>um});function um(e){let{print:t}=Qe(),{block:o,active:r,locale:n,variables:a,configOverride:s={}}=e,i=He(o),c=Nt(n),p={variables:a},d=useRouter(),{sectionVariables:u,setSectionVariables:f,resetSectionVariables:g}=Me(o.section_id),m=mo(),y=JSON.stringify(u),h=useMemo(()=>{if(!i?.logic)return {error:"Add a Configuration"};let w=gt({logic:i.logic},c,p).logic,P={router:d,section:{variables:u,setVariables:f,resetVariables:g}};return yo(w,c,a,n,o.id,{},P,m)},[o,r,a,y]),{type:v}=h.config||{},C=v&&Li[v]?v:"Treemap";Li[v]||(h.config={error:`"${v}" is not a valid Visualization Type`});let R=Li[C],L=useMemo(()=>{let{_data:w,...P}=h.config;return Xv(P,t)},[h,t]),B={locale:n,variables:a,...L,...s},F=w=>{let P;try{P=h.dataFormat(w);}catch(k){console.error("Error in dataFormat: ",k),P=[];}return P};return jsx(Box,{className:"bespoke-Viz-root","data-ignore-print":B._printIgnore?"true":void 0,sx:{display:"flex",minHeight:v==="HTML"?void 0:400,"& .chart":{flex:"1 1 100%"}},children:jsx(sr,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(R,{style:{flex:1},dataFormat:w=>{let P;try{P=h.dataFormat(w);}catch(k){console.error("Error in dataFormat: ",k),P=[];}return P},config:{...B,dataFormat:F,sectionVariables:y}},"viz-key")})})}var Li,Xv,mm=S(()=>{l();Fo();on();Mo();De();Pi();zt();Ii();Li={...jv,HTML:bn},Xv=(e,t)=>{let o={...e};return t&&(o.detectResize=false,o.detectResizeDelay=0,o.detectVisible=false,o.detectVisibleInterval=0,o.duration=0,o.shapeConfig={...o.shapeConfig,duration:0}),o};});var Zv,Jv,fm,gm=S(()=>{l();ye();Zc();np();ap();hd();xd();Td();vd();Vd();Yd();Qd();Jd();om();nm();am();cm();Zv=Qv(()=>Promise.resolve().then(()=>(mm(),dm)),{ssr:false}),Jv={[b.PARAGRAPH]:ka,[b.STAT]:wa,[b.SUBTITLE]:Aa,[b.TITLE]:ci,[b.SELECTOR]:mi,[b.VIZ]:Zv,[b.GENERATOR]:ls,[b.SECTION_FLAG]:ls,[b.IMAGE]:fi,[b.NAV]:xi,[b.RELATED]:vi,[b.RESET_BUTTON]:Ri,[b.COMPARISON_BUTTON]:Ei,[b.TABLE]:Ci,[b.BUTTON]:wi,[b.MULTIHIERARCHY_SELECTOR]:Si,[b.FALLBACK]:Ai},fm=Jv;});var eR,hm,bm=S(()=>{l();eR=(e,t)=>{let o=e.allLabel||"All",r=e.colorKey||"",n=e.data||[],a=e.hideLabel||"false",s=e.resetSectionVars||"false",i=e.iconKey||"",c=e.label||"Unlabeled Multihierarchy Selector",p=e.levels||[],d=e.limit||void 0,u=e.placeholder||"",f=e.searchIndexKey||"",g=e.searchIndexSeparator||"",m,y;return e.defaultValue&&e.defaultValueType&&(m=e.defaultValue,y=e.defaultValueType),(!m||!y)&&(m=[],y=""),{allLabel:o,colorKey:r,data:n,defaultValue:m,defaultValueType:y,hideLabel:a,resetSectionVars:s,iconKey:i,id:t,label:c,levels:p,limit:d,placeholder:u,searchIndexKey:f,searchIndexSeparator:g}},hm=eR;});var tR,ym,oR,Sm,xm=S(()=>{l();ye();Nn();tR=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{id:t,label:t}:t):[],ym=(e,t)=>t===_e.MULTI&&!Array.isArray(e)?[e]:e,oR=(e,t)=>{let o=e.type||_e.SINGLE,r=e.component||"Selector",n=e.hideLabel||"false",a=e.resetSectionVars||"false",s=e.name||"Unlabeled Selector",i=tR(e.options||[]),c;if(e.defaultValue){let p=ym(e.defaultValue,o);Do(o,p,i)&&(c=p);}if(!c){let p=i&&i[0]&&i[0].id||i[0]||"";c=ym(p,o);}return {id:t,name:s,type:o,options:i,component:r,defaultValue:c,hideLabel:n,resetSectionVars:a}},Sm=oR;});var rR,yn,Tm=S(()=>{l();ye();bm();xm();rR={[b.SELECTOR]:Sm,[b.MULTIHIERARCHY_SELECTOR]:hm},yn=rR;});function _i({paragraph:e,tooltip:t,settings:o}){return jsx(se,{component:"p",html:e||`Lorem ipsum dolor sit amet,
15
+ color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,o?.key);}return (c=o?.onChange)==null||c.call(o,n),n}}function cs(e,t){if(e===void 0)throw new Error(`Unexpected undefined${""}`);return e}var Rd,Ed,kd=S(()=>{l();Rd=(e,t)=>Math.abs(e-t)<1,Ed=(e,t,o)=>{let r;return function(...n){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,n),o);}};});function ZT({measurements:e,outerSize:t,scrollOffset:o}){let r=e.length-1,a=Id(0,r,i=>e[i].start,o),s=a;for(;s<r&&e[s].end<o+t;)s++;return {startIndex:a,endIndex:s}}var YT,un,wd,Cd,XT,Ad,QT,Pd,ps,Id,gi=S(()=>{l();kd();YT=e=>e,un=e=>{let t=Math.max(e.startIndex-e.overscan,0),o=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let n=t;n<=o;n++)r.push(n);return r},wd=(e,t)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let n=s=>{let{width:i,height:c}=s;t({width:Math.round(i),height:Math.round(c)});};if(n(o.getBoundingClientRect()),!r.ResizeObserver)return ()=>{};let a=new r.ResizeObserver(s=>{let i=s[0];if(i?.borderBoxSize){let c=i.borderBoxSize[0];if(c){n({width:c.inlineSize,height:c.blockSize});return}}n(o.getBoundingClientRect());});return a.observe(o,{box:"border-box"}),()=>{a.unobserve(o);}},Cd={passive:true},XT=typeof window>"u"?true:"onscrollend"in window,Ad=(e,t)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let n=0,a=e.options.useScrollendEvent&&XT?()=>{}:Ed(r,()=>{t(n,false);},e.options.isScrollingResetDelay),s=p=>()=>{let{horizontal:d,isRtl:u}=e.options;n=d?o.scrollLeft*(u&&-1||1):o.scrollTop,a(),t(n,p);},i=s(true),c=s(false);return c(),o.addEventListener("scroll",i,Cd),o.addEventListener("scrollend",c,Cd),()=>{o.removeEventListener("scroll",i),o.removeEventListener("scrollend",c);}},QT=(e,t,o)=>{if(t?.borderBoxSize){let r=t.borderBoxSize[0];if(r)return Math.round(r[o.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[o.options.horizontal?"width":"height"])},Pd=(e,{adjustments:t=0,behavior:o},r)=>{var n,a;let s=e+t;(a=(n=r.scrollElement)==null?void 0:n.scrollTo)==null||a.call(n,{[r.options.horizontal?"left":"top"]:s,behavior:o});},ps=class{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=false,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let o=null,r=()=>o||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:o=new this.targetWindow.ResizeObserver(n=>{n.forEach(a=>{this._measureElement(a.target,a);});}));return {disconnect:()=>{var n;(n=r())==null||n.disconnect(),o=null;},observe:n=>{var a;return (a=r())==null?void 0:a.observe(n,{box:"border-box"})},unobserve:n=>{var a;return (a=r())==null?void 0:a.unobserve(n)}}})(),this.range=null,this.setOptions=o=>{Object.entries(o).forEach(([r,n])=>{typeof n>"u"&&delete o[r];}),this.options={debug:false,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:false,getItemKey:YT,rangeExtractor:un,onChange:()=>{},measureElement:QT,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:true,isRtl:false,useScrollendEvent:true,...o};},this.notify=o=>{var r,n;(n=(r=this.options).onChange)==null||n.call(r,this,o);},this.maybeNotify=rr(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),o=>{this.notify(o);},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(o=>o()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null;},this._didMount=()=>()=>{this.cleanup();},this._willUpdate=()=>{var o;let r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((o=this.scrollElement)==null?void 0:o.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n);}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify();})),this.unsubs.push(this.options.observeElementOffset(this,(n,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<n?"forward":"backward":null,this.scrollOffset=n,this.isScrolling=a,this.maybeNotify();}));}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(o,r)=>{let n=new Map,a=new Map;for(let s=r-1;s>=0;s--){let i=o[s];if(n.has(i.lane))continue;let c=a.get(i.lane);if(c==null||i.end>c.end?a.set(i.lane,i):i.end<c.end&&n.set(i.lane,true),n.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((s,i)=>s.end===i.end?s.index-i.index:s.end-i.end)[0]:void 0},this.getMeasurementOptions=rr(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(o,r,n,a,s)=>(this.pendingMeasuredCacheIndexes=[],{count:o,paddingStart:r,scrollMargin:n,getItemKey:a,enabled:s}),{key:false}),this.getMeasurements=rr(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:o,paddingStart:r,scrollMargin:n,getItemKey:a,enabled:s},i)=>{if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size);}));let c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];let p=this.measurementsCache.slice(0,c);for(let d=c;d<o;d++){let u=a(d),f=this.options.lanes===1?p[d-1]:this.getFurthestMeasurement(p,d),g=f?f.end+this.options.gap:r+n,m=i.get(u),y=typeof m=="number"?m:this.options.estimateSize(d),h=g+y,v=f?f.lane:d%this.options.lanes;p[d]={index:d,start:g,size:y,end:h,key:u,lane:v};}return this.measurementsCache=p,p},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=rr(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(o,r,n)=>this.range=o.length>0&&r>0?ZT({measurements:o,outerSize:r,scrollOffset:n}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getIndexes=rr(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(o,r,n,a)=>r===null?[]:o({startIndex:r.startIndex,endIndex:r.endIndex,overscan:n,count:a}),{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:()=>this.options.debug}),this.indexFromElement=o=>{let r=this.options.indexAttribute,n=o.getAttribute(r);return n?parseInt(n,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(o,r)=>{let n=this.indexFromElement(o),a=this.measurementsCache[n];if(!a)return;let s=a.key,i=this.elementsCache.get(s);i!==o&&(i&&this.observer.unobserve(i),this.observer.observe(o),this.elementsCache.set(s,o)),o.isConnected&&this.resizeItem(n,this.options.measureElement(o,r,this));},this.resizeItem=(o,r)=>{let n=this.measurementsCache[o];if(!n)return;let a=this.itemSizeCache.get(n.key)??n.size,s=r-a;s!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(n,s,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",s),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=s,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,r)),this.notify(false));},this.measureElement=o=>{if(!o){this.elementsCache.forEach((r,n)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(n));});return}this._measureElement(o,void 0);},this.getVirtualItems=rr(()=>[this.getIndexes(),this.getMeasurements()],(o,r)=>{let n=[];for(let a=0,s=o.length;a<s;a++){let i=o[a],c=r[i];n.push(c);}return n},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=o=>{let r=this.getMeasurements();if(r.length!==0)return cs(r[Id(0,r.length-1,n=>cs(r[n]).start,o)])},this.getOffsetForAlignment=(o,r)=>{let n=this.getSize(),a=this.getScrollOffset();r==="auto"&&o>=a+n&&(r="end"),r==="end"&&(o-=n);let s=this.options.horizontal?"scrollWidth":"scrollHeight",c=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[s]:this.scrollElement[s]:0)-n;return Math.max(Math.min(c,o),0)},this.getOffsetForIndex=(o,r="auto")=>{o=Math.max(0,Math.min(o,this.options.count-1));let n=this.measurementsCache[o];if(!n)return;let a=this.getSize(),s=this.getScrollOffset();if(r==="auto")if(n.end>=s+a-this.options.scrollPaddingEnd)r="end";else if(n.start<=s+this.options.scrollPaddingStart)r="start";else return [s,r];let i=n.start-this.options.scrollPaddingStart+(n.size-a)/2;switch(r){case "center":return [this.getOffsetForAlignment(i,r),r];case "end":return [this.getOffsetForAlignment(n.end+this.options.scrollPaddingEnd,r),r];default:return [this.getOffsetForAlignment(n.start-this.options.scrollPaddingStart,r),r]}},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null);},this.scrollToOffset=(o,{align:r="start",behavior:n}={})=>{this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(o,r),{adjustments:void 0,behavior:n});},this.scrollToIndex=(o,{align:r="auto",behavior:n}={})=>{o=Math.max(0,Math.min(o,this.options.count-1)),this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");let a=this.getOffsetForIndex(o,r);if(!a)return;let[s,i]=a;this._scrollToOffset(s,{adjustments:void 0,behavior:n}),n!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(o))){let[p]=cs(this.getOffsetForIndex(o,i));Rd(p,this.getScrollOffset())||this.scrollToIndex(o,{align:i,behavior:n});}else this.scrollToIndex(o,{align:i,behavior:n});}));},this.scrollBy=(o,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+o,{adjustments:void 0,behavior:r});},this.getTotalSize=()=>{var o;let r=this.getMeasurements(),n;return r.length===0?n=this.options.paddingStart:n=this.options.lanes===1?((o=r[r.length-1])==null?void 0:o.end)??0:Math.max(...r.slice(-this.options.lanes).map(a=>a.end)),Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(o,{adjustments:r,behavior:n})=>{this.options.scrollToFn(o,{behavior:n,adjustments:r},this);},this.measure=()=>{this.itemSizeCache=new Map,this.notify(false);},this.setOptions(t);}},Id=(e,t,o,r)=>{for(;e<=t;){let n=(e+t)/2|0,a=o(n);if(a<r)e=n+1;else if(a>r)t=n-1;else return n}return e>0?e-1:0};});function ev(e){let t=vo.useReducer(()=>({}),{})[1],o={...e,onChange:(n,a)=>{var s;a?flushSync(t):t(),(s=e.onChange)==null||s.call(e,n,a);}},[r]=vo.useState(()=>new ps(o));return r.setOptions(o),Ld(()=>r._didMount(),[]),Ld(()=>r._willUpdate()),r}function us(e){return ev({observeElementRect:wd,observeElementOffset:Ad,scrollToFn:Pd,...e})}var Ld,hi=S(()=>{l();gi();gi();Ld=typeof document<"u"?vo.useLayoutEffect:vo.useEffect;});function Si(e){let{allLabel:t,asComparison:o,colorKey:r,data:n,defaultValue:a,defaultValueType:s,hideLabel:i,resetSectionVars:c,iconKey:p,id:d,levels:u,limit:f,placeholder:g,searchIndexKey:m,searchIndexSeparator:y,section:h,settings:v}=e,{print:C}=Qe(),R=fv(d),L=ns(d,h,R,o,c==="true"),B=o?`${R}-valueCompare`:`${R}-value`,F=o?`${R}-typeCompare`:`${R}-type`,w=useMantineTheme(),{colorScheme:P}=useMantineColorScheme(),[k,A]=useState(false),[E,_]=useState(true),[W,V]=useState(""),[j,Z]=useState(false),[D,H]=useState([""].slice(1)),[O,Y]=useState([]),[ae,ce]=useState(""),G=v[jt.DISABLED]||false,re=useMemo(()=>C?Array.from(new Set(n.filter(oe=>O.includes(oe[`${ae} ID`])))).map(oe=>oe?.[ae]).join(", "):"",[C]),ne=i==="true"||!e.label?jsx(Fragment,{}):jsx(se,{component:"div",html:e.label,size:"sm",style:v}),Q=useRef(null),U=useRef(false),I=useRef(!!f&&f<O.length),N=D.length,M=u[N],K=D.filter(Boolean);D.length>0&&K.length===0&&K.push(`${t} ${M?.label}`),useEffect(()=>{if(!G){let z=new URLSearchParams(window.location.search),oe=z.get(B)||a,fe=z.get(F)||s;oe&&fe?(Y(gv(oe,a)),ce(fe)):(Y([]),ce(""));}},[window.location.search,a,s,G]),useEffect(()=>{let z=()=>{_(true);};return window.addEventListener("touchmove",z),()=>{window.removeEventListener("touchmove",z);}},[]);let J=useMemo(()=>uv(n,u,r,p,m,y),[r,n,p,u,m,y]),te=useMemo(()=>{let z=dv(W),oe=Array.from(mv(J,z)).reverse();return j?oe:D.reduce((fe,mt)=>fe.filter(Ge=>!mt||Ge.searchindex.indexOf(mt)>-1),oe.filter(fe=>fe.type===M?.value))},[M,J,W,j,D]),me=useRef(null),xe=us({count:k?te.length:0,estimateSize:()=>30,getScrollElement:useCallback(()=>me.current,[]),overscan:10,rangeExtractor:useCallback(z=>un(z),[])}),[nt,le]=useState(-1),Te=Math.min(nt,te.length-1),st=useCallback(z=>{let oe=D.concat(z);j&&Z(false),H(oe);},[j,D]),dt=useCallback(()=>{let z=D.slice(0,N-1);j&&Z(false),H(z);},[j,D,N]),It=useCallback(z=>{V(z.currentTarget.value),!I.current&&n.length>0&&A(true);},[n,V,I,A]),Fr=useCallback(()=>{V(""),L([],""),Q.current?.focus(),f&&(I.current=false);},[V,L,Q,f,I]),Po=useCallback(z=>{let oe=O.filter(fe=>fe!==z);oe.length>0?L(oe,ae):L([],""),f&&oe.length<f&&(I.current=false);},[O,ae,L,f,I]),Io=useCallback(z=>{ae!==z.type?L([z.value],z.type):O.includes(z.value)?Po(z.value):f?(O.length<f&&L([...O,z.value],ae),O.length===f&&L([...O.slice(1),z.value],ae)):L([...O,z.value],ae),V("");},[L,ae,O,Po,f]),Ds=useCallback(()=>{O.length>0&&W.length===0&&(L(O.slice(0,-1),ae),A(true),f&&(I.current=false)),W.length>0&&V(W.slice(0,-1));},[L,O,ae,W,V,A,f,I]),Fs=useCallback(()=>{_(z=>z&&(U.current=z,!z)),le(z=>z+1>=te.length?z:z+1);},[le,te]),Vs=useCallback(()=>{let z=te[Te];z&&Io(z);},[te,Te,Io]),zs=useCallback(()=>{A(false);},[A]),$s=useCallback(()=>{dt(),le(0);},[le,dt]),Us=useCallback(()=>{let z=te[Te];!j&&z&&z.type!==u[u.length-1]?.value&&(st(z.name),le(0));},[te,Te,j,u,le,st]),Gs=useCallback(()=>{_(z=>z&&(U.current=z,!z)),le(z=>z-1<0?0:z-1);},[le]),$=({label:z,onRemove:oe,...fe})=>jsxs("div",{className:"bespoke-MultiHierarchySelector-selectedItem",style:{alignItems:"center",backgroundColor:P==="dark"?"var(--mantine-color-dark-7)":"var(--mantine-color-gray-1)",borderRadius:w.radius.sm,cursor:"default",color:P==="dark"?"var(--mantine-color-dark-0)":"var(--mantine-color-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"},...fe,children:[jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:z}),jsx(CloseButton,{className:"bespoke-MultiHierarchySelector-itemCloseButton","aria-hidden":true,iconSize:"70%",onMouseDown:oe,radius:2,size:"sm",sx:{color:P==="dark"?"var(--mantine-color-dark-0)":"var(--mantine-color-gray-7)",marginLeft:`calc(${w.spacing.sm} / 6)`},tabIndex:-1})]}),ue=useMemo(()=>O.map(z=>J.find(oe=>oe.value===z)).filter(z=>!!z).map((z,oe)=>createElement($,{...z,index:oe,label:z.label,key:z.value,onRemove:fe=>{fe.preventDefault(),fe.stopPropagation(),Po(z.value);}})),[O]),Re=forwardRef(function({color:oe,icon:fe,label:mt,value:Ge,...Hs},kg){return jsx("div",{className:"bespoke-MultiHierarchySelector-item",ref:kg,style:{cursor:"pointer",width:"100%"},...Hs,children:jsxs(Group,{className:"bespoke-MultiHierarchySelector-itemWrapper",align:"center",wrap:"nowrap",gap:"xs",w:"100%",children:[fe&&jsx(Box,{className:"bespoke-MultiHierarchySelector-itemIcon",bg:oe??"transparent",component:"img",w:20,h:20,src:fe}),jsx(Text,{lineClamp:1,size:"sm",className:"bespoke-MultiHierarchySelector-itemLabel",children:mt||Ge})]})})});return jsxs(Fragment,{children:[jsx("div",{className:"bespoke-MultiHierarchySelector-root no-print",children:jsx(Input.Wrapper,{className:"bespoke-MultiHierarchySelector-inputWrapper",label:ne,children:jsxs(Popover,{closeOnClickOutside:true,disabled:G,keepMounted:true,opened:k,onChange:A,onClose:()=>{le(0),V("");},onOpen:()=>{te.length>0&&xe.scrollToIndex(0);},shadow:"sm",width:"target",withinPortal:true,children:[jsx(Popover.Target,{children:jsxs(Box,{className:"bespoke-MultiHierarchySelector-content","aria-haspopup":"listbox",component:"div",onMouseLeave:()=>le(0),sx:{position:"relative","& .defaultValue":{backgroundColor:P==="dark"?"var(--mantine-color-dark-5)":"var(--mantine-color-gray-3)",color:P==="dark"?"var(--mantine-color-dark-1)":"var(--mantine-color-gray-7)"}},tabIndex:-1,children:[jsx("input",{type:"hidden",value:O.join(",")}),jsx(Input,{className:"bespoke-MultiHierarchySelector-input",component:"div",disabled:G,multiline:true,onMouseDown:z=>{z.preventDefault(),!I.current&&n.length>0&&A(!k),Q.current?.focus();},rightSection:O.length>0?jsx(CloseButton,{className:"bespoke-MultiHierarchySelector-closeButton",disabled:G,onClick:Fr,onMouseDown:z=>z.preventDefault(),variant:"transparent"}):jsx(IconSelector,{className:"bespoke-MultiHierarchySelector-icon",color:w.colors.gray[6],size:18,stroke:1.5}),style:{overflow:"hidden"},w:"100%",children:jsxs(Box,{className:"bespoke-MultiHierarchySelector-selectedItems",component:"div","data-clearable":true,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:P==="dark"?"var(--mantine-color-dark-3)":"var(--mantine-color-gray-5)",opacity:1}},children:[ue,jsx("input",{className:"bespoke-MultiHierarchySelector-search",autoComplete:"off","data-mantine-stop-propagation":k,onChange:It,onKeyDown:getHotkeyHandler([["ArrowDown",Fs],["ArrowLeft",$s],["ArrowRight",Us],["ArrowUp",Gs],["Backspace",Ds],["Enter",Vs],["Escape",zs]]),placeholder:O.length===0&&g||"",ref:Q,readOnly:I.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:W})]})})]})}),jsx(Popover.Dropdown,{onMouseDown:z=>z.preventDefault(),p:0,children:jsx("div",{className:"bespoke-MultiHierarchySelector-dropdown",style:{display:"flex",maxHeight:rem(300)},children:jsx(Box,{className:"bespoke-MultiHierarchySelector-dropdownContent",component:"div","data-combobox-popover":true,onMouseDown:z=>z.preventDefault(),role:"listbox",sx:{width:"100%"},tabIndex:-1,children:jsxs(Stack,{h:"100%",py:"xs",gap:"xs",w:"100%",children:[u.length>1&&jsxs(Stack,{gap:"xs",children:[jsxs(Group,{onClick:z=>{z.stopPropagation();},px:"xs",justify:"center",gap:"xs",children:[jsx(Button,{onClick:()=>{le(0),Z(true),H([]),te.length>0&&xe.scrollToIndex(0);},size:"xs",variant:j?"filled":"outline",children:t}),u.map((z,oe)=>jsx(Button,{onClick:()=>{j&&Z(false);let fe=[""].slice(1),mt=oe;for(;mt--;)fe[mt]=D[mt]||"";le(0),H(fe),te.length>0&&xe.scrollToIndex(0);},size:"xs",variant:!j&&D.length===u.findIndex(fe=>fe.value===z?.value)?"filled":"outline",children:z?.label},z?.value))]}),jsx(Divider,{})]}),N>0&&jsxs(Group,{align:"center",wrap:"nowrap",px:"xs",children:[jsx(ActionIcon,{onClick:dt,size:"sm",children:jsx(IconChevronLeft,{})}),jsx("div",{children:K.map(z=>jsx(Text,{lineClamp:1,size:"xs",children:z},`${z}`))})]}),jsx(ScrollArea,{mah:250,onWheel:()=>_(true),px:"xs",style:{overflow:"auto",width:"100%"},viewportRef:me,viewportProps:{tabIndex:-1},w:"100%",children:jsx("div",{style:{height:`${xe.getTotalSize()}px`,position:"relative",width:"100%"},children:xe.getVirtualItems().map(z=>{let oe=te[z.index],fe=Te===z.index,mt=O.includes(oe.value);return te.length>0&&fe&&!E&&xe.scrollToIndex(Te),jsxs(Group,{"aria-selected":fe,align:"center","data-hovered":fe||void 0,"data-index":z.index,"data-selected":mt,id:oe.vale,wrap:"nowrap",onMouseEnter:Ge=>{Ge.preventDefault(),Ge.stopPropagation(),E&&(le(z.index),_(false));},onMouseMove:Ge=>{Ge.preventDefault(),Ge.stopPropagation(),_(true);},onMouseDown:Ge=>{Ge.preventDefault(),Io(oe);},justify:"space-between",ref:xe.measureElement,role:"option",gap:"xs",sx:Ge=>({borderRadius:Ge.radius.xs,padding:"15px 5px 15px",paddingLeft:j&&10*u.findIndex(Hs=>Hs?.value===oe.type)||5,position:"absolute",top:0,left:0,height:`${z.size}px`,transform:`translateY(${z.start}px)`,width:"100%","&[data-hovered]":{backgroundColor:P==="dark"?"var(--mantine-color-dark-4)":"var(--mantine-color-gray-1)"},"&:hover":{backgroundColor:P==="dark"?"var(--mantine-color-dark-4)":"var(--mantine-color-gray-1)"}}),tabIndex:-1,children:[jsx(Re,{index:z.index,...oe}),!j&&oe.type!==u[u.length-1]?.value&&jsx(ActionIcon,{onMouseDown:Ge=>{Ge.preventDefault(),Ge.stopPropagation(),st(oe.name);},size:"sm",tabIndex:-1,children:jsx(IconChevronRight,{})})]},oe.value)})})})]})})})})]})})}),C&&jsxs(Text,{children:[ne,": ",re]})]})}var uv,dv,mv,fv,gv,Vd=S(()=>{l();hi();Pe();zt();ze();ye();uv=(e=[],t=[],o="",r="",n="",a="|")=>{let s=t.map(y=>y.value).slice(),i=`${s.pop()}`,c=y=>y[o],p=y=>y[r],d=y=>{if(y[n])return typeof y[n]=="string"?y[n].split(a):y[n]},u=new Set,f=[],g=[],m=nest().rollup(y=>{let h=y[0],v=k=>k&&k.value&&!u.has(k.value),C=s.map(k=>h[`${k} ID`]),R=s.map(k=>h[k]),L=s.map((k,A)=>{if(g[A]!==R[A]){g[A]=R[A];let E=c[A]||c[c.length-1]||c,_=p[A]||p[p.length-1]||p,W=d[A]||d[d.length-1]||d;return {color:E(h,k)||void 0,icon:_(h,k)||void 0,value:`${C[A]}`,label:R[A],name:R[A],type:k,searchindex:R.slice(0,A+1).concat(W(h,k)).join("|")}}return {}}).filter(v);L.forEach(k=>u.add(k.value));let B=c[c.length-1]||c,F=p[p.length-1]||p,w=d[d.length-1]||d,P=y.map(k=>({color:B(k,i)||void 0,icon:F(k,i)||void 0,value:`${k[`${i} ID`]}`,label:k[i],name:k[i],type:i,searchindex:R.concat(k[i]).concat(w(k,i)).join("|")}));f.push(...L.concat(P));});return s.forEach(y=>{m.key(h=>`${h[`${y} ID`]}|${h[y]}`);}),m.entries(e),f},dv=e=>{if(!e)return /./i;let t=e.normalize("NFD").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"[^|]+");return RegExp(t,"i")},mv=(e,t)=>{let o=e.length,r,n=i=>r&&r.searchindex.includes(i.searchindex),s={next:()=>{for(let i=o-1;i>-1;i--){let c=e[i];if(t.test(`${c.value} ${c.label} ${c.searchindex}`)||n(c))return r=c,o=i,{done:false,value:c}}return {done:true,value:void 0}},[Symbol.iterator]:()=>s};return s},fv=e=>`multihierarchySelector${e}`,gv=(e,t)=>e&&typeof e=="string"?e.split(","):t;});function xi({headings:e,settings:t,type:o,title:r,shortTitle:n,_iconType:a,_iconVariant:s,_icon:i,_iconRadius:c,_iconSize:p,_iconPadding:d}){let{min:u="1",max:f="6",icons:g="yes"}=t||{},m=bo(parseInt(u,10),parseInt(f,10),e),y=g==="yes",h=we(r)||"",v=we(n||r)||"",C=h&&h.length>0,R=a&&a!=="none",B=`(max-width: ${useMantineTheme().breakpoints.md})`,F=useMediaQuery(B),w=F?v:h,P=t&&t.align?String(t.align):"left",k=vr(P),A=qe(P),E=et(P),_=t&&t.titlePosition?String(t.titlePosition):"left",W=useMemo(()=>{let D={right:"left",left:"right"},H=C&&["left","right"].includes(_),O={};if(H){let Y=_==="right";O={gap:"xs",justify:Y&&D[A]?D[A]:A,style:{flexDirection:Y?"row-reverse":"row"},wrap:"nowrap"};}else O={gap:"xs",align:E,justify:"center",style:{flexDirection:_==="bottom"?"column-reverse":"column"}};return {element:H?Group:Stack,props:O}},[C,A,E,_]),V=useMemo(()=>C?jsxs(Group,{className:"bespoke-Nav-title",gap:"xs",justify:A,wrap:"nowrap",children:[R&&jsx(Ee,{blockType:"title",iconType:a,iconVariant:s,iconRadius:c,iconSize:p,icon:i,iconPadding:d}),jsx(se,{className:"bespoke-Nav-titleText",style:{...t},html:w,lineClamp:1})]}):null,[C,R,A,w]),j=useMemo(()=>F?jsx(vv,{contentOutline:m,showIcons:y,titleElement:V,wrapper:W}):null,[F,V,W]),Z=useMemo(()=>F?null:o==="multilevel"?jsx(Rv,{contentOutline:m,showIcons:y,align:k}):jsx(Tv,{contentOutline:m,showIcons:y,align:k}),[m,y,k,F]);return jsxs(Fragment,{children:[F&&j,!F&&jsxs(W.element,{className:"bespoke-Nav-root",pos:"relative",...W.props,children:[C&&V,Z]})]})}var $d,Tv,Kd,vv,Rv,Yd=S(()=>{l();ze();Jt();We();Xt();Jt();Pe();$d=e=>t=>({display:"flex",gap:t.spacing.md,justifyContent:e,listStyleType:"none"}),Tv=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null);useEffect(()=>{let s=()=>{let i=document.querySelector(".bespoke-Nav-root");if(!i)return;let c=i.getBoundingClientRect(),p=false;e.forEach(d=>{let u=document.getElementById(`bespoke-title-${d.id}`);u&&u.getBoundingClientRect().top<=c.bottom&&(n(d.id),p=true);}),p||n(null);};return window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s);}},[e]);let a=s=>!s||!s?.length?null:jsx(Fragment,{children:s.map(i=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${i.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(Ee,{...i.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:i.label}})]})})}),jsx(Box,{pl:"xs",children:a(i.children)})]},i.id))});return jsx(Fragment,{children:jsx(Box,{component:"nav",className:"bespoke-nav",children:jsx(List,{sx:s=>({display:"flex",gap:s.spacing.md,justifyContent:o,listStyleType:"none"}),children:e?.map(s=>jsx(List.Item,{children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{href:`#bespoke-title-${s.id}`,"data-active":s.id===r,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(Ee,{...s.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:s.label}})]})})}),s?.children?.length?jsx(Menu.Dropdown,{children:a(s.children)}):null]})},s.id))})})})},Kd=({contentOutline:e,closeNav:t,showIcons:o})=>{let[r,n]=useState(null);return jsx(Stack,{className:"bespoke-MobileNav-accordion",children:e.map(a=>a.children.length?jsxs(Fragment,{children:[jsxs(Group,{className:"bespoke-MobileNav-group",gap:0,wrap:"nowrap",children:[jsx(UnstyledButton,{className:"bespoke-MobileNav-button",w:"100%",component:"a",onClick:t,href:`#bespoke-title-${a.id}`,children:jsxs(Group,{className:"bespoke-MobileNav-buttonContent",gap:"sm",wrap:"nowrap",children:[o&&jsx(Ee,{...a.iconProps,iconSize:"sm",iconPadding:"2"}),jsx(Text,{className:"bespoke-MobileNav-buttonText",dangerouslySetInnerHTML:{__html:a.label}})]})},a.id),jsx(ActionIcon,{className:"bespoke-MobileNav-chevron",component:"a",size:"lg",onClick:()=>n(s=>s===a.id?null:a.id),children:jsx(IconChevronDown,{style:{transition:"transform 0.2s",transform:r===a.id?"rotate(-180deg)":"none"},stroke:1})})]},a.id),jsx(Collapse,{className:"bespoke-MobileNav-collapse",in:r===a.id,pl:"sm",transitionTimingFunction:"linear",transitionDuration:200,children:jsx(Kd,{contentOutline:a.children,closeNav:t,showIcons:o})})]}):jsx(Group,{className:"bespoke-MobileNav-group",wrap:"nowrap",children:jsx(UnstyledButton,{className:"bespoke-MobileNav-button",display:"flex",w:"100%",component:"a",href:`#bespoke-title-${a.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[o&&jsx(Ee,{...a.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:a.label}})]})},a.id)},a.id))})},vv=({contentOutline:e,showIcons:t,titleElement:o,wrapper:r})=>{let[n,{toggle:a}]=useDisclosure(false),s=n?"Close content outline":"Open content outline";return jsxs(Box,{className:"bespoke-MobileNav-root",component:"nav",children:[jsxs(r.element,{className:"bespoke-MobileNav-header",...r.props,onClick:a,children:[o&&o,jsx(ActionIcon,{className:"bespoke-MobileNav-toggle","aria-label":s,size:"lg",variant:"subtle",children:n?jsx(IconChevronUp,{size:"xl",stroke:1.5}):jsx(IconChevronDown,{size:"xl",stroke:1.5})})]}),jsx(Collapse,{in:n,mt:"md",className:"bespoke-MobileNav-body",children:jsx(Kd,{contentOutline:e,closeNav:a,showIcons:t})})]})},Rv=({contentOutline:e,showIcons:t,align:o})=>{let[r,n]=useState(null),[a,s]=useState(null);useEffect(()=>{let c=()=>{let p=document.querySelector(".bespoke-nav");if(!p)return;let d=p.getBoundingClientRect(),u=false;e.forEach(f=>{let g=document.getElementById(`bespoke-title-${f.id}`);g&&(g.getBoundingClientRect().top<=d.bottom&&(n(f.id),s(null),u=true),f.children.forEach(y=>{let h=document.getElementById(`bespoke-title-${y.id}`);h&&h.getBoundingClientRect().top<=d.bottom&&(s(y.id),n(f.id),u=true);}));}),u||(n(null),s(null));};return window.addEventListener("scroll",c),()=>{window.removeEventListener("scroll",c);}},[e]);let i=c=>!c||!c?.length?null:jsx(Fragment,{children:c.map(p=>jsxs(Fragment$1,{children:[jsx(Menu.Item,{children:jsx(Anchor,{href:`#bespoke-title-${p.id}`,children:jsxs(Group,{gap:"sm",wrap:"nowrap",children:[t&&jsx(Ee,{...p.iconProps,iconSize:"sm"}),jsx(Text,{dangerouslySetInnerHTML:{__html:p.label}})]})})}),jsx(Box,{pl:"xs",children:i(p.children)})]},p.id))});return jsxs(Box,{component:"nav",className:"bespoke-Nav-root",children:[jsx(List,{className:"bespoke-Nav-level","data-level":"1",sx:$d(o),children:e?.map(c=>jsx(List.Item,{className:"bespoke-Nav-levelItem",children:jsx(Anchor,{className:"bespoke-Nav-itemAnchor",href:`#bespoke-title-${c.id}`,"data-active":r===c.id,onClick:()=>n(c.id),children:jsxs(Group,{className:"bespoke-Nav-itemGroup",gap:"sm",wrap:"nowrap",children:[t&&jsx(Ee,{...c.iconProps,iconSize:"sm"}),jsx(Text,{className:"bespoke-Nav-itemLabel",dangerouslySetInnerHTML:{__html:c.label}})]})})},c.id))}),r&&e.find(c=>c.id===r)?.children.length>0&&jsx(List,{className:"bespoke-Nav-level","data-level":"2",sx:$d(o),children:e.find(c=>c.id===r)?.children.map(c=>jsx(List.Item,{className:"bespoke-Nav-levelItem",children:jsxs(Menu,{trigger:"hover",openDelay:100,closeDelay:200,children:[jsx(Menu.Target,{children:jsx(Anchor,{className:"bespoke-Nav-itemAnchor",href:`#bespoke-title-${c.id}`,"data-active":c.id===a,children:jsxs(Group,{className:"bespoke-Nav-itemGroup",gap:"sm",wrap:"nowrap",children:[t&&jsx(Ee,{...c.iconProps,iconSize:"sm"}),jsx(Text,{className:"bespoke-Nav-itemLabel",dangerouslySetInnerHTML:{__html:c.label}})]})})}),c?.children?.length?jsx(Menu.Dropdown,{className:"bespoke-Nav-levelMenuDropdown",children:i(c.children)}):null]})},c.id))})]})};});function vi(e){let{related_reports:t,settings:o}=e,r=q(f=>f.status.currentLocale),n=q(f=>f.status.localeDefault),a=Wn(),s=useRouter(),i=pt("components");if(!t?.length)return;let c=r===n?"":`/${r}`,p=f=>{s.push(`${f}`);},d=i?.ReportTile?i.ReportTile:oi,u=et(o&&o.align?String(o.align):"center");return jsx(Grid,{className:"bespoke-Related-root",justify:u,children:t.map(f=>{let g=`${c}${a}${f.link}`,m=f.entities.map(R=>({original_id:R.id,name:R.name,id:R.content_id,variant:R.variant_name,variant_id:R.variant_id,dimension:R.dimension_name,dimension_id:R.dimension_id,image:{src:`/api/cms/member/image?member=${R.content_id}&size=thumb`,alt:R.name}})),y=f.entities.map(R=>R.id).join("-"),h=f.entities.map(R=>R.name).join(" & "),v=f.entities[0]?f.entities[0].report_id:null,C=R=>{R.preventDefault(),p(g);};return jsx(Grid.Col,{className:"bespoke-Related-col",xs:12,sm:6,md:4,lg:4,xl:3,children:jsx(d,{reportId:v,reportName:h,members:m,href:g,onClick:C})},y)})})}var Qd=S(()=>{l();pe();De();ri();ze();We();});function Ri({id:e,label:t,settings:o,showIcon:r,fullWidth:n,showWhenDisabled:a}){let s=Rt(e).data,{sectionVariables:i,resetSectionVariables:c}=Me(s?.section_id),p=!!Object.keys(i).length,d=et(o&&o.align?o.align:"left");return !p&&!a?null:jsx(Button,{className:"bespoke-ResetButton-root",onClick:()=>c(),disabled:!p,fullWidth:n,sx:{justifySelf:d},children:jsxs(Group,{className:"bespoke-ResetButton-content",align:"center",children:[t,r&&jsx(IconRefresh,{className:"bespoke-ResetButton-icon"})]})})}var Jd=S(()=>{l();De();We();});function Ei({settings:e,label:t,removeLabel:o,showIcon:r,position:n="center",asComparison:a=false}){let s=q(R=>R.records.entities.report),i=q(R=>R.variables.attributes),c=e&&e.search?e.search:"inline",p=Object.values(s)[0].settings,d=useRouter(),{comparisonLoaded:u,loading:f}=tt(),g=Object.keys(d.query).includes("compare"),y=u&&g?jsx(Button,{onClick:()=>{let R={...d.query};delete R.compare,d.push({pathname:d.pathname,query:R},void 0,{shallow:true});},rightIcon:jsx(IconX,{}),children:o||"Remove Comparison"}):jsx(Button,{loading:f,children:jsxs(Group,{align:"center",children:[t||"Add Comparison",r&&jsx(IconPlus,{})]})}),h={searchReportParams:{report:[Number(Object.keys(s)[0])],variant:p.compareLevels?[]:[i.variant_id1]}},C=wr(y,c,R=>{d.push({pathname:d.pathname,query:{...d.query,compare:R.reportPath}});},h);return a?null:jsx(Group,{className:"bespoke-ComparisonButton-root",align:n,children:g?y:C})}var om=S(()=>{l();ze();pe();eo();});function Ci({columns:e=[],data:t=[],tableProps:o={},sectionId:r=null}){let[n,a]=useState(false),s=useMemo(()=>e.map(u=>u.accessorKey),[e]),i=useMemo(()=>t.filter(u=>typeof u=="object"&&u!==null&&!Array.isArray(u)&&Object.keys(u).some(f=>s.includes(f))),[s,t]),c=useMemo(()=>e.map(u=>({...u,Cell:({renderedCellValue:f})=>jsx(se,{html:`${f}`}),filterFn:"contains"})),[e]),p=Ie("table"),d={...MRT_Localization_EN,...p};return jsx(MantineReactTable,{className:"bespoke-Table-root",...o,autoResetPageIndex:false,columns:c,data:i,enableColumnFilterModes:true,enableFilterMatchHighlighting:false,globalFilterFn:"contains",layoutMode:"grid",localization:d,onIsFullScreenChange:u=>{let f=document.getElementById(`section-${r}`);f&&(u?f.style.zIndex="10":f.style.zIndex="1"),a(u);},state:{...o.state,isFullScreen:n}})}var nm=S(()=>{l();Pe();ht();});function wi({label:e,url:t,settings:o}){let{align:r}=o;return e?jsx(Group,{className:"bespoke-Button-root",align:r,grow:r==="justify",children:jsx(Button,{className:"bespoke-Button-button",component:"a",target:"_blank",href:t||"",children:e||"Button"})}):null}var am=S(()=>{l();});function Uv({block:e}){let{id:t}=e;return jsxs(Stack,{className:"bespoke-Fallback-root",align:"center",gap:"sm",children:[jsx(ThemeIcon,{className:"bespoke-Fallback-themeIcon",radius:"md",size:100,children:jsx(IconCircleKey,{size:100})}),jsxs(Title,{className:"bespoke-Fallback-title",order:5,children:["Private content (Block ",t,")"]}),jsx(Text,{className:"bespoke-Fallback-text",children:"Sorry, you do not have sufficient permissions to view this block."}),jsx(Text,{className:"bespoke-Fallback-text",children:"Contact your account manager to check your access role."})]})}function Ai(e){let t=Gv();return jsx(t,{block:e})}var Gv,cm=S(()=>{l();ze();Gv=()=>{let e=pt("components"),t=Uv;return e?.CustomFallback&&(t=e.CustomFallback),t};});var sr,Pi=S(()=>{l();sr=class extends Component{constructor(t){super(t),this.state={hasError:false};}static getDerivedStateFromError(t){return console.info("getDerivedStateFromError",t),{hasError:true}}componentDidCatch(t,o){console.error("Error information:",o.componentStack),notifications.show({autoClose:false,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 bn({config:e}){return !e||!e.html?null:jsx("div",{className:"bespoke-html",dangerouslySetInnerHTML:{__html:e.html}})}var Ii=S(()=>{l();});var dm={};qs(dm,{default:()=>um});function um(e){let{print:t}=Qe(),{block:o,active:r,locale:n,variables:a,configOverride:s={}}=e,i=He(o),c=Nt(n),p={variables:a},d=useRouter(),{sectionVariables:u,setSectionVariables:f,resetSectionVariables:g}=Me(o.section_id),m=mo(),y=JSON.stringify(u),h=useMemo(()=>{if(!i?.logic)return {error:"Add a Configuration"};let w=gt({logic:i.logic},c,p).logic,P={router:d,section:{variables:u,setVariables:f,resetVariables:g}};return yo(w,c,a,n,o.id,{},P,m)},[o,r,a,y]),{type:v}=h.config||{},C=v&&Li[v]?v:"Treemap";Li[v]||(h.config={error:`"${v}" is not a valid Visualization Type`});let R=Li[C],L=useMemo(()=>{let{_data:w,...P}=h.config;return Xv(P,t)},[h,t]),B={locale:n,variables:a,...L,...s},F=w=>{let P;try{P=h.dataFormat(w);}catch(k){console.error("Error in dataFormat: ",k),P=[];}return P};return jsx(Box,{className:"bespoke-Viz-root","data-ignore-print":B._printIgnore?"true":void 0,sx:{display:"flex",minHeight:v==="HTML"?void 0:400,"& .chart":{flex:"1 1 100%"}},children:jsx(sr,{fallback:jsx("p",{children:"Error in d3plus viz config."}),children:jsx(R,{style:{flex:1},dataFormat:w=>{let P;try{P=h.dataFormat(w);}catch(k){console.error("Error in dataFormat: ",k),P=[];}return P},config:{...B,dataFormat:F,sectionVariables:y}},"viz-key")})})}var Li,Xv,mm=S(()=>{l();Fo();on();Mo();De();Pi();zt();Ii();Li={...jv,HTML:bn},Xv=(e,t)=>{let o={...e};return t&&(o.detectResize=false,o.detectResizeDelay=0,o.detectVisible=false,o.detectVisibleInterval=0,o.duration=0,o.shapeConfig={...o.shapeConfig,duration:0}),o};});var Zv,Jv,fm,gm=S(()=>{l();ye();Zc();np();ap();hd();xd();Td();vd();Vd();Yd();Qd();Jd();om();nm();am();cm();Zv=Qv(()=>Promise.resolve().then(()=>(mm(),dm)),{ssr:false}),Jv={[b.PARAGRAPH]:ka,[b.STAT]:wa,[b.SUBTITLE]:Aa,[b.TITLE]:ci,[b.SELECTOR]:mi,[b.VIZ]:Zv,[b.GENERATOR]:ls,[b.SECTION_FLAG]:ls,[b.IMAGE]:fi,[b.NAV]:xi,[b.RELATED]:vi,[b.RESET_BUTTON]:Ri,[b.COMPARISON_BUTTON]:Ei,[b.TABLE]:Ci,[b.BUTTON]:wi,[b.MULTIHIERARCHY_SELECTOR]:Si,[b.FALLBACK]:Ai},fm=Jv;});var eR,hm,bm=S(()=>{l();eR=(e,t)=>{let o=e.allLabel||"All",r=e.colorKey||"",n=e.data||[],a=e.hideLabel||"false",s=e.resetSectionVars||"false",i=e.iconKey||"",c=e.label||"Unlabeled Multihierarchy Selector",p=e.levels||[],d=e.limit||void 0,u=e.placeholder||"",f=e.searchIndexKey||"",g=e.searchIndexSeparator||"",m,y;return e.defaultValue&&e.defaultValueType&&(m=e.defaultValue,y=e.defaultValueType),(!m||!y)&&(m=[],y=""),{allLabel:o,colorKey:r,data:n,defaultValue:m,defaultValueType:y,hideLabel:a,resetSectionVars:s,iconKey:i,id:t,label:c,levels:p,limit:d,placeholder:u,searchIndexKey:f,searchIndexSeparator:g}},hm=eR;});var tR,ym,oR,Sm,xm=S(()=>{l();ye();Nn();tR=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?{id:t,label:t}:t):[],ym=(e,t)=>t===_e.MULTI&&!Array.isArray(e)?[e]:e,oR=(e,t)=>{let o=e.type||_e.SINGLE,r=e.component||"Selector",n=e.hideLabel||"false",a=e.resetSectionVars||"false",s=e.name||"Unlabeled Selector",i=tR(e.options||[]),c;if(e.defaultValue){let p=ym(e.defaultValue,o);Do(o,p,i)&&(c=p);}if(!c){let p=i&&i[0]&&i[0].id||i[0]||"";c=ym(p,o);}return {id:t,name:s,type:o,options:i,component:r,defaultValue:c,hideLabel:n,resetSectionVars:a}},Sm=oR;});var rR,yn,Tm=S(()=>{l();ye();bm();xm();rR={[b.SELECTOR]:Sm,[b.MULTIHIERARCHY_SELECTOR]:hm},yn=rR;});function _i({paragraph:e,tooltip:t,settings:o}){return jsx(se,{component:"p",html:e||`Lorem ipsum dolor sit amet,
16
16
  consectetur adipiscing elit. Etiam justo purus, placerat ac turpis at,
17
17
  dignissim interdum eros. Curabitur non tincidunt libero.
18
18
  Suspendisse quis nibh in massa tincidunt feugiat sit amet vitae nisl.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datawheel/bespoke",
3
- "version": "1.0.0-rc.8",
3
+ "version": "1.0.0-rc.9",
4
4
  "description": "Content management system for creating automated data reports",
5
5
  "exports": {
6
6
  ".": {