@bino-bi/bn-template-engine 1.0.0-next.34 → 1.0.0-next.36

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 (146) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-2dcdac86.entry.js +1 -0
  3. package/dist/bn-template-engine/{p-7d475277.entry.js → p-5a64f90f.entry.js} +1 -1
  4. package/dist/bn-template-engine/{p-789bfd06.entry.js → p-93b8387f.entry.js} +1 -1
  5. package/dist/bn-template-engine/{p-66ed6259.entry.js → p-9a61f59d.entry.js} +1 -1
  6. package/dist/bn-template-engine/p-BVU4bIsi.js +1 -0
  7. package/dist/bn-template-engine/{p-CJfJQT0m.js → p-D0tNATZq.js} +1 -1
  8. package/dist/bn-template-engine/p-DF9sfwBN.js +1 -0
  9. package/dist/bn-template-engine/{p-CAvWZ3a5.js → p-DyupX-Z-.js} +1 -1
  10. package/dist/bn-template-engine/{p-14d021be.entry.js → p-b0dfc113.entry.js} +1 -1
  11. package/dist/bn-template-engine/{p-dec6837c.entry.js → p-eea538f1.entry.js} +1 -1
  12. package/dist/bn-template-engine/{p-CHZ50kEY.js → p-qpZjVnX5.js} +1 -1
  13. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +378 -135
  14. package/dist/cjs/bn-grid.cjs.entry.js +3 -3
  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-text.cjs.entry.js +3 -3
  19. package/dist/cjs/{localFrame-P5SDUOto.js → localFrame-U3Qs0psw.js} +1 -1
  20. package/dist/cjs/{withBodyObserver-B1_hmuUz.js → withBodyObserver-S-FGHpAX.js} +1 -1
  21. package/dist/cjs/{withHasError-3kR2tdhJ.js → withHasError-BkBrsCpI.js} +8 -7
  22. package/dist/cjs/{withStyled-eHD8Yt2K.js → withStyled-DfE0aW7D.js} +63 -3
  23. package/dist/cjs/{withTranslation-yJ-j0lsu.js → withTranslation-0gkn9xoC.js} +2 -2
  24. package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +97 -48
  25. package/dist/collection/components/bn-table/bn-table.js +19 -10
  26. package/dist/collection/components/bn-table/utils/Table.js +34 -8
  27. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +103 -32
  28. package/dist/collection/components/bn-table/utils/helper/DataQuery.js +57 -10
  29. package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +73 -30
  30. package/dist/collection/stores/ruleSets.js +8 -7
  31. package/dist/collection/utils/ibcsRuleSet.js +2 -1
  32. package/dist/collection/utils/model/Order.js +49 -2
  33. package/dist/collection/utils/validate.js +11 -1
  34. package/dist/components/bn-annotation-layer.js +1 -1
  35. package/dist/components/bn-annotation-list.js +1 -1
  36. package/dist/components/bn-asset.js +1 -1
  37. package/dist/components/bn-body.js +1 -1
  38. package/dist/components/bn-card.js +1 -1
  39. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  40. package/dist/components/bn-chart-bubble.js +1 -1
  41. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  42. package/dist/components/bn-chart-bullet.js +1 -1
  43. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  44. package/dist/components/bn-chart-scatter.js +1 -1
  45. package/dist/components/bn-chart-structure-renderer.js +1 -1
  46. package/dist/components/bn-chart-structure.js +1 -1
  47. package/dist/components/bn-chart-time-renderer.js +1 -1
  48. package/dist/components/bn-chart-time.js +1 -1
  49. package/dist/components/bn-component-style.js +1 -1
  50. package/dist/components/bn-context.js +1 -1
  51. package/dist/components/bn-dataset.js +1 -1
  52. package/dist/components/bn-datasource.js +1 -1
  53. package/dist/components/bn-footer.js +1 -1
  54. package/dist/components/bn-grid.js +1 -1
  55. package/dist/components/bn-image.js +1 -1
  56. package/dist/components/bn-internationalization.js +1 -1
  57. package/dist/components/bn-layout-card.js +1 -1
  58. package/dist/components/bn-layout-page.js +1 -1
  59. package/dist/components/bn-message.js +1 -1
  60. package/dist/components/bn-page.js +1 -1
  61. package/dist/components/bn-ruleset.js +1 -1
  62. package/dist/components/bn-scaling-group.js +1 -1
  63. package/dist/components/bn-table-renderer.js +1 -1
  64. package/dist/components/bn-table.js +1 -1
  65. package/dist/components/bn-text.js +1 -1
  66. package/dist/components/bn-title-renderer.js +1 -1
  67. package/dist/components/bn-title.js +1 -1
  68. package/dist/components/bn-tree.js +1 -1
  69. package/dist/components/p-16rjcQ0t.js +1 -0
  70. package/dist/components/{p-8a2-IS-y.js → p-2eicD9rF.js} +1 -1
  71. package/dist/components/p-4vVbchX2.js +1 -0
  72. package/dist/components/{p-VIw66ez1.js → p-7ieJFBUk.js} +1 -1
  73. package/dist/components/{p-Dn3DJxQQ.js → p-9mUU4itF.js} +1 -1
  74. package/dist/components/{p-D5LDmR4u.js → p-B5tixDPM.js} +1 -1
  75. package/dist/components/p-BPGLOHUe.js +1 -0
  76. package/dist/components/{p-B3F_c9GB.js → p-BU_53KVT.js} +1 -1
  77. package/dist/components/p-BXXjh6We.js +1 -0
  78. package/dist/components/{p-C-oNdJj9.js → p-BXg3v5AO.js} +1 -1
  79. package/dist/components/{p-B7UDMyar.js → p-BhEdmPjm.js} +1 -1
  80. package/dist/components/{p-nHZ8466v.js → p-BmOWXYHF.js} +1 -1
  81. package/dist/components/{p-DLLljAll.js → p-Bo_R7f_T.js} +1 -1
  82. package/dist/components/{p-DdG2Ylar.js → p-BqUB56k1.js} +1 -1
  83. package/dist/components/{p-DHAoxu6M.js → p-BzjGUtYh.js} +1 -1
  84. package/dist/components/{p-BtH2oezK.js → p-C-KX1_tw.js} +1 -1
  85. package/dist/components/{p-BldMZbAf.js → p-C3gYq-HU.js} +1 -1
  86. package/dist/components/p-CLilvhjH.js +1 -0
  87. package/dist/components/{p-CPC9Vkmg.js → p-CQVAHG6w.js} +1 -1
  88. package/dist/components/{p-4BanAktr.js → p-C_6KHDYv.js} +1 -1
  89. package/dist/components/{p-ClGOhg6P.js → p-Cel0a6ma.js} +1 -1
  90. package/dist/components/{p-Ku08TQL1.js → p-Chuj-LpI.js} +1 -1
  91. package/dist/components/{p-M6hn0BuZ.js → p-CniN8ALm.js} +1 -1
  92. package/dist/components/{p-BcOud3dQ.js → p-DDvWTgk1.js} +1 -1
  93. package/dist/components/p-DJUffGeB.js +1 -0
  94. package/dist/components/p-DQl2K2Xl.js +1 -0
  95. package/dist/components/p-DT04Cka0.js +1 -0
  96. package/dist/components/{p-BVnYDfb8.js → p-DTmqMQpw.js} +1 -1
  97. package/dist/components/{p-DSkyHSIL.js → p-DaOm9YwQ.js} +1 -1
  98. package/dist/components/p-DjPWZfry.js +1 -0
  99. package/dist/components/{p-BXt0ers2.js → p-Dm6EAaJ9.js} +1 -1
  100. package/dist/components/p-Do4oPrkE.js +1 -0
  101. package/dist/components/{p-DEHnizot.js → p-Dq9dG0Kr.js} +1 -1
  102. package/dist/components/{p-D6cWoDk1.js → p-M2k_I8lv.js} +1 -1
  103. package/dist/components/{p-B4pmO5QQ.js → p-NBaq67dL.js} +1 -1
  104. package/dist/components/p-OquycEMA.js +1 -0
  105. package/dist/components/{p-CJtE8Pyr.js → p-eWxolPDU.js} +1 -1
  106. package/dist/components/{p-De82WP7z.js → p-fKJx8WtW.js} +1 -1
  107. package/dist/components/{p-xhiPDAZa.js → p-sLbQ7yZ1.js} +1 -1
  108. package/dist/components/{p-GrpYAVHb.js → p-sar8m7th.js} +1 -1
  109. package/dist/components/{p-CYqHwYgQ.js → p-tkB96Ena.js} +1 -1
  110. package/dist/esm/bn-annotation-layer_30.entry.js +378 -135
  111. package/dist/esm/bn-grid.entry.js +3 -3
  112. package/dist/esm/bn-image.entry.js +2 -2
  113. package/dist/esm/bn-internationalization.entry.js +2 -2
  114. package/dist/esm/bn-ruleset.entry.js +2 -2
  115. package/dist/esm/bn-text.entry.js +3 -3
  116. package/dist/esm/{localFrame-IW84cmdb.js → localFrame-BNWPPaQa.js} +1 -1
  117. package/dist/esm/{withBodyObserver-CAnnvrE_.js → withBodyObserver-AHQAUV85.js} +1 -1
  118. package/dist/esm/{withHasError-Cj_MzZ8Q.js → withHasError-B6Lvj9Cq.js} +8 -7
  119. package/dist/esm/{withStyled-Cxua0iTP.js → withStyled-CIoJ86RM.js} +61 -4
  120. package/dist/esm/{withTranslation-BeAbw2--.js → withTranslation-BX9T3dfm.js} +2 -2
  121. package/dist/types/components/bn-table/bn-table-renderer/bn-table-renderer.d.ts +8 -12
  122. package/dist/types/components/bn-table/bn-table.d.ts +17 -4
  123. package/dist/types/components/bn-table/utils/Table.d.ts +2 -0
  124. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +9 -2
  125. package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +8 -0
  126. package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +18 -9
  127. package/dist/types/components.d.ts +4 -4
  128. package/dist/types/stores/ruleSets.d.ts +2 -1
  129. package/dist/types/utils/ibcsRuleSet.d.ts +2 -1
  130. package/dist/types/utils/model/Order.d.ts +18 -1
  131. package/dist/types/utils/validate.d.ts +2 -0
  132. package/package.json +1 -1
  133. package/dist/bn-template-engine/p-BNCLKXjM.js +0 -1
  134. package/dist/bn-template-engine/p-_SKPuKfK.js +0 -1
  135. package/dist/bn-template-engine/p-dc12ff1b.entry.js +0 -1
  136. package/dist/components/p-BNWZoAip.js +0 -1
  137. package/dist/components/p-BT2WH_CP.js +0 -1
  138. package/dist/components/p-BVtD8O36.js +0 -1
  139. package/dist/components/p-BWRE5w0i.js +0 -1
  140. package/dist/components/p-C6XrNN2m.js +0 -1
  141. package/dist/components/p-CGI6XIaK.js +0 -1
  142. package/dist/components/p-CLkpoHdg.js +0 -1
  143. package/dist/components/p-CYv_8LrR.js +0 -1
  144. package/dist/components/p-Ckl1aEvn.js +0 -1
  145. package/dist/components/p-CurWSJkH.js +0 -1
  146. package/dist/components/p-D7X69xMg.js +0 -1
