@bino-bi/bn-template-engine 1.0.0-next.41 → 1.0.0-next.43

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.
Files changed (33) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-2dd69cb9.entry.js → p-ddf6cd92.entry.js} +1 -1
  3. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +118 -25
  4. package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.css +65 -2
  5. package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +50 -3
  6. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +55 -17
  7. package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +2 -4
  8. package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +8 -1
  9. package/dist/collection/utils/layoutState/baseline.js +5 -1
  10. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  11. package/dist/components/bn-chart-bubble.js +1 -1
  12. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  13. package/dist/components/bn-chart-bullet.js +1 -1
  14. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  15. package/dist/components/bn-chart-scatter.js +1 -1
  16. package/dist/components/bn-chart-structure.js +1 -1
  17. package/dist/components/bn-chart-time.js +1 -1
  18. package/dist/components/bn-table-renderer.js +1 -1
  19. package/dist/components/bn-table.js +1 -1
  20. package/dist/components/p-AwH1w8Mu.js +1 -0
  21. package/dist/components/{p-CUSAlS2o.js → p-BfUdaxZ9.js} +1 -1
  22. package/dist/components/{p-ChaSU4fh.js → p-C2ycO60j.js} +1 -1
  23. package/dist/components/{p-chnyMHJT.js → p-CyfGkLMh.js} +1 -1
  24. package/dist/components/p-DX9_keF-.js +1 -0
  25. package/dist/components/{p-DM4Up10X.js → p-DnDL1pPc.js} +1 -1
  26. package/dist/components/p-JofGXz75.js +1 -0
  27. package/dist/esm/bn-annotation-layer_30.entry.js +118 -25
  28. package/dist/types/components/bn-table/bn-table-renderer/bn-table-renderer.d.ts +11 -0
  29. package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +6 -1
  30. package/package.json +1 -1
  31. package/dist/components/p-Bn7J1pgl.js +0 -1
  32. package/dist/components/p-CGySoYRH.js +0 -1
  33. package/dist/components/p-XFZYX7DZ.js +0 -1
