@bino-bi/bn-template-engine 1.0.0-next.45 → 1.0.0-next.46

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 (169) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-8b28c9bd.entry.js → p-16623e0f.entry.js} +1 -1
  3. package/dist/bn-template-engine/p-17970e07.entry.js +1 -0
  4. package/dist/bn-template-engine/{p-48871742.entry.js → p-21930d0a.entry.js} +1 -1
  5. package/dist/bn-template-engine/{p-5a64f90f.entry.js → p-46c46067.entry.js} +1 -1
  6. package/dist/bn-template-engine/p-9caa7f46.entry.js +1 -0
  7. package/dist/bn-template-engine/p-B0MEAsAS.js +1 -0
  8. package/dist/bn-template-engine/{p-qpZjVnX5.js → p-BA-fydUt.js} +1 -1
  9. package/dist/bn-template-engine/p-BEGt_7Hr.js +1 -0
  10. package/dist/bn-template-engine/p-BRO1oW7m.js +1 -0
  11. package/dist/bn-template-engine/{p-DVE0-sOv.js → p-BnzIfgCq.js} +1 -1
  12. package/dist/bn-template-engine/{p-b0dfc113.entry.js → p-b0d528f2.entry.js} +1 -1
  13. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +608 -83
  14. package/dist/cjs/bn-grid.cjs.entry.js +161 -34
  15. package/dist/cjs/bn-image.cjs.entry.js +2 -2
  16. package/dist/cjs/bn-internationalization.cjs.entry.js +2 -2
  17. package/dist/cjs/bn-ruleset.cjs.entry.js +2 -2
  18. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  19. package/dist/cjs/bn-text.cjs.entry.js +3 -3
  20. package/dist/cjs/loader.cjs.js +1 -1
  21. package/dist/cjs/{localFrame-U3Qs0psw.js → localFrame-C27GGom1.js} +1 -1
  22. package/dist/cjs/{withBodyObserver-S-FGHpAX.js → withBodyObserver-B78wzw3f.js} +1 -1
  23. package/dist/cjs/{withHasError-BkBrsCpI.js → withHasError-0hW3-4mr.js} +11 -5
  24. package/dist/cjs/{withStyled-BZb6snOx.js → withStyled-D0hrcfE_.js} +25 -1
  25. package/dist/cjs/{withTranslation-1qTs5Fi7.js → withTranslation-B4WipL_5.js} +2 -2
  26. package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +33 -2
  27. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +112 -16
  28. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +1 -1
  29. package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +3 -3
  30. package/dist/collection/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.js +113 -3
  31. package/dist/collection/components/bn-chart-time/bn-chart-time.js +261 -22
  32. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +221 -12
  33. package/dist/collection/components/bn-chart-time/utils/elements/Axis.js +9 -1
  34. package/dist/collection/components/bn-chart-time/utils/elements/Column.js +10 -4
  35. package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +9 -3
  36. package/dist/collection/components/bn-chart-time/utils/factories/ScenarioFactory.js +2 -2
  37. package/dist/collection/components/bn-chart-time/utils/model/DataPoint.js +9 -6
  38. package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +15 -0
  39. package/dist/collection/components/bn-grid/bn-grid.js +118 -24
  40. package/dist/collection/components/bn-grid/utils/cellLayout.js +55 -9
  41. package/dist/collection/components/bn-layout-card/bn-layout-card.js +4 -2
  42. package/dist/collection/components/bn-layout-page/bn-layout-page.js +23 -1
  43. package/dist/collection/components/bn-title/bn-title-renderer/bn-title-renderer.css +10 -0
  44. package/dist/collection/components/bn-title/bn-title-renderer/bn-title-renderer.js +23 -1
  45. package/dist/collection/components/bn-title/bn-title.js +40 -2
  46. package/dist/collection/stores/componentStyles.js +9 -3
  47. package/dist/collection/stores/internationalization.js +2 -2
  48. package/dist/collection/utils/DateStringFactory.js +19 -0
  49. package/dist/collection/utils/model/DataFormatDigits.js +4 -2
  50. package/dist/collection/utils/model/VarianceScenario.js +13 -0
  51. package/dist/collection/utils/validate.js +4 -0
  52. package/dist/components/bn-annotation-layer.js +1 -1
  53. package/dist/components/bn-annotation-list.js +1 -1
  54. package/dist/components/bn-asset.js +1 -1
  55. package/dist/components/bn-body.js +1 -1
  56. package/dist/components/bn-card.js +1 -1
  57. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  58. package/dist/components/bn-chart-bubble.js +1 -1
  59. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  60. package/dist/components/bn-chart-bullet.js +1 -1
  61. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  62. package/dist/components/bn-chart-scatter.js +1 -1
  63. package/dist/components/bn-chart-structure-renderer.js +1 -1
  64. package/dist/components/bn-chart-structure.js +1 -1
  65. package/dist/components/bn-chart-time-renderer.js +1 -1
  66. package/dist/components/bn-chart-time.js +1 -1
  67. package/dist/components/bn-component-style.js +1 -1
  68. package/dist/components/bn-context.js +1 -1
  69. package/dist/components/bn-dataset.js +1 -1
  70. package/dist/components/bn-datasource.js +1 -1
  71. package/dist/components/bn-footer.js +1 -1
  72. package/dist/components/bn-grid.js +1 -1
  73. package/dist/components/bn-image.js +1 -1
  74. package/dist/components/bn-internationalization.js +1 -1
  75. package/dist/components/bn-layout-card.js +1 -1
  76. package/dist/components/bn-layout-page.js +1 -1
  77. package/dist/components/bn-message.js +1 -1
  78. package/dist/components/bn-page.js +1 -1
  79. package/dist/components/bn-ruleset.js +1 -1
  80. package/dist/components/bn-scaling-group.js +1 -1
  81. package/dist/components/bn-table-renderer.js +1 -1
  82. package/dist/components/bn-table.js +1 -1
  83. package/dist/components/bn-text.js +1 -1
  84. package/dist/components/bn-title-renderer.js +1 -1
  85. package/dist/components/bn-title.js +1 -1
  86. package/dist/components/bn-tree.js +1 -1
  87. package/dist/components/p-9X5fVJqR.js +1 -0
  88. package/dist/components/p-B5GRtTLX.js +1 -0
  89. package/dist/components/{p-DJUffGeB.js → p-BKA15uoz.js} +1 -1
  90. package/dist/components/p-BKLq0Pbv.js +1 -0
  91. package/dist/components/p-BKTBdrEA.js +1 -0
  92. package/dist/components/p-Bd8cQiLx.js +1 -0
  93. package/dist/components/{p-CvEdUq8i.js → p-Be0Q3bvf.js} +1 -1
  94. package/dist/components/{p-xIWChKGS.js → p-Bj3RWsEx.js} +1 -1
  95. package/dist/components/{p-B4L069XF.js → p-BoBamuPt.js} +1 -1
  96. package/dist/components/{p-DaOm9YwQ.js → p-BrJZUp-K.js} +1 -1
  97. package/dist/components/{p-CyfGkLMh.js → p-BuWNCnvR.js} +1 -1
  98. package/dist/components/{p-M2k_I8lv.js → p-CFVoK5Rb.js} +1 -1
  99. package/dist/components/{p-fKJx8WtW.js → p-CgJB5mCu.js} +1 -1
  100. package/dist/components/p-Cxx0YNnl.js +1 -0
  101. package/dist/components/p-D9F5IBFT.js +1 -0
  102. package/dist/components/{p-BfUdaxZ9.js → p-DQFahsnV.js} +1 -1
  103. package/dist/components/p-DROj8gke.js +1 -0
  104. package/dist/components/p-D_Sbhd0L.js +1 -0
  105. package/dist/components/{p-Cel0a6ma.js → p-DbWh9W5D.js} +1 -1
  106. package/dist/components/{p-2eicD9rF.js → p-DkCeSWKR.js} +1 -1
  107. package/dist/components/{p-7ieJFBUk.js → p-DoOSXntC.js} +1 -1
  108. package/dist/components/p-Dxj_pf8s.js +1 -0
  109. package/dist/components/{p-DQl2K2Xl.js → p-DzYhS_9s.js} +1 -1
  110. package/dist/components/{p-B2bvM2Ig.js → p-EQNS13GN.js} +1 -1
  111. package/dist/components/{p-Y9bth2Y_.js → p-G56USTsQ.js} +1 -1
  112. package/dist/components/p-OgFFKehL.js +1 -0
  113. package/dist/components/{p-C2ycO60j.js → p-kvYRImZT.js} +1 -1
  114. package/dist/components/{p-Chuj-LpI.js → p-rEdNIgD8.js} +1 -1
  115. package/dist/components/{p-DwuXVo2h.js → p-uCpFBDF5.js} +1 -1
  116. package/dist/esm/bn-annotation-layer_30.entry.js +608 -83
  117. package/dist/esm/bn-grid.entry.js +161 -34
  118. package/dist/esm/bn-image.entry.js +2 -2
  119. package/dist/esm/bn-internationalization.entry.js +2 -2
  120. package/dist/esm/bn-ruleset.entry.js +2 -2
  121. package/dist/esm/bn-template-engine.js +1 -1
  122. package/dist/esm/bn-text.entry.js +3 -3
  123. package/dist/esm/loader.js +1 -1
  124. package/dist/esm/{localFrame-BNWPPaQa.js → localFrame-CEZ7-hBs.js} +1 -1
  125. package/dist/esm/{withBodyObserver-AHQAUV85.js → withBodyObserver-D9yIMxdr.js} +1 -1
  126. package/dist/esm/{withHasError-B6Lvj9Cq.js → withHasError-UGtkLrYT.js} +11 -5
  127. package/dist/esm/{withStyled-CzzXg64f.js → withStyled-BlMqEIfr.js} +25 -2
  128. package/dist/esm/{withTranslation-C1gL7wSU.js → withTranslation-Bc3bjHTb.js} +2 -2
  129. package/dist/schemas/theme.schema.json +18 -0
  130. package/dist/types/components/bn-annotation-layer/bn-annotation-layer.d.ts +11 -0
  131. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +16 -0
  132. package/dist/types/components/bn-chart-structure/utils/elements/Needle.d.ts +2 -1
  133. package/dist/types/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.d.ts +8 -0
  134. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +46 -1
  135. package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +37 -0
  136. package/dist/types/components/bn-chart-time/utils/elements/Axis.d.ts +2 -0
  137. package/dist/types/components/bn-chart-time/utils/elements/Needle.d.ts +2 -1
  138. package/dist/types/components/bn-chart-time/utils/factories/ScenarioFactory.d.ts +1 -1
  139. package/dist/types/components/bn-chart-time/utils/model/DataPoint.d.ts +6 -1
  140. package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +6 -0
  141. package/dist/types/components/bn-grid/bn-grid.d.ts +23 -0
  142. package/dist/types/components/bn-grid/utils/cellLayout.d.ts +39 -3
  143. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +3 -1
  144. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +9 -0
  145. package/dist/types/components/bn-title/bn-title-renderer/bn-title-renderer.d.ts +2 -0
  146. package/dist/types/components/bn-title/bn-title.d.ts +10 -0
  147. package/dist/types/components.d.ts +173 -6
  148. package/dist/types/stores/componentStyles.d.ts +8 -0
  149. package/dist/types/utils/DateStringFactory.d.ts +4 -0
  150. package/dist/types/utils/layoutState/types.d.ts +3 -0
  151. package/dist/types/utils/model/VarianceScenario.d.ts +2 -0
  152. package/dist/types/utils/validate.d.ts +2 -0
  153. package/package.json +1 -1
  154. package/dist/bn-template-engine/p-1b002bd5.entry.js +0 -1
  155. package/dist/bn-template-engine/p-750b2c82.entry.js +0 -1
  156. package/dist/bn-template-engine/p-D0tNATZq.js +0 -1
  157. package/dist/bn-template-engine/p-DF9sfwBN.js +0 -1
  158. package/dist/bn-template-engine/p-EcC0qLtU.js +0 -1
  159. package/dist/components/p-1B_s8oPY.js +0 -1
  160. package/dist/components/p-AwH1w8Mu.js +0 -1
  161. package/dist/components/p-BiSytXUy.js +0 -1
  162. package/dist/components/p-C3gYq-HU.js +0 -1
  163. package/dist/components/p-CEf5X8MZ.js +0 -1
  164. package/dist/components/p-CniN8ALm.js +0 -1
  165. package/dist/components/p-D40Am1Ap.js +0 -1
  166. package/dist/components/p-DDvWTgk1.js +0 -1
  167. package/dist/components/p-DjPWZfry.js +0 -1
  168. package/dist/components/p-DnDL1pPc.js +0 -1
  169. package/dist/components/p-sLbQ7yZ1.js +0 -1
