@nanoporetech-digital/components 5.1.3 → 5.2.0

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 (187) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/{component-store-74d25f63.js → component-store-f1dc1276.js} +2 -2
  3. package/dist/cjs/{component-store-74d25f63.js.map → component-store-f1dc1276.js.map} +1 -1
  4. package/dist/cjs/index.cjs.js +1 -1
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/nano-algolia-filter.cjs.entry.js +2 -2
  7. package/dist/cjs/nano-algolia-input.cjs.entry.js +2 -2
  8. package/dist/cjs/nano-algolia.cjs.entry.js +2 -2
  9. package/dist/cjs/nano-checkbox-group.cjs.entry.js +1 -1
  10. package/dist/cjs/nano-components.cjs.js +1 -1
  11. package/dist/cjs/nano-datalist_3.cjs.entry.js +1 -1
  12. package/dist/cjs/nano-dialog.cjs.entry.js +2 -2
  13. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +2 -2
  14. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
  15. package/dist/cjs/nano-global-nav.cjs.entry.js +2 -2
  16. package/dist/cjs/nano-input.cjs.entry.js +1 -1
  17. package/dist/cjs/nano-overflow-nav.cjs.entry.js +1 -1
  18. package/dist/cjs/nano-range.cjs.entry.js +1 -1
  19. package/dist/cjs/nano-resize-observe_2.cjs.entry.js +3 -1
  20. package/dist/cjs/nano-resize-observe_2.cjs.entry.js.map +1 -1
  21. package/dist/cjs/nano-sortable.cjs.entry.js +16 -8
  22. package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -1
  23. package/dist/cjs/nano-split-pane.cjs.entry.js +1 -1
  24. package/dist/cjs/nano-sticker.cjs.entry.js +4 -2
  25. package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
  26. package/dist/cjs/nano-tab-group.cjs.entry.js +2 -2
  27. package/dist/cjs/{nano-table-5a7a4d53.js → nano-table-04993bb4.js} +552 -181
  28. package/dist/cjs/nano-table-04993bb4.js.map +1 -0
  29. package/dist/cjs/nano-table.cjs.entry.js +2 -2
  30. package/dist/cjs/{table.worker-77e56070.js → table.worker-85877b23.js} +4 -4
  31. package/dist/cjs/table.worker-85877b23.js.map +1 -0
  32. package/dist/cjs/{table.worker-bd51e29f.js → table.worker-f258383d.js} +1 -1
  33. package/dist/cjs/{throttle-f55496c8.js → throttle-dfa64b9e.js} +17 -20
  34. package/dist/cjs/throttle-dfa64b9e.js.map +1 -0
  35. package/dist/collection/components/resize-observe/resize-observe.js +21 -1
  36. package/dist/collection/components/resize-observe/resize-observe.js.map +1 -1
  37. package/dist/collection/components/select/select.css +0 -1
  38. package/dist/collection/components/sortable/sortable.js +3 -7
  39. package/dist/collection/components/sortable/sortable.js.map +1 -1
  40. package/dist/collection/components/sticker/sticker.js +11 -5
  41. package/dist/collection/components/sticker/sticker.js.map +1 -1
  42. package/dist/collection/components/table/table-interface.js.map +1 -1
  43. package/dist/collection/components/table/table.cell.js +43 -10
  44. package/dist/collection/components/table/table.cell.js.map +1 -1
  45. package/dist/collection/components/table/table.css +38 -55
  46. package/dist/collection/components/table/table.header.js +4 -9
  47. package/dist/collection/components/table/table.header.js.map +1 -1
  48. package/dist/collection/components/table/table.js +96 -43
  49. package/dist/collection/components/table/table.js.map +1 -1
  50. package/dist/collection/components/table/table.pin-service.js +382 -0
  51. package/dist/collection/components/table/table.pin-service.js.map +1 -0
  52. package/dist/collection/components/table/table.row.js +39 -46
  53. package/dist/collection/components/table/table.row.js.map +1 -1
  54. package/dist/collection/components/table/table.utils.js +0 -124
  55. package/dist/collection/components/table/table.utils.js.map +1 -1
  56. package/dist/collection/components/table/table.worker.js +1 -0
  57. package/dist/collection/components/table/table.worker.js.map +1 -1
  58. package/dist/collection/utils/events.js +27 -0
  59. package/dist/collection/utils/events.js.map +1 -0
  60. package/dist/collection/utils/throttle.js +16 -19
  61. package/dist/collection/utils/throttle.js.map +1 -1
  62. package/dist/components/nano-sortable.js +15 -7
  63. package/dist/components/nano-sortable.js.map +1 -1
  64. package/dist/components/resize-observe.js +3 -1
  65. package/dist/components/resize-observe.js.map +1 -1
  66. package/dist/components/select.js +1 -1
  67. package/dist/components/select.js.map +1 -1
  68. package/dist/components/sticker.js +3 -1
  69. package/dist/components/sticker.js.map +1 -1
  70. package/dist/components/table.js +525 -183
  71. package/dist/components/table.js.map +1 -1
  72. package/dist/components/table.worker.js +1 -1
  73. package/dist/components/throttle.js +16 -19
  74. package/dist/components/throttle.js.map +1 -1
  75. package/dist/esm/{component-store-244a8431.js → component-store-c23ebc9c.js} +2 -2
  76. package/dist/esm/{component-store-244a8431.js.map → component-store-c23ebc9c.js.map} +1 -1
  77. package/dist/esm/index.js +1 -1
  78. package/dist/esm/loader.js +1 -1
  79. package/dist/esm/nano-algolia-filter.entry.js +2 -2
  80. package/dist/esm/nano-algolia-input.entry.js +2 -2
  81. package/dist/esm/nano-algolia.entry.js +2 -2
  82. package/dist/esm/nano-checkbox-group.entry.js +1 -1
  83. package/dist/esm/nano-components.js +1 -1
  84. package/dist/esm/nano-datalist_3.entry.js +1 -1
  85. package/dist/esm/nano-dialog.entry.js +2 -2
  86. package/dist/esm/nano-global-nav-user-profile_3.entry.js +2 -2
  87. package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
  88. package/dist/esm/nano-global-nav.entry.js +2 -2
  89. package/dist/esm/nano-input.entry.js +1 -1
  90. package/dist/esm/nano-overflow-nav.entry.js +1 -1
  91. package/dist/esm/nano-range.entry.js +1 -1
  92. package/dist/esm/nano-resize-observe_2.entry.js +3 -1
  93. package/dist/esm/nano-resize-observe_2.entry.js.map +1 -1
  94. package/dist/esm/nano-sortable.entry.js +16 -8
  95. package/dist/esm/nano-sortable.entry.js.map +1 -1
  96. package/dist/esm/nano-split-pane.entry.js +1 -1
  97. package/dist/esm/nano-sticker.entry.js +4 -2
  98. package/dist/esm/nano-sticker.entry.js.map +1 -1
  99. package/dist/esm/nano-tab-group.entry.js +2 -2
  100. package/dist/esm/{nano-table-026a0d30.js → nano-table-91f09583.js} +553 -182
  101. package/dist/esm/nano-table-91f09583.js.map +1 -0
  102. package/dist/esm/nano-table.entry.js +2 -2
  103. package/dist/esm/{table.worker-c17a27ed.js → table.worker-625475ba.js} +4 -4
  104. package/dist/esm/table.worker-625475ba.js.map +1 -0
  105. package/dist/esm/{table.worker-bd51e29f.js → table.worker-f258383d.js} +1 -1
  106. package/dist/esm/{throttle-7836544e.js → throttle-ac4fcefa.js} +17 -20
  107. package/dist/esm/throttle-ac4fcefa.js.map +1 -0
  108. package/dist/nano-components/index.esm.js +1 -1
  109. package/dist/nano-components/nano-components.esm.js +1 -1
  110. package/dist/nano-components/nano-components.esm.js.map +1 -1
  111. package/dist/nano-components/{p-7d6065c6.entry.js → p-0697795a.entry.js} +2 -2
  112. package/dist/nano-components/p-0697795a.entry.js.map +1 -0
  113. package/dist/nano-components/p-17ee0c07.entry.js +5 -0
  114. package/dist/nano-components/{p-6975f110.entry.js → p-192902e0.entry.js} +2 -2
  115. package/dist/nano-components/{p-a6ff5ca6.js → p-1a0b5bc3.js} +2 -2
  116. package/dist/nano-components/{p-3a761d77.entry.js → p-1b791810.entry.js} +2 -2
  117. package/dist/nano-components/p-3de3449e.js +5 -0
  118. package/dist/nano-components/p-3de3449e.js.map +1 -0
  119. package/dist/nano-components/{p-3b4b7f40.entry.js → p-3eb6d833.entry.js} +2 -2
  120. package/dist/nano-components/{p-a1c0afb6.entry.js → p-4884b65a.entry.js} +2 -2
  121. package/dist/nano-components/{p-34501eae.entry.js → p-565793a2.entry.js} +2 -2
  122. package/dist/nano-components/p-5aae2588.entry.js +5 -0
  123. package/dist/nano-components/p-5aae2588.entry.js.map +1 -0
  124. package/dist/nano-components/{p-935aef3d.entry.js → p-6920ad69.entry.js} +2 -2
  125. package/dist/nano-components/{p-1c6c94cb.entry.js → p-7baa9e14.entry.js} +2 -2
  126. package/dist/nano-components/p-7bff5224.js +5 -0
  127. package/dist/nano-components/p-7bff5224.js.map +1 -0
  128. package/dist/nano-components/{p-f60fe933.entry.js → p-898cbac7.entry.js} +2 -2
  129. package/dist/nano-components/{p-ace1ffc2.entry.js → p-a362bd23.entry.js} +2 -2
  130. package/dist/nano-components/{p-eb6c9191.entry.js → p-b72df1aa.entry.js} +2 -2
  131. package/dist/nano-components/{p-9c4efe14.entry.js → p-bf18e298.entry.js} +2 -2
  132. package/dist/nano-components/p-bf18e298.entry.js.map +1 -0
  133. package/dist/nano-components/p-ce5efc3f.entry.js +5 -0
  134. package/dist/nano-components/p-ce5efc3f.entry.js.map +1 -0
  135. package/dist/nano-components/{p-1b687f96.entry.js → p-d0eefd52.entry.js} +2 -2
  136. package/dist/nano-components/{p-1a9d9956.entry.js → p-d74e2642.entry.js} +2 -2
  137. package/dist/nano-components/{p-2e63676f.js → p-dfbf0d56.js} +2 -2
  138. package/dist/nano-components/{p-bd51e29f.js → p-f258383d.js} +1 -1
  139. package/dist/types/components/resize-observe/resize-observe.d.ts +2 -0
  140. package/dist/types/components/sortable/sortable.d.ts +0 -1
  141. package/dist/types/components/sticker/sticker.d.ts +2 -2
  142. package/dist/types/components/table/table-interface.d.ts +23 -11
  143. package/dist/types/components/table/table.cell.d.ts +0 -7
  144. package/dist/types/components/table/table.d.ts +10 -7
  145. package/dist/types/components/table/table.header.d.ts +0 -1
  146. package/dist/types/components/table/table.pin-service.d.ts +90 -0
  147. package/dist/types/components/table/table.row.d.ts +3 -2
  148. package/dist/types/components/table/table.utils.d.ts +0 -27
  149. package/dist/types/components.d.ts +29 -11
  150. package/dist/types/utils/events.d.ts +15 -0
  151. package/dist/types/utils/throttle.d.ts +1 -1
  152. package/docs-json.json +59 -24
  153. package/docs-vscode.json +2 -2
  154. package/hydrate/index.js +575 -190
  155. package/package.json +2 -2
  156. package/dist/cjs/nano-table-5a7a4d53.js.map +0 -1
  157. package/dist/cjs/table.worker-77e56070.js.map +0 -1
  158. package/dist/cjs/throttle-f55496c8.js.map +0 -1
  159. package/dist/esm/nano-table-026a0d30.js.map +0 -1
  160. package/dist/esm/table.worker-c17a27ed.js.map +0 -1
  161. package/dist/esm/throttle-7836544e.js.map +0 -1
  162. package/dist/nano-components/p-15217442.entry.js +0 -5
  163. package/dist/nano-components/p-15217442.entry.js.map +0 -1
  164. package/dist/nano-components/p-30cc21c2.entry.js +0 -5
  165. package/dist/nano-components/p-59eb9caa.js +0 -5
  166. package/dist/nano-components/p-59eb9caa.js.map +0 -1
  167. package/dist/nano-components/p-7759d185.entry.js +0 -5
  168. package/dist/nano-components/p-7759d185.entry.js.map +0 -1
  169. package/dist/nano-components/p-7d6065c6.entry.js.map +0 -1
  170. package/dist/nano-components/p-9746b0a5.js +0 -5
  171. package/dist/nano-components/p-9746b0a5.js.map +0 -1
  172. package/dist/nano-components/p-9c4efe14.entry.js.map +0 -1
  173. /package/dist/nano-components/{p-2e63676f.js.map → p-17ee0c07.entry.js.map} +0 -0
  174. /package/dist/nano-components/{p-6975f110.entry.js.map → p-192902e0.entry.js.map} +0 -0
  175. /package/dist/nano-components/{p-a6ff5ca6.js.map → p-1a0b5bc3.js.map} +0 -0
  176. /package/dist/nano-components/{p-3a761d77.entry.js.map → p-1b791810.entry.js.map} +0 -0
  177. /package/dist/nano-components/{p-3b4b7f40.entry.js.map → p-3eb6d833.entry.js.map} +0 -0
  178. /package/dist/nano-components/{p-a1c0afb6.entry.js.map → p-4884b65a.entry.js.map} +0 -0
  179. /package/dist/nano-components/{p-34501eae.entry.js.map → p-565793a2.entry.js.map} +0 -0
  180. /package/dist/nano-components/{p-935aef3d.entry.js.map → p-6920ad69.entry.js.map} +0 -0
  181. /package/dist/nano-components/{p-1c6c94cb.entry.js.map → p-7baa9e14.entry.js.map} +0 -0
  182. /package/dist/nano-components/{p-f60fe933.entry.js.map → p-898cbac7.entry.js.map} +0 -0
  183. /package/dist/nano-components/{p-ace1ffc2.entry.js.map → p-a362bd23.entry.js.map} +0 -0
  184. /package/dist/nano-components/{p-eb6c9191.entry.js.map → p-b72df1aa.entry.js.map} +0 -0
  185. /package/dist/nano-components/{p-1b687f96.entry.js.map → p-d0eefd52.entry.js.map} +0 -0
  186. /package/dist/nano-components/{p-1a9d9956.entry.js.map → p-d74e2642.entry.js.map} +0 -0
  187. /package/dist/nano-components/{p-30cc21c2.entry.js.map → p-dfbf0d56.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{g as t,e as i,r as e,c as s,w as n,d as r,h as a,a as h}from"./p-f6a8467a.js";import{a as o}from"./p-ed6adde2.js";import{g as l}from"./p-257432ff.js";import{C as u}from"./p-a6ff5ca6.js";import{b as f,c,a as d}from"./p-69a3e911.js";import{d as p}from"./p-9746b0a5.js";import{S as v}from"./p-60a8c896.js";var m=new Map;var g=function(t,i){var e=t.fields,s=t.updater;e.forEach((function(t){s(t,i[t])}))};var y={create:function(i,e){var s=t(i);var n=new Map;var r={wormholes:n,state:e};m.set(i,r);var a=i.connectedCallback;i.connectedCallback=function(){m.set(i,r);if(a){a.call(i)}};var h=i.disconnectedCallback;i.disconnectedCallback=function(){m.delete(i);if(h){h.call(i)}};s.addEventListener("openWormhole",(function(t){t.stopPropagation();var i=t.detail,e=i.consumer,s=i.onOpen;if(n.has(e))return;if(typeof e!=="symbol"){var a=e.connectedCallback,h=e.disconnectedCallback;e.connectedCallback=function(){n.set(e,t.detail);if(a){a.call(e)}};e.disconnectedCallback=function(){n.delete(e);if(h){h.call(e)}}}n.set(e,t.detail);g(t.detail,r.state);s===null||s===void 0?void 0:s.resolve((function(){n.delete(e)}))}));s.addEventListener("closeWormhole",(function(t){var i=t.detail;n.delete(i)}))},Provider:function(t,e){var s=t.state;var n=i();if(m.has(n)){var r=m.get(n);r.state=s;r.wormholes.forEach((function(t){g(t,s)}))}return e}};class w{constructor(){this.queue=[];this.workingOnPromise=false;this.stop=false;this.limit=null}enqueue(t){return new Promise(((i,e)=>{this.queue.push({promise:t,resolve:i,reject:e});this.dequeue()}))}dequeue(){if(this.workingOnPromise){return false}if(this.stop){this.queue=[];this.stop=false;return}const t=this.queue.shift();if(!t){return false}try{this.workingOnPromise=true;t.promise().then((i=>{this.workingOnPromise=false;t.resolve(i);this.dequeue()})).catch((i=>{this.workingOnPromise=false;t.reject(i);this.dequeue()}))}catch(i){this.workingOnPromise=false;t.reject(i);this.dequeue()}return true}}w.pendingPromise=false;var b=c((function(t,i){!function(t,e){e(i)}(d,(function(t){function i(t){var e,s,n=new Error(t);return e=n,s=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(e,s):e.__proto__=s,n}function e(t,e,s){var n=e.slice(0,s).split(/\n/),r=n.length,a=n[r-1].length+1;throw i(t+=" at line "+r+" col "+a+":\n\n "+e.split(/\n/)[r-1]+"\n "+Array(a).join(" ")+"^")}i.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var s=new Function("return this")().Promise,n=!1;try{n=new Function("return (async function(){}).constructor")()}catch(t){if(!(t instanceof SyntaxError))throw t}function r(t,i){return Object.prototype.hasOwnProperty.call(t,i)}function a(t,i,e){for(var s in i)r(i,s)&&(null==i[s]||"object"!=typeof i[s]||"storage"!==s&&"prefixes"!==s||e?t[s]=i[s]:t[s]=a({},i[s]));return t}var h=/^async +/,o=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,l=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,u=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,f=/[.*+\-?^${}()|[\]\\]/g;function c(t){return f.test(t)?t.replace(f,"\\$&"):t}function d(t,s){s.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),o.lastIndex=0,l.lastIndex=0,u.lastIndex=0;var n=s.prefixes,r=[n.h,n.b,n.i,n.r,n.c,n.e].reduce((function(t,i){return t&&i?t+"|"+c(i):i?c(i):t}),""),a=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+c(s.tags[1])+")","g"),f=new RegExp("([^]*?)"+c(s.tags[0])+"(-|_)?\\s*("+r+")?\\s*","g"),d=0,p=!1;function v(i,n){var r,c={f:[]},v=0,m="c";function g(i){var n=t.slice(d,i),r=n.trim();if("f"===m)"safe"===r?c.raw=!0:s.async&&h.test(r)?(r=r.replace(h,""),c.f.push([r,"",!0])):c.f.push([r,""]);else if("fp"===m)c.f[c.f.length-1][1]+=r;else if("err"===m){if(r){var a=n.search(/\S/);e("invalid syntax",t,d+a)}}else c[m]=r;d=i+1}for("h"===n||"b"===n||"c"===n?m="n":"r"===n&&(c.raw=!0,n="i"),a.lastIndex=d;null!==(r=a.exec(t));){var y=r[1],w=r[2],b=r[3],x=r[4],F=r[5],C=r.index;if(y)"("===y?(0===v&&("n"===m?(g(C),m="p"):"f"===m&&(g(C),m="fp")),v++):")"===y?0===--v&&"c"!==m&&(g(C),m="err"):0===v&&"|"===y?(g(C),m="f"):"=>"===y&&(g(C),d+=1,m="res");else if(w){if("/*"===w){var j=t.indexOf("*/",a.lastIndex);-1===j&&e("unclosed comment",t,r.index),a.lastIndex=j+2}else if("'"===w){l.lastIndex=r.index,l.exec(t)?a.lastIndex=l.lastIndex:e("unclosed string",t,r.index)}else if('"'===w){u.lastIndex=r.index,u.exec(t)?a.lastIndex=u.lastIndex:e("unclosed string",t,r.index)}else if("`"===w){o.lastIndex=r.index,o.exec(t)?a.lastIndex=o.lastIndex:e("unclosed string",t,r.index)}}else if(b)return g(C),d=C+r[0].length,f.lastIndex=d,p=F,x&&"h"===n&&(n="s"),c.t=n,c}return e("unclosed tag",t,i),c}var m=function r(a,o){a.b=[],a.d=[];var l,u=!1,c=[];function m(t,i){t&&(t=function(t,i,e,s){var n,r;return"string"==typeof i.autoTrim?n=r=i.autoTrim:Array.isArray(i.autoTrim)&&(n=i.autoTrim[1],r=i.autoTrim[0]),(e||!1===e)&&(n=e),(s||!1===s)&&(r=s),"slurp"===n&&"slurp"===r?t.trim():("_"===n||"slurp"===n?t=String.prototype.trimLeft?t.trimLeft():t.replace(/^[\s\uFEFF\xA0]+/,""):"-"!==n&&"nl"!==n||(t=t.replace(/^(?:\n|\r|\r\n)/,"")),"_"===r||"slurp"===r?t=String.prototype.trimRight?t.trimRight():t.replace(/[\s\uFEFF\xA0]+$/,""):"-"!==r&&"nl"!==r||(t=t.replace(/(?:\n|\r|\r\n)$/,"")),t)}(t,s,p,i))&&(t=t.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),c.push(t))}for(;null!==(l=f.exec(t));){var g,y=l[1],w=l[2],b=l[3]||"";for(var x in n)if(n[x]===b){g=x;break}m(y,w),d=l.index+l[0].length,g||e("unrecognized tag type: "+b,t,d);var F=v(l.index,g),C=F.t;if("h"===C){var j=F.n||"";s.async&&h.test(j)&&(F.a=!0,F.n=j.replace(h,"")),F=r(F),c.push(F)}else if("c"===C){if(a.n===F.n)return u?(u.d=c,a.b.push(u)):a.d=c,a;e("Helper start and end don't match",t,l.index+l[0].length)}else if("b"===C){u?(u.d=c,a.b.push(u)):a.d=c;var I=F.n||"";s.async&&h.test(I)&&(F.a=!0,F.n=I.replace(h,"")),u=F,c=[]}else if("s"===C){var S=F.n||"";s.async&&h.test(S)&&(F.a=!0,F.n=S.replace(h,"")),c.push(F)}else c.push(F)}if(!o)throw i('unclosed helper "'+a.n+'"');return m(t.slice(d,t.length),!1),a.d=c,a}({f:[]},!0);if(s.plugins)for(var g=0;g<s.plugins.length;g++){var y=s.plugins[g];y.processAST&&(m.d=y.processAST(m.d,s))}return m.d}function p(t,i){var e=d(t,i),s="var tR='';"+(i.useWith?"with("+i.varName+"||{}){":"")+w(e,i)+"if(cb){cb(null,tR)} return tR"+(i.useWith?"}":"");if(i.plugins)for(var n=0;n<i.plugins.length;n++){var r=i.plugins[n];r.processFnString&&(s=r.processFnString(s,i))}return s}function v(t,i){for(var e=0;e<i.length;e++){var s=i[e][0],n=i[e][1];t=(i[e][2]?"await ":"")+"c.l('F','"+s+"')("+t,n&&(t+=","+n),t+=")"}return t}function m(t,i,e,s,n,r){var a="{exec:"+(n?"async ":"")+y(e,i,t)+",params:["+s+"]";return r&&(a+=",name:'"+r+"'"),n&&(a+=",async:true"),a+="}"}function g(t,i){for(var e="[",s=0;s<t.length;s++){var n=t[s];e+=m(i,n.res||"",n.d,n.p||"",n.a,n.n),s<t.length&&(e+=",")}return e+="]"}function y(t,i,e){return"function("+i+"){var tR='';"+w(t,e)+"return tR}"}function w(t,i){for(var e=0,s=t.length,n="";e<s;e++){var r=t[e];if("string"==typeof r){n+="tR+='"+r+"';"}else{var a=r.t,h=r.c||"",o=r.f,l=r.n||"",u=r.p||"",f=r.res||"",c=r.b,d=!!r.a;if("i"===a){i.defaultFilter&&(h="c.l('F','"+i.defaultFilter+"')("+h+")");var p=v(h,o);!r.raw&&i.autoEscape&&(p="c.l('F','e')("+p+")"),n+="tR+="+p+";"}else if("h"===a)if(i.storage.nativeHelpers.get(l))n+=i.storage.nativeHelpers.get(l)(r,i);else{var y=(d?"await ":"")+"c.l('H','"+l+"')("+m(i,f,r.d,u,d);y+=c?","+g(c,i):",[]",n+="tR+="+v(y+=",c)",o)+";"}else"s"===a?n+="tR+="+v((d?"await ":"")+"c.l('H','"+l+"')({params:["+u+"]},[],c)",o)+";":"e"===a&&(n+=h+"\n")}}return n}var b=function(){function t(t){this.cache=t}return t.prototype.define=function(t,i){this.cache[t]=i},t.prototype.get=function(t){return this.cache[t]},t.prototype.remove=function(t){delete this.cache[t]},t.prototype.reset=function(){this.cache={}},t.prototype.load=function(t){a(this.cache,t,!0)},t}();function x(t,e,s,n){if(e&&e.length>0)throw i((n?"Native":"")+"Helper '"+t+"' doesn't accept blocks");if(s&&s.length>0)throw i((n?"Native":"")+"Helper '"+t+"' doesn't accept filters")}var F={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function C(t){return F[t]}var j=new b({}),I=new b({each:function(t,i){var e="",s=t.params[0];if(x("each",i,!1),t.async)return new Promise((function(i){!function t(i,e,s,n,r){s(i[e],e).then((function(a){n+=a,e===i.length-1?r(n):t(i,e+1,s,n,r)}))}(s,0,t.exec,e,i)}));for(var n=0;n<s.length;n++)e+=t.exec(s[n],n);return e},foreach:function(t,i){var e=t.params[0];if(x("foreach",i,!1),t.async)return new Promise((function(i){!function t(i,e,s,n,r,a){n(e[s],i[e[s]]).then((function(h){r+=h,s===e.length-1?a(r):t(i,e,s+1,n,r,a)}))}(e,Object.keys(e),0,t.exec,"",i)}));var s="";for(var n in e)r(e,n)&&(s+=t.exec(n,e[n]));return s},include:function(t,e,s){x("include",e,!1);var n=s.storage.templates.get(t.params[0]);if(!n)throw i('Could not fetch template "'+t.params[0]+'"');return n(t.params[1],s)},extends:function(t,e,s){var n=t.params[1]||{};n.content=t.exec();for(var r=0;r<e.length;r++){var a=e[r];n[a.name]=a.exec()}var h=s.storage.templates.get(t.params[0]);if(!h)throw i('Could not fetch template "'+t.params[0]+'"');return h(n,s)},useScope:function(t,i){return x("useScope",i,!1),t.exec(t.params[0])}}),S=new b({if:function(t,i){x("if",!1,t.f,!0);var e="if("+t.p+"){"+w(t.d,i)+"}";if(t.b)for(var s=0;s<t.b.length;s++){var n=t.b[s];"else"===n.n?e+="else{"+w(n.d,i)+"}":"elif"===n.n&&(e+="else if("+n.p+"){"+w(n.d,i)+"}")}return e},try:function(t,e){if(x("try",!1,t.f,!0),!t.b||1!==t.b.length||"catch"!==t.b[0].n)throw i("native helper 'try' only accepts 1 block, 'catch'");var s="try{"+w(t.d,e)+"}",n=t.b[0];return s+="catch"+(n.res?"("+n.res+")":"")+"{"+w(n.d,e)+"}"},block:function(t,i){return x("block",t.b,t.f,!0),"if(!"+i.varName+"["+t.p+"]){tR+=("+y(t.d,"",i)+")()}else{tR+="+i.varName+"["+t.p+"]}"}}),z=new b({e:function(t){var i=String(t);return/[&<>"']/.test(i)?i.replace(/[&<>"']/g,C):i}}),O={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(t,e){if("H"===t){var s=this.storage.helpers.get(e);if(s)return s;throw i("Can't find helper '"+e+"'")}if("F"===t){var n=this.storage.filters.get(e);if(n)return n;throw i("Can't find filter '"+e+"'")}},async:!1,storage:{helpers:I,nativeHelpers:S,filters:z,templates:j},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function R(t,i){var e={};return a(e,O),i&&a(e,i),t&&a(e,t),e.l.bind(e),e}function A(t,e){var s=R(e||{}),r=Function;if(s.async){if(!n)throw i("This environment doesn't support async/await");r=n}try{return new r(s.varName,"c","cb",p(t,s))}catch(e){throw e instanceof SyntaxError?i("Bad template syntax\n\n"+e.message+"\n"+Array(e.message.length+1).join("=")+"\n"+p(t,s)):e}}function k(t,i){var e;return i.cache&&i.name&&i.storage.templates.get(i.name)?i.storage.templates.get(i.name):(e="function"==typeof t?t:A(t,i),i.cache&&i.name&&i.storage.templates.define(i.name,e),e)}O.l.bind(O),t.compile=A,t.compileScope=w,t.compileScopeIntoFunction=y,t.compileToString=p,t.defaultConfig=O,t.filters=z,t.getConfig=R,t.helpers=I,t.nativeHelpers=S,t.parse=d,t.render=function(t,e,n,r){var a=R(n||{});if(!a.async)return k(t,a)(e,a);if(!r){if("function"==typeof s)return new s((function(i,s){try{i(k(t,a)(e,a))}catch(t){s(t)}}));throw i("Please provide a callback function, this env doesn't support Promises")}try{k(t,a)(e,a,r)}catch(t){return r(t)}},t.templates=j,Object.defineProperty(t,"__esModule",{value:!0})}))}));const x=f(b);const F=Object.freeze(Object.assign(Object.create(null),b,{default:x}));const C=F;C.filters.define("date_long",((t,i={year:"numeric",month:"long",day:"numeric"})=>{if(!t)return;const e=new Date(parseInt(t)*1e3);t=e.toLocaleDateString("en-GB",i);return t}));C.filters.define("date_short",((t,i="d/m/y")=>{if(!t)return;const e=new Date(parseInt(t)*1e3);t=i.replace(/(d)/,e.getDate().toString());t=t.replace(/(m)/,(e.getMonth()+1).toString());t=t.replace(/(y)/,e.getFullYear().toString());return t}));C.filters.define("public_name",(t=>{if(!t)return;t=t.split("_").map((t=>t.length<3?t.toUpperCase():t)).join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}));C.filters.define("trim_to",((t,i=100)=>{if(!t)return;if(t.length<=i)return t;return t.substr(0,i)+"..."}));C.filters.define("classname",(t=>{if(!t)return;return t.replace(/[\W]+/g,"")}));C.filters.define("abs_url",((t,i=null,e)=>{if(!i)return t;if(!t)return;let s=undefined;if(i.domains&&e&&e.origin){const t=i.domains.find((t=>t.origin===e.origin));s=t?t.domain:""}else if(i.domain)s=i.domain;if(!s)return t;return t.match(/^http/)?t:location.protocol+"//"+s+t}));C.filters.define("replace",((t,i,e)=>t.replace(i,e)));C.filters.define("remove_spaces",(t=>t.replace(/ /g,"_")));C.filters.define("add_spaces",(t=>t=t.replace(/[_\-]/g," ")));C.filters.define("capitalise",(t=>t=t.charAt(0).toUpperCase()+t.slice(1)));C.filters.define("lowercase",(t=>t=t.toLowerCase()));const j=C;const I=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{position:relative;display:block}:host ::slotted([slot=search-template]){display:none !important}.loader{opacity:0;position:fixed;block-size:100%;inline-size:100%;min-block-size:100%;max-block-size:100vh !important;max-inline-size:100vw !important;inset-inline-start:0;inset-block-start:0;z-index:-10;font-size:60px;display:flex;align-items:center;justify-content:center;transition:opacity 0.2s ease, z-index 0.01s ease 0.2s}.loader.loading{opacity:1;z-index:10;transition:z-index 0.01s ease, opacity 0.2s ease 0.01s}.default{block-size:100%}.default:focus{outline:none}.results{opacity:0;outline:none;overflow:auto;transition:transform 0.3s ease, opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s;transform:translate(0, 100px);visibility:hidden;z-index:-1;position:absolute;inset-block-start:0;inset-inline-start:0;display:none}.results-container{position:relative}.results.show{transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.3s ease 0.01s, opacity 0.3s ease 0.01s, overflow 0.01s ease 0.31s;transform:translate(0, 0);visibility:visible;opacity:1;z-index:10;overflow:hidden}.results.shown{block-size:auto !important;inline-size:auto !important;display:block;position:static;transform:none;z-index:auto;visibility:inherit;opacity:initial;overflow:visible}";const S=class{constructor(t){e(this,t);this.nanoDidLoad=s(this,"nanoDidLoad",7);this.nanoResultsShown=s(this,"nanoResultsShown",3);this.nanoBeforeQuery=s(this,"nanoBeforeQuery",7);this.nanoAfterQuery=s(this,"nanoAfterQuery",7);this.nanoNewResults=s(this,"nanoNewResults",7);this.staticFacetFilters={};this.dynFacetFilters={};this.hasLoadSlot=false;this.placedAlgoliaEles=[];this.promiseQueue=new w;this.searchChange=async()=>{if(!this.algoliaIndex)return;if(!this.query||this.query.length<this.minChars){if(!this.browseIndex){if(!this.query||this.query.length===0){this.handleSearchReset();return}else return}else if(this.query!=="*"){this.query="*";return}}this.isLoading=true;setTimeout((async()=>{this.resetPage();await this.algoliaSearch(v.Init);await this.updateContent();setTimeout((t=>this.isLoading=false),800);this.showResults=true;this.nanoResultsShown.emit(this.indexResults)}),200)};this.makeAppliedFilters=()=>{const t=[];const i=i=>{Object.values(i).forEach((i=>{if(i.value&&i.value.length){const e=t.find((t=>t.name===i.facetName));if(!e)t.push({name:i.facetName,values:[...i.value]});else e.values=[...e.values,...i.value]}}))};i(this.dynFacetFilters);i(this.staticFacetFilters);if(t.length)return t;return null};this.algoliaSearch=async t=>this.promiseQueue.enqueue((()=>this.queueSearch(t)));this.queueSearch=async t=>{if(!this.algoliaIndex||!this.query||!this.searchIndex||!this.searchIndex.index)return;this.nanoBeforeQuery.emit(this.indexResults);if(v.Init===t)this.clearAllFacetFilters();const i={filters:this.algoliaFilterStr(),page:this.indexResults?this.indexResults.currentPage:0};if(this.searchIndex.filters)i.facets=this.searchIndex.filters;if(this.searchIndex.hitsPerPage)i.hitsPerPage=this.searchIndex.hitsPerPage;let e=await this.algoliaIndex.search(this.query,i);e=this.fixDomain(e);this.changeEvent=t;if(t===v.Init||!this.indexResults){this.indexResults={currentPage:0,totalHits:e.nbHits,hitsPerPage:null,origFilters:e.facets,query:this.query,domain:this.searchIndex.domain||null,totalHitsWithFilters:0,results:[],totalPages:0,appliedFilters:this.makeAppliedFilters(),indexName:this.searchIndex.name||null,index:this.searchIndex.index}}this.indexResults.dynFilters=e.facets;this.indexResults.results=e.hits;this.indexResults.totalHitsWithFilters=e.nbHits;this.indexResults.currentPage=e.page;this.indexResults.totalPages=e.nbPages;this.indexResults.hitsPerPage=e.hitsPerPage;this.indexResults.query=e.query;if(this.changeEvent!==v.Page&&this.changeEvent!==v.Replica){this.facets=e.facets}this.nanoAfterQuery.emit(this.indexResults);return new Promise((t=>{setTimeout((()=>t("tpl updated")),20)})).then((t=>{this.currentHits=this.indexResults.results;this.resultsPage=this.indexResults.currentPage}))};this.handleSearchReset=()=>{this.showResults=false;this.indexResults=null};this.onResultDisplay=()=>{n((()=>{this.resultsDiv.removeEventListener("transitionend",this.onResultDisplay);if(!this.showResults)this.resultsDiv.style.display="none";else{this.defaultDiv.style.display="none";this.resultsDiv.classList.add("shown");this.resultsDiv.style.minHeight="";this.resultsDiv.style.width=""}}))};this._dynFacetFilters={};this.inputField=undefined;this.algoliaIndex=undefined;this.indeces=[];this.resultsEmitterEle=undefined;this.indexResults=undefined;this.filterChanged="";this.currentHits=undefined;this.changeEvent=v.Init;this.isLoading=false;this.wormholeState=this;this.showResults=false;this.resultsPage=0;this.appId=undefined;this.apiKey=undefined;this.searchIndex={};this.searchIndexName="";this.listenTo=null;this.query="";this.operator="and";this.filters=[];this.tplEngine=j;this.tplRenderFn=j.render;this.replicaIndex="";this.browseIndex=false;this.minChars=2;this.storeId=undefined;this.storeMethod="session"}async removeFilters(t,i){if(!t&&!i)this.clearAllFacetFilters();else{Object.keys(this._dynFacetFilters).forEach((e=>{if(t&&this._dynFacetFilters[e].facetName===t){if(!i)this._dynFacetFilters[e].element.value="";else{this._dynFacetFilters[e].element.value=this._dynFacetFilters[e].value.filter((t=>t!==i))}}}))}}onAllTplUpdate(t){t.stopPropagation();if(t.target.tagName==="NANO-ALGOLIA-RESULTS"){requestAnimationFrame((()=>{this.nanoNewResults.emit(this.indexResults)}))}}async onPageChange(t){if(!this.indexResults)return;let i=this.resultsPage;if(t){t.stopPropagation();i=t.detail.page}i=Math.min(this.indexResults.totalPages-1,i);i=Math.max(i,0);if(this.indexResults.currentPage===i)return;this.indexResults.currentPage=i;await this.algoliaSearch(v.Page)}async onFilterChange(t){t.stopPropagation();const i={};const e=t.detail;e.element=t.target;if(this.indexResults){if(this.staticFacetFilters[e.filterId])this.staticFacetFilters[e.filterId]=e;else{i[e.filterId]=e;this._dynFacetFilters=Object.assign(Object.assign({},this._dynFacetFilters),i)}this.indexResults.appliedFilters=this.makeAppliedFilters()}else this.staticFacetFilters[e.filterId]=e;this.filterChanged=e.value&&e.value.length?e.filterId:"all";this.resetPage();this.algoliaSearch(v.Filter)}dynFacetFiltersChange(){Object.values(this._dynFacetFilters).forEach((t=>{if(this.host.ownerDocument===t.element.ownerDocument)this.dynFacetFilters[t.filterId]=t;else delete this.dynFacetFilters[t.filterId]}))}browseIndexChange(){if(this.browseIndex&&(!this.query||this.query.length<this.minChars)){this.query="*"}}inputFieldSet(){if(!this.inputField)return;if(this.query!=="*"&&this.inputField&&this.inputField.value!==this.query)this.inputField.value=this.query}queryChange(){this.searchChange()}async internalIndexSwitch(){if(!this.replicaIndex||!this.indexResults||this.indexResults.index===this.replicaIndex)return;this.indexResults.index=this.replicaIndex;this.algoliaIndex=this.algoliaClient.initIndex(this.indexResults.index);this.resetPage();this.algoliaSearch(v.Replica)}pageChange(){this.onPageChange()}searchIndexNameChange(){if(!this.searchIndexName||!this.searchIndexName.length||this.searchIndex&&this.searchIndex.index===this.searchIndexName)return;this.searchIndex={index:this.searchIndexName}}initAlgoliaClient(){if(!this.appId||!this.apiKey)return;this.algoliaClient=o(this.appId,this.apiKey)}initAlgoliaIndex(){if(!this.algoliaClient||!this.searchIndex)return;if(this.searchIndex.index){if(this.replicaIndex)this.searchIndex.index=this.replicaIndex;this.searchIndexName=this.searchIndex.index;this.algoliaIndex=this.algoliaClient.initIndex(this.searchIndex.index);this.searchChange()}}showResultsChange(){if(!this.resultsDiv||!this.defaultDiv)return;if(this.showResults){this.resultsDiv.style.width=this.host.scrollWidth+"px";this.resultsDiv.style.minHeight=this.host.scrollHeight+"px";n((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.style.display="block";setTimeout((()=>this.resultsDiv.classList.add("show")),50)}))}else{n((()=>{this.resultsDiv.classList.remove("shown");this.defaultDiv.style.display="block";setTimeout((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.classList.remove("show");if(!!this.slottedInput)this.slottedInput.focus({preventScroll:true});else this.defaultDiv.focus({preventScroll:true})}),50)}))}}handleFilterpropChange(){this.algoliaSearch(v.Init)}fixDomain(t){if(!this.searchIndex||!this.searchIndex.domain)return t;t.hits.map((t=>{if(t.url&&!t.url.match(/^http/))t.url=location.protocol+"//"+this.searchIndex.domain+t.url}));return t}resetPage(){if(!this.indexResults)return;this.indexResults.currentPage=0}clearAllFacetFilters(){Object.values(this._dynFacetFilters).forEach((t=>{t.element.value=""}));this._dynFacetFilters={}}algoliaFilterStr(){const t={};const i=i=>{let e;let s;Object.keys(i).forEach((n=>{e=i[n];t[n]=t[n]||{name:e.facetName,or:[],and:[],not:[]};s=t[n][e.operator];if(e.value&&e.value.length){t[n][e.operator]=[...s,...e.value]}}))};i(this.dynFacetFilters);i(this.staticFacetFilters);const e=(t,i)=>{if(i.indexOf(" ")>-1)return t+':"'+i+'"';else return t+":"+i};let s=[];let n;let r;Object.values(t).forEach((function(t){Object.keys(t).filter((t=>t.match(/(or|and|not)/))).forEach((i=>{n=t;r=t.name;if(i==="or"||i==="and"){if(n[i].length){s.push("( "+n[i].map((t=>{if(t.length)return e(r,t)})).join(" "+i.toLocaleUpperCase()+" ")+" )")}}else{if(n.not.length){s.push("( "+n[i].map((t=>{if(t.length)return"NOT "+e(r,t)})).join(" AND ")+" )")}}}))}));s=[...this.filters,...s];return s.join(" "+this.operator.toLocaleUpperCase()+" ")}handleInputChange(t){if(t.target!==this.inputField)return;this.query=this.inputField.value}async updateContent(){return this.promiseQueue.enqueue((()=>this.updateContentQueue()))}async updateContentQueue(){const t=this.outputSlot||this.resultsDiv;if(!t||!this.tpl)return"no tpl";const i=document.createElement("div");i.innerHTML=this.tpl;const e=[];this.placedAlgoliaEles=[];Array.from(i.querySelectorAll("nano-algolia, nano-algolia-filter, nano-algolia-results")).forEach(((t,i)=>{const s=document.createElement("div");s.dataset.placeholderId=i.toString();s.classList.add("nano-ele-placeholder");e.push(t);t.parentNode.replaceChild(s,t)}));t.innerHTML=this.tplRenderFn(i.innerHTML.replace(/&gt;/gm,">").replace(/&lt;/gm,"<").replace(/&amp;/gm,"&"),this.indexResults);Array.from(t.querySelectorAll("div.nano-ele-placeholder")).forEach((t=>{t.parentNode.replaceChild(e[parseInt(t.dataset.placeholderId)],t);this.placedAlgoliaEles.push(e[parseInt(t.dataset.placeholderId)])}));if(!this.placedAlgoliaEles.length)return Promise.resolve("algolia setup");return new Promise((i=>{const e=s=>{this.placedAlgoliaEles=this.placedAlgoliaEles.filter((t=>t!==s.detail));if(!this.placedAlgoliaEles.length){setTimeout((()=>i("tpl updated")),500);t.removeEventListener("nanoTplUpdated",e)}};t.addEventListener("nanoTplUpdated",e)}))}componentWillLoad(){r((t=>{this.tplSlot=l(this.host,'[slot="template"]')[0];this.outputSlot=l(this.host,'[slot="output"]')[0];this.slottedInput=l(this.host,'[slot="search-input"]')[0];this.hasLoadSlot=!!l(this.host,'[slot="loader"]')[0];if(!!this.tplSlot)this.tpl=this.tplSlot.innerHTML||this.tplSlot.innerText;if(this.slottedInput&&(this.slottedInput.tagName.toLocaleLowerCase()==="nano-input"||this.slottedInput instanceof HTMLInputElement)){this.inputField=this.slottedInput}else if(this.slottedInput){this.inputField=this.slottedInput.querySelector('nano-input, input:not([type="radio"]):not([type="checkbox"])')}n((t=>{if(this.showResults&&this.tpl)this.searchChange()}))}));this.searchIndexNameChange();this.initAlgoliaClient();this.initAlgoliaIndex();y.create(this,this.wormholeState);if(this.storeId){u.init(this,["query","replicaIndex"],this.storeMethod,this.storeId);u.init(this,["apiKey","appId","searchIndex"],"session",this.storeId+"_api")}this.internalIndexSwitch()}connectedCallback(){this.searchChange=p(this.searchChange,300);this.browseIndexChange();this.host.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.host}))}render(){const t={indexResults:this.indexResults,results:this.currentHits,filterChanged:this.filterChanged,tplRenderFn:this.tplRenderFn,resultsPage:this.resultsPage,changeEvent:this.changeEvent,facets:this.facets,algoliaIndex:this.algoliaIndex,searchIndex:this.searchIndex,globalStoreMethod:this.storeMethod,isLoading:this.isLoading};return a(h,{class:{"show-results":this.showResults,"is-loading":this.isLoading},"aria-busy":this.isLoading},this.hasLoadSlot&&a("div",{hidden:!this.isLoading},a("slot",{name:"loader"})),!this.hasLoadSlot&&a("div",{class:{loader:true,loading:this.isLoading}},a("nano-spinner",{overlay:true,type:"circle"})),a(y.Provider,{state:t},a("slot",{name:"search-input"}),a("div",{class:"results-container","aria-live":"polite"},a("div",{ref:t=>this.resultsDiv=t,class:"results"},a("slot",{name:"output"})))),a("div",{ref:t=>this.defaultDiv=t,class:"default",tabindex:"-1"},a("slot",null)))}get host(){return t(this)}static get watchers(){return{_dynFacetFilters:["dynFacetFiltersChange"],browseIndex:["browseIndexChange"],inputField:["inputFieldSet"],query:["queryChange"],replicaIndex:["internalIndexSwitch"],resultsPage:["pageChange"],searchIndexName:["searchIndexNameChange"],apiKey:["initAlgoliaClient"],appId:["initAlgoliaClient"],searchIndex:["initAlgoliaIndex"],showResults:["showResultsChange"],filters:["handleFilterpropChange"]}}};S.style=I;export{S as nano_algolia};
5
- //# sourceMappingURL=p-a1c0afb6.entry.js.map
4
+ import{g as t,e as i,r as e,c as s,w as n,d as r,h as a,a as h}from"./p-f6a8467a.js";import{a as o}from"./p-ed6adde2.js";import{g as l}from"./p-257432ff.js";import{C as u}from"./p-1a0b5bc3.js";import{b as f,c,a as d}from"./p-69a3e911.js";import{d as p}from"./p-7bff5224.js";import{S as v}from"./p-60a8c896.js";var m=new Map;var g=function(t,i){var e=t.fields,s=t.updater;e.forEach((function(t){s(t,i[t])}))};var y={create:function(i,e){var s=t(i);var n=new Map;var r={wormholes:n,state:e};m.set(i,r);var a=i.connectedCallback;i.connectedCallback=function(){m.set(i,r);if(a){a.call(i)}};var h=i.disconnectedCallback;i.disconnectedCallback=function(){m.delete(i);if(h){h.call(i)}};s.addEventListener("openWormhole",(function(t){t.stopPropagation();var i=t.detail,e=i.consumer,s=i.onOpen;if(n.has(e))return;if(typeof e!=="symbol"){var a=e.connectedCallback,h=e.disconnectedCallback;e.connectedCallback=function(){n.set(e,t.detail);if(a){a.call(e)}};e.disconnectedCallback=function(){n.delete(e);if(h){h.call(e)}}}n.set(e,t.detail);g(t.detail,r.state);s===null||s===void 0?void 0:s.resolve((function(){n.delete(e)}))}));s.addEventListener("closeWormhole",(function(t){var i=t.detail;n.delete(i)}))},Provider:function(t,e){var s=t.state;var n=i();if(m.has(n)){var r=m.get(n);r.state=s;r.wormholes.forEach((function(t){g(t,s)}))}return e}};class b{constructor(){this.queue=[];this.workingOnPromise=false;this.stop=false;this.limit=null}enqueue(t){return new Promise(((i,e)=>{this.queue.push({promise:t,resolve:i,reject:e});this.dequeue()}))}dequeue(){if(this.workingOnPromise){return false}if(this.stop){this.queue=[];this.stop=false;return}const t=this.queue.shift();if(!t){return false}try{this.workingOnPromise=true;t.promise().then((i=>{this.workingOnPromise=false;t.resolve(i);this.dequeue()})).catch((i=>{this.workingOnPromise=false;t.reject(i);this.dequeue()}))}catch(i){this.workingOnPromise=false;t.reject(i);this.dequeue()}return true}}b.pendingPromise=false;var w=c((function(t,i){!function(t,e){e(i)}(d,(function(t){function i(t){var e,s,n=new Error(t);return e=n,s=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(e,s):e.__proto__=s,n}function e(t,e,s){var n=e.slice(0,s).split(/\n/),r=n.length,a=n[r-1].length+1;throw i(t+=" at line "+r+" col "+a+":\n\n "+e.split(/\n/)[r-1]+"\n "+Array(a).join(" ")+"^")}i.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var s=new Function("return this")().Promise,n=!1;try{n=new Function("return (async function(){}).constructor")()}catch(t){if(!(t instanceof SyntaxError))throw t}function r(t,i){return Object.prototype.hasOwnProperty.call(t,i)}function a(t,i,e){for(var s in i)r(i,s)&&(null==i[s]||"object"!=typeof i[s]||"storage"!==s&&"prefixes"!==s||e?t[s]=i[s]:t[s]=a({},i[s]));return t}var h=/^async +/,o=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,l=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,u=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,f=/[.*+\-?^${}()|[\]\\]/g;function c(t){return f.test(t)?t.replace(f,"\\$&"):t}function d(t,s){s.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),o.lastIndex=0,l.lastIndex=0,u.lastIndex=0;var n=s.prefixes,r=[n.h,n.b,n.i,n.r,n.c,n.e].reduce((function(t,i){return t&&i?t+"|"+c(i):i?c(i):t}),""),a=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+c(s.tags[1])+")","g"),f=new RegExp("([^]*?)"+c(s.tags[0])+"(-|_)?\\s*("+r+")?\\s*","g"),d=0,p=!1;function v(i,n){var r,c={f:[]},v=0,m="c";function g(i){var n=t.slice(d,i),r=n.trim();if("f"===m)"safe"===r?c.raw=!0:s.async&&h.test(r)?(r=r.replace(h,""),c.f.push([r,"",!0])):c.f.push([r,""]);else if("fp"===m)c.f[c.f.length-1][1]+=r;else if("err"===m){if(r){var a=n.search(/\S/);e("invalid syntax",t,d+a)}}else c[m]=r;d=i+1}for("h"===n||"b"===n||"c"===n?m="n":"r"===n&&(c.raw=!0,n="i"),a.lastIndex=d;null!==(r=a.exec(t));){var y=r[1],b=r[2],w=r[3],x=r[4],F=r[5],C=r.index;if(y)"("===y?(0===v&&("n"===m?(g(C),m="p"):"f"===m&&(g(C),m="fp")),v++):")"===y?0===--v&&"c"!==m&&(g(C),m="err"):0===v&&"|"===y?(g(C),m="f"):"=>"===y&&(g(C),d+=1,m="res");else if(b){if("/*"===b){var j=t.indexOf("*/",a.lastIndex);-1===j&&e("unclosed comment",t,r.index),a.lastIndex=j+2}else if("'"===b){l.lastIndex=r.index,l.exec(t)?a.lastIndex=l.lastIndex:e("unclosed string",t,r.index)}else if('"'===b){u.lastIndex=r.index,u.exec(t)?a.lastIndex=u.lastIndex:e("unclosed string",t,r.index)}else if("`"===b){o.lastIndex=r.index,o.exec(t)?a.lastIndex=o.lastIndex:e("unclosed string",t,r.index)}}else if(w)return g(C),d=C+r[0].length,f.lastIndex=d,p=F,x&&"h"===n&&(n="s"),c.t=n,c}return e("unclosed tag",t,i),c}var m=function r(a,o){a.b=[],a.d=[];var l,u=!1,c=[];function m(t,i){t&&(t=function(t,i,e,s){var n,r;return"string"==typeof i.autoTrim?n=r=i.autoTrim:Array.isArray(i.autoTrim)&&(n=i.autoTrim[1],r=i.autoTrim[0]),(e||!1===e)&&(n=e),(s||!1===s)&&(r=s),"slurp"===n&&"slurp"===r?t.trim():("_"===n||"slurp"===n?t=String.prototype.trimLeft?t.trimLeft():t.replace(/^[\s\uFEFF\xA0]+/,""):"-"!==n&&"nl"!==n||(t=t.replace(/^(?:\n|\r|\r\n)/,"")),"_"===r||"slurp"===r?t=String.prototype.trimRight?t.trimRight():t.replace(/[\s\uFEFF\xA0]+$/,""):"-"!==r&&"nl"!==r||(t=t.replace(/(?:\n|\r|\r\n)$/,"")),t)}(t,s,p,i))&&(t=t.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),c.push(t))}for(;null!==(l=f.exec(t));){var g,y=l[1],b=l[2],w=l[3]||"";for(var x in n)if(n[x]===w){g=x;break}m(y,b),d=l.index+l[0].length,g||e("unrecognized tag type: "+w,t,d);var F=v(l.index,g),C=F.t;if("h"===C){var j=F.n||"";s.async&&h.test(j)&&(F.a=!0,F.n=j.replace(h,"")),F=r(F),c.push(F)}else if("c"===C){if(a.n===F.n)return u?(u.d=c,a.b.push(u)):a.d=c,a;e("Helper start and end don't match",t,l.index+l[0].length)}else if("b"===C){u?(u.d=c,a.b.push(u)):a.d=c;var I=F.n||"";s.async&&h.test(I)&&(F.a=!0,F.n=I.replace(h,"")),u=F,c=[]}else if("s"===C){var S=F.n||"";s.async&&h.test(S)&&(F.a=!0,F.n=S.replace(h,"")),c.push(F)}else c.push(F)}if(!o)throw i('unclosed helper "'+a.n+'"');return m(t.slice(d,t.length),!1),a.d=c,a}({f:[]},!0);if(s.plugins)for(var g=0;g<s.plugins.length;g++){var y=s.plugins[g];y.processAST&&(m.d=y.processAST(m.d,s))}return m.d}function p(t,i){var e=d(t,i),s="var tR='';"+(i.useWith?"with("+i.varName+"||{}){":"")+b(e,i)+"if(cb){cb(null,tR)} return tR"+(i.useWith?"}":"");if(i.plugins)for(var n=0;n<i.plugins.length;n++){var r=i.plugins[n];r.processFnString&&(s=r.processFnString(s,i))}return s}function v(t,i){for(var e=0;e<i.length;e++){var s=i[e][0],n=i[e][1];t=(i[e][2]?"await ":"")+"c.l('F','"+s+"')("+t,n&&(t+=","+n),t+=")"}return t}function m(t,i,e,s,n,r){var a="{exec:"+(n?"async ":"")+y(e,i,t)+",params:["+s+"]";return r&&(a+=",name:'"+r+"'"),n&&(a+=",async:true"),a+="}"}function g(t,i){for(var e="[",s=0;s<t.length;s++){var n=t[s];e+=m(i,n.res||"",n.d,n.p||"",n.a,n.n),s<t.length&&(e+=",")}return e+="]"}function y(t,i,e){return"function("+i+"){var tR='';"+b(t,e)+"return tR}"}function b(t,i){for(var e=0,s=t.length,n="";e<s;e++){var r=t[e];if("string"==typeof r){n+="tR+='"+r+"';"}else{var a=r.t,h=r.c||"",o=r.f,l=r.n||"",u=r.p||"",f=r.res||"",c=r.b,d=!!r.a;if("i"===a){i.defaultFilter&&(h="c.l('F','"+i.defaultFilter+"')("+h+")");var p=v(h,o);!r.raw&&i.autoEscape&&(p="c.l('F','e')("+p+")"),n+="tR+="+p+";"}else if("h"===a)if(i.storage.nativeHelpers.get(l))n+=i.storage.nativeHelpers.get(l)(r,i);else{var y=(d?"await ":"")+"c.l('H','"+l+"')("+m(i,f,r.d,u,d);y+=c?","+g(c,i):",[]",n+="tR+="+v(y+=",c)",o)+";"}else"s"===a?n+="tR+="+v((d?"await ":"")+"c.l('H','"+l+"')({params:["+u+"]},[],c)",o)+";":"e"===a&&(n+=h+"\n")}}return n}var w=function(){function t(t){this.cache=t}return t.prototype.define=function(t,i){this.cache[t]=i},t.prototype.get=function(t){return this.cache[t]},t.prototype.remove=function(t){delete this.cache[t]},t.prototype.reset=function(){this.cache={}},t.prototype.load=function(t){a(this.cache,t,!0)},t}();function x(t,e,s,n){if(e&&e.length>0)throw i((n?"Native":"")+"Helper '"+t+"' doesn't accept blocks");if(s&&s.length>0)throw i((n?"Native":"")+"Helper '"+t+"' doesn't accept filters")}var F={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function C(t){return F[t]}var j=new w({}),I=new w({each:function(t,i){var e="",s=t.params[0];if(x("each",i,!1),t.async)return new Promise((function(i){!function t(i,e,s,n,r){s(i[e],e).then((function(a){n+=a,e===i.length-1?r(n):t(i,e+1,s,n,r)}))}(s,0,t.exec,e,i)}));for(var n=0;n<s.length;n++)e+=t.exec(s[n],n);return e},foreach:function(t,i){var e=t.params[0];if(x("foreach",i,!1),t.async)return new Promise((function(i){!function t(i,e,s,n,r,a){n(e[s],i[e[s]]).then((function(h){r+=h,s===e.length-1?a(r):t(i,e,s+1,n,r,a)}))}(e,Object.keys(e),0,t.exec,"",i)}));var s="";for(var n in e)r(e,n)&&(s+=t.exec(n,e[n]));return s},include:function(t,e,s){x("include",e,!1);var n=s.storage.templates.get(t.params[0]);if(!n)throw i('Could not fetch template "'+t.params[0]+'"');return n(t.params[1],s)},extends:function(t,e,s){var n=t.params[1]||{};n.content=t.exec();for(var r=0;r<e.length;r++){var a=e[r];n[a.name]=a.exec()}var h=s.storage.templates.get(t.params[0]);if(!h)throw i('Could not fetch template "'+t.params[0]+'"');return h(n,s)},useScope:function(t,i){return x("useScope",i,!1),t.exec(t.params[0])}}),S=new w({if:function(t,i){x("if",!1,t.f,!0);var e="if("+t.p+"){"+b(t.d,i)+"}";if(t.b)for(var s=0;s<t.b.length;s++){var n=t.b[s];"else"===n.n?e+="else{"+b(n.d,i)+"}":"elif"===n.n&&(e+="else if("+n.p+"){"+b(n.d,i)+"}")}return e},try:function(t,e){if(x("try",!1,t.f,!0),!t.b||1!==t.b.length||"catch"!==t.b[0].n)throw i("native helper 'try' only accepts 1 block, 'catch'");var s="try{"+b(t.d,e)+"}",n=t.b[0];return s+="catch"+(n.res?"("+n.res+")":"")+"{"+b(n.d,e)+"}"},block:function(t,i){return x("block",t.b,t.f,!0),"if(!"+i.varName+"["+t.p+"]){tR+=("+y(t.d,"",i)+")()}else{tR+="+i.varName+"["+t.p+"]}"}}),z=new w({e:function(t){var i=String(t);return/[&<>"']/.test(i)?i.replace(/[&<>"']/g,C):i}}),O={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(t,e){if("H"===t){var s=this.storage.helpers.get(e);if(s)return s;throw i("Can't find helper '"+e+"'")}if("F"===t){var n=this.storage.filters.get(e);if(n)return n;throw i("Can't find filter '"+e+"'")}},async:!1,storage:{helpers:I,nativeHelpers:S,filters:z,templates:j},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function R(t,i){var e={};return a(e,O),i&&a(e,i),t&&a(e,t),e.l.bind(e),e}function A(t,e){var s=R(e||{}),r=Function;if(s.async){if(!n)throw i("This environment doesn't support async/await");r=n}try{return new r(s.varName,"c","cb",p(t,s))}catch(e){throw e instanceof SyntaxError?i("Bad template syntax\n\n"+e.message+"\n"+Array(e.message.length+1).join("=")+"\n"+p(t,s)):e}}function k(t,i){var e;return i.cache&&i.name&&i.storage.templates.get(i.name)?i.storage.templates.get(i.name):(e="function"==typeof t?t:A(t,i),i.cache&&i.name&&i.storage.templates.define(i.name,e),e)}O.l.bind(O),t.compile=A,t.compileScope=b,t.compileScopeIntoFunction=y,t.compileToString=p,t.defaultConfig=O,t.filters=z,t.getConfig=R,t.helpers=I,t.nativeHelpers=S,t.parse=d,t.render=function(t,e,n,r){var a=R(n||{});if(!a.async)return k(t,a)(e,a);if(!r){if("function"==typeof s)return new s((function(i,s){try{i(k(t,a)(e,a))}catch(t){s(t)}}));throw i("Please provide a callback function, this env doesn't support Promises")}try{k(t,a)(e,a,r)}catch(t){return r(t)}},t.templates=j,Object.defineProperty(t,"__esModule",{value:!0})}))}));const x=f(w);const F=Object.freeze(Object.assign(Object.create(null),w,{default:x}));const C=F;C.filters.define("date_long",((t,i={year:"numeric",month:"long",day:"numeric"})=>{if(!t)return;const e=new Date(parseInt(t)*1e3);t=e.toLocaleDateString("en-GB",i);return t}));C.filters.define("date_short",((t,i="d/m/y")=>{if(!t)return;const e=new Date(parseInt(t)*1e3);t=i.replace(/(d)/,e.getDate().toString());t=t.replace(/(m)/,(e.getMonth()+1).toString());t=t.replace(/(y)/,e.getFullYear().toString());return t}));C.filters.define("public_name",(t=>{if(!t)return;t=t.split("_").map((t=>t.length<3?t.toUpperCase():t)).join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}));C.filters.define("trim_to",((t,i=100)=>{if(!t)return;if(t.length<=i)return t;return t.substr(0,i)+"..."}));C.filters.define("classname",(t=>{if(!t)return;return t.replace(/[\W]+/g,"")}));C.filters.define("abs_url",((t,i=null,e)=>{if(!i)return t;if(!t)return;let s=undefined;if(i.domains&&e&&e.origin){const t=i.domains.find((t=>t.origin===e.origin));s=t?t.domain:""}else if(i.domain)s=i.domain;if(!s)return t;return t.match(/^http/)?t:location.protocol+"//"+s+t}));C.filters.define("replace",((t,i,e)=>t.replace(i,e)));C.filters.define("remove_spaces",(t=>t.replace(/ /g,"_")));C.filters.define("add_spaces",(t=>t=t.replace(/[_\-]/g," ")));C.filters.define("capitalise",(t=>t=t.charAt(0).toUpperCase()+t.slice(1)));C.filters.define("lowercase",(t=>t=t.toLowerCase()));const j=C;const I=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{position:relative;display:block}:host ::slotted([slot=search-template]){display:none !important}.loader{opacity:0;position:fixed;block-size:100%;inline-size:100%;min-block-size:100%;max-block-size:100vh !important;max-inline-size:100vw !important;inset-inline-start:0;inset-block-start:0;z-index:-10;font-size:60px;display:flex;align-items:center;justify-content:center;transition:opacity 0.2s ease, z-index 0.01s ease 0.2s}.loader.loading{opacity:1;z-index:10;transition:z-index 0.01s ease, opacity 0.2s ease 0.01s}.default{block-size:100%}.default:focus{outline:none}.results{opacity:0;outline:none;overflow:auto;transition:transform 0.3s ease, opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s;transform:translate(0, 100px);visibility:hidden;z-index:-1;position:absolute;inset-block-start:0;inset-inline-start:0;display:none}.results-container{position:relative}.results.show{transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.3s ease 0.01s, opacity 0.3s ease 0.01s, overflow 0.01s ease 0.31s;transform:translate(0, 0);visibility:visible;opacity:1;z-index:10;overflow:hidden}.results.shown{block-size:auto !important;inline-size:auto !important;display:block;position:static;transform:none;z-index:auto;visibility:inherit;opacity:initial;overflow:visible}";const S=class{constructor(t){e(this,t);this.nanoDidLoad=s(this,"nanoDidLoad",7);this.nanoResultsShown=s(this,"nanoResultsShown",3);this.nanoBeforeQuery=s(this,"nanoBeforeQuery",7);this.nanoAfterQuery=s(this,"nanoAfterQuery",7);this.nanoNewResults=s(this,"nanoNewResults",7);this.staticFacetFilters={};this.dynFacetFilters={};this.hasLoadSlot=false;this.placedAlgoliaEles=[];this.promiseQueue=new b;this.searchChange=async()=>{if(!this.algoliaIndex)return;if(!this.query||this.query.length<this.minChars){if(!this.browseIndex){if(!this.query||this.query.length===0){this.handleSearchReset();return}else return}else if(this.query!=="*"){this.query="*";return}}this.isLoading=true;setTimeout((async()=>{this.resetPage();await this.algoliaSearch(v.Init);await this.updateContent();setTimeout((t=>this.isLoading=false),800);this.showResults=true;this.nanoResultsShown.emit(this.indexResults)}),200)};this.makeAppliedFilters=()=>{const t=[];const i=i=>{Object.values(i).forEach((i=>{if(i.value&&i.value.length){const e=t.find((t=>t.name===i.facetName));if(!e)t.push({name:i.facetName,values:[...i.value]});else e.values=[...e.values,...i.value]}}))};i(this.dynFacetFilters);i(this.staticFacetFilters);if(t.length)return t;return null};this.algoliaSearch=async t=>this.promiseQueue.enqueue((()=>this.queueSearch(t)));this.queueSearch=async t=>{if(!this.algoliaIndex||!this.query||!this.searchIndex||!this.searchIndex.index)return;this.nanoBeforeQuery.emit(this.indexResults);if(v.Init===t)this.clearAllFacetFilters();const i={filters:this.algoliaFilterStr(),page:this.indexResults?this.indexResults.currentPage:0};if(this.searchIndex.filters)i.facets=this.searchIndex.filters;if(this.searchIndex.hitsPerPage)i.hitsPerPage=this.searchIndex.hitsPerPage;let e=await this.algoliaIndex.search(this.query,i);e=this.fixDomain(e);this.changeEvent=t;if(t===v.Init||!this.indexResults){this.indexResults={currentPage:0,totalHits:e.nbHits,hitsPerPage:null,origFilters:e.facets,query:this.query,domain:this.searchIndex.domain||null,totalHitsWithFilters:0,results:[],totalPages:0,appliedFilters:this.makeAppliedFilters(),indexName:this.searchIndex.name||null,index:this.searchIndex.index}}this.indexResults.dynFilters=e.facets;this.indexResults.results=e.hits;this.indexResults.totalHitsWithFilters=e.nbHits;this.indexResults.currentPage=e.page;this.indexResults.totalPages=e.nbPages;this.indexResults.hitsPerPage=e.hitsPerPage;this.indexResults.query=e.query;if(this.changeEvent!==v.Page&&this.changeEvent!==v.Replica){this.facets=e.facets}this.nanoAfterQuery.emit(this.indexResults);return new Promise((t=>{setTimeout((()=>t("tpl updated")),20)})).then((t=>{this.currentHits=this.indexResults.results;this.resultsPage=this.indexResults.currentPage}))};this.handleSearchReset=()=>{this.showResults=false;this.indexResults=null};this.onResultDisplay=()=>{n((()=>{this.resultsDiv.removeEventListener("transitionend",this.onResultDisplay);if(!this.showResults)this.resultsDiv.style.display="none";else{this.defaultDiv.style.display="none";this.resultsDiv.classList.add("shown");this.resultsDiv.style.minHeight="";this.resultsDiv.style.width=""}}))};this._dynFacetFilters={};this.inputField=undefined;this.algoliaIndex=undefined;this.indeces=[];this.resultsEmitterEle=undefined;this.indexResults=undefined;this.filterChanged="";this.currentHits=undefined;this.changeEvent=v.Init;this.isLoading=false;this.wormholeState=this;this.showResults=false;this.resultsPage=0;this.appId=undefined;this.apiKey=undefined;this.searchIndex={};this.searchIndexName="";this.listenTo=null;this.query="";this.operator="and";this.filters=[];this.tplEngine=j;this.tplRenderFn=j.render;this.replicaIndex="";this.browseIndex=false;this.minChars=2;this.storeId=undefined;this.storeMethod="session"}async removeFilters(t,i){if(!t&&!i)this.clearAllFacetFilters();else{Object.keys(this._dynFacetFilters).forEach((e=>{if(t&&this._dynFacetFilters[e].facetName===t){if(!i)this._dynFacetFilters[e].element.value="";else{this._dynFacetFilters[e].element.value=this._dynFacetFilters[e].value.filter((t=>t!==i))}}}))}}onAllTplUpdate(t){t.stopPropagation();if(t.target.tagName==="NANO-ALGOLIA-RESULTS"){requestAnimationFrame((()=>{this.nanoNewResults.emit(this.indexResults)}))}}async onPageChange(t){if(!this.indexResults)return;let i=this.resultsPage;if(t){t.stopPropagation();i=t.detail.page}i=Math.min(this.indexResults.totalPages-1,i);i=Math.max(i,0);if(this.indexResults.currentPage===i)return;this.indexResults.currentPage=i;await this.algoliaSearch(v.Page)}async onFilterChange(t){t.stopPropagation();const i={};const e=t.detail;e.element=t.target;if(this.indexResults){if(this.staticFacetFilters[e.filterId])this.staticFacetFilters[e.filterId]=e;else{i[e.filterId]=e;this._dynFacetFilters=Object.assign(Object.assign({},this._dynFacetFilters),i)}this.indexResults.appliedFilters=this.makeAppliedFilters()}else this.staticFacetFilters[e.filterId]=e;this.filterChanged=e.value&&e.value.length?e.filterId:"all";this.resetPage();this.algoliaSearch(v.Filter)}dynFacetFiltersChange(){Object.values(this._dynFacetFilters).forEach((t=>{if(this.host.ownerDocument===t.element.ownerDocument)this.dynFacetFilters[t.filterId]=t;else delete this.dynFacetFilters[t.filterId]}))}browseIndexChange(){if(this.browseIndex&&(!this.query||this.query.length<this.minChars)){this.query="*"}}inputFieldSet(){if(!this.inputField)return;if(this.query!=="*"&&this.inputField&&this.inputField.value!==this.query)this.inputField.value=this.query}queryChange(){this.searchChange()}async internalIndexSwitch(){if(!this.replicaIndex||!this.indexResults||this.indexResults.index===this.replicaIndex)return;this.indexResults.index=this.replicaIndex;this.algoliaIndex=this.algoliaClient.initIndex(this.indexResults.index);this.resetPage();this.algoliaSearch(v.Replica)}pageChange(){this.onPageChange()}searchIndexNameChange(){if(!this.searchIndexName||!this.searchIndexName.length||this.searchIndex&&this.searchIndex.index===this.searchIndexName)return;this.searchIndex={index:this.searchIndexName}}initAlgoliaClient(){if(!this.appId||!this.apiKey)return;this.algoliaClient=o(this.appId,this.apiKey)}initAlgoliaIndex(){if(!this.algoliaClient||!this.searchIndex)return;if(this.searchIndex.index){if(this.replicaIndex)this.searchIndex.index=this.replicaIndex;this.searchIndexName=this.searchIndex.index;this.algoliaIndex=this.algoliaClient.initIndex(this.searchIndex.index);this.searchChange()}}showResultsChange(){if(!this.resultsDiv||!this.defaultDiv)return;if(this.showResults){this.resultsDiv.style.width=this.host.scrollWidth+"px";this.resultsDiv.style.minHeight=this.host.scrollHeight+"px";n((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.style.display="block";setTimeout((()=>this.resultsDiv.classList.add("show")),50)}))}else{n((()=>{this.resultsDiv.classList.remove("shown");this.defaultDiv.style.display="block";setTimeout((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.classList.remove("show");if(!!this.slottedInput)this.slottedInput.focus({preventScroll:true});else this.defaultDiv.focus({preventScroll:true})}),50)}))}}handleFilterpropChange(){this.algoliaSearch(v.Init)}fixDomain(t){if(!this.searchIndex||!this.searchIndex.domain)return t;t.hits.map((t=>{if(t.url&&!t.url.match(/^http/))t.url=location.protocol+"//"+this.searchIndex.domain+t.url}));return t}resetPage(){if(!this.indexResults)return;this.indexResults.currentPage=0}clearAllFacetFilters(){Object.values(this._dynFacetFilters).forEach((t=>{t.element.value=""}));this._dynFacetFilters={}}algoliaFilterStr(){const t={};const i=i=>{let e;let s;Object.keys(i).forEach((n=>{e=i[n];t[n]=t[n]||{name:e.facetName,or:[],and:[],not:[]};s=t[n][e.operator];if(e.value&&e.value.length){t[n][e.operator]=[...s,...e.value]}}))};i(this.dynFacetFilters);i(this.staticFacetFilters);const e=(t,i)=>{if(i.indexOf(" ")>-1)return t+':"'+i+'"';else return t+":"+i};let s=[];let n;let r;Object.values(t).forEach((function(t){Object.keys(t).filter((t=>t.match(/(or|and|not)/))).forEach((i=>{n=t;r=t.name;if(i==="or"||i==="and"){if(n[i].length){s.push("( "+n[i].map((t=>{if(t.length)return e(r,t)})).join(" "+i.toLocaleUpperCase()+" ")+" )")}}else{if(n.not.length){s.push("( "+n[i].map((t=>{if(t.length)return"NOT "+e(r,t)})).join(" AND ")+" )")}}}))}));s=[...this.filters,...s];return s.join(" "+this.operator.toLocaleUpperCase()+" ")}handleInputChange(t){if(t.target!==this.inputField)return;this.query=this.inputField.value}async updateContent(){return this.promiseQueue.enqueue((()=>this.updateContentQueue()))}async updateContentQueue(){const t=this.outputSlot||this.resultsDiv;if(!t||!this.tpl)return"no tpl";const i=document.createElement("div");i.innerHTML=this.tpl;const e=[];this.placedAlgoliaEles=[];Array.from(i.querySelectorAll("nano-algolia, nano-algolia-filter, nano-algolia-results")).forEach(((t,i)=>{const s=document.createElement("div");s.dataset.placeholderId=i.toString();s.classList.add("nano-ele-placeholder");e.push(t);t.parentNode.replaceChild(s,t)}));t.innerHTML=this.tplRenderFn(i.innerHTML.replace(/&gt;/gm,">").replace(/&lt;/gm,"<").replace(/&amp;/gm,"&"),this.indexResults);Array.from(t.querySelectorAll("div.nano-ele-placeholder")).forEach((t=>{t.parentNode.replaceChild(e[parseInt(t.dataset.placeholderId)],t);this.placedAlgoliaEles.push(e[parseInt(t.dataset.placeholderId)])}));if(!this.placedAlgoliaEles.length)return Promise.resolve("algolia setup");return new Promise((i=>{const e=s=>{this.placedAlgoliaEles=this.placedAlgoliaEles.filter((t=>t!==s.detail));if(!this.placedAlgoliaEles.length){setTimeout((()=>i("tpl updated")),500);t.removeEventListener("nanoTplUpdated",e)}};t.addEventListener("nanoTplUpdated",e)}))}componentWillLoad(){r((t=>{this.tplSlot=l(this.host,'[slot="template"]')[0];this.outputSlot=l(this.host,'[slot="output"]')[0];this.slottedInput=l(this.host,'[slot="search-input"]')[0];this.hasLoadSlot=!!l(this.host,'[slot="loader"]')[0];if(!!this.tplSlot)this.tpl=this.tplSlot.innerHTML||this.tplSlot.innerText;if(this.slottedInput&&(this.slottedInput.tagName.toLocaleLowerCase()==="nano-input"||this.slottedInput instanceof HTMLInputElement)){this.inputField=this.slottedInput}else if(this.slottedInput){this.inputField=this.slottedInput.querySelector('nano-input, input:not([type="radio"]):not([type="checkbox"])')}n((t=>{if(this.showResults&&this.tpl)this.searchChange()}))}));this.searchIndexNameChange();this.initAlgoliaClient();this.initAlgoliaIndex();y.create(this,this.wormholeState);if(this.storeId){u.init(this,["query","replicaIndex"],this.storeMethod,this.storeId);u.init(this,["apiKey","appId","searchIndex"],"session",this.storeId+"_api")}this.internalIndexSwitch()}connectedCallback(){this.searchChange=p(this.searchChange,300);this.browseIndexChange();this.host.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.host}))}render(){const t={indexResults:this.indexResults,results:this.currentHits,filterChanged:this.filterChanged,tplRenderFn:this.tplRenderFn,resultsPage:this.resultsPage,changeEvent:this.changeEvent,facets:this.facets,algoliaIndex:this.algoliaIndex,searchIndex:this.searchIndex,globalStoreMethod:this.storeMethod,isLoading:this.isLoading};return a(h,{class:{"show-results":this.showResults,"is-loading":this.isLoading},"aria-busy":this.isLoading},this.hasLoadSlot&&a("div",{hidden:!this.isLoading},a("slot",{name:"loader"})),!this.hasLoadSlot&&a("div",{class:{loader:true,loading:this.isLoading}},a("nano-spinner",{overlay:true,type:"circle"})),a(y.Provider,{state:t},a("slot",{name:"search-input"}),a("div",{class:"results-container","aria-live":"polite"},a("div",{ref:t=>this.resultsDiv=t,class:"results"},a("slot",{name:"output"})))),a("div",{ref:t=>this.defaultDiv=t,class:"default",tabindex:"-1"},a("slot",null)))}get host(){return t(this)}static get watchers(){return{_dynFacetFilters:["dynFacetFiltersChange"],browseIndex:["browseIndexChange"],inputField:["inputFieldSet"],query:["queryChange"],replicaIndex:["internalIndexSwitch"],resultsPage:["pageChange"],searchIndexName:["searchIndexNameChange"],apiKey:["initAlgoliaClient"],appId:["initAlgoliaClient"],searchIndex:["initAlgoliaIndex"],showResults:["showResultsChange"],filters:["handleFilterpropChange"]}}};S.style=I;export{S as nano_algolia};
5
+ //# sourceMappingURL=p-4884b65a.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{r as n,c as t,h as i,a,g as e}from"./p-f6a8467a.js";import{c as o}from"./p-257432ff.js";import{c as r}from"./p-411bb8f1.js";import{d as s,a as l}from"./p-9746b0a5.js";import{F as c,a as p}from"./p-71057181.js";const d='.sc-nano-input-h {\n box-sizing: border-box;\n}\n\n*.sc-nano-input, *.sc-nano-input::before, *.sc-nano-input::after {\n box-sizing: border-box;\n}\n[hidden].sc-nano-input {\n display: none !important;\n}\n[disabled].sc-nano-input-h:not([disabled=false]) {\n opacity: 0.5;\n}\n\n.form-ctrl.sc-nano-input {\n min-inline-size: 100%;\n display: block;\n}\n.form-ctrl.has-helper-end.sc-nano-input {\n display: flex;\n gap: 1rem;\n container-type: inline-size;\n}\n.form-ctrl.has-helper-end.sc-nano-input .form-ctrl__wrapper.sc-nano-input {\n flex: 1 1 100%;\n}\n.form-ctrl.has-helper-end.sc-nano-input .form-ctrl__helper-end.sc-nano-input {\n display: none;\n}\n@container (min-width: 350px) {\n .form-ctrl.has-helper-end .form-ctrl__helper-end {\n display: block !important;\n }\n .form-ctrl.has-helper-end .form-ctrl__helper {\n display: none !important;\n }\n}\n\n.form-ctrl__wrapper.sc-nano-input {\n display: block;\n}\n\nlabel.sc-nano-input, .form-ctrl__more.sc-nano-input, .form-ctrl__error.sc-nano-input, .form-ctrl__helper.sc-nano-input {\n display: block;\n inline-size: 100%;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\nlabel.visually-hide.sc-nano-input, .form-ctrl__more.visually-hide.sc-nano-input, .form-ctrl__error.visually-hide.sc-nano-input, .form-ctrl__helper.visually-hide.sc-nano-input {\n clip: rect(1px, 1px, 1px, 1px);\n -webkit-clip-path: inset(50%);\n clip-path: inset(50%);\n block-size: 1px;\n inline-size: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n}\n\n.form-ctrl__float-label.sc-nano-input {\n padding-block: 0;\n -webkit-padding-end: 0;\n padding-inline-end: 0;\n -webkit-padding-start: var(--padding-start);\n padding-inline-start: var(--padding-start);\n color: var(--label-color);\n position: absolute;\n font-size: 1.15em;\n transform: translateY(-50%);\n transform-origin: top left;\n inset-block-start: 50%;\n transition: all 0.125s ease-in;\n opacity: 1;\n}\n.has-focus.sc-nano-input-h .form-ctrl__float-label.sc-nano-input, .has-value.sc-nano-input-h .form-ctrl__float-label.sc-nano-input {\n transform: translateY(-110%);\n font-size: 0.8em;\n opacity: 0.7;\n}\n.form-ctrl__float-label.sc-nano-input .form-ctrl__label-charcount.sc-nano-input {\n opacity: 0;\n transition: opacity 0.125s ease-in;\n}\n.has-focus.sc-nano-input-h .form-ctrl__float-label.sc-nano-input .form-ctrl__label-charcount.sc-nano-input, .has-value.sc-nano-input-h .form-ctrl__float-label.sc-nano-input .form-ctrl__label-charcount.sc-nano-input {\n opacity: 1;\n}\n.form-ctrl__textarea.sc-nano-input .form-ctrl__float-label.sc-nano-input {\n inset-block-start: 50%;\n}\n.has-focus.sc-nano-input-h .form-ctrl__textarea.sc-nano-input .form-ctrl__float-label.sc-nano-input {\n inset-block-start: 0;\n transform: translateY(38%);\n}\n.has-value.sc-nano-input-h .form-ctrl__textarea.sc-nano-input .form-ctrl__float-label.sc-nano-input {\n inset-block-start: 0;\n transform: translateY(38%);\n}\n\n.form-ctrl__label.sc-nano-input {\n color: var(--label-color);\n font-size: var(--label-font-size);\n -webkit-padding-after: var(--padding-bottom);\n padding-block-end: var(--padding-bottom);\n line-height: 1;\n display: flex;\n}\n.form-ctrl__label.sc-nano-input .form-ctrl__label-wrap.sc-nano-input {\n flex: 1;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.form-ctrl__label.sc-nano-input .form-ctrl__label-placeholder.sc-nano-input {\n margin-block: unset;\n -webkit-margin-end: 5px;\n margin-inline-end: 5px;\n -webkit-margin-start: 0;\n margin-inline-start: 0;\n opacity: 0;\n -webkit-appearance: none;\n appearance: none;\n transition: 0.3s ease opacity;\n font-size: 0.9em;\n}\n.form-ctrl__label.sc-nano-input .form-ctrl__label-charcount.sc-nano-input {\n margin-block: unset;\n -webkit-margin-end: 0;\n margin-inline-end: 0;\n -webkit-margin-start: auto;\n margin-inline-start: auto;\n font-size: 0.9em;\n opacity: 0.5;\n}\n.has-value.sc-nano-input-h .form-ctrl__label.sc-nano-input .form-ctrl__label-placeholder.sc-nano-input {\n opacity: 0.5;\n}\n.has-focus.sc-nano-input-h .form-ctrl__label.sc-nano-input {\n color: var(--label-color--focus);\n}\n.is-invalid.sc-nano-input-h:not([disabled]) .form-ctrl__label.sc-nano-input {\n color: var(--label-color--invalid);\n}\n\n.has-float-label.sc-nano-input .select__multi-input.sc-nano-input, .has-float-label.sc-nano-input .select__native-input.sc-nano-input, .has-float-label.sc-nano-input .input__native-ctrl.sc-nano-input {\n opacity: 0;\n transition: opacity 0.125s ease-in;\n}\n.has-focus.sc-nano-input-h .has-float-label.sc-nano-input .select__multi-input.sc-nano-input, .has-value.sc-nano-input-h .has-float-label.sc-nano-input .select__multi-input.sc-nano-input, .has-focus.sc-nano-input-h .has-float-label.sc-nano-input .select__native-input.sc-nano-input, .has-value.sc-nano-input-h .has-float-label.sc-nano-input .select__native-input.sc-nano-input, .has-focus.sc-nano-input-h .has-float-label.sc-nano-input .input__native-ctrl.sc-nano-input, .has-value.sc-nano-input-h .has-float-label.sc-nano-input .input__native-ctrl.sc-nano-input {\n opacity: 1;\n}\n\n.form-ctrl__more.sc-nano-input {\n block-size: 1em;\n position: relative;\n margin-block: 4px var(--padding-bottom);\n margin-inline: 3px 0;\n}\n\n.form-ctrl__helper.sc-nano-input, .form-ctrl__error.sc-nano-input {\n inset-block-start: 0;\n inset-inline-start: 0;\n position: absolute;\n font-size: var(--invalid-msg-font-size);\n line-height: 1.2;\n transition: 0.3s ease-out opacity;\n}\n\n.form-ctrl__helper.sc-nano-input {\n font-style: italic;\n color: var(--help-msg-color);\n}\n[show-inline-error].sc-nano-input-h:not([show-inline-error=false]):not([disabled]).is-invalid .form-ctrl__helper.sc-nano-input {\n opacity: 0;\n}\n\n.form-ctrl__helper-end.sc-nano-input {\n flex: 1 1 30%;\n min-inline-size: 150px;\n font-size: var(--invalid-msg-font-size);\n color: var(--help-msg-color);\n font-style: italic;\n}\n\n.form-ctrl__error.sc-nano-input {\n opacity: 0;\n color: var(--invalid-msg-color);\n font-stretch: condensed;\n}\n.is-invalid.sc-nano-input-h:not([disabled]) .form-ctrl__error.sc-nano-input {\n opacity: 1;\n}\n\n.form-ctrl__input.sc-nano-input {\n font-family: inherit;\n font-size: inherit;\n font-stretch: inherit;\n font-style: inherit;\n font-weight: inherit;\n letter-spacing: inherit;\n text-decoration: inherit;\n text-overflow: inherit;\n text-transform: inherit;\n text-align: inherit;\n white-space: inherit;\n color: inherit;\n border-radius: var(--input-border-radius);\n inline-size: 100%;\n padding: 0 !important;\n position: relative;\n flex: 1 0 auto;\n display: flex;\n background: var(--input-bg-color);\n border: var(--input-border-style);\n border-width: var(--input-border-width);\n font-size: var(--input-font-size);\n -webkit-padding-start: calc(var(--input-border-hint-width) - var(--input-border-width)) !important;\n padding-inline-start: calc(var(--input-border-hint-width) - var(--input-border-width)) !important;\n}\n.has-focus.sc-nano-input-h .form-ctrl__input.sc-nano-input {\n background: var(--input-bg-color--focus);\n border: var(--input-border-style--focus);\n border-width: var(--input-border-width);\n -webkit-padding-start: calc(var(--input-border-hint-width) - var(--input-border-width)) !important;\n padding-inline-start: calc(var(--input-border-hint-width) - var(--input-border-width)) !important;\n}\n.is-invalid.sc-nano-input-h:not([disabled]) .form-ctrl__input.sc-nano-input {\n background: var(--input-bg-color--invalid);\n border: var(--input-border-style--invalid);\n border-width: var(--input-border-width);\n -webkit-border-start: var(--input-border-style--invalid-focus) var(--input-border-hint-width);\n border-inline-start: var(--input-border-style--invalid-focus) var(--input-border-hint-width);\n -webkit-padding-start: 0 !important;\n padding-inline-start: 0 !important;\n}\n.is-invalid.has-focus.sc-nano-input-h:not([disabled]) .form-ctrl__input.sc-nano-input {\n background: var(--input-bg-color--invalid);\n border: var(--input-border-style--invalid-focus);\n border-width: var(--input-border-width);\n -webkit-border-start: var(--input-border-style--invalid-focus) var(--input-border-hint-width);\n border-inline-start: var(--input-border-style--invalid-focus) var(--input-border-hint-width);\n -webkit-padding-start: 0 !important;\n padding-inline-start: 0 !important;\n}\n\n.form-ctrl__input-wrap.sc-nano-input {\n display: flex;\n align-items: stretch;\n flex: 1;\n max-inline-size: 100%;\n}\n\n.form-ctrl__clear-btn.sc-nano-input, .form-ctrl__slot-end.sc-nano-input, .form-ctrl__slot-start.sc-nano-input, .form-ctrl__slot-value-end.sc-nano-input {\n --nano-icon-size: 1.4em;\n margin-block: 0;\n margin-inline: 0;\n font-size: 1em;\n border: 0;\n outline: none;\n background-color: transparent;\n background-repeat: no-repeat;\n display: flex;\n align-items: stretch;\n inline-size: auto;\n}\n\n.has-float-label.sc-nano-input .form-ctrl__slot-start.sc-nano-input {\n display: none;\n}\n\n.form-ctrl__slot-start.sc-nano-input-s > *, .form-ctrl__slot-start .sc-nano-input-s > *, .form-ctrl__slot-end.sc-nano-input-s > *, .form-ctrl__slot-end .sc-nano-input-s > *, .form-ctrl__slot-value-end.sc-nano-input-s > *, .form-ctrl__slot-value-end .sc-nano-input-s > *, .form-ctrl__slot-value-end.sc-nano-input *.sc-nano-input {\n --nano-icon-size: 1.4em;\n padding-inline: unset;\n -webkit-padding-start: var(--padding-start);\n padding-inline-start: var(--padding-start);\n -webkit-padding-end: var(--padding-end);\n padding-inline-end: var(--padding-end);\n font-size: 1em;\n align-items: center;\n display: flex;\n block-size: 100%;\n z-index: 1;\n}\n.sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-start.sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-start .sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-end.sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-end .sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-value-end.sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-value-end .sc-nano-input-s > *, [disabled].sc-nano-input-h:not([disabled=false]) .form-ctrl__slot-value-end.sc-nano-input *.sc-nano-input {\n pointer-events: none;\n}\n\n.form-ctrl__slot-value-end.sc-nano-input-s > *, .form-ctrl__slot-value-end .sc-nano-input-s > *, .form-ctrl__slot-value-end.sc-nano-input *.sc-nano-input {\n pointer-events: none;\n}\n\n.form-ctrl__clear-btn.sc-nano-input {\n color: var(--clear-btn-color);\n padding: 0;\n opacity: 0;\n inline-size: 0;\n -webkit-appearance: none;\n appearance: none;\n align-items: center;\n overflow: hidden;\n}\n.is-invalid.sc-nano-input-h .form-ctrl__clear-btn.sc-nano-input {\n color: var(--clear-btn-color--invalid);\n}\n.has-value.sc-nano-input-h .form-ctrl__clear-btn.sc-nano-input {\n padding-block: 0;\n padding-inline: var(--padding-start) var(--padding-end);\n opacity: 1;\n inline-size: auto;\n}\n.form-ctrl__clear-btn.sc-nano-input:hover {\n color: var(--clear-btn-color--hover);\n}\n\n.sc-nano-input-h {\n \n --placeholder-color: var(--nano-input-placeholder-color, initial);\n --placeholder-font-style: var(--nano-input-placeholder-style, initial);\n --placeholder-font-weight: var(--nano-input-placeholder-weight, initial);\n --placeholder-opacity: var(--nano-input-placeholder-opacity, 0.5);\n --padding-top: var(--nano-input-padding-top, var(--nano-input-padding, 8px));\n --padding-end: var(--nano-input-padding-end, var(--nano-input-padding, 8px));\n --padding-bottom: var(--nano-input-padding-bottom, var(--nano-input-padding, 6px));\n --padding-start: var(--nano-input-padding-start, var(--nano-input-padding, 8px));\n --color-invalid: var(--nano-color-danger-rgb, 239 65 53);\n --color--focus-rgb:\n var(\n --nano-color-base-rgb,\n var(--nano-color-primary-rgb, 0 116 149)\n );\n --input-font-size: var(--nano-input-font-size, 0.87em);\n --input-text-color: var(--nano-input-text-color, #4a4a4a);\n --input-border-width: var(--nano-input-border-width, 1px);\n --input-border-hint-width: 3px;\n --input-border-color: var(--nano-input-border-color, #e4e6e8);\n --input-border-radius: var(--nano-input-border-radius, 0);\n --input-border-style: var(--nano-input-border-style, solid) var(--nano-input-border-color, #e4e6e8);\n --input-border-style--focus: var(--nano-input-border-style, solid) var(--nano-input-border-color--focus, #90c6e7);\n --input-border-style--invalid: var(--nano-input-border-style, solid) var(--nano-input-border-color--invalid, #e4e6e8);\n --input-border-style--invalid-focus: var(--nano-input-border-style, solid) var(--nano-input-border-color--invalid, #ef4135);\n --input-bg-color: var(--nano-input-background-color, #fff);\n --input-bg-color--focus: var(--input-bg-color);\n --input-bg-color--invalid: var(--nano-input-background-color, white);\n --invalid-msg-color: rgb(var(--color-invalid) / 100%);\n --invalid-msg-font-size: var(--nano-input-help-font-size, 0.75em);\n --help-msg-color: var(--nano-input-help-color, #616d6e);\n --clear-btn-color: var(--nano-clear-btn-color, rgba(0, 0, 0, 0.3));\n --clear-btn-color--hover: rgb(var(--color--focus-rgb) / 100%);\n --clear-btn-color--invalid: rgb(var(--color-invalid) / 100%);\n --label-color: var(--nano-input-label-color, "currentcolor");\n --label-color--focus: var(--label-color);\n --label-color--invalid: var(--nano-input-label-color-invalid, "currentcolor");\n --label-font-size: var(--nano-input-label-color, 1em);\n --multi-input-value-bg: var(--nano-input-tag-bg, 186 220 240);\n --multi-input-value-text-color: var(--nano-input-tag-color, #455556);\n --multi-input-value-border: var(--nano-input-tag-color, #badcf0);\n position: relative;\n inline-size: 100%;\n padding: 0 !important;\n color: currentcolor;\n display: block;\n}\n\n.nano-color.sc-nano-input-h {\n color: var(--nano-color-base);\n --input-border-style--focus:\n var(--nano-input-border-style, solid) var(\n --nano-color-tint,\n var(--nano-color-primary-tint, #2689a5)\n );\n}\n\n.input__native-ctrl.sc-nano-input {\n font-family: inherit;\n font-size: inherit;\n font-stretch: inherit;\n font-style: inherit;\n font-weight: inherit;\n letter-spacing: inherit;\n text-decoration: inherit;\n text-overflow: inherit;\n text-transform: inherit;\n text-align: inherit;\n white-space: inherit;\n color: inherit;\n padding-block: 0;\n padding-inline: var(--padding-start) var(--padding-end);\n border-radius: var(--input-border-radius);\n text-overflow: ellipsis;\n color: var(--input-text-color);\n display: inline-block;\n flex: 1;\n inline-size: 100%;\n max-inline-size: 100%;\n max-block-size: 100%;\n border: 0;\n outline: none;\n background: transparent;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n box-sizing: border-box;\n resize: none;\n overflow: hidden;\n line-height: 2.5em;\n \n}\n.has-float-label.sc-nano-input .input__native-ctrl.sc-nano-input {\n line-height: 2.1em;\n min-height: 2.1em;\n -webkit-padding-before: 1.4em;\n padding-block-start: 1.4em;\n}\n.input__native-ctrl.sc-nano-input::placeholder {\n color: var(--placeholder-color);\n font-family: inherit;\n font-style: var(--placeholder-font-style);\n font-weight: var(--placeholder-font-weight);\n opacity: var(--placeholder-opacity);\n line-height: inherit;\n min-height: initial;\n}\n.input__native-ctrl.sc-nano-input::-moz-placeholder {\n line-height: 2.8em;\n text-overflow: ellipsis;\n}\n.input__native-ctrl.sc-nano-input:-webkit-autofill {\n background-color: transparent;\n}\n.input__native-ctrl.sc-nano-input::-webkit-search-decoration, .input__native-ctrl.sc-nano-input::-webkit-search-cancel-button, .input__native-ctrl.sc-nano-input::-webkit-search-results-button, .input__native-ctrl.sc-nano-input::-webkit-search-results-decoration {\n -webkit-appearance: none;\n appearance: none;\n}\n.input__native-ctrl.sc-nano-input:invalid {\n box-shadow: none;\n}\n.input__native-ctrl.sc-nano-input::-ms-clear, .input__native-ctrl.sc-nano-input::-ms-reveal {\n display: none;\n}\n.input__native-ctrl.input__resizable.sc-nano-input {\n resize: vertical;\n overflow: auto;\n}\n.form-ctrl__textarea.sc-nano-input .input__native-ctrl.sc-nano-input {\n line-height: 1.5em;\n padding-block: var(--padding-top) 0.25em;\n white-space: pre-wrap;\n}\n.form-ctrl__textarea.sc-nano-input .input__native-ctrl.sc-nano-input::placeholder {\n line-height: 1.5em;\n}\n.has-float-label.sc-nano-input .form-ctrl__textarea.sc-nano-input .input__native-ctrl.sc-nano-input {\n -webkit-padding-before: 1.75em;\n padding-block-start: 1.75em;\n}\n[readonly].sc-nano-input-h:not([readonly=false]) .input__native-ctrl.sc-nano-input {\n -webkit-user-select: none;\n user-select: none;\n}';let h=0;const u=class{get nativeInputWrap(){return this._nativeInputWrap}set nativeInputWrap(n){if(this._nativeInputWrap===n)return;this._nativeInputWrap=n;this.setDataListOpts()}constructor(i){n(this,i);this.nanoInput=t(this,"nanoInput",7);this.nanoChange=t(this,"nanoChange",7);this.nanoBlur=t(this,"nanoBlur",7);this.nanoFocus=t(this,"nanoFocus",7);this.nanoDidLoad=t(this,"nanoDidLoad",7);this.nanoDidUnload=t(this,"nanoDidUnload",7);this.nanoValidate=t(this,"nanoValidate",7);this.inputId=`nano-input-${h++}`;this.didBlurAfterEdit=false;this.rtl=false;this.charCount=0;this.hasRendered=false;this.validate=n=>{if(this.validateOn==="submitThenDirty")this.validateOn="dirty";if(!this.nativeInput.validity.valid){if(this.showInlineError){if(n)n.preventDefault();this.errorMessage=this.nativeInput.validationMessage}this._invalid=true}else this._invalid=false;this.nanoValidate.emit({isValid:!this._invalid,errorMessage:this.nativeInput.validationMessage,originalEvent:n})};this.onInput=n=>{const t=n.target;this.value=(t===null||t===void 0?void 0:t.value)||"";this.nanoInput.emit(n)};this.onBlur=()=>{this.hasFocus=false;this.focusChanged();if(this.validateOn==="dirty")this.validate();this.nanoBlur.emit()};this.onFocus=()=>{this.hasFocus=true;this.focusChanged();this.nanoFocus.emit()};this.onKeydown=()=>{if(this.shouldClearOnEdit()){if(this.didBlurAfterEdit&&this.hasValue()){this.clearTextInput()}this.didBlurAfterEdit=false}};this.clearTextInput=n=>{if(this.clearInput&&!this.readonly&&!this.disabled&&n){n.preventDefault();n.stopPropagation()}this.value="";this.nativeInput.value="";const t=new window.Event("change");this.nativeInput.dispatchEvent(t)};this.hasFocus=false;this.hasLabelSlot=false;this.hasHelperSlot=false;this.hasHelperEndSlot=false;this.errorMessage="";this.datalist=null;this._invalid=false;this.color=undefined;this.accept=undefined;this.autocapitalise="none";this.autocomplete="off";this.autocorrect="off";this.autofocus=false;this.clearInput=false;this.clearOnEdit=undefined;this.debounce=0;this.disabled=false;this.inputmode=undefined;this.validateOn="submitThenDirty";this.showInlineError=true;this.label=undefined;this.hideLabel=false;this.floatLabel=false;this.max=undefined;this.maxlength=undefined;this.min=undefined;this.minlength=undefined;this.multiple=undefined;this.name=this.inputId;this.pattern=undefined;this.placeholder=undefined;this.readonly=false;this.required=false;this.spellcheck=false;this.step=undefined;this.size=undefined;this.type="text";this.form=undefined;this.value="";this.resize="auto";this.rows=2;this.showCharCount=false;this.validate=s(this.validate,50);this.handleBlur=this.handleBlur.bind(this)}setDataListOpts(){if(!this.datalist)return;const n=this.datalist.dropDownConfig||{};this.datalist.dropDownConfig=Object.assign(Object.assign({},n),{skidding:-1,tetherTo:this.nativeInputWrap})}get invalid(){return this._invalid}get validityMessage(){if(!this.nativeInput)return"";return this.nativeInput.validationMessage}shouldValidate(){if(!this.hasRendered)return;requestAnimationFrame((()=>{if(this.validateOn==="dirty")this.validate()}))}valueChanged(){this.nanoChange.emit({value:this.value});this.charCount=this.value.length;if(this.type==="textarea"&&this.resize==="auto"){this.nativeInput.style.height="auto";if(this.value.length)this.nativeInput.style.height=this.nativeInput.scrollHeight+"px"}requestAnimationFrame((()=>{if(this.validateOn==="dirty")this.validate()}))}debounceChanged(){this.nanoChange=l(this.nanoChange,this.debounce)}async reportValidity(n){return new Promise((t=>{if(n)this.validate();setTimeout((()=>{t({isValid:!this._invalid,errorMessage:this.nativeInput.validationMessage})}),50)}))}async setFocus(){if(this.nativeInput){this.nativeInput.focus();this.nativeInput.click()}}async select(){if(this.nativeInput){this.nativeInput.select()}}getInputElement(){return Promise.resolve(this.nativeInput)}async showError(n){if(this.nativeInput){this.nativeInput.setCustomValidity(n);this.validate()}}onReset(n){const t=this.form?document.querySelector("#"+this.form):this.el.closest("form");if(!t||n.target!==this.el.closest("form"))return;this.value=""}handleBlur(n){if(!this.hasFocus)return;const t=n;let i;requestAnimationFrame((()=>{if(n instanceof KeyboardEvent&&t.key){if(t.key!=="Tab")return;i=document.activeElement}else if(n instanceof FocusEvent){i=document.activeElement}else i=n.target;if(o(this.el.tagName.toLowerCase(),i)!==this.el){this.onBlur()}}))}shouldClearOnEdit(){const{type:n,clearOnEdit:t}=this;return t===undefined?n==="password":t}getValue(){return this.value||""}focusChanged(){if(!this.hasFocus&&this.shouldClearOnEdit()&&this.hasValue()){this.didBlurAfterEdit=true}}hasValue(){return this.getValue().length>0}slotChangeObserver(){if(this.mo)this.mo.disconnect();const n=this.mo=new MutationObserver((()=>this.processSlottedContent()));n.observe(this.el,{childList:true,subtree:true})}processSlottedContent(){this.hasLabelSlot=!!this.el.querySelectorAll('[slot="label"]');this.hasHelperSlot=!!this.el.querySelector('[slot="helper"]');this.hasHelperEndSlot=!!this.el.querySelector('[slot="helper-end"]');this.datalist=this.el.querySelector("nano-datalist:not([slot])");if(!!this.el.querySelector('[slot="inline-button"]')){console.warn("The `inline-button` slot was renamed to `end` in v2 - please update your code",this.el)}}connectedCallback(){this.debounceChanged();{this.el.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.el}))}}disconnectedCallback(){{document.dispatchEvent(new CustomEvent("nanoDidUnload",{detail:this.el}))}if(this.mo)this.mo.disconnect()}componentDidLoad(){this.slotChangeObserver();this.hasRendered=true;if(this.autofocus)setTimeout((n=>this.setFocus()),300)}componentWillLoad(){this.processSlottedContent()}render(){const n=this.getValue();const t=this.inputId+"-lbl";const e=this.showInlineError||this.hasHelperSlot?this.inputId+"-more":"";const o=this.hasHelperEndSlot?this.inputId+"-helper":"";this.rtl=this.el.ownerDocument.dir==="rtl";const s=(({el:n,floatLabel:t,label:i,errorMessage:a,type:e,showInlineError:o,hasHelperSlot:r,hasLabelSlot:s,hideLabel:l,placeholder:c,maxlength:p,charCount:d,showCharCount:h,rtl:u,hasHelperEndSlot:f})=>({el:n,floatLabel:t,label:i,errorMessage:a,type:e,showInlineError:o,hasHelperSlot:r,hasLabelSlot:s,hideLabel:l,placeholder:c,maxlength:p,charCount:d,showCharCount:h,rtl:u,hasHelperEndSlot:f}))(this);const l=Object.assign(Object.assign({},s),{labelId:t,moreId:e,helperEndId:o,hasValue:this.hasValue(),controlId:this.inputId});const d=(({clearInput:n,readonly:t,disabled:i})=>({clearInput:n,readonly:t,disabled:i,clearControl:this.clearInput}))(this);return i(a,{"aria-disabled":this.disabled?"true":null,dir:this.rtl?"rtl":null,class:Object.assign(Object.assign({},r(this.color)),{"has-value":this.hasValue(),"has-focus":this.hasFocus,"is-invalid":this._invalid})},i("div",{style:{width:"100%"}},i(c,Object.assign({},l),i(p,Object.assign({},d,{onClearText:this.clearTextInput,control:this.el,ref:n=>this.nativeInputWrap=n}),this.type!=="textarea"&&i("input",{id:this.inputId,class:"input__native-ctrl",ref:n=>this.nativeInput=n,"aria-labelledby":t+" "+e+" "+o,disabled:this.disabled,accept:this.accept,autoCapitalize:this.autocapitalise,autoComplete:this.autocomplete,autoCorrect:this.autocorrect,autoFocus:this.autofocus,inputMode:this.inputmode,form:this.form,min:this.min,max:this.max,minLength:this.minlength,maxLength:this.maxlength,multiple:this.multiple,name:this.name,pattern:this.pattern,placeholder:this.placeholder,readOnly:this.readonly,required:this.required,spellcheck:this.spellcheck,step:this.step,size:this.size,type:this.type,value:n,onInput:this.onInput,onChange:this.onInput,onFocus:this.onFocus,onBlur:this.handleBlur,onKeyDown:this.onKeydown,onInvalid:this.validate}),this.type==="textarea"&&i("textarea",{rows:this.floatLabel?1:this.rows,id:this.inputId,class:{"input__native-ctrl":true,input__resizable:this.resize==="true"},ref:n=>this.nativeInput=n,"aria-labelledby":t+" "+e+" "+o,disabled:this.disabled,autoCapitalize:this.autocapitalise,autoCorrect:this.autocorrect,autoFocus:this.autofocus,inputMode:this.inputmode,form:this.form,minLength:this.minlength,maxLength:this.maxlength,name:this.name,placeholder:this.placeholder,readOnly:this.readonly,required:this.required,spellcheck:this.spellcheck,value:n,onInput:this.onInput,onChange:this.onInput,onFocus:this.onFocus,onKeyDown:this.onKeydown,onInvalid:this.validate,onBlur:this.handleBlur}))),i("slot",null)))}get el(){return e(this)}static get watchers(){return{datalist:["setDataListOpts"],minlength:["shouldValidate"],maxlength:["shouldValidate"],min:["shouldValidate"],max:["shouldValidate"],required:["shouldValidate"],disabled:["shouldValidate"],readonly:["shouldValidate"],pattern:["shouldValidate"],inputmode:["shouldValidate"],value:["valueChanged"],debounce:["debounceChanged"]}}};u.style=d;export{u as nano_input};
5
- //# sourceMappingURL=p-34501eae.entry.js.map
4
+ import{r as n,c as t,h as i,a,g as e}from"./p-f6a8467a.js";import{c as o}from"./p-257432ff.js";import{c as r}from"./p-411bb8f1.js";import{d as s,a as l}from"./p-7bff5224.js";import{F as c,a as p}from"./p-71057181.js";const d='.sc-nano-input-h {\n box-sizing: border-box;\n}\n\n*.sc-nano-input, *.sc-nano-input::before, *.sc-nano-input::after {\n box-sizing: border-box;\n}\n[hidden].sc-nano-input {\n display: none !important;\n}\n[disabled].sc-nano-input-h:not([disabled=false]) {\n opacity: 0.5;\n}\n\n.form-ctrl.sc-nano-input {\n min-inline-size: 100%;\n display: block;\n}\n.form-ctrl.has-helper-end.sc-nano-input {\n display: flex;\n gap: 1rem;\n container-type: inline-size;\n}\n.form-ctrl.has-helper-end.sc-nano-input .form-ctrl__wrapper.sc-nano-input {\n flex: 1 1 100%;\n}\n.form-ctrl.has-helper-end.sc-nano-input .form-ctrl__helper-end.sc-nano-input {\n display: none;\n}\n@container (min-width: 350px) {\n .form-ctrl.has-helper-end .form-ctrl__helper-end {\n display: block !important;\n }\n .form-ctrl.has-helper-end .form-ctrl__helper {\n display: none !important;\n }\n}\n\n.form-ctrl__wrapper.sc-nano-input {\n display: block;\n}\n\nlabel.sc-nano-input, .form-ctrl__more.sc-nano-input, .form-ctrl__error.sc-nano-input, .form-ctrl__helper.sc-nano-input {\n display: block;\n inline-size: 100%;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\nlabel.visually-hide.sc-nano-input, .form-ctrl__more.visually-hide.sc-nano-input, .form-ctrl__error.visually-hide.sc-nano-input, .form-ctrl__helper.visually-hide.sc-nano-input {\n clip: rect(1px, 1px, 1px, 1px);\n -webkit-clip-path: inset(50%);\n clip-path: inset(50%);\n block-size: 1px;\n inline-size: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n}\n\n.form-ctrl__float-label.sc-nano-input {\n padding-block: 0;\n -webkit-padding-end: 0;\n padding-inline-end: 0;\n -webkit-padding-start: var(--padding-start);\n padding-inline-start: var(--padding-start);\n color: var(--label-color);\n position: absolute;\n font-size: 1.15em;\n transform: translateY(-50%);\n transform-origin: top left;\n inset-block-start: 50%;\n transition: all 0.125s ease-in;\n opacity: 1;\n}\n.has-focus.sc-nano-input-h .form-ctrl__float-label.sc-nano-input, .has-value.sc-nano-input-h .form-ctrl__float-label.sc-nano-input {\n transform: translateY(-110%);\n font-size: 0.8em;\n opacity: 0.7;\n}\n.form-ctrl__float-label.sc-nano-input .form-ctrl__label-charcount.sc-nano-input {\n opacity: 0;\n transition: opacity 0.125s ease-in;\n}\n.has-focus.sc-nano-input-h .form-ctrl__float-label.sc-nano-input .form-ctrl__label-charcount.sc-nano-input, .has-value.sc-nano-input-h .form-ctrl__float-label.sc-nano-input .form-ctrl__label-charcount.sc-nano-input {\n opacity: 1;\n}\n.form-ctrl__textarea.sc-nano-input .form-ctrl__float-label.sc-nano-input {\n inset-block-start: 50%;\n}\n.has-focus.sc-nano-input-h .form-ctrl__textarea.sc-nano-input .form-ctrl__float-label.sc-nano-input {\n inset-block-start: 0;\n transform: translateY(38%);\n}\n.has-value.sc-nano-input-h .form-ctrl__textarea.sc-nano-input .form-ctrl__float-label.sc-nano-input {\n inset-block-start: 0;\n transform: translateY(38%);\n}\n\n.form-ctrl__label.sc-nano-input {\n color: var(--label-color);\n font-size: var(--label-font-size);\n -webkit-padding-after: var(--padding-bottom);\n padding-block-end: var(--padding-bottom);\n line-height: 1;\n display: flex;\n}\n.form-ctrl__label.sc-nano-input .form-ctrl__label-wrap.sc-nano-input {\n flex: 1;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.form-ctrl__label.sc-nano-input .form-ctrl__label-placeholder.sc-nano-input {\n margin-block: unset;\n -webkit-margin-end: 5px;\n margin-inline-end: 5px;\n -webkit-margin-start: 0;\n margin-inline-start: 0;\n opacity: 0;\n -webkit-appearance: none;\n appearance: none;\n transition: 0.3s ease opacity;\n font-size: 0.9em;\n}\n.form-ctrl__label.sc-nano-input .form-ctrl__label-charcount.sc-nano-input {\n margin-block: unset;\n -webkit-margin-end: 0;\n margin-inline-end: 0;\n -webkit-margin-start: auto;\n margin-inline-start: auto;\n font-size: 0.9em;\n opacity: 0.5;\n}\n.has-value.sc-nano-input-h .form-ctrl__label.sc-nano-input .form-ctrl__label-placeholder.sc-nano-input {\n opacity: 0.5;\n}\n.has-focus.sc-nano-input-h .form-ctrl__label.sc-nano-input {\n color: var(--label-color--focus);\n}\n.is-invalid.sc-nano-input-h:not([disabled]) .form-ctrl__label.sc-nano-input {\n color: var(--label-color--invalid);\n}\n\n.has-float-label.sc-nano-input .select__multi-input.sc-nano-input, .has-float-label.sc-nano-input .select__native-input.sc-nano-input, .has-float-label.sc-nano-input .input__native-ctrl.sc-nano-input {\n opacity: 0;\n transition: opacity 0.125s ease-in;\n}\n.has-focus.sc-nano-input-h .has-float-label.sc-nano-input .select__multi-input.sc-nano-input, .has-value.sc-nano-input-h .has-float-label.sc-nano-input .select__multi-input.sc-nano-input, .has-focus.sc-nano-input-h .has-float-label.sc-nano-input .select__native-input.sc-nano-input, .has-value.sc-nano-input-h .has-float-label.sc-nano-input .select__native-input.sc-nano-input, .has-focus.sc-nano-input-h .has-float-label.sc-nano-input .input__native-ctrl.sc-nano-input, .has-value.sc-nano-input-h .has-float-label.sc-nano-input .input__native-ctrl.sc-nano-input {\n opacity: 1;\n}\n\n.form-ctrl__more.sc-nano-input {\n block-size: 1em;\n position: relative;\n margin-block: 4px var(--padding-bottom);\n margin-inline: 3px 0;\n}\n\n.form-ctrl__helper.sc-nano-input, .form-ctrl__error.sc-nano-input {\n inset-block-start: 0;\n inset-inline-start: 0;\n position: absolute;\n font-size: var(--invalid-msg-font-size);\n line-height: 1.2;\n transition: 0.3s ease-out opacity;\n}\n\n.form-ctrl__helper.sc-nano-input {\n font-style: italic;\n color: var(--help-msg-color);\n}\n[show-inline-error].sc-nano-input-h:not([show-inline-error=false]):not([disabled]).is-invalid .form-ctrl__helper.sc-nano-input {\n opacity: 0;\n}\n\n.form-ctrl__helper-end.sc-nano-input {\n flex: 1 1 30%;\n min-inline-size: 150px;\n font-size: var(--invalid-msg-font-size);\n color: var(--help-msg-color);\n font-style: italic;\n}\n\n.form-ctrl__error.sc-nano-input {\n opacity: 0;\n color: var(--invalid-msg-color);\n font-stretch: condensed;\n}\n.is-invalid.sc-nano-input-h:not([disabled]) .form-ctrl__error.sc-nano-input {\n opacity: 1;\n}\n\n.form-ctrl__input.sc-nano-input {\n font-family: inherit;\n font-size: inherit;\n font-stretch: inherit;\n font-style: inherit;\n font-weight: inherit;\n letter-spacing: inherit;\n text-decoration: inherit;\n text-overflow: inherit;\n text-transform: inherit;\n text-align: inherit;\n white-space: inherit;\n color: inherit;\n border-radius: var(--input-border-radius);\n inline-size: 100%;\n padding: 0 !important;\n position: relative;\n flex: 1 0 auto;\n display: flex;\n background: var(--input-bg-color);\n border: var(--input-border-style);\n border-width: var(--input-border-width);\n font-size: var(--input-font-size);\n -webkit-padding-start: calc(var(--input-border-hint-width) - var(--input-border-width)) !important;\n padding-inline-start: calc(var(--input-border-hint-width) - var(--input-border-width)) !important;\n}\n.has-focus.sc-nano-input-h .form-ctrl__input.sc-nano-input {\n background: var(--input-bg-color--focus);\n border: var(--input-border-style--focus);\n border-width: var(--input-border-width);\n -webkit-padding-start: calc(var(--input-border-hint-width) - var(--input-border-width)) !important;\n padding-inline-start: calc(var(--input-border-hint-width) - var(--input-border-width)) !important;\n}\n.is-invalid.sc-nano-input-h:not([disabled]) .form-ctrl__input.sc-nano-input {\n background: var(--input-bg-color--invalid);\n border: var(--input-border-style--invalid);\n border-width: var(--input-border-width);\n -webkit-border-start: var(--input-border-style--invalid-focus) var(--input-border-hint-width);\n border-inline-start: var(--input-border-style--invalid-focus) var(--input-border-hint-width);\n -webkit-padding-start: 0 !important;\n padding-inline-start: 0 !important;\n}\n.is-invalid.has-focus.sc-nano-input-h:not([disabled]) .form-ctrl__input.sc-nano-input {\n background: var(--input-bg-color--invalid);\n border: var(--input-border-style--invalid-focus);\n border-width: var(--input-border-width);\n -webkit-border-start: var(--input-border-style--invalid-focus) var(--input-border-hint-width);\n border-inline-start: var(--input-border-style--invalid-focus) var(--input-border-hint-width);\n -webkit-padding-start: 0 !important;\n padding-inline-start: 0 !important;\n}\n\n.form-ctrl__input-wrap.sc-nano-input {\n display: flex;\n align-items: stretch;\n flex: 1;\n max-inline-size: 100%;\n}\n\n.form-ctrl__clear-btn.sc-nano-input, .form-ctrl__slot-end.sc-nano-input, .form-ctrl__slot-start.sc-nano-input, .form-ctrl__slot-value-end.sc-nano-input {\n --nano-icon-size: 1.4em;\n margin-block: 0;\n margin-inline: 0;\n font-size: 1em;\n border: 0;\n outline: none;\n background-color: transparent;\n background-repeat: no-repeat;\n display: flex;\n align-items: stretch;\n inline-size: auto;\n}\n\n.has-float-label.sc-nano-input .form-ctrl__slot-start.sc-nano-input {\n display: none;\n}\n\n.form-ctrl__slot-start.sc-nano-input-s > *, .form-ctrl__slot-start .sc-nano-input-s > *, .form-ctrl__slot-end.sc-nano-input-s > *, .form-ctrl__slot-end .sc-nano-input-s > *, .form-ctrl__slot-value-end.sc-nano-input-s > *, .form-ctrl__slot-value-end .sc-nano-input-s > *, .form-ctrl__slot-value-end.sc-nano-input *.sc-nano-input {\n --nano-icon-size: 1.4em;\n padding-inline: unset;\n -webkit-padding-start: var(--padding-start);\n padding-inline-start: var(--padding-start);\n -webkit-padding-end: var(--padding-end);\n padding-inline-end: var(--padding-end);\n font-size: 1em;\n align-items: center;\n display: flex;\n block-size: 100%;\n z-index: 1;\n}\n.sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-start.sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-start .sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-end.sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-end .sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-value-end.sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-value-end .sc-nano-input-s > *, [disabled].sc-nano-input-h:not([disabled=false]) .form-ctrl__slot-value-end.sc-nano-input *.sc-nano-input {\n pointer-events: none;\n}\n\n.form-ctrl__slot-value-end.sc-nano-input-s > *, .form-ctrl__slot-value-end .sc-nano-input-s > *, .form-ctrl__slot-value-end.sc-nano-input *.sc-nano-input {\n pointer-events: none;\n}\n\n.form-ctrl__clear-btn.sc-nano-input {\n color: var(--clear-btn-color);\n padding: 0;\n opacity: 0;\n inline-size: 0;\n -webkit-appearance: none;\n appearance: none;\n align-items: center;\n overflow: hidden;\n}\n.is-invalid.sc-nano-input-h .form-ctrl__clear-btn.sc-nano-input {\n color: var(--clear-btn-color--invalid);\n}\n.has-value.sc-nano-input-h .form-ctrl__clear-btn.sc-nano-input {\n padding-block: 0;\n padding-inline: var(--padding-start) var(--padding-end);\n opacity: 1;\n inline-size: auto;\n}\n.form-ctrl__clear-btn.sc-nano-input:hover {\n color: var(--clear-btn-color--hover);\n}\n\n.sc-nano-input-h {\n \n --placeholder-color: var(--nano-input-placeholder-color, initial);\n --placeholder-font-style: var(--nano-input-placeholder-style, initial);\n --placeholder-font-weight: var(--nano-input-placeholder-weight, initial);\n --placeholder-opacity: var(--nano-input-placeholder-opacity, 0.5);\n --padding-top: var(--nano-input-padding-top, var(--nano-input-padding, 8px));\n --padding-end: var(--nano-input-padding-end, var(--nano-input-padding, 8px));\n --padding-bottom: var(--nano-input-padding-bottom, var(--nano-input-padding, 6px));\n --padding-start: var(--nano-input-padding-start, var(--nano-input-padding, 8px));\n --color-invalid: var(--nano-color-danger-rgb, 239 65 53);\n --color--focus-rgb:\n var(\n --nano-color-base-rgb,\n var(--nano-color-primary-rgb, 0 116 149)\n );\n --input-font-size: var(--nano-input-font-size, 0.87em);\n --input-text-color: var(--nano-input-text-color, #4a4a4a);\n --input-border-width: var(--nano-input-border-width, 1px);\n --input-border-hint-width: 3px;\n --input-border-color: var(--nano-input-border-color, #e4e6e8);\n --input-border-radius: var(--nano-input-border-radius, 0);\n --input-border-style: var(--nano-input-border-style, solid) var(--nano-input-border-color, #e4e6e8);\n --input-border-style--focus: var(--nano-input-border-style, solid) var(--nano-input-border-color--focus, #90c6e7);\n --input-border-style--invalid: var(--nano-input-border-style, solid) var(--nano-input-border-color--invalid, #e4e6e8);\n --input-border-style--invalid-focus: var(--nano-input-border-style, solid) var(--nano-input-border-color--invalid, #ef4135);\n --input-bg-color: var(--nano-input-background-color, #fff);\n --input-bg-color--focus: var(--input-bg-color);\n --input-bg-color--invalid: var(--nano-input-background-color, white);\n --invalid-msg-color: rgb(var(--color-invalid) / 100%);\n --invalid-msg-font-size: var(--nano-input-help-font-size, 0.75em);\n --help-msg-color: var(--nano-input-help-color, #616d6e);\n --clear-btn-color: var(--nano-clear-btn-color, rgba(0, 0, 0, 0.3));\n --clear-btn-color--hover: rgb(var(--color--focus-rgb) / 100%);\n --clear-btn-color--invalid: rgb(var(--color-invalid) / 100%);\n --label-color: var(--nano-input-label-color, "currentcolor");\n --label-color--focus: var(--label-color);\n --label-color--invalid: var(--nano-input-label-color-invalid, "currentcolor");\n --label-font-size: var(--nano-input-label-color, 1em);\n --multi-input-value-bg: var(--nano-input-tag-bg, 186 220 240);\n --multi-input-value-text-color: var(--nano-input-tag-color, #455556);\n --multi-input-value-border: var(--nano-input-tag-color, #badcf0);\n position: relative;\n inline-size: 100%;\n padding: 0 !important;\n color: currentcolor;\n display: block;\n}\n\n.nano-color.sc-nano-input-h {\n color: var(--nano-color-base);\n --input-border-style--focus:\n var(--nano-input-border-style, solid) var(\n --nano-color-tint,\n var(--nano-color-primary-tint, #2689a5)\n );\n}\n\n.input__native-ctrl.sc-nano-input {\n font-family: inherit;\n font-size: inherit;\n font-stretch: inherit;\n font-style: inherit;\n font-weight: inherit;\n letter-spacing: inherit;\n text-decoration: inherit;\n text-overflow: inherit;\n text-transform: inherit;\n text-align: inherit;\n white-space: inherit;\n color: inherit;\n padding-block: 0;\n padding-inline: var(--padding-start) var(--padding-end);\n border-radius: var(--input-border-radius);\n text-overflow: ellipsis;\n color: var(--input-text-color);\n display: inline-block;\n flex: 1;\n inline-size: 100%;\n max-inline-size: 100%;\n max-block-size: 100%;\n border: 0;\n outline: none;\n background: transparent;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n box-sizing: border-box;\n resize: none;\n overflow: hidden;\n line-height: 2.5em;\n \n}\n.has-float-label.sc-nano-input .input__native-ctrl.sc-nano-input {\n line-height: 2.1em;\n min-height: 2.1em;\n -webkit-padding-before: 1.4em;\n padding-block-start: 1.4em;\n}\n.input__native-ctrl.sc-nano-input::placeholder {\n color: var(--placeholder-color);\n font-family: inherit;\n font-style: var(--placeholder-font-style);\n font-weight: var(--placeholder-font-weight);\n opacity: var(--placeholder-opacity);\n line-height: inherit;\n min-height: initial;\n}\n.input__native-ctrl.sc-nano-input::-moz-placeholder {\n line-height: 2.8em;\n text-overflow: ellipsis;\n}\n.input__native-ctrl.sc-nano-input:-webkit-autofill {\n background-color: transparent;\n}\n.input__native-ctrl.sc-nano-input::-webkit-search-decoration, .input__native-ctrl.sc-nano-input::-webkit-search-cancel-button, .input__native-ctrl.sc-nano-input::-webkit-search-results-button, .input__native-ctrl.sc-nano-input::-webkit-search-results-decoration {\n -webkit-appearance: none;\n appearance: none;\n}\n.input__native-ctrl.sc-nano-input:invalid {\n box-shadow: none;\n}\n.input__native-ctrl.sc-nano-input::-ms-clear, .input__native-ctrl.sc-nano-input::-ms-reveal {\n display: none;\n}\n.input__native-ctrl.input__resizable.sc-nano-input {\n resize: vertical;\n overflow: auto;\n}\n.form-ctrl__textarea.sc-nano-input .input__native-ctrl.sc-nano-input {\n line-height: 1.5em;\n padding-block: var(--padding-top) 0.25em;\n white-space: pre-wrap;\n}\n.form-ctrl__textarea.sc-nano-input .input__native-ctrl.sc-nano-input::placeholder {\n line-height: 1.5em;\n}\n.has-float-label.sc-nano-input .form-ctrl__textarea.sc-nano-input .input__native-ctrl.sc-nano-input {\n -webkit-padding-before: 1.75em;\n padding-block-start: 1.75em;\n}\n[readonly].sc-nano-input-h:not([readonly=false]) .input__native-ctrl.sc-nano-input {\n -webkit-user-select: none;\n user-select: none;\n}';let h=0;const u=class{get nativeInputWrap(){return this._nativeInputWrap}set nativeInputWrap(n){if(this._nativeInputWrap===n)return;this._nativeInputWrap=n;this.setDataListOpts()}constructor(i){n(this,i);this.nanoInput=t(this,"nanoInput",7);this.nanoChange=t(this,"nanoChange",7);this.nanoBlur=t(this,"nanoBlur",7);this.nanoFocus=t(this,"nanoFocus",7);this.nanoDidLoad=t(this,"nanoDidLoad",7);this.nanoDidUnload=t(this,"nanoDidUnload",7);this.nanoValidate=t(this,"nanoValidate",7);this.inputId=`nano-input-${h++}`;this.didBlurAfterEdit=false;this.rtl=false;this.charCount=0;this.hasRendered=false;this.validate=n=>{if(this.validateOn==="submitThenDirty")this.validateOn="dirty";if(!this.nativeInput.validity.valid){if(this.showInlineError){if(n)n.preventDefault();this.errorMessage=this.nativeInput.validationMessage}this._invalid=true}else this._invalid=false;this.nanoValidate.emit({isValid:!this._invalid,errorMessage:this.nativeInput.validationMessage,originalEvent:n})};this.onInput=n=>{const t=n.target;this.value=(t===null||t===void 0?void 0:t.value)||"";this.nanoInput.emit(n)};this.onBlur=()=>{this.hasFocus=false;this.focusChanged();if(this.validateOn==="dirty")this.validate();this.nanoBlur.emit()};this.onFocus=()=>{this.hasFocus=true;this.focusChanged();this.nanoFocus.emit()};this.onKeydown=()=>{if(this.shouldClearOnEdit()){if(this.didBlurAfterEdit&&this.hasValue()){this.clearTextInput()}this.didBlurAfterEdit=false}};this.clearTextInput=n=>{if(this.clearInput&&!this.readonly&&!this.disabled&&n){n.preventDefault();n.stopPropagation()}this.value="";this.nativeInput.value="";const t=new window.Event("change");this.nativeInput.dispatchEvent(t)};this.hasFocus=false;this.hasLabelSlot=false;this.hasHelperSlot=false;this.hasHelperEndSlot=false;this.errorMessage="";this.datalist=null;this._invalid=false;this.color=undefined;this.accept=undefined;this.autocapitalise="none";this.autocomplete="off";this.autocorrect="off";this.autofocus=false;this.clearInput=false;this.clearOnEdit=undefined;this.debounce=0;this.disabled=false;this.inputmode=undefined;this.validateOn="submitThenDirty";this.showInlineError=true;this.label=undefined;this.hideLabel=false;this.floatLabel=false;this.max=undefined;this.maxlength=undefined;this.min=undefined;this.minlength=undefined;this.multiple=undefined;this.name=this.inputId;this.pattern=undefined;this.placeholder=undefined;this.readonly=false;this.required=false;this.spellcheck=false;this.step=undefined;this.size=undefined;this.type="text";this.form=undefined;this.value="";this.resize="auto";this.rows=2;this.showCharCount=false;this.validate=s(this.validate,50);this.handleBlur=this.handleBlur.bind(this)}setDataListOpts(){if(!this.datalist)return;const n=this.datalist.dropDownConfig||{};this.datalist.dropDownConfig=Object.assign(Object.assign({},n),{skidding:-1,tetherTo:this.nativeInputWrap})}get invalid(){return this._invalid}get validityMessage(){if(!this.nativeInput)return"";return this.nativeInput.validationMessage}shouldValidate(){if(!this.hasRendered)return;requestAnimationFrame((()=>{if(this.validateOn==="dirty")this.validate()}))}valueChanged(){this.nanoChange.emit({value:this.value});this.charCount=this.value.length;if(this.type==="textarea"&&this.resize==="auto"){this.nativeInput.style.height="auto";if(this.value.length)this.nativeInput.style.height=this.nativeInput.scrollHeight+"px"}requestAnimationFrame((()=>{if(this.validateOn==="dirty")this.validate()}))}debounceChanged(){this.nanoChange=l(this.nanoChange,this.debounce)}async reportValidity(n){return new Promise((t=>{if(n)this.validate();setTimeout((()=>{t({isValid:!this._invalid,errorMessage:this.nativeInput.validationMessage})}),50)}))}async setFocus(){if(this.nativeInput){this.nativeInput.focus();this.nativeInput.click()}}async select(){if(this.nativeInput){this.nativeInput.select()}}getInputElement(){return Promise.resolve(this.nativeInput)}async showError(n){if(this.nativeInput){this.nativeInput.setCustomValidity(n);this.validate()}}onReset(n){const t=this.form?document.querySelector("#"+this.form):this.el.closest("form");if(!t||n.target!==this.el.closest("form"))return;this.value=""}handleBlur(n){if(!this.hasFocus)return;const t=n;let i;requestAnimationFrame((()=>{if(n instanceof KeyboardEvent&&t.key){if(t.key!=="Tab")return;i=document.activeElement}else if(n instanceof FocusEvent){i=document.activeElement}else i=n.target;if(o(this.el.tagName.toLowerCase(),i)!==this.el){this.onBlur()}}))}shouldClearOnEdit(){const{type:n,clearOnEdit:t}=this;return t===undefined?n==="password":t}getValue(){return this.value||""}focusChanged(){if(!this.hasFocus&&this.shouldClearOnEdit()&&this.hasValue()){this.didBlurAfterEdit=true}}hasValue(){return this.getValue().length>0}slotChangeObserver(){if(this.mo)this.mo.disconnect();const n=this.mo=new MutationObserver((()=>this.processSlottedContent()));n.observe(this.el,{childList:true,subtree:true})}processSlottedContent(){this.hasLabelSlot=!!this.el.querySelectorAll('[slot="label"]');this.hasHelperSlot=!!this.el.querySelector('[slot="helper"]');this.hasHelperEndSlot=!!this.el.querySelector('[slot="helper-end"]');this.datalist=this.el.querySelector("nano-datalist:not([slot])");if(!!this.el.querySelector('[slot="inline-button"]')){console.warn("The `inline-button` slot was renamed to `end` in v2 - please update your code",this.el)}}connectedCallback(){this.debounceChanged();{this.el.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.el}))}}disconnectedCallback(){{document.dispatchEvent(new CustomEvent("nanoDidUnload",{detail:this.el}))}if(this.mo)this.mo.disconnect()}componentDidLoad(){this.slotChangeObserver();this.hasRendered=true;if(this.autofocus)setTimeout((n=>this.setFocus()),300)}componentWillLoad(){this.processSlottedContent()}render(){const n=this.getValue();const t=this.inputId+"-lbl";const e=this.showInlineError||this.hasHelperSlot?this.inputId+"-more":"";const o=this.hasHelperEndSlot?this.inputId+"-helper":"";this.rtl=this.el.ownerDocument.dir==="rtl";const s=(({el:n,floatLabel:t,label:i,errorMessage:a,type:e,showInlineError:o,hasHelperSlot:r,hasLabelSlot:s,hideLabel:l,placeholder:c,maxlength:p,charCount:d,showCharCount:h,rtl:u,hasHelperEndSlot:f})=>({el:n,floatLabel:t,label:i,errorMessage:a,type:e,showInlineError:o,hasHelperSlot:r,hasLabelSlot:s,hideLabel:l,placeholder:c,maxlength:p,charCount:d,showCharCount:h,rtl:u,hasHelperEndSlot:f}))(this);const l=Object.assign(Object.assign({},s),{labelId:t,moreId:e,helperEndId:o,hasValue:this.hasValue(),controlId:this.inputId});const d=(({clearInput:n,readonly:t,disabled:i})=>({clearInput:n,readonly:t,disabled:i,clearControl:this.clearInput}))(this);return i(a,{"aria-disabled":this.disabled?"true":null,dir:this.rtl?"rtl":null,class:Object.assign(Object.assign({},r(this.color)),{"has-value":this.hasValue(),"has-focus":this.hasFocus,"is-invalid":this._invalid})},i("div",{style:{width:"100%"}},i(c,Object.assign({},l),i(p,Object.assign({},d,{onClearText:this.clearTextInput,control:this.el,ref:n=>this.nativeInputWrap=n}),this.type!=="textarea"&&i("input",{id:this.inputId,class:"input__native-ctrl",ref:n=>this.nativeInput=n,"aria-labelledby":t+" "+e+" "+o,disabled:this.disabled,accept:this.accept,autoCapitalize:this.autocapitalise,autoComplete:this.autocomplete,autoCorrect:this.autocorrect,autoFocus:this.autofocus,inputMode:this.inputmode,form:this.form,min:this.min,max:this.max,minLength:this.minlength,maxLength:this.maxlength,multiple:this.multiple,name:this.name,pattern:this.pattern,placeholder:this.placeholder,readOnly:this.readonly,required:this.required,spellcheck:this.spellcheck,step:this.step,size:this.size,type:this.type,value:n,onInput:this.onInput,onChange:this.onInput,onFocus:this.onFocus,onBlur:this.handleBlur,onKeyDown:this.onKeydown,onInvalid:this.validate}),this.type==="textarea"&&i("textarea",{rows:this.floatLabel?1:this.rows,id:this.inputId,class:{"input__native-ctrl":true,input__resizable:this.resize==="true"},ref:n=>this.nativeInput=n,"aria-labelledby":t+" "+e+" "+o,disabled:this.disabled,autoCapitalize:this.autocapitalise,autoCorrect:this.autocorrect,autoFocus:this.autofocus,inputMode:this.inputmode,form:this.form,minLength:this.minlength,maxLength:this.maxlength,name:this.name,placeholder:this.placeholder,readOnly:this.readonly,required:this.required,spellcheck:this.spellcheck,value:n,onInput:this.onInput,onChange:this.onInput,onFocus:this.onFocus,onKeyDown:this.onKeydown,onInvalid:this.validate,onBlur:this.handleBlur}))),i("slot",null)))}get el(){return e(this)}static get watchers(){return{datalist:["setDataListOpts"],minlength:["shouldValidate"],maxlength:["shouldValidate"],min:["shouldValidate"],max:["shouldValidate"],required:["shouldValidate"],disabled:["shouldValidate"],readonly:["shouldValidate"],pattern:["shouldValidate"],inputmode:["shouldValidate"],value:["valueChanged"],debounce:["debounceChanged"]}}};u.style=d;export{u as nano_input};
5
+ //# sourceMappingURL=p-565793a2.entry.js.map
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Web Components for Nanopore digital Web Apps
3
+ */
4
+ import{r as t,c as i,d as s,h as e,a as n,g as r}from"./p-f6a8467a.js";const h=class{constructor(e){t(this,e);this.nanoResizeStateChange=i(this,"nanoResizeStateChange",7);this.nanoResizeObserverReady=i(this,"nanoResizeObserverReady",7);this.nanoResizeContentFitChange=i(this,"nanoResizeContentFitChange",7);this.nanoResize=i(this,"nanoResize",7);this.isReady=false;this.assessChanges=()=>{if(!this.currentWidth&&!this.currentHeight)return;s((()=>this.assesContentFit()));if(!this.states||!this.appliedStates)return;const t={h:new Map,w:new Map};let i=false;Object.keys(this.appliedStates).forEach((s=>{let e;if(s==="h")e=this.currentHeight;else e=this.currentWidth;this.appliedStates[s].forEach(((n,r)=>{if(e>=r&&n.applied===false){n.applied=true;t[s].set(r,n);i=true}else if(e<r&&n.applied===true){n.applied=false;t[s].set(r,n);i=true}}))}));if(i)this.applyChanges(t);else if(!this.classNames.includes("is-ready"))this.classNames=[...this.classNames,"is-ready"]};this.currentWidth=undefined;this.currentHeight=undefined;this.classNames=[];this.contentFitX=null;this.contentFitY=null;this.notifyContentFit=undefined;this.states=undefined}classNameChange(){this.host.className=this.classNames.join(" ");if(!this.isReady&&this.classNames.includes("is-ready")){this.isReady=true;this.nanoResizeObserverReady.emit()}}newStatesProp(){this.statesChanged()}dimensionChanged(){this.assessChanges()}statesChanged(){if(!this.states)return;const t=t=>{const i=t.split(/(\d+)/).filter((t=>t.length));return{bp:parseInt(i[0]),dir:i[1]}};this.appliedStates={h:new Map,w:new Map};this.states.split(",").map((i=>{i=i.trim();if(i.includes(" ")){const[s,...e]=i.split(" ");const{bp:n,dir:r}=t(s);this.appliedStates[r].set(n,{states:e,applied:false})}else{const{bp:s,dir:e}=t(i);this.appliedStates[e].set(s,{applied:false})}}))}assesContentFit(){if(!this.notifyContentFit)return;const t=t=>{if(window.getComputedStyle(t).display!=="contents")return t;const i=t=>Array.from(t.children).find((t=>{if(window.getComputedStyle(t).display!=="contents")return t;i(t)}));return i(t)};let i=false;const s=t(this.host.firstElementChild);if(s){if(this.notifyContentFit&&this.notifyContentFit.includes("x")){if(this.currentWidth<s.scrollWidth&&this.contentFitX!==false){i=true;this.contentFitX=false}else if(this.currentWidth>=s.scrollWidth&&this.contentFitX!==true){i=true;this.contentFitX=true}}if(this.notifyContentFit&&this.notifyContentFit.includes("y")){if(this.currentHeight<s.scrollHeight&&this.contentFitY!==false){i=true;this.contentFitY=false}else if(this.currentHeight>=s.scrollHeight&&this.contentFitY!==true){i=true;this.contentFitY=true}}if(i){this.nanoResizeContentFitChange.emit({x:this.contentFitX,y:this.contentFitY})}}}applyChanges(t){if(!this.states)return;let i=[...this.classNames];Object.keys(t).forEach((s=>{t[s].forEach((t=>{if(!t.states)return;t.states.map((s=>{if(t.applied){i.push(s);i=i.filter((t=>t!=="not-"+s))}else{i.push("not-"+s);i=i.filter((t=>t!==s))}}))}))}));this.classNames=["is-ready",...i];this.nanoResizeStateChange.emit(this.toSimpleObj(t))}toSimpleObj(t){const i={};Object.keys(t).forEach((s=>{t[s].forEach(((t,e)=>{i[e+s]=t.applied}))}));return i}attachRO(){if(!window["ResizeObserver"])return;this.ro=new ResizeObserver((t=>{const{width:i,height:s}=this.host.getBoundingClientRect();this.currentWidth=Math.ceil(i);this.currentHeight=Math.ceil(s);this.nanoResize.emit(t)}));this.ro.observe(this.host)}componentWillLoad(){this.classNames=Array.from(this.host.classList);this.statesChanged();this.applyChanges(this.appliedStates);if(!this.currentWidth&&!this.currentHeight){s((()=>{const{width:t,height:i}=this.host.getBoundingClientRect();this.currentWidth=Math.ceil(t);this.currentHeight=Math.ceil(i)}))}else{this.assessChanges()}}connectedCallback(){if(!this.ro)this.attachRO()}disconnectedCallback(){if(this.ro)this.ro.disconnect()}render(){return e(n,null,e("slot",null),!!this.notifyContentFit&&(this.contentFitX!==null||this.contentFitY!==null)&&[!!this.contentFitX?e("slot",{name:"content-fit-x"}):e("slot",{name:"content-nofit-x"}),!!this.contentFitY?e("slot",{name:"content-fit-y"}):e("slot",{name:"content-nofit-y"})])}get host(){return r(this)}static get watchers(){return{classNames:["classNameChange"],states:["newStatesProp","statesChanged"],currentHeight:["dimensionChanged"],currentWidth:["dimensionChanged"]}}};h.style="nano-resize-observe { display: contents }";const a=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--base-color-rgb:var(--nano-skeleton-rgb, 228 230 232);--color:var(--nano-skeleton-color, rgb(var(--base-color-rgb) / 100%));--tint:var(--nano-skeleton-tint, rgb(var(--base-color-rgb) / 50%));display:block;position:relative;border-radius:0.25rem;min-block-size:1em;line-height:inherit}.skeleton{display:flex;min-inline-size:100%;min-block-size:100%;border-radius:inherit;line-height:inherit}.skeleton__indicator{flex:1 1 auto;background:var(--color);border-radius:inherit;line-height:inherit}.skeleton.animate .skeleton__indicator{background:linear-gradient(270deg, var(--tint), var(--color), var(--color), var(--tint));background-size:400% 100%;animation:loader 6s ease-in-out infinite}@keyframes loader{0%{background-position:200% 0}100%{background-position:-200% 0}}";const o=class{constructor(i){t(this,i);this.animated=true}render(){return e("div",{class:{skeleton:true,animate:this.animated}},e("div",{class:"skeleton__indicator"}," "))}};o.style=a;export{h as nano_resize_observe,o as nano_skeleton};
5
+ //# sourceMappingURL=p-5aae2588.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ResizeObserve","this","isReady","assessChanges","currentWidth","currentHeight","readTask","assesContentFit","states","appliedStates","changedStates","h","Map","w","hasChanged","Object","keys","forEach","dimType","dim","state","bp","applied","set","applyChanges","classNames","includes","classNameChange","host","className","join","nanoResizeObserverReady","emit","newStatesProp","statesChanged","dimensionChanged","toBpDir","bpDir","bpDirSpl","split","filter","bs","length","parseInt","dir","map","st","trim","key","classes","notifyContentFit","findNonContentsEle","ele","window","getComputedStyle","display","recurse","e","Array","from","children","find","cEle","didChange","measureEle","firstElementChild","scrollWidth","contentFitX","scrollHeight","contentFitY","nanoResizeContentFitChange","x","y","changes","push","cl","nanoResizeStateChange","toSimpleObj","stateMaps","retObj","attachRO","ro","ResizeObserver","width","height","getBoundingClientRect","Math","ceil","nanoResize","observe","componentWillLoad","classList","connectedCallback","disconnectedCallback","disconnect","render","Host","name","skeletonCss","Skeleton","class","skeleton","animate","animated"],"sources":["./src/components/resize-observe/resize-observe.tsx","./src/components/skeleton/skeleton.scss?tag=nano-skeleton&encapsulation=shadow","./src/components/skeleton/skeleton.tsx"],"sourcesContent":["import {\n Component,\n h,\n Prop,\n Element,\n Host,\n State,\n Watch,\n ComponentInterface,\n Event,\n EventEmitter,\n readTask,\n} from '@stencil/core';\nimport type { ResizeStateChangeEventDetail } from '../../interface';\n\ntype ResizeObserverState = { states?: string[]; applied?: boolean };\ninterface StateMaps {\n h: Map<number, ResizeObserverState>;\n w: Map<number, ResizeObserverState>;\n}\n\n/**\n * A Resize-Observer utility component.\n * Takes a string list of sizes and optional class-names.\n * Adds class-names and fires `nanoResizeStateChange` events when the component reaches those sizes.\n * Additionally, can fire events when content no-longer fits within the element.\n * @slot - Main slot for any content.\n * @slot content-fit-x - optional slot (when `notifyContentFit` is set). Shows when content fits / doesn't get cut off\n * @slot content-nofit-x - optional slot (when `notifyContentFit` is set). Shows when content doesn't get cut off\n * @slot content-fit-y - optional slot (when `notifyContentFit` is set). Shows when content fits / doesn't get cut off\n * @slot content-nofit-y - optional slot (when `notifyContentFit` is set). Shows when content doesn't get cut off\n */\n@Component({\n tag: 'nano-resize-observe',\n styles: `nano-resize-observe { display: contents }`,\n shadow: true,\n})\nexport class ResizeObserve implements ComponentInterface {\n private ro: ResizeObserver;\n private appliedStates: StateMaps;\n private isReady = false;\n\n @Element() host: HTMLNanoResizeObserveElement;\n @State() currentWidth: number;\n @State() currentHeight: number;\n @State() classNames: string[] = [];\n @State() contentFitX = null;\n @State() contentFitY = null;\n\n @Watch('classNames')\n classNameChange() {\n this.host.className = this.classNames.join(' ');\n if (!this.isReady && this.classNames.includes('is-ready')) {\n this.isReady = true;\n this.nanoResizeObserverReady.emit();\n }\n }\n\n /** Fire `nanoResizeContentFitChange` events notifying\n * whether content currently fits or does not on the x, y or both axis'.\n * Also makes the `content-fit-...` slots available */\n @Prop() notifyContentFit: 'x' | 'y' | 'xy';\n\n /** string list of sizes and optional class-names.\n * Adds class-names and fires nanoResizeStateChange events. Upon hitting breakpoints.\n * Format: `states=\"800w, 300h class1 class2\"` */\n @Prop() states: string;\n\n @Watch('states')\n newStatesProp() {\n this.statesChanged();\n }\n\n /** A resize break point is switched on or off */\n @Event() nanoResizeStateChange!: EventEmitter<ResizeStateChangeEventDetail>;\n\n /** Fires after the initial loading and assessment */\n @Event() nanoResizeObserverReady!: EventEmitter<void>;\n\n /** Fires when the content either begins or stops fitting.\n * Will only work when `notifyContentFit` is set. */\n @Event() nanoResizeContentFitChange!: EventEmitter<{\n x: boolean;\n y: boolean;\n }>;\n\n /** Fires after any resizing */\n @Event() nanoResize!: EventEmitter<ResizeObserverEntry[]>;\n\n @Watch('currentHeight')\n @Watch('currentWidth')\n dimensionChanged() {\n this.assessChanges();\n }\n\n @Watch('states')\n statesChanged() {\n if (!this.states) return;\n\n const toBpDir = (bpDir: string) => {\n const bpDirSpl = bpDir.split(/(\\d+)/).filter((bs) => bs.length);\n return { bp: parseInt(bpDirSpl[0]), dir: bpDirSpl[1] };\n };\n this.appliedStates = { h: new Map(), w: new Map() };\n\n // parse state string\n this.states.split(',').map((st) => {\n st = st.trim();\n if (st.includes(' ')) {\n const [key, ...classes] = st.split(' ');\n const { bp, dir } = toBpDir(key);\n this.appliedStates[dir as keyof StateMaps].set(bp, {\n states: classes,\n applied: false,\n });\n } else {\n const { bp, dir } = toBpDir(st);\n this.appliedStates[dir as keyof StateMaps].set(bp, { applied: false });\n }\n });\n }\n\n private assesContentFit() {\n if (!this.notifyContentFit) return;\n\n const findNonContentsEle = (ele: Element) => {\n if (window.getComputedStyle(ele).display !== 'contents') return ele;\n\n const recurse = (e: Element): Element | null => {\n return Array.from(e.children).find((cEle: HTMLElement) => {\n if (window.getComputedStyle(cEle).display !== 'contents') return cEle;\n recurse(cEle);\n });\n };\n return recurse(ele);\n };\n\n let didChange = false;\n const measureEle = findNonContentsEle(this.host.firstElementChild);\n\n if (measureEle) {\n if (this.notifyContentFit && this.notifyContentFit.includes('x')) {\n if (\n this.currentWidth < measureEle.scrollWidth &&\n this.contentFitX !== false\n ) {\n didChange = true;\n this.contentFitX = false;\n } else if (\n this.currentWidth >= measureEle.scrollWidth &&\n this.contentFitX !== true\n ) {\n didChange = true;\n this.contentFitX = true;\n }\n }\n\n if (this.notifyContentFit && this.notifyContentFit.includes('y')) {\n if (\n this.currentHeight < measureEle.scrollHeight &&\n this.contentFitY !== false\n ) {\n didChange = true;\n this.contentFitY = false;\n } else if (\n this.currentHeight >= measureEle.scrollHeight &&\n this.contentFitY !== true\n ) {\n didChange = true;\n this.contentFitY = true;\n }\n }\n\n if (didChange) {\n this.nanoResizeContentFitChange.emit({\n x: this.contentFitX,\n y: this.contentFitY,\n });\n }\n }\n }\n\n private assessChanges = () => {\n if (!this.currentWidth && !this.currentHeight) return;\n readTask(() => this.assesContentFit());\n\n if (!this.states || !this.appliedStates) return;\n\n const changedStates: StateMaps = { h: new Map(), w: new Map() };\n let hasChanged = false;\n\n Object.keys(this.appliedStates).forEach((dimType) => {\n let dim: number;\n if (dimType === 'h') dim = this.currentHeight;\n else dim = this.currentWidth;\n\n this.appliedStates[dimType].forEach(\n (state: ResizeObserverState, bp: number) => {\n if (dim >= bp && state.applied === false) {\n state.applied = true;\n changedStates[dimType].set(bp, state);\n hasChanged = true;\n } else if (dim < bp && state.applied === true) {\n state.applied = false;\n changedStates[dimType].set(bp, state);\n hasChanged = true;\n }\n }\n );\n });\n if (hasChanged) this.applyChanges(changedStates);\n else if (!this.classNames.includes('is-ready'))\n this.classNames = [...this.classNames, 'is-ready'];\n };\n\n private applyChanges(changes: StateMaps) {\n if (!this.states) return;\n\n let classNames = [...this.classNames];\n Object.keys(changes).forEach((dimType: keyof StateMaps) => {\n changes[dimType].forEach((state) => {\n if (!state.states) return;\n state.states.map((st) => {\n if (state.applied) {\n classNames.push(st);\n classNames = classNames.filter((cl) => cl !== 'not-' + st);\n } else {\n classNames.push('not-' + st);\n classNames = classNames.filter((cl) => cl !== st);\n }\n });\n });\n });\n this.classNames = ['is-ready', ...classNames];\n this.nanoResizeStateChange.emit(this.toSimpleObj(changes));\n }\n\n private toSimpleObj(stateMaps: StateMaps) {\n const retObj = {};\n Object.keys(stateMaps).forEach((dimType: keyof StateMaps) => {\n stateMaps[dimType].forEach((state: ResizeObserverState, bp: number) => {\n retObj[bp + dimType] = state.applied;\n });\n });\n return retObj;\n }\n\n private attachRO() {\n if (!window['ResizeObserver']) return;\n\n this.ro = new ResizeObserver((ro) => {\n const { width, height } = this.host.getBoundingClientRect();\n this.currentWidth = Math.ceil(width);\n this.currentHeight = Math.ceil(height);\n this.nanoResize.emit(ro);\n });\n this.ro.observe(this.host);\n }\n\n componentWillLoad() {\n this.classNames = Array.from(this.host.classList);\n\n this.statesChanged();\n // set all class as 'not-' by deafult\n this.applyChanges(this.appliedStates);\n\n if (!this.currentWidth && !this.currentHeight) {\n readTask(() => {\n const { width, height } = this.host.getBoundingClientRect();\n this.currentWidth = Math.ceil(width);\n this.currentHeight = Math.ceil(height);\n });\n } else {\n this.assessChanges();\n }\n }\n\n connectedCallback() {\n if (!this.ro) this.attachRO();\n }\n\n disconnectedCallback() {\n if (this.ro) this.ro.disconnect();\n }\n\n render() {\n return (\n <Host>\n <slot />\n {!!this.notifyContentFit &&\n (this.contentFitX !== null || this.contentFitY !== null) && [\n !!this.contentFitX ? (\n <slot name=\"content-fit-x\" />\n ) : (\n <slot name=\"content-nofit-x\" />\n ),\n !!this.contentFitY ? (\n <slot name=\"content-fit-y\" />\n ) : (\n <slot name=\"content-nofit-y\" />\n ),\n ]}\n </Host>\n );\n }\n}\n","@import '../../global/style/nano-theme/components';\n\n:host {\n /**\n * @prop --base-color-rgb: default #{$skeleton-color-rgb};\n * @prop --color: default var(--nano-skeleton-color, rgba(var(--base-color-rgb), 1));\n * @prop --tint: default var(--nano-skeleton-tint, rgba(var(--base-color-rgb), .3));\n */\n\n --base-color-rgb: #{$skeleton-color-rgb};\n --color: var(--nano-skeleton-color, rgb(var(--base-color-rgb) / 100%));\n --tint: var(--nano-skeleton-tint, rgb(var(--base-color-rgb) / 50%));\n\n display: block;\n position: relative;\n border-radius: 0.25rem;\n min-block-size: 1em;\n line-height: inherit;\n}\n\n.skeleton {\n display: flex;\n min-inline-size: 100%;\n min-block-size: 100%;\n border-radius: inherit;\n line-height: inherit;\n}\n\n.skeleton__indicator {\n flex: 1 1 auto;\n background: var(--color);\n border-radius: inherit;\n line-height: inherit;\n}\n\n.skeleton.animate .skeleton__indicator {\n background:\n linear-gradient(\n 270deg,\n var(--tint),\n var(--color),\n var(--color),\n var(--tint)\n );\n background-size: 400% 100%;\n animation: loader 6s ease-in-out infinite;\n}\n\n@keyframes loader {\n 0% {\n background-position: 200% 0;\n }\n\n 100% {\n background-position: -200% 0;\n }\n}\n","import { Component, Prop, h, ComponentInterface } from '@stencil/core';\n\n/**\n * Skeletons are used to show where content will eventually be drawn.\n * Simple containers for scaffolding layouts that mimic what users will see when content has finished loading.\n * Prevents large areas of empty space during asynchronous operations.\n */\n@Component({\n tag: 'nano-skeleton',\n styleUrl: 'skeleton.scss',\n shadow: true,\n})\nexport class Skeleton implements ComponentInterface {\n /** When `true`, the skeleton will animate. */\n @Prop() animated = true;\n\n render() {\n return (\n <div\n class={{\n skeleton: true,\n animate: this.animated,\n }}\n >\n <div class=\"skeleton__indicator\">&nbsp;</div>\n </div>\n );\n }\n}\n"],"mappings":";;;6EAqCaA,EAAa,M,qQAGhBC,KAAAC,QAAU,MA8IVD,KAAAE,cAAgB,KACtB,IAAKF,KAAKG,eAAiBH,KAAKI,cAAe,OAC/CC,GAAS,IAAML,KAAKM,oBAEpB,IAAKN,KAAKO,SAAWP,KAAKQ,cAAe,OAEzC,MAAMC,EAA2B,CAAEC,EAAG,IAAIC,IAAOC,EAAG,IAAID,KACxD,IAAIE,EAAa,MAEjBC,OAAOC,KAAKf,KAAKQ,eAAeQ,SAASC,IACvC,IAAIC,EACJ,GAAID,IAAY,IAAKC,EAAMlB,KAAKI,mBAC3Bc,EAAMlB,KAAKG,aAEhBH,KAAKQ,cAAcS,GAASD,SAC1B,CAACG,EAA4BC,KAC3B,GAAIF,GAAOE,GAAMD,EAAME,UAAY,MAAO,CACxCF,EAAME,QAAU,KAChBZ,EAAcQ,GAASK,IAAIF,EAAID,GAC/BN,EAAa,I,MACR,GAAIK,EAAME,GAAMD,EAAME,UAAY,KAAM,CAC7CF,EAAME,QAAU,MAChBZ,EAAcQ,GAASK,IAAIF,EAAID,GAC/BN,EAAa,I,IAGlB,IAEH,GAAIA,EAAYb,KAAKuB,aAAad,QAC7B,IAAKT,KAAKwB,WAAWC,SAAS,YACjCzB,KAAKwB,WAAa,IAAIxB,KAAKwB,WAAY,WAAW,E,yEAvKtB,G,iBACT,K,iBACA,K,sDAGvBE,kBACE1B,KAAK2B,KAAKC,UAAY5B,KAAKwB,WAAWK,KAAK,KAC3C,IAAK7B,KAAKC,SAAWD,KAAKwB,WAAWC,SAAS,YAAa,CACzDzB,KAAKC,QAAU,KACfD,KAAK8B,wBAAwBC,M,EAejCC,gBACEhC,KAAKiC,e,CAqBPC,mBACElC,KAAKE,e,CAIP+B,gBACE,IAAKjC,KAAKO,OAAQ,OAElB,MAAM4B,EAAWC,IACf,MAAMC,EAAWD,EAAME,MAAM,SAASC,QAAQC,GAAOA,EAAGC,SACxD,MAAO,CAAErB,GAAIsB,SAASL,EAAS,IAAKM,IAAKN,EAAS,GAAI,EAExDrC,KAAKQ,cAAgB,CAAEE,EAAG,IAAIC,IAAOC,EAAG,IAAID,KAG5CX,KAAKO,OAAO+B,MAAM,KAAKM,KAAKC,IAC1BA,EAAKA,EAAGC,OACR,GAAID,EAAGpB,SAAS,KAAM,CACpB,MAAOsB,KAAQC,GAAWH,EAAGP,MAAM,KACnC,MAAMlB,GAAEA,EAAEuB,IAAEA,GAAQR,EAAQY,GAC5B/C,KAAKQ,cAAcmC,GAAwBrB,IAAIF,EAAI,CACjDb,OAAQyC,EACR3B,QAAS,O,KAEN,CACL,MAAMD,GAAEA,EAAEuB,IAAEA,GAAQR,EAAQU,GAC5B7C,KAAKQ,cAAcmC,GAAwBrB,IAAIF,EAAI,CAAEC,QAAS,O,KAK5Df,kBACN,IAAKN,KAAKiD,iBAAkB,OAE5B,MAAMC,EAAsBC,IAC1B,GAAIC,OAAOC,iBAAiBF,GAAKG,UAAY,WAAY,OAAOH,EAEhE,MAAMI,EAAWC,GACRC,MAAMC,KAAKF,EAAEG,UAAUC,MAAMC,IAClC,GAAIT,OAAOC,iBAAiBQ,GAAMP,UAAY,WAAY,OAAOO,EACjEN,EAAQM,EAAK,IAGjB,OAAON,EAAQJ,EAAI,EAGrB,IAAIW,EAAY,MAChB,MAAMC,EAAab,EAAmBlD,KAAK2B,KAAKqC,mBAEhD,GAAID,EAAY,CACd,GAAI/D,KAAKiD,kBAAoBjD,KAAKiD,iBAAiBxB,SAAS,KAAM,CAChE,GACEzB,KAAKG,aAAe4D,EAAWE,aAC/BjE,KAAKkE,cAAgB,MACrB,CACAJ,EAAY,KACZ9D,KAAKkE,YAAc,K,MACd,GACLlE,KAAKG,cAAgB4D,EAAWE,aAChCjE,KAAKkE,cAAgB,KACrB,CACAJ,EAAY,KACZ9D,KAAKkE,YAAc,I,EAIvB,GAAIlE,KAAKiD,kBAAoBjD,KAAKiD,iBAAiBxB,SAAS,KAAM,CAChE,GACEzB,KAAKI,cAAgB2D,EAAWI,cAChCnE,KAAKoE,cAAgB,MACrB,CACAN,EAAY,KACZ9D,KAAKoE,YAAc,K,MACd,GACLpE,KAAKI,eAAiB2D,EAAWI,cACjCnE,KAAKoE,cAAgB,KACrB,CACAN,EAAY,KACZ9D,KAAKoE,YAAc,I,EAIvB,GAAIN,EAAW,CACb9D,KAAKqE,2BAA2BtC,KAAK,CACnCuC,EAAGtE,KAAKkE,YACRK,EAAGvE,KAAKoE,a,GAuCR7C,aAAaiD,GACnB,IAAKxE,KAAKO,OAAQ,OAElB,IAAIiB,EAAa,IAAIxB,KAAKwB,YAC1BV,OAAOC,KAAKyD,GAASxD,SAASC,IAC5BuD,EAAQvD,GAASD,SAASG,IACxB,IAAKA,EAAMZ,OAAQ,OACnBY,EAAMZ,OAAOqC,KAAKC,IAChB,GAAI1B,EAAME,QAAS,CACjBG,EAAWiD,KAAK5B,GAChBrB,EAAaA,EAAWe,QAAQmC,GAAOA,IAAO,OAAS7B,G,KAClD,CACLrB,EAAWiD,KAAK,OAAS5B,GACzBrB,EAAaA,EAAWe,QAAQmC,GAAOA,IAAO7B,G,IAEhD,GACF,IAEJ7C,KAAKwB,WAAa,CAAC,cAAeA,GAClCxB,KAAK2E,sBAAsB5C,KAAK/B,KAAK4E,YAAYJ,G,CAG3CI,YAAYC,GAClB,MAAMC,EAAS,GACfhE,OAAOC,KAAK8D,GAAW7D,SAASC,IAC9B4D,EAAU5D,GAASD,SAAQ,CAACG,EAA4BC,KACtD0D,EAAO1D,EAAKH,GAAWE,EAAME,OAAO,GACpC,IAEJ,OAAOyD,C,CAGDC,WACN,IAAK3B,OAAO,kBAAmB,OAE/BpD,KAAKgF,GAAK,IAAIC,gBAAgBD,IAC5B,MAAME,MAAEA,EAAKC,OAAEA,GAAWnF,KAAK2B,KAAKyD,wBACpCpF,KAAKG,aAAekF,KAAKC,KAAKJ,GAC9BlF,KAAKI,cAAgBiF,KAAKC,KAAKH,GAC/BnF,KAAKuF,WAAWxD,KAAKiD,EAAG,IAE1BhF,KAAKgF,GAAGQ,QAAQxF,KAAK2B,K,CAGvB8D,oBACEzF,KAAKwB,WAAaiC,MAAMC,KAAK1D,KAAK2B,KAAK+D,WAEvC1F,KAAKiC,gBAELjC,KAAKuB,aAAavB,KAAKQ,eAEvB,IAAKR,KAAKG,eAAiBH,KAAKI,cAAe,CAC7CC,GAAS,KACP,MAAM6E,MAAEA,EAAKC,OAAEA,GAAWnF,KAAK2B,KAAKyD,wBACpCpF,KAAKG,aAAekF,KAAKC,KAAKJ,GAC9BlF,KAAKI,cAAgBiF,KAAKC,KAAKH,EAAO,G,KAEnC,CACLnF,KAAKE,e,EAITyF,oBACE,IAAK3F,KAAKgF,GAAIhF,KAAK+E,U,CAGrBa,uBACE,GAAI5F,KAAKgF,GAAIhF,KAAKgF,GAAGa,Y,CAGvBC,SACE,OACEpF,EAACqF,EAAI,KACHrF,EAAA,eACGV,KAAKiD,mBACLjD,KAAKkE,cAAgB,MAAQlE,KAAKoE,cAAgB,OAAS,GACxDpE,KAAKkE,YACLxD,EAAA,QAAMsF,KAAK,kBAEXtF,EAAA,QAAMsF,KAAK,sBAEXhG,KAAKoE,YACL1D,EAAA,QAAMsF,KAAK,kBAEXtF,EAAA,QAAMsF,KAAK,qB,4PC3SzB,MAAMC,EAAc,k3B,MCYPC,EAAQ,M,uCAEA,I,CAEnBJ,SACE,OACEpF,EAAA,OACEyF,MAAO,CACLC,SAAU,KACVC,QAASrG,KAAKsG,WAGhB5F,EAAA,OAAKyF,MAAM,uBAAqB,K"}
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{r as t,c as i,w as s,h as e,a as h,g as n}from"./p-f6a8467a.js";import{C as l}from"./p-a6ff5ca6.js";import{W as r}from"./p-60a8c896.js";import"./p-9746b0a5.js";import"./p-69a3e911.js";const o=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{display:none}:host ::slotted([slot=filter-template]){display:none !important}:host(.show-filter){display:block}";const a=class{constructor(s){t(this,s);this.nanoFilterChanged=i(this,"nanoFilterChanged",7);this.nanoTplUpdated=i(this,"nanoTplUpdated",7);this.filterId=null;this.tplWillRnder=new Promise((t=>{this.tplDidRnder=t}));this.changeEvent=undefined;this.internalValue=[undefined];this.showFilter=false;this.indexResults=null;this.filterChanged=null;this.facets=undefined;this.tplRenderFn=undefined;this.globalStoreMethod=undefined;this.filterName=null;this.value="";this.operator="or";this.storeId=undefined;this.storeMethod="session"}valueSet(){const t=this.value;let i;if(typeof t==="string")i=t.length?t.split("|"):[];else i=this.value;if(this.didValueChange(i)){const t=this.setFieldValues(i);if(t&&t.length)this.internalValue=i;else{this.tplWillRnder.then((t=>{this.setFieldValues(i);this.internalValue=i}))}}}valueChanged(){this.value=this.internalValue;this.nanoFilterChanged.emit({filterId:this.filterId,facetName:this.filterName,value:this.internalValue,operator:this.operator})}appliedFilterChanged(){if(this.filterName&&this.filterChanged&&(this.filterChanged!==this.filterId||this.operator==="and")){this.updateContent()}}tplUpdate(){this.updateContent()}handleFilterChange(){if(this.indexResults&&this.indexResults.appliedFilters){const t=this.indexResults.appliedFilters.find((t=>t.name===this.filterName));if(!t)return;this.tplWillRnder.then((i=>{const s=this.setFieldValues(t.values);if(s&&s.length)this.value=s}))}this.updateContent()}handleChangeEvent(){const t=this.getFieldValues();if(this.didValueChange(t)){this.internalValue=t;return true}return false}updateContent(){const t=this.outputSlot||this.outputEle;if(!this.el)return;if(!this.templateStr)this.showFilter=true;else if(!this.filterName||!t||this.templateStr&&(!this.indexResults||!this.indexResults.origFilters[this.filterName])){this.showFilter=false}if(!t)return;if(!this.indexResults){if(this.templateStr){s((()=>{t.innerHTML=this.tplRenderFn(this.templateStr,{orig:{},dyn:{},selected:this.internalValue&&this.internalValue.length?this.internalValue:this.value});if(!this.value||!this.value.length)this.handleChangeEvent()}))}else if(!this.value||!this.value.length)this.handleChangeEvent();return}s((()=>{t.innerHTML=this.tplRenderFn(this.templateStr,{orig:Object.assign({},this.indexResults.origFilters[this.filterName]),dyn:Object.assign({},this.indexResults.dynFilters[this.filterName]),selected:this.internalValue&&this.internalValue.length?this.internalValue:this.value});this.tplDidRnder();this.setFieldValues();if(!this.showFilter)this.showFilter=true;this.nanoTplUpdated.emit(this.el)}))}getFieldValues(){const t=[];const i=this.outputSlot.querySelectorAll('input[type="checkbox"], input[type="radio"], select');for(let s=0;s<i.length;s++){const e=i[s];if(e.type==="select-multiple"){const i=e;for(let s=0;s<i.options.length;s++){if(!i.options[s].selected||!i.options[s].value.length)continue;t.push(i.options[s].value)}}else if(e.type!=="checkbox"&&e.type!=="radio"||e.checked&&e.value.length){t.push(e.value)}}return t}setFieldValues(t){t=t||this.internalValue;if(!t)return;const i=[];const s=this.outputSlot.querySelectorAll('input[type="checkbox"], input[type="radio"], select, nano-select, nano-checkbox');for(let e=0;e<s.length;e++){const h=s[e];if(h.disabled||h.type==="file"||h.type==="reset"||h.type==="submit"||h.type==="button")continue;if(h.type==="select-multiple"||h.type==="select-one"){const s=h;for(let e=0;e<s.options.length;e++){if(!t.includes(s.options[e].value))s.options[e].selected=false;else{i.push(s.value);s.options[e].selected=true;if(h.type==="select-one")s.value=s.options[e].value}}}else if(["checkbox","radio","tag","segment","segment-pill"].includes(h.type)){if(t.includes(h.value)){i.push(h.value);h.checked=true}else if(!t.length&&!h.value.length){h.checked=true}else h.checked=false}}return i}didValueChange(t){if(!!this.internalValue&&!t)return true;if(!this.internalValue&&!t)return false;if(this.internalValue&&t.length!==this.internalValue.length)return true;let i=false;for(let s=0;s<t.length;s++){if(!i&&(!this.internalValue||!this.internalValue.includes(t[s])))i=true}return i}connectedCallback(){this.templateSlot=this.el.querySelector('[slot="filter-template"]');this.outputSlot=this.el.querySelector('[slot="output"]');this.filterId=this.filterName+"_"+f++;if(!!this.templateSlot){this.templateStr=this.templateSlot.innerHTML;this.templateStr=this.templateStr.replace(/=&gt;/gm,"=>")}}componentWillLoad(){if(this.storeId)l.init(this,["value"],this.storeMethod||this.globalStoreMethod,this.storeId)}componentDidLoad(){this.updateContent();if(this.templateStr&&this.filterName&&this.indexResults&&this.indexResults.origFilters[this.filterName])this.showFilter=true}render(){return e(h,{class:{"show-filter":this.showFilter}},e("div",{ref:t=>this.outputEle=t},e("slot",{name:"output"})))}get el(){return n(this)}static get watchers(){return{value:["valueSet"],internalValue:["valueChanged"],facets:["appliedFilterChanged"],tplRenderFn:["tplUpdate"],indexResults:["handleFilterChange"]}}};r(a,["globalStoreMethod","indexResults","filterChanged","facets","tplRenderFn","changeEvent"]);let f=0;a.style=o;export{a as nano_algolia_filter};
5
- //# sourceMappingURL=p-935aef3d.entry.js.map
4
+ import{r as t,c as i,w as s,h as e,a as h,g as n}from"./p-f6a8467a.js";import{C as l}from"./p-1a0b5bc3.js";import{W as r}from"./p-60a8c896.js";import"./p-7bff5224.js";import"./p-69a3e911.js";const o=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{display:none}:host ::slotted([slot=filter-template]){display:none !important}:host(.show-filter){display:block}";const a=class{constructor(s){t(this,s);this.nanoFilterChanged=i(this,"nanoFilterChanged",7);this.nanoTplUpdated=i(this,"nanoTplUpdated",7);this.filterId=null;this.tplWillRnder=new Promise((t=>{this.tplDidRnder=t}));this.changeEvent=undefined;this.internalValue=[undefined];this.showFilter=false;this.indexResults=null;this.filterChanged=null;this.facets=undefined;this.tplRenderFn=undefined;this.globalStoreMethod=undefined;this.filterName=null;this.value="";this.operator="or";this.storeId=undefined;this.storeMethod="session"}valueSet(){const t=this.value;let i;if(typeof t==="string")i=t.length?t.split("|"):[];else i=this.value;if(this.didValueChange(i)){const t=this.setFieldValues(i);if(t&&t.length)this.internalValue=i;else{this.tplWillRnder.then((t=>{this.setFieldValues(i);this.internalValue=i}))}}}valueChanged(){this.value=this.internalValue;this.nanoFilterChanged.emit({filterId:this.filterId,facetName:this.filterName,value:this.internalValue,operator:this.operator})}appliedFilterChanged(){if(this.filterName&&this.filterChanged&&(this.filterChanged!==this.filterId||this.operator==="and")){this.updateContent()}}tplUpdate(){this.updateContent()}handleFilterChange(){if(this.indexResults&&this.indexResults.appliedFilters){const t=this.indexResults.appliedFilters.find((t=>t.name===this.filterName));if(!t)return;this.tplWillRnder.then((i=>{const s=this.setFieldValues(t.values);if(s&&s.length)this.value=s}))}this.updateContent()}handleChangeEvent(){const t=this.getFieldValues();if(this.didValueChange(t)){this.internalValue=t;return true}return false}updateContent(){const t=this.outputSlot||this.outputEle;if(!this.el)return;if(!this.templateStr)this.showFilter=true;else if(!this.filterName||!t||this.templateStr&&(!this.indexResults||!this.indexResults.origFilters[this.filterName])){this.showFilter=false}if(!t)return;if(!this.indexResults){if(this.templateStr){s((()=>{t.innerHTML=this.tplRenderFn(this.templateStr,{orig:{},dyn:{},selected:this.internalValue&&this.internalValue.length?this.internalValue:this.value});if(!this.value||!this.value.length)this.handleChangeEvent()}))}else if(!this.value||!this.value.length)this.handleChangeEvent();return}s((()=>{t.innerHTML=this.tplRenderFn(this.templateStr,{orig:Object.assign({},this.indexResults.origFilters[this.filterName]),dyn:Object.assign({},this.indexResults.dynFilters[this.filterName]),selected:this.internalValue&&this.internalValue.length?this.internalValue:this.value});this.tplDidRnder();this.setFieldValues();if(!this.showFilter)this.showFilter=true;this.nanoTplUpdated.emit(this.el)}))}getFieldValues(){const t=[];const i=this.outputSlot.querySelectorAll('input[type="checkbox"], input[type="radio"], select');for(let s=0;s<i.length;s++){const e=i[s];if(e.type==="select-multiple"){const i=e;for(let s=0;s<i.options.length;s++){if(!i.options[s].selected||!i.options[s].value.length)continue;t.push(i.options[s].value)}}else if(e.type!=="checkbox"&&e.type!=="radio"||e.checked&&e.value.length){t.push(e.value)}}return t}setFieldValues(t){t=t||this.internalValue;if(!t)return;const i=[];const s=this.outputSlot.querySelectorAll('input[type="checkbox"], input[type="radio"], select, nano-select, nano-checkbox');for(let e=0;e<s.length;e++){const h=s[e];if(h.disabled||h.type==="file"||h.type==="reset"||h.type==="submit"||h.type==="button")continue;if(h.type==="select-multiple"||h.type==="select-one"){const s=h;for(let e=0;e<s.options.length;e++){if(!t.includes(s.options[e].value))s.options[e].selected=false;else{i.push(s.value);s.options[e].selected=true;if(h.type==="select-one")s.value=s.options[e].value}}}else if(["checkbox","radio","tag","segment","segment-pill"].includes(h.type)){if(t.includes(h.value)){i.push(h.value);h.checked=true}else if(!t.length&&!h.value.length){h.checked=true}else h.checked=false}}return i}didValueChange(t){if(!!this.internalValue&&!t)return true;if(!this.internalValue&&!t)return false;if(this.internalValue&&t.length!==this.internalValue.length)return true;let i=false;for(let s=0;s<t.length;s++){if(!i&&(!this.internalValue||!this.internalValue.includes(t[s])))i=true}return i}connectedCallback(){this.templateSlot=this.el.querySelector('[slot="filter-template"]');this.outputSlot=this.el.querySelector('[slot="output"]');this.filterId=this.filterName+"_"+f++;if(!!this.templateSlot){this.templateStr=this.templateSlot.innerHTML;this.templateStr=this.templateStr.replace(/=&gt;/gm,"=>")}}componentWillLoad(){if(this.storeId)l.init(this,["value"],this.storeMethod||this.globalStoreMethod,this.storeId)}componentDidLoad(){this.updateContent();if(this.templateStr&&this.filterName&&this.indexResults&&this.indexResults.origFilters[this.filterName])this.showFilter=true}render(){return e(h,{class:{"show-filter":this.showFilter}},e("div",{ref:t=>this.outputEle=t},e("slot",{name:"output"})))}get el(){return n(this)}static get watchers(){return{value:["valueSet"],internalValue:["valueChanged"],facets:["appliedFilterChanged"],tplRenderFn:["tplUpdate"],indexResults:["handleFilterChange"]}}};r(a,["globalStoreMethod","indexResults","filterChanged","facets","tplRenderFn","changeEvent"]);let f=0;a.style=o;export{a as nano_algolia_filter};
5
+ //# sourceMappingURL=p-6920ad69.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{r as i,c as t,h as s,a as h,g as e}from"./p-f6a8467a.js";import{a as n}from"./p-ed6adde2.js";import{C as a}from"./p-a6ff5ca6.js";import{W as r}from"./p-60a8c896.js";import"./p-69a3e911.js";import"./p-9746b0a5.js";const o=class{constructor(s){i(this,s);this.nanoSearchResult=t(this,"nanoSearchResult",7);this.nanoSearch=t(this,"nanoSearch",7);this.nanoSearchReset=t(this,"nanoSearchReset",7);this.handleFocus=()=>{if(this.inputField)this.inputField.setFocus()};this.searchStr="";this.algoliaIndex=null;this.currentResults=undefined;this.appId="";this.apiKey="";this.searchIndex=null;this.searchIndexName=undefined;this.minChars=2;this.autoEmit=true;this.browseIndex=false;this.storeId=undefined;this.storeMethod="session"}async search(){this.emitResults()}searchIndexNameChange(){if(!this.searchIndexName||!this.searchIndexName.length)return;this.searchIndex={index:this.searchIndexName}}algoliaChange(){this.internalIndex=this.algoliaIndex}browseIndexChange(){if(this.browseIndex){this.searchStr="*";this.searchSubmit()}}initAlgoliaClient(){if(this.isNested||!this.appId||!this.apiKey)return;this.algoliaClient=n(this.appId,this.apiKey);if(this.searchIndex)this.algoliaIndex=this.algoliaClient.initIndex(this.searchIndex.index)}async searchSubmit(i){if(!this.internalIndex){console.error("No algolia index set");return}if(i){if(i.target.tagName.toLowerCase()!=="nano-input")return;this.searchStr=i.detail.value}else{this.inputField=this.inputField||this.host.querySelector("nano-input");if(!this.inputField)return;this.searchStr=this.inputField.value}if(this.searchStr.length<this.minChars){if(this.browseIndex)this.searchStr="*";else{if(this.searchStr.length===0){this.nanoSearchResult.emit({results:[],client:{apiKey:this.appId,appId:this.appId}});return}if(this.searchStr.length<this.minChars)return}}let t={};if(this.searchIndex.filters)t={facets:this.searchIndex.filters};const s=this.fixDomain(await this.internalIndex.search(this.searchStr,t));s.indexName=this.searchIndex.name;s.selected=true;s.domain=this.searchIndex.domain||null;s.index=this.searchIndex.index;this.currentResults=s;this.nanoSearch.emit({results:[this.currentResults],client:{apiKey:this.appId,appId:this.appId}});if(this.autoEmit)this.emitResults()}emitResults(){this.nanoSearchResult.emit({results:[this.currentResults],client:{apiKey:this.appId,appId:this.appId}})}fixDomain(i){if(!this.searchIndex.domain)return i;i.hits.map((i=>{if(i.url&&!i.url.match(/^http/))i.url=location.protocol+"//"+this.searchIndex.domain+i.url}));return i}connectedCallback(){this.isNested=this.host.parentElement.tagName.toLowerCase()==="nano-algolia"&&this.host.hasAttribute("slot")&&this.host.getAttribute("slot")==="search-input";if(!this.isNested){this.host.addEventListener("openWormhole",(i=>{i.detail.onOpen.resolve();this.searchIndexNameChange();this.initAlgoliaClient()}))}}componentWillLoad(){this.inputField=this.host.querySelector("nano-input");if(this.storeId)a.init(this,["searchStr"],this.storeMethod,this.storeId)}render(){return s(h,{onFocus:this.handleFocus,tabindex:"-1"},s("slot",null))}get host(){return e(this)}static get watchers(){return{searchIndexName:["searchIndexNameChange"],algoliaIndex:["algoliaChange"],browseIndex:["browseIndexChange"],apiKey:["initAlgoliaClient"],appId:["initAlgoliaClient"],searchIndex:["initAlgoliaClient"]}}};r(o,["algoliaIndex","searchIndex","browseIndex"]);export{o as nano_algolia_input};
5
- //# sourceMappingURL=p-1c6c94cb.entry.js.map
4
+ import{r as i,c as t,h as s,a as h,g as e}from"./p-f6a8467a.js";import{a as n}from"./p-ed6adde2.js";import{C as a}from"./p-1a0b5bc3.js";import{W as r}from"./p-60a8c896.js";import"./p-69a3e911.js";import"./p-7bff5224.js";const o=class{constructor(s){i(this,s);this.nanoSearchResult=t(this,"nanoSearchResult",7);this.nanoSearch=t(this,"nanoSearch",7);this.nanoSearchReset=t(this,"nanoSearchReset",7);this.handleFocus=()=>{if(this.inputField)this.inputField.setFocus()};this.searchStr="";this.algoliaIndex=null;this.currentResults=undefined;this.appId="";this.apiKey="";this.searchIndex=null;this.searchIndexName=undefined;this.minChars=2;this.autoEmit=true;this.browseIndex=false;this.storeId=undefined;this.storeMethod="session"}async search(){this.emitResults()}searchIndexNameChange(){if(!this.searchIndexName||!this.searchIndexName.length)return;this.searchIndex={index:this.searchIndexName}}algoliaChange(){this.internalIndex=this.algoliaIndex}browseIndexChange(){if(this.browseIndex){this.searchStr="*";this.searchSubmit()}}initAlgoliaClient(){if(this.isNested||!this.appId||!this.apiKey)return;this.algoliaClient=n(this.appId,this.apiKey);if(this.searchIndex)this.algoliaIndex=this.algoliaClient.initIndex(this.searchIndex.index)}async searchSubmit(i){if(!this.internalIndex){console.error("No algolia index set");return}if(i){if(i.target.tagName.toLowerCase()!=="nano-input")return;this.searchStr=i.detail.value}else{this.inputField=this.inputField||this.host.querySelector("nano-input");if(!this.inputField)return;this.searchStr=this.inputField.value}if(this.searchStr.length<this.minChars){if(this.browseIndex)this.searchStr="*";else{if(this.searchStr.length===0){this.nanoSearchResult.emit({results:[],client:{apiKey:this.appId,appId:this.appId}});return}if(this.searchStr.length<this.minChars)return}}let t={};if(this.searchIndex.filters)t={facets:this.searchIndex.filters};const s=this.fixDomain(await this.internalIndex.search(this.searchStr,t));s.indexName=this.searchIndex.name;s.selected=true;s.domain=this.searchIndex.domain||null;s.index=this.searchIndex.index;this.currentResults=s;this.nanoSearch.emit({results:[this.currentResults],client:{apiKey:this.appId,appId:this.appId}});if(this.autoEmit)this.emitResults()}emitResults(){this.nanoSearchResult.emit({results:[this.currentResults],client:{apiKey:this.appId,appId:this.appId}})}fixDomain(i){if(!this.searchIndex.domain)return i;i.hits.map((i=>{if(i.url&&!i.url.match(/^http/))i.url=location.protocol+"//"+this.searchIndex.domain+i.url}));return i}connectedCallback(){this.isNested=this.host.parentElement.tagName.toLowerCase()==="nano-algolia"&&this.host.hasAttribute("slot")&&this.host.getAttribute("slot")==="search-input";if(!this.isNested){this.host.addEventListener("openWormhole",(i=>{i.detail.onOpen.resolve();this.searchIndexNameChange();this.initAlgoliaClient()}))}}componentWillLoad(){this.inputField=this.host.querySelector("nano-input");if(this.storeId)a.init(this,["searchStr"],this.storeMethod,this.storeId)}render(){return s(h,{onFocus:this.handleFocus,tabindex:"-1"},s("slot",null))}get host(){return e(this)}static get watchers(){return{searchIndexName:["searchIndexNameChange"],algoliaIndex:["algoliaChange"],browseIndex:["browseIndexChange"],apiKey:["initAlgoliaClient"],appId:["initAlgoliaClient"],searchIndex:["initAlgoliaClient"]}}};r(o,["algoliaIndex","searchIndex","browseIndex"]);export{o as nano_algolia_input};
5
+ //# sourceMappingURL=p-7baa9e14.entry.js.map
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Web Components for Nanopore digital Web Apps
3
+ */
4
+ const t=(t,n)=>{const r=t._original||t;return{_original:t,emit:e(r.emit.bind(r),n)}};const e=(t,e=0)=>{let n;return(...r)=>{clearTimeout(n);n=setTimeout(t,e,...r)}};const n=(t,e)=>{let n=0;return(...r)=>{const o=(new Date).getTime();if(o-n>e){n=o;return t(...r)}}};export{t as a,e as d,n as t};
5
+ //# sourceMappingURL=p-7bff5224.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["debounceEvent","event","wait","original","_original","emit","debounce","bind","callback","timer","args","clearTimeout","setTimeout","throttle","delay","prev","now","Date","getTime"],"sources":["./src/utils/throttle.ts"],"sourcesContent":["import { EventEmitter } from '@stencil/core';\n\nexport const deferEvent = (event: EventEmitter): EventEmitter => {\n return debounceEvent(event, 0);\n};\n\nexport const debounceEvent = (\n event: EventEmitter,\n wait: number\n): EventEmitter => {\n const original = (event as any)._original || event;\n return {\n _original: event,\n emit: debounce(original.emit.bind(original), wait),\n } as EventEmitter;\n};\n\n/**\n * debounce ensures that one function call is made for an event that fires multiple times.\n * @param callback to perform after waiting\n * @param wait how to long to wait before calling the function\n * @returns a debounced function to call as often as required\n */\nexport const debounce = (callback: (...args: any[]) => void, wait = 0) => {\n let timer: any;\n return (...args: any[]): any => {\n clearTimeout(timer);\n timer = setTimeout(callback, wait, ...args);\n };\n};\n\n/**\n * throttle delays executing a function - reducing the function calls of an event that fires multiple times.\n * @param callback to perform after a delay\n * @param delay how long to delay before calling the function\n * @returns a throttled function to call as often as required\n */\nexport const throttle = (callback, delay) => {\n // Previously called time of the function\n let prev = 0;\n return (...args) => {\n // Current called time of the function\n const now = new Date().getTime();\n\n // If difference is greater than delay call\n // the function again.\n if (now - prev > delay) {\n prev = now;\n\n // \"...\" is the spread operator here\n // returning the function with the\n // array of arguments\n return callback(...args);\n }\n };\n};\n"],"mappings":";;;MAMaA,EAAgB,CAC3BC,EACAC,KAEA,MAAMC,EAAYF,EAAcG,WAAaH,EAC7C,MAAO,CACLG,UAAWH,EACXI,KAAMC,EAASH,EAASE,KAAKE,KAAKJ,GAAWD,GAC9B,E,MASNI,EAAW,CAACE,EAAoCN,EAAO,KAClE,IAAIO,EACJ,MAAO,IAAIC,KACTC,aAAaF,GACbA,EAAQG,WAAWJ,EAAUN,KAASQ,EAAK,CAC5C,E,MASUG,EAAW,CAACL,EAAUM,KAEjC,IAAIC,EAAO,EACX,MAAO,IAAIL,KAET,MAAMM,GAAM,IAAIC,MAAOC,UAIvB,GAAIF,EAAMD,EAAOD,EAAO,CACtBC,EAAOC,EAKP,OAAOR,KAAYE,E,EAEtB,S"}
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{r as i,c as t,h as e,a as s,g as n}from"./p-f6a8467a.js";import{d as r}from"./p-842cf127.js";import{c as o}from"./p-ee045579.js";import{d as a}from"./p-9746b0a5.js";const h=':host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--divider-width:12px;--divider-hit-area:14px;--min:0%;--max:100%;--background-color:#e4e6e8;--content-color:#918b86;display:grid}.start,.end{overflow:hidden}.divider{flex:0 0 var(--divider-width);display:flex;position:relative;align-items:center;justify-content:center;background-color:var(--background-color);color:var(--content-color);z-index:1;font-size:0.8rem}.divider:focus{outline:none}:host(:not([disabled])) .divider:focus-visible{background-color:var(--nano-control-focus-color, rgba(144, 198, 231, 0.8))}:host([disabled]) .divider{cursor:not-allowed}:host(:not([vertical]):not([disabled])) .divider{cursor:col-resize}:host(:not([vertical])) .divider::after{display:flex;content:"";position:absolute;block-size:100%;inset-inline-start:calc(var(--divider-hit-area) / -2 + var(--divider-width) / 2);inline-size:var(--divider-hit-area)}:host([vertical]){flex-direction:column}:host([vertical]:not([disabled])) .divider{cursor:row-resize}:host([vertical]) .divider::after{content:"";position:absolute;inline-size:100%;inset-block-start:calc(var(--divider-hit-area) / -2 + var(--divider-width) / 2);block-size:var(--divider-hit-area)}';const d=class{get size(){const{width:i,height:t}=this.host.getBoundingClientRect();return this.vertical?t:i}get shouldAnimate(){return this.didLoad&&this._shouldAnimate}set shouldAnimate(i){this._shouldAnimate=i}constructor(e){i(this,e);this.nanoReposition=t(this,"nanoReposition",7);this.nanoDragging=t(this,"nanoDragging",7);this.isAnimating=false;this.didLoad=false;this._shouldAnimate=true;this.handleDrag=i=>{if(this.disabled){return}i.preventDefault();r(this.host,{onMove:(i,t)=>{let e=this.vertical?t:i;this.nanoDragging.emit(e);if(this.primary==="end"){e=this.size-e}if(this.snap){const i=this.snap.split(" ");i.forEach((i=>{let t;if(i.endsWith("%")){t=this.size*(parseFloat(i)/100)}else{t=parseFloat(i)}if(e>=t-this.snapThreshold&&e<=t+this.snapThreshold){e=t}}))}this.shouldAnimate=false;this.position=o(this.pixelsToPercentage(e),0,100);requestAnimationFrame((()=>this.shouldAnimate=true))}})};this.handleKeyDown=i=>{if(this.disabled){return}if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(i.key)){let t=this.position;const e=(i.shiftKey?10:1)*(this.primary==="end"?-1:1);i.preventDefault();if(i.key==="ArrowLeft"&&!this.vertical||i.key==="ArrowUp"&&this.vertical){t-=e}if(i.key==="ArrowRight"&&!this.vertical||i.key==="ArrowDown"&&this.vertical){t+=e}if(i.key==="Home"){t=this.primary==="end"?100:0}if(i.key==="End"){t=this.primary==="end"?0:100}this.shouldAnimate=false;this.position=o(t,0,100);requestAnimationFrame((()=>this.shouldAnimate=true))}};this.handleResize=()=>{if(!this.didLoad||this.isAnimating)return;if(this.primary){this.shouldAnimate=false;this.position=this.pixelsToPercentage(this.cachedPositionInPixels);requestAnimationFrame((()=>this.shouldAnimate=true))}};this.positionInPixels=undefined;this.vertical=false;this.disabled=false;this.primary=undefined;this.snap=undefined;this.snapThreshold=12;this.animationDuration=.6;this.handlePositionChange=a(this.handlePositionChange.bind(this),100)}get position(){return this._position}set position(i){i=Math.min(Math.max(i,0),100);if(isNaN(i)||i===this._position)return;if(this.shouldAnimate&&this.animationDuration>0&&!isNaN(this.position)){this.animatePosition(i);return}this._position=i}handlePositionChange(){this.cachedPositionInPixels=this.percentageToPixels(this.position);this.positionInPixels=this.percentageToPixels(this.position);this.nanoReposition.emit()}handlePositionInPixelsChange(){this.position=this.pixelsToPercentage(this.positionInPixels)}async getPercentageToPixels(i){return this.percentageToPixels(i)}async getPixelsToPercentage(i){return this.pixelsToPercentage(i)}animatePosition(i){if(this.isAnimating)return;const t=this.animationDuration;const e=60;const s=this.position;const n=i-s;let r=s;let o=0;function a(i,t,e,s){if((i/=s/2)<1)return e/2*i*i+t;else return-e/2*(--i*(i-2)-1)+t}const h=()=>{o+=1/e;r=a(o,s,n,t);if(i>s&&r>=i||i<s&&r<=i){this.position=i;this.shouldAnimate=true;this.isAnimating=false;return}this.position=r;requestAnimationFrame(h)};this.shouldAnimate=false;this.isAnimating=true;requestAnimationFrame(h)}percentageToPixels(i){return this.size*(i/100)}pixelsToPercentage(i){return i/this.size*100}attachRO(){if(!window["ResizeObserver"])return;this.detachRO();this.ro=new ResizeObserver((()=>this.handleResize()));this.ro.observe(this.host)}detachRO(){if(!this.ro)return;this.ro.unobserve(this.host);this.ro=undefined}componentDidLoad(){if(this.positionInPixels)this.handlePositionInPixelsChange();setTimeout((()=>this.didLoad=true))}connectedCallback(){this.cachedPositionInPixels=this.percentageToPixels(this.position);this.attachRO()}disconnectedCallback(){this.detachRO()}componentDidRender(){requestAnimationFrame((()=>{if(typeof this.position==="undefined"){this.position=50}}))}render(){if(typeof this.position==="undefined")return;const i={};const t=this.vertical?"gridTemplateRows":"gridTemplateColumns";const n=`\n clamp(\n 0%,\n clamp(\n var(--min),\n ${this.position}% - var(--divider-width) / 2,\n var(--max)\n ),\n calc(100% - var(--divider-width))\n )\n `;const r="auto";if(this.primary==="end"){i[t]=`${r} var(--divider-width) ${n}`}else{i[t]=`${n} var(--divider-width) ${r}`}return e(s,{style:i},e("div",{part:"panel start",class:"start"},e("slot",{name:"start"})),e("div",{part:"divider",class:"divider",tabindex:this.disabled?undefined:"0",role:"separator","aria-label":"Resize",onKeyDown:this.handleKeyDown,onMouseDown:this.handleDrag,onTouchStart:this.handleDrag},e("slot",{name:"handle"},!this.disabled&&this.vertical?e("nano-icon",{slot:"handle",name:"solid/grip-lines"}):e("nano-icon",{slot:"handle",name:"solid/grip-lines-vertical"}))),e("div",{part:"panel end",class:"end"},e("slot",{name:"end"})))}get host(){return n(this)}static get watchers(){return{position:["handlePositionChange"],positionInPixels:["handlePositionInPixelsChange"]}}};d.style=h;export{d as nano_split_pane};
5
- //# sourceMappingURL=p-f60fe933.entry.js.map
4
+ import{r as i,c as t,h as e,a as s,g as n}from"./p-f6a8467a.js";import{d as r}from"./p-842cf127.js";import{c as o}from"./p-ee045579.js";import{d as a}from"./p-7bff5224.js";const h=':host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--divider-width:12px;--divider-hit-area:14px;--min:0%;--max:100%;--background-color:#e4e6e8;--content-color:#918b86;display:grid}.start,.end{overflow:hidden}.divider{flex:0 0 var(--divider-width);display:flex;position:relative;align-items:center;justify-content:center;background-color:var(--background-color);color:var(--content-color);z-index:1;font-size:0.8rem}.divider:focus{outline:none}:host(:not([disabled])) .divider:focus-visible{background-color:var(--nano-control-focus-color, rgba(144, 198, 231, 0.8))}:host([disabled]) .divider{cursor:not-allowed}:host(:not([vertical]):not([disabled])) .divider{cursor:col-resize}:host(:not([vertical])) .divider::after{display:flex;content:"";position:absolute;block-size:100%;inset-inline-start:calc(var(--divider-hit-area) / -2 + var(--divider-width) / 2);inline-size:var(--divider-hit-area)}:host([vertical]){flex-direction:column}:host([vertical]:not([disabled])) .divider{cursor:row-resize}:host([vertical]) .divider::after{content:"";position:absolute;inline-size:100%;inset-block-start:calc(var(--divider-hit-area) / -2 + var(--divider-width) / 2);block-size:var(--divider-hit-area)}';const d=class{get size(){const{width:i,height:t}=this.host.getBoundingClientRect();return this.vertical?t:i}get shouldAnimate(){return this.didLoad&&this._shouldAnimate}set shouldAnimate(i){this._shouldAnimate=i}constructor(e){i(this,e);this.nanoReposition=t(this,"nanoReposition",7);this.nanoDragging=t(this,"nanoDragging",7);this.isAnimating=false;this.didLoad=false;this._shouldAnimate=true;this.handleDrag=i=>{if(this.disabled){return}i.preventDefault();r(this.host,{onMove:(i,t)=>{let e=this.vertical?t:i;this.nanoDragging.emit(e);if(this.primary==="end"){e=this.size-e}if(this.snap){const i=this.snap.split(" ");i.forEach((i=>{let t;if(i.endsWith("%")){t=this.size*(parseFloat(i)/100)}else{t=parseFloat(i)}if(e>=t-this.snapThreshold&&e<=t+this.snapThreshold){e=t}}))}this.shouldAnimate=false;this.position=o(this.pixelsToPercentage(e),0,100);requestAnimationFrame((()=>this.shouldAnimate=true))}})};this.handleKeyDown=i=>{if(this.disabled){return}if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(i.key)){let t=this.position;const e=(i.shiftKey?10:1)*(this.primary==="end"?-1:1);i.preventDefault();if(i.key==="ArrowLeft"&&!this.vertical||i.key==="ArrowUp"&&this.vertical){t-=e}if(i.key==="ArrowRight"&&!this.vertical||i.key==="ArrowDown"&&this.vertical){t+=e}if(i.key==="Home"){t=this.primary==="end"?100:0}if(i.key==="End"){t=this.primary==="end"?0:100}this.shouldAnimate=false;this.position=o(t,0,100);requestAnimationFrame((()=>this.shouldAnimate=true))}};this.handleResize=()=>{if(!this.didLoad||this.isAnimating)return;if(this.primary){this.shouldAnimate=false;this.position=this.pixelsToPercentage(this.cachedPositionInPixels);requestAnimationFrame((()=>this.shouldAnimate=true))}};this.positionInPixels=undefined;this.vertical=false;this.disabled=false;this.primary=undefined;this.snap=undefined;this.snapThreshold=12;this.animationDuration=.6;this.handlePositionChange=a(this.handlePositionChange.bind(this),100)}get position(){return this._position}set position(i){i=Math.min(Math.max(i,0),100);if(isNaN(i)||i===this._position)return;if(this.shouldAnimate&&this.animationDuration>0&&!isNaN(this.position)){this.animatePosition(i);return}this._position=i}handlePositionChange(){this.cachedPositionInPixels=this.percentageToPixels(this.position);this.positionInPixels=this.percentageToPixels(this.position);this.nanoReposition.emit()}handlePositionInPixelsChange(){this.position=this.pixelsToPercentage(this.positionInPixels)}async getPercentageToPixels(i){return this.percentageToPixels(i)}async getPixelsToPercentage(i){return this.pixelsToPercentage(i)}animatePosition(i){if(this.isAnimating)return;const t=this.animationDuration;const e=60;const s=this.position;const n=i-s;let r=s;let o=0;function a(i,t,e,s){if((i/=s/2)<1)return e/2*i*i+t;else return-e/2*(--i*(i-2)-1)+t}const h=()=>{o+=1/e;r=a(o,s,n,t);if(i>s&&r>=i||i<s&&r<=i){this.position=i;this.shouldAnimate=true;this.isAnimating=false;return}this.position=r;requestAnimationFrame(h)};this.shouldAnimate=false;this.isAnimating=true;requestAnimationFrame(h)}percentageToPixels(i){return this.size*(i/100)}pixelsToPercentage(i){return i/this.size*100}attachRO(){if(!window["ResizeObserver"])return;this.detachRO();this.ro=new ResizeObserver((()=>this.handleResize()));this.ro.observe(this.host)}detachRO(){if(!this.ro)return;this.ro.unobserve(this.host);this.ro=undefined}componentDidLoad(){if(this.positionInPixels)this.handlePositionInPixelsChange();setTimeout((()=>this.didLoad=true))}connectedCallback(){this.cachedPositionInPixels=this.percentageToPixels(this.position);this.attachRO()}disconnectedCallback(){this.detachRO()}componentDidRender(){requestAnimationFrame((()=>{if(typeof this.position==="undefined"){this.position=50}}))}render(){if(typeof this.position==="undefined")return;const i={};const t=this.vertical?"gridTemplateRows":"gridTemplateColumns";const n=`\n clamp(\n 0%,\n clamp(\n var(--min),\n ${this.position}% - var(--divider-width) / 2,\n var(--max)\n ),\n calc(100% - var(--divider-width))\n )\n `;const r="auto";if(this.primary==="end"){i[t]=`${r} var(--divider-width) ${n}`}else{i[t]=`${n} var(--divider-width) ${r}`}return e(s,{style:i},e("div",{part:"panel start",class:"start"},e("slot",{name:"start"})),e("div",{part:"divider",class:"divider",tabindex:this.disabled?undefined:"0",role:"separator","aria-label":"Resize",onKeyDown:this.handleKeyDown,onMouseDown:this.handleDrag,onTouchStart:this.handleDrag},e("slot",{name:"handle"},!this.disabled&&this.vertical?e("nano-icon",{slot:"handle",name:"solid/grip-lines"}):e("nano-icon",{slot:"handle",name:"solid/grip-lines-vertical"}))),e("div",{part:"panel end",class:"end"},e("slot",{name:"end"})))}get host(){return n(this)}static get watchers(){return{position:["handlePositionChange"],positionInPixels:["handlePositionInPixelsChange"]}}};d.style=h;export{d as nano_split_pane};
5
+ //# sourceMappingURL=p-898cbac7.entry.js.map