@@ -0,0 +1 @@
1
+ import{g as t}from"./p-CCZcKl0Q.js";import{r}from"./p-D0tNATZq.js";const o=(o,s)=>{let a;const e=new MutationObserver((()=>{var t;a&&s(null!==(t=a.textContent)&&void 0!==t?t:"")})),c=o.connectedCallback;o.connectedCallback=()=>{var i;a=t(o),e.observe(a,{childList:!0,subtree:!0,characterData:!0}),s(null!==(i=a.textContent)&&void 0!==i?i:""),r(c,o)};const i=o.disconnectedCallback;o.disconnectedCallback=()=>{e.disconnect(),r(i,o)}};export{o as w}
@@ -1 +1 @@
1
- import{g as t,r as n,c as e,R as o}from"./p-CJfJQT0m.js";import{g as r,f as i}from"./p-CCZcKl0Q.js";import{i as s}from"./p-_SKPuKfK.js";const a=new Set(["br","b","i","strong","em","span","p","div","table","tr","td","th","thead","tbody","tfoot","ul","ol","li","h1","h2","h3","h4","h5","h6","sub","sup","small","hr","a","img","code","pre","blockquote","del"]),l=new Set(["class","style","colspan","rowspan","href","title","src","alt","width","height"]),u=new Set(["http:","https:","mailto:"]),c=/^\s*text-align:\s*(left|center|right)\s*;?\s*$/i;function d(t){if(!t)return"";const n=(new DOMParser).parseFromString(t,"text/html").body;return f(n),n.innerHTML}function f(t){for(const n of Array.from(t.childNodes)){if(n.nodeType===Node.TEXT_NODE)continue;const e=n;if(n.nodeType!==Node.ELEMENT_NODE||!a.has(e.localName)){t.removeChild(n);continue}for(const t of Array.from(e.attributes)){const n=t.name.toLowerCase();l.has(n)&&("href"!==n&&"src"!==n||v(n,t.value))||e.removeAttribute(t.name)}const o=e.getAttribute("style");null===o||c.test(o)||e.removeAttribute("style"),f(e)}}function v(t,n){try{const{protocol:e}=new URL(n,"http://a");return u.has(e)||"src"===t&&"data:"===e}catch(t){return!1}}function h(t,n=!1){const e=p(t);if(!e)return n&&console.log("[parentDims] no layout parent found for",t.tagName),{width:0,height:0};const o=getComputedStyle(e),r=e.clientWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight),i=function(t,n=!1){let e=p(t),o=0,r=null,i=1;for(;e;){if(e.hasAttribute("data-bn-fit-content")){n&&console.log(`[height:${o}]`,e.tagName,"fit-content region → discarding inner candidate"),r=null;const t=parseInt(e.getAttribute("data-bn-fit-content"),10);!isNaN(t)&&t>1&&(i*=t),e=m(e),o++;continue}const t=getComputedStyle(e),s=t.overflowY;if(n&&console.log(`[height:${o}]`,e.tagName,e.className||"(no class)",`overflow=${s} clientH=${e.clientHeight} h=${t.height}`),null===r)if("hidden"===s||"scroll"===s||"auto"===s)r=e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom),n&&console.log(`[height] candidate at depth ${o}: ${Math.round(r)}px`);else if("none"!==t.maxHeight){const n=parseFloat(t.maxHeight);!isNaN(n)&&n>0&&(r=Math.min(n,e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)))}e=m(e),o++}return null!==r?r/i:(n&&console.log("[height] NO constrained ancestor → viewport fallback"),"undefined"!=typeof window?window.innerHeight/i:0)}(t,n);return n&&console.log("[parentDims]",t.tagName,"→ layoutParent:",e.tagName,e.className||"(no class)",`clientW=${e.clientWidth} → w=${Math.round(r)}, h=${Math.round(i)}`,"overflow:",o.overflow),{width:Math.max(0,r),height:Math.max(0,i)}}function p(t){var n;const e=t.parentElement;return(null===(n=null==e?void 0:e.assignedSlot)||void 0===n?void 0:n.parentElement)?e.assignedSlot.parentElement:e}function m(t){var n;if(null===(n=t.assignedSlot)||void 0===n?void 0:n.parentElement)return t.assignedSlot.parentElement;if(t.parentElement)return t.parentElement;const e=t.getRootNode();return e instanceof ShadowRoot?e.host:null}function b(t,n){const e=t.getBoundingClientRect(),o=t.offsetHeight>0?e.height/t.offsetHeight:0;if(!(o>0)||Math.abs(o-(t.offsetWidth>0?e.width/t.offsetWidth:0))>.01*o)return 0;const r=e.top+n*o;let i=0;for(let n=t;n;n=m(n)){const t=getComputedStyle(n).overflowY;if("hidden"===t||"clip"===t)i=Math.max(i,r-n.getBoundingClientRect().bottom);else if(("auto"===t||"scroll"===t)&&n.scrollHeight>n.clientHeight+1)break}return i/o}const g=(t,n)=>Math.round(t*n*100)/100;function w(t){if(null==t||""===t)return{mode:"empty"};if("none"===t)return{mode:"none"};if("auto"===t)return{mode:"auto"};const n=Number(t);return!isNaN(n)&&n>0?{mode:"factor",factor:n}:{mode:"empty"}}const y={k:1e3,K:1e3,M:1e6,G:1e9,T:1e12},$=/^(\d+(?:\.\d+)?|\.\d+)\s*([kKMGT])?$/;function M(t){var n;if("number"==typeof t)return Number.isFinite(t)&&t>0?{kind:"number",value:t}:{kind:"invalid",raw:String(t)};const e=null!==(n=null==t?void 0:t.toString().trim())&&void 0!==n?n:"";if("auto"===e.toLowerCase())return{kind:"auto"};const o=$.exec(e);if(o){const t=Number(o[1])*(o[2]?y[o[2]]:1);if(Number.isFinite(t)&&t>0)return{kind:"number",value:t}}return{kind:"invalid",raw:e}}function k(t,n){const e=M(t);if("auto"===e.kind)return{kind:"auto"};if("string"==typeof t){const e=t.trim();if(n.has(e))return{kind:"value",value:n.get(e)}}return"number"===e.kind?{kind:"value",value:e.value}:{kind:"invalid",raw:e.raw}}const N=[[1e12,"T"],[1e9,"G"],[1e6,"M"],[1e3,"k"]];function S(t){if(!Number.isFinite(t)||t<=0)return String(t);const n=t=>String(Number(t.toPrecision(3)));for(const[e,o]of N)if(t>=e)return`${n(t/e)}${o}`;return n(t)}const F="WARN_datasets",R=(o,i,s)=>{let a,l,u=[],c=[],d=[],f="";const v=()=>{const t=f;f=o.datasets||"",""!==t&&t!==f&&i("",[]),[d,c]=((t,n)=>{const e=[],o=[];for(const t of n)(r=t,r.startsWith("$")?e:o).push(t);var r;return[e,o]})(0,f.split(",")),((t,n)=>{const e=t.errors;if(e)if(n.length>0){const t=n.map((t=>t.substring(1))).join(", ");e.addOrReplace({id:F,type:"warning",message:`Using datasource(s) "${t}" directly. Prefer using a dataset (bn-dataset) for query support and metadata.`})}else e.remove(F)})(o,d),p()},h=(t,n)=>{const e=n?t.substring(1):t;let o;try{o=l.db.db.exec(`SELECT * FROM \`${e}\``)}catch(t){o=[]}i(t,o)},p=()=>{u.forEach((t=>t())),u=[],c.forEach((t=>{t&&(u.push(l.db.subscribe(t,(()=>h(t,!1)))),h(t,!1),(t=>{if(s){const n=l.datasetsMeta.get(t);n&&s(t,n)}})(t))})),d.forEach((t=>{t&&(u.push(l.db.subscribe(t.substring(1),(()=>h(t,!0)))),h(t,!0))}))},m=new MutationObserver((t=>{t.forEach((t=>{"datasets"===t.attributeName&&(o.datasets||"")!==f&&v()}))})),b=o.connectedCallback;o.connectedCallback=()=>{const e=r(o);l=t(e),v(),m.observe(e,{attributes:!0,attributeFilter:["datasets"]}),s&&(a=l.datasetsMeta.on("set",((t,n)=>{c.includes(t)&&s(t,n)}))),n(b,o)};const g=o.disconnectedCallback;return o.disconnectedCallback=()=>{m.disconnect(),u.forEach((t=>t())),u=[],n(a),e(r(o)),n(g,o)},t=>{c=t,p()}},C="inherited-page",O="bn-layout-page";function K(t){return"inherited-closest"===t||t===C}function T(t,n){const e=[];let o=t.parentNode;for(;o;){const t=o.nodeName.toLowerCase();if(t===O){e.push(o);break}if("bn-layout-card"===t&&n!==C&&e.push(o),o.parentNode)o=o.parentNode;else{if(!(o instanceof ShadowRoot))break;o=o.host}}return e}function j(t,n){var e;const o=t=>{const e=t.getAttribute(n),o=null==e?void 0:e.trim();return s(o)||K(o)?void 0:e};for(const r of t){if((null===(e=r.getAttribute(n))||void 0===e?void 0:e.trim())===C){const n=t.find((t=>t.nodeName.toLowerCase()===O)),e=n&&o(n);if(void 0!==e)return e;continue}const i=o(r);if(void 0!==i)return i}}const _=(t,e,o)=>{const s=new Map,a=new Map;let l=null;const u=()=>{var n;const o=r(t);s.clear(),a.clear(),l&&(l.disconnect(),l=null);const c=new Map;for(const r of e){const e=t[r.propName];if("string"!=typeof e||!K(e))continue;a.set(r.propName,e);const i=T(o,e),l=j(i,r.ancestorAttr);void 0!==l&&s.set(r.propName,l);for(const t of i)c.set(t,[...null!==(n=c.get(t))&&void 0!==n?n:[],r.ancestorAttr])}if(c.size>0){l=new MutationObserver((()=>{u(),i(t)}));for(const[t,n]of c)l.observe(t,{attributes:!0,attributeFilter:n})}},c=t.connectedCallback;t.connectedCallback=()=>{u(),n(c,t)};const d=t.disconnectedCallback;t.disconnectedCallback=()=>{l&&(l.disconnect(),l=null),s.clear(),a.clear(),n(d,t)};const f=t=>{var n;return null===(n=e.find((n=>n.propName===t)))||void 0===n?void 0:n.ancestorAttr.replace(/-(\w)/g,((t,n)=>n.toUpperCase()))};return(t,n,e)=>{const r=`WARN_inherited_${t}`,i=K(n);i&&a.get(t)!==n&&u();const l=i?s.get(t):void 0;return i&&void 0===l?(null==o||o.addOrReplace({id:r,type:"warning",message:`${t}: '${n}' could not be resolved, no surrounding ${n===C?"page":"card or page"} sets ${f(t)}`}),{value:e,inherited:!1,unresolved:!0}):(null==o||o.remove(r),{value:null!=l?l:n,inherited:void 0!==l,unresolved:!1})}},x=s=>{let a,l,u,c,d=null;const f=()=>{const t=r(s);if(d&&(d.disconnect(),d=null),u=s.i18nNamespace,l=u,null!=l)return;const n=function(t){let n=t.parentNode;for(;n;){if(n instanceof HTMLElement&&n.hasAttribute("i18n-namespace"))return n;if(n.parentNode)n=n.parentNode;else{if(!(n instanceof ShadowRoot))break;n=n.host}}}(t);n&&(l=n.getAttribute("i18n-namespace"),d=new MutationObserver((()=>{f(),i(s)})),d.observe(n,{attributes:!0,attributeFilter:["i18n-namespace"]}))},v=s.connectedCallback;s.connectedCallback=()=>{const e=r(s);c=t(e),f(),a=c.internationalization.on("set",(t=>{t!==l&&"_system"!==t||i(s)})),n(v,s)};const h=s.disconnectedCallback;return s.disconnectedCallback=()=>{d&&(d.disconnect(),d=null),n(a),e(r(s)),n(h,s)},{t:(t,n)=>{var e,i,a,d,v;void 0!==c&&s.i18nNamespace!==u&&f(),t.startsWith(".")&&(t=r(s).localName+t),Object.prototype.hasOwnProperty.call(o,t)&&(t=o[t]);const h=c.internationalization.state,p=c.context.state.locale,m=null!==(a=null===(i=null===(e=h[l])||void 0===e?void 0:e[p])||void 0===i?void 0:i[t])&&void 0!==a?a:null===(v=null===(d=h._system)||void 0===d?void 0:d[p])||void 0===v?void 0:v[t];return null==m?t:m.replace(/{{([\s\S]+?)}}/g,((t,e)=>{var o;return null!==(o=null==n?void 0:n[e.trim()])&&void 0!==o?o:""}))}}};export{R as a,b,g as c,k as d,S as e,T as f,h as g,_ as h,K as i,M as j,w as p,j as r,d as s,x as w}
1
+ import{g as t,r as n,c as e,R as o}from"./p-D0tNATZq.js";import{g as r,f as i}from"./p-CCZcKl0Q.js";import{i as s}from"./p-BVU4bIsi.js";const a=new Set(["br","b","i","strong","em","span","p","div","table","tr","td","th","thead","tbody","tfoot","ul","ol","li","h1","h2","h3","h4","h5","h6","sub","sup","small","hr","a","img","code","pre","blockquote","del"]),l=new Set(["class","style","colspan","rowspan","href","title","src","alt","width","height"]),u=new Set(["http:","https:","mailto:"]),c=/^\s*text-align:\s*(left|center|right)\s*;?\s*$/i;function d(t){if(!t)return"";const n=(new DOMParser).parseFromString(t,"text/html").body;return f(n),n.innerHTML}function f(t){for(const n of Array.from(t.childNodes)){if(n.nodeType===Node.TEXT_NODE)continue;const e=n;if(n.nodeType!==Node.ELEMENT_NODE||!a.has(e.localName)){t.removeChild(n);continue}for(const t of Array.from(e.attributes)){const n=t.name.toLowerCase();l.has(n)&&("href"!==n&&"src"!==n||v(n,t.value))||e.removeAttribute(t.name)}const o=e.getAttribute("style");null===o||c.test(o)||e.removeAttribute("style"),f(e)}}function v(t,n){try{const{protocol:e}=new URL(n,"http://a");return u.has(e)||"src"===t&&"data:"===e}catch(t){return!1}}function h(t,n=!1){const e=p(t);if(!e)return n&&console.log("[parentDims] no layout parent found for",t.tagName),{width:0,height:0};const o=getComputedStyle(e),r=e.clientWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight),i=function(t,n=!1){let e=p(t),o=0,r=null,i=1;for(;e;){if(e.hasAttribute("data-bn-fit-content")){n&&console.log(`[height:${o}]`,e.tagName,"fit-content region → discarding inner candidate"),r=null;const t=parseInt(e.getAttribute("data-bn-fit-content"),10);!isNaN(t)&&t>1&&(i*=t),e=m(e),o++;continue}const t=getComputedStyle(e),s=t.overflowY;if(n&&console.log(`[height:${o}]`,e.tagName,e.className||"(no class)",`overflow=${s} clientH=${e.clientHeight} h=${t.height}`),null===r)if("hidden"===s||"scroll"===s||"auto"===s)r=e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom),n&&console.log(`[height] candidate at depth ${o}: ${Math.round(r)}px`);else if("none"!==t.maxHeight){const n=parseFloat(t.maxHeight);!isNaN(n)&&n>0&&(r=Math.min(n,e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)))}e=m(e),o++}return null!==r?r/i:(n&&console.log("[height] NO constrained ancestor → viewport fallback"),"undefined"!=typeof window?window.innerHeight/i:0)}(t,n);return n&&console.log("[parentDims]",t.tagName,"→ layoutParent:",e.tagName,e.className||"(no class)",`clientW=${e.clientWidth} → w=${Math.round(r)}, h=${Math.round(i)}`,"overflow:",o.overflow),{width:Math.max(0,r),height:Math.max(0,i)}}function p(t){var n;const e=t.parentElement;return(null===(n=null==e?void 0:e.assignedSlot)||void 0===n?void 0:n.parentElement)?e.assignedSlot.parentElement:e}function m(t){var n;if(null===(n=t.assignedSlot)||void 0===n?void 0:n.parentElement)return t.assignedSlot.parentElement;if(t.parentElement)return t.parentElement;const e=t.getRootNode();return e instanceof ShadowRoot?e.host:null}function b(t,n){const e=t.getBoundingClientRect(),o=t.offsetHeight>0?e.height/t.offsetHeight:0;if(!(o>0)||Math.abs(o-(t.offsetWidth>0?e.width/t.offsetWidth:0))>.01*o)return 0;const r=e.top+n*o;let i=0;for(let n=t;n;n=m(n)){const t=getComputedStyle(n).overflowY;if("hidden"===t||"clip"===t)i=Math.max(i,r-n.getBoundingClientRect().bottom);else if(("auto"===t||"scroll"===t)&&n.scrollHeight>n.clientHeight+1)break}return i/o}const g=(t,n)=>Math.round(t*n*100)/100;function w(t){if(null==t||""===t)return{mode:"empty"};if("none"===t)return{mode:"none"};if("auto"===t)return{mode:"auto"};const n=Number(t);return!isNaN(n)&&n>0?{mode:"factor",factor:n}:{mode:"empty"}}const y={k:1e3,K:1e3,M:1e6,G:1e9,T:1e12},$=/^(\d+(?:\.\d+)?|\.\d+)\s*([kKMGT])?$/;function M(t){var n;if("number"==typeof t)return Number.isFinite(t)&&t>0?{kind:"number",value:t}:{kind:"invalid",raw:String(t)};const e=null!==(n=null==t?void 0:t.toString().trim())&&void 0!==n?n:"";if("auto"===e.toLowerCase())return{kind:"auto"};const o=$.exec(e);if(o){const t=Number(o[1])*(o[2]?y[o[2]]:1);if(Number.isFinite(t)&&t>0)return{kind:"number",value:t}}return{kind:"invalid",raw:e}}function k(t,n){const e=M(t);if("auto"===e.kind)return{kind:"auto"};if("string"==typeof t){const e=t.trim();if(n.has(e))return{kind:"value",value:n.get(e)}}return"number"===e.kind?{kind:"value",value:e.value}:{kind:"invalid",raw:e.raw}}const N=[[1e12,"T"],[1e9,"G"],[1e6,"M"],[1e3,"k"]];function S(t){if(!Number.isFinite(t)||t<=0)return String(t);const n=t=>String(Number(t.toPrecision(3)));for(const[e,o]of N)if(t>=e)return`${n(t/e)}${o}`;return n(t)}const F="WARN_datasets",R=(o,i,s)=>{let a,l,u=[],c=[],d=[],f="";const v=()=>{const t=f;f=o.datasets||"",""!==t&&t!==f&&i("",[]),[d,c]=((t,n)=>{const e=[],o=[];for(const t of n)(r=t,r.startsWith("$")?e:o).push(t);var r;return[e,o]})(0,f.split(",")),((t,n)=>{const e=t.errors;if(e)if(n.length>0){const t=n.map((t=>t.substring(1))).join(", ");e.addOrReplace({id:F,type:"warning",message:`Using datasource(s) "${t}" directly. Prefer using a dataset (bn-dataset) for query support and metadata.`})}else e.remove(F)})(o,d),p()},h=(t,n)=>{const e=n?t.substring(1):t;let o;try{o=l.db.db.exec(`SELECT * FROM \`${e}\``)}catch(t){o=[]}i(t,o)},p=()=>{u.forEach((t=>t())),u=[],c.forEach((t=>{t&&(u.push(l.db.subscribe(t,(()=>h(t,!1)))),h(t,!1),(t=>{if(s){const n=l.datasetsMeta.get(t);n&&s(t,n)}})(t))})),d.forEach((t=>{t&&(u.push(l.db.subscribe(t.substring(1),(()=>h(t,!0)))),h(t,!0))}))},m=new MutationObserver((t=>{t.forEach((t=>{"datasets"===t.attributeName&&(o.datasets||"")!==f&&v()}))})),b=o.connectedCallback;o.connectedCallback=()=>{const e=r(o);l=t(e),v(),m.observe(e,{attributes:!0,attributeFilter:["datasets"]}),s&&(a=l.datasetsMeta.on("set",((t,n)=>{c.includes(t)&&s(t,n)}))),n(b,o)};const g=o.disconnectedCallback;return o.disconnectedCallback=()=>{m.disconnect(),u.forEach((t=>t())),u=[],n(a),e(r(o)),n(g,o)},t=>{c=t,p()}},O="inherited-page",C="bn-layout-page";function T(t){return"inherited-closest"===t||t===O}function j(t,n){const e=[];let o=t.parentNode;for(;o;){const t=o.nodeName.toLowerCase();if(t===C){e.push(o);break}if("bn-layout-card"===t&&n!==O&&e.push(o),o.parentNode)o=o.parentNode;else{if(!(o instanceof ShadowRoot))break;o=o.host}}return e}function A(t,n){var e;const o=t=>{const e=t.getAttribute(n),o=null==e?void 0:e.trim();return s(o)||T(o)?void 0:e};for(const r of t){if((null===(e=r.getAttribute(n))||void 0===e?void 0:e.trim())===O){const n=t.find((t=>t.nodeName.toLowerCase()===C)),e=n&&o(n);if(void 0!==e)return e;continue}const i=o(r);if(void 0!==i)return i}}const x=(t,e,o)=>{const s=new Map,a=new Map;let l=null;const u=()=>{var n;const o=r(t);s.clear(),a.clear(),l&&(l.disconnect(),l=null);const c=new Map;for(const r of e){const e=t[r.propName];if("string"!=typeof e||!T(e))continue;a.set(r.propName,e);const i=j(o,e),l=A(i,r.ancestorAttr);void 0!==l&&s.set(r.propName,l);for(const t of i)c.set(t,[...null!==(n=c.get(t))&&void 0!==n?n:[],r.ancestorAttr])}if(c.size>0){l=new MutationObserver((()=>{u(),i(t)}));for(const[t,n]of c)l.observe(t,{attributes:!0,attributeFilter:n})}},c=t.connectedCallback;t.connectedCallback=()=>{u(),n(c,t)};const d=t.disconnectedCallback;t.disconnectedCallback=()=>{l&&(l.disconnect(),l=null),s.clear(),a.clear(),n(d,t)};const f=t=>{var n;return null===(n=e.find((n=>n.propName===t)))||void 0===n?void 0:n.ancestorAttr.replace(/-(\w)/g,((t,n)=>n.toUpperCase()))};return(t,n,e)=>{const r=`WARN_inherited_${t}`,i=T(n);i&&a.get(t)!==n&&u();const l=i?s.get(t):void 0;return i&&void 0===l?(null==o||o.addOrReplace({id:r,type:"warning",message:`${t}: '${n}' could not be resolved, no surrounding ${n===O?"page":"card or page"} sets ${f(t)}`}),{value:e,inherited:!1,unresolved:!0}):(null==o||o.remove(r),{value:null!=l?l:n,inherited:void 0!==l,unresolved:!1})}},D=s=>{let a,l,u,c,d=null;const f=()=>{const t=r(s);if(d&&(d.disconnect(),d=null),u=s.i18nNamespace,l=u,null!=l)return;const n=function(t){let n=t.parentNode;for(;n;){if(n instanceof HTMLElement&&n.hasAttribute("i18n-namespace"))return n;if(n.parentNode)n=n.parentNode;else{if(!(n instanceof ShadowRoot))break;n=n.host}}}(t);n&&(l=n.getAttribute("i18n-namespace"),d=new MutationObserver((()=>{f(),i(s)})),d.observe(n,{attributes:!0,attributeFilter:["i18n-namespace"]}))},v=s.connectedCallback;s.connectedCallback=()=>{const e=r(s);c=t(e),f(),a=c.internationalization.on("set",(t=>{t!==l&&"_system"!==t||i(s)})),n(v,s)};const h=s.disconnectedCallback;return s.disconnectedCallback=()=>{d&&(d.disconnect(),d=null),n(a),e(r(s)),n(h,s)},{t:(t,n)=>{var e,i,a,d,v;void 0!==c&&s.i18nNamespace!==u&&f(),t.startsWith(".")&&(t=r(s).localName+t),Object.prototype.hasOwnProperty.call(o,t)&&(t=o[t]);const h=c.internationalization.state,p=c.context.state.locale,m=null!==(a=null===(i=null===(e=h[l])||void 0===e?void 0:e[p])||void 0===i?void 0:i[t])&&void 0!==a?a:null===(v=null===(d=h._system)||void 0===d?void 0:d[p])||void 0===v?void 0:v[t];return null==m?t:m.replace(/{{([\s\S]+?)}}/g,((t,e)=>{var o;return null!==(o=null==n?void 0:n[e.trim()])&&void 0!==o?o:""}))}}};export{R as a,b,g as c,k as d,S as e,j as f,h as g,x as h,T as i,M as j,w as p,A as r,d as s,D as w}
@@ -1 +1 @@
1
- import{r as s,h as t,a as e,g as r}from"./p-CCZcKl0Q.js";import{w as i}from"./p-BNCLKXjM.js";import{w as o,a,g as c}from"./p-CJfJQT0m.js";const h=class{constructor(t){s(this,t),this.name="_default",o(this),this.errors=a(this),i(this,(s=>{this.stores||(this.stores=c(this.element));try{const t=JSON.parse(s);this.stores.ruleSets.set(this.name,t),this.errors.remove("ERR_body")}catch(s){this.errors.addOrReplace({id:"ERR_body",type:"error",message:`bn-ruleset: Failed to parse JSON body - ${s.message}`}),console.error(s)}}))}render(){return t(e,{key:"de03c25692178ed0f97c1e0d914396cba7c53cc3"})}get element(){return r(this)}};h.style="bn-ruleset{display:none}";export{h as bn_ruleset}
1
+ import{r as s,h as t,a as e,g as r}from"./p-CCZcKl0Q.js";import{w as i}from"./p-DF9sfwBN.js";import{w as o,a,g as c}from"./p-D0tNATZq.js";const h=class{constructor(t){s(this,t),this.name="_default",o(this),this.errors=a(this),i(this,(s=>{this.stores||(this.stores=c(this.element));try{const t=JSON.parse(s);this.stores.ruleSets.set(this.name,t),this.errors.remove("ERR_body")}catch(s){this.errors.addOrReplace({id:"ERR_body",type:"error",message:`bn-ruleset: Failed to parse JSON body - ${s.message}`}),console.error(s)}}))}render(){return t(e,{key:"de03c25692178ed0f97c1e0d914396cba7c53cc3"})}get element(){return r(this)}};h.style="bn-ruleset{display:none}";export{h as bn_ruleset}
@@ -1 +1 @@
1
- import{r as t,h as i,a as e,g as s}from"./p-CCZcKl0Q.js";import{LAYOUT_STATE_VERSION as o}from"./index.esm.js";import{l as n,o as l,r,m as a,a as d}from"./p-CHZ50kEY.js";import{w as h,a as c}from"./p-CJfJQT0m.js";import{w as u,a as v}from"./p-_SKPuKfK.js";function f(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);return Array.isArray(i)?i.map(((t,i)=>{var e,s,o;return"string"==typeof t?{label:t,id:String(i)}:"object"==typeof t&&null!==t?{label:null!==(s=null!==(e=t.label)&&void 0!==e?e:t.name)&&void 0!==s?s:String(i),id:null!==(o=t.id)&&void 0!==o?o:String(i)}:{label:String(t),id:String(i)}})):[]}catch(t){return console.error("parseHeaders: failed to parse JSON",t),[]}}function g(t,i){return`${t.id}-${i.id}`}function p(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);if(!Array.isArray(i))return["Headers must be an array"];const e=[],s=new Set;return i.forEach(((t,i)=>{"object"==typeof t&&null!==t&&void 0!==t.id&&("string"!=typeof t.id?e.push(`Header[${i}]: 'id' must be a string`):s.has(t.id)?e.push(`Header[${i}]: duplicate id '${t.id}'`):s.add(t.id),void 0!==t.label&&"string"!=typeof t.label&&e.push(`Header[${i}]: 'label' must be a string`))})),e}catch(t){return console.error("validateHeadersJson: failed to parse JSON",t),["Invalid JSON structure"]}}const b=["auto","equal"],m=["top","center","bottom","baseline"],y=["left","center","right","baseline"],w={top:"flex-start",center:"center",bottom:"flex-end",baseline:"flex-start"},x={left:"stretch",center:"center",right:"flex-end",baseline:"stretch"},C=t=>Math.round(100*t)/100,S=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]),$=new Set(["bn-layout-card"]),H={top:"--bn-baseline-offset-top",left:"--bn-baseline-offset-left",right:"--bn-baseline-offset-right"},j=class{validateRowHeaders(t){const i="ERR_rowHeaders",e=p(t);e.length>0?this.errors.addOrReplace({id:i,type:"error",message:`row-headers: ${e.join("; ")}`}):this.errors.remove(i),this.updateGridConfig()}validateColumnHeaders(t){const i="ERR_columnHeaders",e=p(t);e.length>0?this.errors.addOrReplace({id:i,type:"error",message:`column-headers: ${e.join("; ")}`}):this.errors.remove(i),this.updateGridConfig()}validateCellHeight(t){this.resolvedHeight=this.validateChoice("cell-height","ERR_cellHeight",t,b,"auto")}validateCellWidth(t){this.resolvedWidth=this.validateChoice("cell-width","ERR_cellWidth",t,b,"auto")}validateCellVerticalAlign(t){this.resolvedVertical=this.validateChoice("cell-vertical-align","ERR_cellVerticalAlign",t,m,"top"),this.schedule()}validateCellHorizontalAlign(t){this.resolvedHorizontal=this.validateChoice("cell-horizontal-align","ERR_cellHorizontalAlign",t,y,"left"),this.schedule()}validateCellCaptions(t){const i=function(t){if(void 0===t||""===t.trim())return{};let i;try{i=JSON.parse(t)}catch(t){return}if("object"!=typeof i||null===i||Array.isArray(i))return;const e={};for(const[t,s]of Object.entries(i)){if("string"!=typeof s)return;""!==s&&(e[t]=s)}return e}(t);i?this.errors.remove("ERR_cellCaptions"):this.errors.addOrReplace({id:"ERR_cellCaptions",type:"error",message:"cell-captions: not a JSON object from slot name to text."}),this.captions=null!=i?i:{}}constructor(i){t(this,i),this.gridConfig={rows:[],columns:[]},this.resolvedHeight="auto",this.resolvedWidth="auto",this.resolvedVertical="top",this.resolvedHorizontal="left",this.captions={},this.offsets={},this.frames=new Map,this.observed=new WeakSet,this.scheduled=!1,this.run=0,this.adjustments=0,this.chartTitle="",this.rowHeaders="[]",this.columnHeaders="[]",this.showRowHeaders=!0,this.showColumnHeaders=!0,this.showBorders=!0,this.rowHeaderWidth="auto",this.cellGap="0px",this.cellHeight="auto",this.cellWidth="auto",this.cellVerticalAlign="top",this.cellHorizontalAlign="left",this.cellCaptions="",this.schedule=()=>{if(!this.isBaselineMode())return this.run++,Object.keys(this.offsets).length>0&&(this.offsets={}),void this.applyFrameOffsets();this.scheduled||(this.scheduled=!0,this.holdStatus(new Promise((t=>{requestAnimationFrame((()=>{this.scheduled=!1,this.align().catch((t=>console.error("bn-grid: aligning the baselines failed",t))).finally(t)}))}))))},u(this),this.holdStatus=h(this),this.errors=c(this),this.componentStyle=v(this)}connectedCallback(){var t;this.observed=new WeakSet,this.resizeObserver=new ResizeObserver(this.schedule),this.mutationObserver=new MutationObserver(this.schedule),this.mutationObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot"]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule)}disconnectedCallback(){var t,i,e;null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(i=this.mutationObserver)||void 0===i||i.disconnect(),null===(e=document.fonts)||void 0===e||e.removeEventListener("loadingdone",this.schedule),this.run++}componentDidRender(){this.schedule()}validateChoice(t,i,e,s,o){return null==e||""===e?(this.errors.remove(i),o):s.includes(e)?(this.errors.remove(i),e):(this.errors.addOrReplace({id:i,type:"error",message:`${t}: "${e}" is not one of ${s.join(", ")}.`}),o)}isBaselineMode(){return"baseline"===this.resolvedVertical||"baseline"===this.resolvedHorizontal}contentIn(t){const i=Array.from(this.element.children).find((i=>i.getAttribute("slot")===t));if(!i)return{};const e=[i,...Array.from(i.querySelectorAll("*"))],s=e.find((t=>t.localName.startsWith("bn-")&&!S.has(t.localName)&&!$.has(t.localName))),o=s?e.find((t=>$.has(t.localName)&&t.contains(s))):void 0;return{visual:s,frame:o}}applyFrameOffsets(){this.frames.forEach(((t,i)=>{const e=this.offsets[i];Object.keys(H).forEach((i=>{const s=null==e?void 0:e[i];s?t.style.setProperty(H[i],`${s}px`):t.style.removeProperty(H[i])}))}))}async align(){var t;const i=++this.run;if(!this.element.isConnected||!this.isBaselineMode())return;const{rows:e,columns:s}=this.gridConfig,o=e.flatMap(((t,i)=>s.map(((e,s)=>({slot:g(t,e),row:i,column:s}))))),l=o.map((({slot:t})=>this.contentIn(t))),r=l.map((t=>t.visual));if(await Promise.all(r.map((t=>{var i;return null===(i=null==t?void 0:t.componentOnReady)||void 0===i?void 0:i.call(t)}))),i!==this.run)return;r.forEach((t=>t&&this.observe(t)));const a=await Promise.all(r.map((t=>"function"==typeof(null==t?void 0:t.getBaseline)?t.getBaseline().catch((()=>({}))):Promise.resolve({}))));if(i!==this.run)return;const d=n(this.element),h=new Map;null===(t=this.element.shadowRoot)||void 0===t||t.querySelectorAll(".grid-slot").forEach((t=>{var i;h.set(null!==(i=t.getAttribute("data-slot"))&&void 0!==i?i:"",t)})),this.frames=new Map,l.forEach((({frame:t},i)=>t&&this.frames.set(o[i].slot,t)));const c=function(t,i,e){const s={};for(const i of t)s[i.slot]={};const o=(i,e,o,n)=>{var l;const r=new Map;for(const e of t)r.set(e[i],[...null!==(l=r.get(e[i]))&&void 0!==l?l:[],e]);for(const t of r.values()){const i=t.map((t=>{const i=e(t);return void 0===i?void 0:i-o(t)})),l=i.filter((t=>void 0!==t)),r=l.length>0?Math.max(...l):0,a=i.map((t=>void 0===t?void 0:C(r-t))),d=Math.max(0,...a.filter((t=>void 0!==t)));t.forEach(((t,i)=>n(s[t.slot],a[i],d)))}};return i&&o("row",(t=>t.y),(t=>t.top),((t,i)=>{void 0===i?t.bottom=!0:t.top=i})),e&&o("column",(t=>t.x),(t=>t.left),((t,i,e)=>{void 0!==i&&(t.left=i);const s=C(e-(null!=i?i:0));s>0&&(t.right=s)})),s}(o.map((({slot:t,row:i,column:e},s)=>{const o=r[s],n=a[s],c=l[s].frame,u=null!=c?c:h.get(t),v=t=>parseFloat((null==u?void 0:u.style.getPropertyValue(t))||"0")||0,f=c?{slot:t,row:i,column:e,top:v(H.top),left:v(H.left)}:{slot:t,row:i,column:e,top:v("padding-top"),left:v("margin-left")};if(o){const t=d.toLocal(o.getBoundingClientRect());void 0!==n.y&&(f.y=t.y+n.y),void 0!==n.x&&(f.x=t.x+n.x)}return f})),"baseline"===this.resolvedVertical,"baseline"===this.resolvedHorizontal);if(function(t,i){var e,s,o,n,l,r,a,d;const h=new Set([...Object.keys(t),...Object.keys(i)]);for(const c of h){const h=null!==(e=t[c])&&void 0!==e?e:{},u=null!==(s=i[c])&&void 0!==s?s:{};if(Boolean(h.bottom)!==Boolean(u.bottom))return!1;if(Math.abs((null!==(o=h.top)&&void 0!==o?o:0)-(null!==(n=u.top)&&void 0!==n?n:0))>=.5)return!1;if(Math.abs((null!==(l=h.left)&&void 0!==l?l:0)-(null!==(r=u.left)&&void 0!==r?r:0))>=.5)return!1;if(Math.abs((null!==(a=h.right)&&void 0!==a?a:0)-(null!==(d=u.right)&&void 0!==d?d:0))>=.5)return!1}return!0}(c,this.offsets))this.adjustments=0;else{if(this.adjustments>=5)return console.warn("bn-grid: the baselines did not settle; the cells keep their last alignment."),void(this.adjustments=0);this.adjustments++,this.offsets=c,this.applyFrameOffsets(),this.schedule()}}observe(t){var i;this.observed.has(t)||(this.observed.add(t),null===(i=this.resizeObserver)||void 0===i||i.observe(t));const e=t=>{var i;t&&(this.observed.has(t)||(this.observed.add(t),null===(i=this.mutationObserver)||void 0===i||i.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["x1","y1","x2","y2","x","y","width","height","transform","style","class"]})),t.querySelectorAll("*").forEach((t=>e(t.shadowRoot))))};e(t.shadowRoot)}async getLayoutState(t){var i,e,s,n;const h=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",c=l(this.element),u=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),{rows:v,columns:f}=this.gridConfig,g={version:o,tag:this.element.localName,id:d(this.element),slot:null!==(e=this.element.getAttribute("slot"))&&void 0!==e?e:void 0,rect:a(this.element,c),em:{fontSizePx:u,appliedScaleFactor:1},regions:[],metadata:{title:this.chartTitle||void 0,rowCount:v.length,columnCount:f.length,cellCount:v.length*f.length},diagnostics:r(this.element)},p=null===(s=this.element.shadowRoot)||void 0===s?void 0:s.querySelector(".grid-container");if(p&&g.regions.push({id:"grid",rect:a(p,c)}),"full"!==h||!p)return g;const b=[],m=t=>b.push(t),y=p.querySelector(".grid-title");return y&&m({kind:"gridTitle",label:(null===(n=y.textContent)||void 0===n?void 0:n.trim())||void 0,rect:a(y,c)}),p.querySelectorAll(".grid-header-col").forEach(((t,i)=>{var e,s;m({kind:"gridHeader",columnId:null===(e=f[i])||void 0===e?void 0:e.id,label:(null===(s=t.textContent)||void 0===s?void 0:s.trim())||void 0,rect:a(t,c)})})),p.querySelectorAll(".grid-header-row").forEach(((t,i)=>{var e,s;m({kind:"gridHeader",rowId:null===(e=v[i])||void 0===e?void 0:e.id,label:(null===(s=t.textContent)||void 0===s?void 0:s.trim())||void 0,rect:a(t,c)})})),p.querySelectorAll(".grid-cell").forEach(((t,i)=>{var e,s,o,n;m({kind:"gridCell",rowId:f.length>0?null===(e=v[Math.floor(i/f.length)])||void 0===e?void 0:e.id:void 0,columnId:f.length>0?null===(s=f[i%f.length])||void 0===s?void 0:s.id:void 0,slot:null!==(n=null===(o=t.querySelector("slot"))||void 0===o?void 0:o.getAttribute("name"))&&void 0!==n?n:void 0,rect:a(t,c)})})),p.querySelectorAll(".grid-caption").forEach((t=>{var i,e,s,o;m({kind:"gridCaption",slot:null!==(s=null===(e=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector("slot"))||void 0===e?void 0:e.getAttribute("name"))&&void 0!==s?s:void 0,label:(null===(o=t.textContent)||void 0===o?void 0:o.trim())||void 0,rect:a(t,c)})})),g.elements=b,g}getGridStyle(){return this.componentStyle((t=>t["bn-grid"]))}componentWillLoad(){this.validateRowHeaders(this.rowHeaders),this.validateColumnHeaders(this.columnHeaders),this.validateCellHeight(this.cellHeight),this.validateCellWidth(this.cellWidth),this.validateCellVerticalAlign(this.cellVerticalAlign),this.validateCellHorizontalAlign(this.cellHorizontalAlign),this.validateCellCaptions(this.cellCaptions)}updateGridConfig(){var t;this.gridConfig=(t=this.columnHeaders,{rows:f(this.rowHeaders),columns:f(t)})}shouldShowRowHeaders(){return this.showRowHeaders&&this.gridConfig.rows.length>0}shouldShowColumnHeaders(){return this.showColumnHeaders&&this.gridConfig.columns.length>0}shouldShowBorders(){return this.showBorders}getGridTemplateColumns(){const t=[];this.shouldShowRowHeaders()&&t.push(this.rowHeaderWidth);const i=this.gridConfig.columns.length||1;for(let e=0;e<i;e++)t.push("equal"===this.resolvedWidth?"minmax(0, 1fr)":"auto");return t.join(" ")}getGridTemplateRows(){const t=[];this.chartTitle&&t.push("auto"),this.shouldShowColumnHeaders()&&t.push("auto");const i=this.gridConfig.rows.length||1;for(let e=0;e<i;e++)t.push("equal"===this.resolvedHeight?"1fr":"auto");return t.join(" ")}renderTitle(){if(!this.chartTitle)return null;const t=(this.shouldShowRowHeaders()?1:0)+this.gridConfig.columns.length;return i("div",{class:"grid-title",style:{"grid-column":`1 / span ${t}`,"grid-row":"1"}},this.chartTitle)}renderColumnHeaders(){if(!this.shouldShowColumnHeaders())return null;const t=this.getGridStyle(),e=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",s=this.shouldShowRowHeaders()?2:1,o=this.chartTitle?2:1;return this.gridConfig.columns.map(((n,l)=>{const r=l>0;return i("div",{key:`col-header-${n.id}`,class:"grid-header grid-header-col",style:{"grid-column":String(s+l),"grid-row":String(o),"border-left":r?e:"none",padding:`${t.cellPadding}px`,"padding-left":r?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},n.label)}))}renderDataCells(){const t=this.getGridStyle(),e=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",s=this.shouldShowRowHeaders()?2:1,o=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,n=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((l,r)=>{if(this.shouldShowRowHeaders()){const s=r>0;n.push(i("div",{key:`row-header-${l.id}`,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":String(o+r),"border-top":s?e:"none",padding:`${t.cellPadding}px`,"padding-top":s?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},l.label))}this.gridConfig.columns.forEach(((a,d)=>{const h=g(l,a),c=d>0,u=r>0;n.push(i("div",{key:`cell-${h}`,class:"grid-cell",style:Object.assign({"grid-column":String(s+d),"grid-row":String(o+r),"border-left":c?e:"none","border-top":u?e:"none","padding-left":c?`${t.cellPadding+4}px`:"0","padding-top":u?`${t.cellPadding+4}px`:"0"},this.cellAlignStyle())},this.renderCellContent(h,t)))}))})),n}cellAlignStyle(){return"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal?{}:{display:"flex","flex-direction":"column","justify-content":w[this.resolvedVertical],"align-items":x[this.resolvedHorizontal]}}renderCellContent(t,e){var s;const o=this.captions[t],n=void 0!==o?i("div",{class:"grid-caption",style:{"font-size":`${e.captionFontSize}px`,"font-weight":String(e.captionFontWeight),color:e.captionColor,"margin-bottom":`${e.captionGap}px`,"align-self":"flex-start"}},o):null,l={};"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal||(l["align-self"]="stretch","center"!==this.resolvedHorizontal&&"right"!==this.resolvedHorizontal||(l.display="flex",l["flex-direction"]="column",l["align-items"]=x[this.resolvedHorizontal])),"center"===this.resolvedVertical?(l["margin-top"]="auto",l["margin-bottom"]="auto"):"bottom"===this.resolvedVertical&&(l["margin-top"]="auto");const r=this.frames.has(t)?{bottom:null===(s=this.offsets[t])||void 0===s?void 0:s.bottom}:this.offsets[t];return(null==r?void 0:r.bottom)&&(l["margin-top"]="auto"),(null==r?void 0:r.top)&&(l["padding-top"]=`${r.top}px`),(null==r?void 0:r.left)&&(l["margin-left"]=`${r.left}px`),(null==r?void 0:r.right)&&(l["margin-right"]=`${r.right}px`),[n,i("div",{class:"grid-slot","data-slot":t,style:l},i("slot",{name:t}))]}getFontStyles(){return this.componentStyle((t=>{var i,e,s,o;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(o=t.global)||void 0===o?void 0:o.fontBackgroundColor)||"#ffffff"}}))}render(){const t="equal"===this.resolvedWidth,s=Object.assign(Object.assign({display:t?"grid":"inline-grid"},t?{width:"100%"}:{}),{"grid-template-columns":this.getGridTemplateColumns(),"grid-template-rows":this.getGridTemplateRows(),gap:this.cellGap});return i(e,{key:"643b4d675bac89c542618e7d6ec5f2c0ef8d6d6c",style:t?Object.assign(Object.assign({},this.getFontStyles()),{display:"block"}):this.getFontStyles()},i("div",{key:"4bc671a6868b313c809f37aeb2f32ca30c7e9142",class:"grid-container",style:s},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),i("slot",{key:"5e66d95c65a0bad59d3816cf0009bb88fbe53f9c"}))}get element(){return s(this)}static get watchers(){return{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],cellHeight:[{validateCellHeight:0}],cellWidth:[{validateCellWidth:0}],cellVerticalAlign:[{validateCellVerticalAlign:0}],cellHorizontalAlign:[{validateCellHorizontalAlign:0}],cellCaptions:[{validateCellCaptions:0}]}}};j.style=':host{display:inline-block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.grid-container{display:inline-grid;box-sizing:border-box}.grid-title{font-weight:normal;padding-bottom:8px}.grid-header{display:flex;align-items:flex-end;box-sizing:border-box}.grid-header-row{justify-content:flex-end;padding-right:8px}.grid-header-col{white-space:nowrap;justify-content:flex-start}.grid-cell{position:relative;box-sizing:border-box}';export{j as bn_grid}
1
+ import{r as t,h as i,a as e,g as s}from"./p-CCZcKl0Q.js";import{LAYOUT_STATE_VERSION as o}from"./index.esm.js";import{l as n,o as l,r,m as a,a as d}from"./p-qpZjVnX5.js";import{w as h,a as c}from"./p-D0tNATZq.js";import{w as u,a as v}from"./p-BVU4bIsi.js";function f(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);return Array.isArray(i)?i.map(((t,i)=>{var e,s,o;return"string"==typeof t?{label:t,id:String(i)}:"object"==typeof t&&null!==t?{label:null!==(s=null!==(e=t.label)&&void 0!==e?e:t.name)&&void 0!==s?s:String(i),id:null!==(o=t.id)&&void 0!==o?o:String(i)}:{label:String(t),id:String(i)}})):[]}catch(t){return console.error("parseHeaders: failed to parse JSON",t),[]}}function g(t,i){return`${t.id}-${i.id}`}function p(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);if(!Array.isArray(i))return["Headers must be an array"];const e=[],s=new Set;return i.forEach(((t,i)=>{"object"==typeof t&&null!==t&&void 0!==t.id&&("string"!=typeof t.id?e.push(`Header[${i}]: 'id' must be a string`):s.has(t.id)?e.push(`Header[${i}]: duplicate id '${t.id}'`):s.add(t.id),void 0!==t.label&&"string"!=typeof t.label&&e.push(`Header[${i}]: 'label' must be a string`))})),e}catch(t){return console.error("validateHeadersJson: failed to parse JSON",t),["Invalid JSON structure"]}}const b=["auto","equal"],m=["top","center","bottom","baseline"],y=["left","center","right","baseline"],w={top:"flex-start",center:"center",bottom:"flex-end",baseline:"flex-start"},x={left:"stretch",center:"center",right:"flex-end",baseline:"stretch"},S=t=>Math.round(100*t)/100,C=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]),$=new Set(["bn-layout-card"]),H={top:"--bn-baseline-offset-top",left:"--bn-baseline-offset-left",right:"--bn-baseline-offset-right"},j=class{validateRowHeaders(t){const i="ERR_rowHeaders",e=p(t);e.length>0?this.errors.addOrReplace({id:i,type:"error",message:`row-headers: ${e.join("; ")}`}):this.errors.remove(i),this.updateGridConfig()}validateColumnHeaders(t){const i="ERR_columnHeaders",e=p(t);e.length>0?this.errors.addOrReplace({id:i,type:"error",message:`column-headers: ${e.join("; ")}`}):this.errors.remove(i),this.updateGridConfig()}validateCellHeight(t){this.resolvedHeight=this.validateChoice("cell-height","ERR_cellHeight",t,b,"auto")}validateCellWidth(t){this.resolvedWidth=this.validateChoice("cell-width","ERR_cellWidth",t,b,"auto")}validateCellVerticalAlign(t){this.resolvedVertical=this.validateChoice("cell-vertical-align","ERR_cellVerticalAlign",t,m,"top"),this.schedule()}validateCellHorizontalAlign(t){this.resolvedHorizontal=this.validateChoice("cell-horizontal-align","ERR_cellHorizontalAlign",t,y,"left"),this.schedule()}validateCellCaptions(t){const i=function(t){if(void 0===t||""===t.trim())return{};let i;try{i=JSON.parse(t)}catch(t){return}if("object"!=typeof i||null===i||Array.isArray(i))return;const e={};for(const[t,s]of Object.entries(i)){if("string"!=typeof s)return;""!==s&&(e[t]=s)}return e}(t);i?this.errors.remove("ERR_cellCaptions"):this.errors.addOrReplace({id:"ERR_cellCaptions",type:"error",message:"cell-captions: not a JSON object from slot name to text."}),this.captions=null!=i?i:{}}constructor(i){t(this,i),this.gridConfig={rows:[],columns:[]},this.resolvedHeight="auto",this.resolvedWidth="auto",this.resolvedVertical="top",this.resolvedHorizontal="left",this.captions={},this.offsets={},this.frames=new Map,this.observed=new WeakSet,this.scheduled=!1,this.run=0,this.adjustments=0,this.chartTitle="",this.rowHeaders="[]",this.columnHeaders="[]",this.showRowHeaders=!0,this.showColumnHeaders=!0,this.showBorders=!0,this.rowHeaderWidth="auto",this.cellGap="0px",this.cellHeight="auto",this.cellWidth="auto",this.cellVerticalAlign="top",this.cellHorizontalAlign="left",this.cellCaptions="",this.schedule=()=>{if(!this.isBaselineMode())return this.run++,Object.keys(this.offsets).length>0&&(this.offsets={}),void this.applyFrameOffsets();this.scheduled||(this.scheduled=!0,this.holdStatus(new Promise((t=>{requestAnimationFrame((()=>{this.scheduled=!1,this.align().catch((t=>console.error("bn-grid: aligning the baselines failed",t))).finally(t)}))}))))},u(this),this.holdStatus=h(this),this.errors=c(this),this.componentStyle=v(this)}connectedCallback(){var t;this.observed=new WeakSet,this.resizeObserver=new ResizeObserver(this.schedule),this.mutationObserver=new MutationObserver(this.schedule),this.mutationObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot"]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule)}disconnectedCallback(){var t,i,e;null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(i=this.mutationObserver)||void 0===i||i.disconnect(),null===(e=document.fonts)||void 0===e||e.removeEventListener("loadingdone",this.schedule),this.run++}componentDidRender(){this.schedule()}validateChoice(t,i,e,s,o){return null==e||""===e?(this.errors.remove(i),o):s.includes(e)?(this.errors.remove(i),e):(this.errors.addOrReplace({id:i,type:"error",message:`${t}: "${e}" is not one of ${s.join(", ")}.`}),o)}isBaselineMode(){return"baseline"===this.resolvedVertical||"baseline"===this.resolvedHorizontal}contentIn(t){const i=Array.from(this.element.children).find((i=>i.getAttribute("slot")===t));if(!i)return{};const e=[i,...Array.from(i.querySelectorAll("*"))],s=e.find((t=>t.localName.startsWith("bn-")&&!C.has(t.localName)&&!$.has(t.localName))),o=s?e.find((t=>$.has(t.localName)&&t.contains(s))):void 0;return{visual:s,frame:o}}applyFrameOffsets(){this.frames.forEach(((t,i)=>{const e=this.offsets[i];Object.keys(H).forEach((i=>{const s=null==e?void 0:e[i];s?t.style.setProperty(H[i],`${s}px`):t.style.removeProperty(H[i])}))}))}async align(){var t;const i=++this.run;if(!this.element.isConnected||!this.isBaselineMode())return;const{rows:e,columns:s}=this.gridConfig,o=e.flatMap(((t,i)=>s.map(((e,s)=>({slot:g(t,e),row:i,column:s}))))),l=o.map((({slot:t})=>this.contentIn(t))),r=l.map((t=>t.visual));if(await Promise.all(r.map((t=>{var i;return null===(i=null==t?void 0:t.componentOnReady)||void 0===i?void 0:i.call(t)}))),i!==this.run)return;r.forEach((t=>t&&this.observe(t)));const a=await Promise.all(r.map((t=>"function"==typeof(null==t?void 0:t.getBaseline)?t.getBaseline().catch((()=>({}))):Promise.resolve({}))));if(i!==this.run)return;const d=n(this.element),h=new Map;null===(t=this.element.shadowRoot)||void 0===t||t.querySelectorAll(".grid-slot").forEach((t=>{var i;h.set(null!==(i=t.getAttribute("data-slot"))&&void 0!==i?i:"",t)})),this.frames=new Map,l.forEach((({frame:t},i)=>t&&this.frames.set(o[i].slot,t)));const c=function(t,i,e){const s={};for(const i of t)s[i.slot]={};const o=(i,e,o,n)=>{var l;const r=new Map;for(const e of t)r.set(e[i],[...null!==(l=r.get(e[i]))&&void 0!==l?l:[],e]);for(const t of r.values()){const i=t.map((t=>{const i=e(t);return void 0===i?void 0:i-o(t)})),l=i.filter((t=>void 0!==t)),r=l.length>0?Math.max(...l):0,a=i.map((t=>void 0===t?void 0:S(r-t))),d=Math.max(0,...a.filter((t=>void 0!==t)));t.forEach(((t,i)=>n(s[t.slot],a[i],d)))}};return i&&o("row",(t=>t.y),(t=>t.top),((t,i)=>{void 0===i?t.bottom=!0:t.top=i})),e&&o("column",(t=>t.x),(t=>t.left),((t,i,e)=>{void 0!==i&&(t.left=i);const s=S(e-(null!=i?i:0));s>0&&(t.right=s)})),s}(o.map((({slot:t,row:i,column:e},s)=>{const o=r[s],n=a[s],c=l[s].frame,u=null!=c?c:h.get(t),v=t=>parseFloat((null==u?void 0:u.style.getPropertyValue(t))||"0")||0,f=c?{slot:t,row:i,column:e,top:v(H.top),left:v(H.left)}:{slot:t,row:i,column:e,top:v("padding-top"),left:v("margin-left")};if(o){const t=d.toLocal(o.getBoundingClientRect());void 0!==n.y&&(f.y=t.y+n.y),void 0!==n.x&&(f.x=t.x+n.x)}return f})),"baseline"===this.resolvedVertical,"baseline"===this.resolvedHorizontal);if(function(t,i){var e,s,o,n,l,r,a,d;const h=new Set([...Object.keys(t),...Object.keys(i)]);for(const c of h){const h=null!==(e=t[c])&&void 0!==e?e:{},u=null!==(s=i[c])&&void 0!==s?s:{};if(Boolean(h.bottom)!==Boolean(u.bottom))return!1;if(Math.abs((null!==(o=h.top)&&void 0!==o?o:0)-(null!==(n=u.top)&&void 0!==n?n:0))>=.5)return!1;if(Math.abs((null!==(l=h.left)&&void 0!==l?l:0)-(null!==(r=u.left)&&void 0!==r?r:0))>=.5)return!1;if(Math.abs((null!==(a=h.right)&&void 0!==a?a:0)-(null!==(d=u.right)&&void 0!==d?d:0))>=.5)return!1}return!0}(c,this.offsets))this.adjustments=0;else{if(this.adjustments>=5)return console.warn("bn-grid: the baselines did not settle; the cells keep their last alignment."),void(this.adjustments=0);this.adjustments++,this.offsets=c,this.applyFrameOffsets(),this.schedule()}}observe(t){var i;this.observed.has(t)||(this.observed.add(t),null===(i=this.resizeObserver)||void 0===i||i.observe(t));const e=t=>{var i;t&&(this.observed.has(t)||(this.observed.add(t),null===(i=this.mutationObserver)||void 0===i||i.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["x1","y1","x2","y2","x","y","width","height","transform","style","class"]})),t.querySelectorAll("*").forEach((t=>e(t.shadowRoot))))};e(t.shadowRoot)}async getLayoutState(t){var i,e,s,n;const h=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",c=l(this.element),u=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),{rows:v,columns:f}=this.gridConfig,g={version:o,tag:this.element.localName,id:d(this.element),slot:null!==(e=this.element.getAttribute("slot"))&&void 0!==e?e:void 0,rect:a(this.element,c),em:{fontSizePx:u,appliedScaleFactor:1},regions:[],metadata:{title:this.chartTitle||void 0,rowCount:v.length,columnCount:f.length,cellCount:v.length*f.length},diagnostics:r(this.element)},p=null===(s=this.element.shadowRoot)||void 0===s?void 0:s.querySelector(".grid-container");if(p&&g.regions.push({id:"grid",rect:a(p,c)}),"full"!==h||!p)return g;const b=[],m=t=>b.push(t),y=p.querySelector(".grid-title");return y&&m({kind:"gridTitle",label:(null===(n=y.textContent)||void 0===n?void 0:n.trim())||void 0,rect:a(y,c)}),p.querySelectorAll(".grid-header-col").forEach(((t,i)=>{var e,s;m({kind:"gridHeader",columnId:null===(e=f[i])||void 0===e?void 0:e.id,label:(null===(s=t.textContent)||void 0===s?void 0:s.trim())||void 0,rect:a(t,c)})})),p.querySelectorAll(".grid-header-row").forEach(((t,i)=>{var e,s;m({kind:"gridHeader",rowId:null===(e=v[i])||void 0===e?void 0:e.id,label:(null===(s=t.textContent)||void 0===s?void 0:s.trim())||void 0,rect:a(t,c)})})),p.querySelectorAll(".grid-cell").forEach(((t,i)=>{var e,s,o,n;m({kind:"gridCell",rowId:f.length>0?null===(e=v[Math.floor(i/f.length)])||void 0===e?void 0:e.id:void 0,columnId:f.length>0?null===(s=f[i%f.length])||void 0===s?void 0:s.id:void 0,slot:null!==(n=null===(o=t.querySelector("slot"))||void 0===o?void 0:o.getAttribute("name"))&&void 0!==n?n:void 0,rect:a(t,c)})})),p.querySelectorAll(".grid-caption").forEach((t=>{var i,e,s,o;m({kind:"gridCaption",slot:null!==(s=null===(e=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector("slot"))||void 0===e?void 0:e.getAttribute("name"))&&void 0!==s?s:void 0,label:(null===(o=t.textContent)||void 0===o?void 0:o.trim())||void 0,rect:a(t,c)})})),g.elements=b,g}getGridStyle(){return this.componentStyle((t=>t["bn-grid"]))}componentWillLoad(){this.validateRowHeaders(this.rowHeaders),this.validateColumnHeaders(this.columnHeaders),this.validateCellHeight(this.cellHeight),this.validateCellWidth(this.cellWidth),this.validateCellVerticalAlign(this.cellVerticalAlign),this.validateCellHorizontalAlign(this.cellHorizontalAlign),this.validateCellCaptions(this.cellCaptions)}updateGridConfig(){var t;this.gridConfig=(t=this.columnHeaders,{rows:f(this.rowHeaders),columns:f(t)})}shouldShowRowHeaders(){return this.showRowHeaders&&this.gridConfig.rows.length>0}shouldShowColumnHeaders(){return this.showColumnHeaders&&this.gridConfig.columns.length>0}shouldShowBorders(){return this.showBorders}getGridTemplateColumns(){const t=[];this.shouldShowRowHeaders()&&t.push(this.rowHeaderWidth);const i=this.gridConfig.columns.length||1;for(let e=0;e<i;e++)t.push("equal"===this.resolvedWidth?"minmax(0, 1fr)":"auto");return t.join(" ")}getGridTemplateRows(){const t=[];this.chartTitle&&t.push("auto"),this.shouldShowColumnHeaders()&&t.push("auto");const i=this.gridConfig.rows.length||1;for(let e=0;e<i;e++)t.push("equal"===this.resolvedHeight?"1fr":"auto");return t.join(" ")}renderTitle(){if(!this.chartTitle)return null;const t=(this.shouldShowRowHeaders()?1:0)+this.gridConfig.columns.length;return i("div",{class:"grid-title",style:{"grid-column":`1 / span ${t}`,"grid-row":"1"}},this.chartTitle)}renderColumnHeaders(){if(!this.shouldShowColumnHeaders())return null;const t=this.getGridStyle(),e=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",s=this.shouldShowRowHeaders()?2:1,o=this.chartTitle?2:1;return this.gridConfig.columns.map(((n,l)=>{const r=l>0;return i("div",{key:`col-header-${n.id}`,class:"grid-header grid-header-col",style:{"grid-column":String(s+l),"grid-row":String(o),"border-left":r?e:"none",padding:`${t.cellPadding}px`,"padding-left":r?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},n.label)}))}renderDataCells(){const t=this.getGridStyle(),e=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",s=this.shouldShowRowHeaders()?2:1,o=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,n=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((l,r)=>{if(this.shouldShowRowHeaders()){const s=r>0;n.push(i("div",{key:`row-header-${l.id}`,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":String(o+r),"border-top":s?e:"none",padding:`${t.cellPadding}px`,"padding-top":s?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},l.label))}this.gridConfig.columns.forEach(((a,d)=>{const h=g(l,a),c=d>0,u=r>0;n.push(i("div",{key:`cell-${h}`,class:"grid-cell",style:Object.assign({"grid-column":String(s+d),"grid-row":String(o+r),"border-left":c?e:"none","border-top":u?e:"none","padding-left":c?`${t.cellPadding+4}px`:"0","padding-top":u?`${t.cellPadding+4}px`:"0"},this.cellAlignStyle())},this.renderCellContent(h,t)))}))})),n}cellAlignStyle(){return"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal?{}:{display:"flex","flex-direction":"column","justify-content":w[this.resolvedVertical],"align-items":x[this.resolvedHorizontal]}}renderCellContent(t,e){var s;const o=this.captions[t],n=void 0!==o?i("div",{class:"grid-caption",style:{"font-size":`${e.captionFontSize}px`,"font-weight":String(e.captionFontWeight),color:e.captionColor,"margin-bottom":`${e.captionGap}px`,"align-self":"flex-start"}},o):null,l={};"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal||(l["align-self"]="stretch","center"!==this.resolvedHorizontal&&"right"!==this.resolvedHorizontal||(l.display="flex",l["flex-direction"]="column",l["align-items"]=x[this.resolvedHorizontal])),"center"===this.resolvedVertical?(l["margin-top"]="auto",l["margin-bottom"]="auto"):"bottom"===this.resolvedVertical&&(l["margin-top"]="auto");const r=this.frames.has(t)?{bottom:null===(s=this.offsets[t])||void 0===s?void 0:s.bottom}:this.offsets[t];return(null==r?void 0:r.bottom)&&(l["margin-top"]="auto"),(null==r?void 0:r.top)&&(l["padding-top"]=`${r.top}px`),(null==r?void 0:r.left)&&(l["margin-left"]=`${r.left}px`),(null==r?void 0:r.right)&&(l["margin-right"]=`${r.right}px`),[n,i("div",{class:"grid-slot","data-slot":t,style:l},i("slot",{name:t}))]}getFontStyles(){return this.componentStyle((t=>{var i,e,s,o;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(o=t.global)||void 0===o?void 0:o.fontBackgroundColor)||"#ffffff"}}))}render(){const t="equal"===this.resolvedWidth,s=Object.assign(Object.assign({display:t?"grid":"inline-grid"},t?{width:"100%"}:{}),{"grid-template-columns":this.getGridTemplateColumns(),"grid-template-rows":this.getGridTemplateRows(),gap:this.cellGap});return i(e,{key:"643b4d675bac89c542618e7d6ec5f2c0ef8d6d6c",style:t?Object.assign(Object.assign({},this.getFontStyles()),{display:"block"}):this.getFontStyles()},i("div",{key:"4bc671a6868b313c809f37aeb2f32ca30c7e9142",class:"grid-container",style:s},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),i("slot",{key:"5e66d95c65a0bad59d3816cf0009bb88fbe53f9c"}))}get element(){return s(this)}static get watchers(){return{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],cellHeight:[{validateCellHeight:0}],cellWidth:[{validateCellWidth:0}],cellVerticalAlign:[{validateCellVerticalAlign:0}],cellHorizontalAlign:[{validateCellHorizontalAlign:0}],cellCaptions:[{validateCellCaptions:0}]}}};j.style=':host{display:inline-block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.grid-container{display:inline-grid;box-sizing:border-box}.grid-title{font-weight:normal;padding-bottom:8px}.grid-header{display:flex;align-items:flex-end;box-sizing:border-box}.grid-header-row{justify-content:flex-end;padding-right:8px}.grid-header-col{white-space:nowrap;justify-content:flex-start}.grid-cell{position:relative;box-sizing:border-box}';export{j as bn_grid}
@@ -1 +1 @@
1
- import{b as t}from"./p-CJfJQT0m.js";const n=t=>Math.round(100*t)/100;function o(t){return{x:n(t.left),y:n(t.top),width:n(t.width),height:n(t.height)}}function r(t,o){const r=n(t.width),e=n(t.height);return{context:{x:n(t.left-o.context.x),y:n(t.top-o.context.y),width:r,height:e},component:{x:n(t.left-o.component.x),y:n(t.top-o.component.y),width:r,height:e}}}function e(t,n){return r(t.getBoundingClientRect(),n)}function i(t){const n=getComputedStyle(t,"::before").content;if(!n||"none"===n||"normal"===n)return 0;const o=t.ownerDocument.createElement("canvas").getContext("2d");if(!o)return 0;const{fontStyle:r,fontWeight:e,fontSize:i,fontFamily:u}=getComputedStyle(t);return o.font=`${r} ${e} ${i} ${u}`,o.measureText(n.replace(/^"|"$/g,"")).width}function u(t,n){var o,e;const i=null===(e=null===(o=t.ownerDocument)||void 0===o?void 0:o.createRange)||void 0===e?void 0:e.call(o);if(!i)return;const u=t.getBoundingClientRect(),c=t.querySelector("svg text");let a;if(c)a=c.getBoundingClientRect();else{i.selectNodeContents(t);const n=t.querySelector(".prefix-second");n&&i.setStartAfter(n),a=i.getBoundingClientRect()}const l=Math.max(a.left,u.left),s=Math.max(a.top,u.top),f=Math.min(a.right,u.right)-l,h=Math.min(a.bottom,u.bottom)-s;return f>0&&h>0?r({left:l,top:s,width:f,height:h},n):void 0}function c(n){const o=n.getBoundingClientRect(),r=t(n),e=r?r.getBoundingClientRect():o;return{context:{x:e.left,y:e.top},component:{x:o.left,y:o.top}}}function a(t){var n,o;return null!==(o=null!==(n=t.getAttribute("id"))&&void 0!==n?n:t.getAttribute("name"))&&void 0!==o?o:void 0}function l(t){var n;return null!==(n=a(t))&&void 0!==n?n:t.localName}function s(t){const n=new Map;return t.map((({tag:t,explicitId:o})=>{var r;const e=null!==(r=n.get(t))&&void 0!==r?r:0;return n.set(t,e+1),null!=o?o:`${t}[${e}]`}))}function f(t){const n=t.getAttribute("has-error");if(!n)return[];try{const t=JSON.parse(n);return Array.isArray(t)?t:[]}catch(t){return[]}}const h=[1,0,0,1],d=([t,n,o,r],[e,i,u,c])=>[t*e+o*i,n*e+r*i,t*u+o*c,n*u+r*c];function v(t){if("function"!=typeof getComputedStyle||"function"!=typeof DOMMatrix)return h;const n=getComputedStyle(t).transform;if(!n||"none"===n)return h;try{const{a:t,b:o,c:r,d:e}=new DOMMatrix(n);return[t,o,r,e]}catch(t){return h}}function y(t){var n,o,r;return null!==(r=null!==(o=null!==(n=t.assignedSlot)&&void 0!==n?n:t.parentElement)&&void 0!==o?o:t.getRootNode().host)&&void 0!==r?r:null}function x(t){var n,o;const[r,e,i,u]=function(t){let n=h;for(let o=t;o;o=y(o))n=d(v(o),n);return n}(t),c=r*u-e*i;if(0===c){const n=t.getBoundingClientRect();return{toLocal:t=>({x:t.left-n.left,y:t.top-n.top,width:t.width,height:t.height})}}const a=(t,n)=>({x:r*t+i*n,y:e*t+u*n}),l=t,s=t.getBoundingClientRect(),f=null!==(n=l.offsetWidth)&&void 0!==n?n:s.width,x=null!==(o=l.offsetHeight)&&void 0!==o?o:s.height,M=[a(0,0),a(f,0),a(0,x),a(f,x)],p=s.left-Math.min(...M.map((t=>t.x))),g=s.top-Math.min(...M.map((t=>t.y))),m=(t,n)=>{const o=t-p,a=n-g;return{x:(u*o-i*a)/c,y:(-e*o+r*a)/c}};return{toLocal:t=>{const n=[m(t.left,t.top),m(t.left+t.width,t.top),m(t.left,t.top+t.height),m(t.left+t.width,t.top+t.height)],o=Math.min(...n.map((t=>t.x))),r=Math.min(...n.map((t=>t.y)));return{x:o,y:r,width:Math.max(...n.map((t=>t.x)))-o,height:Math.max(...n.map((t=>t.y)))-r}}}}export{l as a,s as b,a as c,u as d,i as e,x as l,e as m,c as o,f as r,o as t}
1
+ import{b as t}from"./p-D0tNATZq.js";const n=t=>Math.round(100*t)/100;function o(t){return{x:n(t.left),y:n(t.top),width:n(t.width),height:n(t.height)}}function r(t,o){const r=n(t.width),e=n(t.height);return{context:{x:n(t.left-o.context.x),y:n(t.top-o.context.y),width:r,height:e},component:{x:n(t.left-o.component.x),y:n(t.top-o.component.y),width:r,height:e}}}function e(t,n){return r(t.getBoundingClientRect(),n)}function i(t){const n=getComputedStyle(t,"::before").content;if(!n||"none"===n||"normal"===n)return 0;const o=t.ownerDocument.createElement("canvas").getContext("2d");if(!o)return 0;const{fontStyle:r,fontWeight:e,fontSize:i,fontFamily:u}=getComputedStyle(t);return o.font=`${r} ${e} ${i} ${u}`,o.measureText(n.replace(/^"|"$/g,"")).width}function u(t,n){var o,e;const i=null===(e=null===(o=t.ownerDocument)||void 0===o?void 0:o.createRange)||void 0===e?void 0:e.call(o);if(!i)return;const u=t.getBoundingClientRect(),c=t.querySelector("svg text");let a;if(c)a=c.getBoundingClientRect();else{i.selectNodeContents(t);const n=t.querySelector(".prefix-second");n&&i.setStartAfter(n),a=i.getBoundingClientRect()}const l=Math.max(a.left,u.left),s=Math.max(a.top,u.top),f=Math.min(a.right,u.right)-l,h=Math.min(a.bottom,u.bottom)-s;return f>0&&h>0?r({left:l,top:s,width:f,height:h},n):void 0}function c(n){const o=n.getBoundingClientRect(),r=t(n),e=r?r.getBoundingClientRect():o;return{context:{x:e.left,y:e.top},component:{x:o.left,y:o.top}}}function a(t){var n,o;return null!==(o=null!==(n=t.getAttribute("id"))&&void 0!==n?n:t.getAttribute("name"))&&void 0!==o?o:void 0}function l(t){var n;return null!==(n=a(t))&&void 0!==n?n:t.localName}function s(t){const n=new Map;return t.map((({tag:t,explicitId:o})=>{var r;const e=null!==(r=n.get(t))&&void 0!==r?r:0;return n.set(t,e+1),null!=o?o:`${t}[${e}]`}))}function f(t){const n=t.getAttribute("has-error");if(!n)return[];try{const t=JSON.parse(n);return Array.isArray(t)?t:[]}catch(t){return[]}}const h=[1,0,0,1],d=([t,n,o,r],[e,i,u,c])=>[t*e+o*i,n*e+r*i,t*u+o*c,n*u+r*c];function v(t){if("function"!=typeof getComputedStyle||"function"!=typeof DOMMatrix)return h;const n=getComputedStyle(t).transform;if(!n||"none"===n)return h;try{const{a:t,b:o,c:r,d:e}=new DOMMatrix(n);return[t,o,r,e]}catch(t){return h}}function y(t){var n,o,r;return null!==(r=null!==(o=null!==(n=t.assignedSlot)&&void 0!==n?n:t.parentElement)&&void 0!==o?o:t.getRootNode().host)&&void 0!==r?r:null}function x(t){var n,o;const[r,e,i,u]=function(t){let n=h;for(let o=t;o;o=y(o))n=d(v(o),n);return n}(t),c=r*u-e*i;if(0===c){const n=t.getBoundingClientRect();return{toLocal:t=>({x:t.left-n.left,y:t.top-n.top,width:t.width,height:t.height})}}const a=(t,n)=>({x:r*t+i*n,y:e*t+u*n}),l=t,s=t.getBoundingClientRect(),f=null!==(n=l.offsetWidth)&&void 0!==n?n:s.width,x=null!==(o=l.offsetHeight)&&void 0!==o?o:s.height,M=[a(0,0),a(f,0),a(0,x),a(f,x)],p=s.left-Math.min(...M.map((t=>t.x))),g=s.top-Math.min(...M.map((t=>t.y))),m=(t,n)=>{const o=t-p,a=n-g;return{x:(u*o-i*a)/c,y:(-e*o+r*a)/c}};return{toLocal:t=>{const n=[m(t.left,t.top),m(t.left+t.width,t.top),m(t.left,t.top+t.height),m(t.left+t.width,t.top+t.height)],o=Math.min(...n.map((t=>t.x))),r=Math.min(...n.map((t=>t.y)));return{x:o,y:r,width:Math.max(...n.map((t=>t.x)))-o,height:Math.max(...n.map((t=>t.y)))-r}}}}export{l as a,s as b,a as c,u as d,i as e,x as l,e as m,c as o,f as r,o as t}