@bino-bi/bn-template-engine 1.0.0-alpha.17 → 1.0.0-alpha.18

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 (186) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-0107f0cc.entry.js +1 -0
  3. package/dist/bn-template-engine/p-209351c9.entry.js +1 -0
  4. package/dist/bn-template-engine/p-22d0fb7a.entry.js +1 -0
  5. package/dist/bn-template-engine/p-2e6dc267.entry.js +1 -0
  6. package/dist/bn-template-engine/p-485d23d7.entry.js +1 -0
  7. package/dist/bn-template-engine/p-5651417d.entry.js +1 -0
  8. package/dist/bn-template-engine/p-5bfdc1e5.entry.js +1 -0
  9. package/dist/bn-template-engine/p-6b75762d.entry.js +1 -0
  10. package/dist/bn-template-engine/{p-1a1fd8eb.entry.js → p-7bdc0e28.entry.js} +1 -1
  11. package/dist/bn-template-engine/p-9879c9b2.entry.js +1 -0
  12. package/dist/bn-template-engine/p-BWKdb9ym.js +1 -0
  13. package/dist/bn-template-engine/{p-CIXlJoMr.js → p-BZV1b5VH.js} +1 -1
  14. package/dist/bn-template-engine/p-Bdfxd_Ke.js +1 -0
  15. package/dist/bn-template-engine/p-BqhIhYr1.js +1 -0
  16. package/dist/bn-template-engine/p-C0Pwqx-O.js +1 -0
  17. package/dist/bn-template-engine/{p-44L8rZSd.js → p-CBqUr7I8.js} +1 -1
  18. package/dist/bn-template-engine/{p-COXiPUfj.js → p-CPzF3Q2m.js} +1 -1
  19. package/dist/bn-template-engine/{p-DHibUOw5.js → p-CiudZRQr.js} +1 -1
  20. package/dist/bn-template-engine/{p-B2KOyHRY.js → p-Dg9OcXAO.js} +1 -1
  21. package/dist/bn-template-engine/p-DsTzlzxQ.js +1 -0
  22. package/dist/bn-template-engine/p-X6CxL6W-.js +1 -0
  23. package/dist/bn-template-engine/p-a130cb43.entry.js +1 -0
  24. package/dist/bn-template-engine/p-aakBGfzL.js +1 -0
  25. package/dist/bn-template-engine/p-dc745c32.entry.js +1 -0
  26. package/dist/bn-template-engine/p-e96da91f.entry.js +1 -0
  27. package/dist/bn-template-engine/{p-d3fc17ee.entry.js → p-f3d1fa06.entry.js} +1 -1
  28. package/dist/bn-template-engine/p-fcb43f2c.entry.js +1 -0
  29. package/dist/bn-template-engine/p-rdqTC0_5.js +1 -0
  30. package/dist/cjs/{AxisConfig-B_GMRfX_.js → AxisConfig-VnVelfSV.js} +1 -1
  31. package/dist/cjs/LabelCollisionManager-nfD5P__k.js +412 -0
  32. package/dist/cjs/NumericScale-BAyYXpKL.js +107 -0
  33. package/dist/cjs/Order-DobBozQC.js +87 -0
  34. package/dist/cjs/{LabelCollisionManager-8HGn9W0V.js → SVGStyle-BQOmGWLX.js} +2 -409
  35. package/dist/cjs/SVGVariancesStyleGroup-DCGfHrqh.js +50 -0
  36. package/dist/cjs/{VarianceMeasure-DEOzP-XZ.js → VarianceMeasure-NY9yhiNV.js} +1 -1
  37. package/dist/cjs/{XYChartDataRow-CDl1Ofnv.js → XYChartDataRow-B7OKrAcC.js} +7 -111
  38. package/dist/cjs/bn-asset_21.cjs.entry.js +221 -263
  39. package/dist/cjs/bn-chart-bubble.cjs.entry.js +8 -7
  40. package/dist/cjs/bn-chart-bullet.cjs.entry.js +785 -0
  41. package/dist/cjs/bn-chart-scatter.cjs.entry.js +8 -7
  42. package/dist/cjs/bn-grid.cjs.entry.js +5 -4
  43. package/dist/cjs/bn-image.cjs.entry.js +5 -4
  44. package/dist/cjs/bn-internationalization.cjs.entry.js +2 -2
  45. package/dist/cjs/bn-ruleset.cjs.entry.js +2 -2
  46. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  47. package/dist/cjs/bn-template.cjs.entry.js +1 -1
  48. package/dist/cjs/bn-text.cjs.entry.js +6 -5
  49. package/dist/cjs/bn-tree.cjs.entry.js +4 -3
  50. package/dist/cjs/{context-protocol-CIuyJKkK.js → context-protocol-BDrMkhc4.js} +66 -0
  51. package/dist/cjs/editor-companion.cjs.entry.js +2 -2
  52. package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +20 -18
  53. package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +673 -0
  54. package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +19 -17
  55. package/dist/cjs/{layoutObserver-CJWRV_y6.js → layoutObserver-p0wXIWFg.js} +2 -2
  56. package/dist/cjs/loader.cjs.js +1 -1
  57. package/dist/cjs/{scaling-B4UPXivZ.js → scaling-BmqxcNOf.js} +1 -1
  58. package/dist/cjs/{withScalingGroup-D832DQKp.js → withScalingGroup-BmcRlWBs.js} +1 -1
  59. package/dist/cjs/{withStyled-COxuhL-N.js → withStyled-CRiC9fzc.js} +5 -86
  60. package/dist/collection/collection-manifest.json +2 -0
  61. package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.css +10 -0
  62. package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +1014 -0
  63. package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.css +9 -0
  64. package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.js +538 -0
  65. package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +440 -0
  66. package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +132 -0
  67. package/dist/collection/components/bn-chart-bullet/utils/model/BulletConfig.js +89 -0
  68. package/dist/collection/components/bn-chart-bullet/utils/model/index.js +2 -0
  69. package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +1 -1
  70. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +1 -1
  71. package/dist/collection/components/bn-chart-time/bn-chart-time.js +1 -1
  72. package/dist/collection/components/bn-component-style/bn-component-style.js +1 -1
  73. package/dist/collection/components/bn-context/bn-context.js +1 -1
  74. package/dist/collection/components/bn-dataset/bn-dataset.js +1 -1
  75. package/dist/collection/components/bn-datasource/bn-datasource.js +1 -1
  76. package/dist/collection/components/bn-footer/bn-footer.js +1 -1
  77. package/dist/collection/components/bn-grid/bn-grid.js +1 -1
  78. package/dist/collection/components/bn-image/bn-image.js +1 -1
  79. package/dist/collection/components/bn-internationalization/bn-internationalization.js +1 -1
  80. package/dist/collection/components/bn-layout-card/bn-layout-card.js +1 -1
  81. package/dist/collection/components/bn-layout-page/bn-layout-page.js +1 -1
  82. package/dist/collection/components/bn-message/bn-message.js +1 -1
  83. package/dist/collection/components/bn-page/bn-page.js +1 -1
  84. package/dist/collection/components/bn-ruleset/bn-ruleset.js +1 -1
  85. package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +1 -1
  86. package/dist/collection/components/bn-table/bn-table.js +1 -1
  87. package/dist/collection/components/bn-template/bn-template.js +1 -1
  88. package/dist/collection/components/bn-text/bn-text.js +1 -1
  89. package/dist/collection/components/bn-title/bn-title.js +1 -1
  90. package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +1 -1
  91. package/dist/collection/components/editor-companion/editor-companion.js +1 -1
  92. package/dist/collection/stores/componentStyles.js +38 -0
  93. package/dist/collection/stores/internationalization.js +28 -0
  94. package/dist/components/NumericScale.js +1 -0
  95. package/dist/components/Order.js +1 -1
  96. package/dist/components/XYChartDataRow.js +1 -1
  97. package/dist/components/bn-chart-bullet.d.ts +11 -0
  98. package/dist/components/bn-chart-bullet.js +1 -0
  99. package/dist/components/bn-chart-scatter.js +1 -1
  100. package/dist/components/bn-chart-structure.js +1 -1
  101. package/dist/components/bn-chart-time.js +1 -1
  102. package/dist/components/bn-component-style.js +1 -1
  103. package/dist/components/bn-context.js +1 -1
  104. package/dist/components/bn-dataset.js +1 -1
  105. package/dist/components/bn-datasource.js +1 -1
  106. package/dist/components/bn-footer2.js +1 -1
  107. package/dist/components/bn-grid.js +1 -1
  108. package/dist/components/bn-image.js +1 -1
  109. package/dist/components/bn-internationalization.js +1 -1
  110. package/dist/components/bn-layout-card.js +1 -1
  111. package/dist/components/bn-layout-page.js +1 -1
  112. package/dist/components/bn-message2.js +1 -1
  113. package/dist/components/bn-page2.js +1 -1
  114. package/dist/components/bn-ruleset.js +1 -1
  115. package/dist/components/bn-scaling-group.js +1 -1
  116. package/dist/components/bn-table.js +1 -1
  117. package/dist/components/bn-template.js +1 -1
  118. package/dist/components/bn-text.js +1 -1
  119. package/dist/components/bn-title2.js +1 -1
  120. package/dist/components/context-protocol.js +1 -1
  121. package/dist/components/editor-companion.js +1 -1
  122. package/dist/components/ibcs-chart-bubble2.js +1 -1
  123. package/dist/components/ibcs-chart-bullet.d.ts +11 -0
  124. package/dist/components/ibcs-chart-bullet.js +1 -0
  125. package/dist/components/ibcs-chart-bullet2.js +1 -0
  126. package/dist/components/ibcs-chart-scatter2.js +1 -1
  127. package/dist/components/ibcs-chart-structure2.js +1 -1
  128. package/dist/components/ibcs-chart-time2.js +1 -1
  129. package/dist/components/ibcs-table2.js +1 -1
  130. package/dist/components/ibcs-title2.js +1 -1
  131. package/dist/components/main.js +1 -0
  132. package/dist/components/stackColors.js +1 -1
  133. package/dist/esm/{AxisConfig-BwUQrme0.js → AxisConfig-C_zWCKlL.js} +1 -1
  134. package/dist/esm/LabelCollisionManager-8swVQHKA.js +404 -0
  135. package/dist/esm/NumericScale-DsTzlzxQ.js +105 -0
  136. package/dist/esm/Order-BPeWfygb.js +83 -0
  137. package/dist/esm/{LabelCollisionManager-DZP5Vl8T.js → SVGStyle-BxEDw9zh.js} +3 -403
  138. package/dist/esm/SVGVariancesStyleGroup-DRQYvSDD.js +48 -0
  139. package/dist/esm/{VarianceMeasure-Cxshx01h.js → VarianceMeasure-DnwNKspZ.js} +1 -1
  140. package/dist/esm/{XYChartDataRow-FF_VxRnF.js → XYChartDataRow-DeV4r-Wm.js} +5 -108
  141. package/dist/esm/bn-asset_21.entry.js +25 -67
  142. package/dist/esm/bn-chart-bubble.entry.js +8 -7
  143. package/dist/esm/bn-chart-bullet.entry.js +783 -0
  144. package/dist/esm/bn-chart-scatter.entry.js +8 -7
  145. package/dist/esm/bn-grid.entry.js +5 -4
  146. package/dist/esm/bn-image.entry.js +5 -4
  147. package/dist/esm/bn-internationalization.entry.js +2 -2
  148. package/dist/esm/bn-ruleset.entry.js +2 -2
  149. package/dist/esm/bn-template-engine.js +1 -1
  150. package/dist/esm/bn-template.entry.js +1 -1
  151. package/dist/esm/bn-text.entry.js +6 -5
  152. package/dist/esm/bn-tree.entry.js +4 -3
  153. package/dist/esm/{context-protocol-BNHTlllP.js → context-protocol-1Yj1uKvh.js} +66 -0
  154. package/dist/esm/editor-companion.entry.js +2 -2
  155. package/dist/esm/ibcs-chart-bubble.entry.js +6 -4
  156. package/dist/esm/ibcs-chart-bullet.entry.js +671 -0
  157. package/dist/esm/ibcs-chart-scatter.entry.js +6 -4
  158. package/dist/esm/{layoutObserver-D5FY_lQa.js → layoutObserver-DCbmpGrz.js} +2 -2
  159. package/dist/esm/loader.js +1 -1
  160. package/dist/esm/{scaling-B7Pa0d_s.js → scaling-B_k50v9z.js} +1 -1
  161. package/dist/esm/{withScalingGroup-DBheBsP4.js → withScalingGroup-Br70pAv9.js} +1 -1
  162. package/dist/esm/{withStyled-DTvj2nar.js → withStyled-Br2DGTPs.js} +4 -83
  163. package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +172 -0
  164. package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +52 -0
  165. package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +91 -0
  166. package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +70 -0
  167. package/dist/types/components/bn-chart-bullet/utils/model/BulletConfig.d.ts +43 -0
  168. package/dist/types/components/bn-chart-bullet/utils/model/index.d.ts +2 -0
  169. package/dist/types/components.d.ts +399 -4
  170. package/dist/types/stores/componentStyles.d.ts +20 -0
  171. package/package.json +1 -1
  172. package/dist/bn-template-engine/p-172499ac.entry.js +0 -1
  173. package/dist/bn-template-engine/p-19e65c04.entry.js +0 -1
  174. package/dist/bn-template-engine/p-2849c367.entry.js +0 -1
  175. package/dist/bn-template-engine/p-5dd11fcc.entry.js +0 -1
  176. package/dist/bn-template-engine/p-63f891d9.entry.js +0 -1
  177. package/dist/bn-template-engine/p-72f63181.entry.js +0 -1
  178. package/dist/bn-template-engine/p-836ad6f3.entry.js +0 -1
  179. package/dist/bn-template-engine/p-BnOTt2YD.js +0 -1
  180. package/dist/bn-template-engine/p-CDPTCKVx.js +0 -1
  181. package/dist/bn-template-engine/p-CPZIJpxn.js +0 -1
  182. package/dist/bn-template-engine/p-a50da0f0.entry.js +0 -1
  183. package/dist/bn-template-engine/p-a9a34fb2.entry.js +0 -1
  184. package/dist/bn-template-engine/p-b0369558.entry.js +0 -1
  185. package/dist/bn-template-engine/p-f8c46905.entry.js +0 -1
  186. package/dist/bn-template-engine/p-lIy3SJs2.js +0 -1