@@ -1 +1 @@
1
- import{p as t,H as e,w as i,f as s,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as l,a as o}from"./p-DDvWTgk1.js";import{o as h}from"./p-DaOm9YwQ.js";import{c}from"./p-ChaSU4fh.js";import{a as d}from"./p-XFZYX7DZ.js";import{g as u}from"./p-DD1zlev_.js";import{c as p}from"./p-D2Epww9R.js";import{o as v}from"./p-B6kka9sT.js";import{p as m}from"./p-Xb6Ilq8u.js";import{i as f,h as b,j as y}from"./p-BiSytXUy.js";import{w as g}from"./p-Dq9dG0Kr.js";import{w as x}from"./p-DjPWZfry.js";import{w}from"./p-DJUffGeB.js";import{w as _}from"./p-4vVbchX2.js";import{w as S}from"./p-D40Am1Ap.js";import{w as j}from"./p-DQl2K2Xl.js";import{w as L}from"./p-xIWChKGS.js";import{w as R}from"./p-DwuXVo2h.js";import{r as $,s as z}from"./p-BXXjh6We.js";import{t as A,a as E,b as W,c as D,d as N,e as k,p as F}from"./p-9mUU4itF.js";import{s as O}from"./p-DakXa7Dp.js";import{d as C}from"./p-DM4Up10X.js";const X={rowGroup:0,category:1,subCategory:2},G=["ac","pp","fc","pl"],M=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateMeasureSpec("x",t,!0,(t=>A(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>A(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>E(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>W(t)))}validateCompareWith(t){const e="WARN_compareWith";f(t)||G.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`compare-with: invalid value '${t}' - expected ${G.join("/")}; ignored.`})}validateLevel(t){const e="WARN_level",i=["auto","category","subcategory"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",i=["auto","rowgroup","category","none"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>D(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>N(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>k(t)))}validateAspect(t){const e="WARN_aspect";f(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";b(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(f(t))return void this.errors.remove(e);const{mode:i,factor:s}=m(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),R(this),g(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=_(this),j(this),this.componentStyle=x(this),this.ruleSetConfig=S(this),this.t=L(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){O(this.element,"bn-chart-bubble-renderer");const{mode:t}=m(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:s}=u(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l}))),this.checkOverflow()}checkOverflow(){p(this.element,"bn-chart-bubble-renderer",this.errors)}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===e||this.pixelPerUnitGroupMap.has(e)?null:this.t(".bubble-scale-group-unknown",{group:e}))}validateMeasureSpec(t,e,i,s){var a;const r="ERR_xy_json_"+t,n="ERR_xy_measure_"+t,l="WARN_xy_fields_"+t,{data:o,parseError:h}=F(e,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(l);if(this.setBlockingError(r,null),null===o)return this.setBlockingError(n,i?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const c=null!==(a=o.measure)&&void 0!==a?a:"";y(c)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,e,i){const s="ERR_xy_json_"+t,a="WARN_xy_fields_"+t,{data:r,parseError:n}=F(e,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,i(r)):this.errors.remove(a)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=F(e,"measure");if(s||null===i)return null;const{config:a}=A(i);return null!==a&&y(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareSize(){const{data:t,parseError:e}=F(this.size,"measure");if(e||null===t)return null;const{config:i}=E(t);return null!==i&&y(i.measure)?i:null}prepareShare(){const{data:t,parseError:e}=F(this.share,"measure");if(e||null===t)return null;const{config:i}=W(t);return null!==i&&y(i.measure)?i:null}prepareCompareFamily(){var t;const e=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return G.includes(e)?e:null}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=F(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:N(e,t).config}prepareLegend(){const{data:t,parseError:e}=F(this.legend,null);return e||null===t?{show:!0,position:"right"}:k(t).config}prepareFacet(){const{data:t,parseError:e}=F(this.facet,null);return e||null===t?null:D(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;let s=!1;for(const e of t){if(void 0===e)continue;const t=$(e);null!==t&&("scenario"===t.kind?i.add(z(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===i.size&&i.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let o=null;if(null!==n&&X[n]>=X[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;X[l]>=X[t]&&(o=`facet '${l}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===e||!this.pixelPerUnitGroupMap.has(e))return 0;const i=this.pixelPerUnitGroupMap.get(e);if(!(i>0))return 0;const s=this.getEffectiveFontPx();return s*s/i}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bubble"].axisStyles,seriesColors:e["bn-chart-bubble"].seriesColors,padding:e["bn-chart-bubble"].padding}}))}async getBaseline(){return d(this.element,"bn-chart-bubble-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return c(this.element,"bn-chart-bubble-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=m(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[i,s]of Object.entries(e)){if(null===s)continue;const e=$(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${void 0!==s.label?s.label:s.measure}`:(t[e.measure.base].description=`${i}: ${s.measure} (base)`,t[e.measure.delta].description=`${i}: ${s.measure} (delta)`))}const i=this.prepareCompareFamily();if(null!==i)for(const[s,a]of Object.entries(e)){if(null===a||"share"===s)continue;const e=$(a.measure);if(null!==e&&"scenario"===e.kind){const a=i+e.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=s+": compareWith")}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareSize(),s=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure,null==i?void 0:i.measure,null==s?void 0:s.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===e||null===i)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),h=u(this.element).width;return a("bn-chart-bubble-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,size:i,share:s,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:o,i18n:l,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"2b15b5b4fc32db48b951e82ecc87f25b0afcc9f8",style:this.getFontStyles()},a("div",{key:"210d8622e1785b8c882f9c9a2fa2072af0e857b6",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bubble",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],size:[1],share:[1],compareWith:[1,"compare-with"],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),U=M,B=function(){"undefined"!=typeof customElements&&["bn-chart-bubble","bn-chart-bubble-renderer"].forEach((t=>{switch(t){case"bn-chart-bubble":customElements.get(n(t))||customElements.define(n(t),M);break;case"bn-chart-bubble-renderer":customElements.get(n(t))||C()}}))};export{U as BnChartBubble,B as defineCustomElement}
1
+ import{p as t,H as e,w as i,f as s,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as l,a as o}from"./p-DDvWTgk1.js";import{o as h}from"./p-DaOm9YwQ.js";import{c}from"./p-C2ycO60j.js";import{a as d}from"./p-JofGXz75.js";import{g as u}from"./p-DD1zlev_.js";import{c as p}from"./p-D2Epww9R.js";import{o as v}from"./p-B6kka9sT.js";import{p as m}from"./p-Xb6Ilq8u.js";import{i as f,h as b,j as y}from"./p-BiSytXUy.js";import{w as g}from"./p-Dq9dG0Kr.js";import{w as x}from"./p-DjPWZfry.js";import{w}from"./p-DJUffGeB.js";import{w as _}from"./p-4vVbchX2.js";import{w as S}from"./p-D40Am1Ap.js";import{w as j}from"./p-DQl2K2Xl.js";import{w as L}from"./p-xIWChKGS.js";import{w as R}from"./p-DwuXVo2h.js";import{r as $,s as z}from"./p-BXXjh6We.js";import{t as A,a as E,b as W,c as D,d as N,e as k,p as O}from"./p-9mUU4itF.js";import{s as F}from"./p-DakXa7Dp.js";import{d as C}from"./p-DnDL1pPc.js";const G={rowGroup:0,category:1,subCategory:2},X=["ac","pp","fc","pl"],M=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateMeasureSpec("x",t,!0,(t=>A(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>A(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>E(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>W(t)))}validateCompareWith(t){const e="WARN_compareWith";f(t)||X.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`compare-with: invalid value '${t}' - expected ${X.join("/")}; ignored.`})}validateLevel(t){const e="WARN_level",i=["auto","category","subcategory"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",i=["auto","rowgroup","category","none"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>D(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>N(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>k(t)))}validateAspect(t){const e="WARN_aspect";f(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";b(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(f(t))return void this.errors.remove(e);const{mode:i,factor:s}=m(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),R(this),g(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=_(this),j(this),this.componentStyle=x(this),this.ruleSetConfig=S(this),this.t=L(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){F(this.element,"bn-chart-bubble-renderer");const{mode:t}=m(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:s}=u(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l}))),this.checkOverflow()}checkOverflow(){p(this.element,"bn-chart-bubble-renderer",this.errors)}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===e||this.pixelPerUnitGroupMap.has(e)?null:this.t(".bubble-scale-group-unknown",{group:e}))}validateMeasureSpec(t,e,i,s){var a;const r="ERR_xy_json_"+t,n="ERR_xy_measure_"+t,l="WARN_xy_fields_"+t,{data:o,parseError:h}=O(e,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(l);if(this.setBlockingError(r,null),null===o)return this.setBlockingError(n,i?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const c=null!==(a=o.measure)&&void 0!==a?a:"";y(c)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,e,i){const s="ERR_xy_json_"+t,a="WARN_xy_fields_"+t,{data:r,parseError:n}=O(e,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,i(r)):this.errors.remove(a)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=O(e,"measure");if(s||null===i)return null;const{config:a}=A(i);return null!==a&&y(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareSize(){const{data:t,parseError:e}=O(this.size,"measure");if(e||null===t)return null;const{config:i}=E(t);return null!==i&&y(i.measure)?i:null}prepareShare(){const{data:t,parseError:e}=O(this.share,"measure");if(e||null===t)return null;const{config:i}=W(t);return null!==i&&y(i.measure)?i:null}prepareCompareFamily(){var t;const e=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return X.includes(e)?e:null}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=O(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:N(e,t).config}prepareLegend(){const{data:t,parseError:e}=O(this.legend,null);return e||null===t?{show:!0,position:"right"}:k(t).config}prepareFacet(){const{data:t,parseError:e}=O(this.facet,null);return e||null===t?null:D(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;let s=!1;for(const e of t){if(void 0===e)continue;const t=$(e);null!==t&&("scenario"===t.kind?i.add(z(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===i.size&&i.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let o=null;if(null!==n&&G[n]>=G[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;G[l]>=G[t]&&(o=`facet '${l}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===e||!this.pixelPerUnitGroupMap.has(e))return 0;const i=this.pixelPerUnitGroupMap.get(e);if(!(i>0))return 0;const s=this.getEffectiveFontPx();return s*s/i}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bubble"].axisStyles,seriesColors:e["bn-chart-bubble"].seriesColors,padding:e["bn-chart-bubble"].padding}}))}async getBaseline(){return d(this.element,"bn-chart-bubble-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return c(this.element,"bn-chart-bubble-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=m(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[i,s]of Object.entries(e)){if(null===s)continue;const e=$(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${void 0!==s.label?s.label:s.measure}`:(t[e.measure.base].description=`${i}: ${s.measure} (base)`,t[e.measure.delta].description=`${i}: ${s.measure} (delta)`))}const i=this.prepareCompareFamily();if(null!==i)for(const[s,a]of Object.entries(e)){if(null===a||"share"===s)continue;const e=$(a.measure);if(null!==e&&"scenario"===e.kind){const a=i+e.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=s+": compareWith")}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareSize(),s=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure,null==i?void 0:i.measure,null==s?void 0:s.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===e||null===i)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),h=u(this.element).width;return a("bn-chart-bubble-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,size:i,share:s,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:o,i18n:l,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"2b15b5b4fc32db48b951e82ecc87f25b0afcc9f8",style:this.getFontStyles()},a("div",{key:"210d8622e1785b8c882f9c9a2fa2072af0e857b6",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bubble",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],size:[1],share:[1],compareWith:[1,"compare-with"],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),B=M,U=function(){"undefined"!=typeof customElements&&["bn-chart-bubble","bn-chart-bubble-renderer"].forEach((t=>{switch(t){case"bn-chart-bubble":customElements.get(n(t))||customElements.define(n(t),M);break;case"bn-chart-bubble-renderer":customElements.get(n(t))||C()}}))};export{B as BnChartBubble,U as defineCustomElement}
@@ -1 +1 @@
1
- import{B as o,d as s}from"./p-chnyMHJT.js";const p=o,r=s;export{p as BnChartBulletRenderer,r as defineCustomElement}
1
+ import{B as o,d as s}from"./p-CyfGkLMh.js";const p=o,r=s;export{p as BnChartBulletRenderer,r as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as e,w as i,f as s,h as r,a,t as n}from"./p-D6YGOYV1.js";import{h as l,a as o}from"./p-DDvWTgk1.js";import{o as h}from"./p-DaOm9YwQ.js";import{c as u}from"./p-ChaSU4fh.js";import{a as d}from"./p-XFZYX7DZ.js";import{C as c,A as p}from"./p-B5tixDPM.js";import{o as v}from"./p-B6kka9sT.js";import{a as m,b as f,O as g}from"./p-16rjcQ0t.js";import{g as b}from"./p-DD1zlev_.js";import{p as y}from"./p-Xb6Ilq8u.js";import{b as _,i as w,c as A,h as j}from"./p-BiSytXUy.js";import{w as O}from"./p-Dq9dG0Kr.js";import{w as R}from"./p-DjPWZfry.js";import{w as N}from"./p-DJUffGeB.js";import{w as S}from"./p-4vVbchX2.js";import{r as x}from"./p-CniN8ALm.js";import{w as D}from"./p-D40Am1Ap.js";import{w as E}from"./p-xIWChKGS.js";import{w as T}from"./p-DwuXVo2h.js";import{r as z}from"./p-BXXjh6We.js";import{p as W}from"./p-9mUU4itF.js";import{s as k}from"./p-DakXa7Dp.js";import{d as U}from"./p-chnyMHJT.js";const L=["measure","label","unit"];function $(t){const e=[],i=V(t,"measure",e);if(void 0===i||""===i.trim())return e.push("measure"),{config:null,unknownKeys:C(t,L),invalidFields:e};const s={measure:i.trim()};return s.label=V(t,"label",e),s.unit=V(t,"unit",e),{config:s,unknownKeys:C(t,L),invalidFields:e}}const F=["show","decimals"];function M(t,e){const i=[],s={show:e.show,decimals:e.decimals};return c.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:i.push("show")),c.isExisting(t.decimals)&&(c.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):i.push("decimals")),{config:s,unknownKeys:C(t,F),invalidFields:i}}function B(t){var e;const i=null!==(e=null==t?void 0:t.trim())&&void 0!==e?e:"";if(""===i||"null"===i)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(i)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>c.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const r=[];let a=s;const n=[...a].sort(((t,e)=>t-e));return n.some(((t,e)=>t!==a[e]))&&r.push("not ascending, sorted"),a=n,a.length>2&&(r.push(a.length+" entries, first 2 kept"),a=a.slice(0,2)),{ranges:a,parseError:!1,issues:r}}function C(t,e){return Object.keys(t).filter((t=>!e.includes(t)))}function V(t,e,i){if(c.isExisting(t[e]))return c.isString(t[e])?t[e]:void i.push(e)}const X=["pl1","pp1","fc1"],I=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const e="ERR_bullet_json_ranges",i="WARN_bullet_ranges",s=B(t);if(s.parseError)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(i);this.setBlockingError(e,null),s.issues.length>0?this.errors.addOrReplace({id:i,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(i)}validateNormalize(t){this.validateEnum("normalize","WARN_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","WARN_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","WARN_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const e="WARN_order",i=_(t).filter((t=>""!==t));0===i.length?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order: invalid value(s) '${i.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const e="WARN_orderDirection";w(t)||A(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order-direction: invalid value '${t}' - expected asc/desc; using asc.`})}validateLimit(t){const e="WARN_limit";j(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateLabels(t){const e="ERR_bullet_json_labels",i="WARN_bullet_fields_labels",{data:s,parseError:r}=W(t,null);if(r)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(i);this.setBlockingError(e,null),null!==s?this.reportSpecIssues(i,"labels",M(s,this.labelDefaults())):this.errors.remove(i)}validateScale(t){const e="WARN_scale";if(w(t))return void this.errors.remove(e);const{mode:i,factor:s}=y(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.actual="",this.target="",this.ranges="",this.normalizeMode="target",this.variances="auto",this.level="auto",this.order="",this.orderDirection="",this.limit=0,this.labels="",this._autoScaleGuard=!1,this._lastScaledParentHeight=0,this.translateForInner=(t,e)=>this.t(t,e),T(this),O(this),N(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=S(this),this.componentStyle=R(this),this.ruleSetConfig=D(this),this.t=E(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalizeMode),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){k(this.element,"bn-chart-bullet-renderer");const{mode:t}=y(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{height:s}=b(e);if(s<=0)return;this._lastScaledParentHeight=s;const r=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),a=e.scrollHeight,n=this.appliedScaleFactor;if(a<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/a);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",r*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,e){var i;const s="ERR_bullet_json_"+t,r="ERR_bullet_measure_"+t,a="WARN_bullet_fields_"+t,{data:n,parseError:l}=W(e,"measure");if(l)return this.setBlockingError(s,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(r,null),void this.errors.remove(a);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(r,null),void this.errors.remove(a);const o=(null!==(i=n.measure)&&void 0!==i?i:"").trim(),h=z(o);"auto"===o.toLowerCase()||null!==h&&"scenario"===h.kind?this.setBlockingError(r,null):this.setBlockingError(r,this.t(".bullet-measure-invalid",{prop:t,measure:o})),this.reportSpecIssues(a,t,$(n))}validateEnum(t,e,i,s,r){w(i)||s.includes(i.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`${t}: invalid value '${i}' - expected ${s.join("/")}; using '${r}'.`})}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,e,i,s,r;const{data:a,parseError:n}=W(this.actual,"measure");if(n)return null;const l=null!==a?$(a).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const r=null!==l,a=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],n=null!==(s=a.includes("ac1")?"ac1":null!==(i=a.find((t=>t.startsWith("ac"))))&&void 0!==i?i:a[0])&&void 0!==s?s:"ac1";return r||null===this.datasetMeta?this.errors.remove("AUTO_actual"):this.errors.addOrReplace({id:"AUTO_actual",type:"warning",message:"actual: not set, auto-detected: "+n}),null===l?{measure:n}:Object.assign(Object.assign({},l),{measure:n})}return this.errors.remove("AUTO_actual"),"scenario"===(null===(r=z(l.measure))||void 0===r?void 0:r.kind)?l:null}prepareTarget(){var t,e,i;const{data:s,parseError:r}=W(this.target,"measure");if(r)return null;const a=null!==s?$(s).config:null;if(null===a||"auto"===a.measure.toLowerCase()){const i=null!==a,s=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],r=X.find((t=>s.includes(t)));return void 0===r?(this.errors.remove("AUTO_target"),null!==this.datasetMeta?this.errors.addOrReplace({id:"WARN_bullet_target_unavailable",type:"warning",message:this.t(".bullet-target-none")}):this.errors.remove("WARN_bullet_target_unavailable"),null):(this.errors.remove("WARN_bullet_target_unavailable"),i||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:"target: not set, auto-detected: "+r}),null===a?{measure:r}:Object.assign(Object.assign({},a),{measure:r}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(i=z(a.measure))||void 0===i?void 0:i.kind)?a:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalizeMode)||void 0===t?void 0:t.trim().toLowerCase())?"none":"target"}prepareShowVariances(){var t;return"none"!==(null===(t=this.variances)||void 0===t?void 0:t.trim().toLowerCase())}prepareLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===i)return p.ROWGROUP;if("category"===i)return p.CATEGORY;if("subcategory"===i)return p.SUBCATEGORY;const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;if(void 0!==s&&""!==s){const t=p[s.toUpperCase()];if(void 0!==t)return t}return p.CATEGORY}prepareOrder(){var t,e,i,s;const r="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let a;w(this.order)||r?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),a=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),a=""):(this.errors.remove("AUTO_order"),a=this.order);const n=null!==(s=m[null===(i=this.orderDirection)||void 0===i?void 0:i.toUpperCase()])&&void 0!==s?s:m.ASC;if(w(a))return new f([g.CATEGORYINDEX],n);const l=a.split(",").map((t=>g[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new f(l.length>0?l:[g.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=W(this.labels,null);return i||null===e?{show:t.show,decimals:t.decimals}:M(e,t).config}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","target","axis.in"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries(),...x(this.ruleSetConfig("user"))])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bullet"].axisStyles,barStyles:e["bn-chart-bullet"].barStyles,varianceStyles:e["bn-chart-bullet"].varianceStyles,rangeColors:e["bn-chart-bullet"].rangeColors,padding:e["bn-chart-bullet"].padding}}))}async getBaseline(){return d(this.element,"bn-chart-bullet-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),r=this.getEffectiveScaleFactor(),a=Number.isFinite(r)&&r>0?r:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*a;return u(this.element,"bn-chart-bullet-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:a},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=y(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,r,a;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(r=e.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(a=e.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={actual:this.prepareActual(),target:this.prepareTarget()};for(const[i,s]of Object.entries(e))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${i}: ${void 0!==s.label?s.label:s.measure}`);return{IBulletChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareActual(),e=this.prepareTarget(),i=B(this.ranges).ranges,s=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==e&&t.measure===e.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),i.length>0&&"target"===s?this.errors.addOrReplace({id:"WARN_bullet_ranges_ignored",type:"warning",message:this.t(".bullet-ranges-ignored")}):this.errors.remove("WARN_bullet_ranges_ignored"),this.hasBlockingErrors()||null===t?null:r("bn-chart-bullet-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:e,ranges:i,normalizeMode:s,showVariances:this.prepareShowVariances(),level:this.prepareLevel(),order:this.prepareOrder(),limit:this.prepareLimit(),labels:this.prepareLabels(),filter:this.filter,styles:this.prepareStyle(),i18n:this.prepareI18n(),containerWidth:b(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return r(a,{key:"cdd2404977255a330652806671d1bea76c796769",style:this.getFontStyles()},r("div",{key:"0b8cfeb6209083f9144c5824bceecb9b02578f02",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bullet",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],actual:[1],target:[1],ranges:[1],normalizeMode:[1,"normalize"],variances:[1],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],labels:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}]),G=I,K=function(){"undefined"!=typeof customElements&&["bn-chart-bullet","bn-chart-bullet-renderer"].forEach((t=>{switch(t){case"bn-chart-bullet":customElements.get(n(t))||customElements.define(n(t),I);break;case"bn-chart-bullet-renderer":customElements.get(n(t))||U()}}))};export{G as BnChartBullet,K as defineCustomElement}
1
+ import{p as t,H as e,w as i,f as s,h as r,a,t as n}from"./p-D6YGOYV1.js";import{h as l,a as o}from"./p-DDvWTgk1.js";import{o as h}from"./p-DaOm9YwQ.js";import{c as u}from"./p-C2ycO60j.js";import{a as d}from"./p-JofGXz75.js";import{C as c,A as p}from"./p-B5tixDPM.js";import{o as v}from"./p-B6kka9sT.js";import{a as m,b as f,O as g}from"./p-16rjcQ0t.js";import{g as b}from"./p-DD1zlev_.js";import{p as y}from"./p-Xb6Ilq8u.js";import{b as _,i as w,c as A,h as j}from"./p-BiSytXUy.js";import{w as O}from"./p-Dq9dG0Kr.js";import{w as R}from"./p-DjPWZfry.js";import{w as N}from"./p-DJUffGeB.js";import{w as S}from"./p-4vVbchX2.js";import{r as x}from"./p-CniN8ALm.js";import{w as D}from"./p-D40Am1Ap.js";import{w as E}from"./p-xIWChKGS.js";import{w as z}from"./p-DwuXVo2h.js";import{r as T}from"./p-BXXjh6We.js";import{p as k}from"./p-9mUU4itF.js";import{s as W}from"./p-DakXa7Dp.js";import{d as L}from"./p-CyfGkLMh.js";const U=["measure","label","unit"];function $(t){const e=[],i=V(t,"measure",e);if(void 0===i||""===i.trim())return e.push("measure"),{config:null,unknownKeys:B(t,U),invalidFields:e};const s={measure:i.trim()};return s.label=V(t,"label",e),s.unit=V(t,"unit",e),{config:s,unknownKeys:B(t,U),invalidFields:e}}const M=["show","decimals"];function F(t,e){const i=[],s={show:e.show,decimals:e.decimals};return c.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:i.push("show")),c.isExisting(t.decimals)&&(c.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):i.push("decimals")),{config:s,unknownKeys:B(t,M),invalidFields:i}}function C(t){var e;const i=null!==(e=null==t?void 0:t.trim())&&void 0!==e?e:"";if(""===i||"null"===i)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(i)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>c.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const r=[];let a=s;const n=[...a].sort(((t,e)=>t-e));return n.some(((t,e)=>t!==a[e]))&&r.push("not ascending, sorted"),a=n,a.length>2&&(r.push(a.length+" entries, first 2 kept"),a=a.slice(0,2)),{ranges:a,parseError:!1,issues:r}}function B(t,e){return Object.keys(t).filter((t=>!e.includes(t)))}function V(t,e,i){if(c.isExisting(t[e]))return c.isString(t[e])?t[e]:void i.push(e)}const G=["pl1","pp1","fc1"],I=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const e="ERR_bullet_json_ranges",i="WARN_bullet_ranges",s=C(t);if(s.parseError)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(i);this.setBlockingError(e,null),s.issues.length>0?this.errors.addOrReplace({id:i,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(i)}validateNormalize(t){this.validateEnum("normalize","WARN_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","WARN_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","WARN_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const e="WARN_order",i=_(t).filter((t=>""!==t));0===i.length?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order: invalid value(s) '${i.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const e="WARN_orderDirection";w(t)||A(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order-direction: invalid value '${t}' - expected asc/desc; using asc.`})}validateLimit(t){const e="WARN_limit";j(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateLabels(t){const e="ERR_bullet_json_labels",i="WARN_bullet_fields_labels",{data:s,parseError:r}=k(t,null);if(r)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(i);this.setBlockingError(e,null),null!==s?this.reportSpecIssues(i,"labels",F(s,this.labelDefaults())):this.errors.remove(i)}validateScale(t){const e="WARN_scale";if(w(t))return void this.errors.remove(e);const{mode:i,factor:s}=y(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.actual="",this.target="",this.ranges="",this.normalizeMode="target",this.variances="auto",this.level="auto",this.order="",this.orderDirection="",this.limit=0,this.labels="",this._autoScaleGuard=!1,this._lastScaledParentHeight=0,this.translateForInner=(t,e)=>this.t(t,e),z(this),O(this),N(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=S(this),this.componentStyle=R(this),this.ruleSetConfig=D(this),this.t=E(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalizeMode),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){W(this.element,"bn-chart-bullet-renderer");const{mode:t}=y(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{height:s}=b(e);if(s<=0)return;this._lastScaledParentHeight=s;const r=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),a=e.scrollHeight,n=this.appliedScaleFactor;if(a<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/a);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",r*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,e){var i;const s="ERR_bullet_json_"+t,r="ERR_bullet_measure_"+t,a="WARN_bullet_fields_"+t,{data:n,parseError:l}=k(e,"measure");if(l)return this.setBlockingError(s,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(r,null),void this.errors.remove(a);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(r,null),void this.errors.remove(a);const o=(null!==(i=n.measure)&&void 0!==i?i:"").trim(),h=T(o);"auto"===o.toLowerCase()||null!==h&&"scenario"===h.kind?this.setBlockingError(r,null):this.setBlockingError(r,this.t(".bullet-measure-invalid",{prop:t,measure:o})),this.reportSpecIssues(a,t,$(n))}validateEnum(t,e,i,s,r){w(i)||s.includes(i.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`${t}: invalid value '${i}' - expected ${s.join("/")}; using '${r}'.`})}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,e,i,s,r;const{data:a,parseError:n}=k(this.actual,"measure");if(n)return null;const l=null!==a?$(a).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const r=null!==l,a=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],n=null!==(s=a.includes("ac1")?"ac1":null!==(i=a.find((t=>t.startsWith("ac"))))&&void 0!==i?i:a[0])&&void 0!==s?s:"ac1";return r||null===this.datasetMeta?this.errors.remove("AUTO_actual"):this.errors.addOrReplace({id:"AUTO_actual",type:"warning",message:"actual: not set, auto-detected: "+n}),null===l?{measure:n}:Object.assign(Object.assign({},l),{measure:n})}return this.errors.remove("AUTO_actual"),"scenario"===(null===(r=T(l.measure))||void 0===r?void 0:r.kind)?l:null}prepareTarget(){var t,e,i;const{data:s,parseError:r}=k(this.target,"measure");if(r)return null;const a=null!==s?$(s).config:null;if(null===a||"auto"===a.measure.toLowerCase()){const i=null!==a,s=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],r=G.find((t=>s.includes(t)));return void 0===r?(this.errors.remove("AUTO_target"),null!==this.datasetMeta?this.errors.addOrReplace({id:"WARN_bullet_target_unavailable",type:"warning",message:this.t(".bullet-target-none")}):this.errors.remove("WARN_bullet_target_unavailable"),null):(this.errors.remove("WARN_bullet_target_unavailable"),i||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:"target: not set, auto-detected: "+r}),null===a?{measure:r}:Object.assign(Object.assign({},a),{measure:r}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(i=T(a.measure))||void 0===i?void 0:i.kind)?a:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalizeMode)||void 0===t?void 0:t.trim().toLowerCase())?"none":"target"}prepareShowVariances(){var t;return"none"!==(null===(t=this.variances)||void 0===t?void 0:t.trim().toLowerCase())}prepareLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===i)return p.ROWGROUP;if("category"===i)return p.CATEGORY;if("subcategory"===i)return p.SUBCATEGORY;const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;if(void 0!==s&&""!==s){const t=p[s.toUpperCase()];if(void 0!==t)return t}return p.CATEGORY}prepareOrder(){var t,e,i,s;const r="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let a;w(this.order)||r?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),a=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),a=""):(this.errors.remove("AUTO_order"),a=this.order);const n=null!==(s=m[null===(i=this.orderDirection)||void 0===i?void 0:i.toUpperCase()])&&void 0!==s?s:m.ASC;if(w(a))return new f([g.CATEGORYINDEX],n);const l=a.split(",").map((t=>g[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new f(l.length>0?l:[g.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=k(this.labels,null);return i||null===e?{show:t.show,decimals:t.decimals}:F(e,t).config}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","target","axis.in"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries(),...x(this.ruleSetConfig("user"))])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bullet"].axisStyles,barStyles:e["bn-chart-bullet"].barStyles,varianceStyles:e["bn-chart-bullet"].varianceStyles,rangeColors:e["bn-chart-bullet"].rangeColors,padding:e["bn-chart-bullet"].padding}}))}async getBaseline(){return d(this.element,"bn-chart-bullet-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),r=this.getEffectiveScaleFactor(),a=Number.isFinite(r)&&r>0?r:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*a;return u(this.element,"bn-chart-bullet-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:a},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=y(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,r,a;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(r=e.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(a=e.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={actual:this.prepareActual(),target:this.prepareTarget()};for(const[i,s]of Object.entries(e))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${i}: ${void 0!==s.label?s.label:s.measure}`);return{IBulletChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareActual(),e=this.prepareTarget(),i=C(this.ranges).ranges,s=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==e&&t.measure===e.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),i.length>0&&"target"===s?this.errors.addOrReplace({id:"WARN_bullet_ranges_ignored",type:"warning",message:this.t(".bullet-ranges-ignored")}):this.errors.remove("WARN_bullet_ranges_ignored"),this.hasBlockingErrors()||null===t?null:r("bn-chart-bullet-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:e,ranges:i,normalizeMode:s,showVariances:this.prepareShowVariances(),level:this.prepareLevel(),order:this.prepareOrder(),limit:this.prepareLimit(),labels:this.prepareLabels(),filter:this.filter,styles:this.prepareStyle(),i18n:this.prepareI18n(),containerWidth:b(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return r(a,{key:"cdd2404977255a330652806671d1bea76c796769",style:this.getFontStyles()},r("div",{key:"0b8cfeb6209083f9144c5824bceecb9b02578f02",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bullet",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],actual:[1],target:[1],ranges:[1],normalizeMode:[1,"normalize"],variances:[1],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],labels:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}]),X=I,K=function(){"undefined"!=typeof customElements&&["bn-chart-bullet","bn-chart-bullet-renderer"].forEach((t=>{switch(t){case"bn-chart-bullet":customElements.get(n(t))||customElements.define(n(t),I);break;case"bn-chart-bullet-renderer":customElements.get(n(t))||L()}}))};export{X as BnChartBullet,K as defineCustomElement}
@@ -1 +1 @@
1
- import{B as o,d as p}from"./p-Bn7J1pgl.js";const s=o,r=p;export{s as BnChartScatterRenderer,r as defineCustomElement}
1
+ import{B as o,d as s}from"./p-AwH1w8Mu.js";const p=o,r=s;export{p as BnChartScatterRenderer,r as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as e,w as s,f as i,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-DDvWTgk1.js";import{o as h}from"./p-DaOm9YwQ.js";import{c as d}from"./p-ChaSU4fh.js";import{a as c}from"./p-XFZYX7DZ.js";import{g as u}from"./p-DD1zlev_.js";import{c as p}from"./p-D2Epww9R.js";import{o as v}from"./p-B6kka9sT.js";import{p as m}from"./p-Xb6Ilq8u.js";import{i as f,h as y,j as g}from"./p-BiSytXUy.js";import{w as b}from"./p-Dq9dG0Kr.js";import{w as x}from"./p-DjPWZfry.js";import{w}from"./p-DJUffGeB.js";import{w as _}from"./p-4vVbchX2.js";import{w as S}from"./p-D40Am1Ap.js";import{w as j}from"./p-xIWChKGS.js";import{w as L}from"./p-DwuXVo2h.js";import{r as A,s as $}from"./p-BXXjh6We.js";import{f as R,c as N,d as E,e as D,p as k,t as O}from"./p-9mUU4itF.js";import{s as F}from"./p-DakXa7Dp.js";import{d as W}from"./p-Bn7J1pgl.js";const C={rowGroup:0,category:1,subCategory:2},z=t(class extends e{validateFilter(t){const e="ERR_filter";o(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateAxisSpec("x",t)}validateY(t){this.validateAxisSpec("y",t)}validateIso(t){this.validateObjectSpec("iso",t,null,(t=>R(t)))}validateLevel(t){const e="WARN_level",s=["auto","category","subcategory"];f(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",s=["auto","rowgroup","category","none"];f(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,null,(t=>N(t)))}validateLabels(t){this.validateObjectSpec("labels",t,null,(t=>E(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,null,(t=>D(t)))}validateAspect(t){const e="WARN_aspect";f(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";y(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(f(t))return void this.errors.remove(e);const{mode:s,factor:i}=m(t);"factor"===s&&(void 0===i||i<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.iso="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),L(this),b(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=_(this),this.componentStyle=x(this),this.ruleSetConfig=S(this),this.t=j(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateIso(this.iso),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){F(this.element,"bn-chart-scatter-renderer");const{mode:t}=m(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:i}=u(e);if(i<=0)return void this.checkOverflow();this._lastObservedWidth=i;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=i+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(i-1)/r);Math.abs(o-n)<.01||(e.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,s((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}checkOverflow(){p(this.element,"bn-chart-scatter-renderer",this.errors)}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,i(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,i(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"auto",values:!1,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateAxisSpec(t,e){var s;const i="ERR_xy_json_"+t,a="ERR_xy_measure_"+t,r="WARN_xy_fields_"+t,n="x"===t||"y"===t||"size"===t,{data:o,parseError:l}=k(e,"measure");if(l)return this.setBlockingError(i,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(a,null),void this.errors.remove(r);if(this.setBlockingError(i,null),null===o)return this.setBlockingError(a,n?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(r);const h="share"===t?null:O(o),d=null!==(s=o.measure)&&void 0!==s?s:"";g(d)?this.setBlockingError(a,null):this.setBlockingError(a,this.t(".xy-measure-invalid",{prop:t,measure:d})),this.reportSpecIssues(r,t,h)}validateObjectSpec(t,e,s,i){const a="ERR_xy_json_"+t,r="WARN_xy_fields_"+t,{data:n,parseError:o}=k(e,s);if(o)return this.setBlockingError(a,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(r);this.setBlockingError(a,null),null!==n?this.reportSpecIssues(r,t,i(n)):this.errors.remove(r)}reportSpecIssues(t,e,s){const i=[];null!==s&&s.invalidFields.length>0&&i.push("invalid: "+s.invalidFields.join(", ")),null!==s&&s.unknownKeys.length>0&&i.push("unknown: "+s.unknownKeys.join(", ")),i.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${i.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:s,parseError:i}=k(e,"measure");if(i||null===s)return null;const{config:a}=O(s);return null!==a&&g(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareIso(){const{data:t,parseError:e}=k(this.iso,null);return e||null===t?null:R(t).config}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:s}=k(this.labels,null);return s||null===e?{points:t.points,values:t.values,max:t.max}:E(e,t).config}prepareLegend(){const{data:t,parseError:e}=k(this.legend,null);return e||null===t?{show:!0,position:"right"}:D(t).config}prepareFacet(){const{data:t,parseError:e}=k(this.facet,null);return e||null===t?null:N(t).config}preparePointLevel(){var t,e;const s=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===s)return"category";if("subcategory"===s)return"subCategory";const i=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===i||"category"===i||"subCategory"===i?i:"category"}prepareSeriesLevel(t){var e;const s=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===s?null:"rowgroup"===s?"rowGroup":"category"===s||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const s=new Set;for(const e of t){if(void 0===e)continue;const t=A(e);null!==t&&"scenario"===t.kind&&s.add($(t.slot))}this.setBlockingError("ERR_xy_family",s.size>1?this.t(".xy-family-mixed",{families:[...s].join(", ")}):null);const i=this.preparePointLevel(),a=this.prepareSeriesLevel(i),r=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let n=null;if(null!==a&&C[a]>=C[i]&&(n=`series '${a}' vs point '${i}'`),null!==r){const t=null!=a?a:i;C[r]>=C[t]&&(n=`facet '${r}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==n?this.t(".xy-level-order",{detail:n}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const s=Number(e[1]),i=Number(e[2]);return s<=0||i<=0?null:s/i}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","axis.in","legend.title"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(l.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor(),e=this.element.localName;return this.componentStyle((s=>{const i=s.global.fontSizePx*t;return{scaleFactors:s[e].scaleFactors,fontStyles:{font:`${i}px ${s.global.fontFamily}`,size:i,color:s.global.fontColor,background:s.global.fontBackgroundColor,leading:1.8},axisStyles:s[e].axisStyles,seriesColors:s[e].seriesColors,padding:s[e].padding}}))}async getBaseline(){return c(this.element,"bn-chart-scatter-renderer")}async getLayoutState(t){var e;const s=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",i=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return d(this.element,"bn-chart-scatter-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},i,s)}getEffectiveScaleFactor(){const{mode:t,factor:e}=m(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var s,i,a,r;const n=(null===(s=e.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(i=e.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const s of[1,2,3,4])t[`${e}${s}`]={type:"number",isOptional:!0,description:""};for(const[e,s]of Object.entries(this.mappedAxes())){if(null===s)continue;const i=A(s.measure);null!==i&&("scenario"===i.kind?t[i.slot].description=`${e}: ${"label"in s&&void 0!==s.label?s.label:s.measure}`:(t[i.measure.base].description=`${e}: ${s.measure} (base)`,t[i.measure.delta].description=`${e}: ${s.measure} (delta)`))}return{[this.dataStructureName()]:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}mappedAxes(){return{x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y)}}dataStructureName(){return"IScatterChartDataRow"}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),s=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure],s),this.hasBlockingErrors()||null===t||null===e)return null;const i=this.preparePointLevel(),r=this.prepareI18n(),n=this.prepareStyle(),o=u(this.element).width;return a("bn-chart-scatter-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,iso:this.prepareIso(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:s,pointLevel:i,seriesLevel:this.prepareSeriesLevel(i),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,styles:n,i18n:r,containerWidth:o,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"4947af836a9c76b089bc07fb1f4df8c248aa4f62",style:this.getFontStyles()},a("div",{key:"16abbc30d255d224aefecf9e337d3b23d449828a",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-scatter",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],iso:[1],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),I=z,X=function(){"undefined"!=typeof customElements&&["bn-chart-scatter","bn-chart-scatter-renderer"].forEach((t=>{switch(t){case"bn-chart-scatter":customElements.get(n(t))||customElements.define(n(t),z);break;case"bn-chart-scatter-renderer":customElements.get(n(t))||W()}}))};export{I as BnChartScatter,X as defineCustomElement}
1
+ import{p as t,H as e,w as s,f as i,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-DDvWTgk1.js";import{o as h}from"./p-DaOm9YwQ.js";import{c as d}from"./p-C2ycO60j.js";import{a as c}from"./p-JofGXz75.js";import{g as u}from"./p-DD1zlev_.js";import{c as p}from"./p-D2Epww9R.js";import{o as v}from"./p-B6kka9sT.js";import{p as m}from"./p-Xb6Ilq8u.js";import{i as f,h as y,j as g}from"./p-BiSytXUy.js";import{w as b}from"./p-Dq9dG0Kr.js";import{w as x}from"./p-DjPWZfry.js";import{w}from"./p-DJUffGeB.js";import{w as _}from"./p-4vVbchX2.js";import{w as j}from"./p-D40Am1Ap.js";import{w as S}from"./p-xIWChKGS.js";import{w as L}from"./p-DwuXVo2h.js";import{r as A,s as $}from"./p-BXXjh6We.js";import{f as R,c as N,d as E,e as D,p as k,t as O}from"./p-9mUU4itF.js";import{s as F}from"./p-DakXa7Dp.js";import{d as W}from"./p-AwH1w8Mu.js";const z={rowGroup:0,category:1,subCategory:2},C=t(class extends e{validateFilter(t){const e="ERR_filter";o(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateAxisSpec("x",t)}validateY(t){this.validateAxisSpec("y",t)}validateIso(t){this.validateObjectSpec("iso",t,null,(t=>R(t)))}validateLevel(t){const e="WARN_level",s=["auto","category","subcategory"];f(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",s=["auto","rowgroup","category","none"];f(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,null,(t=>N(t)))}validateLabels(t){this.validateObjectSpec("labels",t,null,(t=>E(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,null,(t=>D(t)))}validateAspect(t){const e="WARN_aspect";f(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";y(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(f(t))return void this.errors.remove(e);const{mode:s,factor:i}=m(t);"factor"===s&&(void 0===i||i<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.iso="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),L(this),b(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=_(this),this.componentStyle=x(this),this.ruleSetConfig=j(this),this.t=S(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateIso(this.iso),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){F(this.element,"bn-chart-scatter-renderer");const{mode:t}=m(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:i}=u(e);if(i<=0)return void this.checkOverflow();this._lastObservedWidth=i;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=i+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(i-1)/r);Math.abs(o-n)<.01||(e.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,s((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}checkOverflow(){p(this.element,"bn-chart-scatter-renderer",this.errors)}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,i(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,i(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"auto",values:!1,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateAxisSpec(t,e){var s;const i="ERR_xy_json_"+t,a="ERR_xy_measure_"+t,r="WARN_xy_fields_"+t,n="x"===t||"y"===t||"size"===t,{data:o,parseError:l}=k(e,"measure");if(l)return this.setBlockingError(i,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(a,null),void this.errors.remove(r);if(this.setBlockingError(i,null),null===o)return this.setBlockingError(a,n?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(r);const h="share"===t?null:O(o),d=null!==(s=o.measure)&&void 0!==s?s:"";g(d)?this.setBlockingError(a,null):this.setBlockingError(a,this.t(".xy-measure-invalid",{prop:t,measure:d})),this.reportSpecIssues(r,t,h)}validateObjectSpec(t,e,s,i){const a="ERR_xy_json_"+t,r="WARN_xy_fields_"+t,{data:n,parseError:o}=k(e,s);if(o)return this.setBlockingError(a,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(r);this.setBlockingError(a,null),null!==n?this.reportSpecIssues(r,t,i(n)):this.errors.remove(r)}reportSpecIssues(t,e,s){const i=[];null!==s&&s.invalidFields.length>0&&i.push("invalid: "+s.invalidFields.join(", ")),null!==s&&s.unknownKeys.length>0&&i.push("unknown: "+s.unknownKeys.join(", ")),i.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${i.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:s,parseError:i}=k(e,"measure");if(i||null===s)return null;const{config:a}=O(s);return null!==a&&g(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareIso(){const{data:t,parseError:e}=k(this.iso,null);return e||null===t?null:R(t).config}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:s}=k(this.labels,null);return s||null===e?{points:t.points,values:t.values,max:t.max}:E(e,t).config}prepareLegend(){const{data:t,parseError:e}=k(this.legend,null);return e||null===t?{show:!0,position:"right"}:D(t).config}prepareFacet(){const{data:t,parseError:e}=k(this.facet,null);return e||null===t?null:N(t).config}preparePointLevel(){var t,e;const s=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===s)return"category";if("subcategory"===s)return"subCategory";const i=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===i||"category"===i||"subCategory"===i?i:"category"}prepareSeriesLevel(t){var e;const s=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===s?null:"rowgroup"===s?"rowGroup":"category"===s||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const s=new Set;for(const e of t){if(void 0===e)continue;const t=A(e);null!==t&&"scenario"===t.kind&&s.add($(t.slot))}this.setBlockingError("ERR_xy_family",s.size>1?this.t(".xy-family-mixed",{families:[...s].join(", ")}):null);const i=this.preparePointLevel(),a=this.prepareSeriesLevel(i),r=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let n=null;if(null!==a&&z[a]>=z[i]&&(n=`series '${a}' vs point '${i}'`),null!==r){const t=null!=a?a:i;z[r]>=z[t]&&(n=`facet '${r}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==n?this.t(".xy-level-order",{detail:n}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const s=Number(e[1]),i=Number(e[2]);return s<=0||i<=0?null:s/i}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","axis.in","legend.title"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(l.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor(),e=this.element.localName;return this.componentStyle((s=>{const i=s.global.fontSizePx*t;return{scaleFactors:s[e].scaleFactors,fontStyles:{font:`${i}px ${s.global.fontFamily}`,size:i,color:s.global.fontColor,background:s.global.fontBackgroundColor,leading:1.8},axisStyles:s[e].axisStyles,seriesColors:s[e].seriesColors,padding:s[e].padding}}))}async getBaseline(){return c(this.element,"bn-chart-scatter-renderer")}async getLayoutState(t){var e;const s=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",i=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return d(this.element,"bn-chart-scatter-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},i,s)}getEffectiveScaleFactor(){const{mode:t,factor:e}=m(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var s,i,a,r;const n=(null===(s=e.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(i=e.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const s of[1,2,3,4])t[`${e}${s}`]={type:"number",isOptional:!0,description:""};for(const[e,s]of Object.entries(this.mappedAxes())){if(null===s)continue;const i=A(s.measure);null!==i&&("scenario"===i.kind?t[i.slot].description=`${e}: ${"label"in s&&void 0!==s.label?s.label:s.measure}`:(t[i.measure.base].description=`${e}: ${s.measure} (base)`,t[i.measure.delta].description=`${e}: ${s.measure} (delta)`))}return{[this.dataStructureName()]:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}mappedAxes(){return{x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y)}}dataStructureName(){return"IScatterChartDataRow"}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),s=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure],s),this.hasBlockingErrors()||null===t||null===e)return null;const i=this.preparePointLevel(),r=this.prepareI18n(),n=this.prepareStyle(),o=u(this.element).width;return a("bn-chart-scatter-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,iso:this.prepareIso(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:s,pointLevel:i,seriesLevel:this.prepareSeriesLevel(i),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,styles:n,i18n:r,containerWidth:o,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"4947af836a9c76b089bc07fb1f4df8c248aa4f62",style:this.getFontStyles()},a("div",{key:"16abbc30d255d224aefecf9e337d3b23d449828a",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-scatter",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],iso:[1],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),G=C,I=function(){"undefined"!=typeof customElements&&["bn-chart-scatter","bn-chart-scatter-renderer"].forEach((t=>{switch(t){case"bn-chart-scatter":customElements.get(n(t))||customElements.define(n(t),C);break;case"bn-chart-scatter-renderer":customElements.get(n(t))||W()}}))};export{G as BnChartScatter,I as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as i,w as e,f as s,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-DDvWTgk1.js";import{v as c,a as h,i as d,k as p,b as u,c as v,h as m,l as g,m as f}from"./p-BiSytXUy.js";import{w as y}from"./p-DJUffGeB.js";import{w as b}from"./p-Dq9dG0Kr.js";import{i as S,w,a as O}from"./p-xIWChKGS.js";import{w as A}from"./p-DQl2K2Xl.js";import{w as k}from"./p-DwuXVo2h.js";import{w as x}from"./p-DjPWZfry.js";import{r as _}from"./p-CniN8ALm.js";import{w as N}from"./p-D40Am1Ap.js";import{w as T,r as D}from"./p-4vVbchX2.js";import{g as U}from"./p-DD1zlev_.js";import{r as W,f as j,p as M}from"./p-Xb6Ilq8u.js";import{o as R}from"./p-B6kka9sT.js";import{A as C,e as L,f as z,g as P}from"./p-B5tixDPM.js";import{a as $,O as E}from"./p-16rjcQ0t.js";import{LAYOUT_STATE_VERSION as F}from"./index.js";import{o as G,m as I}from"./p-DaOm9YwQ.js";import{r as B,a as V}from"./p-CckAR27O.js";import{a as H}from"./p-ChaSU4fh.js";import{a as X}from"./p-XFZYX7DZ.js";import{s as Y}from"./p-DakXa7Dp.js";import{d as J}from"./p-1B_s8oPY.js";const q=t(class t extends i{validateFilter(t){const i="ERR_filter";o(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="WARN_scenarios";if(S(t))return void this.errors.remove(i);const e=c(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="WARN_variances";if(S(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="WARN_unitScaling";d(t)?this.errors.remove(i):"invalid"===W(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="WARN_percentageScaling";d(t)?this.errors.remove(i):"invalid"===W(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateLevel(t){const i="WARN_level";d(t)||p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="WARN_order";if(S(t))return void this.errors.remove(i);const e=u(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="WARN_orderDirection";S(t)||d(t)||v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="WARN_limit";m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="WARN_measureScale";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateStack(t){const i="WARN_stack",e=f(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("WARN_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"WARN_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("WARN_scale")}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this._lastScaledParentHeight=0,this.chartTitle="",this.filter="",this.limit=0,this.showCategories=!0,this.measureScale="greatest",this.showMeasureScale=!1,this.measureUnit="",this.stack="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,r,n,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(r=this.lastAutoScalingReport)||void 0===r?void 0:r.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),c=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=c/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(n=this.unitScaling)&&void 0!==n?n:"")+"").trim())}, auto-fitted to 1 em ≈ ${j(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*c/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${j(e)} percentage points.`}))}},k(this),b(this),y(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=T(this),A(this),this.componentStyle=x(this),this.ruleSetConfig=N(this),this.t=w(this).t,this.resolveInherited=O(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}],this.errors)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateMeasureScale(this.measureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){Y(this.element,"bn-chart-structure-renderer");const{mode:t}=M(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{height:s}=U(i);if(s<=0)return void this.checkOverflow();this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollHeight,n=this.appliedScaleFactor;if(r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(s-1)/r);Math.abs(o-n)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=R(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=U(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=U(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("bn-chart-structure-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,r;const n=parseFloat(null!==(r=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==r?r:"");Number.isNaN(n)||(e+=n,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}checkOverflow(){const t=U(this.element),i=this.measureContentWidth(),e=this.element.scrollHeight,s=t.width>0&&i>t.width+1,a=t.height>0&&e>t.height+1;if(!s&&!a)return void D(this.errors,null);const r=this.prepareVariances().some((t=>t.startsWith("dr"))),n="value"===W(this.unitScaling,this.pixelPerUnitGroupMap).kind,o=r&&"value"===W(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=M(this.scale),c="auto"!==l&&"empty"!==l,h=[];s&&n&&h.push("unit-scaling"),s&&o&&h.push("percentage-scaling"),a&&c&&h.push("scale");const d=[];s&&d.push(`width (${Math.round(i)}px > ${Math.round(t.width)}px)`),a&&d.push(`height (${Math.round(e)}px > ${Math.round(t.height)}px)`),D(this.errors,`Chart exceeds available ${d.join(" and ")}. `+(h.length>0?`Adjust ${h.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container."),h.length>0)}prepareDimension(){const t=U(this.element),i=this.prepareVariances();return this.canvasWidthSegmented=t.width/(1+i.length),{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(a.inherited)return this.errors.remove("AUTO_scenarios"),a.value.split(",").map((t=>t.trim()));const r="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return d(a.value)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r||a.unresolved?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=a.value)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return d(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||!this.showCategories}prepareI18n(){const t=l,i=new Map(["no-data","REST"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries(),..._(this.ruleSetConfig("user"))])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=W(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=W(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return d(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),C[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),C[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=i.value,s=this.resolveInherited("orderDirection",this.orderDirection).value,a="auto"===(null==e?void 0:e.trim().toLowerCase());let r;return d(e)||a?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(a||i.unresolved?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),r=this.datasetMeta.suggestedOrder):r=e:(this.errors.remove("AUTO_order"),r=e),{hierarchy:null==r?void 0:r.split(",").map((t=>E[null==t?void 0:t.toUpperCase()])),direction:$[null==s?void 0:s.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,stackColors:i["bn-chart-structure"].stackColors,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(d(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===L.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||P.ABSOLUTE,order:t.order||z.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return d(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){const e=this.preparePixelPerUnit(),s=this.preparePixelPerPercentage(),r=this.prepareStackConfig(),n=this.prepareScenarios(),o=(null==r?void 0:r.by)===L.DIMENSIONS?n.slice(0,1):n;return a("bn-chart-structure-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:o,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:e,pixelPerPercentage:s,reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(i),stackConfig:r,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getBaseline(){return X(this.element,"bn-chart-structure-renderer")}async getLayoutState(t){var i,e,s,a;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",n=G(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,c=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,h=this.prepareVariances(),d=H(this.element,"bn-chart-structure-renderer",["base",...h],n,r),p=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("bn-chart-structure-renderer"),u={version:F,tag:this.element.localName,id:V(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:I(this.element,n),em:{fontSizePx:c,appliedScaleFactor:l},regions:d.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==p?void 0:p.scenarios)&&void 0!==a?a:[],variances:h,barCount:d.barCount,hasNoData:0===d.barCount},diagnostics:B(this.element),scaling:this.resolveScalingInfo(c),baseline:d.baseline};return d.elements&&(u.elements=d.elements),u}resolveScalingInfo(t){var i,e;const s={},a=W(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const r=W(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)s.percentageMode="fixed",s.percentagePointsPerEm=r.value,s.percentagePxPerPoint=t/r.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=M(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"467a851c6547b300c71a38e812bfea4718f27775",style:e},a("div",{key:"4b5078608132e047a9404987c65c46f43037c043",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],measureScale:[{validateMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],chartTitle:[1,"chart-title"],ruleset:[513],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[4,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[4,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],measureScale:[{validateMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),Z=q,K=function(){"undefined"!=typeof customElements&&["bn-chart-structure","bn-chart-structure-renderer"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),q);break;case"bn-chart-structure-renderer":customElements.get(n(t))||J()}}))};export{Z as BnChartStructure,K as defineCustomElement}
1
+ import{p as t,H as i,w as e,f as s,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-DDvWTgk1.js";import{v as c,a as h,i as d,k as p,b as u,c as v,h as m,l as g,m as f}from"./p-BiSytXUy.js";import{w as y}from"./p-DJUffGeB.js";import{w as b}from"./p-Dq9dG0Kr.js";import{i as S,w,a as O}from"./p-xIWChKGS.js";import{w as A}from"./p-DQl2K2Xl.js";import{w as k}from"./p-DwuXVo2h.js";import{w as x}from"./p-DjPWZfry.js";import{r as _}from"./p-CniN8ALm.js";import{w as N}from"./p-D40Am1Ap.js";import{w as T,r as D}from"./p-4vVbchX2.js";import{g as U}from"./p-DD1zlev_.js";import{r as j,f as W,p as M}from"./p-Xb6Ilq8u.js";import{o as R}from"./p-B6kka9sT.js";import{A as C,e as L,f as z,g as P}from"./p-B5tixDPM.js";import{a as $,O as E}from"./p-16rjcQ0t.js";import{LAYOUT_STATE_VERSION as G}from"./index.js";import{o as F,m as I}from"./p-DaOm9YwQ.js";import{r as B,a as V}from"./p-CckAR27O.js";import{a as H}from"./p-C2ycO60j.js";import{a as X}from"./p-JofGXz75.js";import{s as J}from"./p-DakXa7Dp.js";import{d as Y}from"./p-1B_s8oPY.js";const q=t(class t extends i{validateFilter(t){const i="ERR_filter";o(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="WARN_scenarios";if(S(t))return void this.errors.remove(i);const e=c(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="WARN_variances";if(S(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="WARN_unitScaling";d(t)?this.errors.remove(i):"invalid"===j(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="WARN_percentageScaling";d(t)?this.errors.remove(i):"invalid"===j(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateLevel(t){const i="WARN_level";d(t)||p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="WARN_order";if(S(t))return void this.errors.remove(i);const e=u(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="WARN_orderDirection";S(t)||d(t)||v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="WARN_limit";m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="WARN_measureScale";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateStack(t){const i="WARN_stack",e=f(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("WARN_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"WARN_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("WARN_scale")}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this._lastScaledParentHeight=0,this.chartTitle="",this.filter="",this.limit=0,this.showCategories=!0,this.measureScale="greatest",this.showMeasureScale=!1,this.measureUnit="",this.stack="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,r,n,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(r=this.lastAutoScalingReport)||void 0===r?void 0:r.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),c=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=c/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(n=this.unitScaling)&&void 0!==n?n:"")+"").trim())}, auto-fitted to 1 em ≈ ${W(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*c/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${W(e)} percentage points.`}))}},k(this),b(this),y(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=T(this),A(this),this.componentStyle=x(this),this.ruleSetConfig=N(this),this.t=w(this).t,this.resolveInherited=O(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}],this.errors)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateMeasureScale(this.measureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){J(this.element,"bn-chart-structure-renderer");const{mode:t}=M(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{height:s}=U(i);if(s<=0)return void this.checkOverflow();this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollHeight,n=this.appliedScaleFactor;if(r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(s-1)/r);Math.abs(o-n)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=R(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=U(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=U(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("bn-chart-structure-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,r;const n=parseFloat(null!==(r=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==r?r:"");Number.isNaN(n)||(e+=n,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}checkOverflow(){const t=U(this.element),i=this.measureContentWidth(),e=this.element.scrollHeight,s=t.width>0&&i>t.width+1,a=t.height>0&&e>t.height+1;if(!s&&!a)return void D(this.errors,null);const r=this.prepareVariances().some((t=>t.startsWith("dr"))),n="value"===j(this.unitScaling,this.pixelPerUnitGroupMap).kind,o=r&&"value"===j(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=M(this.scale),c="auto"!==l&&"empty"!==l,h=[];s&&n&&h.push("unit-scaling"),s&&o&&h.push("percentage-scaling"),a&&c&&h.push("scale");const d=[];s&&d.push(`width (${Math.round(i)}px > ${Math.round(t.width)}px)`),a&&d.push(`height (${Math.round(e)}px > ${Math.round(t.height)}px)`),D(this.errors,`Chart exceeds available ${d.join(" and ")}. `+(h.length>0?`Adjust ${h.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container."),h.length>0)}prepareDimension(){const t=U(this.element),i=this.prepareVariances();return this.canvasWidthSegmented=t.width/(1+i.length),{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(a.inherited)return this.errors.remove("AUTO_scenarios"),a.value.split(",").map((t=>t.trim()));const r="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return d(a.value)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r||a.unresolved?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=a.value)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return d(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||!this.showCategories}prepareI18n(){const t=l,i=new Map(["no-data","REST"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries(),..._(this.ruleSetConfig("user"))])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=j(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=j(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return d(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),C[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),C[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=i.value,s=this.resolveInherited("orderDirection",this.orderDirection).value,a="auto"===(null==e?void 0:e.trim().toLowerCase());let r;return d(e)||a?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(a||i.unresolved?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),r=this.datasetMeta.suggestedOrder):r=e:(this.errors.remove("AUTO_order"),r=e),{hierarchy:null==r?void 0:r.split(",").map((t=>E[null==t?void 0:t.toUpperCase()])),direction:$[null==s?void 0:s.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,stackColors:i["bn-chart-structure"].stackColors,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(d(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===L.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||P.ABSOLUTE,order:t.order||z.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return d(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){const e=this.preparePixelPerUnit(),s=this.preparePixelPerPercentage(),r=this.prepareStackConfig(),n=this.prepareScenarios(),o=(null==r?void 0:r.by)===L.DIMENSIONS?n.slice(0,1):n;return a("bn-chart-structure-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:o,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:e,pixelPerPercentage:s,reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(i),stackConfig:r,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getBaseline(){return X(this.element,"bn-chart-structure-renderer")}async getLayoutState(t){var i,e,s,a;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",n=F(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,c=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,h=this.prepareVariances(),d=H(this.element,"bn-chart-structure-renderer",["base",...h],n,r),p=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("bn-chart-structure-renderer"),u={version:G,tag:this.element.localName,id:V(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:I(this.element,n),em:{fontSizePx:c,appliedScaleFactor:l},regions:d.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==p?void 0:p.scenarios)&&void 0!==a?a:[],variances:h,barCount:d.barCount,hasNoData:0===d.barCount},diagnostics:B(this.element),scaling:this.resolveScalingInfo(c),baseline:d.baseline};return d.elements&&(u.elements=d.elements),u}resolveScalingInfo(t){var i,e;const s={},a=j(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const r=j(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)s.percentageMode="fixed",s.percentagePointsPerEm=r.value,s.percentagePxPerPoint=t/r.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=M(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"467a851c6547b300c71a38e812bfea4718f27775",style:e},a("div",{key:"4b5078608132e047a9404987c65c46f43037c043",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],measureScale:[{validateMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],chartTitle:[1,"chart-title"],ruleset:[513],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[4,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[4,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],measureScale:[{validateMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),K=q,Q=function(){"undefined"!=typeof customElements&&["bn-chart-structure","bn-chart-structure-renderer"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),q);break;case"bn-chart-structure-renderer":customElements.get(n(t))||Y()}}))};export{K as BnChartStructure,Q as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as i,w as e,f as s,h as a,a as n,t as r}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-DDvWTgk1.js";import{v as h,a as d,n as c,i as p,f as u,h as v,m,o as g,l as f}from"./p-BiSytXUy.js";import{w as y}from"./p-DJUffGeB.js";import{w as b}from"./p-Dq9dG0Kr.js";import{i as S,w,a as x}from"./p-xIWChKGS.js";import{w as M}from"./p-DQl2K2Xl.js";import{w as O}from"./p-DwuXVo2h.js";import{w as A}from"./p-DjPWZfry.js";import{V as _,r as N,F as T}from"./p-CniN8ALm.js";import{w as L}from"./p-D40Am1Ap.js";import{w as k,r as W}from"./p-4vVbchX2.js";import{g as U}from"./p-DD1zlev_.js";import{r as j,f as C,p as D}from"./p-Xb6Ilq8u.js";import{o as I}from"./p-B6kka9sT.js";import{b as R,e as $,f as F,g as P,h as B}from"./p-B5tixDPM.js";import{D as E}from"./p-sLbQ7yZ1.js";import{LAYOUT_STATE_VERSION as z}from"./index.js";import{o as G,m as V}from"./p-DaOm9YwQ.js";import{r as X,a as Z}from"./p-CckAR27O.js";import{a as H}from"./p-ChaSU4fh.js";import{a as Y}from"./p-XFZYX7DZ.js";import{s as q}from"./p-DakXa7Dp.js";import{d as J}from"./p-CEf5X8MZ.js";const K=t(class t extends i{validateFilter(t){const i="ERR_filter";o(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="WARN_scenarios";if(S(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="WARN_variances";if(S(t))return void this.errors.remove(i);const e=d(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateLeftSync(t){const i="WARN_syncSpaceLeft";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+t+"' are not supported."})}validateUnitScaling(t){const i="WARN_unitScaling";p(t)?this.errors.remove(i):"invalid"===j(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="WARN_percentageScaling";p(t)?this.errors.remove(i):"invalid"===j(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateDateInterval(t){const i="WARN_dateInterval";p(t)||u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateInterval: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateChartMode(t){const i="WARN_chartMode";["bar","line","auto"].includes(null==t?void 0:t.toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"chartMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(t){const i="WARN_maxBars";!v(t)||t<1?this.errors.addOrReplace({id:i,type:"warning",message:"maxBars: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Must be a positive integer."}):this.errors.remove(i)}validateStack(t){const i="WARN_stack",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("WARN_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"WARN_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("WARN_scale")}validateAxisLabelsMode(t){const i="WARN_axisLabelsMode";p(t)||g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"axisLabelsMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="WARN_measureScale";f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth=!0,this.showCategories=!0,this.measureScale="greatest",this.showMeasureScale=!1,this.showOverlayAvg=!0,this.showOverlayMedian=!1,this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this._lastObservedWidth=0,this._settleTimer=null,this._lastAppliedHeight=0,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,n,r,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(n=this.lastAutoScalingReport)||void 0===n?void 0:n.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),h=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=h/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(r=this.unitScaling)&&void 0!==r?r:"")+"").trim())}, auto-fitted to 1 em ≈ ${C(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*h/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${C(e)} percentage points.`}))}},O(this),b(this),y(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=k(this),M(this),this.componentStyle=A(this),this.ruleSetConfig=L(this),this.t=w(this).t,this.resolveInherited=x(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"}],this.errors)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateMeasureScale(this.measureScale),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("bn-chart-time-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,n;const r=parseFloat(null!==(n=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==n?n:"");Number.isNaN(r)||(e=Math.max(e,r),s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}measureContentHeight(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("bn-chart-time-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,n;const r=parseFloat(null!==(n=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("height"))&&void 0!==n?n:"");Number.isNaN(r)||(e+=r,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollHeight):this.element.scrollHeight}checkOverflow(){const t=U(this.element),i=this.measureContentWidth(),e=this.measureContentHeight(),s=t.width>0&&i>t.width+1,a=t.height>0&&e>t.height+1;if(!s&&!a)return void W(this.errors,null);const n=this.prepareVariances().some((t=>t.startsWith("dr"))),r="value"===j(this.unitScaling,this.pixelPerUnitGroupMap).kind,o=n&&"value"===j(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=D(this.scale),h="auto"!==l&&"empty"!==l,d=[];a&&r&&d.push("unit-scaling"),a&&o&&d.push("percentage-scaling"),s&&h&&d.push("scale");const c=[];s&&c.push(`width (${Math.round(i)}px > ${Math.round(t.width)}px)`),a&&c.push(`height (${Math.round(e)}px > ${Math.round(t.height)}px)`),W(this.errors,`Chart exceeds available ${c.join(" and ")}. `+(d.length>0?`Adjust ${d.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container."),d.length>0)}componentDidRender(){q(this.element,"bn-chart-time-renderer");const{mode:t}=D(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{width:s}=U(i);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollWidth,r=this.appliedScaleFactor;if(n<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,r*(s-1)/n);Math.abs(o-r)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=I(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=U(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=U(this.element);this._lastObservedWidth=t,s(this)}))})),this.settleParentHeight()}settleParentHeight(){const t=[150,400,1e3,2500],i=()=>{if(this._settleTimer=null,!this.element.isConnected)return;const{height:e}=U(this.element);e>0&&Math.abs(e-this._lastAppliedHeight)>8&&!this._autoScaleGuard&&s(this);const a=t.shift();void 0!==a&&(this._settleTimer=setTimeout(i,a))};this._settleTimer=setTimeout(i,t.shift())}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null,null!=this._settleTimer&&(clearTimeout(this._settleTimer),this._settleTimer=null)}prepareDimension(){const t=U(this.element),i=this.prepareScenarios(),e=this.prepareVariances();this.canvasWidthSegmented=t.width/(i.length+e.length||1),this._lastAppliedHeight=t.height;const s=1+e.length,a=this.showMeasureScale?this.getEffectiveFontPx():0;return{width:this.canvasWidthSegmented,height:Math.max(0,t.height-a)/s}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(a.inherited)return this.errors.remove("AUTO_scenarios"),a.value.split(",").map((t=>t.trim()));const n="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return p(a.value)||n?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(n||a.unresolved?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=a.value)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareAvg(){return this.showOverlayAvg}prepareMedian(){return this.showOverlayMedian}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return p(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}checkVarianceScenarios(t){const i="WARN_variances_scenario",e=this.prepareScenarios(),s=[];for(const i of t){const t=new _(i);if(t.isValid)for(const a of[t.base,t.delta])e.includes(a)||s.push(`'${i}' needs '${a}'`)}e.length>0&&s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:`variances: ${s.join(", ")}, which is not in scenarios (${e.join(", ")}). The variance has no values.`}):this.errors.remove(i)}prepareHideAxisLabels(t){return t>=1||!this.showCategories}prepareI18n(){const t=l,i=new Map(["no-data"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries(),...N(this.ruleSetConfig("user"))])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=j(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=j(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:i["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:i["bn-chart-time"].scaleFactors.labelToColumn,labelToAxis:i["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:i["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:i["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-time"].scaleFactors.markerWidth,markerOffset:i["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-time"].axisStyles,barStyles:i["bn-chart-time"].barStyles,varianceStyles:i["bn-chart-time"].varianceStyles,stackColors:i["bn-chart-time"].stackColors,padding:i["bn-chart-time"].padding,pattern:null,locale:"de"}}))}prepareLeftSideOffset(t,i){return this.syncSpaceLeft>-1?this.syncSpaceLeft:T.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],t,i)}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareDateInterval(){var t,i,e;const s="auto"===(null===(t=this.dateInterval)||void 0===t?void 0:t.trim().toLowerCase());return p(this.dateInterval)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:"dateInterval: not set, auto-detected: "+this.datasetMeta.suggestedDateInterval}),E[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?E.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),E[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){const t=Number(this.intervalSpanLimit);return t>0?t:28}prepareAxisLabelsMode(){var t;return R[null===(t=this.axisLabelsMode)||void 0===t?void 0:t.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return p(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(p(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===$.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||P.ABSOLUTE,order:t.order||F.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareLineFullWidth(){return this.lineFullWidth}prepareChartMode(){var t;const i=null===(t=this.chartMode)||void 0===t?void 0:t.toLowerCase();return"line"===i?B.LINE:"auto"===i?B.AUTO:B.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(t,i){const e=this.prepareI18n(),s=this.prepareStyle(),n=U(this.element).width,r=this.preparePixelPerUnit(),o=this.preparePixelPerPercentage(),l=this.prepareStackConfig(),h=this.prepareScenarios(),d=(null==l?void 0:l.by)===$.DIMENSIONS?h.slice(0,1):h;return a("bn-chart-time-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:d,variances:[t],hideAxisLabels:this.prepareHideAxisLabels(i),pixelPerUnit:r,pixelPerPercentage:o,reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(e,s),styles:s,i18n:e,dateInterval:this.prepareDateInterval(),intervalSpanLimit:this.prepareIntervalSpanLimit(),axisLabelsMode:this.prepareAxisLabelsMode(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showOverlayAvg:this.prepareAvg(),showOverlayMedian:this.prepareMedian(),showMeasureScale:this.prepareShowMeasureScale(i),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:l,lineFullWidth:this.prepareLineFullWidth(),containerWidth:n,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getBaseline(){return Y(this.element,"bn-chart-time-renderer")}async getLayoutState(t){var i,e,s,a;const n=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",r=G(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,h=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,d=this.prepareVariances(),c=H(this.element,"bn-chart-time-renderer",["base",...d],r,n),p=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("bn-chart-time-renderer"),u={version:z,tag:this.element.localName,id:Z(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:V(this.element,r),em:{fontSizePx:h,appliedScaleFactor:l},regions:c.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==p?void 0:p.scenarios)&&void 0!==a?a:[],variances:d,barCount:c.barCount,chartMode:this.chartMode||void 0,hasNoData:0===c.barCount},diagnostics:X(this.element),scaling:this.resolveScalingInfo(h),baseline:c.baseline};return c.elements&&(u.elements=c.elements),u}resolveScalingInfo(t){var i,e;const s={},a=j(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const n=j(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===n.kind)s.percentageMode="fixed",s.percentagePointsPerEm=n.value,s.percentagePxPerPoint=t/n.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=D(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,n;const r=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":r*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(n=i.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();this.checkVarianceScenarios(i),i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(n,{key:"37085b275bb92d716a31f79f15b9f2517f1c596b",style:e},a("div",{key:"93e9eacc22334da1deed871db640d6fd4aafb153",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],measureScale:[{validateMeasureScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}'}},[1,"bn-chart-time",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],syncSpaceLeft:[2,"sync-space-left"],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],dateInterval:[1,"date-interval"],chartMode:[1,"chart-mode"],maxBars:[2,"max-bars"],stack:[1],scale:[1],intervalSpanLimit:[2,"interval-span-limit"],axisLabelsMode:[1,"axis-labels-mode"],lineFullWidth:[4,"line-full-width"],showCategories:[4,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[4,"show-measure-scale"],showOverlayAvg:[4,"show-overlay-avg"],showOverlayMedian:[4,"show-overlay-median"],measureUnit:[1,"measure-unit"],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],measureScale:[{validateMeasureScale:0}]}]),Q=K,tt=function(){"undefined"!=typeof customElements&&["bn-chart-time","bn-chart-time-renderer"].forEach((t=>{switch(t){case"bn-chart-time":customElements.get(r(t))||customElements.define(r(t),K);break;case"bn-chart-time-renderer":customElements.get(r(t))||J()}}))};export{Q as BnChartTime,tt as defineCustomElement}
1
+ import{p as t,H as i,w as e,f as s,h as a,a as n,t as r}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-DDvWTgk1.js";import{v as h,a as d,n as c,i as p,f as u,h as v,m,o as g,l as f}from"./p-BiSytXUy.js";import{w as y}from"./p-DJUffGeB.js";import{w as b}from"./p-Dq9dG0Kr.js";import{i as S,w,a as x}from"./p-xIWChKGS.js";import{w as O}from"./p-DQl2K2Xl.js";import{w as M}from"./p-DwuXVo2h.js";import{w as A}from"./p-DjPWZfry.js";import{V as _,r as N,F as T}from"./p-CniN8ALm.js";import{w as L}from"./p-D40Am1Ap.js";import{w as k,r as W}from"./p-4vVbchX2.js";import{g as j}from"./p-DD1zlev_.js";import{r as C,f as U,p as D}from"./p-Xb6Ilq8u.js";import{o as I}from"./p-B6kka9sT.js";import{b as R,e as $,f as F,g as P,h as B}from"./p-B5tixDPM.js";import{D as z}from"./p-sLbQ7yZ1.js";import{LAYOUT_STATE_VERSION as E}from"./index.js";import{o as G,m as V}from"./p-DaOm9YwQ.js";import{r as X,a as H}from"./p-CckAR27O.js";import{a as J}from"./p-C2ycO60j.js";import{a as q}from"./p-JofGXz75.js";import{s as Y}from"./p-DakXa7Dp.js";import{d as Z}from"./p-CEf5X8MZ.js";const K=t(class t extends i{validateFilter(t){const i="ERR_filter";o(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="WARN_scenarios";if(S(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="WARN_variances";if(S(t))return void this.errors.remove(i);const e=d(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateLeftSync(t){const i="WARN_syncSpaceLeft";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+t+"' are not supported."})}validateUnitScaling(t){const i="WARN_unitScaling";p(t)?this.errors.remove(i):"invalid"===C(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="WARN_percentageScaling";p(t)?this.errors.remove(i):"invalid"===C(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateDateInterval(t){const i="WARN_dateInterval";p(t)||u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateInterval: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateChartMode(t){const i="WARN_chartMode";["bar","line","auto"].includes(null==t?void 0:t.toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"chartMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(t){const i="WARN_maxBars";!v(t)||t<1?this.errors.addOrReplace({id:i,type:"warning",message:"maxBars: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Must be a positive integer."}):this.errors.remove(i)}validateStack(t){const i="WARN_stack",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("WARN_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"WARN_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("WARN_scale")}validateAxisLabelsMode(t){const i="WARN_axisLabelsMode";p(t)||g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"axisLabelsMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="WARN_measureScale";f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth=!0,this.showCategories=!0,this.measureScale="greatest",this.showMeasureScale=!1,this.showOverlayAvg=!0,this.showOverlayMedian=!1,this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this._lastObservedWidth=0,this._settleTimer=null,this._lastAppliedHeight=0,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,n,r,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(n=this.lastAutoScalingReport)||void 0===n?void 0:n.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),h=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=h/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(r=this.unitScaling)&&void 0!==r?r:"")+"").trim())}, auto-fitted to 1 em ≈ ${U(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*h/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${U(e)} percentage points.`}))}},M(this),b(this),y(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=k(this),O(this),this.componentStyle=A(this),this.ruleSetConfig=L(this),this.t=w(this).t,this.resolveInherited=x(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"}],this.errors)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateMeasureScale(this.measureScale),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("bn-chart-time-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,n;const r=parseFloat(null!==(n=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==n?n:"");Number.isNaN(r)||(e=Math.max(e,r),s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}measureContentHeight(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("bn-chart-time-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,n;const r=parseFloat(null!==(n=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("height"))&&void 0!==n?n:"");Number.isNaN(r)||(e+=r,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollHeight):this.element.scrollHeight}checkOverflow(){const t=j(this.element),i=this.measureContentWidth(),e=this.measureContentHeight(),s=t.width>0&&i>t.width+1,a=t.height>0&&e>t.height+1;if(!s&&!a)return void W(this.errors,null);const n=this.prepareVariances().some((t=>t.startsWith("dr"))),r="value"===C(this.unitScaling,this.pixelPerUnitGroupMap).kind,o=n&&"value"===C(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=D(this.scale),h="auto"!==l&&"empty"!==l,d=[];a&&r&&d.push("unit-scaling"),a&&o&&d.push("percentage-scaling"),s&&h&&d.push("scale");const c=[];s&&c.push(`width (${Math.round(i)}px > ${Math.round(t.width)}px)`),a&&c.push(`height (${Math.round(e)}px > ${Math.round(t.height)}px)`),W(this.errors,`Chart exceeds available ${c.join(" and ")}. `+(d.length>0?`Adjust ${d.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container."),d.length>0)}componentDidRender(){Y(this.element,"bn-chart-time-renderer");const{mode:t}=D(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{width:s}=j(i);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollWidth,r=this.appliedScaleFactor;if(n<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,r*(s-1)/n);Math.abs(o-r)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=I(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=j(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=j(this.element);this._lastObservedWidth=t,s(this)}))})),this.settleParentHeight()}settleParentHeight(){const t=[150,400,1e3,2500],i=()=>{if(this._settleTimer=null,!this.element.isConnected)return;const{height:e}=j(this.element);e>0&&Math.abs(e-this._lastAppliedHeight)>8&&!this._autoScaleGuard&&s(this);const a=t.shift();void 0!==a&&(this._settleTimer=setTimeout(i,a))};this._settleTimer=setTimeout(i,t.shift())}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null,null!=this._settleTimer&&(clearTimeout(this._settleTimer),this._settleTimer=null)}prepareDimension(){const t=j(this.element),i=this.prepareScenarios(),e=this.prepareVariances();this.canvasWidthSegmented=t.width/(i.length+e.length||1),this._lastAppliedHeight=t.height;const s=1+e.length,a=this.showMeasureScale?this.getEffectiveFontPx():0;return{width:this.canvasWidthSegmented,height:Math.max(0,t.height-a)/s}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(a.inherited)return this.errors.remove("AUTO_scenarios"),a.value.split(",").map((t=>t.trim()));const n="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return p(a.value)||n?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(n||a.unresolved?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=a.value)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareAvg(){return this.showOverlayAvg}prepareMedian(){return this.showOverlayMedian}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return p(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}checkVarianceScenarios(t){const i="WARN_variances_scenario",e=this.prepareScenarios(),s=[];for(const i of t){const t=new _(i);if(t.isValid)for(const a of[t.base,t.delta])e.includes(a)||s.push(`'${i}' needs '${a}'`)}e.length>0&&s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:`variances: ${s.join(", ")}, which is not in scenarios (${e.join(", ")}). The variance has no values.`}):this.errors.remove(i)}prepareHideAxisLabels(t){return t>=1||!this.showCategories}prepareI18n(){const t=l,i=new Map(["no-data"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries(),...N(this.ruleSetConfig("user"))])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=C(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=C(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:i["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:i["bn-chart-time"].scaleFactors.labelToColumn,labelToAxis:i["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:i["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:i["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-time"].scaleFactors.markerWidth,markerOffset:i["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-time"].axisStyles,barStyles:i["bn-chart-time"].barStyles,varianceStyles:i["bn-chart-time"].varianceStyles,stackColors:i["bn-chart-time"].stackColors,padding:i["bn-chart-time"].padding,pattern:null,locale:"de"}}))}prepareLeftSideOffset(t,i){return this.syncSpaceLeft>-1?this.syncSpaceLeft:T.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],t,i)}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareDateInterval(){var t,i,e;const s="auto"===(null===(t=this.dateInterval)||void 0===t?void 0:t.trim().toLowerCase());return p(this.dateInterval)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:"dateInterval: not set, auto-detected: "+this.datasetMeta.suggestedDateInterval}),z[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?z.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),z[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){const t=Number(this.intervalSpanLimit);return t>0?t:28}prepareAxisLabelsMode(){var t;return R[null===(t=this.axisLabelsMode)||void 0===t?void 0:t.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return p(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(p(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===$.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||P.ABSOLUTE,order:t.order||F.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareLineFullWidth(){return this.lineFullWidth}prepareChartMode(){var t;const i=null===(t=this.chartMode)||void 0===t?void 0:t.toLowerCase();return"line"===i?B.LINE:"auto"===i?B.AUTO:B.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(t,i){const e=this.prepareI18n(),s=this.prepareStyle(),n=j(this.element).width,r=this.preparePixelPerUnit(),o=this.preparePixelPerPercentage(),l=this.prepareStackConfig(),h=this.prepareScenarios(),d=(null==l?void 0:l.by)===$.DIMENSIONS?h.slice(0,1):h;return a("bn-chart-time-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:d,variances:[t],hideAxisLabels:this.prepareHideAxisLabels(i),pixelPerUnit:r,pixelPerPercentage:o,reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(e,s),styles:s,i18n:e,dateInterval:this.prepareDateInterval(),intervalSpanLimit:this.prepareIntervalSpanLimit(),axisLabelsMode:this.prepareAxisLabelsMode(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showOverlayAvg:this.prepareAvg(),showOverlayMedian:this.prepareMedian(),showMeasureScale:this.prepareShowMeasureScale(i),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:l,lineFullWidth:this.prepareLineFullWidth(),containerWidth:n,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getBaseline(){return q(this.element,"bn-chart-time-renderer")}async getLayoutState(t){var i,e,s,a;const n=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",r=G(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,h=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,d=this.prepareVariances(),c=J(this.element,"bn-chart-time-renderer",["base",...d],r,n),p=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("bn-chart-time-renderer"),u={version:E,tag:this.element.localName,id:H(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:V(this.element,r),em:{fontSizePx:h,appliedScaleFactor:l},regions:c.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==p?void 0:p.scenarios)&&void 0!==a?a:[],variances:d,barCount:c.barCount,chartMode:this.chartMode||void 0,hasNoData:0===c.barCount},diagnostics:X(this.element),scaling:this.resolveScalingInfo(h),baseline:c.baseline};return c.elements&&(u.elements=c.elements),u}resolveScalingInfo(t){var i,e;const s={},a=C(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const n=C(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===n.kind)s.percentageMode="fixed",s.percentagePointsPerEm=n.value,s.percentagePxPerPoint=t/n.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=D(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,n;const r=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":r*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(n=i.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();this.checkVarianceScenarios(i),i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(n,{key:"37085b275bb92d716a31f79f15b9f2517f1c596b",style:e},a("div",{key:"93e9eacc22334da1deed871db640d6fd4aafb153",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],measureScale:[{validateMeasureScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}'}},[1,"bn-chart-time",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],syncSpaceLeft:[2,"sync-space-left"],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],dateInterval:[1,"date-interval"],chartMode:[1,"chart-mode"],maxBars:[2,"max-bars"],stack:[1],scale:[1],intervalSpanLimit:[2,"interval-span-limit"],axisLabelsMode:[1,"axis-labels-mode"],lineFullWidth:[4,"line-full-width"],showCategories:[4,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[4,"show-measure-scale"],showOverlayAvg:[4,"show-overlay-avg"],showOverlayMedian:[4,"show-overlay-median"],measureUnit:[1,"measure-unit"],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],measureScale:[{validateMeasureScale:0}]}]),Q=K,tt=function(){"undefined"!=typeof customElements&&["bn-chart-time","bn-chart-time-renderer"].forEach((t=>{switch(t){case"bn-chart-time":customElements.get(r(t))||customElements.define(r(t),K);break;case"bn-chart-time-renderer":customElements.get(r(t))||Z()}}))};export{Q as BnChartTime,tt as defineCustomElement}
@@ -1 +1 @@
1
- import{B as o,d as s}from"./p-CGySoYRH.js";const p=o,r=s;export{p as BnTableRenderer,r as defineCustomElement}
1
+ import{B as o,d as s}from"./p-DX9_keF-.js";const p=o,r=s;export{p as BnTableRenderer,r as defineCustomElement}