@@ -1 +1 @@
1
- import{p as t,H as e,h as s,F as r,t as i}from"./p-D6YGOYV1.js";import{g as a}from"./p-DDvWTgk1.js";import{w as n}from"./p-Dq9dG0Kr.js";import{w as o}from"./p-4vVbchX2.js";import{a as l}from"./p-xIWChKGS.js";import{t as d,a as c,b as m,c as h,C as b,d as p}from"./p-Dq4KMCDU.js";import{d as f}from"./p-Chuj-LpI.js";import{d as u}from"./p-2eicD9rF.js";import{d as g}from"./p-fKJx8WtW.js";import{d as y}from"./p-B4L069XF.js";import{d as x}from"./p-C3gYq-HU.js";const v=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.titleImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.footerText="",this.cardLayout="full",this.cardCustomTemplate='"a b" "c d"',this.cardGridGap="0",this.cardFitToContent=!1,this.cardShowBorder=!0,n(this),this.errors=o(this),this.resolveInherited=l(this,[{propName:"titleScenarios",ancestorAttr:"title-scenarios"},{propName:"titleVariances",ancestorAttr:"title-variances"},{propName:"titleOrder",ancestorAttr:"title-order"},{propName:"titleOrderDirection",ancestorAttr:"title-order-direction"},{propName:"ruleset",ancestorAttr:"ruleset"}])}connectedCallback(){this.stores=a(this.element)}getCommonStyles(){let t="100%";return!0===this.cardFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.cardGridGap+"px"}}getGridTemplateColumns(t){return d(this.getTemplatePattern(t))}getRowCount(t){return c(this.getTemplatePattern(t)).length||1}getGridTemplateRows(t){const e=this.getRowCount(t);return this.cardFitToContent?Array(e).fill("auto").join(" "):Array(e).fill("minmax(0, 1fr)").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplatePattern(this.cardLayout),"grid-template-columns":this.getGridTemplateColumns(this.cardLayout),"grid-template-rows":this.getGridTemplateRows(this.cardLayout)})}createDivAreaStyles(t){return t.map((t=>({display:"flex",overflow:"hidden","grid-area":t})))}getSlots(t){const e=this.createDivAreaStyles(t);return s(r,null,e.map(((t,e)=>s("div",{style:t},s("slot",{name:"card-slot-"+e})))))}extractSlotNames(t){return m(t)}getTemplatePattern(t){return h(t,this.cardCustomTemplate)}componentWillRender(){const t=this.cardLayout===b?p(this.cardCustomTemplate):void 0;t?this.errors.addOrReplace({id:"WARN_cardCustomTemplate",type:"warning",message:"cardCustomTemplate: "+t}):this.errors.remove("WARN_cardCustomTemplate")}setCardClass(){return!0===this.cardShowBorder?"card_box border":"card_box"}titleProp(t){return this.resolveInherited(t,this[t],"").value}prepareTitleImage(t){if(null==t||""===t)return"";const e=this.stores.assets.state;return t.startsWith("asset:")?e[t.substring(6)]:e[t]||t}render(){var t;const e=this.getLayoutStyle(),r=this.extractSlotNames(e["grid-template-areas"]);return s("bn-card",{key:"f9d135554b1ab8a8bee9bb4f7084e465e495e180",styles:this.styles,"selected-style":this.selectedStyle,class:this.setCardClass()},s("div",{key:"54766941aa09df561453f620bd2ecd16f9fd3526",class:"cardtitle"},s("bn-title",{key:"ce2dc7bd84943a6b97068441d9da85a150271227","i18n-namespace":null!==(t=this.i18nNamespace)&&void 0!==t?t:this.titleNamespace,ruleset:this.titleProp("ruleset"),"business-unit":this.titleBusinessUnit,scenarios:this.titleProp("titleScenarios"),variances:this.titleProp("titleVariances"),order:this.titleProp("titleOrder"),"order-direction":this.titleProp("titleOrderDirection"),measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),null!=this.titleImage&&""!==this.titleImage?s("img",{class:"image",src:this.prepareTitleImage(this.titleImage)}):""),s("bn-body",{key:"b692bf5149c7c34288b612b7179779030ef2031c"},s("div",{key:"2650ddbbae89f6e63fdeba3f65513446eb22a96f",style:e,"data-bn-fit-content":this.cardFitToContent?this.getRowCount(this.cardLayout)+"":null},this.getSlots(r))),s("bn-footer",{key:"d924118be1d48c4f80b8e6d39f90aa1e2b3a1ff2",text:this.footerText,"page-number":"0","display-page-number":"false"}))}get element(){return this}static get style(){return':host{--bn-baseline-offset-top:0px;--bn-baseline-offset-left:0px;--bn-baseline-offset-right:0px;background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.cardtitle{display:inline-flex}::slotted(*){flex:1 1 auto;min-width:0}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}bn-body{box-sizing:border-box;padding:var(--bn-baseline-offset-top) var(--bn-baseline-offset-right) 0 var(--bn-baseline-offset-left)}'}},[257,"bn-layout-card",{styles:[1],selectedStyle:[1,"selected-style"],ruleset:[1],titleImage:[1,"title-image"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],i18nNamespace:[513,"i18n-namespace"],footerText:[1,"footer-text"],cardLayout:[1,"card-layout"],cardCustomTemplate:[1,"card-custom-template"],cardGridGap:[1,"card-grid-gap"],cardFitToContent:[4,"card-fit-to-content"],cardShowBorder:[4,"card-show-border"]}]),k=v,w=function(){"undefined"!=typeof customElements&&["bn-layout-card","bn-body","bn-card","bn-footer","bn-title","bn-title-renderer"].forEach((t=>{switch(t){case"bn-layout-card":customElements.get(i(t))||customElements.define(i(t),v);break;case"bn-body":customElements.get(i(t))||f();break;case"bn-card":customElements.get(i(t))||u();break;case"bn-footer":customElements.get(i(t))||g();break;case"bn-title":customElements.get(i(t))||y();break;case"bn-title-renderer":customElements.get(i(t))||x()}}))};export{k as BnLayoutCard,w as defineCustomElement}
1
+ import{p as t,H as e,h as s,F as i,t as r}from"./p-D6YGOYV1.js";import{g as a}from"./p-Cxx0YNnl.js";import{w as n}from"./p-Dq9dG0Kr.js";import{w as o}from"./p-9X5fVJqR.js";import{w as l}from"./p-4vVbchX2.js";import{a as d}from"./p-Bj3RWsEx.js";import{t as c,a as m,b as h,c as p,C as f,d as b}from"./p-Dq4KMCDU.js";import{d as u}from"./p-rEdNIgD8.js";import{d as g}from"./p-DkCeSWKR.js";import{d as y}from"./p-CgJB5mCu.js";import{d as x}from"./p-BoBamuPt.js";import{d as v}from"./p-DROj8gke.js";const k=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.titleImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.footerText="",this.cardLayout="full",this.cardCustomTemplate='"a b" "c d"',this.cardGridGap="0",this.cardFitToContent=!1,this.cardShowBorder=!0,n(this),this.errors=l(this),this.componentStyle=o(this),this.resolveInherited=d(this,[{propName:"titleScenarios",ancestorAttr:"title-scenarios"},{propName:"titleVariances",ancestorAttr:"title-variances"},{propName:"titleOrder",ancestorAttr:"title-order"},{propName:"titleOrderDirection",ancestorAttr:"title-order-direction"},{propName:"ruleset",ancestorAttr:"ruleset"}])}connectedCallback(){this.stores=a(this.element)}getCommonStyles(){let t="100%";return!0===this.cardFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.cardGridGap+"px"}}getGridTemplateColumns(t){return c(this.getTemplatePattern(t))}getRowCount(t){return m(this.getTemplatePattern(t)).length||1}getGridTemplateRows(t){const e=this.getRowCount(t);return this.cardFitToContent?Array(e).fill("auto").join(" "):Array(e).fill("minmax(0, 1fr)").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplatePattern(this.cardLayout),"grid-template-columns":this.getGridTemplateColumns(this.cardLayout),"grid-template-rows":this.getGridTemplateRows(this.cardLayout)})}createDivAreaStyles(t){return t.map((t=>({display:"flex",overflow:"hidden","grid-area":t})))}getSlots(t){const e=this.createDivAreaStyles(t);return s(i,null,e.map(((t,e)=>s("div",{style:t},s("slot",{name:"card-slot-"+e})))))}extractSlotNames(t){return h(t)}getTemplatePattern(t){return p(t,this.cardCustomTemplate)}componentWillRender(){const t=this.cardLayout===f?b(this.cardCustomTemplate):void 0;t?this.errors.addOrReplace({id:"WARN_cardCustomTemplate",type:"warning",message:"cardCustomTemplate: "+t}):this.errors.remove("WARN_cardCustomTemplate")}setCardClass(){return!0===this.cardShowBorder?"card_box border":"card_box"}titleProp(t){return this.resolveInherited(t,this[t],"").value}prepareTitleImage(t){if(null==t||""===t)return"";const e=this.stores.assets.state;return t.startsWith("asset:")?e[t.substring(6)]:e[t]||t}render(){var t;const e=this.getLayoutStyle(),i=this.extractSlotNames(e["grid-template-areas"]);return s("bn-card",{key:"3db479047905de01ac517491f2d68a9bd0a3a576",styles:this.styles,"selected-style":this.selectedStyle,class:this.setCardClass()},s("div",{key:"fd9948acd84ce55badf87a7e03d733d1e75a1bea",class:"cardtitle"},s("bn-title",{key:"21200c96fb03d403fa616b093d753ea4b746c6f2","i18n-namespace":null!==(t=this.i18nNamespace)&&void 0!==t?t:this.titleNamespace,ruleset:this.titleProp("ruleset"),"title-font-size":this.componentStyle((t=>{var e;return null===(e=null==t?void 0:t["bn-layout-card"])||void 0===e?void 0:e.titleFontSize})),"business-unit":this.titleBusinessUnit,scenarios:this.titleProp("titleScenarios"),variances:this.titleProp("titleVariances"),order:this.titleProp("titleOrder"),"order-direction":this.titleProp("titleOrderDirection"),measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),null!=this.titleImage&&""!==this.titleImage?s("img",{class:"image",src:this.prepareTitleImage(this.titleImage)}):""),s("bn-body",{key:"c5b1957822ff216d33084154afdf6deb3e4426cc"},s("div",{key:"bc17f6f73825894641f775137eaefd5059a25cf6",style:e,"data-bn-fit-content":this.cardFitToContent?this.getRowCount(this.cardLayout)+"":null},this.getSlots(i))),s("bn-footer",{key:"cfbeba76eaf11358e92002d309cafae19d2525e2",text:this.footerText,"page-number":"0","display-page-number":"false"}))}get element(){return this}static get style(){return':host{--bn-baseline-offset-top:0px;--bn-baseline-offset-left:0px;--bn-baseline-offset-right:0px;background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.cardtitle{display:inline-flex}::slotted(*){flex:1 1 auto;min-width:0}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}bn-body{box-sizing:border-box;padding:var(--bn-baseline-offset-top) var(--bn-baseline-offset-right) 0 var(--bn-baseline-offset-left)}'}},[257,"bn-layout-card",{styles:[1],selectedStyle:[1,"selected-style"],ruleset:[1],titleImage:[1,"title-image"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],i18nNamespace:[513,"i18n-namespace"],footerText:[1,"footer-text"],cardLayout:[1,"card-layout"],cardCustomTemplate:[1,"card-custom-template"],cardGridGap:[1,"card-grid-gap"],cardFitToContent:[4,"card-fit-to-content"],cardShowBorder:[4,"card-show-border"]}]),w=k,C=function(){"undefined"!=typeof customElements&&["bn-layout-card","bn-body","bn-card","bn-footer","bn-title","bn-title-renderer"].forEach((t=>{switch(t){case"bn-layout-card":customElements.get(r(t))||customElements.define(r(t),k);break;case"bn-body":customElements.get(r(t))||u();break;case"bn-card":customElements.get(r(t))||g();break;case"bn-footer":customElements.get(r(t))||y();break;case"bn-title":customElements.get(r(t))||x();break;case"bn-title-renderer":customElements.get(r(t))||v()}}))};export{w as BnLayoutCard,C as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as e,h as s,F as a,a as i,t as r}from"./p-D6YGOYV1.js";import{s as o}from"./p-DM7fwmH4.js";import{w as n}from"./p-Dq9dG0Kr.js";import{w as l}from"./p-4vVbchX2.js";import{a as m,b as d,c as h,t as p,i as c,C as b,d as u}from"./p-Dq4KMCDU.js";import{d as f}from"./p-Chuj-LpI.js";import{d as g}from"./p-fKJx8WtW.js";import{d as y}from"./p-Cel0a6ma.js";import{d as k}from"./p-Y9bth2Y_.js";import{d as v}from"./p-B4L069XF.js";import{d as x}from"./p-C3gYq-HU.js";const j=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.messageText="",this.messageImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.footerDisplayPageNumber=!0,this.pageLayout="full",this.pageCustomTemplate='"a b" "c d"',this.pageGridGap="0",this.pageFitToContent=!1,n(this),this.errors=l(this)}getCommonStyles(){let t="100%";return!0===this.pageFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.pageGridGap+"px"}}getRowCount(t){return m(this.getTemplateAreas(t)).length||1}getGridTemplateRows(t){const e=this.getRowCount(t);return this.pageFitToContent?Array(e).fill("auto").join(" "):Array(e).fill("minmax(0, 1fr)").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplateAreas(this.pageLayout),"grid-template-columns":this.getGridTemplateColumns(this.pageLayout),"grid-template-rows":this.getGridTemplateRows(this.pageLayout)})}createDivAreaStyles(t){return t.map((t=>({display:"flex",overflow:"hidden","grid-area":t})))}getSlots(t){const e=this.createDivAreaStyles(t);return s(a,null,e.map(((t,e)=>s("div",{style:t},s("slot",{name:"slot-"+e})))))}extractSlotNames(t){return d(t)}getTemplateAreas(t){return h(t,this.pageCustomTemplate)}getGridTemplateColumns(t){return c(t)?p(this.getTemplateAreas(t)):"1fr"}mirror(t,e){null==e?this.element.hasAttribute(t)&&this.element.removeAttribute(t):this.element.getAttribute(t)!==e&&this.element.setAttribute(t,e)}componentWillRender(){this.mirror("page-format",this.pageFormat),this.mirror("page-orientation",this.pageOrientation);const t=this.pageLayout===b?u(this.pageCustomTemplate):void 0;t?this.errors.addOrReplace({id:"WARN_pageCustomTemplate",type:"warning",message:"pageCustomTemplate: "+t}):this.errors.remove("WARN_pageCustomTemplate")}rotation(){var t;const e=null===(t=this.element.closest("bn-context"))||void 0===t?void 0:t.getAttribute("render-orientation"),s=o(this.pageFormat,this.pageOrientation,e);if(s.turned)return{host:{width:s.width,height:s.height},page:{transform:"rotate(-90deg) translate(-100%)",transformOrigin:"top left"}}}render(){var t;const e=this.getLayoutStyle(),a=this.extractSlotNames(e["grid-template-areas"]),r=this.rotation();return s(i,{key:"290e6e8250c5f8bf53352886a810eeedd7548e57",style:null==r?void 0:r.host},s("bn-page",{key:"71b472107af79e9581e2097aae33c6b2808decbf",styles:this.styles,"selected-style":this.selectedStyle,format:this.pageFormat,orientation:this.pageOrientation,style:null==r?void 0:r.page},s("bn-message",{key:"99ac5c760476f95ff296077736849e6ddfd85120",text:this.messageText,image:this.messageImage}),s("bn-title",{key:"3af5ee4a7be905676a927397ff19cf062b291fb6","i18n-namespace":null!==(t=this.i18nNamespace)&&void 0!==t?t:this.titleNamespace,ruleset:this.ruleset,"business-unit":this.titleBusinessUnit,scenarios:this.titleScenarios,variances:this.titleVariances,order:this.titleOrder,"order-direction":this.titleOrderDirection,measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),s("bn-body",{key:"c91e9c708934499b855fe9e321bebb7aed31ab7c"},s("div",{key:"92d01a4bad8ae401e570fcee4a9bbdac42b31d81",style:e,"data-bn-fit-content":this.pageFitToContent?this.getRowCount(this.pageLayout)+"":null},this.getSlots(a)),s("slot",{key:"ac227c5985b827e91d139396915e3a104e44710b",name:"annotations"})),s("bn-footer",{key:"41dfc75b74a158a0e7cdb05456b03ae62cf6d6db",text:this.footerText,"page-number":this.pageNumber,"display-page-number":this.footerDisplayPageNumber})))}get element(){return this}static get style(){return':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;overflow:hidden}::slotted(*){flex:1 1 auto;min-width:0}'}},[257,"bn-layout-page",{styles:[1],selectedStyle:[1,"selected-style"],ruleset:[1],messageText:[1,"message-text"],messageImage:[1,"message-image"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],i18nNamespace:[513,"i18n-namespace"],pageFormat:[1,"page-format"],pageOrientation:[1,"page-orientation"],pageNumber:[1,"page-number"],footerText:[1,"footer-text"],footerDisplayPageNumber:[4,"footer-display-page-number"],pageLayout:[1,"page-layout"],pageCustomTemplate:[1,"page-custom-template"],pageGridGap:[1,"page-grid-gap"],pageFitToContent:[4,"page-fit-to-content"]}]),w=j,C=function(){"undefined"!=typeof customElements&&["bn-layout-page","bn-body","bn-footer","bn-message","bn-page","bn-title","bn-title-renderer"].forEach((t=>{switch(t){case"bn-layout-page":customElements.get(r(t))||customElements.define(r(t),j);break;case"bn-body":customElements.get(r(t))||f();break;case"bn-footer":customElements.get(r(t))||g();break;case"bn-message":customElements.get(r(t))||y();break;case"bn-page":customElements.get(r(t))||k();break;case"bn-title":customElements.get(r(t))||v();break;case"bn-title-renderer":customElements.get(r(t))||x()}}))};export{w as BnLayoutPage,C as defineCustomElement}
1
+ import{p as t,H as e,h as s,F as a,a as i,t as r}from"./p-D6YGOYV1.js";import{s as o}from"./p-DM7fwmH4.js";import{w as n}from"./p-Dq9dG0Kr.js";import{w as l}from"./p-4vVbchX2.js";import{a as m,b as d,c as h,t as c,i as p,C as u,d as b}from"./p-Dq4KMCDU.js";import{d as g}from"./p-rEdNIgD8.js";import{d as f}from"./p-CgJB5mCu.js";import{d as y}from"./p-DbWh9W5D.js";import{d as k}from"./p-G56USTsQ.js";import{d as v}from"./p-BoBamuPt.js";import{d as D}from"./p-DROj8gke.js";const x=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.messageText="",this.messageImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.footerDisplayPageNumber=!0,this.pageLayout="full",this.pageCustomTemplate='"a b" "c d"',this.pageGridGap="0",this.pageFitToContent=!1,n(this),this.errors=l(this)}getCommonStyles(){let t="100%";return!0===this.pageFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.pageGridGap+"px"}}getRowCount(t){return m(this.getTemplateAreas(t)).length||1}getGridTemplateRows(t){const e=this.getRowCount(t);return this.pageFitToContent?Array(e).fill("auto").join(" "):Array(e).fill("minmax(0, 1fr)").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplateAreas(this.pageLayout),"grid-template-columns":this.getGridTemplateColumns(this.pageLayout),"grid-template-rows":this.getGridTemplateRows(this.pageLayout)})}createDivAreaStyles(t){return t.map((t=>({display:"flex",overflow:"hidden","grid-area":t})))}getSlots(t){const e=this.createDivAreaStyles(t);return s(a,null,e.map(((t,e)=>s("div",{style:t},s("slot",{name:"slot-"+e})))))}extractSlotNames(t){return d(t)}getTemplateAreas(t){return h(t,this.pageCustomTemplate)}getGridTemplateColumns(t){return p(t)?c(this.getTemplateAreas(t)):"1fr"}mirror(t,e){null==e?this.element.hasAttribute(t)&&this.element.removeAttribute(t):this.element.getAttribute(t)!==e&&this.element.setAttribute(t,e)}componentWillRender(){this.mirror("page-format",this.pageFormat),this.mirror("page-orientation",this.pageOrientation);const t=this.pageLayout===u?b(this.pageCustomTemplate):void 0;t?this.errors.addOrReplace({id:"WARN_pageCustomTemplate",type:"warning",message:"pageCustomTemplate: "+t}):this.errors.remove("WARN_pageCustomTemplate")}rotation(){var t;const e=null===(t=this.element.closest("bn-context"))||void 0===t?void 0:t.getAttribute("render-orientation"),s=o(this.pageFormat,this.pageOrientation,e);if(s.turned)return{host:{width:s.width,height:s.height},page:{transform:"rotate(-90deg) translate(-100%)",transformOrigin:"top left"}}}render(){var t;const e=this.getLayoutStyle(),a=this.extractSlotNames(e["grid-template-areas"]),r=this.rotation();return s(i,{key:"2ec4b279578c40e0aa56ec89ede269abb4d2951b",style:null==r?void 0:r.host},s("bn-page",{key:"fae96a429fad331f28fdf69e5036e6857db866c6",styles:this.styles,"selected-style":this.selectedStyle,format:this.pageFormat,orientation:this.pageOrientation,style:null==r?void 0:r.page},s("bn-message",{key:"17e10377a10a257417acc50460cc2a66e1010abd",text:this.messageText,image:this.messageImage}),s("bn-title",{key:"3149bfdb60c2782c65a3c956fe15d291b2748327","i18n-namespace":null!==(t=this.i18nNamespace)&&void 0!==t?t:this.titleNamespace,ruleset:this.ruleset,"title-id":this.titleId,"business-unit":this.titleBusinessUnit,scenarios:this.titleScenarios,variances:this.titleVariances,order:this.titleOrder,"order-direction":this.titleOrderDirection,measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),s("bn-body",{key:"8ef72077b8656469db320af429a1226453866558"},s("div",{key:"99b22034f2c6edbe7e25e1a3cb6873f2af287178",style:e,"data-bn-fit-content":this.pageFitToContent?this.getRowCount(this.pageLayout)+"":null},this.getSlots(a)),s("slot",{key:"918b8f2c8991d801a0033748f37250500cf2d2e9",name:"annotations"})),s("bn-footer",{key:"a77e27405f7fbc68c90a95c563628ddc2d708e02",text:this.footerText,"page-number":this.pageNumber,"display-page-number":this.footerDisplayPageNumber})))}get element(){return this}static get style(){return':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;overflow:hidden}::slotted(*){flex:1 1 auto;min-width:0}'}},[257,"bn-layout-page",{styles:[1],selectedStyle:[1,"selected-style"],ruleset:[1],messageText:[1,"message-text"],messageImage:[1,"message-image"],titleId:[1,"title-id"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],i18nNamespace:[513,"i18n-namespace"],pageFormat:[1,"page-format"],pageOrientation:[1,"page-orientation"],pageNumber:[1,"page-number"],footerText:[1,"footer-text"],footerDisplayPageNumber:[4,"footer-display-page-number"],pageLayout:[1,"page-layout"],pageCustomTemplate:[1,"page-custom-template"],pageGridGap:[1,"page-grid-gap"],pageFitToContent:[4,"page-fit-to-content"]}]),j=x,w=function(){"undefined"!=typeof customElements&&["bn-layout-page","bn-body","bn-footer","bn-message","bn-page","bn-title","bn-title-renderer"].forEach((t=>{switch(t){case"bn-layout-page":customElements.get(r(t))||customElements.define(r(t),x);break;case"bn-body":customElements.get(r(t))||g();break;case"bn-footer":customElements.get(r(t))||f();break;case"bn-message":customElements.get(r(t))||y();break;case"bn-page":customElements.get(r(t))||k();break;case"bn-title":customElements.get(r(t))||v();break;case"bn-title-renderer":customElements.get(r(t))||D()}}))};export{j as BnLayoutPage,w as defineCustomElement}
@@ -1 +1 @@
1
- import{F as a,d as o}from"./p-Cel0a6ma.js";const s=a,m=o;export{s as BnMessage,m as defineCustomElement}
1
+ import{F as o,d as s}from"./p-DbWh9W5D.js";const p=o,r=s;export{p as BnMessage,r as defineCustomElement}
@@ -1 +1 @@
1
- import{P as o,d as s}from"./p-Y9bth2Y_.js";const t=o,p=s;export{t as BnPage,p as defineCustomElement}
1
+ import{P as s,d as o}from"./p-G56USTsQ.js";const p=s,r=o;export{p as BnPage,r as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as s,h as e,a as r,t as o}from"./p-D6YGOYV1.js";import{w as i}from"./p-Do4oPrkE.js";import{g as n}from"./p-DDvWTgk1.js";import{w as c}from"./p-Dq9dG0Kr.js";import{w as m}from"./p-4vVbchX2.js";const a=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.name="_default",c(this),this.errors=m(this),i(this,(t=>{this.stores||(this.stores=n(this.element));try{const s=JSON.parse(t);this.stores.ruleSets.set(this.name,s),this.errors.remove("ERR_body")}catch(t){this.errors.addOrReplace({id:"ERR_body",type:"error",message:"bn-ruleset: Failed to parse JSON body - "+t.message}),console.error(t)}}))}render(){return e(r,{key:"de03c25692178ed0f97c1e0d914396cba7c53cc3"})}get element(){return this}static get style(){return"bn-ruleset{display:none}"}},[0,"bn-ruleset",{name:[1]}]),p=a,h=function(){"undefined"!=typeof customElements&&["bn-ruleset"].forEach((t=>{"bn-ruleset"===t&&(customElements.get(o(t))||customElements.define(o(t),a))}))};export{p as BnRuleset,h as defineCustomElement}
1
+ import{p as t,H as s,h as e,a as r,t as o}from"./p-D6YGOYV1.js";import{w as n}from"./p-Do4oPrkE.js";import{g as i}from"./p-Cxx0YNnl.js";import{w as c}from"./p-Dq9dG0Kr.js";import{w as m}from"./p-4vVbchX2.js";const a=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.name="_default",c(this),this.errors=m(this),n(this,(t=>{this.stores||(this.stores=i(this.element));try{const s=JSON.parse(t);this.stores.ruleSets.set(this.name,s),this.errors.remove("ERR_body")}catch(t){this.errors.addOrReplace({id:"ERR_body",type:"error",message:"bn-ruleset: Failed to parse JSON body - "+t.message}),console.error(t)}}))}render(){return e(r,{key:"de03c25692178ed0f97c1e0d914396cba7c53cc3"})}get element(){return this}static get style(){return"bn-ruleset{display:none}"}},[0,"bn-ruleset",{name:[1]}]),p=a,h=function(){"undefined"!=typeof customElements&&["bn-ruleset"].forEach((t=>{"bn-ruleset"===t&&(customElements.get(o(t))||customElements.define(o(t),a))}))};export{p as BnRuleset,h as defineCustomElement}
@@ -1 +1 @@
1
- import{p as e,H as i,h as s,a as t,t as n}from"./p-D6YGOYV1.js";import{g as a}from"./p-DDvWTgk1.js";import{a as r,f as o}from"./p-Xb6Ilq8u.js";import{w as u}from"./p-Dq9dG0Kr.js";import{w as h}from"./p-4vVbchX2.js";const l=e(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),u(this),this.errors=h(this)}connectedCallback(){this.stores=a(this.element),this.pushToStore()}disconnectedCallback(){this.removeEntryIfOurs(this.storedName)}onNameChange(e,i){const s=null==i?void 0:(""+i).trim();s&&s!==(null==e?void 0:(""+e).trim())&&this.removeEntryIfOurs(s),this.pushToStore()}onValueChange(){this.pushToStore()}removeEntryIfOurs(e){e&&this.stores&&(this.storedName===e&&this.stores.scalingGroups.state[e]===this.storedValue&&this.stores.scalingGroups.set(e,void 0),this.storedName===e&&(this.storedName=void 0,this.storedValue=void 0))}pushToStore(){var e;if(!this.stores)return;const i=null===(e=this.name)||void 0===e?void 0:(""+e).trim(),s=r(i);if("auto"===s.kind)return void this.errors.addOrReplace({id:"WARN_reserved_name",type:"warning",message:'bn-scaling-group: name "auto" is reserved and cannot be used.'});if(this.errors.remove("WARN_reserved_name"),!i)return void this.errors.addOrReplace({id:"WARN_empty_name",type:"warning",message:"bn-scaling-group: name is required."});if(this.errors.remove("WARN_empty_name"),"number"===s.kind)return void this.errors.addOrReplace({id:"WARN_numeric_name",type:"warning",message:`bn-scaling-group: name "${i}" is not allowed - it would be ambiguous with a numeric scaling value.`});this.errors.remove("WARN_numeric_name");const t=r(this.value);if("number"!==t.kind)return void this.errors.addOrReplace({id:"WARN_invalid_value",type:"warning",message:`bn-scaling-group: invalid value "${this.value}" - must be a positive number, optionally with k/M/G/T suffix.`});this.errors.remove("WARN_invalid_value");const n=this.stores.scalingGroups.state[i];void 0===n||n===t.value||this.storedName===i&&this.storedValue===n?this.errors.remove("WARN_duplicate_group"):this.errors.addOrReplace({id:"WARN_duplicate_group",type:"warning",message:`bn-scaling-group: "${i}" is already registered with a different value (${o(n)}); overwriting.`}),this.storedName&&this.storedName!==i&&this.removeEntryIfOurs(this.storedName),this.stores.scalingGroups.set(i,t.value),this.storedName=i,this.storedValue=t.value}render(){return s(t,{key:"db1fe7bbe3d3caf76ad32eac64f944eef10b1ccd"})}get element(){return this}static get watchers(){return{name:[{onNameChange:0}],value:[{onValueChange:0}]}}static get style(){return"bn-scaling-group{display:none}"}},[0,"bn-scaling-group",{name:[1],value:[8]},void 0,{name:[{onNameChange:0}],value:[{onValueChange:0}]}]),m=l,d=function(){"undefined"!=typeof customElements&&["bn-scaling-group"].forEach((e=>{"bn-scaling-group"===e&&(customElements.get(n(e))||customElements.define(n(e),l))}))};export{m as BnScalingGroup,d as defineCustomElement}
1
+ import{p as e,H as i,h as s,a as t,t as n}from"./p-D6YGOYV1.js";import{g as a}from"./p-Cxx0YNnl.js";import{a as r,f as o}from"./p-Xb6Ilq8u.js";import{w as u}from"./p-Dq9dG0Kr.js";import{w as h}from"./p-4vVbchX2.js";const l=e(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),u(this),this.errors=h(this)}connectedCallback(){this.stores=a(this.element),this.pushToStore()}disconnectedCallback(){this.removeEntryIfOurs(this.storedName)}onNameChange(e,i){const s=null==i?void 0:(""+i).trim();s&&s!==(null==e?void 0:(""+e).trim())&&this.removeEntryIfOurs(s),this.pushToStore()}onValueChange(){this.pushToStore()}removeEntryIfOurs(e){e&&this.stores&&(this.storedName===e&&this.stores.scalingGroups.state[e]===this.storedValue&&this.stores.scalingGroups.set(e,void 0),this.storedName===e&&(this.storedName=void 0,this.storedValue=void 0))}pushToStore(){var e;if(!this.stores)return;const i=null===(e=this.name)||void 0===e?void 0:(""+e).trim(),s=r(i);if("auto"===s.kind)return void this.errors.addOrReplace({id:"WARN_reserved_name",type:"warning",message:'bn-scaling-group: name "auto" is reserved and cannot be used.'});if(this.errors.remove("WARN_reserved_name"),!i)return void this.errors.addOrReplace({id:"WARN_empty_name",type:"warning",message:"bn-scaling-group: name is required."});if(this.errors.remove("WARN_empty_name"),"number"===s.kind)return void this.errors.addOrReplace({id:"WARN_numeric_name",type:"warning",message:`bn-scaling-group: name "${i}" is not allowed - it would be ambiguous with a numeric scaling value.`});this.errors.remove("WARN_numeric_name");const t=r(this.value);if("number"!==t.kind)return void this.errors.addOrReplace({id:"WARN_invalid_value",type:"warning",message:`bn-scaling-group: invalid value "${this.value}" - must be a positive number, optionally with k/M/G/T suffix.`});this.errors.remove("WARN_invalid_value");const n=this.stores.scalingGroups.state[i];void 0===n||n===t.value||this.storedName===i&&this.storedValue===n?this.errors.remove("WARN_duplicate_group"):this.errors.addOrReplace({id:"WARN_duplicate_group",type:"warning",message:`bn-scaling-group: "${i}" is already registered with a different value (${o(n)}); overwriting.`}),this.storedName&&this.storedName!==i&&this.removeEntryIfOurs(this.storedName),this.stores.scalingGroups.set(i,t.value),this.storedName=i,this.storedValue=t.value}render(){return s(t,{key:"db1fe7bbe3d3caf76ad32eac64f944eef10b1ccd"})}get element(){return this}static get watchers(){return{name:[{onNameChange:0}],value:[{onValueChange:0}]}}static get style(){return"bn-scaling-group{display:none}"}},[0,"bn-scaling-group",{name:[1],value:[8]},void 0,{name:[{onNameChange:0}],value:[{onValueChange:0}]}]),m=l,d=function(){"undefined"!=typeof customElements&&["bn-scaling-group"].forEach((e=>{"bn-scaling-group"===e&&(customElements.get(n(e))||customElements.define(n(e),l))}))};export{m as BnScalingGroup,d as defineCustomElement}
@@ -1 +1 @@
1
- import{B as o,d as s}from"./p-B2bvM2Ig.js";const p=o,r=s;export{p as BnTableRenderer,r as defineCustomElement}
1
+ import{B as o,d as s}from"./p-EQNS13GN.js";const p=o,r=s;export{p as BnTableRenderer,r as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as i,w as e,h as a,a as s,t as r,f as n}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-DDvWTgk1.js";import{v as h,a as d,i as p,p as u,q as c,r as v,s as m,h as g,t as f,u as y,w as b,x as S,c as w,y as O,l as A,z as T,A as D,f as N,B as W}from"./p-BiSytXUy.js";import{w as _}from"./p-DJUffGeB.js";import{w as C}from"./p-Dq9dG0Kr.js";import{w as P}from"./p-DQl2K2Xl.js";import{w as M,a as R,i as F}from"./p-xIWChKGS.js";import{w as x}from"./p-DwuXVo2h.js";import{w as I}from"./p-DjPWZfry.js";import{r as j}from"./p-CniN8ALm.js";import{w as U}from"./p-D40Am1Ap.js";import{w as k,r as B}from"./p-4vVbchX2.js";import{g as G}from"./p-Dsvjkuy3.js";import{f as L,r as E,p as J}from"./p-Xb6Ilq8u.js";import{o as $}from"./p-B6kka9sT.js";import{D as z,I as V,d as X,M as Y,B as q,T as K}from"./p-B5tixDPM.js";import{T as Q,a as Z,p as H}from"./p-BZXiWkDS.js";import{I as tt,a as it,d as et,c as at}from"./p-B2bvM2Ig.js";import{a as st,n as rt}from"./p-16rjcQ0t.js";import{LAYOUT_STATE_VERSION as nt}from"./index.js";import{o as ot,m as lt}from"./p-DaOm9YwQ.js";import{r as ht,a as dt}from"./p-CckAR27O.js";import{b as pt}from"./p-JofGXz75.js";import{s as ut}from"./p-DakXa7Dp.js";const ct=t(class extends 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(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.layoutObserver=null,this._lastScaledParentWidth=0,this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.hasBlankSetnames=!1,this.hasSetnameIndexWithoutSetname=!1,this.sumTitle="",this.filter="",this.measureUnit="",this.barColumnWidth="w10",this.unitScaling="100",this.percentageScaling="2",this.pixelPerUnitGroupMap=new Map,this.dataFormat="decimal",this.grouped=!1,this.showMeasureScale=!1,this.showGroupTitle=!0,this.runningSum=!1,this.varianceWaterfall=!1,this.type="list",this.limit=0,this.thereof="[]",this.thereofPosition="below",this.partof="[]",this.order="category",this.orderDirection="asc",this.measureType="volume",this.measureScale="greatest",this.dataFormatDigitsDecimal=1,this.dataFormatDigitsPercent=2,this.categoryWidth="w15",this.columnthereof=null,this.interval="none",this.categoryIntervalPosition=0,this.tableAttributes="",this._autoScaleGuard=!1,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=t=>{var i,e,a,s;this.lastAutoScalingReport={unit:null!==(i=t.unit)&&void 0!==i?i:null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.unit,percentage:null!==(a=t.percentage)&&void 0!==a?a:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.percentage};const r=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t);if(void 0!==t.unit&&t.unit>0&&this.autoUnitWarningActive){const i=1/t.unit;r(i,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=i,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: invalid value "${this.unitScaling}" - auto-fitted to 1 em ≈ ${L(i)} units.`}))}if(void 0!==t.percentage&&t.percentage>0&&this.autoPctWarningActive){const i=1/t.percentage;r(i,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=i,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: invalid value "${this.percentageScaling}" - auto-fitted to 1 em ≈ ${L(i)} percentage points.`}))}},x(this),C(this),this.errors=k(this),P(this),this.componentStyle=I(this),this.ruleSetConfig=U(this),_(this,((t,i)=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1,this.hasBlankSetnames=Array.isArray(i)&&i.some((t=>{var i;return p(null!==(i=null==t?void 0:t.setname)&&void 0!==i?i:null==t?void 0:t.setName)})),this.hasSetnameIndexWithoutSetname=Array.isArray(i)&&i.some((t=>{var i,e;return void 0!==at(null!==(i=null==t?void 0:t.setnameIndex)&&void 0!==i?i:null==t?void 0:t.setNameIndex)&&p(null!==(e=null==t?void 0:t.setname)&&void 0!==e?e:null==t?void 0:t.setName)}))}),((t,i)=>{this.datasetMeta=i})),this.t=M(this).t,this.resolveInherited=R(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}],this.errors)}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(F(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) '"+(null==e?void 0:""+e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="WARN_variances";if(F(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)}validateBarColumns(t){const i="WARN_barColumns";if(p(t))return void this.errors.remove(i);const e=u(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"barColumns: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateBarColumnWidth(t){const i="WARN_barColumnWidth";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"barColumnWidth: invalid value '"+t+"' is not supported."})}validateUnitScaling(t){const i="WARN_unitScaling";"invalid"===E(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value '"+t+"' is not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="WARN_percentageScaling";"invalid"===E(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value '"+t+"' is not supported."}):this.errors.remove(i)}validateDataFormat(t){const i="WARN_dataFormat";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormat: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateType(t){const i="WARN_type";m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"type: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateLimit(t){const i="WARN_limit";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateThereOf(t){const i="WARN_thereof",e=f(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"ThereOf: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateThereofPosition(t){const i="WARN_thereofPosition";p(t)||y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"thereofPosition: invalid value '"+t+"' is not supported."})}validatePartOf(t){const i="WARN_partof",e=b(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"partof: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderList(t){const i="WARN_order";if(F(t))return void this.errors.remove(i);const e=S(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";F(t)||w(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureType(t){const i="WARN_measureType";O(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureType: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="WARN_measureScale";A(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateDataFormatDigitsDecimal(t){const i="WARN_dataFormatDigitsDecimal";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormatDigitsDecimal: invalid value(s) '"+t+"' are not supported."})}validateDateFormatDigitsPercent(t){const i="WARN_dataFormatDigitsPercent";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormatDigitsPercent: invalid value(s) '"+t+"' are not supported."})}validateCategoryWidth(t){const i="WARN_categoryWidth";T(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"categoryWidth: invalid value(s) '"+t+"' are not supported."})}validateColumnThereOf(t){const i=D(t),e="WARN_columnthereof";i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"columnthereof: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(e)}validateInterval(t){const i="WARN_interval",e=null==t?void 0:t.trim().toLowerCase();p(t)||e===tt||e===it||N(e)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"interval: invalid value '"+t+"' is not supported."})}validateCategoryIntervalPosition(t){const i="WARN_categoryIntervalPosition";p(t)||g(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"categoryIntervalPosition: invalid value '"+t+"' is not supported."})}validateTableAttributes(t){const i="WARN_attributes",e=W(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"attributes: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateDataFormat(this.dataFormat),this.validateType(this.type),this.validateLimit(this.limit),this.validateThereOf(this.thereof),this.validateThereofPosition(this.thereofPosition),this.validatePartOf(this.partof),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal),this.validateDateFormatDigitsPercent(this.dataFormatDigitsPercent),this.validateCategoryWidth(this.categoryWidth),this.validateMeasureType(this.measureType),this.validateMeasureScale(this.measureScale),this.validateColumnThereOf(this.columnthereof),this.validateInterval(this.interval),this.validateCategoryIntervalPosition(this.categoryIntervalPosition),this.validateTableAttributes(this.tableAttributes),this.validateBarColumns(this.barColumns),this.validateBarColumnWidth(this.barColumnWidth),this.validateUnitScaling(this.unitScaling),this.validatePercentageScaling(this.percentageScaling),this.validateScaling(this.scale)}componentDidLoad(){this.layoutObserver=$(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=G(this.element);t>0&&Math.abs(t-this._lastScaledParentWidth)>2&&(this._lastScaledParentWidth=t,n(this))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}componentDidRender(){ut(this.element,"bn-table-renderer");const{mode:t}=J(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:a}=G(i);if(a<=0)return void this.checkOverflow();this._lastScaledParentWidth=a;const s=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollWidth,n=this.appliedScaleFactor;if(r<=a+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(a-1)/r);Math.abs(o-n)<.001||(i.style.setProperty("--bn-font-size",s*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled table by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}checkOverflow(){const t=G(this.element),i=this.element.scrollWidth,e=this.element.scrollHeight,a=t.width>0&&i>t.width+1,s=t.height>0&&e>t.height+1;if(!a&&!s)return void B(this.errors,null);const{mode:r}=J(this.scale),n="auto"!==r&&"empty"!==r,o=[];a&&o.push(`width (${Math.round(i)}px > ${Math.round(t.width)}px)`),s&&o.push(`height (${Math.round(e)}px > ${Math.round(t.height)}px)`),B(this.errors,`Table exceeds available ${o.join(" and ")}. Give the component more space, reduce rows (e.g. limit), or set a smaller scale.`,n)}prepareDataFormat(){var t;return z[null===(t=this.dataFormat)||void 0===t?void 0:t.toUpperCase()]}prepareGrouped(){return this.grouped}prepareShowGroupTitle(){return this.showGroupTitle}prepareThereofPosition(){var t;return(null===(t=this.thereofPosition)||void 0===t?void 0:t.toLowerCase())===Q.ABOVE?Q.ABOVE:Q.BELOW}prepareTableType(){var t;return Z[null===(t=this.type)||void 0===t?void 0:t.toUpperCase()]}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareThereOf(){if(null==this.thereof||""===this.thereof.trim())return[];try{return JSON.parse(this.thereof)}catch(t){return[]}}preparePartOf(){if(null==this.partof||""===this.partof.trim())return[];try{return JSON.parse(this.partof)}catch(t){return[]}}prepareOrder(){var t;const i=this.resolveInherited("order",this.order,"category").value,e=this.resolveInherited("orderDirection",this.orderDirection,"asc").value,a="auto"===(null==i?void 0:i.trim().toLowerCase());let s=i;return a&&(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)&&(s=this.datasetMeta.suggestedOrder),{hierarchy:s.split(",").map((t=>rt(t))),direction:st[null==e?void 0:e.toUpperCase()]}}prepareI18nMode(){return V.META}prepareI18n(){const t=l,i=new Map(["in","category","operation","thereof","part_of","SUM_TOTAL","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(),...j(this.ruleSetConfig("user"))])}prepareDataFormatDigits(){return{percent:this.dataFormatDigitsPercent,decimal:this.dataFormatDigitsDecimal}}prepareScenarios(){var t,i,e,a,s,r,n,o,l,h,d;const u=this.resolveInherited("scenarios",this.scenarios),c=this.resolveInherited("variances",this.variances);if(u.inherited||c.inherited){this.errors.remove("AUTO_scenarios");let a=[];return p(u.value)?u.unresolved&&(a=a.concat(null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[])):a=a.concat(u.value.split(",")),(null===(e=c.value)||void 0===e?void 0:e.trim().length)>0&&(a=a.concat(c.value.split(","))),a.map((t=>t.trim()))}const v="auto"===(null===(a=u.value)||void 0===a?void 0:a.trim().toLowerCase()),m=v||u.unresolved;if((p(u.value)||v)&&p(c.value))return(null===(r=null===(s=this.datasetMeta)||void 0===s?void 0:s.availableScenarios)||void 0===r?void 0:r.length)>0?(m?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):[];let g=[];return v||p(u.value)?(null===(o=null===(n=this.datasetMeta)||void 0===n?void 0:n.availableScenarios)||void 0===o?void 0:o.length)>0&&(m?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),g=g.concat(this.datasetMeta.availableScenarios)):(this.errors.remove("AUTO_scenarios"),g=g.concat(null===(l=u.value)||void 0===l?void 0:l.split(","))),(null===(h=c.value)||void 0===h?void 0:h.trim().length)>0&&(g=g.concat(null===(d=c.value)||void 0===d?void 0:d.split(","))),g.map((t=>t.trim()))}prepareCategoryWidth(){var t;return p(this.categoryWidth)?X.INF:X[null===(t=this.categoryWidth)||void 0===t?void 0:t.toUpperCase()]}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"}prepareMeasureType(){var t;return p(this.measureType)?Y.VOLUME:Y[null===(t=this.measureType)||void 0===t?void 0:t.toUpperCase()]}prepareColumnThereOf(){if(null==this.columnthereof||""===this.columnthereof.trim())return new Map;const t=new Map;try{const i=JSON.parse(this.columnthereof);for(const[e,a]of Object.entries(i))!1===t.has(a.scenario)&&t.set(a.scenario,[]),t.get(a.scenario).push(a)}catch(t){return new Map}return t}prepareInterval(){var t;const i="WARN_intervalConflict",e="WARN_intervalNoDate",a="WARN_intervalSetname",s="WARN_intervalSetnameIndex",r=p(this.interval)?tt:this.interval.trim().toLowerCase();return r!==tt&&r!==it&&!N(r)||r===tt?(this.errors.remove(i),this.errors.remove(e),this.errors.remove(a),this.errors.remove(s),tt):null!=this.columnthereof&&""!==this.columnthereof.trim()?(this.errors.addOrReplace({id:i,type:"warning",message:"interval: cannot be combined with columnthereof, interval is ignored."}),this.errors.remove(e),this.errors.remove(a),this.errors.remove(s),tt):(this.errors.remove(i),r===it?(this.hasBlankSetnames?this.errors.addOrReplace({id:a,type:"warning",message:"interval: rows with blank setname found, they are grouped under '-'."}):this.errors.remove(a),this.hasSetnameIndexWithoutSetname?this.errors.addOrReplace({id:s,type:"warning",message:"interval: rows with setnameIndex but blank setname found, setnameIndex needs setname."}):this.errors.remove(s),this.errors.remove(e),it):(this.errors.remove(a),this.errors.remove(s),this.datasetMeta&&!(null===(t=this.datasetMeta.dateRange)||void 0===t?void 0:t.hasData)?(this.errors.addOrReplace({id:e,type:"warning",message:"interval: dataset has no date values, interval is ignored."}),tt):(this.errors.remove(e),r)))}prepareCategoryIntervalPosition(){const t=Number(this.categoryIntervalPosition);return Number.isInteger(t)&&t>0?t:0}prepareAttributes(){if(null==this.tableAttributes||""===this.tableAttributes.trim())return[];try{const t=JSON.parse(this.tableAttributes);return null===t||"object"!=typeof t||t instanceof Array?[]:Object.entries(t).map((([t,i],e)=>"string"==typeof i?H(t,"attr_"+e,i):null)).filter((t=>null!==t))}catch(t){return[]}}prepareSumTitle(){return""===this.sumTitle||null==this.sumTitle?"SUM_TOTAL":this.sumTitle}prepareShowMeasureScale(){return this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareBarColumnWidth(){var t;const i=null===(t=this.barColumnWidth)||void 0===t?void 0:t.toUpperCase(),e=K[i];return e?q[e]:q[K.W10]}prepareBarColumns(){return p(this.barColumns)?[]:this.barColumns.split(",").map((t=>t.trim()))}prepareUnitScaling(){const t=E(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===t.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,1/t.value):"auto"===t.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: invalid value "${t.raw}" - auto-fitting to the bar column width.`}),0)}preparePercentageScaling(){const t=E(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===t.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,1/t.value):"auto"===t.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: invalid value "${t.raw}" - auto-fitting to the pin area.`}),0)}getDataStructure(){return{ITableDataRow:{setName:{type:"string",isOptional:!1,description:""},setNameIndex:{type:"number",isOptional:!0,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:""}}}}async getBaseline(){return this.readBaseline()}readBaseline(){var t,i,e;const a=null===(e=null===(i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector("bn-table-renderer"))||void 0===i?void 0:i.shadowRoot)||void 0===e?void 0:e.querySelector("table");return pt(a,this.element)}async getLayoutState(t){var i,e,a,s;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",n=ot(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={version:nt,tag:this.element.localName,id:dt(this.element),slot:null!==(e=this.element.getAttribute("slot"))&&void 0!==e?e:void 0,rect:lt(this.element,n),em:{fontSizePx:h,appliedScaleFactor:l},regions:[],metadata:{},diagnostics:ht(this.element),scaling:this.resolveScalingInfo(h),baseline:this.readBaseline()},p=null===(a=this.element.shadowRoot)||void 0===a?void 0:a.querySelector("bn-table-renderer");if(p){const t=null!==(s=p.scenarios)&&void 0!==s?s:[];if(d.metadata.scenarios=t.filter((t=>!t.startsWith("d"))),d.metadata.variances=t.filter((t=>t.startsWith("d"))),"function"==typeof p.getLayoutDetail){const t=await p.getLayoutDetail(n,r);d.regions=t.regions,d.metadata=Object.assign(Object.assign({},d.metadata),t.metadata),d.diagnostics=[...d.diagnostics,...t.diagnostics],t.elements&&(d.elements=t.elements),t.table&&(d.table=t.table)}}return d}resolveScalingInfo(t){var i,e;const a={},s=E(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===s.kind)a.unitMode="fixed",a.unitsPerEm=s.value,a.unitPxPerUnit=t/s.value;else{a.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(a.unitsPerEm=1/e,a.unitPxPerUnit=e*t)}const r=E(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)a.percentageMode="fixed",a.percentagePointsPerEm=r.value,a.percentagePxPerPoint=t/r.value;else{a.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(a.percentagePointsPerEm=1/i,a.percentagePxPerPoint=i*t)}return a}getEffectiveScaleFactor(){const{mode:t,factor:i}=J(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,a,s,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(a=i.global)||void 0===a?void 0:a.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(s=i.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles(),i=this.getEffectiveScaleFactor();return a(s,{key:"2af1b7f31952cd0ba32e0a069ce143d3402b4a77",style:t},a("div",{key:"b78ad13abb48a43c1da0aec4727372a482c39701"},a("bn-table-renderer",{key:"ab0132a3b57953379f6d8f5f19a18f95a14cc326",tableName:this.datasetName,dataVersion:this.dataVersion,sumTitle:this.prepareSumTitle(),scenarios:this.prepareScenarios(),scenariosDataFormat:this.prepareDataFormat(),grouped:this.prepareGrouped(),limit:this.prepareLimit(),showGroupTitle:this.prepareShowGroupTitle(),runningSum:this.runningSum,varianceWaterfall:this.varianceWaterfall,thereof:this.prepareThereOf(),thereofPosition:this.prepareThereofPosition(),partof:this.preparePartOf(),order:this.prepareOrder(),categorythereof:this.prepareColumnThereOf(),attributeColumns:this.prepareAttributes(),type:this.prepareTableType(),categoryWidth:this.prepareCategoryWidth(),dataFormatDigits:this.prepareDataFormatDigits(),i18n:this.prepareI18n(),i18nMode:this.prepareI18nMode(),measureScale:this.prepareMeasureScale(),measureType:this.prepareMeasureType(),measureUnit:this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(),filter:this.prepareFilter(),barColumns:this.prepareBarColumns(),interval:this.prepareInterval(),categoryIntervalPosition:this.prepareCategoryIntervalPosition(),barColumnMaxWidth:this.prepareBarColumnWidth(),unitScaling:this.prepareUnitScaling(),percentageScaling:this.preparePercentageScaling(),reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,scaleFactor:i,ruleSetConfig:this.ruleSetConfig(),selectedStyle:this.selectedStyle})))}get element(){return this}static get watchers(){return{scale:[{validateScaling:0}],filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],barColumns:[{validateBarColumns:0}],barColumnWidth:[{validateBarColumnWidth:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dataFormat:[{validateDataFormat:0}],type:[{validateType:0}],limit:[{validateLimit:0}],thereof:[{validateThereOf:0}],thereofPosition:[{validateThereofPosition:0}],partof:[{validatePartOf:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],measureType:[{validateMeasureType:0}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDateFormatDigitsPercent:0}],categoryWidth:[{validateCategoryWidth:0}],columnthereof:[{validateColumnThereOf:0}],interval:[{validateInterval:0}],categoryIntervalPosition:[{validateCategoryIntervalPosition:0}],tableAttributes:[{validateTableAttributes: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)}'}},[1,"bn-table",{datasets:[513],i18nNamespace:[513,"i18n-namespace"],scale:[1],ruleset:[513],selectedStyle:[513,"selected-style"],sumTitle:[1,"sum-title"],filter:[1],measureUnit:[1,"measure-unit"],scenarios:[1],variances:[1],barColumns:[1,"bar-columns"],barColumnWidth:[1,"bar-column-width"],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],dataFormat:[1,"data-format"],grouped:[4],showMeasureScale:[4,"show-measure-scale"],showGroupTitle:[4,"show-group-title"],runningSum:[4,"running-sum"],varianceWaterfall:[4,"variance-waterfall"],type:[1],limit:[2],thereof:[1],thereofPosition:[1,"thereof-position"],partof:[1],order:[1],orderDirection:[1,"order-direction"],measureType:[1,"measure-type"],measureScale:[1,"measure-scale"],dataFormatDigitsDecimal:[2,"data-format-digits-decimal"],dataFormatDigitsPercent:[2,"data-format-digits-percent"],categoryWidth:[1,"category-width"],columnthereof:[1],interval:[1],categoryIntervalPosition:[2,"category-interval-position"],tableAttributes:[1,"attributes"],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],hasBlankSetnames:[32],hasSetnameIndexWithoutSetname:[32],getBaseline:[64],getLayoutState:[64]},void 0,{scale:[{validateScaling:0}],filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],barColumns:[{validateBarColumns:0}],barColumnWidth:[{validateBarColumnWidth:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dataFormat:[{validateDataFormat:0}],type:[{validateType:0}],limit:[{validateLimit:0}],thereof:[{validateThereOf:0}],thereofPosition:[{validateThereofPosition:0}],partof:[{validatePartOf:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],measureType:[{validateMeasureType:0}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDateFormatDigitsPercent:0}],categoryWidth:[{validateCategoryWidth:0}],columnthereof:[{validateColumnThereOf:0}],interval:[{validateInterval:0}],categoryIntervalPosition:[{validateCategoryIntervalPosition:0}],tableAttributes:[{validateTableAttributes:0}]}]),vt=ct,mt=function(){"undefined"!=typeof customElements&&["bn-table","bn-table-renderer"].forEach((t=>{switch(t){case"bn-table":customElements.get(r(t))||customElements.define(r(t),ct);break;case"bn-table-renderer":customElements.get(r(t))||et()}}))};export{vt as BnTable,mt as defineCustomElement}
1
+ import{p as t,H as i,w as e,h as a,a as s,t as r,f as n}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-Cxx0YNnl.js";import{v as h,a as d,i as p,q as u,r as c,s as v,t as m,h as g,u as f,w as y,x as b,y as S,c as w,z as O,m as A,A as T,B as N,f as D,C as W}from"./p-BKLq0Pbv.js";import{w as _}from"./p-BKA15uoz.js";import{w as C}from"./p-Dq9dG0Kr.js";import{w as P}from"./p-DzYhS_9s.js";import{w as R,a as F,i as x}from"./p-Bj3RWsEx.js";import{w as M}from"./p-uCpFBDF5.js";import{w as j}from"./p-9X5fVJqR.js";import{r as I}from"./p-D_Sbhd0L.js";import{w as U}from"./p-Bd8cQiLx.js";import{w as B,r as k}from"./p-4vVbchX2.js";import{g as G}from"./p-Dsvjkuy3.js";import{f as L,r as E,p as z}from"./p-Xb6Ilq8u.js";import{o as J}from"./p-B6kka9sT.js";import{D as $,I as V,d as X,M as q,B as Y,T as K}from"./p-B5tixDPM.js";import{T as Q,a as Z,p as H}from"./p-BZXiWkDS.js";import{I as tt,a as it,d as et,c as at}from"./p-EQNS13GN.js";import{a as st,n as rt}from"./p-16rjcQ0t.js";import{LAYOUT_STATE_VERSION as nt}from"./index.js";import{o as ot,m as lt}from"./p-BrJZUp-K.js";import{r as ht,a as dt}from"./p-CckAR27O.js";import{b as pt}from"./p-JofGXz75.js";import{s as ut}from"./p-DakXa7Dp.js";const ct=t(class extends 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(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.layoutObserver=null,this._lastScaledParentWidth=0,this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.hasBlankSetnames=!1,this.hasSetnameIndexWithoutSetname=!1,this.sumTitle="",this.filter="",this.measureUnit="",this.barColumnWidth="w10",this.unitScaling="100",this.percentageScaling="2",this.pixelPerUnitGroupMap=new Map,this.dataFormat="decimal",this.grouped=!1,this.showMeasureScale=!1,this.showGroupTitle=!0,this.runningSum=!1,this.varianceWaterfall=!1,this.type="list",this.limit=0,this.thereof="[]",this.thereofPosition="below",this.partof="[]",this.order="category",this.orderDirection="asc",this.measureType="volume",this.measureScale="greatest",this.dataFormatDigitsDecimal=1,this.dataFormatDigitsPercent=2,this.categoryWidth="w15",this.columnthereof=null,this.interval="none",this.categoryIntervalPosition=0,this.tableAttributes="",this._autoScaleGuard=!1,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=t=>{var i,e,a,s;this.lastAutoScalingReport={unit:null!==(i=t.unit)&&void 0!==i?i:null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.unit,percentage:null!==(a=t.percentage)&&void 0!==a?a:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.percentage};const r=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t);if(void 0!==t.unit&&t.unit>0&&this.autoUnitWarningActive){const i=1/t.unit;r(i,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=i,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: invalid value "${this.unitScaling}" - auto-fitted to 1 em ≈ ${L(i)} units.`}))}if(void 0!==t.percentage&&t.percentage>0&&this.autoPctWarningActive){const i=1/t.percentage;r(i,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=i,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: invalid value "${this.percentageScaling}" - auto-fitted to 1 em ≈ ${L(i)} percentage points.`}))}},M(this),C(this),this.errors=B(this),P(this),this.componentStyle=j(this),this.ruleSetConfig=U(this),_(this,((t,i)=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1,this.hasBlankSetnames=Array.isArray(i)&&i.some((t=>{var i;return p(null!==(i=null==t?void 0:t.setname)&&void 0!==i?i:null==t?void 0:t.setName)})),this.hasSetnameIndexWithoutSetname=Array.isArray(i)&&i.some((t=>{var i,e;return void 0!==at(null!==(i=null==t?void 0:t.setnameIndex)&&void 0!==i?i:null==t?void 0:t.setNameIndex)&&p(null!==(e=null==t?void 0:t.setname)&&void 0!==e?e:null==t?void 0:t.setName)}))}),((t,i)=>{this.datasetMeta=i})),this.t=R(this).t,this.resolveInherited=F(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}],this.errors)}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(x(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) '"+(null==e?void 0:""+e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="WARN_variances";if(x(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)}validateBarColumns(t){const i="WARN_barColumns";if(p(t))return void this.errors.remove(i);const e=u(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"barColumns: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateBarColumnWidth(t){const i="WARN_barColumnWidth";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"barColumnWidth: invalid value '"+t+"' is not supported."})}validateUnitScaling(t){const i="WARN_unitScaling";"invalid"===E(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value '"+t+"' is not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="WARN_percentageScaling";"invalid"===E(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value '"+t+"' is not supported."}):this.errors.remove(i)}validateDataFormat(t){const i="WARN_dataFormat";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormat: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateType(t){const i="WARN_type";m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"type: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateLimit(t){const i="WARN_limit";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateThereOf(t){const i="WARN_thereof",e=f(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"ThereOf: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateThereofPosition(t){const i="WARN_thereofPosition";p(t)||y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"thereofPosition: invalid value '"+t+"' is not supported."})}validatePartOf(t){const i="WARN_partof",e=b(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"partof: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderList(t){const i="WARN_order";if(x(t))return void this.errors.remove(i);const e=S(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";x(t)||w(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureType(t){const i="WARN_measureType";O(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureType: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="WARN_measureScale";A(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateDataFormatDigitsDecimal(t){const i="WARN_dataFormatDigitsDecimal";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormatDigitsDecimal: invalid value(s) '"+t+"' are not supported."})}validateDateFormatDigitsPercent(t){const i="WARN_dataFormatDigitsPercent";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormatDigitsPercent: invalid value(s) '"+t+"' are not supported."})}validateCategoryWidth(t){const i="WARN_categoryWidth";T(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"categoryWidth: invalid value(s) '"+t+"' are not supported."})}validateColumnThereOf(t){const i=N(t),e="WARN_columnthereof";i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"columnthereof: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(e)}validateInterval(t){const i="WARN_interval",e=null==t?void 0:t.trim().toLowerCase();p(t)||e===tt||e===it||D(e)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"interval: invalid value '"+t+"' is not supported."})}validateCategoryIntervalPosition(t){const i="WARN_categoryIntervalPosition";p(t)||g(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"categoryIntervalPosition: invalid value '"+t+"' is not supported."})}validateTableAttributes(t){const i="WARN_attributes",e=W(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"attributes: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateDataFormat(this.dataFormat),this.validateType(this.type),this.validateLimit(this.limit),this.validateThereOf(this.thereof),this.validateThereofPosition(this.thereofPosition),this.validatePartOf(this.partof),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal),this.validateDateFormatDigitsPercent(this.dataFormatDigitsPercent),this.validateCategoryWidth(this.categoryWidth),this.validateMeasureType(this.measureType),this.validateMeasureScale(this.measureScale),this.validateColumnThereOf(this.columnthereof),this.validateInterval(this.interval),this.validateCategoryIntervalPosition(this.categoryIntervalPosition),this.validateTableAttributes(this.tableAttributes),this.validateBarColumns(this.barColumns),this.validateBarColumnWidth(this.barColumnWidth),this.validateUnitScaling(this.unitScaling),this.validatePercentageScaling(this.percentageScaling),this.validateScaling(this.scale)}componentDidLoad(){this.layoutObserver=J(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=G(this.element);t>0&&Math.abs(t-this._lastScaledParentWidth)>2&&(this._lastScaledParentWidth=t,n(this))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}componentDidRender(){ut(this.element,"bn-table-renderer");const{mode:t}=z(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:a}=G(i);if(a<=0)return void this.checkOverflow();this._lastScaledParentWidth=a;const s=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollWidth,n=this.appliedScaleFactor;if(r<=a+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(a-1)/r);Math.abs(o-n)<.001||(i.style.setProperty("--bn-font-size",s*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled table by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}checkOverflow(){const t=G(this.element),i=this.element.scrollWidth,e=this.element.scrollHeight,a=t.width>0&&i>t.width+1,s=t.height>0&&e>t.height+1;if(!a&&!s)return void k(this.errors,null);const{mode:r}=z(this.scale),n="auto"!==r&&"empty"!==r,o=[];a&&o.push(`width (${Math.round(i)}px > ${Math.round(t.width)}px)`),s&&o.push(`height (${Math.round(e)}px > ${Math.round(t.height)}px)`),k(this.errors,`Table exceeds available ${o.join(" and ")}. Give the component more space, reduce rows (e.g. limit), or set a smaller scale.`,n)}prepareDataFormat(){var t;return $[null===(t=this.dataFormat)||void 0===t?void 0:t.toUpperCase()]}prepareGrouped(){return this.grouped}prepareShowGroupTitle(){return this.showGroupTitle}prepareThereofPosition(){var t;return(null===(t=this.thereofPosition)||void 0===t?void 0:t.toLowerCase())===Q.ABOVE?Q.ABOVE:Q.BELOW}prepareTableType(){var t;return Z[null===(t=this.type)||void 0===t?void 0:t.toUpperCase()]}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareThereOf(){if(null==this.thereof||""===this.thereof.trim())return[];try{return JSON.parse(this.thereof)}catch(t){return[]}}preparePartOf(){if(null==this.partof||""===this.partof.trim())return[];try{return JSON.parse(this.partof)}catch(t){return[]}}prepareOrder(){var t;const i=this.resolveInherited("order",this.order,"category").value,e=this.resolveInherited("orderDirection",this.orderDirection,"asc").value,a="auto"===(null==i?void 0:i.trim().toLowerCase());let s=i;return a&&(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)&&(s=this.datasetMeta.suggestedOrder),{hierarchy:s.split(",").map((t=>rt(t))),direction:st[null==e?void 0:e.toUpperCase()]}}prepareI18nMode(){return V.META}prepareI18n(){const t=l,i=new Map(["in","category","operation","thereof","part_of","SUM_TOTAL","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(),...I(this.ruleSetConfig("user"))])}prepareDataFormatDigits(){return{percent:this.dataFormatDigitsPercent,decimal:this.dataFormatDigitsDecimal}}prepareScenarios(){var t,i,e,a,s,r,n,o,l,h,d;const u=this.resolveInherited("scenarios",this.scenarios),c=this.resolveInherited("variances",this.variances);if(u.inherited||c.inherited){this.errors.remove("AUTO_scenarios");let a=[];return p(u.value)?u.unresolved&&(a=a.concat(null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[])):a=a.concat(u.value.split(",")),(null===(e=c.value)||void 0===e?void 0:e.trim().length)>0&&(a=a.concat(c.value.split(","))),a.map((t=>t.trim()))}const v="auto"===(null===(a=u.value)||void 0===a?void 0:a.trim().toLowerCase()),m=v||u.unresolved;if((p(u.value)||v)&&p(c.value))return(null===(r=null===(s=this.datasetMeta)||void 0===s?void 0:s.availableScenarios)||void 0===r?void 0:r.length)>0?(m?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):[];let g=[];return v||p(u.value)?(null===(o=null===(n=this.datasetMeta)||void 0===n?void 0:n.availableScenarios)||void 0===o?void 0:o.length)>0&&(m?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),g=g.concat(this.datasetMeta.availableScenarios)):(this.errors.remove("AUTO_scenarios"),g=g.concat(null===(l=u.value)||void 0===l?void 0:l.split(","))),(null===(h=c.value)||void 0===h?void 0:h.trim().length)>0&&(g=g.concat(null===(d=c.value)||void 0===d?void 0:d.split(","))),g.map((t=>t.trim()))}prepareCategoryWidth(){var t;return p(this.categoryWidth)?X.INF:X[null===(t=this.categoryWidth)||void 0===t?void 0:t.toUpperCase()]}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"}prepareMeasureType(){var t;return p(this.measureType)?q.VOLUME:q[null===(t=this.measureType)||void 0===t?void 0:t.toUpperCase()]}prepareColumnThereOf(){if(null==this.columnthereof||""===this.columnthereof.trim())return new Map;const t=new Map;try{const i=JSON.parse(this.columnthereof);for(const[e,a]of Object.entries(i))!1===t.has(a.scenario)&&t.set(a.scenario,[]),t.get(a.scenario).push(a)}catch(t){return new Map}return t}prepareInterval(){var t;const i="WARN_intervalConflict",e="WARN_intervalNoDate",a="WARN_intervalSetname",s="WARN_intervalSetnameIndex",r=p(this.interval)?tt:this.interval.trim().toLowerCase();return r!==tt&&r!==it&&!D(r)||r===tt?(this.errors.remove(i),this.errors.remove(e),this.errors.remove(a),this.errors.remove(s),tt):null!=this.columnthereof&&""!==this.columnthereof.trim()?(this.errors.addOrReplace({id:i,type:"warning",message:"interval: cannot be combined with columnthereof, interval is ignored."}),this.errors.remove(e),this.errors.remove(a),this.errors.remove(s),tt):(this.errors.remove(i),r===it?(this.hasBlankSetnames?this.errors.addOrReplace({id:a,type:"warning",message:"interval: rows with blank setname found, they are grouped under '-'."}):this.errors.remove(a),this.hasSetnameIndexWithoutSetname?this.errors.addOrReplace({id:s,type:"warning",message:"interval: rows with setnameIndex but blank setname found, setnameIndex needs setname."}):this.errors.remove(s),this.errors.remove(e),it):(this.errors.remove(a),this.errors.remove(s),this.datasetMeta&&!(null===(t=this.datasetMeta.dateRange)||void 0===t?void 0:t.hasData)?(this.errors.addOrReplace({id:e,type:"warning",message:"interval: dataset has no date values, interval is ignored."}),tt):(this.errors.remove(e),r)))}prepareCategoryIntervalPosition(){const t=Number(this.categoryIntervalPosition);return Number.isInteger(t)&&t>0?t:0}prepareAttributes(){if(null==this.tableAttributes||""===this.tableAttributes.trim())return[];try{const t=JSON.parse(this.tableAttributes);return null===t||"object"!=typeof t||t instanceof Array?[]:Object.entries(t).map((([t,i],e)=>"string"==typeof i?H(t,"attr_"+e,i):null)).filter((t=>null!==t))}catch(t){return[]}}prepareSumTitle(){return""===this.sumTitle||null==this.sumTitle?"SUM_TOTAL":this.sumTitle}prepareShowMeasureScale(){return this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareBarColumnWidth(){var t;const i=null===(t=this.barColumnWidth)||void 0===t?void 0:t.toUpperCase(),e=K[i];return e?Y[e]:Y[K.W10]}prepareBarColumns(){return p(this.barColumns)?[]:this.barColumns.split(",").map((t=>t.trim()))}prepareUnitScaling(){const t=E(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===t.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,1/t.value):"auto"===t.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: invalid value "${t.raw}" - auto-fitting to the bar column width.`}),0)}preparePercentageScaling(){const t=E(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===t.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,1/t.value):"auto"===t.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: invalid value "${t.raw}" - auto-fitting to the pin area.`}),0)}getDataStructure(){return{ITableDataRow:{setName:{type:"string",isOptional:!1,description:""},setNameIndex:{type:"number",isOptional:!0,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:""}}}}async getBaseline(){return this.readBaseline()}readBaseline(){var t,i,e;const a=null===(e=null===(i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector("bn-table-renderer"))||void 0===i?void 0:i.shadowRoot)||void 0===e?void 0:e.querySelector("table");return pt(a,this.element)}async getLayoutState(t){var i,e,a,s;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",n=ot(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={version:nt,tag:this.element.localName,id:dt(this.element),slot:null!==(e=this.element.getAttribute("slot"))&&void 0!==e?e:void 0,rect:lt(this.element,n),em:{fontSizePx:h,appliedScaleFactor:l},regions:[],metadata:{},diagnostics:ht(this.element),scaling:this.resolveScalingInfo(h),baseline:this.readBaseline()},p=null===(a=this.element.shadowRoot)||void 0===a?void 0:a.querySelector("bn-table-renderer");if(p){const t=null!==(s=p.scenarios)&&void 0!==s?s:[];if(d.metadata.scenarios=t.filter((t=>!t.startsWith("d"))),d.metadata.variances=t.filter((t=>t.startsWith("d"))),"function"==typeof p.getLayoutDetail){const t=await p.getLayoutDetail(n,r);d.regions=t.regions,d.metadata=Object.assign(Object.assign({},d.metadata),t.metadata),d.diagnostics=[...d.diagnostics,...t.diagnostics],t.elements&&(d.elements=t.elements),t.table&&(d.table=t.table)}}return d}resolveScalingInfo(t){var i,e;const a={},s=E(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===s.kind)a.unitMode="fixed",a.unitsPerEm=s.value,a.unitPxPerUnit=t/s.value;else{a.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(a.unitsPerEm=1/e,a.unitPxPerUnit=e*t)}const r=E(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)a.percentageMode="fixed",a.percentagePointsPerEm=r.value,a.percentagePxPerPoint=t/r.value;else{a.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(a.percentagePointsPerEm=1/i,a.percentagePxPerPoint=i*t)}return a}getEffectiveScaleFactor(){const{mode:t,factor:i}=z(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,a,s,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(a=i.global)||void 0===a?void 0:a.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(s=i.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles(),i=this.getEffectiveScaleFactor();return a(s,{key:"2af1b7f31952cd0ba32e0a069ce143d3402b4a77",style:t},a("div",{key:"b78ad13abb48a43c1da0aec4727372a482c39701"},a("bn-table-renderer",{key:"ab0132a3b57953379f6d8f5f19a18f95a14cc326",tableName:this.datasetName,dataVersion:this.dataVersion,sumTitle:this.prepareSumTitle(),scenarios:this.prepareScenarios(),scenariosDataFormat:this.prepareDataFormat(),grouped:this.prepareGrouped(),limit:this.prepareLimit(),showGroupTitle:this.prepareShowGroupTitle(),runningSum:this.runningSum,varianceWaterfall:this.varianceWaterfall,thereof:this.prepareThereOf(),thereofPosition:this.prepareThereofPosition(),partof:this.preparePartOf(),order:this.prepareOrder(),categorythereof:this.prepareColumnThereOf(),attributeColumns:this.prepareAttributes(),type:this.prepareTableType(),categoryWidth:this.prepareCategoryWidth(),dataFormatDigits:this.prepareDataFormatDigits(),i18n:this.prepareI18n(),i18nMode:this.prepareI18nMode(),measureScale:this.prepareMeasureScale(),measureType:this.prepareMeasureType(),measureUnit:this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(),filter:this.prepareFilter(),barColumns:this.prepareBarColumns(),interval:this.prepareInterval(),categoryIntervalPosition:this.prepareCategoryIntervalPosition(),barColumnMaxWidth:this.prepareBarColumnWidth(),unitScaling:this.prepareUnitScaling(),percentageScaling:this.preparePercentageScaling(),reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,scaleFactor:i,ruleSetConfig:this.ruleSetConfig(),selectedStyle:this.selectedStyle})))}get element(){return this}static get watchers(){return{scale:[{validateScaling:0}],filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],barColumns:[{validateBarColumns:0}],barColumnWidth:[{validateBarColumnWidth:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dataFormat:[{validateDataFormat:0}],type:[{validateType:0}],limit:[{validateLimit:0}],thereof:[{validateThereOf:0}],thereofPosition:[{validateThereofPosition:0}],partof:[{validatePartOf:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],measureType:[{validateMeasureType:0}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDateFormatDigitsPercent:0}],categoryWidth:[{validateCategoryWidth:0}],columnthereof:[{validateColumnThereOf:0}],interval:[{validateInterval:0}],categoryIntervalPosition:[{validateCategoryIntervalPosition:0}],tableAttributes:[{validateTableAttributes: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)}'}},[1,"bn-table",{datasets:[513],i18nNamespace:[513,"i18n-namespace"],scale:[1],ruleset:[513],selectedStyle:[513,"selected-style"],sumTitle:[1,"sum-title"],filter:[1],measureUnit:[1,"measure-unit"],scenarios:[1],variances:[1],barColumns:[1,"bar-columns"],barColumnWidth:[1,"bar-column-width"],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],dataFormat:[1,"data-format"],grouped:[4],showMeasureScale:[4,"show-measure-scale"],showGroupTitle:[4,"show-group-title"],runningSum:[4,"running-sum"],varianceWaterfall:[4,"variance-waterfall"],type:[1],limit:[2],thereof:[1],thereofPosition:[1,"thereof-position"],partof:[1],order:[1],orderDirection:[1,"order-direction"],measureType:[1,"measure-type"],measureScale:[1,"measure-scale"],dataFormatDigitsDecimal:[2,"data-format-digits-decimal"],dataFormatDigitsPercent:[2,"data-format-digits-percent"],categoryWidth:[1,"category-width"],columnthereof:[1],interval:[1],categoryIntervalPosition:[2,"category-interval-position"],tableAttributes:[1,"attributes"],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],hasBlankSetnames:[32],hasSetnameIndexWithoutSetname:[32],getBaseline:[64],getLayoutState:[64]},void 0,{scale:[{validateScaling:0}],filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],barColumns:[{validateBarColumns:0}],barColumnWidth:[{validateBarColumnWidth:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dataFormat:[{validateDataFormat:0}],type:[{validateType:0}],limit:[{validateLimit:0}],thereof:[{validateThereOf:0}],thereofPosition:[{validateThereofPosition:0}],partof:[{validatePartOf:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],measureType:[{validateMeasureType:0}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDateFormatDigitsPercent:0}],categoryWidth:[{validateCategoryWidth:0}],columnthereof:[{validateColumnThereOf:0}],interval:[{validateInterval:0}],categoryIntervalPosition:[{validateCategoryIntervalPosition:0}],tableAttributes:[{validateTableAttributes:0}]}]),vt=ct,mt=function(){"undefined"!=typeof customElements&&["bn-table","bn-table-renderer"].forEach((t=>{switch(t){case"bn-table":customElements.get(r(t))||customElements.define(r(t),ct);break;case"bn-table-renderer":customElements.get(r(t))||et()}}))};export{vt as BnTable,mt as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as e,f as n,h as o,a as s,t as i}from"./p-D6YGOYV1.js";import{w as l}from"./p-DJUffGeB.js";import{w as a}from"./p-xIWChKGS.js";import{w as r}from"./p-Dq9dG0Kr.js";import{w as d}from"./p-DwuXVo2h.js";import{w as u}from"./p-DjPWZfry.js";import{w as c}from"./p-4vVbchX2.js";import{g as f}from"./p-Dsvjkuy3.js";import{p as v}from"./p-Xb6Ilq8u.js";import{s as h}from"./p-CyUmrWfW.js";const p="[A-Za-z_$\\u00C0-\\uFFFF][\\w$\\u00C0-\\uFFFF]*",m="'[^'\\\\]*'|\"[^\"\\\\]*\"",b=`(?:this\\.)?data(?:\\.(${p})|\\[\\s*(${m})\\s*\\])\\[\\s*(\\d+)\\s*\\]\\.(${p})`,g=RegExp(`\\$\\{\\s*(?:${b}|t\\(\\s*(${m})\\s*(?:,\\s*\\{([^{}]*)\\}\\s*)?\\))\\s*\\}`,"g"),y=RegExp(`\\s*(?:(${p})|(${m}))\\s*:\\s*(?:(${m})|(-?\\d+(?:\\.\\d+)?)|(${b}))\\s*(?:,|$)`,"y"),w=t=>(t+"").replace(/[&<>"'\t\n\f\r ]/g,(t=>`&#${t.charCodeAt(0)};`)),$=(t,e)=>"object"==typeof t&&null!==t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0,N=t=>t.slice(1,-1);const _=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.refit=()=>{n(this)},this.data={},d(this),r(this),this.errors=c(this),this.t=a(this).t,l(this,((t,e)=>{this.data=""===t?{}:Object.assign(Object.assign({},this.data),{[t]:e})})),this.componentStyle=u(this)}connectedCallback(){var t;null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.refit)}disconnectedCallback(){var t;null===(t=document.fonts)||void 0===t||t.removeEventListener("loadingdone",this.refit)}validateValue(t){"string"!=typeof t||""===t?this.errors.addOrReplace({id:"WARN_value",type:"warning",message:"Empty value"}):this.errors.remove("WARN_value")}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("WARN_scale");const e=Number(t);isNaN(e)||e<=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")}componentWillLoad(){this.validateValue(this.value),this.validateScaling(this.scale)}prepareStyle(){return this.componentStyle((t=>{var e,n,o,s,i,l,a,r,d,u,c,f,v,h,p,m,b,g,y,w,$,N;return{fontStyles:{font:`${null!==(s=null!==(n=null===(e=t["bn-text"])||void 0===e?void 0:e.fontSizePx)&&void 0!==n?n:null===(o=t.global)||void 0===o?void 0:o.fontSizePx)&&void 0!==s?s:13.3333}px ${null!==(r=null!==(l=null===(i=t["bn-text"])||void 0===i?void 0:i.fontFamily)&&void 0!==l?l:null===(a=t.global)||void 0===a?void 0:a.fontFamily)&&void 0!==r?r:"'Noto Sans', sans-serif"}`,size:null!==(f=null!==(u=null===(d=t["bn-text"])||void 0===d?void 0:d.fontSizePx)&&void 0!==u?u:null===(c=t.global)||void 0===c?void 0:c.fontSizePx)&&void 0!==f?f:13.3333,color:null!==(m=null!==(h=null===(v=t["bn-text"])||void 0===v?void 0:v.fontColor)&&void 0!==h?h:null===(p=t.global)||void 0===p?void 0:p.fontColor)&&void 0!==m?m:"#000000",background:null!==(w=null!==(g=null===(b=t["bn-text"])||void 0===b?void 0:b.fontBackgroundColor)&&void 0!==g?g:null===(y=t.global)||void 0===y?void 0:y.fontBackgroundColor)&&void 0!==w?w:"#ffffff",leading:null!==(N=null===($=t["bn-text"])||void 0===$?void 0:$.leading)&&void 0!==N?N:1.8}}}))}applyScaling(t){const e=this.element,{mode:n,factor:o}=v(this.scale),{width:s,height:i}=f(e),l=e.scrollHeight>e.clientHeight+1?e.clientHeight:i,a=s,r=a>0&&e.scrollWidth>a+1,d=l>0&&e.scrollHeight>l+1,u=r||d;if(a<=0&&l<=0)return;if("none"===n){if(u){const t=[];r&&t.push(`w:${e.scrollWidth}>${Math.round(a)}`),d&&t.push(`h:${e.scrollHeight}>${Math.round(l)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows container (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}if("factor"===n){if(u){const t=[];r&&t.push(`w:${e.scrollWidth}>${Math.round(a)}`),d&&t.push(`h:${e.scrollHeight}>${Math.round(l)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows with factor ${o} (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}e.style.setProperty("--bn-font-size",t+"px");const c=e.scrollWidth,h=e.scrollHeight,p=e.clientHeight,m=h>p+1?p:i,b=a<=0||c<=a+1,g=m<=0||h<=m+1;if(b&&g)return void this.errors.remove("AUTO_scale");const y=Math.min(1,!b&&a>0?a/c:1,!g&&m>0?m/h:1);e.style.setProperty("--bn-font-size",t*y+"px"),"empty"===n?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled font by factor "+y.toFixed(3)}):this.errors.remove("AUTO_scale")}componentDidRender(){var t;const{html:e,unknown:n}=function(t,e,n){const o=[],s=t=>{o.includes(t)||o.push(t)},i=(t,n,o,i,l)=>{const a=$($($(e,null!=n?n:N(o)),Number(i)+""),l);return void 0===a&&s(t),a};return{html:t.replace(g,((t,e,o,l,a,r,d)=>{const u=t.slice(2,-1).trim();try{if(void 0===r){const t=i(u,e,o,l,a);return null==t?"":w(t)}const s=void 0===d?void 0:(t=>{const e={};for(y.lastIndex=0;""!==t.slice(y.lastIndex).trim();){const n=y.exec(t);if(!n)return null;const[,o,s,l,a,r,d,u,c,f]=n;e[null!=o?o:N(s)]=void 0!==l?N(l):void 0!==a?Number(a):i(r,d,u,c,f)}return e})(d);return null===s?t:w(n(N(r),s))}catch(t){return s(u),""}})),unknown:o}}(null!==(t=this.value)&&void 0!==t?t:"",this.data,this.t);n.length>0?this.errors.addOrReplace({id:"WARN_value_path",type:"warning",message:"Unknown template path: "+n.join(", ")}):this.errors.remove("WARN_value_path"),this.container.innerHTML=h(e),this.applyScaling(this.prepareStyle().fontStyles.size)}render(){const{fontStyles:t}=this.prepareStyle(),{mode:e,factor:n}=v(this.scale),i="factor"===e?t.size*n+"px":t.size+"px",l={"--bn-font-family":t.font.substring(t.font.indexOf("px ")+3),"--bn-font-size":i,"--bn-font-color":t.color,"--bn-font-background":t.background};return o(s,{key:"47eaf1468ffc8b8de7e77f2b0aff4b927f8b0471",style:l},o("div",{key:"1f592c2fd0a4af77047c56ee043f6bdd84dfb2d2"},o("span",{key:"ecad3e6ea36dfa495ef78183fc6c3979eb9d5be2",class:"container",ref:t=>{this.container=t}})))}get element(){return this}static get watchers(){return{value:[{validateValue:0}],scale:[{validateScaling:0}]}}static get style(){return':host{padding:0.5em;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);background-color:var(--bn-font-background, white)}span.container p{margin:0}'}},[1,"bn-text",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],value:[1],scale:[1],data:[32]},void 0,{value:[{validateValue:0}],scale:[{validateScaling:0}]}]),j=_,A=function(){"undefined"!=typeof customElements&&["bn-text"].forEach((t=>{"bn-text"===t&&(customElements.get(i(t))||customElements.define(i(t),_))}))};export{j as BnText,A as defineCustomElement}
1
+ import{p as t,H as e,f as n,h as o,a as s,t as i}from"./p-D6YGOYV1.js";import{w as l}from"./p-BKA15uoz.js";import{w as a}from"./p-Bj3RWsEx.js";import{w as r}from"./p-Dq9dG0Kr.js";import{w as d}from"./p-uCpFBDF5.js";import{w as u}from"./p-9X5fVJqR.js";import{w as c}from"./p-4vVbchX2.js";import{g as f}from"./p-Dsvjkuy3.js";import{p as v}from"./p-Xb6Ilq8u.js";import{s as h}from"./p-CyUmrWfW.js";const p="[A-Za-z_$\\u00C0-\\uFFFF][\\w$\\u00C0-\\uFFFF]*",m="'[^'\\\\]*'|\"[^\"\\\\]*\"",b=`(?:this\\.)?data(?:\\.(${p})|\\[\\s*(${m})\\s*\\])\\[\\s*(\\d+)\\s*\\]\\.(${p})`,g=RegExp(`\\$\\{\\s*(?:${b}|t\\(\\s*(${m})\\s*(?:,\\s*\\{([^{}]*)\\}\\s*)?\\))\\s*\\}`,"g"),y=RegExp(`\\s*(?:(${p})|(${m}))\\s*:\\s*(?:(${m})|(-?\\d+(?:\\.\\d+)?)|(${b}))\\s*(?:,|$)`,"y"),w=t=>(t+"").replace(/[&<>"'\t\n\f\r ]/g,(t=>`&#${t.charCodeAt(0)};`)),$=(t,e)=>"object"==typeof t&&null!==t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0,N=t=>t.slice(1,-1);const A=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.refit=()=>{n(this)},this.data={},d(this),r(this),this.errors=c(this),this.t=a(this).t,l(this,((t,e)=>{this.data=""===t?{}:Object.assign(Object.assign({},this.data),{[t]:e})})),this.componentStyle=u(this)}connectedCallback(){var t;null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.refit)}disconnectedCallback(){var t;null===(t=document.fonts)||void 0===t||t.removeEventListener("loadingdone",this.refit)}validateValue(t){"string"!=typeof t||""===t?this.errors.addOrReplace({id:"WARN_value",type:"warning",message:"Empty value"}):this.errors.remove("WARN_value")}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("WARN_scale");const e=Number(t);isNaN(e)||e<=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")}componentWillLoad(){this.validateValue(this.value),this.validateScaling(this.scale)}prepareStyle(){return this.componentStyle((t=>{var e,n,o,s,i,l,a,r,d,u,c,f,v,h,p,m,b,g,y,w,$,N;return{fontStyles:{font:`${null!==(s=null!==(n=null===(e=t["bn-text"])||void 0===e?void 0:e.fontSizePx)&&void 0!==n?n:null===(o=t.global)||void 0===o?void 0:o.fontSizePx)&&void 0!==s?s:13.3333}px ${null!==(r=null!==(l=null===(i=t["bn-text"])||void 0===i?void 0:i.fontFamily)&&void 0!==l?l:null===(a=t.global)||void 0===a?void 0:a.fontFamily)&&void 0!==r?r:"'Noto Sans', sans-serif"}`,size:null!==(f=null!==(u=null===(d=t["bn-text"])||void 0===d?void 0:d.fontSizePx)&&void 0!==u?u:null===(c=t.global)||void 0===c?void 0:c.fontSizePx)&&void 0!==f?f:13.3333,color:null!==(m=null!==(h=null===(v=t["bn-text"])||void 0===v?void 0:v.fontColor)&&void 0!==h?h:null===(p=t.global)||void 0===p?void 0:p.fontColor)&&void 0!==m?m:"#000000",background:null!==(w=null!==(g=null===(b=t["bn-text"])||void 0===b?void 0:b.fontBackgroundColor)&&void 0!==g?g:null===(y=t.global)||void 0===y?void 0:y.fontBackgroundColor)&&void 0!==w?w:"#ffffff",leading:null!==(N=null===($=t["bn-text"])||void 0===$?void 0:$.leading)&&void 0!==N?N:1.8}}}))}applyScaling(t){const e=this.element,{mode:n,factor:o}=v(this.scale),{width:s,height:i}=f(e),l=e.scrollHeight>e.clientHeight+1?e.clientHeight:i,a=s,r=a>0&&e.scrollWidth>a+1,d=l>0&&e.scrollHeight>l+1,u=r||d;if(a<=0&&l<=0)return;if("none"===n){if(u){const t=[];r&&t.push(`w:${e.scrollWidth}>${Math.round(a)}`),d&&t.push(`h:${e.scrollHeight}>${Math.round(l)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows container (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}if("factor"===n){if(u){const t=[];r&&t.push(`w:${e.scrollWidth}>${Math.round(a)}`),d&&t.push(`h:${e.scrollHeight}>${Math.round(l)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows with factor ${o} (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}e.style.setProperty("--bn-font-size",t+"px");const c=e.scrollWidth,h=e.scrollHeight,p=e.clientHeight,m=h>p+1?p:i,b=a<=0||c<=a+1,g=m<=0||h<=m+1;if(b&&g)return void this.errors.remove("AUTO_scale");const y=Math.min(1,!b&&a>0?a/c:1,!g&&m>0?m/h:1);e.style.setProperty("--bn-font-size",t*y+"px"),"empty"===n?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled font by factor "+y.toFixed(3)}):this.errors.remove("AUTO_scale")}componentDidRender(){var t;const{html:e,unknown:n}=function(t,e,n){const o=[],s=t=>{o.includes(t)||o.push(t)},i=(t,n,o,i,l)=>{const a=$($($(e,null!=n?n:N(o)),Number(i)+""),l);return void 0===a&&s(t),a};return{html:t.replace(g,((t,e,o,l,a,r,d)=>{const u=t.slice(2,-1).trim();try{if(void 0===r){const t=i(u,e,o,l,a);return null==t?"":w(t)}const s=void 0===d?void 0:(t=>{const e={};for(y.lastIndex=0;""!==t.slice(y.lastIndex).trim();){const n=y.exec(t);if(!n)return null;const[,o,s,l,a,r,d,u,c,f]=n;e[null!=o?o:N(s)]=void 0!==l?N(l):void 0!==a?Number(a):i(r,d,u,c,f)}return e})(d);return null===s?t:w(n(N(r),s))}catch(t){return s(u),""}})),unknown:o}}(null!==(t=this.value)&&void 0!==t?t:"",this.data,this.t);n.length>0?this.errors.addOrReplace({id:"WARN_value_path",type:"warning",message:"Unknown template path: "+n.join(", ")}):this.errors.remove("WARN_value_path"),this.container.innerHTML=h(e),this.applyScaling(this.prepareStyle().fontStyles.size)}render(){const{fontStyles:t}=this.prepareStyle(),{mode:e,factor:n}=v(this.scale),i="factor"===e?t.size*n+"px":t.size+"px",l={"--bn-font-family":t.font.substring(t.font.indexOf("px ")+3),"--bn-font-size":i,"--bn-font-color":t.color,"--bn-font-background":t.background};return o(s,{key:"47eaf1468ffc8b8de7e77f2b0aff4b927f8b0471",style:l},o("div",{key:"1f592c2fd0a4af77047c56ee043f6bdd84dfb2d2"},o("span",{key:"ecad3e6ea36dfa495ef78183fc6c3979eb9d5be2",class:"container",ref:t=>{this.container=t}})))}get element(){return this}static get watchers(){return{value:[{validateValue:0}],scale:[{validateScaling:0}]}}static get style(){return':host{padding:0.5em;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);background-color:var(--bn-font-background, white)}span.container p{margin:0}'}},[1,"bn-text",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],value:[1],scale:[1],data:[32]},void 0,{value:[{validateValue:0}],scale:[{validateScaling:0}]}]),_=A,j=function(){"undefined"!=typeof customElements&&["bn-text"].forEach((t=>{"bn-text"===t&&(customElements.get(i(t))||customElements.define(i(t),A))}))};export{_ as BnText,j as defineCustomElement}
@@ -1 +1 @@
1
- import{B as o,d as s}from"./p-C3gYq-HU.js";const p=o,r=s;export{p as BnTitleRenderer,r as defineCustomElement}
1
+ import{B as o,d as s}from"./p-DROj8gke.js";const p=o,r=s;export{p as BnTitleRenderer,r as defineCustomElement}
@@ -1 +1 @@
1
- import{T as o,d as s}from"./p-B4L069XF.js";const p=o,r=s;export{p as BnTitle,r as defineCustomElement}
1
+ import{T as o,d as s}from"./p-BoBamuPt.js";const t=o,a=s;export{t as BnTitle,a as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as e,h as n,a as i,t as s}from"./p-D6YGOYV1.js";import{n as o}from"./p-BiSytXUy.js";import{LAYOUT_STATE_VERSION as r}from"./index.js";import{o as l,m as a}from"./p-DaOm9YwQ.js";import{r as d,a as c}from"./p-CckAR27O.js";import{w as u}from"./p-Dq9dG0Kr.js";import{w as h}from"./p-DwuXVo2h.js";import{w as f}from"./p-DjPWZfry.js";import{w as p}from"./p-4vVbchX2.js";import{g,a as v}from"./p-Dsvjkuy3.js";import{o as y}from"./p-B6kka9sT.js";const m=["*","/","+","-","x","÷","none"];function b(t){switch(t){case"*":case"x":return"×";case"/":case"÷":return"÷";case"+":return"+";case"-":return"−";default:return""}}function x(t,e,n){return t.find((t=>t.from===e&&t.to===n))}function w(t){return 2*(t-1)+1}function $(t){return 2*(t-1)+1}function S(t){return t<=1?1:2*(t-1)+1}function k(t){return S(t)}function M(t,e){const n=t.getBoundingClientRect(),i=n.left-e.left,s=n.top-e.top;return{left:i,top:s,width:n.width,height:n.height,centerX:i+n.width/2,centerY:s+n.height/2}}function R(t,e,n){switch(n){case"ltr":return e?{x:t.left+t.width,y:t.centerY}:{x:t.left,y:t.centerY};case"rtl":return e?{x:t.left,y:t.centerY}:{x:t.left+t.width,y:t.centerY};case"ttb":return e?{x:t.centerX,y:t.top+t.height}:{x:t.centerX,y:t.top};case"btt":return e?{x:t.centerX,y:t.top}:{x:t.centerX,y:t.top+t.height}}}function j(t,e,n,i,s=8){const o=-(i-1)*s/2+n*s;switch(e){case"ltr":return{x:t.left,y:t.centerY+o};case"rtl":return{x:t.left+t.width,y:t.centerY+o};case"ttb":return{x:t.centerX+o,y:t.top};case"btt":return{x:t.centerX+o,y:t.top+t.height}}}function A(t,e,n,i,s){switch(n){case"straight":return function(t,e){return{path:`M ${t.x} ${t.y} L ${e.x} ${e.y}`,midpoint:{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}}(t,e);case"curved":return function(t,e,n){let i,s;if("ltr"===n||"rtl"===n){const n=(t.x+e.x)/2;i={x:n,y:t.y},s={x:n,y:e.y}}else{const n=(t.y+e.y)/2;i={x:t.x,y:n},s={x:e.x,y:n}}return{path:`M ${t.x} ${t.y} C ${i.x} ${i.y}, ${s.x} ${s.y}, ${e.x} ${e.y}`,midpoint:{x:.125*t.x+.375*i.x+.375*s.x+.125*e.x,y:.125*t.y+.375*i.y+.375*s.y+.125*e.y}}}(t,e,i);default:return function(t,e,n,i){let s,o;if("ltr"===n||"rtl"===n){const n=null!=i?i:t.x+.7*(e.x-t.x);s=`M ${t.x} ${t.y} L ${n} ${t.y} L ${n} ${e.y} L ${e.x} ${e.y}`,o={x:n,y:(t.y+e.y)/2}}else{const n=null!=i?i:t.y+.7*(e.y-t.y);s=`M ${t.x} ${t.y} L ${t.x} ${n} L ${e.x} ${n} L ${e.x} ${e.y}`,o={x:(t.x+e.x)/2,y:n}}return{path:s,midpoint:o}}(t,e,i,s)}}function L(t,e,n){let i,s,o;switch(n){case"ltr":i=t.left+t.width,s=e.map((t=>t.left)),o=1;break;case"rtl":i=t.left,s=e.map((t=>t.left+t.width)),o=-1;break;case"ttb":i=t.top+t.height,s=e.map((t=>t.top)),o=1;break;case"btt":i=t.top,s=e.map((t=>t.top+t.height)),o=-1}const r=s.map((t=>(t-i)*o)).filter((t=>t>=0));if(0!==r.length)return i+Math.min(...r)*o*.7}function C(t,e,n,i){return"ltr"===i||"rtl"===i?{x:t,y:(e.centerY+n.centerY)/2}:{x:(e.centerX+n.centerX)/2,y:t}}function N(t,e,n){var i,s;return Object.assign({stroke:null!==(i=null==n?void 0:n.color)&&void 0!==i?i:t,strokeWidth:null!==(s=null==n?void 0:n.width)&&void 0!==s?s:e},(null==n?void 0:n.dasharray)?{strokeDasharray:n.dasharray}:{})}const T=t(class extends e{validateEdgesProp(t){const e="ERR_edges",n=function(t){const e=[];if(!t||""===t.trim())return e.push("edges: value is required"),e;let n;try{n=JSON.parse(t)}catch(t){return e.push("edges: invalid JSON structure"),e}if(!Array.isArray(n))return e.push("edges: must be an array"),e;if(0===n.length)return e.push("edges: array must not be empty"),e;const i=new Set,s=new Set,o=new Map;n.forEach(((t,n)=>{if("object"!=typeof t||null===t)return void e.push(`edges[${n}]: must be an object`);const r=t;if("string"!=typeof r.from||""===r.from.trim()?e.push(`edges[${n}]: 'from' is required and must be a non-empty string`):i.add(r.from),"string"!=typeof r.to||""===r.to.trim()?e.push(`edges[${n}]: 'to' is required and must be a non-empty string`):(i.add(r.to),s.add(r.to),"string"==typeof r.from&&o.set(r.from,[...o.get(r.from)||[],r.to])),void 0!==r.operator&&("string"==typeof r.operator&&m.includes(r.operator)||e.push(`edges[${n}]: 'operator' must be one of: ${m.join(", ")}`)),void 0!==r.label&&"string"!=typeof r.label&&e.push(`edges[${n}]: 'label' must be a string`),void 0!==r.style)if("object"!=typeof r.style||null===r.style)e.push(`edges[${n}]: 'style' must be an object`);else{const t=r.style;void 0!==t.color&&"string"!=typeof t.color&&e.push(`edges[${n}]: 'style.color' must be a string`),void 0!==t.width&&"number"!=typeof t.width&&e.push(`edges[${n}]: 'style.width' must be a number`),void 0!==t.dasharray&&"string"!=typeof t.dasharray&&e.push(`edges[${n}]: 'style.dasharray' must be a string`)}}));const r=Array.from(i).filter((t=>!s.has(t)));return 0===r.length?e.push("edges: tree has no root node (circular reference detected)"):r.length>1?e.push("edges: tree has multiple root nodes: "+r.join(", ")):e.push(...function(t,e,n){const i=[],s=new Set,o=new Set,r=t=>{o.add(t),s.add(t);for(const n of e.get(t)||[])s.has(n)?i.push(`edges: circular reference, the edge from '${t}' to '${n}' leads back`):o.has(n)||r(n);s.delete(t)};r(t);const l=Array.from(n).filter((t=>!o.has(t)));return l.length>0&&i.push(`edges: nodes not connected to the root '${t}': ${l.join(", ")}`),i}(r[0],o,i)),e}(t);n.length>0?(this.errors.addOrReplace({id:e,type:"error",message:"edges: "+n.join("; ")}),this.treeConfig=null):(this.errors.remove(e),this.treeConfig=function(t){if(!t||""===t.trim())return null;try{const e=JSON.parse(t);if(!Array.isArray(e))return null;const n=e,i=function(t){const e=new Map;for(const n of t){const t=e.get(n.from)||[];t.push(n.to),e.set(n.from,t)}return e}(n),s=function(t){const e=new Set;for(const n of t)e.add(n.from),e.add(n.to);return e}(n),o=function(t,e){const n=new Set;for(const e of t)n.add(e.to);const i=Array.from(e).filter((t=>!n.has(t)));return 1===i.length?i[0]:null}(n,s);return{edges:n,adjacencyList:i,rootNode:o,allNodes:s}}catch(t){return console.error("parseTreeConfig: failed to parse tree configuration",t),null}}(t)),this.recalculateLayout()}validateDirection(t){const e="WARN_direction",n=["ltr","rtl","ttb","btt"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`direction: invalid value '${t}', must be one of: ${n.join(", ")}`}),this.recalculateLayout()}validateLevelSpacing(t){const e="WARN_levelSpacing";!o(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`level-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateNodeSpacing(t){const e="WARN_nodeSpacing";!o(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`node-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateEdgeStyle(t){const e="WARN_edgeStyle",n=["straight","orthogonal","curved"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`edge-style: invalid value '${t}', must be one of: ${n.join(", ")}`})}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.treeConfig=null,this.layout=null,this.nodeRects=new Map,this.svgWidth=0,this.svgHeight=0,this.resizeObserver=null,this.gridContainer=null,this.observed=new Set,this.parentObserver=null,this.direction="ltr",this.levelSpacing=60,this.nodeSpacing=20,this.edgeStyle="orthogonal",this.showOperators=!0,h(this),u(this),this.errors=p(this),this.componentStyle=f(this)}async getLayoutState(t){var e,n,i,s,o,u,h,f,p,g,v;const y=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",m=l(this.element),b=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),x={version:r,tag:this.element.localName,id:c(this.element),slot:null!==(n=this.element.getAttribute("slot"))&&void 0!==n?n:void 0,rect:a(this.element,m),em:{fontSizePx:b,appliedScaleFactor:1},regions:[],metadata:{nodeCount:null!==(s=null===(i=this.treeConfig)||void 0===i?void 0:i.allNodes.size)&&void 0!==s?s:0,edgeCount:null!==(u=null===(o=this.treeConfig)||void 0===o?void 0:o.edges.length)&&void 0!==u?u:0},diagnostics:d(this.element)},w=null===(h=this.element.shadowRoot)||void 0===h?void 0:h.querySelector(".tree-grid");if(w&&x.regions.push({id:"grid",rect:a(w,m)}),"full"!==y||!this.treeConfig)return x;const $=[];for(const t of this.treeConfig.allNodes){const e=this.element.querySelector(`[slot="${t}"]`);if(!e)continue;const n={kind:"node",nodeId:t,rect:a(e,m)};$.push(n)}const S=Array.from(null!==(p=null===(f=this.element.shadowRoot)||void 0===f?void 0:f.querySelectorAll("svg.edge-layer path"))&&void 0!==p?p:[]);let k=0;for(const t of this.treeConfig.edges){if(!this.nodeRects.get(t.from)||!this.nodeRects.get(t.to))continue;const e=S[k++];if(!e)break;const n={kind:"edge",from:t.from,to:t.to,operator:t.operator,path:null!==(g=e.getAttribute("d"))&&void 0!==g?g:void 0,rect:a(e,m)};$.push(n)}return null===(v=this.element.shadowRoot)||void 0===v||v.querySelectorAll("svg.edge-layer g.operator-group").forEach((t=>{var e,n;const i=null!==(n=null===(e=t.textContent)||void 0===e?void 0:e.trim())&&void 0!==n?n:"";if(!i)return;const s={kind:"label",role:"operator",text:i,rect:a(t,m)};$.push(s)})),x.elements=$,x}getTreeStyle(){return this.componentStyle((t=>({edgeColor:t["bn-tree"].edgeColor,edgeWidth:t["bn-tree"].edgeWidth,operatorCircleRadius:t["bn-tree"].operatorCircleRadius,operatorFontSize:t.global.fontSizePx*t["bn-tree"].operatorFontSizeScale,operatorColor:t["bn-tree"].operatorColor})))}componentWillLoad(){this.validateEdgesProp(this.edges),this.validateDirection(this.direction),this.validateLevelSpacing(this.levelSpacing),this.validateNodeSpacing(this.nodeSpacing),this.validateEdgeStyle(this.edgeStyle)}connectedCallback(){this.observeLayout(),this.updateNodeRects()}componentDidLoad(){var t;null===(t=this.element.shadowRoot)||void 0===t||t.addEventListener("slotchange",(()=>{this.observeLayout(),this.updateNodeRects()})),requestAnimationFrame((()=>{this.updateNodeRects()}))}componentDidRender(){this.observeLayout(),this.updateNodeRects()}disconnectedCallback(){var t;this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.observed.clear(),null===(t=this.parentObserver)||void 0===t||t.disconnect(),this.parentObserver=null}observeLayout(){var t,e,n;const i=null!==(e=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".tree-grid"))&&void 0!==e?e:null;if(i!==this.gridContainer&&(null===(n=this.resizeObserver)||void 0===n||n.disconnect(),this.observed.clear(),this.gridContainer=i),i){this.resizeObserver||(this.resizeObserver=new ResizeObserver((()=>{this.updateNodeRects()}))),this.parentObserver||(this.parentObserver=y(this.element,(()=>this.checkOverflow())));for(const t of[i,...Array.from(this.element.querySelectorAll("[slot]"))])this.observed.has(t)||(this.resizeObserver.observe(t),this.observed.add(t))}}recalculateLayout(){this.layout=this.treeConfig?function(t,e,n,i){if(!t.rootNode)return{positions:new Map,gridTemplateColumns:"",gridTemplateRows:"",maxLevel:0,maxIndex:0};const s=function(t){const e=new Map;if(!t.rootNode)return e;const n=[{node:t.rootNode,level:0}],i=new Set;for(;n.length>0;){const{node:s,level:o}=n.shift();if(i.has(s))continue;i.add(s),e.set(s,o);const r=t.adjacencyList.get(s)||[];for(const t of r)i.has(t)||n.push({node:t,level:o+1})}return e}(t),o=function(t){const e=new Map;if(!t.rootNode)return e;let n=0;return function i(s){const o=e.get(s);if(o)return o;const r=t.adjacencyList.get(s)||[];if(e.set(s,{startIndex:n,endIndex:n}),0===r.length){const t={startIndex:n,endIndex:n};return e.set(s,t),n++,t}let l=1/0,a=-1/0;for(const t of r){const e=i(t);l=Math.min(l,e.startIndex),a=Math.max(a,e.endIndex)}const d={startIndex:l,endIndex:a};return e.set(s,d),d}(t.rootNode),e}(t),r=function(t,e,n,i){var s,o;const r=new Map,l=Math.max(...Array.from(e.values()));for(const a of t.allNodes){const d=null!==(s=e.get(a))&&void 0!==s?s:0,c=null!==(o=n.get(a))&&void 0!==o?o:{startIndex:0,endIndex:0};let u,h,f=1,p=1;const g=c.endIndex-c.startIndex+1,v=Array.from(t.allNodes).some((t=>{var i;const s=n.get(t);return t!==a&&void 0!==s&&(null!==(i=e.get(t))&&void 0!==i?i:0)===d&&s.startIndex<=c.endIndex&&c.startIndex<=s.endIndex})),y=v?1:g;switch(i){case"ltr":u=d+1,h=c.startIndex+1,f=g;break;case"rtl":u=l-d+1,h=c.startIndex+1,f=g;break;case"ttb":h=d+1,u=c.startIndex+1,p=y;break;case"btt":h=l-d+1,u=c.startIndex+1,p=y}r.set(a,{nodeId:a,level:d,index:c.startIndex,gridColumn:u,gridRow:h,gridRowSpan:f,gridColumnSpan:p})}return r}(t,s,o,e),l=Math.max(...Array.from(s.values())),a=Math.max(...Array.from(o.values()).map((t=>t.endIndex))),{gridTemplateColumns:d,gridTemplateRows:c}=function(t,e,n,i,s){const o=t+1,r=e+1;if("ltr"===n||"rtl"===n){const t=[];for(let e=0;e<o;e++)t.push("auto"),e<o-1&&t.push(i+"px");const e=[];for(let t=0;t<r;t++)e.push("auto"),t<r-1&&e.push(s+"px");return{gridTemplateColumns:t.join(" "),gridTemplateRows:e.join(" ")}}{const t=[];for(let e=0;e<o;e++)t.push("auto"),e<o-1&&t.push(i+"px");const e=[];for(let t=0;t<r;t++)e.push("auto"),t<r-1&&e.push(s+"px");return{gridTemplateColumns:e.join(" "),gridTemplateRows:t.join(" ")}}}(l,a,e,n,i);return{positions:r,gridTemplateColumns:d,gridTemplateRows:c,maxLevel:l,maxIndex:a}}(this.treeConfig,this.direction,this.levelSpacing,this.nodeSpacing):null}updateNodeRects(){var t;if(!this.treeConfig||!this.gridContainer)return void(null===(t=this.errors)||void 0===t||t.remove("WARN_overflow"));const e=this.gridContainer.getBoundingClientRect(),n=new Map;for(const t of this.treeConfig.allNodes){const i=this.element.querySelector(`[slot="${t}"]`);i&&n.set(t,M(i,e))}(function(t,e){if(t.size!==e.size)return!1;for(const[n,i]of t){const t=e.get(n);if(!t||t.left!==i.left||t.top!==i.top||t.width!==i.width||t.height!==i.height)return!1}return!0})(this.nodeRects,n)||(this.nodeRects=n),this.svgWidth=e.width,this.svgHeight=e.height,this.checkOverflow()}checkOverflow(){var t,e;const n="WARN_overflow",i=g(this.element),s=(null===(t=this.gridContainer)||void 0===t?void 0:t.scrollWidth)||0,o=(null===(e=this.gridContainer)||void 0===e?void 0:e.scrollHeight)||0,r=[];i.width>0&&s>i.width+1&&r.push(`width (${Math.round(s)}px > ${Math.round(i.width)}px)`);const l=v(this.element,o);l>1&&r.push(`height (${Math.round(o)}px > ${Math.round(o-l)}px)`),0!==r.length?this.errors.addOrReplace({id:n,type:"warning",message:`Tree exceeds available ${r.join(" and ")} and will be cut off. Reduce level-spacing, node-spacing or the node content, or enlarge the container.`}):this.errors.remove(n)}getSlotStyle(t){if(!this.layout)return{};const e=this.layout.positions.get(t);return e?"ltr"===this.direction||"rtl"===this.direction?{"grid-column":w(e.gridColumn)+"","grid-row":`${$(e.gridRow)} / span ${S(e.gridRowSpan)}`,"align-self":"center"}:{"grid-row":$(e.gridRow)+"","grid-column":`${w(e.gridColumn)} / span ${k(e.gridColumnSpan)}`,"justify-self":"center"}:{}}renderEdges(){var t;if(!this.treeConfig||0===this.nodeRects.size)return null;const e=this.getTreeStyle(),i=[],s=[],o=new Map;for(const t of this.treeConfig.edges){const e=o.get(t.to)||[];e.push(t.from),o.set(t.to,e)}const r=new Map;for(const[t,e]of this.treeConfig.adjacencyList.entries()){const n=this.nodeRects.get(t),i=e.map((t=>this.nodeRects.get(t))).filter((t=>void 0!==t)),s=n?L(n,i,this.direction):void 0;void 0!==s&&r.set(t,s)}for(const t of this.treeConfig.edges){const s=this.nodeRects.get(t.from),l=this.nodeRects.get(t.to);if(!s||!l)continue;const a=R(s,!0,this.direction),d=o.get(t.to)||[];let c;if(d.length>1){const e=d.indexOf(t.from);c=j(l,this.direction,e,d.length)}else c=R(l,!1,this.direction);const{path:u}=A(a,c,this.edgeStyle,this.direction,r.get(t.from)),h=N(e.edgeColor,e.edgeWidth,t.style);i.push(n("path",{key:`edge-${t.from}-${t.to}`,d:u,fill:"none",stroke:h.stroke,"stroke-width":h.strokeWidth,"stroke-dasharray":h.strokeDasharray}))}if(this.showOperators)for(const[i,o]of this.treeConfig.adjacencyList.entries()){const l=r.get(i);if(void 0!==l)for(let r=0;r<o.length-1;r++){const a=o[r],d=o[r+1],c=x(this.treeConfig.edges,i,a);if(!(null==c?void 0:c.operator)||"none"===c.operator)continue;const u=this.nodeRects.get(a),h=this.nodeRects.get(d);if(!u||!h)continue;const f=null!==(t=c.label)&&void 0!==t?t:b(c.operator),p=C(l,u,h,this.direction);s.push(n("g",{key:`operator-${i}-${a}`,class:"operator-group"},n("circle",{cx:p.x,cy:p.y,r:e.operatorCircleRadius,fill:"white",stroke:e.edgeColor,"stroke-width":e.edgeWidth}),n("text",{x:p.x,y:p.y,"text-anchor":"middle","dominant-baseline":"central",style:{fontSize:e.operatorFontSize+"px",fill:e.operatorColor,fontWeight:"bold"}},f)))}}return n("svg",{class:"edge-layer",width:this.svgWidth,height:this.svgHeight,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none"}},i,s)}renderSlots(){return this.treeConfig&&this.layout?Array.from(this.treeConfig.allNodes).map((t=>n("div",{key:t,class:"tree-node","data-bn-fit-content":"",style:this.getSlotStyle(t)},n("slot",{name:t})))):null}getFontStyles(){return this.componentStyle((t=>{var e,n,i,s;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":((null===(n=t.global)||void 0===n?void 0:n.fontSizePx)||13.3333)+"px","--bn-font-color":(null===(i=t.global)||void 0===i?void 0:i.fontColor)||"#000000","--bn-font-background":(null===(s=t.global)||void 0===s?void 0:s.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return n(i,{style:t},this.treeConfig&&this.layout?n("div",{class:"tree-container"},n("div",{class:"tree-grid",style:{display:"grid","grid-template-columns":this.layout.gridTemplateColumns,"grid-template-rows":this.layout.gridTemplateRows,position:"relative"}},this.renderEdges(),this.renderSlots())):n("div",{class:"tree-container tree-error"},n("slot",null)))}get element(){return this}static get watchers(){return{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}]}}static get style(){return':host{display:inline-block;position:relative;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.tree-container{position:relative;display:inline-block}.tree-grid{position:relative;display:grid;align-items:center}.tree-node{position:relative;z-index:1;border:1px solid #404040;background:var(--bn-font-background, white)}.edge-layer{position:absolute;top:0;left:0;z-index:0;pointer-events:none;overflow:visible}.tree-error{display:flex;flex-wrap:wrap;gap:20px}'}},[257,"bn-tree",{selectedStyle:[513,"selected-style"],edges:[1],direction:[1],levelSpacing:[2,"level-spacing"],nodeSpacing:[2,"node-spacing"],edgeStyle:[1,"edge-style"],i18nNamespace:[513,"i18n-namespace"],showOperators:[4,"show-operators"],treeConfig:[32],layout:[32],nodeRects:[32],svgWidth:[32],svgHeight:[32],getLayoutState:[64]},void 0,{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}]}]),D=T,E=function(){"undefined"!=typeof customElements&&["bn-tree"].forEach((t=>{"bn-tree"===t&&(customElements.get(s(t))||customElements.define(s(t),T))}))};export{D as BnTree,E as defineCustomElement}
1
+ import{p as t,H as e,h as n,a as i,t as s}from"./p-D6YGOYV1.js";import{o}from"./p-BKLq0Pbv.js";import{LAYOUT_STATE_VERSION as r}from"./index.js";import{o as l,m as a}from"./p-BrJZUp-K.js";import{r as d,a as c}from"./p-CckAR27O.js";import{w as u}from"./p-Dq9dG0Kr.js";import{w as h}from"./p-uCpFBDF5.js";import{w as f}from"./p-9X5fVJqR.js";import{w as p}from"./p-4vVbchX2.js";import{g,a as v}from"./p-Dsvjkuy3.js";import{o as y}from"./p-B6kka9sT.js";const m=["*","/","+","-","x","÷","none"];function b(t){switch(t){case"*":case"x":return"×";case"/":case"÷":return"÷";case"+":return"+";case"-":return"−";default:return""}}function x(t,e,n){return t.find((t=>t.from===e&&t.to===n))}function $(t){return 2*(t-1)+1}function w(t){return 2*(t-1)+1}function S(t){return t<=1?1:2*(t-1)+1}function k(t){return S(t)}function M(t,e){const n=t.getBoundingClientRect(),i=n.left-e.left,s=n.top-e.top;return{left:i,top:s,width:n.width,height:n.height,centerX:i+n.width/2,centerY:s+n.height/2}}function R(t,e,n){switch(n){case"ltr":return e?{x:t.left+t.width,y:t.centerY}:{x:t.left,y:t.centerY};case"rtl":return e?{x:t.left,y:t.centerY}:{x:t.left+t.width,y:t.centerY};case"ttb":return e?{x:t.centerX,y:t.top+t.height}:{x:t.centerX,y:t.top};case"btt":return e?{x:t.centerX,y:t.top}:{x:t.centerX,y:t.top+t.height}}}function A(t,e,n,i,s=8){const o=-(i-1)*s/2+n*s;switch(e){case"ltr":return{x:t.left,y:t.centerY+o};case"rtl":return{x:t.left+t.width,y:t.centerY+o};case"ttb":return{x:t.centerX+o,y:t.top};case"btt":return{x:t.centerX+o,y:t.top+t.height}}}function L(t,e,n,i,s){switch(n){case"straight":return function(t,e){return{path:`M ${t.x} ${t.y} L ${e.x} ${e.y}`,midpoint:{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}}(t,e);case"curved":return function(t,e,n){let i,s;if("ltr"===n||"rtl"===n){const n=(t.x+e.x)/2;i={x:n,y:t.y},s={x:n,y:e.y}}else{const n=(t.y+e.y)/2;i={x:t.x,y:n},s={x:e.x,y:n}}return{path:`M ${t.x} ${t.y} C ${i.x} ${i.y}, ${s.x} ${s.y}, ${e.x} ${e.y}`,midpoint:{x:.125*t.x+.375*i.x+.375*s.x+.125*e.x,y:.125*t.y+.375*i.y+.375*s.y+.125*e.y}}}(t,e,i);default:return function(t,e,n,i){let s,o;if("ltr"===n||"rtl"===n){const n=null!=i?i:t.x+.7*(e.x-t.x);s=`M ${t.x} ${t.y} L ${n} ${t.y} L ${n} ${e.y} L ${e.x} ${e.y}`,o={x:n,y:(t.y+e.y)/2}}else{const n=null!=i?i:t.y+.7*(e.y-t.y);s=`M ${t.x} ${t.y} L ${t.x} ${n} L ${e.x} ${n} L ${e.x} ${e.y}`,o={x:(t.x+e.x)/2,y:n}}return{path:s,midpoint:o}}(t,e,i,s)}}function j(t,e,n){let i,s,o;switch(n){case"ltr":i=t.left+t.width,s=e.map((t=>t.left)),o=1;break;case"rtl":i=t.left,s=e.map((t=>t.left+t.width)),o=-1;break;case"ttb":i=t.top+t.height,s=e.map((t=>t.top)),o=1;break;case"btt":i=t.top,s=e.map((t=>t.top+t.height)),o=-1}const r=s.map((t=>(t-i)*o)).filter((t=>t>=0));if(0!==r.length)return i+Math.min(...r)*o*.7}function C(t,e,n,i){return"ltr"===i||"rtl"===i?{x:t,y:(e.centerY+n.centerY)/2}:{x:(e.centerX+n.centerX)/2,y:t}}function N(t,e,n){var i,s;return Object.assign({stroke:null!==(i=null==n?void 0:n.color)&&void 0!==i?i:t,strokeWidth:null!==(s=null==n?void 0:n.width)&&void 0!==s?s:e},(null==n?void 0:n.dasharray)?{strokeDasharray:n.dasharray}:{})}const T=t(class extends e{validateEdgesProp(t){const e="ERR_edges",n=function(t){const e=[];if(!t||""===t.trim())return e.push("edges: value is required"),e;let n;try{n=JSON.parse(t)}catch(t){return e.push("edges: invalid JSON structure"),e}if(!Array.isArray(n))return e.push("edges: must be an array"),e;if(0===n.length)return e.push("edges: array must not be empty"),e;const i=new Set,s=new Set,o=new Map;n.forEach(((t,n)=>{if("object"!=typeof t||null===t)return void e.push(`edges[${n}]: must be an object`);const r=t;if("string"!=typeof r.from||""===r.from.trim()?e.push(`edges[${n}]: 'from' is required and must be a non-empty string`):i.add(r.from),"string"!=typeof r.to||""===r.to.trim()?e.push(`edges[${n}]: 'to' is required and must be a non-empty string`):(i.add(r.to),s.add(r.to),"string"==typeof r.from&&o.set(r.from,[...o.get(r.from)||[],r.to])),void 0!==r.operator&&("string"==typeof r.operator&&m.includes(r.operator)||e.push(`edges[${n}]: 'operator' must be one of: ${m.join(", ")}`)),void 0!==r.label&&"string"!=typeof r.label&&e.push(`edges[${n}]: 'label' must be a string`),void 0!==r.style)if("object"!=typeof r.style||null===r.style)e.push(`edges[${n}]: 'style' must be an object`);else{const t=r.style;void 0!==t.color&&"string"!=typeof t.color&&e.push(`edges[${n}]: 'style.color' must be a string`),void 0!==t.width&&"number"!=typeof t.width&&e.push(`edges[${n}]: 'style.width' must be a number`),void 0!==t.dasharray&&"string"!=typeof t.dasharray&&e.push(`edges[${n}]: 'style.dasharray' must be a string`)}}));const r=Array.from(i).filter((t=>!s.has(t)));return 0===r.length?e.push("edges: tree has no root node (circular reference detected)"):r.length>1?e.push("edges: tree has multiple root nodes: "+r.join(", ")):e.push(...function(t,e,n){const i=[],s=new Set,o=new Set,r=t=>{o.add(t),s.add(t);for(const n of e.get(t)||[])s.has(n)?i.push(`edges: circular reference, the edge from '${t}' to '${n}' leads back`):o.has(n)||r(n);s.delete(t)};r(t);const l=Array.from(n).filter((t=>!o.has(t)));return l.length>0&&i.push(`edges: nodes not connected to the root '${t}': ${l.join(", ")}`),i}(r[0],o,i)),e}(t);n.length>0?(this.errors.addOrReplace({id:e,type:"error",message:"edges: "+n.join("; ")}),this.treeConfig=null):(this.errors.remove(e),this.treeConfig=function(t){if(!t||""===t.trim())return null;try{const e=JSON.parse(t);if(!Array.isArray(e))return null;const n=e,i=function(t){const e=new Map;for(const n of t){const t=e.get(n.from)||[];t.push(n.to),e.set(n.from,t)}return e}(n),s=function(t){const e=new Set;for(const n of t)e.add(n.from),e.add(n.to);return e}(n),o=function(t,e){const n=new Set;for(const e of t)n.add(e.to);const i=Array.from(e).filter((t=>!n.has(t)));return 1===i.length?i[0]:null}(n,s);return{edges:n,adjacencyList:i,rootNode:o,allNodes:s}}catch(t){return console.error("parseTreeConfig: failed to parse tree configuration",t),null}}(t)),this.recalculateLayout()}validateDirection(t){const e="WARN_direction",n=["ltr","rtl","ttb","btt"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`direction: invalid value '${t}', must be one of: ${n.join(", ")}`}),this.recalculateLayout()}validateLevelSpacing(t){const e="WARN_levelSpacing";!o(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`level-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateNodeSpacing(t){const e="WARN_nodeSpacing";!o(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`node-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateEdgeStyle(t){const e="WARN_edgeStyle",n=["straight","orthogonal","curved"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`edge-style: invalid value '${t}', must be one of: ${n.join(", ")}`})}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.treeConfig=null,this.layout=null,this.nodeRects=new Map,this.svgWidth=0,this.svgHeight=0,this.resizeObserver=null,this.gridContainer=null,this.observed=new Set,this.parentObserver=null,this.direction="ltr",this.levelSpacing=60,this.nodeSpacing=20,this.edgeStyle="orthogonal",this.showOperators=!0,h(this),u(this),this.errors=p(this),this.componentStyle=f(this)}async getLayoutState(t){var e,n,i,s,o,u,h,f,p,g,v;const y=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",m=l(this.element),b=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),x={version:r,tag:this.element.localName,id:c(this.element),slot:null!==(n=this.element.getAttribute("slot"))&&void 0!==n?n:void 0,rect:a(this.element,m),em:{fontSizePx:b,appliedScaleFactor:1},regions:[],metadata:{nodeCount:null!==(s=null===(i=this.treeConfig)||void 0===i?void 0:i.allNodes.size)&&void 0!==s?s:0,edgeCount:null!==(u=null===(o=this.treeConfig)||void 0===o?void 0:o.edges.length)&&void 0!==u?u:0},diagnostics:d(this.element)},$=null===(h=this.element.shadowRoot)||void 0===h?void 0:h.querySelector(".tree-grid");if($&&x.regions.push({id:"grid",rect:a($,m)}),"full"!==y||!this.treeConfig)return x;const w=[];for(const t of this.treeConfig.allNodes){const e=this.element.querySelector(`[slot="${t}"]`);if(!e)continue;const n={kind:"node",nodeId:t,rect:a(e,m)};w.push(n)}const S=Array.from(null!==(p=null===(f=this.element.shadowRoot)||void 0===f?void 0:f.querySelectorAll("svg.edge-layer path"))&&void 0!==p?p:[]);let k=0;for(const t of this.treeConfig.edges){if(!this.nodeRects.get(t.from)||!this.nodeRects.get(t.to))continue;const e=S[k++];if(!e)break;const n={kind:"edge",from:t.from,to:t.to,operator:t.operator,path:null!==(g=e.getAttribute("d"))&&void 0!==g?g:void 0,rect:a(e,m)};w.push(n)}return null===(v=this.element.shadowRoot)||void 0===v||v.querySelectorAll("svg.edge-layer g.operator-group").forEach((t=>{var e,n;const i=null!==(n=null===(e=t.textContent)||void 0===e?void 0:e.trim())&&void 0!==n?n:"";if(!i)return;const s={kind:"label",role:"operator",text:i,rect:a(t,m)};w.push(s)})),x.elements=w,x}getTreeStyle(){return this.componentStyle((t=>({edgeColor:t["bn-tree"].edgeColor,edgeWidth:t["bn-tree"].edgeWidth,operatorCircleRadius:t["bn-tree"].operatorCircleRadius,operatorFontSize:t.global.fontSizePx*t["bn-tree"].operatorFontSizeScale,operatorColor:t["bn-tree"].operatorColor})))}componentWillLoad(){this.validateEdgesProp(this.edges),this.validateDirection(this.direction),this.validateLevelSpacing(this.levelSpacing),this.validateNodeSpacing(this.nodeSpacing),this.validateEdgeStyle(this.edgeStyle)}connectedCallback(){this.observeLayout(),this.updateNodeRects()}componentDidLoad(){var t;null===(t=this.element.shadowRoot)||void 0===t||t.addEventListener("slotchange",(()=>{this.observeLayout(),this.updateNodeRects()})),requestAnimationFrame((()=>{this.updateNodeRects()}))}componentDidRender(){this.observeLayout(),this.updateNodeRects()}disconnectedCallback(){var t;this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.observed.clear(),null===(t=this.parentObserver)||void 0===t||t.disconnect(),this.parentObserver=null}observeLayout(){var t,e,n;const i=null!==(e=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".tree-grid"))&&void 0!==e?e:null;if(i!==this.gridContainer&&(null===(n=this.resizeObserver)||void 0===n||n.disconnect(),this.observed.clear(),this.gridContainer=i),i){this.resizeObserver||(this.resizeObserver=new ResizeObserver((()=>{this.updateNodeRects()}))),this.parentObserver||(this.parentObserver=y(this.element,(()=>this.checkOverflow())));for(const t of[i,...Array.from(this.element.querySelectorAll("[slot]"))])this.observed.has(t)||(this.resizeObserver.observe(t),this.observed.add(t))}}recalculateLayout(){this.layout=this.treeConfig?function(t,e,n,i){if(!t.rootNode)return{positions:new Map,gridTemplateColumns:"",gridTemplateRows:"",maxLevel:0,maxIndex:0};const s=function(t){const e=new Map;if(!t.rootNode)return e;const n=[{node:t.rootNode,level:0}],i=new Set;for(;n.length>0;){const{node:s,level:o}=n.shift();if(i.has(s))continue;i.add(s),e.set(s,o);const r=t.adjacencyList.get(s)||[];for(const t of r)i.has(t)||n.push({node:t,level:o+1})}return e}(t),o=function(t){const e=new Map;if(!t.rootNode)return e;let n=0;return function i(s){const o=e.get(s);if(o)return o;const r=t.adjacencyList.get(s)||[];if(e.set(s,{startIndex:n,endIndex:n}),0===r.length){const t={startIndex:n,endIndex:n};return e.set(s,t),n++,t}let l=1/0,a=-1/0;for(const t of r){const e=i(t);l=Math.min(l,e.startIndex),a=Math.max(a,e.endIndex)}const d={startIndex:l,endIndex:a};return e.set(s,d),d}(t.rootNode),e}(t),r=function(t,e,n,i){var s,o;const r=new Map,l=Math.max(...Array.from(e.values()));for(const a of t.allNodes){const d=null!==(s=e.get(a))&&void 0!==s?s:0,c=null!==(o=n.get(a))&&void 0!==o?o:{startIndex:0,endIndex:0};let u,h,f=1,p=1;const g=c.endIndex-c.startIndex+1,v=Array.from(t.allNodes).some((t=>{var i;const s=n.get(t);return t!==a&&void 0!==s&&(null!==(i=e.get(t))&&void 0!==i?i:0)===d&&s.startIndex<=c.endIndex&&c.startIndex<=s.endIndex})),y=v?1:g;switch(i){case"ltr":u=d+1,h=c.startIndex+1,f=g;break;case"rtl":u=l-d+1,h=c.startIndex+1,f=g;break;case"ttb":h=d+1,u=c.startIndex+1,p=y;break;case"btt":h=l-d+1,u=c.startIndex+1,p=y}r.set(a,{nodeId:a,level:d,index:c.startIndex,gridColumn:u,gridRow:h,gridRowSpan:f,gridColumnSpan:p})}return r}(t,s,o,e),l=Math.max(...Array.from(s.values())),a=Math.max(...Array.from(o.values()).map((t=>t.endIndex))),{gridTemplateColumns:d,gridTemplateRows:c}=function(t,e,n,i,s){const o=t+1,r=e+1;if("ltr"===n||"rtl"===n){const t=[];for(let e=0;e<o;e++)t.push("auto"),e<o-1&&t.push(i+"px");const e=[];for(let t=0;t<r;t++)e.push("auto"),t<r-1&&e.push(s+"px");return{gridTemplateColumns:t.join(" "),gridTemplateRows:e.join(" ")}}{const t=[];for(let e=0;e<o;e++)t.push("auto"),e<o-1&&t.push(i+"px");const e=[];for(let t=0;t<r;t++)e.push("auto"),t<r-1&&e.push(s+"px");return{gridTemplateColumns:e.join(" "),gridTemplateRows:t.join(" ")}}}(l,a,e,n,i);return{positions:r,gridTemplateColumns:d,gridTemplateRows:c,maxLevel:l,maxIndex:a}}(this.treeConfig,this.direction,this.levelSpacing,this.nodeSpacing):null}updateNodeRects(){var t;if(!this.treeConfig||!this.gridContainer)return void(null===(t=this.errors)||void 0===t||t.remove("WARN_overflow"));const e=this.gridContainer.getBoundingClientRect(),n=new Map;for(const t of this.treeConfig.allNodes){const i=this.element.querySelector(`[slot="${t}"]`);i&&n.set(t,M(i,e))}(function(t,e){if(t.size!==e.size)return!1;for(const[n,i]of t){const t=e.get(n);if(!t||t.left!==i.left||t.top!==i.top||t.width!==i.width||t.height!==i.height)return!1}return!0})(this.nodeRects,n)||(this.nodeRects=n),this.svgWidth=e.width,this.svgHeight=e.height,this.checkOverflow()}checkOverflow(){var t,e;const n="WARN_overflow",i=g(this.element),s=(null===(t=this.gridContainer)||void 0===t?void 0:t.scrollWidth)||0,o=(null===(e=this.gridContainer)||void 0===e?void 0:e.scrollHeight)||0,r=[];i.width>0&&s>i.width+1&&r.push(`width (${Math.round(s)}px > ${Math.round(i.width)}px)`);const l=v(this.element,o);l>1&&r.push(`height (${Math.round(o)}px > ${Math.round(o-l)}px)`),0!==r.length?this.errors.addOrReplace({id:n,type:"warning",message:`Tree exceeds available ${r.join(" and ")} and will be cut off. Reduce level-spacing, node-spacing or the node content, or enlarge the container.`}):this.errors.remove(n)}getSlotStyle(t){if(!this.layout)return{};const e=this.layout.positions.get(t);return e?"ltr"===this.direction||"rtl"===this.direction?{"grid-column":$(e.gridColumn)+"","grid-row":`${w(e.gridRow)} / span ${S(e.gridRowSpan)}`,"align-self":"center"}:{"grid-row":w(e.gridRow)+"","grid-column":`${$(e.gridColumn)} / span ${k(e.gridColumnSpan)}`,"justify-self":"center"}:{}}renderEdges(){var t;if(!this.treeConfig||0===this.nodeRects.size)return null;const e=this.getTreeStyle(),i=[],s=[],o=new Map;for(const t of this.treeConfig.edges){const e=o.get(t.to)||[];e.push(t.from),o.set(t.to,e)}const r=new Map;for(const[t,e]of this.treeConfig.adjacencyList.entries()){const n=this.nodeRects.get(t),i=e.map((t=>this.nodeRects.get(t))).filter((t=>void 0!==t)),s=n?j(n,i,this.direction):void 0;void 0!==s&&r.set(t,s)}for(const t of this.treeConfig.edges){const s=this.nodeRects.get(t.from),l=this.nodeRects.get(t.to);if(!s||!l)continue;const a=R(s,!0,this.direction),d=o.get(t.to)||[];let c;if(d.length>1){const e=d.indexOf(t.from);c=A(l,this.direction,e,d.length)}else c=R(l,!1,this.direction);const{path:u}=L(a,c,this.edgeStyle,this.direction,r.get(t.from)),h=N(e.edgeColor,e.edgeWidth,t.style);i.push(n("path",{key:`edge-${t.from}-${t.to}`,d:u,fill:"none",stroke:h.stroke,"stroke-width":h.strokeWidth,"stroke-dasharray":h.strokeDasharray}))}if(this.showOperators)for(const[i,o]of this.treeConfig.adjacencyList.entries()){const l=r.get(i);if(void 0!==l)for(let r=0;r<o.length-1;r++){const a=o[r],d=o[r+1],c=x(this.treeConfig.edges,i,a);if(!(null==c?void 0:c.operator)||"none"===c.operator)continue;const u=this.nodeRects.get(a),h=this.nodeRects.get(d);if(!u||!h)continue;const f=null!==(t=c.label)&&void 0!==t?t:b(c.operator),p=C(l,u,h,this.direction);s.push(n("g",{key:`operator-${i}-${a}`,class:"operator-group"},n("circle",{cx:p.x,cy:p.y,r:e.operatorCircleRadius,fill:"white",stroke:e.edgeColor,"stroke-width":e.edgeWidth}),n("text",{x:p.x,y:p.y,"text-anchor":"middle","dominant-baseline":"central",style:{fontSize:e.operatorFontSize+"px",fill:e.operatorColor,fontWeight:"bold"}},f)))}}return n("svg",{class:"edge-layer",width:this.svgWidth,height:this.svgHeight,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none"}},i,s)}renderSlots(){return this.treeConfig&&this.layout?Array.from(this.treeConfig.allNodes).map((t=>n("div",{key:t,class:"tree-node","data-bn-fit-content":"",style:this.getSlotStyle(t)},n("slot",{name:t})))):null}getFontStyles(){return this.componentStyle((t=>{var e,n,i,s;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":((null===(n=t.global)||void 0===n?void 0:n.fontSizePx)||13.3333)+"px","--bn-font-color":(null===(i=t.global)||void 0===i?void 0:i.fontColor)||"#000000","--bn-font-background":(null===(s=t.global)||void 0===s?void 0:s.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return n(i,{style:t},this.treeConfig&&this.layout?n("div",{class:"tree-container"},n("div",{class:"tree-grid",style:{display:"grid","grid-template-columns":this.layout.gridTemplateColumns,"grid-template-rows":this.layout.gridTemplateRows,position:"relative"}},this.renderEdges(),this.renderSlots())):n("div",{class:"tree-container tree-error"},n("slot",null)))}get element(){return this}static get watchers(){return{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}]}}static get style(){return':host{display:inline-block;position:relative;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.tree-container{position:relative;display:inline-block}.tree-grid{position:relative;display:grid;align-items:center}.tree-node{position:relative;z-index:1;border:1px solid #404040;background:var(--bn-font-background, white)}.edge-layer{position:absolute;top:0;left:0;z-index:0;pointer-events:none;overflow:visible}.tree-error{display:flex;flex-wrap:wrap;gap:20px}'}},[257,"bn-tree",{selectedStyle:[513,"selected-style"],edges:[1],direction:[1],levelSpacing:[2,"level-spacing"],nodeSpacing:[2,"node-spacing"],edgeStyle:[1,"edge-style"],i18nNamespace:[513,"i18n-namespace"],showOperators:[4,"show-operators"],treeConfig:[32],layout:[32],nodeRects:[32],svgWidth:[32],svgHeight:[32],getLayoutState:[64]},void 0,{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}]}]),E=T,I=function(){"undefined"!=typeof customElements&&["bn-tree"].forEach((t=>{"bn-tree"===t&&(customElements.get(s(t))||customElements.define(s(t),T))}))};export{E as BnTree,I as defineCustomElement}
@@ -0,0 +1 @@
1
+ import{f as r,g as s}from"./p-D6YGOYV1.js";import{g as o,c as t}from"./p-Cxx0YNnl.js";import{r as a}from"./p-Dq9dG0Kr.js";import{m as e}from"./p-B2NXsfMz.js";const p=p=>{let m,f,n,c;const i=()=>{const r=f.componentStyles.state;c=e([r._system||{},r._default||{},r[n]||{}],{arrayMergeType:"overwrite"})},j=p.connectedCallback;p.connectedCallback=()=>{const t=s(p);f=o(t),c=f.componentStyles.state._system,n=p.selectedStyle,i(),m=f.componentStyles.on("set",(o=>{o!==n&&"_default"!==o||(n=p.selectedStyle,i(),r(s(p)))})),a(j,p)};const d=p.disconnectedCallback;return p.disconnectedCallback=()=>{a(m),t(s(p)),a(d,p)},r=>(void 0!==f&&p.selectedStyle!==n&&(n=p.selectedStyle,i()),r(c))};export{p as w}
@@ -0,0 +1 @@
1
+ import{D as t}from"./p-Dq9dG0Kr.js";var e,s;!function(t){t.YEAR="year",t.QUARTER="quarter",t.MONTH="month",t.WEEK="week",t.DAY="day",t.HOUR="hour",t.MINUTE="minute",t.SECOND="second",t.MILLISECOND="millisecond",t.NONE="fallback",t.AUTO="auto"}(e||(e={})),function(t){t.AVG="avg",t.INTERVAL="interval",t.START="start",t.END="end",t.YTD="ytd",t.YTG="ytg",t.CUM="cum",t.MAT="mat",t.NONE="none",t.AUTO="auto"}(s||(s={}));class r{constructor(){this._dateFormat={year:"yyyy",quarter:"q'Q' yyyy",month:"LLL yyyy",week:"'KW'WW kkkk",day:"dd.MM.yyyy",hour:"TT",minute:"TT",second:"TT",millisecond:"TT:SSS",fallback:"dd.MM.yyyy"},this._dateFormatShort={year:"yy",quarter:"q'Q'",month:"LLL",week:"'KW'WW",day:"dd",hour:"hh'h'",minute:"mm'm'",second:"ss's'",millisecond:"SSS'ms'",fallback:"dd.MM.yyyy"},this._dateLinkFormat={avg:"Ø[LINK]",interval:"[DATE]..[DATE2]",start:".[DATE]",end:"[DATE].",ytd:"_[DATE]",ytg:"[DATE]_",cum:"[DATE]_[DATE2]",mat:"~[DATE]",none:"[DATE]"},this.locale="de",this.dateFormatPinned=!1,this.dateFormatShortPinned=!1,this.dateFormat=this._dateFormat,this.dateLinkFormat=this._dateLinkFormat,this.dateFormatShort=this._dateFormatShort}setDateLinkFormat(t){this.dateLinkFormat=t}setDateFormat(t){this.dateFormat=t,this.dateFormatPinned=!0}setDateFormatShort(t){this.dateFormatShort=t,this.dateFormatShortPinned=!0}patchDateFormatShort(t){this.dateFormatShort=Object.assign(Object.assign({},this.dateFormatShort),t)}setLocale(t){this.locale=t,this.dateFormatPinned||(this.dateFormat=Object.assign(Object.assign({},this._dateFormat),r.LOCALE_DATE_FORMAT[t]||{})),this.dateFormatShortPinned||(this.dateFormatShort=Object.assign(Object.assign({},this._dateFormatShort),r.LOCALE_DATE_FORMAT_SHORT[t]||{}))}getDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormat[e]||this.dateFormat.fallback)}getSmartDateString(t,s){switch(s){case e.DAY:return this.getFormatedDayDate(t);case e.MONTH:return this.getFormatedMonthDate(t);case e.QUARTER:return this.getFormatedQuarterDate(t);case e.WEEK:return this.getFormatedWeekDate(t);case e.HOUR:return this.getFormatedHourDate(t);case e.MINUTE:return this.getFormatedMinuteDate(t);case e.SECOND:return this.getFormatedSecondDate(t);case e.MILLISECOND:return this.getFormatedMilliSecondDate(t);default:return this.getDateString(t,s)}}calculateDistanceType(s,r,i=32){if(null==r)return e.DAY;const a="number"==typeof s?t.fromMillis(s):s,n="number"==typeof r?t.fromMillis(r):r;return 0===n.diff(a).as("milliseconds")?e.DAY:n.diff(a).as("milliseconds")<i?e.MILLISECOND:n.diff(a).as("seconds")<i?e.SECOND:n.diff(a).as("minutes")<i?e.MINUTE:n.diff(a).as("hours")<i?e.HOUR:n.diff(a).as("days")<i?e.DAY:n.diff(a).as("weeks")<i?e.WEEK:n.diff(a).as("months")<i?e.MONTH:n.diff(a).as("quarters")<i?e.QUARTER:e.YEAR}datesBetween(t,e,s){const r=this.convertDateDistanceToMomentunitOfTime(s),i=t.startOf(r),a=e.endOf(r),n=[];let h=i;do{n.push(h),h=h.plus(this.createDiratonLike(r,1))}while(h<=a);return n}countBetween(t,e,s){const r=this.convertDateDistanceToMomentunitOfTime(s);return Math.floor(e.startOf(r).diff(t.startOf(r),r).as(r))+1}getDateLinkString(r,i,a,n,h){if(null==r&&null==i)return"";if(null==r&&a!==s.END&&a!==s.YTD)return"";if(null==i&&(s.INTERVAL===a||s.CUM===a||s.END===a||s.YTD===a))return"";const u=r||t.now(),c=i;n===e.AUTO&&(n=this.calculateDistanceType(u,c,h));let o=this.getDateString(u,n),l="",d=s.NONE;return null!=c&&(l=this.getDateString(c,n),d=s.INTERVAL,o===l&&a===s.INTERVAL&&(a=s.NONE),o===l&&a===s.AVG&&(d=s.NONE),s.END!==a&&s.YTD!==a||(o=l),a!==s.INTERVAL&&a!==s.CUM&&a!==s.AVG||(n===e.QUARTER?u.quarter===c.quarter&&u.year===c.year?l=l.replace(" "+c.year,""):u.year===c.year&&(o=o.replace(" "+u.year,"")):n===e.MONTH?u.month===c.month&&u.year===c.year?l=l.replace(" "+c.year,""):u.year===c.year&&(o=o.replace(" "+u.year,"")):n===e.WEEK&&(u.weekNumber===c.weekNumber&&u.weekYear===c.weekYear?l=l.replace(" "+c.weekYear,""):u.weekYear===c.weekYear&&(o=o.replace(" "+u.weekYear,""))))),this.dateLinkFormat[a].replace("[LINK]",this.dateLinkFormat[d]).replace("[DATE]",o).replace("[DATE2]",l)}getShortDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormatShort[e]||this.dateFormatShort.fallback)}getFormatedDayDate(t){let e=this.dateFormatShort.day;return this.isFirstInMonth(t)&&(e+=" "+this.dateFormatShort.month),this.isJanuary(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedMonthDate(t){let e=this.dateFormatShort.month;return this.isJanuary(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedQuarterDate(t){let e=this.dateFormatShort.quarter;return this.isFirstQuarter(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedWeekDate(t){let e=this.dateFormatShort.week;return this.isFirstWeek(t)&&(e+=" kk"),t.setLocale(this.locale).toFormat(e)}getFormatedHourDate(t){let e=this.dateFormatShort.hour;return this.isFirstHour(t)&&(e+=" "+this.dateFormatShort.day),t.setLocale(this.locale).toFormat(e)}getFormatedMinuteDate(t){let e=this.dateFormatShort.minute;return this.isFirstMinute(t)&&(e=this.dateFormatShort.hour+":"+e),t.setLocale(this.locale).toFormat(e)}getFormatedSecondDate(t){let e=this.dateFormatShort.second;return this.isFirstSecond(t)&&(e=this.dateFormatShort.minute+":"+e),t.setLocale(this.locale).toFormat(e)}getFormatedMilliSecondDate(t){let e=this.dateFormatShort.millisecond;return this.isFirstMilliSecond(t)&&(e=this.dateFormatShort.second+":"+e),t.setLocale(this.locale).toFormat(e)}isSmartBoundary(t,s){switch(s){case e.DAY:return this.isFirstInMonth(t);case e.WEEK:return this.isFirstWeek(t);case e.MONTH:return this.isJanuary(t);case e.QUARTER:return this.isFirstQuarter(t);default:return!1}}isFirstInMonth(t){return 1===t.day}isJanuary(t){return 1===t.month}isFirstQuarter(t){return 1===t.quarter}isFirstWeek(t){return 1===t.weekNumber}isFirstHour(t){return 0===t.hour}isFirstMinute(t){return 0===t.minute}isFirstSecond(t){return 0===t.second}isFirstMilliSecond(t){return 0===t.millisecond}convertDateDistanceToMomentunitOfTime(t){let s;switch(t){case e.YEAR:s="year";break;case e.MONTH:s="month";break;case e.QUARTER:s="quarter";break;case e.WEEK:s="week";break;case e.DAY:s="day";break;case e.HOUR:s="hour";break;case e.MINUTE:s="minute";break;case e.SECOND:s="second";break;case e.MILLISECOND:s="millisecond";break;default:s="day"}return s}createDiratonLike(t,e){switch(t){case"year":return{years:e};case"month":return{months:e};case"quarter":return{quarters:e};case"week":return{weeks:e};case"day":default:return{days:e};case"hour":return{hours:e};case"minute":return{minutes:e};case"second":return{seconds:e};case"millisecond":return{milliseconds:e}}}}r.LOCALE_DATE_FORMAT={en:{week:"'W'WW kkkk",day:"MM/dd/yyyy",fallback:"MM/dd/yyyy"}},r.LOCALE_DATE_FORMAT_SHORT={en:{week:"'W'WW",fallback:"MM/dd/yyyy"}};export{e as D,s as a,r as b}
@@ -1 +1 @@
1
- import{g as t,c as s}from"./p-DDvWTgk1.js";import{r as a}from"./p-Dq9dG0Kr.js";import{g as r}from"./p-D6YGOYV1.js";const e="WARN_datasets",o=(o,n,c)=>{let i,d,f=[],p=[],u=[],m="";const g=()=>{const t=m;m=o.datasets||"",""!==t&&t!==m&&n("",[]),[u,p]=((t,s)=>{const a=[],r=[];for(const t of s)(e=t,e.startsWith("$")?a:r).push(t);var e;return[a,r]})(0,m.split(",")),((t,s)=>{const a=t.errors;if(a)if(s.length>0){const t=s.map((t=>t.substring(1))).join(", ");a.addOrReplace({id:e,type:"warning",message:`Using datasource(s) "${t}" directly. Prefer using a dataset (bn-dataset) for query support and metadata.`})}else a.remove(e)})(o,u),b()},l=(t,s)=>{const a=s?t.substring(1):t;let r;try{r=d.db.db.exec(`SELECT * FROM \`${a}\``)}catch(t){r=[]}n(t,r)},b=()=>{f.forEach((t=>t())),f=[],p.forEach((t=>{t&&(f.push(d.db.subscribe(t,(()=>l(t,!1)))),l(t,!1),(t=>{if(c){const s=d.datasetsMeta.get(t);s&&c(t,s)}})(t))})),u.forEach((t=>{t&&(f.push(d.db.subscribe(t.substring(1),(()=>l(t,!0)))),l(t,!0))}))},y=new MutationObserver((t=>{t.forEach((t=>{"datasets"===t.attributeName&&(o.datasets||"")!==m&&g()}))})),D=o.connectedCallback;o.connectedCallback=()=>{const s=r(o);d=t(s),g(),y.observe(s,{attributes:!0,attributeFilter:["datasets"]}),c&&(i=d.datasetsMeta.on("set",((t,s)=>{p.includes(t)&&c(t,s)}))),a(D,o)};const j=o.disconnectedCallback;return o.disconnectedCallback=()=>{y.disconnect(),f.forEach((t=>t())),f=[],a(i),s(r(o)),a(j,o)},t=>{p=t,b()}};export{o as w}
1
+ import{g as t,c as s}from"./p-Cxx0YNnl.js";import{r as a}from"./p-Dq9dG0Kr.js";import{g as r}from"./p-D6YGOYV1.js";const e="WARN_datasets",o=(o,n,c)=>{let i,d,f=[],p=[],u=[],m="";const g=()=>{const t=m;m=o.datasets||"",""!==t&&t!==m&&n("",[]),[u,p]=((t,s)=>{const a=[],r=[];for(const t of s)(e=t,e.startsWith("$")?a:r).push(t);var e;return[a,r]})(0,m.split(",")),((t,s)=>{const a=t.errors;if(a)if(s.length>0){const t=s.map((t=>t.substring(1))).join(", ");a.addOrReplace({id:e,type:"warning",message:`Using datasource(s) "${t}" directly. Prefer using a dataset (bn-dataset) for query support and metadata.`})}else a.remove(e)})(o,u),b()},l=(t,s)=>{const a=s?t.substring(1):t;let r;try{r=d.db.db.exec(`SELECT * FROM \`${a}\``)}catch(t){r=[]}n(t,r)},b=()=>{f.forEach((t=>t())),f=[],p.forEach((t=>{t&&(f.push(d.db.subscribe(t,(()=>l(t,!1)))),l(t,!1),(t=>{if(c){const s=d.datasetsMeta.get(t);s&&c(t,s)}})(t))})),u.forEach((t=>{t&&(f.push(d.db.subscribe(t.substring(1),(()=>l(t,!0)))),l(t,!0))}))},y=new MutationObserver((t=>{t.forEach((t=>{"datasets"===t.attributeName&&(o.datasets||"")!==m&&g()}))})),j=o.connectedCallback;o.connectedCallback=()=>{const s=r(o);d=t(s),g(),y.observe(s,{attributes:!0,attributeFilter:["datasets"]}),c&&(i=d.datasetsMeta.on("set",((t,s)=>{p.includes(t)&&c(t,s)}))),a(j,o)};const w=o.disconnectedCallback;return o.disconnectedCallback=()=>{y.disconnect(),f.forEach((t=>t())),f=[],a(i),s(r(o)),a(w,o)},t=>{p=t,b()}};export{o as w}
@@ -0,0 +1 @@
1
+ import{S as n,a as t,A as r,b as o,T as u,D as e,c as i,M as a,d as s}from"./p-B5tixDPM.js";import{T as c,i as l}from"./p-BZXiWkDS.js";import{D as f,a as d}from"./p-B5GRtTLX.js";import{O as v,a as m,p}from"./p-16rjcQ0t.js";import{r as S}from"./p-BXXjh6We.js";function y(n){return null==n||""===n||"null"===n}function b(n){return"string"==typeof n&&"none"===n.trim().toLowerCase()}function N(t){return y(t)||"auto"===t.trim().toLowerCase()?[]:O((null==t?void 0:t.split(",").filter((t=>!(t.toUpperCase().trim()in n)))).toString())}function O(r){return y(r)?[]:r.replace(";",",").split(",").filter((r=>{var o,u,e;const i=r.split("_"),a=null===(o=i[0])||void 0===o?void 0:o.replace(/^dr|^d/,"").toUpperCase().trim(),s=null===(u=i[1])||void 0===u?void 0:u.toUpperCase().trim(),c=null===(e=i[2])||void 0===e?void 0:e.toUpperCase().trim();return 3!==i.length||!(a in n)||!(s in n)||!(c in t)}))}function J(t){return y(t)?[]:O(t.split(",").filter((t=>!(t.toUpperCase().trim()in n))).toString())}function j(n){return y(n)||"auto"===n.trim().toLowerCase()?[]:O(n.split(",").filter((n=>!(n.toUpperCase()in v))).toString())}function h(n){return y(n)||"auto"===n.trim().toLowerCase()?[]:n.split(",").filter((n=>void 0===p(n)))}function A(n){return!y(n)&&Number.isInteger(Number(n))}function k(n){return!y(n)&&!Number.isNaN(Number(n))}function T(n){return!y(n)&&(null==n?void 0:n.toUpperCase())in m}function g(n){return"auto"===(null==n?void 0:n.toLowerCase())||(null==n?void 0:n.toUpperCase())in r}function G(n){if(y(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("name")&&n.hasOwnProperty("unit"))))}catch(n){console.error("validateMeasureList: failed to parse JSON",n)}return["Invalid JSON structure"]}function B(n){const t=Date.parse(n);return Number.isInteger(t)}function D(n){return(null==n?void 0:n.toUpperCase())in d}function I(n){return(null==n?void 0:n.toUpperCase())in f}function $(n){return(null==n?void 0:n.toUpperCase())in o}function E(n){return!y(n)&&(null==n?void 0:n.toUpperCase())in e}function M(n){return!y(n)&&(null==n?void 0:n.toUpperCase())in i}function X(n){return(null==n?void 0:n.toUpperCase())in c}function w(n){if(y(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("rowGroup")&&n.hasOwnProperty("category")&&n.hasOwnProperty("subCategory"))))}catch(n){console.error("validateThereOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function x(n){if(y(n))return[];try{const t=JSON.parse(n);if(null!==t&&"object"==typeof t&&!(t instanceof Array))return Object.entries(t).filter((([,n])=>"string"!=typeof n||!l(n))).map((([n,t])=>`${n}: ${t}`))}catch(n){console.error("validateAttributesJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function C(n){if(y(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("rowGroup")&&n.hasOwnProperty("category"))))}catch(n){console.error("validatePartOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function L(n){return(null==n?void 0:n.trim().toUpperCase())in a}function P(n){return["_","k","M","G","T","P","E","Z","Y","m","my","μ","n","p","f","a","z","y"].includes(null==n?void 0:n.trim())||["GREATEST","LEAST"].includes(null==n?void 0:n.trim().toUpperCase())}function q(n){return(null==n?void 0:n.toUpperCase().trim())in s}function z(n){return(null==n?void 0:n.toUpperCase().trim())in u}function R(n){if(y(n))return[];try{return JSON.parse(n).filter((n=>!(n.hasOwnProperty("scenario")&&n.hasOwnProperty("name")&&n.hasOwnProperty("subGroups"))))}catch(n){console.error("validateColumnThereOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function W(n){if(y(n))return[];try{const t=JSON.parse(n);if("object"!=typeof t||null===t||Array.isArray(t))return["stack: must be a JSON object"];const r=[];if(t.hasOwnProperty("by")){const n=["scenarios","dimensions"];n.includes(t.by)||r.push(`stack: 'by' must be one of: ${n.join(", ")}`)}else r.push("stack: 'by' is required");if(t.hasOwnProperty("mode")){const n=["absolute","relative","absolute-relative"];n.includes(t.mode)||r.push(`stack: 'mode' must be one of: ${n.join(", ")}`)}if(t.hasOwnProperty("order")){const n=["asc","desc","dataset"];n.includes(t.order)||r.push(`stack: 'order' must be one of: ${n.join(", ")}`)}return r}catch(n){return["stack: invalid JSON"]}}function Z(n){return!y(n)&&null!==S(n)}export{q as A,R as B,x as C,O as a,j as b,T as c,G as d,B as e,I as f,D as g,A as h,y as i,Z as j,b as k,g as l,P as m,W as n,k as o,$ as p,J as q,z as r,E as s,M as t,w as u,N as v,X as w,C as x,h as y,L as z}
@@ -0,0 +1 @@
1
+ import{p as t,H as i,h as s,a as e,t as h}from"./p-D6YGOYV1.js";import{r as n,m as o,s as r,g as a,d as l}from"./p-Cxx0YNnl.js";import{C as d,I as c}from"./p-D_Sbhd0L.js";import{w as u}from"./p-Dq9dG0Kr.js";import{e as v,r as m}from"./p-ClruFZD_.js";import{S as f,F as b,a as p,P as w}from"./p-eWxolPDU.js";import{d as g,S as y}from"./p-BzjGUtYh.js";import{X as x,r as M,a as $,x as z,f as S,b as j,P as L,c as P,F as D,d as W,S as C}from"./p-DQFahsnV.js";import{g as N}from"./p-4q8nRcWC.js";import{N as k}from"./p-BJmwHV0a.js";import{a as F,r as E,i as T}from"./p-BXXjh6We.js";class A{constructor(t,i,s,e,h){this.mode=t,this.vMax=i,this.rMaxPx=s,this.rMinPx=e,this.areaPerUnitPx2=h}static local(t,i,s){return new A("local",t,i,s,0)}static grouped(t){return new A("grouped",0,0,0,t)}radius(t){return"grouped"===this.mode?t<=0?0:Math.sqrt(this.areaPerUnitPx2*t/Math.PI):this.vMax<=0||t<=0?this.rMinPx:Math.max(this.rMinPx,this.rMaxPx*Math.sqrt(t/this.vMax))}}class B{constructor(t,i,s,e,h,n){var o,r,a,l;this.ruleSet=t,this.config=e,this.styles=h,this.availableWidth=n,this.warnings=[],this.canvasHeight=0,this.i18nMap=new Map,this.hatchPatterns=new Set,this.scaleOverflowCount=0,this.svgRoot=null,this.config=Object.assign(Object.assign({},e),{x:F(e.x),y:F(e.y)});const d=new x;let c=[];try{""!==s&&(c=i.exec(`SELECT * FROM ${s}`))}catch(t){this.queryError=v(t)}const u=(null!=c?c:[]).map((t=>d.adapt(t)));this.data=M(u,{pointLevel:e.pointLevel,seriesLevel:e.seriesLevel,facetLevel:null!==e.facet?"rowgroup"===e.facet.level?"rowGroup":"category":null,measures:{x:null!==(o=E(e.x.measure))&&void 0!==o?o:{kind:"scenario",slot:"ac1"},y:null!==(r=E(e.y.measure))&&void 0!==r?r:{kind:"scenario",slot:"ac2"},size:null!==(a=E(e.size.measure))&&void 0!==a?a:{kind:"scenario",slot:"ac3"},share:null!==e.share&&null!==(l=E(e.share.measure))&&void 0!==l?l:void 0},compareFamily:e.compareFamily,domains:{x:{min:this.config.x.min,max:this.config.x.max},y:{min:this.config.y.min,max:this.config.y.max}},limit:e.limit,limitBy:"size"}),this.warnings.push(...this.data.warnings)}get em(){return this.styles.fontStyles.size}get xPercent(){return T(this.config.x.measure)}get yPercent(){return T(this.config.y.measure)}get sizePercent(){return T(this.config.size.measure)}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=d(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:i?"bold":"normal"}).width;return Number.isFinite(s)&&s>0?s:.6*t.length*this.em}drawText(t,i,s,e,h={}){var n,o;return t.text(i).font({size:this.styles.fontStyles.size,weight:h.bold?"bold":"normal",anchor:null!==(n=h.anchor)&&void 0!==n?n:"start"}).fill(null!==(o=h.color)&&void 0!==o?o:this.styles.fontStyles.color).attr({x:s,y:e,"font-family":this.fontFamily()})}hasNoData(){return 0===this.data.totalPoints}getWarnings(){return this.warnings}getQueryError(){return this.queryError}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.canvasHeight}setI18n(t){this.i18nMap=t}addWarningOnce(t,i){this.warnings.some((i=>i.code===t))||this.warnings.push({code:t,data:i})}primaryColorIndex(){const t=E(this.config.size.measure);return null===t||"variance"===t.kind?10:this.ruleSet.getScenarioColorIndex(t.slot)}compareColorIndex(){return this.ruleSet.getScenarioColorIndex(`${this.config.compareFamily}1`)}seriesHue(t){const{color:i,overflowed:s}=n(t,this.styles.seriesColors);return s&&this.addWarningOnce("xy-series-overflow",{}),i}familyDisplayName(t){return this.ruleSet.getScenario(`${t}1`).group}legendModel(){var t,i;const s=[],e=null!==(i=null!==(t=this.config.size.label)&&void 0!==t?t:this.i18nMap.get("legend.size"))&&void 0!==i?i:"";""!==e&&(s.push(e),void 0!==this.config.size.unit&&""!==this.config.size.unit&&s.push(`${this.i18nMap.get("axis.in")||"in"} ${this.config.size.unit}`));const h=[];if(null!==this.config.compareFamily){const t=E(this.config.size.measure),i=null!==t&&"scenario"===t.kind?t.slot.replace(/\d+$/,""):"ac";h.push(this.legendEntry(this.familyDisplayName(this.config.compareFamily),this.compareColorIndex(),0)),h.push(this.legendEntry(this.familyDisplayName(i),this.primaryColorIndex(),0))}const n=this.data.series.map((t=>{var i;return this.legendEntry(""===t.key?null!==(i=this.ruleSet.getScenario("").name)&&void 0!==i?i:"Series":t.key,this.primaryColorIndex(),t.index)}));return{sizeCaption:s,title:this.i18nMap.get("legend.title")||null,compareEntries:h,entries:n}}legendEntry(t,i,s){const e=this.seriesHue(s),h=o(i,e,"bubble");return{label:t,treatment:h,fill:this.treatmentFill(h,s,e)}}toString(){const t=new f;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}axisTitle(t,i){var s;const e=null!==(s=t.label)&&void 0!==s?s:"";return""===e?"":void 0===t.unit||""===t.unit?e:`${e} ${i} ${t.unit}`}draw(t){var i,s,e,h,n,o,r,a,l,d,c;this.warnings=this.data.warnings.slice(),this.hatchPatterns.clear(),this.scaleOverflowCount=0,this.svgRoot=t;const u=this.em,v=this.styles.padding,m=this.i18nMap.get("axis.in")||"in",f=t.group(),b=new $(this.styles),p=this.legendModel(),w=this.config.legend.show&&(p.entries.length>0||p.sizeCaption.length>0),g=w?b.measure(p,this.config.legend.position):{width:0,height:0},y="right"===this.config.legend.position&&w?g.width+u:0,x=""!==this.config.chartTitle?1.6*u:0,M=this.axisTitle(this.config.y,m),j=this.axisTitle(this.config.x,m),L=""!==M?1.4*u:.4*u,P=1.4*u+(""!==j?1.3*u:0);let W,C=3*u,N={x:0,y:0,width:0,height:0},F=[];const E=Math.max(1,this.data.facets.length),T=null===(i=this.config.facet)||void 0===i?void 0:i.columns,B=k.domain(null!==(e=null===(s=this.data.extents)||void 0===s?void 0:s.xMin)&&void 0!==e?e:0,null!==(n=null===(h=this.data.extents)||void 0===h?void 0:h.xMax)&&void 0!==n?n:1,{min:this.config.x.min,max:this.config.x.max}),Y=k.domain(null!==(r=null===(o=this.data.extents)||void 0===o?void 0:o.yMin)&&void 0!==r?r:0,null!==(l=null===(a=this.data.extents)||void 0===a?void 0:a.yMax)&&void 0!==l?l:1,{min:this.config.y.min,max:this.config.y.max});for(let t=0;t<2;t++){const t=Math.max(10,this.availableWidth-v.left-v.right-C-y);N={x:v.left+C,y:v.top+x+L,width:t,height:t/this.config.aspect},W=new D(E,T,N,this.styles.scaleFactors.panelGap*u);const i=W.panelRect(0).height,s=Math.max(4,Math.min(8,Math.round(i/(4*u)))),e=new k(Y[0],Y[1],i,0);F=e.ticks(s);const h=z(F,this.yPercent);C=Math.max(...F.map((t=>this.textWidth(S(t,h,this.styles.locale,this.yPercent)))),u)+this.styles.scaleFactors.axisTickLength*u+.4*u}this.canvasHeight=N.y+N.height+P+("bottom"===this.config.legend.position&&w?g.height+u:0)+v.bottom,""!==this.config.chartTitle&&this.drawText(f,this.config.chartTitle,v.left,v.top+u,{bold:!0}),""!==M&&this.drawAxisTitleText(f,this.config.y,m,v.left,N.y-.6*u,"start");const H=this.buildPanels(W,B,Y),I=H[0].xScale.ticks(Math.max(3,Math.min(8,Math.round(H[0].rect.width/(7*u))))),O=z(I,this.xPercent),U=z(F,this.yPercent),V=this.config.sizeAreaPerUnit>0?A.grouped(this.config.sizeAreaPerUnit):A.local(null!==(c=null===(d=this.data.extents)||void 0===d?void 0:d.sizeMax)&&void 0!==c?c:0,this.styles.scaleFactors.bubbleMaxRadius*u,this.styles.scaleFactors.bubbleMinRadius*u);0===this.data.facets.length?this.drawPanel(f,H[0],{key:"",points:[]},V,I,F,O,U,!0,!0):this.data.facets.forEach(((t,i)=>{this.drawPanel(f,H[i],t,V,I,F,O,U,W.isOuterLeft(i),W.isOuterBottom(i),this.data.facets.length>1?t.key:"")})),""!==j&&this.drawAxisTitleText(f,this.config.x,m,N.x+N.width,N.y+N.height+2.6*u,"end"),w&&("right"===this.config.legend.position?b.draw(f,p,N.x+N.width+u,N.y,"right"):b.draw(f,p,N.x,N.y+N.height+P,"bottom")),this.scaleOverflowCount>0&&this.addWarningOnce("bubble-scale-overflow",{count:String(this.scaleOverflowCount)}),t.group().addClass("annotations")}drawAxisTitleText(t,i,s,e,h,n){var o;const r=null!==(o=i.label)&&void 0!==o?o:"",a=void 0!==i.unit&&""!==i.unit?`${s} ${i.unit}`:"",l=.3*this.em;"start"===n?(this.drawText(t,r,e,h,{bold:!0}),""!==a&&this.drawText(t,a,e+this.textWidth(r,!0)+l,h,{})):""!==a?(this.drawText(t,a,e,h,{anchor:"end"}),this.drawText(t,r,e-this.textWidth(a)-l,h,{anchor:"end",bold:!0})):this.drawText(t,r,e,h,{anchor:"end",bold:!0})}buildPanels(t,i,s){const e=[];for(let h=0;h<t.count;h++){const n=t.panelRect(h),o=new k(i[0],i[1],n.x,n.x+n.width),r=new k(s[0],s[1],n.y+n.height,n.y);e.push({rect:n,xScale:o,yScale:r,frame:new j(o,r,n,this.styles)})}return e}treatmentFill(t,i,s){return!0!==t.hatch?t.fill:(this.ensureHatchPattern(i,s),`url(#xy-fc-${i})`)}ensureHatchPattern(t,i){this.hatchPatterns.has(t)||null===this.svgRoot||(this.hatchPatterns.add(t),this.svgRoot.defs().pattern(10,10,(t=>{t.rect(10,10).fill("#ffffff"),t.line(0,10,10,0).stroke({color:i,width:2}),t.line(-2.5,2.5,2.5,-2.5).stroke({color:i,width:2}),t.line(7.5,12.5,12.5,7.5).stroke({color:i,width:2})})).id(`xy-fc-${t}`))}drawPanel(t,i,s,e,h,n,a,l,d,c,u=""){var v,m,f,b,p,w;const y=t.group(),x=this.em;i.frame.drawBands(y,this.config.x.highlight,this.config.y.highlight),i.frame.drawGrid(y,n,void 0===this.config.x.refLine&&void 0===this.config.y.refLine&&i.rect.width>30*x?h:void 0),i.frame.drawRefLines(y,this.config.x.refLine,this.config.y.refLine),i.frame.drawFrame(y);const M=y.group().id("compare"),$=y.group().id("primary"),z=new L(i.rect,this.styles.scaleFactors.labelToMark*x),S=[...s.points].sort(((t,i)=>{var s,e;return(null!==(s=i.size)&&void 0!==s?s:0)-(null!==(e=t.size)&&void 0!==e?e:0)})),j=[];for(const t of S){const h=null!==(m=null===(v=this.data.series.find((i=>i.key===t.seriesKey)))||void 0===v?void 0:v.index)&&void 0!==m?m:0,n=this.seriesHue(h),a=o(this.primaryColorIndex(),n,"bubble"),l=i.xScale.scale(t.x),d=i.yScale.scale(t.y),c=e.radius(null!==(f=t.size)&&void 0!==f?f:0);if(this.config.sizeAreaPerUnit>0&&this.bubbleExceedsPanel(i.rect,l,d,c)&&this.scaleOverflowCount++,null!=t.compare){const s=o(this.compareColorIndex(),n,"bubble"),r=i.xScale.scale(t.compare.x),a=i.yScale.scale(t.compare.y),l=e.radius(null!==(b=t.compare.size)&&void 0!==b?b:0);this.drawBubble(M,r,a,l,s,h,n),z.registerMark(r,a,l),this.config.labels.values&&void 0!==t.compare.size&&l>=1.2*x&&this.drawValueLabel(M,r,a,l,t.compare.size,s.fill)}const u=P(t,s.key,this.config);null===(p=this.drawBubble($,l,d,c,a,h,n))||void 0===p||p.attr(g(u,"element")),z.registerMark(l,d,c),void 0!==t.share&&c>0&&(null===(w=this.drawShareSlice($,l,d,c,t.share,r(n)))||void 0===w||w.attr(g(u))),this.config.labels.values&&void 0!==t.size&&this.drawValueLabel($,l,d,c,t.size,!0===a.hatch?"#ffffff":a.fill),j.push({point:t,cx:l,cy:d,r:c,seriesIndex:h,hue:n,treatment:a})}this.drawNameLabels(y,z,j,s.key),i.frame.drawTickLabels(y,{ticksX:h,ticksY:n,xDecimals:a,yDecimals:l,xPercent:this.xPercent,yPercent:this.yPercent,showXLabels:c,showYLabels:d}),""!==u&&i.frame.drawPanelTitle(y,u)}bubbleExceedsPanel(t,i,s,e){return i-e<t.x||i+e>t.x+t.width||s-e<t.y||s+e>t.y+t.height}drawBubble(t,i,s,e,h,n,o){if(!(e<=0))return t.circle(2*e).center(i,s).fill(this.treatmentFill(h,n,o)).stroke({color:h.stroke,width:h.strokeWidth})}drawShareSlice(t,i,s,e,h,n){if(h<=0)return;if(h>=1)return t.circle(2*e).center(i,s).fill(n);const o=2*h*Math.PI,r=i+e*Math.sin(o),a=s-e*Math.cos(o),l=o>Math.PI?1:0;return t.path(`M ${i} ${s} L ${i} ${s-e} A ${e} ${e} 0 ${l} 1 ${r} ${a} Z`).fill(n).stroke("none")}drawValueLabel(t,i,s,e,h,n){const o=S(h,this.valueDecimals(),this.styles.locale,this.sizePercent);this.textWidth(o)+.4*this.em>2*e||this.drawText(t,o,i,s+.35*this.em,{anchor:"middle",color:N(n)})}drawNameLabels(t,i,s,e){const h=[...s].sort(((t,i)=>{var s,e;return(null!==(s=i.point.size)&&void 0!==s?s:0)-(null!==(e=t.point.size)&&void 0!==e?e:0)})),{selected:n,unknownNames:o}=i.selectCandidates(h,this.config.labels.points,this.config.labels.max,(t=>t.point.name));o.length>0&&this.addWarningOnce("xy-label-unknown",{names:o.join(", ")});const r=new Map,a=n.map((t=>{const i={name:t.point.name,cx:t.cx,cy:t.cy,r:t.r,width:this.textWidth(t.point.name),height:1.1*this.em};return r.set(i,t.point),i}));for(const s of i.place(a))this.drawText(t,s.candidate.name,s.x,s.y+.9*s.candidate.height,{}).attr(g(P(r.get(s.candidate),e,this.config),"label"))}valueDecimals(){var t,i,s;let e=0;for(const h of this.data.facets)for(const n of h.points)e=Math.max(e,Math.abs(null!==(t=n.size)&&void 0!==t?t:0),Math.abs(null!==(s=null===(i=n.compare)||void 0===i?void 0:i.size)&&void 0!==s?s:0));return e>0&&Number.isFinite(e)?(this.sizePercent&&(e*=100),k.stepDecimals(Math.pow(10,Math.floor(Math.log10(e))-2))):1}}const Y=["xy-duplicate-point","xy-point-clipped","xy-variance-nodata","xy-label-unknown","xy-series-overflow","xy-point-budget","bubble-size-negative","bubble-share-range","bubble-scale-overflow"],H=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.chartTitle="",this.share=null,this.compareFamily=null,this.facet=null,this.pointLevel="category",this.seriesLevel=null,this.aspect=16/9,this.limit=0,this.filter="",this.sizeAreaPerUnit=0,this.i18n=new Map,this.containerWidth=0,this.svgMarkup="",u(this)}getDb(){return this.stores||(this.stores=a(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=l(this.getDb(),this.tableName,this.filter);this.chart=new B(new c(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,x:this.x,y:this.y,size:this.size,share:this.share,compareFamily:this.compareFamily,labels:this.labels,legend:this.legend,facet:this.facet,pointLevel:this.pointLevel,seriesLevel:this.seriesLevel,aspect:this.aspect,limit:this.limit,sizeAreaPerUnit:this.sizeAreaPerUnit},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings()),m(this.errors,this.chart.getQueryError())}syncWarnings(t){if(void 0===this.errors)return;const i=new Map(t.map((t=>[t.code,t.data])));for(const t of Y){const s=`WARN_${t.replace(/-/g,"_")}`;if(i.has(t)){const e=void 0!==this.translator?this.translator(`.${t}`,i.get(t)):t;this.errors.addOrReplace({id:s,type:"warning",message:e})}else this.errors.remove(s)}}prepareStyle(){var t,i;const s=new W(new C,new b,new p(new y),new w).adapt(this.styles);return s.locale=(null===(i=null===(t=a(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}render(){var t;if(void 0===this.chart||void 0!==this.chart.getQueryError())return s(e,null);if(this.chart.hasNoData()){const i=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return s(e,{class:"no-data"},s("div",{class:"empty-state"},i))}return s(e,null,s("div",{innerHTML:this.svgMarkup}))}get element(){return this}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{position:relative;display:inline-block}'}},[1,"bn-chart-bubble-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],chartTitle:[1,"chart-title"],x:[16],y:[16],size:[16],share:[16],compareFamily:[1,"compare-family"],labels:[16],legend:[16],facet:[16],pointLevel:[1,"point-level"],seriesLevel:[1,"series-level"],aspect:[2],limit:[2],filter:[1],sizeAreaPerUnit:[2,"size-area-per-unit"],styles:[16],i18n:[16],containerWidth:[2,"container-width"],ruleSetConfig:[16],errors:[16],translator:[16]}]);function I(){"undefined"!=typeof customElements&&["bn-chart-bubble-renderer"].forEach((t=>{"bn-chart-bubble-renderer"===t&&(customElements.get(h(t))||customElements.define(h(t),H))}))}export{H as B,I as d}
@@ -0,0 +1 @@
1
+ import{f as t,g as s}from"./p-D6YGOYV1.js";import{g as r,c as e}from"./p-Cxx0YNnl.js";import{r as o}from"./p-Dq9dG0Kr.js";import{i as l,f as a,r as u}from"./p-Bj3RWsEx.js";import{m as n}from"./p-B2NXsfMz.js";const i=i=>{let f,m,p,c,b,j=null;const x=()=>{const t=m.ruleSets.state;b=n([t._default||{},t[p]||{}]),c=n([t._system||{},b])},w=()=>{const r=s(i),e=r.getAttribute("ruleset");if(j&&(j.disconnect(),j=null),e&&l(e)){const s=a(r,e);if(p=u(s,"ruleset"),s.length>0){j=new MutationObserver((()=>{p=u(s,"ruleset"),x(),t(i)}));for(const t of s)j.observe(t,{attributes:!0,attributeFilter:["ruleset"]})}}else p=e},M=new MutationObserver((s=>{s.forEach((s=>{"ruleset"===s.attributeName&&(w(),x(),t(i))}))})),O=i.connectedCallback;i.connectedCallback=()=>{const e=s(i);m=r(e),c=m.ruleSets.state._system,M.observe(e,{attributes:!0,attributeFilter:["ruleset"]}),w(),x(),f=m.ruleSets.on("set",(r=>{r!==p&&"_default"!==r||(w(),x(),t(s(i)))})),o(O,i)};const Y=i.disconnectedCallback;return i.disconnectedCallback=()=>{M.disconnect(),j&&(j.disconnect(),j=null),o(f),e(s(i)),o(Y,i)},(t="all")=>"user"===t?b:c};export{i as w}
@@ -1 +1 @@
1
- import{S as t}from"./p-CeE4_3wQ.js";import{F as s}from"./p-CniN8ALm.js";import"./p-B5tixDPM.js";import{g as i}from"./p-4q8nRcWC.js";import{d as e}from"./p-BzjGUtYh.js";var r;!function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right",t[t.Top=3]="Top",t[t.Bottom=4]="Bottom"}(r||(r={}));class h{constructor(t,s,i,e,h,n,o,a){this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.isRelativeLabel=!1,this.segmentFillColor=null,this.pointPart="label",this.x=s,this.y=i,this.value=h,this.group=t.group().id(this.createElementID(t.toString(),e)),this.styles=n,this.isVarianceLabel=!1,this.verticalHookLocation=o||r.Top,this.horizontalHookLocation=a||r.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}setPoint(t,s="label"){return this.pointKey=t,this.pointPart=s,this}updateGroup(t){return this.group=t,this}draw(i=!0,r={percent:2,decimal:1},h=new t){if(this.isEmpty())return this;const n=this.group;let o,a="";if(!1===Number.isNaN(Number(this.value))){let t="percent",i=r.percent,e=r.percent,n=1;!1===this.isRelativeLabel&&(i=r.decimal,e=r.decimal,n=h.value,t="decimal"),o=s.number(Number(this.value),t,i,e,n,this.styles.locale);const l=s.number(0,t,i,e,n,this.styles.locale);this.isVarianceLabel&&Number(this.value)>0&&o!==l&&(a="+")}else o=""+this.value;const l=this.drawLabel(n,a+o);return!1===i?(l.addClass("hide"),n.addClass("hide")):this.pointKey&&n.attr(e(this.pointKey,this.pointPart)),this}isEmpty(){return null==this.value||""===this.value}setPos(t,s){return this.x=t,this.y=s,this}forceStringTypeDraw(){const t=this.group;return this.drawLabel(t,""+this.value),this.pointKey&&t.attr(e(this.pointKey,this.pointPart)),this}drawLabel(t,s){const e=this.styles.fontStyles.background||"#ffffff";let h="start";const n=t.text(s);n.move(this.x,this.y);const o=n.bbox(),a=o.w,l=o.h;let c=0,u=0;const f=n.x();let p=n.y();return this.horizontalHookLocation===r.Left?(h="left",c=n.x()):this.horizontalHookLocation===r.Center?(h="middle",c=n.x()-(a+2)/2):this.horizontalHookLocation===r.Right&&(h="end",c=n.x()-a),this.verticalHookLocation===r.Center?(p=n.y()-1.2*l/2,u=p+.2*l):this.verticalHookLocation===r.Top?(p-=l/4,u=p+.2*l):this.verticalHookLocation===r.Bottom&&(p-=l,u=p+.2*l),n.move(f,p),n.font({anchor:h}),null!=this.segmentFillColor?n.fill(i(this.segmentFillColor)):t.rect(a+2,.8*l).stroke(e).fill(e).opacity(.9).move(c-1,u).insertBefore(n),n}createElementID(t,s){return t+"_"+s+"_"+this.ID_SCENARIOLABEL}}const n={ac:1,pp:2,fc:3,pl:4};var o;!function(t){t[t.Above=0]="Above",t[t.Below=1]="Below",t[t.Left=2]="Left",t[t.Right=3]="Right"}(o||(o={}));class a{constructor(){this.labels=[],this.scenarioLabels=[]}clear(){this.labels=[],this.scenarioLabels=[]}register(t){this.labels.push(t)}hasCollision(t){return this.labels.some((s=>this.intersects(t,s)))}getOptimalPlacement(t,s,i,e,r,h,o,a){const l=n[o]||99,c=h/2;for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.hasCollision(n.bounds))return n}for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.collidesWithHigherPriority(n.bounds,l))return n}return null}calculatePlacementForDirection(t,s,i,e,h,n,a,l){let c,u,f,p,m,b;switch(l){case o.Above:c=t,u=s-n-a,f=r.Bottom,p=r.Center,m=t-i/2,b=s-n-a-e;break;case o.Below:c=t,u=s+n+a,f=r.Top,p=r.Center,m=t-i/2,b=s+n+a-e/4;break;case o.Left:c=t-n-a,u=s,f=r.Center,p=r.Right,m=t-n-a-i,b=s-.6*e;break;case o.Right:c=t+n+a,u=s,f=r.Center,p=r.Left,m=t+n+a,b=s-.6*e}return{labelX:c,labelY:u,verticalHook:f,horizontalHook:p,bounds:{x:m,y:b,width:i,height:e,pointIndex:h,preferredHook:f}}}collidesWithHigherPriority(t,s){return this.labels.some((i=>!!i.scenarioType&&((n[i.scenarioType]||99)<s&&this.intersects(t,i))))}shouldHideScenarioLabel(t,s,i,e=20){const r=n[i]||99;return!(r<=1)&&this.scenarioLabels.some((i=>{if((n[i.scenarioType]||99)>=r)return!1;const h=Math.abs(s-i.y),o=Math.abs(t-i.x);return h<e&&o<e}))}registerScenarioLabel(t,s,i){this.scenarioLabels.push({x:t,y:s,scenarioType:i})}intersects(t,s){return!(t.x+t.width<s.x||s.x+s.width<t.x||t.y+t.height<s.y||s.y+s.height<t.y)}getLabelCount(){return this.labels.length}}export{r as H,a as L,n as S,h as a,o as b}
1
+ import{S as t}from"./p-CeE4_3wQ.js";import{F as s}from"./p-D_Sbhd0L.js";import"./p-B5tixDPM.js";import{g as i}from"./p-4q8nRcWC.js";import{d as e}from"./p-BzjGUtYh.js";var r;!function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right",t[t.Top=3]="Top",t[t.Bottom=4]="Bottom"}(r||(r={}));class h{constructor(t,s,i,e,h,n,o,a){this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.isRelativeLabel=!1,this.segmentFillColor=null,this.pointPart="label",this.x=s,this.y=i,this.value=h,this.group=t.group().id(this.createElementID(t.toString(),e)),this.styles=n,this.isVarianceLabel=!1,this.verticalHookLocation=o||r.Top,this.horizontalHookLocation=a||r.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}setPoint(t,s="label"){return this.pointKey=t,this.pointPart=s,this}updateGroup(t){return this.group=t,this}draw(i=!0,r={percent:2,decimal:1},h=new t){if(this.isEmpty())return this;const n=this.group;let o,a="";if(!1===Number.isNaN(Number(this.value))){let t="percent",i=r.percent,e=r.percent,n=1;!1===this.isRelativeLabel&&(i=r.decimal,e=r.decimal,n=h.value,t="decimal"),o=s.number(Number(this.value),t,i,e,n,this.styles.locale);const l=s.number(0,t,i,e,n,this.styles.locale);this.isVarianceLabel&&Number(this.value)>0&&o!==l&&(a="+")}else o=""+this.value;const l=this.drawLabel(n,a+o);return!1===i?(l.addClass("hide"),n.addClass("hide")):this.pointKey&&n.attr(e(this.pointKey,this.pointPart)),this}isEmpty(){return null==this.value||""===this.value}setPos(t,s){return this.x=t,this.y=s,this}forceStringTypeDraw(){const t=this.group;return this.drawLabel(t,""+this.value),this.pointKey&&t.attr(e(this.pointKey,this.pointPart)),this}drawLabel(t,s){const e=this.styles.fontStyles.background||"#ffffff";let h="start";const n=t.text(s);n.move(this.x,this.y);const o=n.bbox(),a=o.w,l=o.h;let c=0,u=0;const f=n.x();let p=n.y();return this.horizontalHookLocation===r.Left?(h="left",c=n.x()):this.horizontalHookLocation===r.Center?(h="middle",c=n.x()-(a+2)/2):this.horizontalHookLocation===r.Right&&(h="end",c=n.x()-a),this.verticalHookLocation===r.Center?(p=n.y()-1.2*l/2,u=p+.2*l):this.verticalHookLocation===r.Top?(p-=l/4,u=p+.2*l):this.verticalHookLocation===r.Bottom&&(p-=l,u=p+.2*l),n.move(f,p),n.font({anchor:h}),null!=this.segmentFillColor?n.fill(i(this.segmentFillColor)):t.rect(a+2,.8*l).stroke(e).fill(e).opacity(.9).move(c-1,u).insertBefore(n),n}createElementID(t,s){return t+"_"+s+"_"+this.ID_SCENARIOLABEL}}const n={ac:1,pp:2,fc:3,pl:4};var o;!function(t){t[t.Above=0]="Above",t[t.Below=1]="Below",t[t.Left=2]="Left",t[t.Right=3]="Right"}(o||(o={}));class a{constructor(){this.labels=[],this.scenarioLabels=[]}clear(){this.labels=[],this.scenarioLabels=[]}register(t){this.labels.push(t)}hasCollision(t){return this.labels.some((s=>this.intersects(t,s)))}getOptimalPlacement(t,s,i,e,r,h,o,a){const l=n[o]||99,c=h/2;for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.hasCollision(n.bounds))return n}for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.collidesWithHigherPriority(n.bounds,l))return n}return null}calculatePlacementForDirection(t,s,i,e,h,n,a,l){let c,u,f,p,m,b;switch(l){case o.Above:c=t,u=s-n-a,f=r.Bottom,p=r.Center,m=t-i/2,b=s-n-a-e;break;case o.Below:c=t,u=s+n+a,f=r.Top,p=r.Center,m=t-i/2,b=s+n+a-e/4;break;case o.Left:c=t-n-a,u=s,f=r.Center,p=r.Right,m=t-n-a-i,b=s-.6*e;break;case o.Right:c=t+n+a,u=s,f=r.Center,p=r.Left,m=t+n+a,b=s-.6*e}return{labelX:c,labelY:u,verticalHook:f,horizontalHook:p,bounds:{x:m,y:b,width:i,height:e,pointIndex:h,preferredHook:f}}}collidesWithHigherPriority(t,s){return this.labels.some((i=>!!i.scenarioType&&((n[i.scenarioType]||99)<s&&this.intersects(t,i))))}shouldHideScenarioLabel(t,s,i,e=20){const r=n[i]||99;return!(r<=1)&&this.scenarioLabels.some((i=>{if((n[i.scenarioType]||99)>=r)return!1;const h=Math.abs(s-i.y),o=Math.abs(t-i.x);return h<e&&o<e}))}registerScenarioLabel(t,s,i){this.scenarioLabels.push({x:t,y:s,scenarioType:i})}intersects(t,s){return!(t.x+t.width<s.x||s.x+s.width<t.x||t.y+t.height<s.y||s.y+s.height<t.y)}getLabelCount(){return this.labels.length}}export{r as H,a as L,n as S,h as a,o as b}