@@ -1 +0,0 @@
1
- import{r as t,h as e,H as n,g as s}from"./p-B_d-jp99.js";import{e as r,d as i,w as o,b as a}from"./p-lIy3SJs2.js";import{w as l,a as c}from"./p-B4JfKvVT.js";import"./p-BnOTt2YD.js";import"./p-CIXlJoMr.js";const d=["*","/","+","-","x","÷","none"];function u(t){switch(t){case"*":case"x":return"×";case"/":case"÷":return"÷";case"+":return"+";case"-":return"−";default:return""}}function h(t,e,n){return t.find((t=>t.from===e&&t.to===n))}function f(t){return 2*(t-1)+1}function p(t){return 2*(t-1)+1}function g(t,e){const n=t.getBoundingClientRect(),s=n.left-e.left,r=n.top-e.top;return{left:s,top:r,width:n.width,height:n.height,centerX:s+n.width/2,centerY:r+n.height/2}}function y(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 v(t,e,n,s,r=8){const i=-(s-1)*r/2+n*r;switch(e){case"ltr":return{x:t.left,y:t.centerY+i};case"rtl":return{x:t.left+t.width,y:t.centerY+i};case"ttb":return{x:t.centerX+i,y:t.top};case"btt":return{x:t.centerX+i,y:t.top+t.height}}}function m(t,e,n,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 s,r;if("ltr"===n||"rtl"===n){const n=(t.x+e.x)/2;s={x:n,y:t.y},r={x:n,y:e.y}}else{const n=(t.y+e.y)/2;s={x:t.x,y:n},r={x:e.x,y:n}}return{path:`M ${t.x} ${t.y} C ${s.x} ${s.y}, ${r.x} ${r.y}, ${e.x} ${e.y}`,midpoint:{x:.125*t.x+.375*s.x+.375*r.x+.125*e.x,y:.125*t.y+.375*s.y+.375*r.y+.125*e.y}}}(t,e,s);default:return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=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}`,r={x:n,y:(t.y+e.y)/2}}else{const n=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}`,r={x:(t.x+e.x)/2,y:n}}return{path:s,midpoint:r}}(t,e,s)}}function b(t,e,n,s){const r=.7;switch(s){case"ltr":{const s=t.left+t.width;return{x:s+(Math.min(e.left,n.left)-s)*r,y:t.centerY}}case"rtl":{const s=t.left,i=Math.max(e.left+e.width,n.left+n.width);return{x:i+(s-i)*r,y:t.centerY}}case"ttb":{const s=t.top+t.height,i=Math.min(e.top,n.top);return{x:t.centerX,y:s+(i-s)*r}}case"btt":{const s=t.top,i=Math.max(e.top+e.height,n.top+n.height);return{x:t.centerX,y:i+(s-i)*r}}}}function $(t,e,n){var s,r;return Object.assign({stroke:null!==(s=null==n?void 0:n.color)&&void 0!==s?s:t,strokeWidth:null!==(r=null==n?void 0:n.width)&&void 0!==r?r:e},(null==n?void 0:n.dasharray)?{strokeDasharray:n.dasharray}:{})}const x=class{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 s=new Set,r=new Set;n.forEach(((t,n)=>{if("object"!=typeof t||null===t)return void e.push(`edges[${n}]: must be an object`);const i=t;if("string"!=typeof i.from||""===i.from.trim()?e.push(`edges[${n}]: 'from' is required and must be a non-empty string`):s.add(i.from),"string"!=typeof i.to||""===i.to.trim()?e.push(`edges[${n}]: 'to' is required and must be a non-empty string`):(s.add(i.to),r.add(i.to)),void 0!==i.operator&&("string"==typeof i.operator&&d.includes(i.operator)||e.push(`edges[${n}]: 'operator' must be one of: ${d.join(", ")}`)),void 0!==i.label&&"string"!=typeof i.label&&e.push(`edges[${n}]: 'label' must be a string`),void 0!==i.style)if("object"!=typeof i.style||null===i.style)e.push(`edges[${n}]: 'style' must be an object`);else{const t=i.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 i=Array.from(s).filter((t=>!r.has(t)));return 0===i.length?e.push("edges: tree has no root node (circular reference detected)"):i.length>1&&e.push(`edges: tree has multiple root nodes: ${i.join(", ")}`),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,s=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),r=function(t){const e=new Set;for(const n of t)e.add(n.from),e.add(n.to);return e}(n),i=function(t,e){const n=new Set;for(const e of t)n.add(e.to);const s=Array.from(e).filter((t=>!n.has(t)));return 1===s.length?s[0]:null}(n,r);return{edges:n,adjacencyList:s,rootNode:i,allNodes:r}}catch(t){return console.error("parseTreeConfig: failed to parse tree configuration",t),null}}(t)),this.recalculateLayout()}validateDirection(t){const e="ERR_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="ERR_levelSpacing";!r(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="ERR_nodeSpacing";!r(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="ERR_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(", ")}`})}validateShowOperators(t){const e="ERR_showOperators";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-operators: invalid value '${t}', must be 'true' or 'false'`})}constructor(e){t(this,e),this.treeConfig=null,this.layout=null,this.nodeRects=new Map,this.svgWidth=0,this.svgHeight=0,this.resizeObserver=null,this.gridContainer=null,this.direction="ltr",this.levelSpacing=60,this.nodeSpacing=20,this.edgeStyle="orthogonal",this.showOperators="true",o(this),l(this),this.errors=c(this),this.componentStyle=a(this)}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),this.validateShowOperators(this.showOperators)}componentDidLoad(){this.setupResizeObserver(),requestAnimationFrame((()=>{this.updateNodeRects()}))}disconnectedCallback(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}setupResizeObserver(){var t;this.gridContainer=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".tree-grid"),this.gridContainer&&(this.resizeObserver=new ResizeObserver((()=>{this.updateNodeRects()})),this.resizeObserver.observe(this.gridContainer),this.element.querySelectorAll("[slot]").forEach((t=>{this.resizeObserver.observe(t)})))}recalculateLayout(){this.layout=this.treeConfig?function(t,e,n,s){if(!t.rootNode)return{positions:new Map,gridTemplateColumns:"",gridTemplateRows:"",maxLevel:0,maxIndex:0};const r=function(t){const e=new Map;if(!t.rootNode)return e;const n=[{node:t.rootNode,level:0}],s=new Set;for(;n.length>0;){const{node:r,level:i}=n.shift();if(s.has(r))continue;s.add(r),e.set(r,i);const o=t.adjacencyList.get(r)||[];for(const t of o)s.has(t)||n.push({node:t,level:i+1})}return e}(t),i=function(t){const e=new Map;if(!t.rootNode)return e;let n=0;return function s(r){const i=e.get(r);if(i)return i;const o=t.adjacencyList.get(r)||[];if(0===o.length){const t={startIndex:n,endIndex:n};return e.set(r,t),n++,t}let a=1/0,l=-1/0;for(const t of o){const e=s(t);a=Math.min(a,e.startIndex),l=Math.max(l,e.endIndex)}const c={startIndex:a,endIndex:l};return e.set(r,c),c}(t.rootNode),e}(t),o=function(t,e,n,s){var r,i;const o=new Map,a=Math.max(...Array.from(e.values()));for(const l of t.allNodes){const t=null!==(r=e.get(l))&&void 0!==r?r:0,c=null!==(i=n.get(l))&&void 0!==i?i:{startIndex:0,endIndex:0};let d,u,h;switch(s){case"ltr":d=t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"rtl":d=a-t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"ttb":u=t+1,d=c.startIndex+1,h=1;break;case"btt":u=a-t+1,d=c.startIndex+1,h=1}o.set(l,{nodeId:l,level:t,index:c.startIndex,gridColumn:d,gridRow:u,gridRowSpan:h})}return o}(t,r,i,e),a=Math.max(...Array.from(r.values())),l=Math.max(...Array.from(i.values()).map((t=>t.endIndex))),{gridTemplateColumns:c,gridTemplateRows:d}=function(t,e,n,s,r){const i=t+1,o=e+1;if("ltr"===n||"rtl"===n){const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:t.join(" "),gridTemplateRows:e.join(" ")}}{const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:e.join(" "),gridTemplateRows:t.join(" ")}}}(a,l,e,n,s);return{positions:o,gridTemplateColumns:c,gridTemplateRows:d,maxLevel:a,maxIndex:l}}(this.treeConfig,this.direction,this.levelSpacing,this.nodeSpacing):null}updateNodeRects(){if(!this.treeConfig||!this.gridContainer)return;const t=this.gridContainer.getBoundingClientRect(),e=new Map;for(const n of this.treeConfig.allNodes){const s=this.element.querySelector(`[slot="${n}"]`);s&&e.set(n,g(s,t))}this.nodeRects=e,this.svgWidth=t.width,this.svgHeight=t.height}getSlotStyle(t){if(!this.layout)return{};const e=this.layout.positions.get(t);return e?"ltr"===this.direction||"rtl"===this.direction?{"grid-column":String(f(e.gridColumn)),"grid-row":`${p(e.gridRow)} / span ${n=e.gridRowSpan,n<=1?1:2*(n-1)+1}`,"align-self":"center"}:{"grid-row":String(p(e.gridRow)),"grid-column":String(f(e.gridColumn)),"justify-self":"center"}:{};var n}renderEdges(){var t;if(!this.treeConfig||0===this.nodeRects.size)return null;const n=this.getTreeStyle(),s=[],r=[],i=new Map;for(const t of this.treeConfig.edges){const e=i.get(t.to)||[];e.push(t.from),i.set(t.to,e)}for(const t of this.treeConfig.edges){const r=this.nodeRects.get(t.from),o=this.nodeRects.get(t.to);if(!r||!o)continue;const a=y(r,!0,this.direction),l=i.get(t.to)||[];let c;if(l.length>1){const e=l.indexOf(t.from);c=v(o,this.direction,e,l.length)}else c=y(o,!1,this.direction);const{path:d}=m(a,c,this.edgeStyle,this.direction),u=$(n.edgeColor,n.edgeWidth,t.style);s.push(e("path",{key:`edge-${t.from}-${t.to}`,d,fill:"none",stroke:u.stroke,"stroke-width":u.strokeWidth,"stroke-dasharray":u.strokeDasharray}))}if("true"===this.showOperators)for(const[s,i]of this.treeConfig.adjacencyList.entries()){const o=this.nodeRects.get(s);if(o)for(let a=0;a<i.length-1;a++){const l=i[a],c=i[a+1],d=h(this.treeConfig.edges,s,l);if(!(null==d?void 0:d.operator)||"none"===d.operator)continue;const f=this.nodeRects.get(l),p=this.nodeRects.get(c);if(!f||!p)continue;const g=null!==(t=d.label)&&void 0!==t?t:u(d.operator),y=b(o,f,p,this.direction);r.push(e("g",{key:`operator-${s}-${l}`,class:"operator-group"},e("circle",{cx:y.x,cy:y.y,r:n.operatorCircleRadius,fill:"white",stroke:n.edgeColor,"stroke-width":n.edgeWidth}),e("text",{x:y.x,y:y.y,"text-anchor":"middle","dominant-baseline":"central",style:{fontSize:`${n.operatorFontSize}px`,fill:n.operatorColor,fontWeight:"bold"}},g)))}}return e("svg",{class:"edge-layer",width:this.svgWidth,height:this.svgHeight,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none"}},s,r)}renderSlots(){return this.treeConfig&&this.layout?Array.from(this.treeConfig.allNodes).map((t=>e("div",{key:t,class:"tree-node",style:this.getSlotStyle(t)},e("slot",{name:t})))):null}getFontStyles(){return this.componentStyle((t=>{var e,n,s,r;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===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return e(n,{style:t},this.treeConfig&&this.layout?e("div",{class:"tree-container"},e("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())):e("div",{class:"tree-container tree-error"},e("slot",null)))}get element(){return s(this)}static get watchers(){return{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}],showOperators:[{validateShowOperators:0}]}}};x.style=':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}';export{x as bn_tree}
@@ -1 +0,0 @@
1
- import{r as t,d as s,f as i,h as e,H as r,g as a}from"./p-B_d-jp99.js";import{a as n}from"./p-BnOTt2YD.js";import{w as o,a as l,g as h,p as u}from"./p-COXiPUfj.js";import{w as c,o as d}from"./p-44L8rZSd.js";import{i as p,a as v,w as f,b as m,c as y}from"./p-lIy3SJs2.js";import{w as g,a as b}from"./p-B4JfKvVT.js";import{r as x,s as w}from"./p-CIXlJoMr.js";import{f as _,c as $,d as R,e as L,p as S,t as E}from"./p-B2KOyHRY.js";const A={rowGroup:0,category:1,subCategory:2},j=class{validateX(t){this.validateAxisSpec("x",t)}validateY(t){this.validateAxisSpec("y",t)}validateIso(t){this.validateObjectSpec("iso",t,null,(t=>_(t)))}validateLevel(t){const s="ERR_level",i=["auto","category","subcategory"];p(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(s):this.errors.addOrReplace({id:s,type:"warning",message:`level: invalid value '${t}' — expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const s="ERR_seriesLevel",i=["auto","rowgroup","category","none"];p(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(s):this.errors.addOrReplace({id:s,type:"warning",message:`series-level: invalid value '${t}' — expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,null,(t=>$(t)))}validateLabels(t){this.validateObjectSpec("labels",t,null,(t=>R(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,null,(t=>L(t)))}validateAspect(t){const s="ERR_aspect";p(t)||null!==this.parseAspect(t)?this.errors.remove(s):this.errors.addOrReplace({id:s,type:"warning",message:`aspect: invalid value '${t}' — expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const s="ERR_limit";v(t)&&Number(t)>=0?this.errors.remove(s):this.errors.addOrReplace({id:s,type:"warning",message:`limit: invalid value '${t}' — expected a non-negative integer; using 0.`})}validateScale(t){const s="ERR_scale";if(p(t))return void this.errors.remove(s);const{mode:i,factor:e}=u(t);"factor"===i&&(void 0===e||e<=0)?this.errors.addOrReplace({id:s,type:"warning",message:`scale: invalid value '${t}' — expected none/auto or a positive number.`}):this.errors.remove(s)}constructor(s){t(this,s),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.iso="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,s)=>this.t(t,s),f(this),g(this),o(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,s)=>{this.datasetMeta=s})),this.errors=b(this),this.componentStyle=m(this),this.ruleSetConfig=c(this),this.t=l(this).t}componentWillLoad(){this.validateX(this.x),this.validateY(this.y),this.validateIso(this.iso),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){const{mode:t}=u(this.scale);if("auto"!==t&&"empty"!==t){this._autoScaleGuard=!1;const t=h(this.element),s="WARN_overflow";return void(t.width>0&&this.element.scrollWidth>t.width+1?this.errors.addOrReplace({id:s,type:"warning",message:"Chart exceeds available space and will be cut off. Check the scale value."}):this.errors.remove(s))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const i=this.element,{width:e}=h(i);if(e<=0)return;this._lastObservedWidth=e;const r=this.componentStyle((t=>{var s;return(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333})),a=i.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(a)||a<=e+1)return void this.errors.remove("AUTO_scale");const o=Math.max(.3,n*(e-1)/a);Math.abs(o-n)<.01||(i.style.setProperty("--bn-font-size",r*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${o.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,s((()=>{this.appliedScaleFactor=o})))}componentDidLoad(){this.layoutObserver=d(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=h(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,i(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=h(this.element);this._lastObservedWidth=t,i(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"auto",values:!1,max:12}}setBlockingError(t,s){null===s?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:s}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateAxisSpec(t,s){var i;const e=`ERR_xy_json_${t}`,r=`ERR_xy_measure_${t}`,a=`WARN_xy_fields_${t}`,n="x"===t||"y"===t||"size"===t,{data:o,parseError:l}=S(s,"measure");if(l)return this.setBlockingError(e,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(r,null),void this.errors.remove(a);if(this.setBlockingError(e,null),null===o)return this.setBlockingError(r,n?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(a);const h="share"===t?null:E(o),u=null!==(i=o.measure)&&void 0!==i?i:"";y(u)?this.setBlockingError(r,null):this.setBlockingError(r,this.t(".xy-measure-invalid",{prop:t,measure:u})),this.reportSpecIssues(a,t,h)}validateObjectSpec(t,s,i,e){const r=`ERR_xy_json_${t}`,a=`WARN_xy_fields_${t}`,{data:n,parseError:o}=S(s,i);if(o)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(r,null),null!==n?this.reportSpecIssues(a,t,e(n)):this.errors.remove(a)}reportSpecIssues(t,s,i){const e=[];null!==i&&i.invalidFields.length>0&&e.push(`invalid: ${i.invalidFields.join(", ")}`),null!==i&&i.unknownKeys.length>0&&e.push(`unknown: ${i.unknownKeys.join(", ")}`),e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${s}: ignored sub-fields (${e.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,s){const{data:i,parseError:e}=S(s,"measure");if(e||null===i)return null;const{config:r}=E(i);return null!==r&&y(r.measure)?(void 0!==r.min&&void 0!==r.max&&r.min>=r.max?(this.errors.addOrReplace({id:`WARN_xy_domain_${t}`,type:"warning",message:`${t}: min must be smaller than max; the override is ignored.`}),r.min=void 0,r.max=void 0):this.errors.remove(`WARN_xy_domain_${t}`),r):null}prepareIso(){const{data:t,parseError:s}=S(this.iso,null);return s||null===t?null:_(t).config}prepareLabels(){const t=this.labelDefaults(),{data:s,parseError:i}=S(this.labels,null);return i||null===s?{points:t.points,values:t.values,max:t.max}:R(s,t).config}prepareLegend(){const{data:t,parseError:s}=S(this.legend,null);return s||null===t?{show:!0,position:"right"}:L(t).config}prepareFacet(){const{data:t,parseError:s}=S(this.facet,null);return s||null===t?null:$(t).config}preparePointLevel(){var t,s;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const e=null===(s=this.datasetMeta)||void 0===s?void 0:s.suggestedLevel;return"rowGroup"===e||"category"===e||"subCategory"===e?e:"category"}prepareSeriesLevel(t){var s;const i=null===(s=this.seriesLevel)||void 0===s?void 0:s.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,s){const i=new Set;for(const s of t){if(void 0===s)continue;const t=x(s);null!==t&&"scenario"===t.kind&&i.add(w(t.slot))}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const e=this.preparePointLevel(),r=this.prepareSeriesLevel(e),a=null!==s?"rowgroup"===s.level?"rowGroup":"category":null;let n=null;if(null!==r&&A[r]>=A[e]&&(n=`series '${r}' vs point '${e}'`),null!==a){const t=null!=r?r:e;A[a]>=A[t]&&(n=`facet '${a}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==n?this.t(".xy-level-order",{detail:n}):null)}parseAspect(t){const s=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===s)return null;const i=Number(s[1]),e=Number(s[2]);return i<=0||e<=0?null:i/e}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","axis.in","legend.title"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),s=new Map(n.map((t=>[t,this.t("global.".concat(t))])));return new Map([...s.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor(),s=this.element.localName;return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:i[s].scaleFactors,fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i[s].axisStyles,seriesColors:i[s].seriesColors,padding:i[s].padding}}))}getEffectiveScaleFactor(){const{mode:t,factor:s}=u(this.scale);return"factor"===t?s:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((s=>{var i,e,r,a;const n=(null===(i=s.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(e=s.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(r=s.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(a=s.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const s of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${s}${i}`]={type:"number",isOptional:!0,description:""};for(const[s,i]of Object.entries(this.mappedAxes())){if(null===i)continue;const e=x(i.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${s}: ${"label"in i&&void 0!==i.label?i.label:i.measure}`:(t[e.measure.base].description=`${s}: ${i.measure} (base)`,t[e.measure.delta].description=`${s}: ${i.measure} (delta)`))}return{[this.dataStructureName()]:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}mappedAxes(){return{x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y)}}dataStructureName(){return"IScatterChartDataRow"}chartTemplate(){const t=this.prepareAxis("x",this.x),s=this.prepareAxis("y",this.y),i=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==s?void 0:s.measure],i),this.hasBlockingErrors()||null===t||null===s)return null;const r=this.preparePointLevel(),a=this.prepareI18n(),n=this.prepareStyle(),o=h(this.element).width;return e("ibcs-chart-scatter",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:s,iso:this.prepareIso(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:i,pointLevel:r,seriesLevel:this.prepareSeriesLevel(r),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,styles:n,i18n:a,containerWidth:o,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return e(r,{key:"34a4004ac103bf8cee9e723ec5c5ebf47f5c7a4c",style:this.getFontStyles()},e("div",{key:"28f050a91d0c85e02c8cf295178cd075082787c6",class:"container"},this.chartTemplate()))}get element(){return a(this)}static get watchers(){return{x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}};j.style=":host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:column}";export{j as bn_chart_scatter}
@@ -1 +0,0 @@
1
- import{r as t,h as s,H as i,g as o}from"./p-B_d-jp99.js";import{w as r,b as n}from"./p-lIy3SJs2.js";import{w as e,a}from"./p-B4JfKvVT.js";import{g as l}from"./p-BnOTt2YD.js";import"./p-CIXlJoMr.js";const f=class{constructor(s){t(this,s),r(this),e(this),this.errors=a(this),this.componentStyle=n(this)}connectedCallback(){this.stores=l(this.element)}getFontStyles(){return this.componentStyle((t=>{var s,i,o,r;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(o=t.global)||void 0===o?void 0:o.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}prepareAssetUrl(t){if(null==t||""===t)return"";const s=this.stores.assets.state;return t.startsWith("asset:")?s[t.substring(6)]:s[t]||t}render(){return s(i,{key:"38fd8efa1dabbdf6c3b3140cf24810eea8f14ca2",style:this.getFontStyles()},null!=this.source&&""!==this.source?s("img",{src:this.prepareAssetUrl(this.source)}):"")}get element(){return o(this)}};f.style=":host{display:inline-block;position:relative;overflow:hidden}img{max-width:100%;height:auto}";export{f as bn_image}
@@ -1 +0,0 @@
1
- import{r as t,h as i,H as e,g as o}from"./p-B_d-jp99.js";import{a as n,w as s,g as a,p as l}from"./p-COXiPUfj.js";import{w as r,a as d}from"./p-B4JfKvVT.js";import{w as f,b as v}from"./p-lIy3SJs2.js";import{s as c}from"./p-BA48JiHe.js";import"./p-BnOTt2YD.js";import"./p-CIXlJoMr.js";const h=/\b(__proto__|globalThis)\b|\.constructor\b/,u=class{constructor(i){t(this,i),this.data={},f(this),r(this),this.errors=d(this),this.t=n(this).t,s(this,((t,i)=>{this.data=Object.assign(Object.assign({},this.data),{[t]:i})})),this.componentStyle=v(this)}validateValue(t){"string"!=typeof t||""===t?this.errors.addOrReplace({id:"no_value",type:"warning",message:"Empty value"}):this.errors.remove("no_value")}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}componentWillLoad(){this.validateValue(this.value),this.validateScaling(this.scale)}evalTemplate(t){if(!t)return"";if(h.test(t))return this.errors.addOrReplace({id:"ERR_value_eval",type:"error",message:"Template contains forbidden pattern"}),"";try{const i=new Proxy({data:this.data,t:this.t},{has:()=>!0,get:(t,i)=>i===Symbol.unscopables?void 0:t[i],set:()=>!0}),e=new Function("sandbox","with(sandbox){try{return`"+t+'`}catch(e){return""}}').call(i,i);return this.errors.remove("ERR_value_eval"),null!=e?String(e):""}catch(t){return this.errors.addOrReplace({id:"ERR_value_eval",type:"error",message:`Template evaluation failed: ${t instanceof Error?t.message:String(t)}`}),""}}prepareStyle(){return this.componentStyle((t=>{var i,e,o,n,s,a,l,r,d,f,v,c,h,u,p,b,m,g,y,w,_,$;return{fontStyles:{font:`${null!==(n=null!==(e=null===(i=t["bn-text"])||void 0===i?void 0:i.fontSizePx)&&void 0!==e?e:null===(o=t.global)||void 0===o?void 0:o.fontSizePx)&&void 0!==n?n:13.3333}px ${null!==(r=null!==(a=null===(s=t["bn-text"])||void 0===s?void 0:s.fontFamily)&&void 0!==a?a:null===(l=t.global)||void 0===l?void 0:l.fontFamily)&&void 0!==r?r:"'Noto Sans', sans-serif"}`,size:null!==(c=null!==(f=null===(d=t["bn-text"])||void 0===d?void 0:d.fontSizePx)&&void 0!==f?f:null===(v=t.global)||void 0===v?void 0:v.fontSizePx)&&void 0!==c?c:13.3333,color:null!==(b=null!==(u=null===(h=t["bn-text"])||void 0===h?void 0:h.fontColor)&&void 0!==u?u:null===(p=t.global)||void 0===p?void 0:p.fontColor)&&void 0!==b?b:"#000000",background:null!==(w=null!==(g=null===(m=t["bn-text"])||void 0===m?void 0:m.fontBackgroundColor)&&void 0!==g?g:null===(y=t.global)||void 0===y?void 0:y.fontBackgroundColor)&&void 0!==w?w:"#ffffff",leading:null!==($=null===(_=t["bn-text"])||void 0===_?void 0:_.leading)&&void 0!==$?$:1.8}}}))}applyScaling(t){const i=this.element,{mode:e,factor:o}=l(this.scale),{width:n,height:s}=a(i),r=i.scrollHeight>i.clientHeight+1?i.clientHeight:s,d=n,f=d>0&&i.scrollWidth>d+1,v=r>0&&i.scrollHeight>r+1,c=f||v;if(d<=0&&r<=0)return;if("none"===e){if(c){const t=[];f&&t.push(`w:${i.scrollWidth}>${Math.round(d)}`),v&&t.push(`h:${i.scrollHeight}>${Math.round(r)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows container (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}if("factor"===e){if(c){const t=[];f&&t.push(`w:${i.scrollWidth}>${Math.round(d)}`),v&&t.push(`h:${i.scrollHeight}>${Math.round(r)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows with factor ${o} (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}i.style.setProperty("--bn-font-size",`${t}px`);const h=i.scrollWidth,u=i.scrollHeight,p=i.clientHeight,b=u>p+1?p:s,m=d<=0||h<=d+1,g=b<=0||u<=b+1;if(m&&g)return void this.errors.remove("AUTO_scale");const y=Math.min(1,!m&&d>0?d/h:1,!g&&b>0?b/u:1);i.style.setProperty("--bn-font-size",t*y+"px"),"empty"===e?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled font by factor ${y.toFixed(3)}`}):this.errors.remove("AUTO_scale")}componentDidRender(){this.container.innerHTML=c(this.evalTemplate(this.value)),this.applyScaling(this.prepareStyle().fontStyles.size)}render(){const{fontStyles:t}=this.prepareStyle(),{mode:o,factor:n}=l(this.scale),s="factor"===o?t.size*n+"px":`${t.size}px`,a={"--bn-font-family":t.font.substring(t.font.indexOf("px ")+3),"--bn-font-size":s,"--bn-font-color":t.color,"--bn-font-background":t.background};return i(e,{key:"07508edce15f5716e05ca9e4644b6f2c8d6efff1",style:a},i("div",{key:"b86016ce2ca4cfa55b6eac62de9a61fa23b83b13"},i("span",{key:"912e9755d52faf58053f9c8e02d44bf43cd5b355",class:"container",ref:t=>{this.container=t}})))}get element(){return o(this)}static get watchers(){return{value:[{validateValue:0}],scale:[{validateScaling:0}]}}};u.style=':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}';export{u as bn_text}