@nanoporetech-digital/components 4.0.0 → 4.1.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.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +1 -1
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js +2 -2
- package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-icon.cjs.entry.js +1 -1
- package/dist/cjs/nano-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/{nano-table-737365b7.js → nano-table-c5b6630a.js} +2 -2
- package/dist/cjs/{nano-table-737365b7.js.map → nano-table-c5b6630a.js.map} +1 -1
- package/dist/cjs/nano-table.cjs.entry.js +1 -1
- package/dist/cjs/{table.worker-c3b11144.js → table.worker-0876611d.js} +2 -2
- package/dist/cjs/table.worker-0876611d.js.map +1 -0
- package/dist/collection/components/global-nav/global-nav-user-profile.js +1 -1
- package/dist/collection/components/global-nav/global-nav-user-profile.js.map +1 -1
- package/dist/collection/components/global-nav/global-nav.js +1 -1
- package/dist/collection/components/global-nav/global-nav.js.map +1 -1
- package/dist/collection/components/global-nav/style/global-nav.css +6 -4
- package/dist/collection/components/icon/utils.js +1 -1
- package/dist/collection/components/icon/utils.js.map +1 -1
- package/dist/components/global-nav-user-profile.js +1 -1
- package/dist/components/global-nav-user-profile.js.map +1 -1
- package/dist/components/icon.js +1 -1
- package/dist/components/icon.js.map +1 -1
- package/dist/components/nano-global-nav.js +2 -2
- package/dist/components/nano-global-nav.js.map +1 -1
- package/dist/esm/nano-global-nav-user-profile_3.entry.js +1 -1
- package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
- package/dist/esm/nano-global-nav.entry.js +2 -2
- package/dist/esm/nano-global-nav.entry.js.map +1 -1
- package/dist/esm/nano-icon.entry.js +1 -1
- package/dist/esm/nano-icon.entry.js.map +1 -1
- package/dist/esm/{nano-table-75d755ae.js → nano-table-ff985e63.js} +2 -2
- package/dist/esm/{nano-table-75d755ae.js.map → nano-table-ff985e63.js.map} +1 -1
- package/dist/esm/nano-table.entry.js +1 -1
- package/dist/esm/{table.worker-d60d6df4.js → table.worker-906bc297.js} +2 -2
- package/dist/esm/table.worker-906bc297.js.map +1 -0
- package/dist/nano-components/nano-components.esm.js +1 -1
- package/dist/nano-components/p-0c077605.entry.js +5 -0
- package/dist/nano-components/p-0c077605.entry.js.map +1 -0
- package/dist/nano-components/{p-42e7f253.js → p-13dd65c9.js} +2 -2
- package/dist/nano-components/p-173cc842.entry.js +5 -0
- package/dist/nano-components/p-173cc842.entry.js.map +1 -0
- package/dist/nano-components/p-4b136a65.js +5 -0
- package/dist/nano-components/{p-1b7bad31.entry.js → p-c38a246f.entry.js} +2 -2
- package/dist/nano-components/p-f2d89239.entry.js +5 -0
- package/dist/nano-components/p-f2d89239.entry.js.map +1 -0
- package/docs-json.json +1 -1
- package/hydrate/index.js +3 -3
- package/package.json +2 -2
- package/dist/cjs/table.worker-c3b11144.js.map +0 -1
- package/dist/esm/table.worker-d60d6df4.js.map +0 -1
- package/dist/nano-components/p-b2655717.entry.js +0 -5
- package/dist/nano-components/p-b2655717.entry.js.map +0 -1
- package/dist/nano-components/p-d4cebdef.entry.js +0 -5
- package/dist/nano-components/p-d4cebdef.entry.js.map +0 -1
- package/dist/nano-components/p-d98c6a62.js +0 -5
- package/dist/nano-components/p-f471a392.entry.js +0 -5
- package/dist/nano-components/p-f471a392.entry.js.map +0 -1
- /package/dist/nano-components/{p-42e7f253.js.map → p-13dd65c9.js.map} +0 -0
- /package/dist/nano-components/{p-1b7bad31.entry.js.map → p-4b136a65.js.map} +0 -0
- /package/dist/nano-components/{p-d98c6a62.js.map → p-c38a246f.entry.js.map} +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
2
|
* Web Components for Nanopore digital Web Apps
|
3
3
|
*/
|
4
|
-
import{j as t,g as n,e,h as o,F as i,r,c as s,d as a,a as l}from"./p-f6a8467a.js";import{a as d}from"./p-ee045579.js";import{d as c}from"./p-9746b0a5.js";import{c as h}from"./p-9ebbb814.js";const b="nano-tbl";const p=(t,n)=>{const e=globalThis[n];return e!=null&&t instanceof e};const _=t=>{if(t!=null){if(p(t,"ArrayBuffer")||p(t,"MessagePort")||p(t,"ImageBitmap")||p(t,"OffscreenCanvas")){return[t]}if(typeof t==="object"){if(t.constructor===Object){t=Object.values(t)}if(Array.isArray(t)){return t.flatMap(_)}return _(t.buffer)}}return[]};let f=0;let u=0;const g=new Map;const m=new Map;const v=(n,e,o)=>{const i=new Worker(n,{name:e});i.addEventListener("message",(({data:n})=>{if(n){const e=n[0];const i=n[1];const r=n[2];if(e===o){const e=n[3];const[o,s,a]=g.get(i);g.delete(i);if(e){const n=e.isError?Object.assign(new Error(e.value.message),e.value):e.value;t(n);s(n)}else{if(a){a.forEach((t=>m.delete(t)))}o(r)}}else if(e===o+".cb"){try{m.get(i)(...r)}catch(n){t(n)}}}}));return i};const w=(t,n,e)=>(...o)=>new Promise(((i,r)=>{let s=f++;let a=0;let l=o.length;let d=[i,r];g.set(s,d);for(;a<l;a++){if(typeof o[a]==="function"){const t=u++;m.set(t,o[a]);o[a]=[n+".cb",t];(d[2]=d[2]||[]).push(t)}}const c=t=>t.postMessage([n,s,e,o],_(o));if(t.then){t.then(c)}else{c(t)}}));const y=import("./p-d98c6a62.js").then((t=>t.worker));const k=w(y,"stencil.table.worker","createWorkerStore");const x=w(y,"stencil.table.worker","syncConfigToWorker");const $=w(y,"stencil.table.worker","syncDataToWorker");const j=w(y,"stencil.table.worker","workerFilter");const O=w(y,"stencil.table.worker","workerSearch");const C=w(y,"stencil.table.worker","workerSort");function z(t){const n=JSON.parse(JSON.stringify(t));t.forEach((t=>{if(!!t.sortCompareFn){const e=n.find((n=>n.prop===t.prop));e.sortCompareFn=t.sortCompareFn.toString()}}));return n}const S=new WeakMap;async function I(t,n,e){const o={data:h({rows:[]}),config:h({columns:n}),general:h({workerId:null,scrollParent:e,host:t})};const i=await k(o.data.state.rows,z(o.config.state.columns));o.general.state.workerId=i;S.set(t,o);o.data.use({reset:()=>{if(o.general.state.workerId)$(o.general.state.workerId,null)},dispose:()=>{if(o.general.state.workerId)$(o.general.state.workerId,null)}});o.config.use({reset:()=>{if(o.general.state.workerId)x(o.general.state.workerId,null)},dispose:()=>{if(o.general.state.workerId)x(o.general.state.workerId,null)}});return o}function D(t){return S.get(t)}function T(t){if(t instanceof Date){return"date"}if(["number","string"].includes(typeof t)){return typeof t}return"unknown"}function R(t,n){const e=S.get(t);if(!e)return;const o=e.config.state.columns;const i=o.filter((t=>t.type==="date")).reduce(((t,n)=>[...t,n.prop]),[]);const r=o.filter((t=>!t.type));n=n.map(((t,n)=>{if(r.length&&n===0){e.config.state.columns=o.map((n=>{if(r.includes(n)&&t[n.prop]&&!n.type){n.type=T(t[n.prop]);if(n.type==="date")i.push(n.prop)}return n}))}i.forEach((n=>{var e;const o=(e=new Date(t[n]))!==null&&e!==void 0?e:null;if(!!o&&Number(o))t[n]=Number(o)}));t["__index"]=n;t["__uuid"]=d(o.map((n=>t[n.prop])).join());return t}));e.data.state.rows=n;if(e.general.state.workerId)return $(e.general.state.workerId,n)}function M(t,n){const e=S.get(t);if(!e)return;e.config.state.columns=n;if(e.general.state.workerId)return x(e.general.state.workerId,z(n))}async function N(t,n){const e=S.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await O(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function B(t,n){const e=S.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await j(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function F(t,n,e){const o=S.get(t);if(!o||!o.general.state.workerId)return;try{o.data.state.rows=await C(o.general.state.workerId,n,e)}catch(t){console.warn(t)}}function P(t,n){const e=E();const o=e.config.state.columns;const i=e.data.state.rows;const r=o[n];const s=r===null||r===void 0?void 0:r.prop;const a=i[t];const l=a?a[o[n].prop]:"";return{prop:s,cellModel:l,column:r,rowIndex:t,rowModel:a}}function A(t){const n=E();const e=n.data.state.rows;const o=e[t];return{rowModel:o,rowIndex:t}}function W(t,n){if(!n)return t;const e=Object.assign(Object.assign({},n),t);if(n.class){if(typeof n.class==="object"&&typeof e.class==="object"){e.class=Object.assign(Object.assign({},n.class),e.class)}else if(typeof n.class==="string"&&typeof e.class==="object"){e.class[n.class]=true}else if(typeof e.class==="string"){e.class+=" "+n.class}}if(n.style){e.style=Object.assign(Object.assign({},n.style),e.style)}return e}function E(){return D(n(e()))}function H(t,n,e){var o;const i=Object.assign({},e);const r=(o=E().config.state.columns[n])===null||o===void 0?void 0:o.cellProperties;if(!r)return i;const s=P(t,n);const a=r(s);if(!a)return i;return W(i,a)}function q(t){const n=t===null||t===void 0?void 0:t.columnTemplate;return n?n(o,t):o(i,null,t.title)}const J=new WeakMap;const L=new WeakMap;function Z(t,n,e){if(J.get(t))return;const o=E();const i=o.general.state.scrollParent;const r=new IntersectionObserver((([t])=>{const o=t.rootBounds||document.scrollingElement.getBoundingClientRect();const r={};if(n==="start"){r.start=t.boundingClientRect.x-(o.x+i.scrollLeft)<0&&!t.isIntersecting}if(n==="end"){r.end=t.boundingClientRect.right>t.boundingClientRect.width&&!t.isIntersecting}if(!!e)e(r)}),{threshold:[1],rootMargin:"1px 0px 100px 0px",root:i===document.scrollingElement?null:i});J.set(t,r);setTimeout((()=>r.observe(t)),300)}function U(t,n,e){if(L.get(t))return;const o=E();const i=o.general.state.scrollParent;const r=new IntersectionObserver((([t])=>{const o=t.rootBounds||document.scrollingElement.getBoundingClientRect();const r={};if(n==="top"){r.top=t.boundingClientRect.y-(o.y+i.scrollTop)<0&&!t.isIntersecting}if(n==="bottom"){const n=t.target.getBoundingClientRect();r.bottom=n.height+n.y>o.height&&!t.isIntersecting}if(!!e)e(r)}),{threshold:[1],rootMargin:"0px 100px 0px 100px",root:i===document.scrollingElement?null:i});L.set(t,r);requestAnimationFrame((()=>r.observe(t)))}function G(t,n,e=false){const o={[`${b}__${t}`]:true,[`${b}__pin`]:!!n,[`${b}__pin--top`]:n==="top",[`${b}__pin--bottom`]:n==="bottom"};if(e)return K(o);return o}function K(t){let n="";Object.entries(t).forEach((([t,e])=>{if(e)n+=t+" "}));return n}function Q(t){let n=getComputedStyle(t);const e=n.position==="absolute";const o=/(auto|scroll)/;if(n.position==="fixed")return document.documentElement;for(let i=t;i=i.parentElement;){n=getComputedStyle(i);if(e&&n.position==="static"){continue}if(o.test(n.overflow+n.overflowY+n.overflowX))return i}return document.documentElement}function V(t,n=100){const e=t.getBoundingClientRect();const o=window.innerHeight||document.documentElement.clientHeight;if(!e.bottom&&!e.top&&!e.left&&!e.right&&!e.height&&!e.width&&!e.x&&!e.y)return false;return!(Math.floor(100-(e.top>=0?0:e.top)/+-e.height*100)<n||Math.floor(100-(e.bottom-o)/e.height*100)<n)}function X(t,n,e){const o=[...e];const i=o.splice(t,1)[0];o.splice(n,0,i);return o}let Y;let tt;let nt;let et;const ot=({column:t,headRenderer:n,onColumnSortClick:e,onColumnPinned:r,onColumnDrag:s,onColumnDrop:a,defaults:l})=>{const d=E();function c(t,n){Y=n;tt=nt=t.target;et=tt.closest("."+`${b}__tr`);et.classList.add(`${b}__dragging`);tt.classList.add(`${b}__drag--start`);t.dataTransfer.effectAllowed="move";t.dataTransfer.setData("text/html",tt.innerHTML);s(n.prop,tt)}function h(){et.classList.remove(`${b}__dragging`);tt.classList.remove(`${b}__drag--start`);et.querySelectorAll(`.${b}__drag-mask--active`).forEach((t=>{t.classList.remove(`${b}__drag-mask--active`)}));tt=null;Y=null;et=null;nt=null}function p(t){if(nt===t.target)return;t.preventDefault();t.stopImmediatePropagation();t.dataTransfer.dropEffect="move";et.querySelectorAll(`.${b}__drag-mask--active`).forEach((t=>{t.classList.remove(`${b}__drag-mask--active`)}));nt=t.target;if(!nt.classList.contains(`${b}__drag-mask`)){t.dataTransfer.dropEffect="none";return}nt.classList.add(`${b}__drag-mask--active`)}function _(t){t.stopPropagation();const{colName:n}=this.dataset;if(n===Y.prop)return;const e=d.config.state.columns;let o=e.findIndex((t=>t.prop===n));const i=e.findIndex((t=>t===Y));if(o<i&&this.classList.contains(`${b}__drag-mask--end`))o++;if(o>i&&this.classList.contains(`${b}__drag-mask--start`))o--;if(o===i)return;a(Y.prop,d.config.state.columns[o].prop,tt)}function f(n){let o;switch(t.order){case"asc":o="desc";break;case"desc":o=null;break;default:o="asc"}e(o,t.prop,n.target.closest("th"))}function u(){return!!l.sortable&&t.sortable!==false||!l.sortable&&t.sortable===true}function g(){return!!l.draggable&&t.draggable!==false||!l.draggable&&t.draggable===true}let m={};if(t.columnProperties){m=t.columnProperties(t)||m}const v={class:Object.assign(Object.assign({},G("th",n===null||n===void 0?void 0:n.pinned)),{[`${b}__pin--start`]:t.pinned==="start",[`${b}__pin--end`]:t.pinned==="end",[`${b}__ordered`]:!!t.order,[`${b}__filtered`]:!!t.filter})};let w=m?W(v,m):v;const y=q(t);if(!y)return o(i,null);w=Number(w.colSpan)>1?Object.assign(Object.assign({},w),{scope:"colgroup"}):Object.assign(Object.assign({},w),{scope:"col"});if(u()){const n=t.order?t.order==="asc"?"ascending":"descending":"none";w=Object.assign(Object.assign({},w),{"aria-sort":n})}if(g()){w=Object.assign(Object.assign({},w),{draggable:true,onDragStart:n=>c(n,t),onDragOver:t=>t.preventDefault(),onDragEnd:()=>h()})}return o("th",Object.assign({},w,{ref:e=>{if(["end","start"].includes(t.pinned))Z(e,t.pinned,r);if(["top","bottom"].includes(n.pinned))U(e,n.pinned,r)},key:t.prop}),g()&&[o("div",{class:{[`${b}__drag-mask`]:true,[`${b}__drag-mask--start`]:true},"data-col-name":t.prop,onDragEnter:p,onDrop:_,onDragOver:t=>t.preventDefault()}),o("div",{class:{[`${b}__drag-mask`]:true,[`${b}__drag-mask--end`]:true},"data-col-name":t.prop,onDragEnter:p,onDrop:_,onDragOver:t=>t.preventDefault()})],u()?o("button",{class:{[`${b}__order-btn`]:true,[`${b}__cell-content`]:true},onClick:f},q(t),!!t.filter&&o("nano-icon",{name:"light/filter"}),!!t.order&&(t.order==="desc"?o("nano-icon",{name:"solid/long-arrow-down"}):o("nano-icon",{name:"solid/long-arrow-up"})),o("div",{class:`${b}__status-icons`},o("nano-icon",{name:"light/chevron-down"}))):o("div",{class:`${b}__cell-content`},q(t),!!t.filter&&o("nano-icon",{name:"light/bars-filter"})))};function it(t,n){var e,r;const s=E();const a=s.config.state.columns;const l=(e=a[n])===null||e===void 0?void 0:e.cellTemplate;const d=P(t,n);if(!!d.cellModel&&a[n].type==="date"){const t=new Date(d.cellModel);if(t instanceof Date&&!isNaN(t)){d.cellModel=!l?`${new Date(d.cellModel).toLocaleDateString()} ${new Date(d.cellModel).toLocaleTimeString()}`:t}}return l?l(o,d):d.cellModel?o(i,null,(r=d.cellModel)===null||r===void 0?void 0:r.toString()):""}const rt=(t,n=false)=>{const e=E();const o=e.config.state.columns[t];const i={[`${b}__td`]:true,[`${b}__ordered`]:!!o.order,[`${b}__pin`]:!!o.pinned,[`${b}__pin--start`]:o.pinned==="start",[`${b}__pin--end`]:o.pinned==="end"};if(n)return K(i);return i};const st=({rowIndex:t,colIndex:n,nestedContent:e})=>{const i=()=>e?e():it(t,n)||o("span",{class:"placeholder"}," ");let r="td";const s=E();const a=s.config.state.columns[n];let l=H(t,n,{class:rt(n)});if(a.rowHeader){l=Number(l.rowSpan)>1?Object.assign(Object.assign({},l),{scope:"rowgroup"}):Object.assign(Object.assign({},l),{scope:"row"});r="th"}const d=t=>o("div",Object.assign({},t,{class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:!!a.wrap}}),o(i,null));return o(r,Object.assign({},l),a.autoTooltip&&!a.wrap?o("nano-resize-observe",{notifyContentFit:"x",onNanoResizeContentFitChange:t=>t.target.firstElementChild.disabled=t.detail.x},o("nano-tooltip",{disabled:true,placement:"top",onNanoShow:t=>t.target.closest(r).style.zIndex="100",onNanoHide:t=>t.target.closest(r).style.zIndex=""},o(d,null),o("span",{slot:"content"},o(i,null)))):o(d,null))};const at=({rowRenderer:t,rowIndex:n,rowModel:e,onColumnPinned:i},r,s)=>{let a={};const l=({header:t,wrap:n},e)=>{const i=o("div",{class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:n}},e);return t?o("th",{scope:"row"},i):o("td",null,i)};if(!e){const t=A(n);e=t.rowModel}if(t===null||t===void 0?void 0:t.rowProperties){a=t.rowProperties({rowModel:e,rowIndex:n})||a}let d;if((t===null||t===void 0?void 0:t.pinned)&&typeof t.pinned==="function"){d=t.pinned()}const c={class:G("tr",d)};const h=a?W(c,a):c;const p=t===null||t===void 0?void 0:t.template;if(p){let t=p(o,{renderedRow:o("tr",Object.assign({},h,{key:e.__uuid}),r),rowModel:e,rowIndex:n},l);if(Array.isArray(t)){t=s.map(t,((t,n)=>{if(t.vtag==="tr"){if(!t.vkey)t.vkey=`${e.__uuid}_${n}`;t.vattrs=W({class:G("tr",d,true)},t.vattrs);if(!!t.vchildren){t.vchildren=s.map(t.vchildren,((t,n)=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=W({class:G(t.vtag.toString(),d,true)+rt(n,true),ref:t=>{if(!!t&&d==="top"||d==="bottom")U(t,d,i);if(!!t&&t.classList.contains("nano-tbl__pin--end"))Z(t,"end",i);if(!!t&&t.classList.contains("nano-tbl__pin--start"))Z(t,"start",i)}},t.vattrs)}return t}))}}return t}))}return t}return o("tr",Object.assign({},h,{key:e.__uuid}),r)};const lt=({rowRenderer:t,onColumnPinned:n},e,i)=>{let r={};if(t.rowProperties){r=t.rowProperties()||{}}const s=({header:t,wrap:n},e)=>{const i=o("div",{class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:n}},e);return t!==false?o("th",{scope:"col"},i):o("td",null,i)};const a=t.pinned||null;const l={class:G("tr",null)};const d=r?W(l,r):l;const c=t===null||t===void 0?void 0:t.template;if(c){let t=c(o,{renderedRow:o("tr",Object.assign({},d),e)},s);if(Array.isArray(t)){t=i.map(t,(t=>{if(t.vtag==="tr"){t.vattrs=W({class:G("tr",a,true)},t.vattrs);if(!!t.vchildren){t.vchildren=i.map(t.vchildren,(t=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=W({class:G(t.vtag.toString(),a,true),ref:t=>{if(!!t&&a==="top"||a==="bottom")U(t,a,n);if(!!t&&t.classList.contains("nano-tbl__pin--end"))Z(t,"end",n);if(!!t&&t.classList.contains("nano-tbl__pin--start"))Z(t,"start",n)}},t.vattrs)}return t}))}}return t}))}return t}return o("tr",Object.assign({},d),e)};const dt=':host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}nano-table{display:block;width:100%;--max-col-width:clamp(200px, 500px, 50vw);--color:var(--nano-color-mediumgrey, #68767e);--font-size:0.87rem;--cell-line-height:1.5;--thead-font-size:0.95rem;--thead-color:#455560;--tfoot-color:#455560;--border-color:#dddbda;--border-style:thin solid var(--border-color);--border-tint-color:#0084a9;--border-tint-style:3px solid var(--border-tint-color);--cell-bg-rgb:var(--nano-color-white-rgb, 255 255 255);--head-bg-rgb:250 250 249;--foot-bg-rgb:var(--head-bg-rgb);--th-row-bg-rgb:var(--cell-bg-rgb);--ordered-bg-rgb:var(--nano-color-offwhite-rgb, 249 249 251);--td-padding-start:0.625rem;--td-padding-end:0.625rem;--td-padding-top:0.5rem;--td-padding-bottom:0.4125rem;--th-padding-start:0.625rem;--th-padding-end:0.625rem;--th-padding-top:0.875rem;--th-padding-bottom:0.6875rem;--td-padding-v:var(--td-padding-top) var(--td-padding-bottom);--td-padding-h:var(--td-padding-start) var(--td-padding-end);--th-padding-v:var(--th-padding-top) var(--th-padding-bottom);--th-padding-h:var(--th-padding-start) var(--th-padding-end);--foot-th-padding-v:var(--td-padding-top) var(--td-padding-bottom);--foot-th-padding-h:var(--td-padding-start) var(--td-padding-end);--head-th-padding-v:var(--th-padding-top) var(--th-padding-bottom);--head-th-padding-h:var(--th-padding-start) var(--th-padding-end);--bookend-col-padding:2rem}.nano-tbl{color:var(--color);text-align:start;width:100%;font-size:var(--font-size);border-spacing:0 0;border-collapse:separate;background:rgb(var(--cell-bg-rgb));-webkit-border-end:1px solid transparent;border-inline-end:1px solid transparent;-webkit-border-before:1px solid transparent;border-block-start:1px solid transparent;position:relative;z-index:1}.nano-tbl__wrap{display:table;min-width:100%}.nano-tbl__top-anchor{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;position:relative}.nano-tbl__ordered{background-color:var(--ordered-bg);-webkit-border-start:var(--border-style);border-inline-start:var(--border-style);-webkit-border-end:var(--border-style);border-inline-end:var(--border-style)}.nano-tbl__drag-mask{display:none;position:absolute;inset-block:-2px -2px;z-index:10;opacity:0;transition:0.2s ease opacity}.nano-tbl__drag-mask--start{width:calc(50% + 2px);inset-inline-start:-2px;-webkit-border-start:2px dashed var(--border-tint-color);border-inline-start:2px dashed var(--border-tint-color)}.nano-tbl__drag-mask--end{width:50%;inset-inline-end:0;-webkit-border-end:2px dashed var(--border-tint-color);border-inline-end:2px dashed var(--border-tint-color)}.nano-tbl__drag-mask--active{opacity:1}.nano-tbl__dragging .nano-tbl__drag-mask{display:block}.nano-tbl__drag--start{opacity:0.4}.nano-tbl__dragging .nano-tbl__td,.nano-tbl__dragging .nano-tbl__th{cursor:no-drop}.nano-tbl__dragging .nano-tbl__td .nano-tbl__cell-content,.nano-tbl__dragging .nano-tbl__th .nano-tbl__cell-content{pointer-events:none}.nano-tbl__order-btn{padding:0;border:none;outline:none;font:inherit;background:none;-webkit-appearance:none;appearance:none;color:inherit;display:flex;gap:10px;align-items:center;width:100%}.nano-tbl__status-icons{margin-inline:auto 10px;display:flex;gap:10px}.nano-tbl__progress-bar{font-size:0.2rem;position:sticky;inset-block-start:0;inset-inline:0;z-index:10;transition:scale 0.25s;transform:scale(0);width:100%;height:0}.nano-tbl__progress-bar--show{transform:scale(1);height:auto}.nano-tbl__caption--hide{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}.nano-tbl__td,.nano-tbl__th{line-height:var(--cell-line-height);text-align:start;-webkit-border-before:var(--border-style);border-block-start:var(--border-style);max-width:var(--max-col-width);background-color:rgb(var(--cell-bg-rgb))}tbody:first-of-type tr:first-child .nano-tbl__td,tbody:first-of-type tr:first-child .nano-tbl__th{-webkit-border-before:none;border-block-start:none}tbody:last-of-type tr:last-child .nano-tbl__td,tbody:last-of-type tr:last-child .nano-tbl__th{-webkit-border-after:var(--border-style);border-block-end:var(--border-style)}.md .nano-tbl__td:first-child .nano-tbl__cell-content,.md .nano-tbl__th:first-child .nano-tbl__cell-content{-webkit-padding-start:var(--bookend-col-padding);padding-inline-start:var(--bookend-col-padding)}.md .nano-tbl__td:last-child .nano-tbl__cell-content,.md .nano-tbl__th:last-child .nano-tbl__cell-content{-webkit-padding-end:var(--bookend-col-padding);padding-inline-end:var(--bookend-col-padding)}@media (max-width: 768px){.nano-tbl__td:first-child .nano-tbl__cell-content,.nano-tbl__th:first-child .nano-tbl__cell-content{-webkit-padding-start:var(--td-padding-start) !important;padding-inline-start:var(--td-padding-start) !important}.nano-tbl__td:last-child .nano-tbl__cell-content,.nano-tbl__th:last-child .nano-tbl__cell-content{-webkit-padding-end:var(--td-padding-end) !important;padding-inline-end:var(--td-padding-end) !important}}thead .nano-tbl__td,thead .nano-tbl__th{color:var(--thead-color);font-weight:800;background:rgb(var(--head-bg-rgb)/90%);font-size:var(--thead-font-size);-webkit-border-before:none !important;border-block-start:none !important;transition:all 0.2s ease}thead .nano-tbl__td .nano-tbl__cell-content,thead .nano-tbl__th .nano-tbl__cell-content{padding-block:var(--head-th-padding-v);padding-inline:var(--head-th-padding-h)}tfoot .nano-tbl__td,tfoot .nano-tbl__th{color:var(--tfoot-color);font-weight:800;-webkit-border-before:none;border-block-start:none;background:rgb(var(--foot-bg-rgb)/90%);font-size:var(--thead-font-size)}tfoot .nano-tbl__td .nano-tbl__cell-content,tfoot .nano-tbl__th .nano-tbl__cell-content{padding-block:var(--foot-th-padding-v);padding-inline:var(--foot-th-padding-h)}.nano-tbl__td.nano-tbl__ordered,.nano-tbl__th.nano-tbl__ordered{background-color:rgb(var(--ordered-bg-rgb)/80%) !important}.nano-tbl__cell-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-block:var(--td-padding-v);padding-inline:var(--td-padding-h)}.nano-tbl__cell-content--no-result{padding-block:2rem}.nano-tbl__cell-content--wrap{white-space:normal;overflow:visible}.nano-tbl tbody{will-change:scroll-position;opacity:1;transition:0.1s ease opacity;transform:translateZ(0)}.nano-tbl tbody.nano-tbl__inactive{opacity:0}.nano-tbl th[scope=row]{font-weight:800;margin:0}.nano-tbl__pin{position:sticky;transform:translateZ(0)}.nano-tbl__pin--start{inset-inline:-1px auto;transition:max-width 0.25s ease}.nano-tbl__pin--start::after{content:"";position:absolute;inset:0;box-shadow:5px 1px 4px 0 rgba(0, 0, 0, 0.2);opacity:0;z-index:-1}.nano-tbl__pinned--start .nano-tbl__pin--start{z-index:2;max-width:125px !important}.sm .nano-tbl__pinned--start .nano-tbl__pin--start{max-width:var(--max-col-width) !important}.nano-tbl__pinned--start .nano-tbl__pin--start::after{opacity:1}.nano-tbl__pin--end{}.nano-tbl__pin--start+.nano-tbl__pin--end{inset-inline:auto auto}.nano-tbl__pin--start+.nano-tbl__pin--end::after{display:none}.sm .nano-tbl__pin--end{inset-inline:auto -1px !important;max-width:min(50vw, 200px)}.sm .nano-tbl__pin--end::after{display:block !important;content:"";position:absolute;inset:0;box-shadow:-5px 1px 4px 0 rgba(0, 0, 0, 0.2);opacity:0;z-index:-1}.sm .nano-tbl__pinned--end .nano-tbl__pin--end::after{opacity:1}.nano-tbl__pin--top{inset-block:-1px auto}.nano-tbl__pinned--top .nano-tbl__pin--top{z-index:4 !important}.nano-tbl__pin--bottom{inset-block:auto -1px}.nano-tbl__pinned--bottom .nano-tbl__pin--bottom{z-index:5 !important}.nano-tbl__pinned--start .nano-tbl__pin--top.nano-tbl__pin--start{z-index:5 !important}.nano-tbl__pinned--top.nano-tbl__pinned--start .nano-tbl__pin--top.nano-tbl__pin--start{z-index:6 !important}.nano-tbl__pinned--end .nano-tbl__pin--top.nano-tbl__pin--end{z-index:5 !important}.nano-tbl__pinned--top.nano-tbl__pinned--end .nano-tbl__pin--top.nano-tbl__pin--end{z-index:6 !important}.nano-tbl__pinned--start .nano-tbl__pin--bottom.nano-tbl__pin--start{z-index:5 !important}.nano-tbl__pinned--bottom.nano-tbl__pinned--start .nano-tbl__pin--bottom.nano-tbl__pin--start{z-index:6 !important}.nano-tbl__pinned--end .nano-tbl__pin--bottom.nano-tbl__pin--end{z-index:5 !important}.nano-tbl__pinned--bottom.nano-tbl__pinned--end .nano-tbl__pin--bottom.nano-tbl__pin--end{z-index:6 !important}.nano-tbl thead tr:last-of-type td,.nano-tbl thead tr:last-of-type th{-webkit-border-after:var(--border-tint-style);border-block-end:var(--border-tint-style)}.nano-tbl tfoot tr:first-of-type td,.nano-tbl tfoot tr:first-of-type th{-webkit-border-before:none;border-block-start:none}.nano-tbl tfoot tr:last-of-type td,.nano-tbl tfoot tr:last-of-type th{-webkit-border-after:var(--border-tint-style);border-block-end:var(--border-tint-style)}.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:first-of-type td,.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:first-of-type th{-webkit-border-before:var(--border-tint-style) !important;border-block-start:var(--border-tint-style) !important}.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:last-of-type td,.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:last-of-type th{-webkit-border-after:none !important;border-block-end:none !important}.nano-tbl .unlimited-width{max-width:none}.nano-tbl__spinner{font-size:1.5rem;transition:scale 0.25s;scale:0;padding:0.5rem;position:absolute;inset-block-end:0;inset-inline-start:calc(50% - 0.75rem);z-index:0}.nano-tbl__spinner--show{scale:1;position:sticky}.nano-tbl nano-skeleton{line-height:var(--cell-line-height)}';let ct=0;const ht=class{constructor(t){r(this,t);this.nanoTblReady=s(this,"nanoTblReady",7);this.nanoTblBlockRendered=s(this,"nanoTblBlockRendered",7);this.nanoTblBeforeSort=s(this,"nanoTblBeforeSort",7);this.nanoTblAfterSort=s(this,"nanoTblAfterSort",7);this.nanoTblColDrag=s(this,"nanoTblColDrag",7);this.nanoTblColDrop=s(this,"nanoTblColDrop",7);this.nanoTblBeforeFilter=s(this,"nanoTblBeforeFilter",7);this.nanoTblAfterFilter=s(this,"nanoTblAfterFilter",7);this.nanoTblBeforeSearch=s(this,"nanoTblBeforeSearch",7);this.nanoTblAfterSearch=s(this,"nanoTblAfterSearch",7);this.nanoTblBeforeEdit=s(this,"nanoTblBeforeEdit",7);this.renderId="tbl-"+ct++;this.filters=[];this.currentFilters="[]";this.currentSort="";this.cacheScrollPosition=0;this.measureHeight=0;this.blockHeights=[];this.unitHeight=0;this._isReady=false;this.colDrag=t=>{this.nanoTblColDrag.emit({column:t})};this.colDrop=(t,n)=>{const e=this.store.config.state.columns;const o=e.findIndex((t=>t.prop===n));const i=e.findIndex((n=>n.prop===t));const r=this.nanoTblColDrop.emit({fromCol:t,toCol:n,fromIndex:i,toIndex:o});if(r.defaultPrevented)return;this.columns=X(i,o,e)};this.sortStart=async(t,n,e)=>{if(this.currentSort===t+":"+n)return;this._loading=true;const o=this.nanoTblBeforeSort.emit({column:n,order:t});if(o.defaultPrevented)return;this.currentSort=t+":"+n;this.scrollToTop(e);if(this.customSortFn){try{const e=await this.customSortFn(n,t);if(e===true){this.sortComplete(t,n);this._loading=false;return}}catch(t){console.warn("custom sort failed",t);this.currentSort="";this._loading=false;return}}try{await F(this.host,n,t);this.sortComplete(t,n)}catch(t){console.warn("sort failed",t);this.currentSort=""}finally{if(this.blocks.length)this._loading=false}};this.scrollHandler=()=>{this.cacheScrollPosition=this.scrollParent.scrollTop||window.scrollY;requestAnimationFrame((()=>{let t=0;let n=0;const e=this.blocks.length;while(n<e&&this.cacheScrollPosition>=t){t+=this.getBlockHeight(n);if(this.cacheScrollPosition<t){const t=[n,n+1,Math.max(0,n-1)];if(t.toString()!==this.activeBlocks.toString()){this.activeBlocks=t;this.setBlockHeight()}this.primaryBlockIndex=n}n++}}))};this.handleColumnPinned=t=>{Object.entries(t).forEach((([t,n])=>{this.tableEle.classList.toggle(`${b}__pinned--${t}`,n)}))};this.handleResizeChange=t=>{var n;this.tableWrapperEle.className="";let e=[`${b}__wrap`];if((n=t.target)===null||n===void 0?void 0:n.className)e=[...t.target.className.split(" "),...e];this.tableWrapperEle.classList.add(...e.filter((t=>!!t)))};this.type="table";this.caption=undefined;this.showCaption=false;this.loading=undefined;this.internalLoading=false;this.placeholderSize=5;this.rows=undefined;this.columns=[];this.headRender={pinned:"top"};this.rowRender=undefined;this.footRender={pinned:"bottom"};this.showFooter=false;this.perBlock=40;this.searchTerm=undefined;this.customFilterFn=undefined;this.customSortFn=undefined;this.defaultSort=true;this.defaultColDraggable=false;this.virtualTotalItems=0;this.blocks=[];this.activeBlocks=[0,1,2];this.debounceSetLoading=c(this.debounceSetLoading.bind(this),50)}get _loading(){return this.loading!==undefined?this.loading:this.internalLoading}set _loading(t){if(this.loading!==undefined)return;this.debounceSetLoading(t)}debounceSetLoading(t){this.internalLoading=t}handleRowsChange(){if(!this.rows){this._loading=true;return}this._loading=true;Promise.resolve(this.rows).then((async t=>{await R(this.host,t);this.currentFilters="";this.currentSort="";await this.columnInit();if(!this.isReady)this.setInitialBlockDimension();this._loading=false}))}async handleColsChange(){await M(this.host,this.columns);if(this.isReady)this.columnInit()}get blocksLength(){return this.blocks.length}handleSearchTermChange(){this.searchStart()}virtualTotalItemsChangeHandler(){this.setBlocks()}async resetSorting(){const t=this.columns.find((t=>!!t.order));if(!t)return;return this.sortStart(null,t.prop)}async addSort(t,n){const e=this.columns.find((n=>n.prop===t));if(!e)throw"Cannot find column with "+t;return this.sortStart(n,e.prop)}async resetFilters(){this.filters=[];return this.filterStart()}async addFilters(t,n=true){if(!n)this.filters=[];return this.filterStart(t,n)}async removeFilters(t){this.filters=this.filters.filter((n=>!t.includes(n.prop)));return this.filterStart()}async updateRow(t,n){this.rows.splice(n,1,t);this.handleRowsChange()}set measureEle(t){var n;if(!t)return;const e=t.getBoundingClientRect().height;this.measureHeight=Math.abs(this.measureHeight-e)<5?this.measureHeight:e;this.unitHeight=((n=t.querySelector("tr"))===null||n===void 0?void 0:n.getBoundingClientRect().height)||this.unitHeight}get scrollParent(){return this._scrollParent}set scrollParent(t){if(t===this._scrollParent)return;if(this._scrollParent){(this._scrollParent===document.documentElement?document:this._scrollParent).removeEventListener("scroll",this.scrollHandler)}(t===document.documentElement?document:t).addEventListener("scroll",this.scrollHandler);this._scrollParent=t}get primaryBlockIndex(){return this._primaryBlockIndex}set primaryBlockIndex(t){if(this._primaryBlockIndex===t)return;this._primaryBlockIndex=t;this.nanoTblBlockRendered.emit({block:t,totalBlocks:this.blockElements.length})}get isReady(){return this._isReady}set isReady(t){if(t===this._isReady)return;this._isReady=t;if(this.isReady)requestAnimationFrame((()=>this.handleReady()))}handleReady(){const t=window.location.hash;if(t.length>1){try{const n=document.querySelector(t);if(n)n.scrollIntoView()}catch(t){}}this.nanoTblReady.emit()}sortComplete(t,n){this.columns=this.columns.map((e=>{if(e.prop===n)return Object.assign(Object.assign({},e),{order:t});return Object.assign(Object.assign({},e),{order:null})}));this.nanoTblAfterSort.emit({column:n,order:t})}async searchStart(){this._loading=true;const t=this.nanoTblBeforeSearch.emit({term:this.searchTerm});if(t.defaultPrevented)return;this.scrollToTop();try{await N(this.host,this.searchTerm);this.nanoTblAfterSearch.emit({term:this.searchTerm})}catch(t){console.warn("search failed",t)}finally{this._loading=false}}async filterStart(t,n=true){if(t){if(n){this.filters=[...this.filters.filter((n=>!t.find((t=>t.prop===n.prop)))),...t]}else{this.filters=t}}if(this.currentFilters===JSON.stringify(this.filters))return;this._loading=true;const e=this.nanoTblBeforeFilter.emit({filters:this.filters});if(e.defaultPrevented)return;this.currentFilters=JSON.stringify(this.filters);this.scrollToTop();if(this.customFilterFn){try{const t=await this.customFilterFn(this.filters);if(t===true){this.filterComplete();this._loading=false}}catch(t){console.warn("custom filter failed",t);this.currentFilters="";this._loading=false}return}try{await B(this.host,this.filters);this.filterComplete()}catch(t){console.warn("filter failed",t)}finally{this._loading=false}}filterComplete(){this.columns=this.columns.map((t=>{const n=this.filters.find((n=>n.prop===t.prop));if(n)t.filter=n.filter;return t}));this.nanoTblAfterFilter.emit({filters:this.filters})}scrollToTop(t){var n;const e=(n=this.scrollParent.style)===null||n===void 0?void 0:n.scrollBehavior;const o=this.scrollParent.scrollLeft;this.scrollParent.style.scrollBehavior="auto";if(this.topAnchorEle&&!V(this.topAnchorEle,.1)){this.host.scrollIntoView()}if(t&&!V(t,1))setTimeout((()=>t.scrollIntoView({block:"start"})),500);if(o)this.scrollParent.scrollLeft=o;if(e)this.scrollParent.style.scrollBehavior=e;this.scrollHandler()}setMeasureElement(){a((()=>{this.measureEle=this.blockElements.find((t=>{var n;return!((n=t===null||t===void 0?void 0:t.classList)===null||n===void 0?void 0:n.contains(`${b}__inactive`))}))}))}setInitialBlockDimension(){var t;if(!((t=this.blockElements)===null||t===void 0?void 0:t.length))return;const n=new Promise((t=>{a((()=>{this.setMeasureElement();if(!this.measureEle&&!this.unitHeight)t();this.blockElements.forEach(((n,e)=>{var o;if(!n||!((o=n.classList)===null||o===void 0?void 0:o.contains(`${b}__inactive`))){if(e===this.blockElements.length-1)t();return}if(e===this.blockElements.length-1)t()}))}))}));n.then((()=>{requestAnimationFrame((()=>{this.isReady=true}))}))}async columnInit(){this.filters=this.columns.filter((t=>!!t.filter)).map((t=>{const{filter:n,prop:e}=t;return{filter:n,prop:e}}));if(this.searchTerm){await this.searchStart()}if(this.filters.length){await this.filterStart()}const t=this.columns.find((t=>!!t.order));if(!!t){await this.sortStart(t.order,t.prop)}}setBlocks(){const t=this.store.data.state.rows;if(!t.length){this.blocks=[];return}let n=1;const e=this.virtualTotalItems>t.length?this.virtualTotalItems:t.length;let o=[];const i=[];this.blockHeights=[];for(n;n<=e;n++){o.push(this.store.data.state.rows[n-1]||{__uuid:""});if(n%this.perBlock===0){i.push({rows:o,__uuid:d(o.map((t=>t.__uuid)).join())});o=[]}}if(o.length){i.push({rows:o,__uuid:d(o.map((t=>t.__uuid)).join())})}this.blocks=i}getBlockHeight(t){if(this.blockHeights.length){const n=this.blockHeights.find((n=>n.blockIndex===t));if(n)return n.height}const n=this.blocks[t].rows.length;if(n===this.perBlock&&this.measureHeight){return this.measureHeight}return this.unitHeight?this.unitHeight*n:undefined}setBlockHeight(){this.activeBlocks.forEach((t=>{const n=this.blockElements[t];if(!n)return;a((()=>{const e=n.getBoundingClientRect().height;const o=this.blockHeights.findIndex((n=>n.blockIndex===t));if(o>0){this.blockHeights[o]={height:e,blockIndex:t}}else this.blockHeights.push({height:e,blockIndex:t})}))}))}processSlots(){if(!this.caption&&!this.host.querySelector('[slot="caption"]')){console.error("For accessibility you must set a `caption` prop or use the `caption` slot")}}async componentWillLoad(){this.scrollParent=Q(this.host);this.store=await I(this.host,this.columns,this.scrollParent);await this.handleRowsChange();this.processSlots();this.store.data.onChange("rows",(()=>this.setBlocks()));this.setBlocks()}connectedCallback(){this.scrollParent=Q(this.host)}componentDidLoad(){this.setInitialBlockDimension()}componentShouldUpdate(t,n,e){if(["rows","columns"].includes(e))return false}componentWillRender(){}componentDidRender(){this.setMeasureElement()}render(){this.blockElements=[];return o(l,null,o("div",{class:`${b}__top-anchor`,ref:t=>this.topAnchorEle=t}," "),o("nano-resize-observe",{"aria-labelledby":"table-caption-"+this.renderId,tabindex:this.type==="grid"?"0":undefined,states:"576w sm, 768w md",class:"sm md",onNanoResizeStateChange:this.handleResizeChange}),o("div",{class:`${b}__wrap sm md`,ref:t=>this.tableWrapperEle=t},o("nano-progress-bar",{indeterminate:true,class:{[`${b}__progress-bar`]:true,[`${b}__progress-bar--show`]:this._loading}}),o("table",{role:this.type==="grid"?"grid":undefined,"aria-readonly":this.type==="table"?"true":undefined,"aria-rowcount":this.store.data.state.rows.length,"aria-colcount":this.store.config.state.columns.length,class:`${b}`,ref:t=>this.tableEle=t},o("caption",{class:{[`${b}__caption`]:true,[`${b}__caption--hide`]:!this.showCaption},id:"table-caption-"+this.renderId},o("slot",{name:"caption"},this.caption)),o("thead",null,o(lt,{rowRenderer:this.headRender,onColumnPinned:this.handleColumnPinned},this.store.config.state.columns.map((t=>[o(ot,{column:t,headRenderer:this.headRender,onColumnSortClick:this.sortStart,onColumnPinned:this.handleColumnPinned,onColumnDrag:this.colDrag,onColumnDrop:this.colDrop,defaults:{sortable:this.defaultSort,draggable:this.defaultColDraggable}})])))),this._loading&&!this.blocks.length&&o("tbody",{class:`${b}__active`},[...Array(10).keys()].map((t=>o("tr",null,this.store.config.state.columns.map(((n,e)=>o(st,{rowIndex:t,colIndex:e,nestedContent:()=>o("nano-skeleton",null)}))))))),!this._loading&&!this.blocks.length&&o("tr",null,o("th",{class:`${b}__th`,colSpan:this.store.config.state.columns.length},o("div",{class:"nano-tbl__cell-content nano-tbl__cell-content--no-result"},o("slot",{name:"no-results"},"No results found")))),this.blocks.map(((t,n)=>o("tbody",{key:t.__uuid,id:`tbody-${this.renderId}-${n}`,ref:t=>{this.blockElements.push(t)},class:{[`${b}__inactive`]:!this.activeBlocks.includes(n),[`${b}__active`]:this.activeBlocks.includes(n)}},this.activeBlocks.includes(n)?t.rows.map(((t,e)=>{const i=n>0?n*this.perBlock+e:e;return o(at,{rowRenderer:this.rowRender,rowModel:t,rowIndex:i},this.store.config.state.columns.map(((t,n)=>o(st,{rowIndex:i,colIndex:n}))))})):o("tr",null,o("td",{colSpan:this.store.config.state.columns.length,style:{height:this.getBlockHeight(n)+"px"}}))))),this.showFooter&&o("tfoot",null,o(lt,{rowRenderer:this.footRender,onColumnPinned:this.handleColumnPinned},this.store.config.state.columns.map((t=>[o(ot,{column:t,headRenderer:this.footRender,onColumnPinned:this.handleColumnPinned,onColumnSortClick:this.sortStart,defaults:{sortable:this.defaultSort,draggable:this.defaultColDraggable}})]))))),!!this.blocks.length&&o("nano-spinner",{type:"circle",class:{[`${b}__spinner`]:true,[`${b}__spinner--show`]:this._loading}})))}get host(){return n(this)}static get watchers(){return{rows:["handleRowsChange"],columns:["handleColsChange"],searchTerm:["handleSearchTermChange"],virtualTotalItems:["virtualTotalItemsChangeHandler"]}}};ht.style=dt;export{ht as T,v as c};
|
5
|
-
//# sourceMappingURL=p-
|
4
|
+
import{j as t,g as n,e,h as o,F as i,r,c as s,d as a,a as l}from"./p-f6a8467a.js";import{a as d}from"./p-ee045579.js";import{d as c}from"./p-9746b0a5.js";import{c as h}from"./p-9ebbb814.js";const b="nano-tbl";const p=(t,n)=>{const e=globalThis[n];return e!=null&&t instanceof e};const _=t=>{if(t!=null){if(p(t,"ArrayBuffer")||p(t,"MessagePort")||p(t,"ImageBitmap")||p(t,"OffscreenCanvas")){return[t]}if(typeof t==="object"){if(t.constructor===Object){t=Object.values(t)}if(Array.isArray(t)){return t.flatMap(_)}return _(t.buffer)}}return[]};let f=0;let u=0;const g=new Map;const m=new Map;const v=(n,e,o)=>{const i=new Worker(n,{name:e});i.addEventListener("message",(({data:n})=>{if(n){const e=n[0];const i=n[1];const r=n[2];if(e===o){const e=n[3];const[o,s,a]=g.get(i);g.delete(i);if(e){const n=e.isError?Object.assign(new Error(e.value.message),e.value):e.value;t(n);s(n)}else{if(a){a.forEach((t=>m.delete(t)))}o(r)}}else if(e===o+".cb"){try{m.get(i)(...r)}catch(n){t(n)}}}}));return i};const w=(t,n,e)=>(...o)=>new Promise(((i,r)=>{let s=f++;let a=0;let l=o.length;let d=[i,r];g.set(s,d);for(;a<l;a++){if(typeof o[a]==="function"){const t=u++;m.set(t,o[a]);o[a]=[n+".cb",t];(d[2]=d[2]||[]).push(t)}}const c=t=>t.postMessage([n,s,e,o],_(o));if(t.then){t.then(c)}else{c(t)}}));const y=import("./p-4b136a65.js").then((t=>t.worker));const k=w(y,"stencil.table.worker","createWorkerStore");const x=w(y,"stencil.table.worker","syncConfigToWorker");const $=w(y,"stencil.table.worker","syncDataToWorker");const j=w(y,"stencil.table.worker","workerFilter");const O=w(y,"stencil.table.worker","workerSearch");const C=w(y,"stencil.table.worker","workerSort");function z(t){const n=JSON.parse(JSON.stringify(t));t.forEach((t=>{if(!!t.sortCompareFn){const e=n.find((n=>n.prop===t.prop));e.sortCompareFn=t.sortCompareFn.toString()}}));return n}const S=new WeakMap;async function I(t,n,e){const o={data:h({rows:[]}),config:h({columns:n}),general:h({workerId:null,scrollParent:e,host:t})};const i=await k(o.data.state.rows,z(o.config.state.columns));o.general.state.workerId=i;S.set(t,o);o.data.use({reset:()=>{if(o.general.state.workerId)$(o.general.state.workerId,null)},dispose:()=>{if(o.general.state.workerId)$(o.general.state.workerId,null)}});o.config.use({reset:()=>{if(o.general.state.workerId)x(o.general.state.workerId,null)},dispose:()=>{if(o.general.state.workerId)x(o.general.state.workerId,null)}});return o}function D(t){return S.get(t)}function T(t){if(t instanceof Date){return"date"}if(["number","string"].includes(typeof t)){return typeof t}return"unknown"}function R(t,n){const e=S.get(t);if(!e)return;const o=e.config.state.columns;const i=o.filter((t=>t.type==="date")).reduce(((t,n)=>[...t,n.prop]),[]);const r=o.filter((t=>!t.type));n=n.map(((t,n)=>{if(r.length&&n===0){e.config.state.columns=o.map((n=>{if(r.includes(n)&&t[n.prop]&&!n.type){n.type=T(t[n.prop]);if(n.type==="date")i.push(n.prop)}return n}))}i.forEach((n=>{var e;const o=(e=new Date(t[n]))!==null&&e!==void 0?e:null;if(!!o&&Number(o))t[n]=Number(o)}));t["__index"]=n;t["__uuid"]=d(o.map((n=>t[n.prop])).join());return t}));e.data.state.rows=n;if(e.general.state.workerId)return $(e.general.state.workerId,n)}function M(t,n){const e=S.get(t);if(!e)return;e.config.state.columns=n;if(e.general.state.workerId)return x(e.general.state.workerId,z(n))}async function N(t,n){const e=S.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await O(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function B(t,n){const e=S.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await j(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function F(t,n,e){const o=S.get(t);if(!o||!o.general.state.workerId)return;try{o.data.state.rows=await C(o.general.state.workerId,n,e)}catch(t){console.warn(t)}}function P(t,n){const e=E();const o=e.config.state.columns;const i=e.data.state.rows;const r=o[n];const s=r===null||r===void 0?void 0:r.prop;const a=i[t];const l=a?a[o[n].prop]:"";return{prop:s,cellModel:l,column:r,rowIndex:t,rowModel:a}}function A(t){const n=E();const e=n.data.state.rows;const o=e[t];return{rowModel:o,rowIndex:t}}function W(t,n){if(!n)return t;const e=Object.assign(Object.assign({},n),t);if(n.class){if(typeof n.class==="object"&&typeof e.class==="object"){e.class=Object.assign(Object.assign({},n.class),e.class)}else if(typeof n.class==="string"&&typeof e.class==="object"){e.class[n.class]=true}else if(typeof e.class==="string"){e.class+=" "+n.class}}if(n.style){e.style=Object.assign(Object.assign({},n.style),e.style)}return e}function E(){return D(n(e()))}function H(t,n,e){var o;const i=Object.assign({},e);const r=(o=E().config.state.columns[n])===null||o===void 0?void 0:o.cellProperties;if(!r)return i;const s=P(t,n);const a=r(s);if(!a)return i;return W(i,a)}function q(t){const n=t===null||t===void 0?void 0:t.columnTemplate;return n?n(o,t):o(i,null,t.title)}const J=new WeakMap;const L=new WeakMap;function Z(t,n,e){if(J.get(t))return;const o=E();const i=o.general.state.scrollParent;const r=new IntersectionObserver((([t])=>{const o=t.rootBounds||document.scrollingElement.getBoundingClientRect();const r={};if(n==="start"){r.start=t.boundingClientRect.x-(o.x+i.scrollLeft)<0&&!t.isIntersecting}if(n==="end"){r.end=t.boundingClientRect.right>t.boundingClientRect.width&&!t.isIntersecting}if(!!e)e(r)}),{threshold:[1],rootMargin:"1px 0px 100px 0px",root:i===document.scrollingElement?null:i});J.set(t,r);setTimeout((()=>r.observe(t)),300)}function U(t,n,e){if(L.get(t))return;const o=E();const i=o.general.state.scrollParent;const r=new IntersectionObserver((([t])=>{const o=t.rootBounds||document.scrollingElement.getBoundingClientRect();const r={};if(n==="top"){r.top=t.boundingClientRect.y-(o.y+i.scrollTop)<0&&!t.isIntersecting}if(n==="bottom"){const n=t.target.getBoundingClientRect();r.bottom=n.height+n.y>o.height&&!t.isIntersecting}if(!!e)e(r)}),{threshold:[1],rootMargin:"0px 100px 0px 100px",root:i===document.scrollingElement?null:i});L.set(t,r);requestAnimationFrame((()=>r.observe(t)))}function G(t,n,e=false){const o={[`${b}__${t}`]:true,[`${b}__pin`]:!!n,[`${b}__pin--top`]:n==="top",[`${b}__pin--bottom`]:n==="bottom"};if(e)return K(o);return o}function K(t){let n="";Object.entries(t).forEach((([t,e])=>{if(e)n+=t+" "}));return n}function Q(t){let n=getComputedStyle(t);const e=n.position==="absolute";const o=/(auto|scroll)/;if(n.position==="fixed")return document.documentElement;for(let i=t;i=i.parentElement;){n=getComputedStyle(i);if(e&&n.position==="static"){continue}if(o.test(n.overflow+n.overflowY+n.overflowX))return i}return document.documentElement}function V(t,n=100){const e=t.getBoundingClientRect();const o=window.innerHeight||document.documentElement.clientHeight;if(!e.bottom&&!e.top&&!e.left&&!e.right&&!e.height&&!e.width&&!e.x&&!e.y)return false;return!(Math.floor(100-(e.top>=0?0:e.top)/+-e.height*100)<n||Math.floor(100-(e.bottom-o)/e.height*100)<n)}function X(t,n,e){const o=[...e];const i=o.splice(t,1)[0];o.splice(n,0,i);return o}let Y;let tt;let nt;let et;const ot=({column:t,headRenderer:n,onColumnSortClick:e,onColumnPinned:r,onColumnDrag:s,onColumnDrop:a,defaults:l})=>{const d=E();function c(t,n){Y=n;tt=nt=t.target;et=tt.closest("."+`${b}__tr`);et.classList.add(`${b}__dragging`);tt.classList.add(`${b}__drag--start`);t.dataTransfer.effectAllowed="move";t.dataTransfer.setData("text/html",tt.innerHTML);s(n.prop,tt)}function h(){et.classList.remove(`${b}__dragging`);tt.classList.remove(`${b}__drag--start`);et.querySelectorAll(`.${b}__drag-mask--active`).forEach((t=>{t.classList.remove(`${b}__drag-mask--active`)}));tt=null;Y=null;et=null;nt=null}function p(t){if(nt===t.target)return;t.preventDefault();t.stopImmediatePropagation();t.dataTransfer.dropEffect="move";et.querySelectorAll(`.${b}__drag-mask--active`).forEach((t=>{t.classList.remove(`${b}__drag-mask--active`)}));nt=t.target;if(!nt.classList.contains(`${b}__drag-mask`)){t.dataTransfer.dropEffect="none";return}nt.classList.add(`${b}__drag-mask--active`)}function _(t){t.stopPropagation();const{colName:n}=this.dataset;if(n===Y.prop)return;const e=d.config.state.columns;let o=e.findIndex((t=>t.prop===n));const i=e.findIndex((t=>t===Y));if(o<i&&this.classList.contains(`${b}__drag-mask--end`))o++;if(o>i&&this.classList.contains(`${b}__drag-mask--start`))o--;if(o===i)return;a(Y.prop,d.config.state.columns[o].prop,tt)}function f(n){let o;switch(t.order){case"asc":o="desc";break;case"desc":o=null;break;default:o="asc"}e(o,t.prop,n.target.closest("th"))}function u(){return!!l.sortable&&t.sortable!==false||!l.sortable&&t.sortable===true}function g(){return!!l.draggable&&t.draggable!==false||!l.draggable&&t.draggable===true}let m={};if(t.columnProperties){m=t.columnProperties(t)||m}const v={class:Object.assign(Object.assign({},G("th",n===null||n===void 0?void 0:n.pinned)),{[`${b}__pin--start`]:t.pinned==="start",[`${b}__pin--end`]:t.pinned==="end",[`${b}__ordered`]:!!t.order,[`${b}__filtered`]:!!t.filter})};let w=m?W(v,m):v;const y=q(t);if(!y)return o(i,null);w=Number(w.colSpan)>1?Object.assign(Object.assign({},w),{scope:"colgroup"}):Object.assign(Object.assign({},w),{scope:"col"});if(u()){const n=t.order?t.order==="asc"?"ascending":"descending":"none";w=Object.assign(Object.assign({},w),{"aria-sort":n})}if(g()){w=Object.assign(Object.assign({},w),{draggable:true,onDragStart:n=>c(n,t),onDragOver:t=>t.preventDefault(),onDragEnd:()=>h()})}return o("th",Object.assign({},w,{ref:e=>{if(["end","start"].includes(t.pinned))Z(e,t.pinned,r);if(["top","bottom"].includes(n.pinned))U(e,n.pinned,r)},key:t.prop}),g()&&[o("div",{class:{[`${b}__drag-mask`]:true,[`${b}__drag-mask--start`]:true},"data-col-name":t.prop,onDragEnter:p,onDrop:_,onDragOver:t=>t.preventDefault()}),o("div",{class:{[`${b}__drag-mask`]:true,[`${b}__drag-mask--end`]:true},"data-col-name":t.prop,onDragEnter:p,onDrop:_,onDragOver:t=>t.preventDefault()})],u()?o("button",{class:{[`${b}__order-btn`]:true,[`${b}__cell-content`]:true},onClick:f},q(t),!!t.filter&&o("nano-icon",{name:"light/filter"}),!!t.order&&(t.order==="desc"?o("nano-icon",{name:"solid/long-arrow-down"}):o("nano-icon",{name:"solid/long-arrow-up"})),o("div",{class:`${b}__status-icons`},o("nano-icon",{name:"light/chevron-down"}))):o("div",{class:`${b}__cell-content`},q(t),!!t.filter&&o("nano-icon",{name:"light/bars-filter"})))};function it(t,n){var e,r;const s=E();const a=s.config.state.columns;const l=(e=a[n])===null||e===void 0?void 0:e.cellTemplate;const d=P(t,n);if(!!d.cellModel&&a[n].type==="date"){const t=new Date(d.cellModel);if(t instanceof Date&&!isNaN(t)){d.cellModel=!l?`${new Date(d.cellModel).toLocaleDateString()} ${new Date(d.cellModel).toLocaleTimeString()}`:t}}return l?l(o,d):d.cellModel?o(i,null,(r=d.cellModel)===null||r===void 0?void 0:r.toString()):""}const rt=(t,n=false)=>{const e=E();const o=e.config.state.columns[t];const i={[`${b}__td`]:true,[`${b}__ordered`]:!!o.order,[`${b}__pin`]:!!o.pinned,[`${b}__pin--start`]:o.pinned==="start",[`${b}__pin--end`]:o.pinned==="end"};if(n)return K(i);return i};const st=({rowIndex:t,colIndex:n,nestedContent:e})=>{const i=()=>e?e():it(t,n)||o("span",{class:"placeholder"}," ");let r="td";const s=E();const a=s.config.state.columns[n];let l=H(t,n,{class:rt(n)});if(a.rowHeader){l=Number(l.rowSpan)>1?Object.assign(Object.assign({},l),{scope:"rowgroup"}):Object.assign(Object.assign({},l),{scope:"row"});r="th"}const d=t=>o("div",Object.assign({},t,{class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:!!a.wrap}}),o(i,null));return o(r,Object.assign({},l),a.autoTooltip&&!a.wrap?o("nano-resize-observe",{notifyContentFit:"x",onNanoResizeContentFitChange:t=>t.target.firstElementChild.disabled=t.detail.x},o("nano-tooltip",{disabled:true,placement:"top",onNanoShow:t=>t.target.closest(r).style.zIndex="100",onNanoHide:t=>t.target.closest(r).style.zIndex=""},o(d,null),o("span",{slot:"content"},o(i,null)))):o(d,null))};const at=({rowRenderer:t,rowIndex:n,rowModel:e,onColumnPinned:i},r,s)=>{let a={};const l=({header:t,wrap:n},e)=>{const i=o("div",{class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:n}},e);return t?o("th",{scope:"row"},i):o("td",null,i)};if(!e){const t=A(n);e=t.rowModel}if(t===null||t===void 0?void 0:t.rowProperties){a=t.rowProperties({rowModel:e,rowIndex:n})||a}let d;if((t===null||t===void 0?void 0:t.pinned)&&typeof t.pinned==="function"){d=t.pinned()}const c={class:G("tr",d)};const h=a?W(c,a):c;const p=t===null||t===void 0?void 0:t.template;if(p){let t=p(o,{renderedRow:o("tr",Object.assign({},h,{key:e.__uuid}),r),rowModel:e,rowIndex:n},l);if(Array.isArray(t)){t=s.map(t,((t,n)=>{if(t.vtag==="tr"){if(!t.vkey)t.vkey=`${e.__uuid}_${n}`;t.vattrs=W({class:G("tr",d,true)},t.vattrs);if(!!t.vchildren){t.vchildren=s.map(t.vchildren,((t,n)=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=W({class:G(t.vtag.toString(),d,true)+rt(n,true),ref:t=>{if(!!t&&d==="top"||d==="bottom")U(t,d,i);if(!!t&&t.classList.contains("nano-tbl__pin--end"))Z(t,"end",i);if(!!t&&t.classList.contains("nano-tbl__pin--start"))Z(t,"start",i)}},t.vattrs)}return t}))}}return t}))}return t}return o("tr",Object.assign({},h,{key:e.__uuid}),r)};const lt=({rowRenderer:t,onColumnPinned:n},e,i)=>{let r={};if(t.rowProperties){r=t.rowProperties()||{}}const s=({header:t,wrap:n},e)=>{const i=o("div",{class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:n}},e);return t!==false?o("th",{scope:"col"},i):o("td",null,i)};const a=t.pinned||null;const l={class:G("tr",null)};const d=r?W(l,r):l;const c=t===null||t===void 0?void 0:t.template;if(c){let t=c(o,{renderedRow:o("tr",Object.assign({},d),e)},s);if(Array.isArray(t)){t=i.map(t,(t=>{if(t.vtag==="tr"){t.vattrs=W({class:G("tr",a,true)},t.vattrs);if(!!t.vchildren){t.vchildren=i.map(t.vchildren,(t=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=W({class:G(t.vtag.toString(),a,true),ref:t=>{if(!!t&&a==="top"||a==="bottom")U(t,a,n);if(!!t&&t.classList.contains("nano-tbl__pin--end"))Z(t,"end",n);if(!!t&&t.classList.contains("nano-tbl__pin--start"))Z(t,"start",n)}},t.vattrs)}return t}))}}return t}))}return t}return o("tr",Object.assign({},d),e)};const dt=':host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}nano-table{display:block;width:100%;--max-col-width:clamp(200px, 500px, 50vw);--color:var(--nano-color-mediumgrey, #68767e);--font-size:0.87rem;--cell-line-height:1.5;--thead-font-size:0.95rem;--thead-color:#455560;--tfoot-color:#455560;--border-color:#dddbda;--border-style:thin solid var(--border-color);--border-tint-color:#0084a9;--border-tint-style:3px solid var(--border-tint-color);--cell-bg-rgb:var(--nano-color-white-rgb, 255 255 255);--head-bg-rgb:250 250 249;--foot-bg-rgb:var(--head-bg-rgb);--th-row-bg-rgb:var(--cell-bg-rgb);--ordered-bg-rgb:var(--nano-color-offwhite-rgb, 249 249 251);--td-padding-start:0.625rem;--td-padding-end:0.625rem;--td-padding-top:0.5rem;--td-padding-bottom:0.4125rem;--th-padding-start:0.625rem;--th-padding-end:0.625rem;--th-padding-top:0.875rem;--th-padding-bottom:0.6875rem;--td-padding-v:var(--td-padding-top) var(--td-padding-bottom);--td-padding-h:var(--td-padding-start) var(--td-padding-end);--th-padding-v:var(--th-padding-top) var(--th-padding-bottom);--th-padding-h:var(--th-padding-start) var(--th-padding-end);--foot-th-padding-v:var(--td-padding-top) var(--td-padding-bottom);--foot-th-padding-h:var(--td-padding-start) var(--td-padding-end);--head-th-padding-v:var(--th-padding-top) var(--th-padding-bottom);--head-th-padding-h:var(--th-padding-start) var(--th-padding-end);--bookend-col-padding:2rem}.nano-tbl{color:var(--color);text-align:start;width:100%;font-size:var(--font-size);border-spacing:0 0;border-collapse:separate;background:rgb(var(--cell-bg-rgb));-webkit-border-end:1px solid transparent;border-inline-end:1px solid transparent;-webkit-border-before:1px solid transparent;border-block-start:1px solid transparent;position:relative;z-index:1}.nano-tbl__wrap{display:table;min-width:100%}.nano-tbl__top-anchor{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;position:relative}.nano-tbl__ordered{background-color:var(--ordered-bg);-webkit-border-start:var(--border-style);border-inline-start:var(--border-style);-webkit-border-end:var(--border-style);border-inline-end:var(--border-style)}.nano-tbl__drag-mask{display:none;position:absolute;inset-block:-2px -2px;z-index:10;opacity:0;transition:0.2s ease opacity}.nano-tbl__drag-mask--start{width:calc(50% + 2px);inset-inline-start:-2px;-webkit-border-start:2px dashed var(--border-tint-color);border-inline-start:2px dashed var(--border-tint-color)}.nano-tbl__drag-mask--end{width:50%;inset-inline-end:0;-webkit-border-end:2px dashed var(--border-tint-color);border-inline-end:2px dashed var(--border-tint-color)}.nano-tbl__drag-mask--active{opacity:1}.nano-tbl__dragging .nano-tbl__drag-mask{display:block}.nano-tbl__drag--start{opacity:0.4}.nano-tbl__dragging .nano-tbl__td,.nano-tbl__dragging .nano-tbl__th{cursor:no-drop}.nano-tbl__dragging .nano-tbl__td .nano-tbl__cell-content,.nano-tbl__dragging .nano-tbl__th .nano-tbl__cell-content{pointer-events:none}.nano-tbl__order-btn{padding:0;border:none;outline:none;font:inherit;background:none;-webkit-appearance:none;appearance:none;color:inherit;display:flex;gap:10px;align-items:center;width:100%}.nano-tbl__status-icons{margin-inline:auto 10px;display:flex;gap:10px}.nano-tbl__progress-bar{font-size:0.2rem;position:sticky;inset-block-start:0;inset-inline:0;z-index:10;transition:scale 0.25s;transform:scale(0);width:100%;height:0}.nano-tbl__progress-bar--show{transform:scale(1);height:auto}.nano-tbl__caption--hide{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}.nano-tbl__td,.nano-tbl__th{line-height:var(--cell-line-height);text-align:start;-webkit-border-before:var(--border-style);border-block-start:var(--border-style);max-width:var(--max-col-width);background-color:rgb(var(--cell-bg-rgb))}tbody:first-of-type tr:first-child .nano-tbl__td,tbody:first-of-type tr:first-child .nano-tbl__th{-webkit-border-before:none;border-block-start:none}tbody:last-of-type tr:last-child .nano-tbl__td,tbody:last-of-type tr:last-child .nano-tbl__th{-webkit-border-after:var(--border-style);border-block-end:var(--border-style)}.md .nano-tbl__td:first-child .nano-tbl__cell-content,.md .nano-tbl__th:first-child .nano-tbl__cell-content{-webkit-padding-start:var(--bookend-col-padding);padding-inline-start:var(--bookend-col-padding)}.md .nano-tbl__td:last-child .nano-tbl__cell-content,.md .nano-tbl__th:last-child .nano-tbl__cell-content{-webkit-padding-end:var(--bookend-col-padding);padding-inline-end:var(--bookend-col-padding)}@media (max-width: 768px){.nano-tbl__td:first-child .nano-tbl__cell-content,.nano-tbl__th:first-child .nano-tbl__cell-content{-webkit-padding-start:var(--td-padding-start) !important;padding-inline-start:var(--td-padding-start) !important}.nano-tbl__td:last-child .nano-tbl__cell-content,.nano-tbl__th:last-child .nano-tbl__cell-content{-webkit-padding-end:var(--td-padding-end) !important;padding-inline-end:var(--td-padding-end) !important}}thead .nano-tbl__td,thead .nano-tbl__th{color:var(--thead-color);font-weight:800;background:rgb(var(--head-bg-rgb)/90%);font-size:var(--thead-font-size);-webkit-border-before:none !important;border-block-start:none !important;transition:all 0.2s ease}thead .nano-tbl__td .nano-tbl__cell-content,thead .nano-tbl__th .nano-tbl__cell-content{padding-block:var(--head-th-padding-v);padding-inline:var(--head-th-padding-h)}tfoot .nano-tbl__td,tfoot .nano-tbl__th{color:var(--tfoot-color);font-weight:800;-webkit-border-before:none;border-block-start:none;background:rgb(var(--foot-bg-rgb)/90%);font-size:var(--thead-font-size)}tfoot .nano-tbl__td .nano-tbl__cell-content,tfoot .nano-tbl__th .nano-tbl__cell-content{padding-block:var(--foot-th-padding-v);padding-inline:var(--foot-th-padding-h)}.nano-tbl__td.nano-tbl__ordered,.nano-tbl__th.nano-tbl__ordered{background-color:rgb(var(--ordered-bg-rgb)/80%) !important}.nano-tbl__cell-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-block:var(--td-padding-v);padding-inline:var(--td-padding-h)}.nano-tbl__cell-content--no-result{padding-block:2rem}.nano-tbl__cell-content--wrap{white-space:normal;overflow:visible}.nano-tbl tbody{will-change:scroll-position;opacity:1;transition:0.1s ease opacity;transform:translateZ(0)}.nano-tbl tbody.nano-tbl__inactive{opacity:0}.nano-tbl th[scope=row]{font-weight:800;margin:0}.nano-tbl__pin{position:sticky;transform:translateZ(0)}.nano-tbl__pin--start{inset-inline:-1px auto;transition:max-width 0.25s ease}.nano-tbl__pin--start::after{content:"";position:absolute;inset:0;box-shadow:5px 1px 4px 0 rgba(0, 0, 0, 0.2);opacity:0;z-index:-1}.nano-tbl__pinned--start .nano-tbl__pin--start{z-index:2;max-width:125px !important}.sm .nano-tbl__pinned--start .nano-tbl__pin--start{max-width:var(--max-col-width) !important}.nano-tbl__pinned--start .nano-tbl__pin--start::after{opacity:1}.nano-tbl__pin--end{}.nano-tbl__pin--start+.nano-tbl__pin--end{inset-inline:auto auto}.nano-tbl__pin--start+.nano-tbl__pin--end::after{display:none}.sm .nano-tbl__pin--end{inset-inline:auto -1px !important;max-width:min(50vw, 200px)}.sm .nano-tbl__pin--end::after{display:block !important;content:"";position:absolute;inset:0;box-shadow:-5px 1px 4px 0 rgba(0, 0, 0, 0.2);opacity:0;z-index:-1}.sm .nano-tbl__pinned--end .nano-tbl__pin--end::after{opacity:1}.nano-tbl__pin--top{inset-block:-1px auto}.nano-tbl__pinned--top .nano-tbl__pin--top{z-index:4 !important}.nano-tbl__pin--bottom{inset-block:auto -1px}.nano-tbl__pinned--bottom .nano-tbl__pin--bottom{z-index:5 !important}.nano-tbl__pinned--start .nano-tbl__pin--top.nano-tbl__pin--start{z-index:5 !important}.nano-tbl__pinned--top.nano-tbl__pinned--start .nano-tbl__pin--top.nano-tbl__pin--start{z-index:6 !important}.nano-tbl__pinned--end .nano-tbl__pin--top.nano-tbl__pin--end{z-index:5 !important}.nano-tbl__pinned--top.nano-tbl__pinned--end .nano-tbl__pin--top.nano-tbl__pin--end{z-index:6 !important}.nano-tbl__pinned--start .nano-tbl__pin--bottom.nano-tbl__pin--start{z-index:5 !important}.nano-tbl__pinned--bottom.nano-tbl__pinned--start .nano-tbl__pin--bottom.nano-tbl__pin--start{z-index:6 !important}.nano-tbl__pinned--end .nano-tbl__pin--bottom.nano-tbl__pin--end{z-index:5 !important}.nano-tbl__pinned--bottom.nano-tbl__pinned--end .nano-tbl__pin--bottom.nano-tbl__pin--end{z-index:6 !important}.nano-tbl thead tr:last-of-type td,.nano-tbl thead tr:last-of-type th{-webkit-border-after:var(--border-tint-style);border-block-end:var(--border-tint-style)}.nano-tbl tfoot tr:first-of-type td,.nano-tbl tfoot tr:first-of-type th{-webkit-border-before:none;border-block-start:none}.nano-tbl tfoot tr:last-of-type td,.nano-tbl tfoot tr:last-of-type th{-webkit-border-after:var(--border-tint-style);border-block-end:var(--border-tint-style)}.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:first-of-type td,.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:first-of-type th{-webkit-border-before:var(--border-tint-style) !important;border-block-start:var(--border-tint-style) !important}.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:last-of-type td,.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:last-of-type th{-webkit-border-after:none !important;border-block-end:none !important}.nano-tbl .unlimited-width{max-width:none}.nano-tbl__spinner{font-size:1.5rem;transition:scale 0.25s;scale:0;padding:0.5rem;position:absolute;inset-block-end:0;inset-inline-start:calc(50% - 0.75rem);z-index:0}.nano-tbl__spinner--show{scale:1;position:sticky}.nano-tbl nano-skeleton{line-height:var(--cell-line-height)}';let ct=0;const ht=class{constructor(t){r(this,t);this.nanoTblReady=s(this,"nanoTblReady",7);this.nanoTblBlockRendered=s(this,"nanoTblBlockRendered",7);this.nanoTblBeforeSort=s(this,"nanoTblBeforeSort",7);this.nanoTblAfterSort=s(this,"nanoTblAfterSort",7);this.nanoTblColDrag=s(this,"nanoTblColDrag",7);this.nanoTblColDrop=s(this,"nanoTblColDrop",7);this.nanoTblBeforeFilter=s(this,"nanoTblBeforeFilter",7);this.nanoTblAfterFilter=s(this,"nanoTblAfterFilter",7);this.nanoTblBeforeSearch=s(this,"nanoTblBeforeSearch",7);this.nanoTblAfterSearch=s(this,"nanoTblAfterSearch",7);this.nanoTblBeforeEdit=s(this,"nanoTblBeforeEdit",7);this.renderId="tbl-"+ct++;this.filters=[];this.currentFilters="[]";this.currentSort="";this.cacheScrollPosition=0;this.measureHeight=0;this.blockHeights=[];this.unitHeight=0;this._isReady=false;this.colDrag=t=>{this.nanoTblColDrag.emit({column:t})};this.colDrop=(t,n)=>{const e=this.store.config.state.columns;const o=e.findIndex((t=>t.prop===n));const i=e.findIndex((n=>n.prop===t));const r=this.nanoTblColDrop.emit({fromCol:t,toCol:n,fromIndex:i,toIndex:o});if(r.defaultPrevented)return;this.columns=X(i,o,e)};this.sortStart=async(t,n,e)=>{if(this.currentSort===t+":"+n)return;this._loading=true;const o=this.nanoTblBeforeSort.emit({column:n,order:t});if(o.defaultPrevented)return;this.currentSort=t+":"+n;this.scrollToTop(e);if(this.customSortFn){try{const e=await this.customSortFn(n,t);if(e===true){this.sortComplete(t,n);this._loading=false;return}}catch(t){console.warn("custom sort failed",t);this.currentSort="";this._loading=false;return}}try{await F(this.host,n,t);this.sortComplete(t,n)}catch(t){console.warn("sort failed",t);this.currentSort=""}finally{if(this.blocks.length)this._loading=false}};this.scrollHandler=()=>{this.cacheScrollPosition=this.scrollParent.scrollTop||window.scrollY;requestAnimationFrame((()=>{let t=0;let n=0;const e=this.blocks.length;while(n<e&&this.cacheScrollPosition>=t){t+=this.getBlockHeight(n);if(this.cacheScrollPosition<t){const t=[n,n+1,Math.max(0,n-1)];if(t.toString()!==this.activeBlocks.toString()){this.activeBlocks=t;this.setBlockHeight()}this.primaryBlockIndex=n}n++}}))};this.handleColumnPinned=t=>{Object.entries(t).forEach((([t,n])=>{this.tableEle.classList.toggle(`${b}__pinned--${t}`,n)}))};this.handleResizeChange=t=>{var n;this.tableWrapperEle.className="";let e=[`${b}__wrap`];if((n=t.target)===null||n===void 0?void 0:n.className)e=[...t.target.className.split(" "),...e];this.tableWrapperEle.classList.add(...e.filter((t=>!!t)))};this.type="table";this.caption=undefined;this.showCaption=false;this.loading=undefined;this.internalLoading=false;this.placeholderSize=5;this.rows=undefined;this.columns=[];this.headRender={pinned:"top"};this.rowRender=undefined;this.footRender={pinned:"bottom"};this.showFooter=false;this.perBlock=40;this.searchTerm=undefined;this.customFilterFn=undefined;this.customSortFn=undefined;this.defaultSort=true;this.defaultColDraggable=false;this.virtualTotalItems=0;this.blocks=[];this.activeBlocks=[0,1,2];this.debounceSetLoading=c(this.debounceSetLoading.bind(this),50)}get _loading(){return this.loading!==undefined?this.loading:this.internalLoading}set _loading(t){if(this.loading!==undefined)return;this.debounceSetLoading(t)}debounceSetLoading(t){this.internalLoading=t}handleRowsChange(){if(!this.rows){this._loading=true;return}this._loading=true;Promise.resolve(this.rows).then((async t=>{await R(this.host,t);this.currentFilters="";this.currentSort="";await this.columnInit();if(!this.isReady)this.setInitialBlockDimension();this._loading=false}))}async handleColsChange(){await M(this.host,this.columns);if(this.isReady)this.columnInit()}get blocksLength(){return this.blocks.length}handleSearchTermChange(){this.searchStart()}virtualTotalItemsChangeHandler(){this.setBlocks()}async resetSorting(){const t=this.columns.find((t=>!!t.order));if(!t)return;return this.sortStart(null,t.prop)}async addSort(t,n){const e=this.columns.find((n=>n.prop===t));if(!e)throw"Cannot find column with "+t;return this.sortStart(n,e.prop)}async resetFilters(){this.filters=[];return this.filterStart()}async addFilters(t,n=true){if(!n)this.filters=[];return this.filterStart(t,n)}async removeFilters(t){this.filters=this.filters.filter((n=>!t.includes(n.prop)));return this.filterStart()}async updateRow(t,n){this.rows.splice(n,1,t);this.handleRowsChange()}set measureEle(t){var n;if(!t)return;const e=t.getBoundingClientRect().height;this.measureHeight=Math.abs(this.measureHeight-e)<5?this.measureHeight:e;this.unitHeight=((n=t.querySelector("tr"))===null||n===void 0?void 0:n.getBoundingClientRect().height)||this.unitHeight}get scrollParent(){return this._scrollParent}set scrollParent(t){if(t===this._scrollParent)return;if(this._scrollParent){(this._scrollParent===document.documentElement?document:this._scrollParent).removeEventListener("scroll",this.scrollHandler)}(t===document.documentElement?document:t).addEventListener("scroll",this.scrollHandler);this._scrollParent=t}get primaryBlockIndex(){return this._primaryBlockIndex}set primaryBlockIndex(t){if(this._primaryBlockIndex===t)return;this._primaryBlockIndex=t;this.nanoTblBlockRendered.emit({block:t,totalBlocks:this.blockElements.length})}get isReady(){return this._isReady}set isReady(t){if(t===this._isReady)return;this._isReady=t;if(this.isReady)requestAnimationFrame((()=>this.handleReady()))}handleReady(){const t=window.location.hash;if(t.length>1){try{const n=document.querySelector(t);if(n)n.scrollIntoView()}catch(t){}}this.nanoTblReady.emit()}sortComplete(t,n){this.columns=this.columns.map((e=>{if(e.prop===n)return Object.assign(Object.assign({},e),{order:t});return Object.assign(Object.assign({},e),{order:null})}));this.nanoTblAfterSort.emit({column:n,order:t})}async searchStart(){this._loading=true;const t=this.nanoTblBeforeSearch.emit({term:this.searchTerm});if(t.defaultPrevented)return;this.scrollToTop();try{await N(this.host,this.searchTerm);this.nanoTblAfterSearch.emit({term:this.searchTerm})}catch(t){console.warn("search failed",t)}finally{this._loading=false}}async filterStart(t,n=true){if(t){if(n){this.filters=[...this.filters.filter((n=>!t.find((t=>t.prop===n.prop)))),...t]}else{this.filters=t}}if(this.currentFilters===JSON.stringify(this.filters))return;this._loading=true;const e=this.nanoTblBeforeFilter.emit({filters:this.filters});if(e.defaultPrevented)return;this.currentFilters=JSON.stringify(this.filters);this.scrollToTop();if(this.customFilterFn){try{const t=await this.customFilterFn(this.filters);if(t===true){this.filterComplete();this._loading=false}}catch(t){console.warn("custom filter failed",t);this.currentFilters="";this._loading=false}return}try{await B(this.host,this.filters);this.filterComplete()}catch(t){console.warn("filter failed",t)}finally{this._loading=false}}filterComplete(){this.columns=this.columns.map((t=>{const n=this.filters.find((n=>n.prop===t.prop));if(n)t.filter=n.filter;return t}));this.nanoTblAfterFilter.emit({filters:this.filters})}scrollToTop(t){var n;const e=(n=this.scrollParent.style)===null||n===void 0?void 0:n.scrollBehavior;const o=this.scrollParent.scrollLeft;this.scrollParent.style.scrollBehavior="auto";if(this.topAnchorEle&&!V(this.topAnchorEle,.1)){this.host.scrollIntoView()}if(t&&!V(t,1))setTimeout((()=>t.scrollIntoView({block:"start"})),500);if(o)this.scrollParent.scrollLeft=o;if(e)this.scrollParent.style.scrollBehavior=e;this.scrollHandler()}setMeasureElement(){a((()=>{this.measureEle=this.blockElements.find((t=>{var n;return!((n=t===null||t===void 0?void 0:t.classList)===null||n===void 0?void 0:n.contains(`${b}__inactive`))}))}))}setInitialBlockDimension(){var t;if(!((t=this.blockElements)===null||t===void 0?void 0:t.length))return;const n=new Promise((t=>{a((()=>{this.setMeasureElement();if(!this.measureEle&&!this.unitHeight)t();this.blockElements.forEach(((n,e)=>{var o;if(!n||!((o=n.classList)===null||o===void 0?void 0:o.contains(`${b}__inactive`))){if(e===this.blockElements.length-1)t();return}if(e===this.blockElements.length-1)t()}))}))}));n.then((()=>{requestAnimationFrame((()=>{this.isReady=true}))}))}async columnInit(){this.filters=this.columns.filter((t=>!!t.filter)).map((t=>{const{filter:n,prop:e}=t;return{filter:n,prop:e}}));if(this.searchTerm){await this.searchStart()}if(this.filters.length){await this.filterStart()}const t=this.columns.find((t=>!!t.order));if(!!t){await this.sortStart(t.order,t.prop)}}setBlocks(){const t=this.store.data.state.rows;if(!t.length){this.blocks=[];return}let n=1;const e=this.virtualTotalItems>t.length?this.virtualTotalItems:t.length;let o=[];const i=[];this.blockHeights=[];for(n;n<=e;n++){o.push(this.store.data.state.rows[n-1]||{__uuid:""});if(n%this.perBlock===0){i.push({rows:o,__uuid:d(o.map((t=>t.__uuid)).join())});o=[]}}if(o.length){i.push({rows:o,__uuid:d(o.map((t=>t.__uuid)).join())})}this.blocks=i}getBlockHeight(t){if(this.blockHeights.length){const n=this.blockHeights.find((n=>n.blockIndex===t));if(n)return n.height}const n=this.blocks[t].rows.length;if(n===this.perBlock&&this.measureHeight){return this.measureHeight}return this.unitHeight?this.unitHeight*n:undefined}setBlockHeight(){this.activeBlocks.forEach((t=>{const n=this.blockElements[t];if(!n)return;a((()=>{const e=n.getBoundingClientRect().height;const o=this.blockHeights.findIndex((n=>n.blockIndex===t));if(o>0){this.blockHeights[o]={height:e,blockIndex:t}}else this.blockHeights.push({height:e,blockIndex:t})}))}))}processSlots(){if(!this.caption&&!this.host.querySelector('[slot="caption"]')){console.error("For accessibility you must set a `caption` prop or use the `caption` slot")}}async componentWillLoad(){this.scrollParent=Q(this.host);this.store=await I(this.host,this.columns,this.scrollParent);await this.handleRowsChange();this.processSlots();this.store.data.onChange("rows",(()=>this.setBlocks()));this.setBlocks()}connectedCallback(){this.scrollParent=Q(this.host)}componentDidLoad(){this.setInitialBlockDimension()}componentShouldUpdate(t,n,e){if(["rows","columns"].includes(e))return false}componentWillRender(){}componentDidRender(){this.setMeasureElement()}render(){this.blockElements=[];return o(l,null,o("div",{class:`${b}__top-anchor`,ref:t=>this.topAnchorEle=t}," "),o("nano-resize-observe",{"aria-labelledby":"table-caption-"+this.renderId,tabindex:this.type==="grid"?"0":undefined,states:"576w sm, 768w md",class:"sm md",onNanoResizeStateChange:this.handleResizeChange}),o("div",{class:`${b}__wrap sm md`,ref:t=>this.tableWrapperEle=t},o("nano-progress-bar",{indeterminate:true,class:{[`${b}__progress-bar`]:true,[`${b}__progress-bar--show`]:this._loading}}),o("table",{role:this.type==="grid"?"grid":undefined,"aria-readonly":this.type==="table"?"true":undefined,"aria-rowcount":this.store.data.state.rows.length,"aria-colcount":this.store.config.state.columns.length,class:`${b}`,ref:t=>this.tableEle=t},o("caption",{class:{[`${b}__caption`]:true,[`${b}__caption--hide`]:!this.showCaption},id:"table-caption-"+this.renderId},o("slot",{name:"caption"},this.caption)),o("thead",null,o(lt,{rowRenderer:this.headRender,onColumnPinned:this.handleColumnPinned},this.store.config.state.columns.map((t=>[o(ot,{column:t,headRenderer:this.headRender,onColumnSortClick:this.sortStart,onColumnPinned:this.handleColumnPinned,onColumnDrag:this.colDrag,onColumnDrop:this.colDrop,defaults:{sortable:this.defaultSort,draggable:this.defaultColDraggable}})])))),this._loading&&!this.blocks.length&&o("tbody",{class:`${b}__active`},[...Array(10).keys()].map((t=>o("tr",null,this.store.config.state.columns.map(((n,e)=>o(st,{rowIndex:t,colIndex:e,nestedContent:()=>o("nano-skeleton",null)}))))))),!this._loading&&!this.blocks.length&&o("tr",null,o("th",{class:`${b}__th`,colSpan:this.store.config.state.columns.length},o("div",{class:"nano-tbl__cell-content nano-tbl__cell-content--no-result"},o("slot",{name:"no-results"},"No results found")))),this.blocks.map(((t,n)=>o("tbody",{key:t.__uuid,id:`tbody-${this.renderId}-${n}`,ref:t=>{this.blockElements.push(t)},class:{[`${b}__inactive`]:!this.activeBlocks.includes(n),[`${b}__active`]:this.activeBlocks.includes(n)}},this.activeBlocks.includes(n)?t.rows.map(((t,e)=>{const i=n>0?n*this.perBlock+e:e;return o(at,{rowRenderer:this.rowRender,rowModel:t,rowIndex:i},this.store.config.state.columns.map(((t,n)=>o(st,{rowIndex:i,colIndex:n}))))})):o("tr",null,o("td",{colSpan:this.store.config.state.columns.length,style:{height:this.getBlockHeight(n)+"px"}}))))),this.showFooter&&o("tfoot",null,o(lt,{rowRenderer:this.footRender,onColumnPinned:this.handleColumnPinned},this.store.config.state.columns.map((t=>[o(ot,{column:t,headRenderer:this.footRender,onColumnPinned:this.handleColumnPinned,onColumnSortClick:this.sortStart,defaults:{sortable:this.defaultSort,draggable:this.defaultColDraggable}})]))))),!!this.blocks.length&&o("nano-spinner",{type:"circle",class:{[`${b}__spinner`]:true,[`${b}__spinner--show`]:this._loading}})))}get host(){return n(this)}static get watchers(){return{rows:["handleRowsChange"],columns:["handleColsChange"],searchTerm:["handleSearchTermChange"],virtualTotalItems:["virtualTotalItemsChangeHandler"]}}};ht.style=dt;export{ht as T,v as c};
|
5
|
+
//# sourceMappingURL=p-13dd65c9.js.map
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
import{i as n,r as i,h as o,a as t,g as r}from"./p-f6a8467a.js";import{c as s}from"./p-411bb8f1.js";let e;const a=()=>{if(!e){const n=window;n.Nanoicons=n.Nanoicons||{};e=n.Nanoicons.map=n.Nanoicons.map||new Map}return e};const c=n=>{let i=f(n.src);if(i){return i}i=h(n.name,n.icon);if(i){return l(i)}if(n.icon){i=f(n.icon);if(i){return i}}return null};const l=i=>{const o=a().get(i);if(o){return o}return n(`../nano-assets/fontawesome-pro/svgs/${i}.svg`)};const h=(n,i)=>{if(!n&&i&&!d(i)){n=i}if(u(n)){n=m(n)}if(!u(n)||n.trim()===""){return null}const o=n.replace(/[a-z]|-|\/|\d/gi,"");if(o!==""){console.warn("invalid characters in icon name "+n);return null}return n};const f=n=>{if(u(n)){n=n.trim();if(d(n)){return n}}return null};const d=n=>n.length>0&&/(\/|\.)/.test(n);const u=n=>typeof n==="string";const m=n=>n.toLowerCase();const p=n=>{if(n){const i=document.createElement("div");i.innerHTML=n;for(let n=i.childNodes.length-1;n>=0;n--){if(i.childNodes[n].nodeName.toLowerCase()!=="svg"){i.removeChild(i.childNodes[n])}}const o=i.firstElementChild;if(o&&o.nodeName.toLowerCase()==="svg"){const n=o.getAttribute("class")||"";o.setAttribute("class",(n+" sc-nano-icon s-nano-icon svg").trim());if(g(o)){return i.innerHTML}}}return""};const g=n=>{if(n.nodeType===1){if(n.nodeName.toLowerCase()==="script"){return false}for(let i=0;i<n.attributes.length;i++){const o=n.attributes[i].value;if(u(o)&&o.toLowerCase().indexOf("on")===0){return false}}for(let i=0;i<n.childNodes.length;i++){if(!g(n.childNodes[i])){return false}}}return true};const v=new Map;const b=new Map;const w=n=>{let i=b.get(n);if(!i){i=fetch(n).then((i=>{if(i.ok){return i.text().then((i=>{v.set(n,p(i))}))}v.set(n,"")}));b.set(n,i)}return i};const y=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--color:var(--nano-color-base, currentcolor);--primary-color:var(--nano-color-tint, currentcolor);--secondary-color:var(--nano-color-shade, currentcolor);--stroke-width:32px;--primary-opacity:0.8;--secondary-opacity:1;--icon-size:var(--nano-icon-size, 1em);--icon-margin-top:var(--nano-icon-margin-top, 0);--icon-margin-end:var(--nano-icon-margin-end, 0);--icon-margin-bottom:var(--nano-icon-margin-bottom, 0);--icon-margin-start:var(--nano-icon-margin-start, 0);display:inline-block;width:var(--icon-size);height:var(--icon-size);min-width:var(--icon-size);min-height:var(--icon-size);contain:strict;fill:currentcolor;box-sizing:content-box !important;transition:opacity 0.3s ease;color:var(--color);margin-inline:var(--icon-margin-start) var(--icon-margin-end);margin-block:var(--icon-margin-top) var(--icon-margin-bottom)}:host .nanoicon{stroke:currentcolor}.nanoicon-fill-none{fill:none}.nanoicon-stroke-width{stroke-width:32px;stroke-width:var(--stroke-width)}.icon-inner,.nanoicon,svg,.svg{display:block;height:100%;width:100%;overflow:visible}:host(.loading){opacity:0}.fa-primary{color:var(--primary-color);opacity:var(--primary-opacity, 1)}.fa-secondary{color:var(--secondary-color);opacity:var(--secondary-opacity) !important}:host(.flip-rtl) .icon-inner{transform:scaleX(-1)}:host(.icon-small){font-size:18px !important}:host(.icon-large){font-size:32px !important}";const x=class{constructor(n){i(this,n);this.svgContent=undefined;this.isVisible=false;this.isLoading=true;this.color=undefined;this.ariaLabel=undefined;this.flipRtl=undefined;this.name=undefined;this.src=undefined;this.icon=undefined;this.size=undefined;this.lazy=true}setAriaLabel(){if(!this.ariaLabel){const n=h(this.name,this.icon);if(n){this.ariaLabel=n.split("/").slice(-1)[0].replace(/\-/g," ")}}}connectedCallback(){this.waitUntilVisible(this.el,"50px",(()=>{this.isVisible=true;this.loadIcon()}))}disconnectedCallback(){if(this.io){this.io.disconnect();this.io=undefined}}componentWillLoad(){this.setAriaLabel()}waitUntilVisible(n,i,o){if(this.lazy&&typeof window!=="undefined"&&window.IntersectionObserver){const t=this.io=new window.IntersectionObserver((n=>{if(n[0].isIntersecting||n[1]&&n[1].isIntersecting){t.disconnect();this.io=undefined;o()}}),{rootMargin:i});t.observe(n)}else{o()}}loadIcon(){if(this.isVisible){const n=c(this);if(n){if(v.has(n)){this.svgContent=v.get(n);requestAnimationFrame((()=>this.isLoading=false))}else{w(n).then((()=>{this.svgContent=v.get(n);requestAnimationFrame((()=>this.isLoading=false))}))}}}this.setAriaLabel()}render(){const n=this.flipRtl||this.name&&(this.name.indexOf("arrow")>-1||this.name.indexOf("chevron")>-1)&&this.el.ownerDocument.dir==="rtl"&&this.flipRtl!==false;return o(t,{role:"img",class:Object.assign(Object.assign({},s(this.color)),{loading:this.isLoading,[`icon-${this.size}`]:!!this.size,"flip-rtl":!!n})},this.svgContent?o("div",{class:"icon-inner",innerHTML:this.svgContent}):o("div",{class:"icon-inner"}))}get el(){return r(this)}static get watchers(){return{name:["loadIcon"],src:["loadIcon"],icon:["loadIcon"]}}};x.style=y;export{x as nano_icon};
|
5
|
+
//# sourceMappingURL=p-173cc842.entry.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["CACHED_MAP","getIconMap","win","window","Nanoicons","map","Map","getUrl","i","url","getSrc","src","getName","name","icon","getNamedUrl","iconName","get","getAssetPath","isSrc","isStr","toLower","trim","invalidChars","replace","console","warn","str","length","test","val","toLowerCase","validateContent","svgContent","div","document","createElement","innerHTML","childNodes","nodeName","removeChild","svgElm","firstElementChild","svgClass","getAttribute","setAttribute","isValid","elm","nodeType","attributes","value","indexOf","iconContent","requests","getSvgContent","req","fetch","then","rsp","ok","text","set","iconCss","Icon","setAriaLabel","this","ariaLabel","label","split","slice","connectedCallback","waitUntilVisible","el","isVisible","loadIcon","disconnectedCallback","io","disconnect","undefined","componentWillLoad","rootMargin","cb","lazy","IntersectionObserver","data","isIntersecting","observe","has","requestAnimationFrame","isLoading","render","flipRtl","ownerDocument","dir","h","Host","role","class","Object","assign","createColorClasses","color","loading","size"],"sources":["./src/components/icon/utils.ts","./src/components/icon/validate.ts","./src/components/icon/request.ts","./src/components/icon/icon.scss?tag=nano-icon&encapsulation=shadow","./src/components/icon/icon.tsx"],"sourcesContent":["import { getAssetPath } from '@stencil/core';\nimport { Icon } from './icon';\n\nlet CACHED_MAP: Map<string, string>;\n\nexport const getIconMap = (): Map<string, string> => {\n if (!CACHED_MAP) {\n const win = window as any;\n win.Nanoicons = win.Nanoicons || {};\n CACHED_MAP = win.Nanoicons.map = win.Nanoicons.map || new Map();\n }\n return CACHED_MAP;\n};\n\nexport const addIcons = (icons: { [name: string]: string }) => {\n const map = getIconMap();\n Object.keys(icons).forEach((name) => map.set(name, icons[name]));\n};\n\nexport const getUrl = (i: Icon) => {\n let url = getSrc(i.src);\n if (url) {\n return url;\n }\n\n url = getName(i.name, i.icon);\n if (url) {\n return getNamedUrl(url);\n }\n\n if (i.icon) {\n url = getSrc(i.icon);\n if (url) {\n return url;\n }\n }\n return null;\n};\n\nconst getNamedUrl = (iconName: string) => {\n const url = getIconMap().get(iconName);\n if (url) {\n return url;\n }\n return getAssetPath(`../nano-assets/fontawesome-pro/svgs/${iconName}.svg`);\n};\n\nexport const getName = (\n iconName: string | undefined,\n icon: string | undefined\n) => {\n if (!iconName && icon && !isSrc(icon)) {\n iconName = icon;\n }\n if (isStr(iconName)) {\n iconName = toLower(iconName);\n }\n\n if (!isStr(iconName) || iconName.trim() === '') {\n return null;\n }\n\n // only allow alpha characters and dash\n const invalidChars = iconName.replace(/[a-z]|-|\\/|\\d/gi, '');\n if (invalidChars !== '') {\n console.warn('invalid characters in icon name ' + iconName);\n return null;\n }\n return iconName;\n};\n\nexport const getSrc = (src: string | undefined) => {\n if (isStr(src)) {\n src = src.trim();\n if (isSrc(src)) {\n return src;\n }\n }\n return null;\n};\n\nexport const isSrc = (str: string) => str.length > 0 && /(\\/|\\.)/.test(str);\nexport const isStr = (val: any): val is string => typeof val === 'string';\nexport const toLower = (val: string) => val.toLowerCase();\n","import { isStr } from './utils';\n\nexport const validateContent = (svgContent: string | null) => {\n if (svgContent) {\n const div = document.createElement('div');\n div.innerHTML = svgContent;\n\n // setup this way to ensure it works on our buddy IE\n for (let i = div.childNodes.length - 1; i >= 0; i--) {\n if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {\n div.removeChild(div.childNodes[i]);\n }\n }\n\n // must only have 1 root element\n const svgElm = div.firstElementChild;\n if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {\n const svgClass = svgElm.getAttribute('class') || '';\n svgElm.setAttribute(\n 'class',\n (svgClass + ' sc-nano-icon s-nano-icon svg').trim()\n );\n\n // root element must be an svg\n // lets double check we've got valid elements\n // do not allow scripts\n if (isValid(svgElm as any)) {\n return div.innerHTML;\n }\n }\n }\n return '';\n};\n\nexport const isValid = (elm: HTMLElement) => {\n if (elm.nodeType === 1) {\n if (elm.nodeName.toLowerCase() === 'script') {\n return false;\n }\n\n for (let i = 0; i < elm.attributes.length; i++) {\n const val = elm.attributes[i].value;\n if (isStr(val) && val.toLowerCase().indexOf('on') === 0) {\n return false;\n }\n }\n\n for (let i = 0; i < elm.childNodes.length; i++) {\n if (!isValid(elm.childNodes[i] as any)) {\n return false;\n }\n }\n }\n return true;\n};\n","import { validateContent } from './validate';\nexport const iconContent = new Map<string, string>();\nconst requests = new Map<string, Promise<any>>();\n\nexport const getSvgContent = (url: string) => {\n // see if we already have a request for this url\n let req = requests.get(url);\n if (!req) {\n // we don't already have a request\n req = fetch(url).then((rsp) => {\n if (rsp.ok) {\n return rsp.text().then((svgContent) => {\n iconContent.set(url, validateContent(svgContent));\n });\n }\n iconContent.set(url, '');\n });\n\n // cache for the same requests\n requests.set(url, req);\n }\n return req;\n};\n","@import '../../global/style/utilities/globals';\n\n:host {\n /**\n * @prop --color: defaults to current context color\n * @prop --primary-color: used for duotone icons to set the primary color\n * @prop --secondary-color: used for duotone icons to set the secondary color\n * @prop --primary-opacity: used for duotone icons to set the primary opacity\n * @prop --secondary-opacity: used for duotone icons to set the secondary opacity\n * @prop --stroke-width: 32px default stroke width\n */\n\n --color: var(--nano-color-base, currentcolor);\n --primary-color: var(--nano-color-tint, currentcolor);\n --secondary-color: var(--nano-color-shade, currentcolor);\n --stroke-width: 32px;\n --primary-opacity: 0.8;\n --secondary-opacity: 1;\n --icon-size: var(--nano-icon-size, 1em);\n --icon-margin-top: var(--nano-icon-margin-top, 0);\n --icon-margin-end: var(--nano-icon-margin-end, 0);\n --icon-margin-bottom: var(--nano-icon-margin-bottom, 0);\n --icon-margin-start: var(--nano-icon-margin-start, 0);\n\n display: inline-block;\n width: var(--icon-size);\n height: var(--icon-size);\n min-width: var(--icon-size);\n min-height: var(--icon-size);\n contain: strict;\n fill: currentcolor;\n box-sizing: content-box !important;\n transition: opacity 0.3s ease;\n color: var(--color);\n margin-inline: var(--icon-margin-start) var(--icon-margin-end);\n margin-block: var(--icon-margin-top) var(--icon-margin-bottom);\n}\n\n:host .nanoicon {\n stroke: currentcolor;\n}\n\n.nanoicon-fill-none {\n fill: none;\n}\n\n.nanoicon-stroke-width {\n stroke-width: 32px;\n stroke-width: var(--stroke-width);\n}\n\n.icon-inner,\n.nanoicon,\nsvg,\n.svg {\n display: block;\n height: 100%;\n width: 100%;\n overflow: visible;\n}\n\n:host(.loading) {\n opacity: 0;\n}\n\n.fa-primary {\n color: var(--primary-color);\n opacity: var(--primary-opacity, 1);\n}\n\n.fa-secondary {\n color: var(--secondary-color);\n opacity: var(--secondary-opacity) !important;\n}\n\n/* Icon RTL\n * -----------------------------------------------------------\n */\n:host(.flip-rtl) .icon-inner {\n transform: scaleX(-1);\n}\n\n/* Icon Sizes\n * -----------------------------------------------------------\n */\n:host(.icon-small) {\n font-size: 18px !important;\n}\n\n:host(.icon-large) {\n font-size: 32px !important;\n}\n","import {\n Build,\n Component,\n Element,\n Host,\n Prop,\n State,\n Watch,\n h,\n} from '@stencil/core';\nimport { createColorClasses } from '../../utils/theme';\nimport { getSvgContent, iconContent } from './request';\nimport { getName, getUrl } from './utils';\nimport type { Color } from '../../interface';\n\n/**\n * An SVG loader / helper. Comes bundled with all fontawesome pro icons by default but can use any custom SVG (with an correct path). Lazily loads SVG for each icon, so will only request the icons that you're using and that are visible.\n */\n@Component({\n tag: 'nano-icon',\n styleUrl: 'icon.scss',\n shadow: true,\n})\nexport class Icon {\n private io?: IntersectionObserver;\n\n @Element() el!: HTMLNanoIconElement;\n\n @State() svgContent?: string;\n @State() isVisible = false;\n @State() isLoading = true;\n\n /**\n * Color to use from your application's color palette.\n * Default options are: `\"primary\"`, `\"secondary\"`, `\"tertiary\"`, `\"success\"`, `\"warning\"`, `\"danger\"`, `\"light\"`, `\"medium\"`, and `\"dark\"`.\n */\n @Prop() color?: Color;\n\n /**\n * Specifies the label to use for accessibility. Defaults to the icon name.\n */\n @Prop({ mutable: true, reflect: true }) ariaLabel: string;\n\n /**\n * Specifies whether the icon should horizontally flip when `dir` is `\"rtl\"`.\n */\n @Prop() flipRtl?: boolean;\n\n /**\n * Specifies which icon to use from the built-in set of icons.\n */\n @Prop() name?: string;\n\n /**\n * Specifies the exact `src` of an SVG file to use.\n */\n @Prop() src?: string;\n\n /**\n * A combination of both `name` and `src`. If a `src` url is detected\n * it will set the `src` property. Otherwise it assumes it's a built-in named\n * SVG and set the `name` property.\n */\n @Prop() icon?: any;\n\n /**\n * The size of the icon.\n * Available options are: `\"small\"` and `\"large\"`.\n */\n @Prop() size?: 'small' | 'large';\n\n /**\n * If enabled, nano-icon will be loaded lazily when it's visible in the viewport.\n * Default, `true`.\n */\n @Prop() lazy = true;\n\n private setAriaLabel() {\n if (!this.ariaLabel) {\n const label = getName(this.name, this.icon);\n // user did not provide a label\n // come up with the label based on the icon name\n if (label) {\n this.ariaLabel = label.split('/').slice(-1)[0].replace(/\\-/g, ' ');\n }\n }\n }\n\n connectedCallback() {\n // purposely do not return the promise here because loading\n // the svg file should not hold up loading the app\n // only load the svg if it's visible\n this.waitUntilVisible(this.el, '50px', () => {\n this.isVisible = true;\n this.loadIcon();\n });\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n componentWillLoad() {\n this.setAriaLabel();\n }\n\n private waitUntilVisible(\n el: HTMLElement,\n rootMargin: string,\n cb: () => void\n ) {\n if (\n Build.isBrowser &&\n this.lazy &&\n typeof window !== 'undefined' &&\n (window as any).IntersectionObserver\n ) {\n const io = (this.io = new (window as any).IntersectionObserver(\n (data: IntersectionObserverEntry[]) => {\n if (data[0].isIntersecting || (data[1] && data[1].isIntersecting)) {\n io.disconnect();\n this.io = undefined;\n cb();\n }\n },\n { rootMargin }\n ));\n\n io.observe(el);\n } else {\n // browser doesn't support IntersectionObserver\n // so just fallback to always show it\n cb();\n }\n }\n\n @Watch('name')\n @Watch('src')\n @Watch('icon')\n loadIcon() {\n if (Build.isBrowser && this.isVisible) {\n const url = getUrl(this);\n if (url) {\n if (iconContent.has(url)) {\n // sync if it's already loaded\n this.svgContent = iconContent.get(url);\n requestAnimationFrame(() => (this.isLoading = false));\n } else {\n // async if it hasn't been loaded\n getSvgContent(url).then(() => {\n this.svgContent = iconContent.get(url);\n requestAnimationFrame(() => (this.isLoading = false));\n });\n }\n }\n }\n this.setAriaLabel();\n }\n\n render() {\n const flipRtl =\n this.flipRtl ||\n (this.name &&\n (this.name.indexOf('arrow') > -1 ||\n this.name.indexOf('chevron') > -1) &&\n (this.el.ownerDocument as Document).dir === 'rtl' &&\n this.flipRtl !== false);\n\n return (\n <Host\n role=\"img\"\n class={{\n ...createColorClasses(this.color),\n loading: this.isLoading,\n [`icon-${this.size}`]: !!this.size,\n 'flip-rtl': !!flipRtl,\n }}\n >\n {Build.isBrowser && this.svgContent ? (\n <div class=\"icon-inner\" innerHTML={this.svgContent}></div>\n ) : (\n <div class=\"icon-inner\"></div>\n )}\n </Host>\n );\n }\n}\n"],"mappings":";;;oGAGA,IAAIA,EAEG,MAAMC,EAAa,KACxB,IAAKD,EAAY,CACf,MAAME,EAAMC,OACZD,EAAIE,UAAYF,EAAIE,WAAa,GACjCJ,EAAaE,EAAIE,UAAUC,IAAMH,EAAIE,UAAUC,KAAO,IAAIC,G,CAE5D,OAAON,CAAU,EAQZ,MAAMO,EAAUC,IACrB,IAAIC,EAAMC,EAAOF,EAAEG,KACnB,GAAIF,EAAK,CACP,OAAOA,C,CAGTA,EAAMG,EAAQJ,EAAEK,KAAML,EAAEM,MACxB,GAAIL,EAAK,CACP,OAAOM,EAAYN,E,CAGrB,GAAID,EAAEM,KAAM,CACVL,EAAMC,EAAOF,EAAEM,MACf,GAAIL,EAAK,CACP,OAAOA,C,EAGX,OAAO,IAAI,EAGb,MAAMM,EAAeC,IACnB,MAAMP,EAAMR,IAAagB,IAAID,GAC7B,GAAIP,EAAK,CACP,OAAOA,C,CAET,OAAOS,EAAa,uCAAuCF,QAAe,EAGrE,MAAMJ,EAAU,CACrBI,EACAF,KAEA,IAAKE,GAAYF,IAASK,EAAML,GAAO,CACrCE,EAAWF,C,CAEb,GAAIM,EAAMJ,GAAW,CACnBA,EAAWK,EAAQL,E,CAGrB,IAAKI,EAAMJ,IAAaA,EAASM,SAAW,GAAI,CAC9C,OAAO,I,CAIT,MAAMC,EAAeP,EAASQ,QAAQ,kBAAmB,IACzD,GAAID,IAAiB,GAAI,CACvBE,QAAQC,KAAK,mCAAqCV,GAClD,OAAO,I,CAET,OAAOA,CAAQ,EAGV,MAAMN,EAAUC,IACrB,GAAIS,EAAMT,GAAM,CACdA,EAAMA,EAAIW,OACV,GAAIH,EAAMR,GAAM,CACd,OAAOA,C,EAGX,OAAO,IAAI,EAGN,MAAMQ,EAASQ,GAAgBA,EAAIC,OAAS,GAAK,UAAUC,KAAKF,GAChE,MAAMP,EAASU,UAAmCA,IAAQ,SAC1D,MAAMT,EAAWS,GAAgBA,EAAIC,cCjFrC,MAAMC,EAAmBC,IAC9B,GAAIA,EAAY,CACd,MAAMC,EAAMC,SAASC,cAAc,OACnCF,EAAIG,UAAYJ,EAGhB,IAAK,IAAIzB,EAAI0B,EAAII,WAAWV,OAAS,EAAGpB,GAAK,EAAGA,IAAK,CACnD,GAAI0B,EAAII,WAAW9B,GAAG+B,SAASR,gBAAkB,MAAO,CACtDG,EAAIM,YAAYN,EAAII,WAAW9B,G,EAKnC,MAAMiC,EAASP,EAAIQ,kBACnB,GAAID,GAAUA,EAAOF,SAASR,gBAAkB,MAAO,CACrD,MAAMY,EAAWF,EAAOG,aAAa,UAAY,GACjDH,EAAOI,aACL,SACCF,EAAW,iCAAiCrB,QAM/C,GAAIwB,EAAQL,GAAgB,CAC1B,OAAOP,EAAIG,S,GAIjB,MAAO,EAAE,EAGJ,MAAMS,EAAWC,IACtB,GAAIA,EAAIC,WAAa,EAAG,CACtB,GAAID,EAAIR,SAASR,gBAAkB,SAAU,CAC3C,OAAO,K,CAGT,IAAK,IAAIvB,EAAI,EAAGA,EAAIuC,EAAIE,WAAWrB,OAAQpB,IAAK,CAC9C,MAAMsB,EAAMiB,EAAIE,WAAWzC,GAAG0C,MAC9B,GAAI9B,EAAMU,IAAQA,EAAIC,cAAcoB,QAAQ,QAAU,EAAG,CACvD,OAAO,K,EAIX,IAAK,IAAI3C,EAAI,EAAGA,EAAIuC,EAAIT,WAAWV,OAAQpB,IAAK,CAC9C,IAAKsC,EAAQC,EAAIT,WAAW9B,IAAY,CACtC,OAAO,K,GAIb,OAAO,IAAI,ECpDN,MAAM4C,EAAc,IAAI9C,IAC/B,MAAM+C,EAAW,IAAI/C,IAEd,MAAMgD,EAAiB7C,IAE5B,IAAI8C,EAAMF,EAASpC,IAAIR,GACvB,IAAK8C,EAAK,CAERA,EAAMC,MAAM/C,GAAKgD,MAAMC,IACrB,GAAIA,EAAIC,GAAI,CACV,OAAOD,EAAIE,OAAOH,MAAMxB,IACtBmB,EAAYS,IAAIpD,EAAKuB,EAAgBC,GAAY,G,CAGrDmB,EAAYS,IAAIpD,EAAK,GAAG,IAI1B4C,EAASQ,IAAIpD,EAAK8C,E,CAEpB,OAAOA,CAAG,ECrBZ,MAAMO,EAAU,i9C,MCuBHC,EAAI,M,kEAMM,M,eACA,K,8JA6CN,I,CAEPC,eACN,IAAKC,KAAKC,UAAW,CACnB,MAAMC,EAAQvD,EAAQqD,KAAKpD,KAAMoD,KAAKnD,MAGtC,GAAIqD,EAAO,CACTF,KAAKC,UAAYC,EAAMC,MAAM,KAAKC,OAAO,GAAG,GAAG7C,QAAQ,MAAO,I,GAKpE8C,oBAIEL,KAAKM,iBAAiBN,KAAKO,GAAI,QAAQ,KACrCP,KAAKQ,UAAY,KACjBR,KAAKS,UAAU,G,CAInBC,uBACE,GAAIV,KAAKW,GAAI,CACXX,KAAKW,GAAGC,aACRZ,KAAKW,GAAKE,S,EAIdC,oBACEd,KAAKD,c,CAGCO,iBACNC,EACAQ,EACAC,GAEA,GAEEhB,KAAKiB,aACE/E,SAAW,aACjBA,OAAegF,qBAChB,CACA,MAAMP,EAAMX,KAAKW,GAAK,IAAKzE,OAAegF,sBACvCC,IACC,GAAIA,EAAK,GAAGC,gBAAmBD,EAAK,IAAMA,EAAK,GAAGC,eAAiB,CACjET,EAAGC,aACHZ,KAAKW,GAAKE,UACVG,G,IAGJ,CAAED,eAGJJ,EAAGU,QAAQd,E,KACN,CAGLS,G,EAOJP,WACE,GAAuBT,KAAKQ,UAAW,CACrC,MAAMhE,EAAMF,EAAO0D,MACnB,GAAIxD,EAAK,CACP,GAAI2C,EAAYmC,IAAI9E,GAAM,CAExBwD,KAAKhC,WAAamB,EAAYnC,IAAIR,GAClC+E,uBAAsB,IAAOvB,KAAKwB,UAAY,O,KACzC,CAELnC,EAAc7C,GAAKgD,MAAK,KACtBQ,KAAKhC,WAAamB,EAAYnC,IAAIR,GAClC+E,uBAAsB,IAAOvB,KAAKwB,UAAY,OAAO,G,GAK7DxB,KAAKD,c,CAGP0B,SACE,MAAMC,EACJ1B,KAAK0B,SACJ1B,KAAKpD,OACHoD,KAAKpD,KAAKsC,QAAQ,UAAY,GAC7Bc,KAAKpD,KAAKsC,QAAQ,YAAc,IACjCc,KAAKO,GAAGoB,cAA2BC,MAAQ,OAC5C5B,KAAK0B,UAAY,MAErB,OACEG,EAACC,EAAI,CACHC,KAAK,MACLC,MAAKC,OAAAC,OAAAD,OAAAC,OAAA,GACAC,EAAmBnC,KAAKoC,QAAM,CACjCC,QAASrC,KAAKwB,UACd,CAAC,QAAQxB,KAAKsC,UAAWtC,KAAKsC,KAC9B,aAAcZ,KAGI1B,KAAKhC,WACvB6D,EAAA,OAAKG,MAAM,aAAa5D,UAAW4B,KAAKhC,aAExC6D,EAAA,OAAKG,MAAM,e"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
import{c as t}from"./p-13dd65c9.js";import"./p-f6a8467a.js";import"./p-ee045579.js";import"./p-9746b0a5.js";import"./p-9ebbb814.js";const o="table.worker";const p="stencil.table.worker";const s=new URL("p-e2f9ccfa.js",import.meta.url).href;const r=new Blob(['importScripts("'+s+'")'],{type:"text/javascript"});const e=URL.createObjectURL(r);const c=t(e,o,p);URL.revokeObjectURL(e);export{c as worker,p as workerMsgId,o as workerName,s as workerPath};
|
5
|
+
//# sourceMappingURL=p-4b136a65.js.map
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
2
|
* Web Components for Nanopore digital Web Apps
|
3
3
|
*/
|
4
|
-
export{T as nano_table}from"./p-
|
5
|
-
//# sourceMappingURL=p-
|
4
|
+
export{T as nano_table}from"./p-13dd65c9.js";import"./p-f6a8467a.js";import"./p-ee045579.js";import"./p-9746b0a5.js";import"./p-9ebbb814.js";
|
5
|
+
//# sourceMappingURL=p-c38a246f.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 e,w as n,h as s,i as a,a as o,g as r}from"./p-f6a8467a.js";import{a as h}from"./p-ed6adde2.js";import{C as l}from"./p-a6ff5ca6.js";import{d as c}from"./p-9746b0a5.js";import{d}from"./p-f6de2d5d.js";import"./p-69a3e911.js";var u=undefined&&undefined.__rest||function(t,i){var e={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&i.indexOf(n)<0)e[n]=t[n];if(t!=null&&typeof Object.getOwnPropertySymbols==="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++){if(i.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s]))e[n[s]]=t[n[s]]}return e};async function p(t,i={}){var{body:e}=i,n=u(i,["body"]);const s={Accept:"application/json, text/plain, */*","Access-Control-Allow-Origin":"*","Content-Type":"application/json",Cache:"no-cache"};const a=Object.assign(Object.assign({method:e?"POST":"GET",credentials:"include",keepalive:true,mode:"cors"},n),{headers:Object.assign(Object.assign({},s),n.headers)});if(e){a.body=JSON.stringify(e)}let o=setTimeout((()=>{}),0);if(window.AbortController){const t=new AbortController;const{timeout:i=500}=n;o=setTimeout((()=>t.abort()),i);a.signal=t.signal}const r=await fetch(t,a);clearTimeout(o);if(r.ok){return await r.json()}else{const t=await r.text();return new Error(t)}}const g=':host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}.global-nav{font-family:inherit;font-size:inherit;font-stretch:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;z-index:var(--nano-layer-index-menubar, 10)}.global-nav button{background:none;color:inherit;border:none}.global-nav .icon-btn{position:relative;background:none;color:inherit;border:none;align-self:normal;padding:9px 7px;cursor:pointer;display:flex;align-items:center}.global-nav .icon-btn nano-icon{width:18px;height:18px}.global-nav ::slotted(nano-nav-item[slot=icon]){--padding-top:9px;--padding-bottom:9px;--padding-start:7px;--padding-end:7px;--display:flex;font-size:18px}.global-nav a{color:inherit;text-decoration:none;white-space:nowrap}.global-nav .nav-links_title{margin:8px 0 3px}.global-nav .nav-links ul{margin:0;padding:0}.global-nav .nav-links li{list-style:none}.global-nav .login-btn{display:flex;align-items:center}.global-nav .menu-btn{padding:9px var(--bar-item-spacing) 9px var(--bar-item-spacing)}.site-content{display:flex;transition:min-height 0.2s ease;position:relative;z-index:auto;align-items:stretch;flex:1}.mask{opacity:0;background:rgba(0, 0, 0, 0.3);position:fixed;inset-inline:0;inset-block-start:0;height:100vh;z-index:-1;transition:transform 0.2s ease, opacity 0.2s ease, visibility 0.01s ease 0.2s, z-index 0.01s ease 0.2s;visibility:hidden}.mask.open{opacity:1;transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.2s ease 0.01s, opacity 0.2s ease 0.01s;z-index:3;visibility:visible}.bars{color:var(--bar-text-color);z-index:var(--nano-layer-index-menubar, 10);position:relative;max-width:100%;min-width:100%;box-shadow:none;transition:0.2s ease box-shadow}[stuck] .bars{box-shadow:0 1px 25px 0 rgba(0, 0, 0, 0.15)}.bars::before{content:"";width:100%;height:100%;z-index:-1;background:var(--bar-background);position:absolute}.main-bar{width:100%;padding-inline:0 var(--bar-item-spacing);padding-block:var(--bar-vertical-padding);display:flex;align-items:center;justify-content:space-between;overflow-x:hidden}.main-bar:focus{outline:none}:host(.ready) .main-bar{overflow-x:visible}.main-bar>*,.main-bar ::slotted(*){transition:opacity 0.2s ease}:host(:not(.ready)) .main-bar>*,:host(:not(.ready)) .main-bar ::slotted(*){opacity:0 !important}:host(.ready) .main-bar>*,:host(.ready) .main-bar ::slotted(*){opacity:1}:host(.resizing) .main-bar>*,:host(.resizing) .main-bar ::slotted(*){opacity:0 !important}.main-bar>*{flex:0 0 auto}.main-bar>* ::slotted(nano-nav-item[slot=icon]){-webkit-margin-start:11px;margin-inline-start:11px}.main-bar>* ::slotted(nano-nav-item),.main-bar>* nano-nav-item{--color-hover:var(--bar-color-focus);--secondary-bg-color:var(--bar-dropdown-bg);--secondary-color:var(--bar-dropdown-text);--bg-color-open:var(--bar-background);--padding-top:7px;--padding-bottom:7px;--padding-end:2px;--padding-start:2px;text-decoration:none !important}.main-bar .icon-btn{-webkit-margin-before:0;margin-block-start:0;-webkit-margin-after:0;margin-block-end:0;-webkit-margin-start:6px;margin-inline-start:6px}:host(.threshold-2) .main-bar .icon-btn{-webkit-margin-before:0;margin-block-start:0;-webkit-margin-after:0;margin-block-end:0;-webkit-margin-start:11px;margin-inline-start:11px}.main-bar .menu-btn.icon-btn{margin:0 !important;-webkit-border-end:1.5px solid var(--bar-color-shade);border-inline-end:1.5px solid var(--bar-color-shade)}.main-bar .logo{height:36px;width:200px;min-width:200px}:host(:not(.threshold-1)) .main-bar .logo{height:30px}.main-bar .logo-link{-webkit-margin-end:0;margin-inline-end:0;-webkit-margin-start:0;margin-inline-start:0;padding-inline:var(--bar-item-spacing);display:flex;align-items:center;border:none}.main-bar .nav-links{flex:0 0 auto;display:flex;justify-content:space-around}.main-bar .nav-links ul{display:flex;justify-content:space-around}.main-bar .nav-links ::slotted(nano-nav-item),.main-bar .nav-links nano-nav-item{--padding-top:7px;--padding-bottom:7px;--padding-end:2px;--padding-start:2px;--margin:0 var(--bar-item-spacing)}.main-bar .nav-links--main{justify-content:flex-start;letter-spacing:1.5px;font-weight:600;font-stretch:condensed;text-transform:uppercase;font-size:1.065em;-webkit-margin-end:auto;margin-inline-end:auto}.main-bar .nav-links--main ::slotted(nano-nav-item){--color:var(--bar-text-color);--padding-end:3px;--padding-start:0}.main-bar .nav-links--sub{--color:var(--color, #e2e2e2);-webkit-margin-start:6px;margin-inline-start:6px;justify-content:flex-end}.main-bar .login-btn{display:inline-block;border-radius:4px;background-color:var(--login-button-bg);color:var(--login-button-text);padding:3px 10px;position:relative;inset-inline-start:auto;inset-block-end:auto;margin-inline:11px 0}.main-bar .measure-ele{min-width:1px;display:block;margin:0;padding:0}.sticker-trigger{background:var(--bar-background);width:100%;height:1px;z-index:20;position:relative}.sticker-trigger+.sticker-trigger{display:none}.gn-menu{position:fixed;inset-block-start:0;inset-inline-start:0;z-index:-1;display:none;transition:z-index 0.01s ease 0.2s;height:100vh;width:100vw;overflow-y:auto}:host(.threshold-4) .gn-menu{position:absolute;width:calc(100vw - 20px)}.gn-menu.menu-full-screen{width:100vw !important}.gn-menu_wrap{max-width:92vw;width:335px;background:var(--menu-background);color:var(--menu-text-color);padding:calc(var(--bar-vertical-padding) + 1px) 0 0;box-shadow:0 0 36px 0 rgba(0, 0, 0, 0.8);position:relative;pointer-events:all;-webkit-margin-after:36px;margin-block-end:36px;opacity:0;outline:none;transition:transform 0.2s ease, opacity 0.2s ease}.gn-menu_wrap.has-promotion{padding:var(--menu-padding) 0 0}.gn-menu.open{z-index:var(--nano-layer-index-dropdown, 300);transition:z-index 0.01s ease}.gn-menu.open .gn-menu_wrap{opacity:1;transform:translate3d(0, 0, 0) !important;transition:transform 0.2s ease 0.01s, opacity 0.2s ease 0.01s}.gn-menu_actions{-webkit-padding-end:calc(var(--menu-padding) / 2);padding-inline-end:calc(var(--menu-padding) / 2);display:flex;justify-content:space-between}.gn-menu_actions-counter{background:#d0021b;color:var(--menu-text-color);position:absolute;inset-block-end:4px;inset-inline:auto 0;font-size:9px;height:14px;line-height:14px;width:auto;min-width:14px;border-radius:50%;box-sizing:border-box;text-align:center;text-indent:0}.gn-menu .content-wrap{position:relative;overflow:hidden;transition:0.2s ease min-height;min-height:190px}.gn-menu .content--sub{padding:var(--menu-padding) 0 var(--menu-padding) 7px}.gn-menu .menu-btn{-webkit-margin-end:auto;margin-inline-end:auto}.gn-menu .nav-links{display:flex;flex-wrap:wrap}.gn-menu .nav-links ::slotted(nano-nav-item),.gn-menu .nav-links nano-nav-item{--icon-size:14px;--display:inline-block;--secondary-bg-color:#001a21;--padding-top:10px;--padding-bottom:10px;--padding-end:calc(var(--menu-padding) * 2);--padding-start:calc(var(--menu-padding) + 3px);--color:var(--menu-text-color);--color-hover:var(--menu-title-text);--bg-color-hover:transparent;--bg-color-focus:#002530;--focus-outline:none;width:100%}.gn-menu .nav-links .user-nav{--bg-color:var(--menu-user-panel-bg);--padding-top:9px;--padding-bottom:9px;font-weight:bold;margin:5px 0 0}.gn-menu .nav-links .user-nav ::slotted(nano-nav-item),.gn-menu .nav-links .user-nav nano-nav-item{font-weight:500;--bg-color:transparent}.gn-menu .nav-links .user-nav .content{padding:0;background-color:var(--menu-user-panel-bg)}.gn-menu .nav-links .user-nav .content--sub{padding-inline:var(--menu-padding)}.gn-menu .nav-links .user-nav .back-btn{-webkit-padding-start:var(--menu-padding);padding-inline-start:var(--menu-padding)}.gn-menu .nav-links_title{margin:0 var(--menu-padding) 4px;-webkit-border-after:1px solid var(--menu-hint-color);border-block-end:1px solid var(--menu-hint-color);-webkit-padding-after:8px;padding-block-end:8px;text-transform:uppercase;color:var(--menu-title-text);letter-spacing:1px;font-weight:700}.gn-menu .nav-links_title--sites{-webkit-border-after:none;border-block-end:none}.gn-menu .nav-links-wrap{margin:18px 0}.gn-menu .nav-links-wrap:last-child{-webkit-margin-after:0;margin-block-end:0}.gn-menu .nav-links .back-btn{-webkit-border-before:1px solid var(--menu-hint-color);border-block-start:1px solid var(--menu-hint-color);-webkit-border-after:1px solid var(--menu-hint-color);border-block-end:1px solid var(--menu-hint-color);display:flex;align-items:center;padding:10px 11px 10px 0;width:100%;font-size:12px;text-transform:uppercase;color:var(--menu-title-text);letter-spacing:1px;font-weight:700;cursor:pointer;font-stretch:expanded}.gn-menu .nav-links .back-btn:hover{color:var(--menu-text-color)}.gn-menu .nav-links .back-btn nano-icon{-webkit-margin-end:10px;margin-inline-end:10px;font-size:12px;color:var(--menu-icon-color)}.gn-menu .nav-links--sub{display:flex;flex-wrap:wrap}.gn-menu .nav-links--sub ::slotted(nano-nav-item),.gn-menu .nav-links--sub nano-nav-item{--border-bottom:none;--padding-end:var(--menu-padding);--padding-start:var(--menu-padding);--padding-top:8px;--padding-bottom:8px;margin:0;width:50%;line-height:1.8}.gn-menu .nav-links--sites ::slotted(nano-nav-item),.gn-menu .nav-links--sites nano-nav-item{width:100%}.gn-menu .nav-links .content{padding:8px var(--menu-padding)}.gn-menu .login-btn{padding-inline:7px var(--menu-padding);padding-block:var(--menu-padding)}.gn-menu .login-btn nano-icon{-webkit-margin-start:10px;margin-inline-start:10px}.gn-menu .logout-btn{justify-content:flex-end}.gn-menu .logout-btn a{padding:0 5px}.search-btn::before{content:"";background-color:#0c5a71;height:9px;inset-inline:0 5px;inset-block-end:-20px;position:absolute;transform:translateZ(0) scaleX(0);transform-origin:0;transition:0.2s ease transform}.search-btn--open::before{transform:translateZ(0) scaleX(1);opacity:0.7}.search-bar{height:0;overflow:hidden;transition:0.2s ease height;padding:0 var(--bar-item-spacing);outline:none;max-width:45em;-webkit-margin-start:auto;margin-inline-start:auto;}.search-bar .search-widget{margin:0;overflow:inherit;max-width:none;max-height:none;min-width:auto;-webkit-padding-end:0;padding-inline-end:0}.search-bar .search-widget .search-icon--search{display:none}.search-bar .search-widget .search-input{--input-border-width:2px 0 0 0;--input-bg-color:#f3f3f3;--nano-input-border-color:transparent;--nano-input-border-color--focus:var(--bar-color-shade);font-size:1.1875em}.search-bar .search-widget nano-select.search-input{--input-border-width:2px 3px 0 0;--input-bg-color:var(--bar-color-shade);--input-bg-color--focus:#f3f3f3;color:#f3f3f3}.search-bar .search-widget nano-select.search-input.has-focus{color:var(--bar-color-shade)}.search-bar .search-widget .select-input__arrow{font-size:0.75em}.search-bar .search-widget .select__mask.sc-nano-select{line-height:2.35em;min-height:2.35em;-webkit-padding-before:2px;padding-block-start:2px}.search-bar .search-inputs{padding:0;margin:0}.search-bar .search-autocomplete{inset-block-start:100%;width:100%}.search-widget{-webkit-padding-end:var(--bar-item-spacing);padding-inline-end:var(--bar-item-spacing);-webkit-margin-start:var(--bar-item-spacing);margin-inline-start:var(--bar-item-spacing);-webkit-margin-end:auto;margin-inline-end:auto;position:relative;flex:1 1 auto;max-width:500px;min-width:350px;max-height:36px;inset-block-start:-1px}.search-inputs{display:flex;margin:0}.search-inputs input[type=submit]{display:none}.search-autocomplete{position:absolute;inset-block-start:calc(100% + 15px);width:calc(100% - var(--bar-item-spacing));inset-inline-start:0;background:white;border:2px solid var(--bar-color-tint);border-radius:0 0 5px 5px;color:#4a4a4a;-webkit-padding-before:calc(var(--bar-vertical-padding) / 2);padding-block-start:calc(var(--bar-vertical-padding) / 2);-webkit-padding-end:0;padding-inline-end:0;-webkit-padding-after:1px;padding-block-end:1px;-webkit-padding-start:0;padding-inline-start:0;z-index:1}.search-autocomplete-hit{padding-block:calc(var(--bar-vertical-padding) / 4);padding-inline:var(--bar-item-spacing);width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;text-align:start;line-height:1.5;cursor:pointer}.search-autocomplete-hit-scope{color:#a7b0b3;font-weight:600}.search-autocomplete-hit:hover,.search-autocomplete-hit:focus-visible{background-color:#e4e6e8}.search-autocomplete-hit:focus-visible{box-shadow:var(--nano-control-focus-shadow, 0 0 0 0.1875rem var(--nano-control-focus-color, rgba(144, 198, 231, 0.8)))}.search-autocomplete-hit:focus{outline:none}.search-autocomplete-hit .search__highlight,.search-autocomplete-hit em{font-weight:bold;font-style:normal}.search-autocomplete-hit--no-result:hover,.search-autocomplete-hit--no-result:focus{background:none !important}.search-autocomplete-foot{margin:7px 0 0}.search-autocomplete-submit{background:none;border:none;align-self:normal;padding:9px var(--bar-item-spacing) !important;cursor:pointer;display:flex;align-items:center;color:#007495;justify-content:flex-end;width:100%;text-decoration:underline;-webkit-border-before:1px solid #e8eaea;border-block-start:1px solid #e8eaea}.search-autocomplete-submit:hover,.search-autocomplete-submit:focus{background-color:#e4e6e8}nano-select.search-input{--input-border-width:0 0 2px 0;--input-text-color:var(--bar-text-color);--nano-input-border-color:rgb(103 138 154);--padding-end:var(--bar-item-spacing);--nano-input-border-color--focus:black;font-stretch:condensed;font-weight:600;letter-spacing:1.5px;font-size:1.2em;flex:0 1 auto;width:auto;display:flex;align-items:center;flex-direction:column;position:relative;inset-inline-start:1px;text-transform:uppercase}:host(:not(.ready)) nano-select.search-input{overflow:hidden;max-height:1em}nano-select.search-input .down-arrow{font-size:0.65em}nano-input.search-input{--clear-btn-color:var(--bar-text-color);--nano-input-border-color:rgb(103 138 154);--input-border-width:0 0 2px 0;--placeholder-color:var(--bar-text-color);--input-text-color:var(--bar-text-color);--padding-start:21px;--nano-input-border-color--focus:black;font-size:1.2em;width:206px;display:flex;align-items:center;flex-direction:column;flex:1}:host([dir=rtl]) nano-input.search-input{--input-border-radius:5px 0 0 5px}:host(:not(.ready)) nano-input.search-input{overflow:hidden;max-height:1em}nano-input.search-input .search-icon{background:none;padding:0 8px;display:none;font-size:0.9em}nano-input.search-input .search-icon--show{display:flex !important}nano-input.search-input .search-icon--loader{animation:spin 1s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}nano-input.search-input .search-icon nano-icon{height:1.4em}.user-profile{display:flex;justify-content:space-between;align-items:center;padding:2em;background-color:var(--menu-user-profile-bg)}.user-profile .left{display:flex;align-items:center}.user-profile .avatar-container{position:relative}.user-profile .avatar-container img.avatar{border-radius:50px}.user-profile .avatar-container img.logo-small{position:absolute;height:30px;width:30px;inset-block-end:0;inset-inline-end:0;background-color:#27586e;border-radius:10px;padding:5px}.user-profile .user-details{display:flex;flex-direction:column;margin:0 1.25em;color:white}.user-profile .user-details .name{font-size:1.25em}.user-profile .user-details .bio{margin:0.5em 0}.user-profile .user-details .kudos span{background-color:#81c7eb;color:#415958;padding:0.25em;border-radius:0.5em;font-weight:bold}.user-profile .chevron-right{font-size:1.5em;color:white}.user-links{position:relative}.user-links .icon-btn{-webkit-padding-end:0;padding-inline-end:0;font-weight:500}.user-links .icon-btn nano-icon{-webkit-margin-start:5px;margin-inline-start:5px;width:16px;height:16px;transform-origin:center;transition:transform 0.2s ease, color 0.2s ease}.user-links .icon-btn.open nano-icon{transform:rotate(180deg);color:#007495}.user-links-panel{display:none;position:absolute;border-radius:4px 0 4px 4px;box-shadow:0 1px 5px 0 rgba(0, 0, 0, 0.4);background-color:#568c9d;opacity:0;transform:translate3d(0, 30px, 0);transition:transform 0.2s ease, opacity 0.2s ease;inset-inline-end:0;min-width:318px;z-index:2}.user-links-panel:focus{outline:none}.user-links-panel.show{opacity:1;transform:translate3d(0, calc(var(--padding) + 1px), 0)}.user-links-panel-content{padding:0 18px;display:flex;flex-direction:column;color:white}.user-links-panel-content a{padding:11px 0;-webkit-border-after:#669dac 1px solid;border-block-end:#669dac 1px solid}.user-links-panel-content a:hover,.user-links-panel-content a:focus{color:#455556}.user-links-panel-content a:last-child{-webkit-border-after:none;border-block-end:none}.user-links-panel-foot{background-color:#aac5cd;border-radius:0 0 4px 4px;padding:var(--padding);color:#455556;display:flex;align-items:center;font-weight:500;justify-content:space-between}.user-links-panel-foot a:hover{text-decoration:underline}.user-links-panel .user-profile{background-color:var(--bar-user-panel-bg)}:host{--bar-vertical-padding:21px;--bar-item-spacing:13px;--bar-background:white;--bar-text-color:#196c82;--bar-color-shade:rgb(12 90 113);--bar-color-tint:rgb(19 89 111);--bar-color-focus:#99a3a6;--bar-user-panel-bg:#016d86;--bar-dropdown-bg:#196c82;--bar-dropdown-text:white;--menu-background:#001a21;--menu-text-color:white;--menu-user-profile-bg:#001a21;--menu-user-panel-bg:#193037;--menu-padding:12px;--menu-hint-color:#33484d;--menu-title-text:#90c6e7;--menu-icon-color:white;--login-button-bg:#17bb75;--login-button-text:white;--padding:12px;--padding-top:var(--padding);--padding-end:var(--padding);--padding-bottom:var(--padding);--padding-start:var(--padding);display:flex;flex-direction:column;position:relative;line-height:1.5;height:100%;font-size:0.9375em;font-size:clamp(0.77rem, 1vw, 0.9rem)}:host input,:host select,:host button{font-family:inherit;-webkit-appearance:none;appearance:none;font-size:inherit}:host a:focus,:host button:focus{outline:none}:host a:focus-visible,:host button:focus-visible{box-shadow:var(--nano-control-focus-shadow, 0 0 0 0.1875rem var(--nano-control-focus-color, rgba(144, 198, 231, 0.8)))}';const b={about:0,main:1,login:2,search:3,icon:4};const m=class{constructor(n){t(this,n);this.nanoIsReady=i(this,"nanoIsReady",7);this.nanoSearchResult=i(this,"nanoSearchResult",7);this.nanoSearchError=i(this,"nanoSearchError",7);this.nanoSearchReset=i(this,"nanoSearchReset",7);this.currSize=0;this.thresholdsGoingUp=false;this.THRESHOLDLIMIT=Object.keys(b).length;this.autocompleteEles=[];this.currAIndex=-1;this.isLoggedIn=false;this.myAccData=null;this.aboutNavItms=[];this.siteNavItms=[];this.loggedInNavItms=[];this.setResizingState=(t=false)=>{if(typeof this.debounceSetResizingState==="undefined"){this.debounceSetResizingState=c(this.setResizingState,600)}if(t){this.isResizing=true;this.debounceSetResizingState()}else{this.isResizing=false;this.thresholdsGoingUp=false}};this.onMenuBtnKeyDown=t=>{switch(t.key){case"Enter":case" ":this.modalOpen?this.menuClose(t,true):this.menuOpen();break}};this.onMenuBtnClick=t=>{this.menuClose(t,true)};this.menuOpen=t=>{if(t)t.preventDefault();this.menuDiv.style.display="block";this.modalOpen=true;this.menuWrapDiv.focus({preventScroll:true});if(this.threshold<2||this.menuWrapDiv.scrollHeight>window.innerHeight){document.body.style.overflow="hidden";this.menuFullScreen=true}else document.body.style.overflowX="hidden";setTimeout((()=>this.modalIsOpen=true),300)};this.onMenuHidden=()=>{this.menuDiv.removeEventListener("transitionend",this.onMenuHidden);document.body.style.overflow="";this.menuDiv.style.display="none";this.modalIsOpen=false;this.menuFullScreen=false;setTimeout((()=>{if(document.activeElement===document.body&&this.menuBtn)this.mainBarDiv.focus({preventScroll:true})}),50)};this.subMenuClose=t=>{t.preventDefault();t.target.closest("nano-nav-item").open=false};this.onUserBtnClick=t=>{t.preventDefault();this.userMenuOpen=!this.userMenuOpen};this.onUserBtnKeyDown=t=>{switch(t.key){case"Enter":case" ":this.userMenuOpen=!this.userMenuOpen;break}};this.onUserMenuBlur=t=>{if(!t.relatedTarget){this.userMenuOpen=false;return}if(!!t.relatedTarget.closest(".user-links-panel"))return false;this.userMenuOpen=false};this.onSearchBtnClick=t=>{t.preventDefault();if(!this.searchBarShown)this.searchbarShow();else this.searchbarHide()};this.onSearchBtnKeyDown=t=>{switch(t.key){case"Enter":case" ":this.searchBarShown?this.searchbarHide():this.searchbarShow();break}};this.onSearchBarShown=()=>{this.searchBarEl.removeEventListener("transitionend",this.onSearchBarShown);if(this.searchInput)this.searchInput.setFocus();this.searchBarEl.style.overflow="visible"};this.searchbarHide=t=>{if(t&&t.relatedTarget&&t.relatedTarget.closest("#global-nav-search-bar"))return;this.showAutocomplete=false;if(this.searchValInternal.length&&t)return;this.searchBarEl.addEventListener("transitionend",this.onSearchBarHidden);this.searchBarEl.style.overflow="hidden";this.searchBarEl.style.height="0px"};this.onSearchBarHidden=()=>{this.searchBarEl.removeEventListener("transitionend",this.onSearchBarHidden);this.searchBarEl.style.display="none";this.searchBarShown=false};this.onSearchInput=t=>{this.searchValInternal=this.searchInput.value;if(!this.isSearchValSet()){this.searchLoading=false;return}if(t.detail.type==="input"){this.showAutocomplete=false;this.searchLoading=true}};this.onSearchChange=async t=>{this.searchValInternal=this.searchValue=t?t.detail.value:this.searchValInternal;this.showAutocomplete=false;this.autocompleteResults=null;if(!this.isSearchValSet()){if(!this.searchValInternal.length){this.nanoSearchReset.emit()}this.searchLoading=false;return}if(!this.currentIndex)this.currentSelectedIndex();try{this.autocompleteResults=this.processSearchResults(await this.currentIndex.alogliaIndex.search(this.searchValInternal,{attributesToSnippet:["body:5","title:8"],hitsPerPage:5,filters:"created > "+Math.floor((Date.now()-631152e5)/1e3)}))}catch(t){console.error(t)}this.scopeSearch=null;this.scopeSearch=await this.onSearchSubmit(null,false);this.searchLoading=false;this.showAutocompleteResults()};this.onSearchSubmit=async(t,i=true)=>{if(t)t.preventDefault();if(!this.isSearchValSet())return;this.searchLoading=true;this.algoliaSearchResults=null;if(!this.currentIndex)this.currentSelectedIndex();const e=this.internalSearchIndeces.map((t=>({indexName:t.index,query:this.searchValInternal,facets:t.filters,hitsPerPage:10,filters:"created > "+Math.floor((Date.now()-631152e5)/1e3)})));try{this.algoliaSearchResults=this.processSearchResults(await this.algoliaClient.multipleQueries(e))}catch(t){this.nanoSearchError.emit(t)}this.searchLoading=false;if(!this.algoliaSearchResults)return;this.algoliaSearchResults.results.map(((t,i)=>{t.indexName=this.internalSearchIndeces[i].name;t.selected=this.currentIndex.name===this.internalSearchIndeces[i].name;t.domain=this.currentIndex.domain||null;t.domains=this.myAccData.domains||null;t.allGroup=!!this.internalSearchIndeces[i].allGroup;t.filters=this.internalSearchIndeces[i].filters}));if(i){this.nanoSearchResult.emit({results:this.algoliaSearchResults.results,client:{apiKey:this.searchApiKey,appId:this.searchAppId}});this.showAutocomplete=false}return this.algoliaSearchResults};this.onSearchIndexChange=async t=>{const i=t;let e=t;if(!this.currentIndex)this.currentSelectedIndex();if(i.detail&&i.detail.value.length)e=i.detail.value;if(!e||!e.length)return;if(this.currentIndex.index===e)return;const n=this.internalSearchIndeces.find((t=>t.index===e));if(!n||!n.alogliaIndex)return;this.searchIndex=n.index;if(this.isSearchValSet())await this.onSearchChange()};this.switchIndexSubmit=async t=>{if(this.isSearchValSet()){await this.onSearchIndexChange(t);this.onSearchSubmit()}else this.onSearchIndexChange(t)};this.onAutocompleteBlur=t=>{if(!this.showAutocomplete||!this.autocompleteResults)return;if(t&&t.target&&t.target.closest(".search-widget"))return;this.showAutocomplete=false};this.showAutocompleteResults=()=>{if(!this.autocompleteResults||!this.autocompleteResults.hits)return;this.showAutocomplete=true};this.onAutocompleteInteract=t=>{if(!this.showAutocomplete||!this.autocompleteResults)return;let i=this.currAIndex;switch(t.key){case"Tab":setTimeout((()=>{if(!this.el.shadowRoot.activeElement||!this.el.shadowRoot.activeElement.closest(".search-widget")){this.showAutocomplete=false;return}else{const t=this.autocompleteEles.find(((t,i)=>{if(t===this.el.shadowRoot.activeElement){this.currAIndex=i;return true}}));if(t)this.setActiveElement(t);else this.currAIndex=-1}}));break;case"ArrowDown":case"ArrowUp":if(t.key==="ArrowDown")i++;else if(t.key==="ArrowUp")i--;const e=this.autocompleteEles[i];if(e||i<0||i>this.autocompleteEles.length-1)t.preventDefault();if(e){this.setActiveElement(e);this.currAIndex=i}else if(i<0){this.searchInput.setFocus();this.currAIndex=-1}break;case"Enter":case" ":if(this.autocompleteEles[this.currAIndex]){this.autocompleteEles[this.currAIndex].click()}break}};this.assessSlottedContent=()=>{e((()=>{this.hasSiteSlot=!!this.el.querySelectorAll('[slot="site"]').length;this.hasLoggedinSlot=!!this.el.querySelectorAll('[slot="loggedin"]').length;this.hasPromotionSlot=!!this.el.querySelectorAll('[slot="promotion"]').length;this.aboutSlotLen=this.el.querySelectorAll('[slot="about"]').length;this.iconSlotLen=this.el.querySelectorAll('[slot="icon"]').length;this.mainSlotLen=this.el.querySelectorAll('[slot="main"]').length;this.overflowSlotLen=this.el.querySelectorAll('[slot="overflow"]').length;this.searchSlotLen=this.el.querySelectorAll('[slot="search"]').length}))};this.userProfileUrl="";this.hasLoggedinSlot=false;this.hasSiteSlot=false;this.hasPromotionSlot=false;this.aboutSlotLen=0;this.iconSlotLen=0;this.mainSlotLen=0;this.overflowSlotLen=0;this.searchSlotLen=0;this.internalSearchIndeces=[];this.thresholdReady=false;this.remoteDataReady=false;this.ready=false;this.isResizing=false;this.intersectRatio=undefined;this.threshold=this.THRESHOLDLIMIT;this.modalOpen=false;this.modalIsOpen=false;this.searchBarShown=false;this.scrollingUp=true;this.searchLoading=false;this.showAutocomplete=false;this.secondaryMenuOpen=null;this.userMenuOpen=false;this.menuFullScreen=false;this.searchValInternal="";this.env="prod";this.ssoDataUrl=undefined;this.myAccountData=undefined;this.ssoRedirect=encodeURIComponent(window.location.href);this.getMyAccountData=true;this.activeMyAccountSections=null;this.showSearch=true;this.showLogo=true;this.logoUrl=location.protocol+"//"+location.host;this.searchIndeces=[];this.myAccountUser=null;this.searchAppId=undefined;this.searchApiKey=undefined;this.searchValue="";this.searchIndex="all_prod_en";this.cartCount=0;this.msgCount=0;this.cartUrl=null;this.msgUrl=null;this.assessSlottedContent=c(this.assessSlottedContent.bind(this),10)}handleMyAccountData(){if(!this.myAccountData)return;if(!this.myAccountData.user||!this.myAccountData.links)return;this.myAccData=this.myAccountData;if(this.myAccData.user.id){this.isLoggedIn=true;this.myAccountUser=this.myAccData.user}this.processMyAccLinks();this.processMyAccData();this.remoteDataReady=true}async submitSearch(){this.onSearchSubmit();this.showAutocomplete=false;return}async getMyAccData(){if(!!this.myAccData)return;switch(this.env){case"prod":this.userProfileUrl="https://community.nanoporetech.com/profile/me";case"local":case"dev":case"test":default:this.userProfileUrl="https://community-test.nanoporetech.com/profile/me";break}if(!this.getMyAccountData||this.myAccData){this.remoteDataReady=true;return}let t=this.ssoDataUrl;if(!t){switch(this.env){case"dev":t="https://myaccount-dev.nanoporetech.com/";break;case"test":t="https://myaccount-test.nanoporetech.com/";break;default:t="https://myaccount.nanoporetech.com/";break}}const i={timeout:5e3};try{if(this.env==="local"){this.myAccData=await import("./p-c53b232e.js")}else{this.myAccData=await p(t+"nav_bar_data.json",i)}if(this.myAccData.user.id){this.isLoggedIn=true;this.myAccountUser=this.myAccData.user}this.processMyAccLinks();this.processMyAccData();setTimeout((()=>this.remoteDataReady=true),300)}catch(t){console.error(t);this.remoteDataReady=true}}currentSelectedIndex(){if(!this.internalSearchIndeces.length){return}if(!this.searchIndex)return this.internalSearchIndeces[0];const t=this.internalSearchIndeces.find((t=>t.index===this.searchIndex));if(!t){this.currentIndex=this.internalSearchIndeces[0];console.error("index not found");return}this.currentIndex=t;return t}changeInternalSearchVal(){if(this.searchValInternal!==this.searchValue)this.searchValue=this.searchValInternal}initAlgoliaClient(){if(!this.searchAppId||!this.searchApiKey)return;this.algoliaClient=h(this.searchAppId,this.searchApiKey);this.addAlgoliaIndeces()}addIndeces(){this.internalSearchIndeces=[...this.internalSearchIndeces,...this.searchIndeces]}addAlgoliaIndeces(){if(!this.algoliaClient||!this.internalSearchIndeces.length)return;this.internalSearchIndeces.forEach((t=>{t.alogliaIndex=this.algoliaClient.initIndex(t.index)}));if(!this.searchIndex)this.searchIndex=this.internalSearchIndeces[0].index}thresholdChange(t,i){if(t>i){this.thresholdsGoingUp=true;this.setResizingState(true)}}ratioChange(){if(this.intersectRatio<1&&this.threshold>0){if(this.thresholdsGoingUp)this.setResizingState(true);this.threshold--;setTimeout((()=>this.ratioChange()),500)}else{this.thresholdReady=true;let t,i;e((()=>{t=[...Array.from(this.el.querySelectorAll('nano-nav-item[slot="site"]')),...Array.from(this.el.querySelectorAll('nano-nav-item[slot="overflow"]'))];i=[];if(this.threshold<this.THRESHOLDLIMIT-b.icon)t.push(...Array.from(this.el.querySelectorAll('nano-nav-item[slot="icon"]')));else i.push(...Array.from(this.el.querySelectorAll('nano-nav-item[slot="icon"]')));if(this.threshold<this.THRESHOLDLIMIT-b.login)t.push(...Array.from(this.el.querySelectorAll('nano-nav-item[slot="loggedin"]')));else i.push(...Array.from(this.el.querySelectorAll('nano-nav-item[slot="loggedin"]')));if(this.threshold<this.THRESHOLDLIMIT-b.main)t.push(...Array.from(this.el.querySelectorAll('nano-nav-item[slot="main"]')));else i.push(...Array.from(this.el.querySelectorAll('nano-nav-item[slot="main"]')));if(this.threshold<this.THRESHOLDLIMIT-b.about)t.push(...Array.from(this.el.querySelectorAll('nano-nav-item[slot="about"]')));else i.push(...Array.from(this.el.querySelectorAll('nano-nav-item[slot="about"]')))}));n((()=>{t.forEach((t=>{t.classList.add("nano-global-nav-menu");t.classList.remove("nano-global-nav-bar")}));i.forEach((t=>{t.classList.remove("nano-global-nav-menu");t.classList.add("nano-global-nav-bar")}))}))}}assessReady(){if(this.thresholdReady&&this.remoteDataReady){this.ready=true}}remoteReady(){this.attachIO()}isReady(){this.nanoIsReady.emit()}setupAutocompleteBlur(){if(this.showAutocomplete){this.el.shadowRoot.addEventListener("click",this.onAutocompleteBlur)}else{this.el.shadowRoot.removeEventListener("click",this.onAutocompleteBlur)}}closeSearchBar(){if(!!this.secondaryMenuOpen&&this.searchBarShown)this.searchbarHide()}slotChange(){this.threshold=this.THRESHOLDLIMIT;if(this.ready)this.ratioChange()}thresholdClasses(){const t=[];let i=0;for(i;i<this.threshold;i++)t.push("threshold-"+(i+1));return t}onWindowResize(){if(this.threshold<this.THRESHOLDLIMIT&&window.innerWidth>this.currSize){this.threshold=this.THRESHOLDLIMIT;this.ratioChange()}this.currSize=window.innerWidth;this.searchBarShown=false}secondaryOpen(t){if(!t.detail.secondaryMenu)return;t.stopPropagation();this.secondaryMenuOpen=t.target;if(!this.menuSelectedItems){this.menuSelectedItems=this.el.querySelectorAll("nano-nav-item.selected");this.menuSelectedItems.forEach((t=>t.classList.remove("selected")));this.menuSelectedItems.forEach((t=>t.selected=false))}this.menuContentDiv.style.minHeight=t.detail.secondaryMenu.scrollHeight+"px"}secondaryClose(t){if(!t.detail.secondaryMenu)return;t.stopPropagation();setTimeout((()=>{if(this.secondaryMenuOpen===t.target&&this.menuSelectedItems){this.secondaryMenuOpen=null;this.menuContentDiv.style.minHeight="";this.menuSelectedItems.forEach((t=>t.classList.add("selected")));this.menuSelectedItems.forEach((t=>t.selected=true));this.menuSelectedItems=null}}),200)}menuClose(t,i=false){if(!this.modalIsOpen)return;if(i){this.modalOpen=false;this.menuDiv.addEventListener("transitionend",this.onMenuHidden);return}if(!t.composedPath().some((t=>{var i;return t===this.menuContentDiv||((i=t.classList)===null||i===void 0?void 0:i.contains("gn-menu_actions"))}))){requestAnimationFrame((()=>{if(!!this.secondaryMenuOpen)return;this.modalOpen=false;this.menuDiv.addEventListener("transitionend",this.onMenuHidden)}))}}async handleUserMenu(){await d(this.userLinkPanel,"show",this.userMenuOpen);if(this.userMenuOpen){this.userLinkPanel.focus();this.userLinkPanel.addEventListener("focusout",this.onUserMenuBlur)}else{this.userLinkPanel.removeEventListener("focusout",this.onUserMenuBlur);this.el.focus()}}searchbarShow(){this.searchBarShown=true;this.searchBarEl.addEventListener("transitionend",this.onSearchBarShown);this.searchBarEl.style.display="block";setTimeout((()=>{const t=Math.floor(this.searchBarEl.querySelector(".search-widget").scrollHeight)-1;this.searchBarEl.style.height=t.toString()+"px"}),50)}autocompleteSnippet(t){const i=["title"];if(t._snippetResult){const e=i.find((i=>t._snippetResult[i]&&t._snippetResult[i].matchLevel!=="none"));if(e){if(e!=="title")return(t.title.length>15?t.title.substring(0,15)+" ...":t.title)+" "+t._snippetResult[e].value;else return t._snippetResult["title"].value}}return t.title}isSearchValSet(){if(this.searchValInternal.length<3)return false;return true}resetHitFocus(){this.currAIndex=-1}setActiveElement(t){this.autocompleteEles.map((t=>t.setAttribute("aria-selected","false")));t.focus({preventScroll:true});t.setAttribute("aria-selected","true")}attachIO(){if(this.io)return;const t=this.el.shadowRoot.querySelector(".global-nav .main-bar");if(typeof window!=="undefined"&&window.IntersectionObserver&&!!t){const i=this.io=new window.IntersectionObserver((t=>{this.intersectRatio=t.slice(-1)[0].intersectionRatio}),{root:t,threshold:1});i.observe(t.querySelector(".measure-ele"))}}componentDidLoad(){{this.debounceResize=c(this.onWindowResize.bind(this),300);window.addEventListener("resize",this.debounceResize);this.currSize=window.innerWidth}this.initAlgoliaClient();this.addAlgoliaIndeces();if(this.remoteDataReady)this.attachIO()}componentWillLoad(){l.init(this,["searchIndex","searchValue"],"url-hash","gns");this.assessSlottedContent()}disconnectedCallback(){if(this.io){this.io.disconnect();this.io=undefined}if(this.mo){this.mo.disconnect();this.mo=undefined}window.removeEventListener("resize",this.debounceResize)}connectedCallback(){this.handleMyAccountData();this.getMyAccData()}autocompleteList(){let t;if(this.showAutocomplete&&this.scrollingUp){let i=0;let e=0;const n=(t,i)=>i.index!==this.currentIndex.index?t+i.hits.length:t;const a=(t,i)=>i.index===this.currentIndex.index?t+i.hits.length:t;if(this.scopeSearch){e=this.scopeSearch.results.reduce(n,0);i=this.scopeSearch.results.reduce(a,0)}if(this.autocompleteResults&&this.autocompleteResults.hits.length||e&&!i){let e=0;t=s("div",null,!i&&s("div",{class:"search-autocomplete-hit search-autocomplete-hit--no-result"},"No results matching '",this.searchValInternal,"' were found in"," ",s("strong",null,this.currentIndex.name),". Try another phrase."),this.autocompleteResults&&[this.autocompleteResults.hits.map(((t,i)=>s("a",{role:"option",ref:t=>this.autocompleteEles.push(t),tabindex:"-1",id:"autocomplete-hit-"+i,href:t.url,class:"search-autocomplete-hit",innerHTML:this.autocompleteSnippet(t)})))],(!i||this.currentIndex.allGroup)&&this.scopeSearch&&this.scopeSearch.results&&[this.scopeSearch.results.map(((t,i)=>{if(!t.hits.length||t.index===this.currentIndex.index||e>1)return;e++;return s("button",{role:"option",ref:t=>this.autocompleteEles.push(t),tabindex:"-1",id:"autocomplete-scope-"+i,class:"search-autocomplete-hit",onClick:()=>this.switchIndexSubmit(t.index),onMouseDown:()=>this.switchIndexSubmit(t.index)},'"',this.searchValInternal,'"'," ",s("div",{class:"search-autocomplete-hit-scope"},"in ",t.indexName))}))],!!i&&s("div",{class:"search-autocomplete-foot"},s("button",{role:"option",class:"search-autocomplete-submit",ref:t=>this.autocompleteEles.push(t),id:"autocomplete-foot",onClick:this.onSearchSubmit,onMouseDown:this.onSearchSubmit},"View all results")))}else if(!i){t=s("div",{class:"search-autocomplete-hit search-autocomplete-hit--no-result"},"No results matching '",this.searchValInternal,"' were found. Try another phrase.")}}return s("div",{class:"search-autocomplete",role:"listbox",id:"autocomplete-results","aria-expanded":this.showAutocomplete?"true":"false",hidden:!this.showAutocomplete,onKeyDown:this.onAutocompleteInteract},t)}searchWidget(){return[s("form",{class:"search-inputs",onSubmit:this.onSearchSubmit,id:"global-nav-search"},s("nano-select",{class:"search-input",label:"Which area of content would you like to search?",hideLabel:true,showInlineError:false,value:this.searchIndex,onNanoChange:this.onSearchIndexChange,mask:true},this.internalSearchIndeces.map((t=>s("nano-option",{selected:t.index===this.searchIndex,value:t.index},t.name||t.index))),s("nano-icon",{name:"light/chevron-down",class:"select-input__arrow",slot:"down-arrow"})),s("nano-input",{class:"search-input",label:"What would you like to search for?","aria-label":"What would you like to search for",hideLabel:true,showInlineError:false,"clear-input":true,placeholder:"Search Nanopore",type:"text",ref:t=>this.searchInput=t,onNanoChange:this.onSearchChange,onNanoInput:this.onSearchInput,onKeyDown:this.onAutocompleteInteract,debounce:500,"aria-autocomplete":"list","aria-activedescendant":this.autocompleteEles[this.currAIndex]?this.autocompleteEles[this.currAIndex].id:false,"aria-controls":"autocomplete-results",onNanoFocus:this.showAutocompleteResults,value:this.searchValue,role:"textbox"},s("button",{class:{"search-icon":true,"search-icon--search":true,"search-icon--show":!!this.searchValue&&!this.searchLoading},slot:"end",onMouseDown:t=>{this.searchValInternal=this.searchInput.value;this.onSearchSubmit(t,true)}},s("nano-icon",{name:"light/search"})),s("span",{class:{"search-icon":true,"search-icon--loader":true,"search-icon--show":this.searchLoading},slot:"end"},s("nano-icon",{name:"light/spinner-third"}))),s("input",{type:"submit"}))]}render(){var t,i;this.autocompleteEles=[];const e=this.el.ownerDocument.dir==="rtl";const n=this.searchWidget();n.push(this.autocompleteList());return s(o,{class:{[this.thresholdClasses().join(" ")]:true,ready:this.ready,"search-bar-shown":this.searchBarShown&&this.scrollingUp,"search-auto-complete-shown":this.showAutocomplete&&this.scrollingUp,"modal-open":this.modalIsOpen,resizing:this.isResizing},dir:e?"rtl":null,role:"navigation"},s("div",{class:{"global-nav":true,"scrolling-down":!this.scrollingUp}},s("nav",{id:"global-nav-menu",class:{"gn-menu":true,open:this.modalOpen,"has-promotion":this.hasPromotionSlot,"menu-full-screen":this.menuFullScreen,"secondary-open":!!this.secondaryMenuOpen},"aria-expanded":this.modalOpen?"true":"false",ref:t=>this.menuDiv=t},s("div",{class:"gn-menu_wrap",ref:t=>this.menuWrapDiv=t,tabindex:"-1"},s("div",{class:"gn-menu_actions"},s("button",{class:"menu-btn icon-btn icon-btn",onMouseDown:this.onMenuBtnClick,onKeyDown:this.onMenuBtnKeyDown},this.threshold<this.THRESHOLDLIMIT-3&&s("nano-icon",{name:"light/times","aria-label":"close menu"}),this.threshold>=this.THRESHOLDLIMIT-3&&s("nano-icon",{name:"light/bars","aria-label":"close menu"})),this.threshold<this.THRESHOLDLIMIT-b.icon&&[!!this.iconSlotLen&&s("slot",{name:"icon"}),this.myAccData&&(!this.activeMyAccountSections||this.activeMyAccountSections.includes("icons"))&&[this.msgUrl&&s("a",{href:this.msgUrl,class:"icon-btn"},s("nano-icon",{name:"light/bell"}),this.msgCount>0&&s("span",{class:"gn-menu_actions-counter"},this.msgCount)),this.cartUrl&&s("a",{href:this.cartUrl,class:"icon-btn"},s("nano-icon",{name:"light/shopping-cart"}),this.cartCount>0&&s("span",{class:"gn-menu_actions-counter"},this.cartCount))]],this.myAccData&&this.myAccData.urls.login&&s("a",{href:this.myAccData.urls.login+this.ssoRedirect,class:"login-btn"},"Login / Register"," ",s("nano-icon",{name:"solid/chevron-right"}))),s("div",{class:"content-wrap",ref:t=>this.menuContentDiv=t},s("div",{class:"content"},s("nav",{class:"nav-links nav-links--main",role:"menu"},s("slot",{name:"overflow",onSlotchange:this.assessSlottedContent}),this.threshold<this.THRESHOLDLIMIT-b.main&&!!this.mainSlotLen&&s("slot",{name:"main",onSlotchange:this.assessSlottedContent})),((!!this.aboutSlotLen||!!this.aboutNavItms.length)&&this.hasSiteSlot||!!this.siteNavItms.length)&&s("div",null,(this.hasSiteSlot||!!this.siteNavItms.length)&&[(this.threshold>=this.THRESHOLDLIMIT-2||this.mainSlotLen<2)&&this.overflowSlotLen<2&&s("div",{class:"nav-links-wrap"},s("h4",{class:"nav-links_title nav-links_title--sites"},"Sites"),s("nav",{class:"nav-links nav-links--sub nav-links--sites","aria-label":"Different company site links"},s("slot",{name:"site",onSlotchange:this.assessSlottedContent}),this.siteNavItms.map((t=>s("nano-nav-item",{class:"nano-global-nav nano-global-nav-menu"},s("a",{href:t.address,target:t.target},t.title)))))),(this.threshold<this.THRESHOLDLIMIT-2&&this.mainSlotLen>=2||this.overflowSlotLen>=2)&&s("nav",{class:"nav-links","aria-label":"Different company site links"},s("nano-nav-item",{class:"nano-global-nav nano-global-nav-menu"},"Sites",s("nano-icon",{slot:"icon-end",name:"solid/chevron-right"}),s("div",{slot:"secondary"},s("div",{class:"content"},s("button",{class:"back-btn",onClick:this.subMenuClose},s("nano-icon",{slot:"icon-end",name:"solid/chevron-left","aria-label":"go back"}),"Sites"),s("div",{class:"content--sub"},s("slot",{name:"site",onSlotchange:this.assessSlottedContent}),this.siteNavItms.map((t=>s("nano-nav-item",{class:"nano-global-nav nano-global-nav-menu"},s("a",{href:t.address,target:t.target},t.title)))))))))])),this.isLoggedIn&&this.threshold<this.THRESHOLDLIMIT-b.login&&(this.loggedInNavItms.length||this.hasLoggedinSlot)&&s("nav",{class:"nav-links","aria-label":"Your user account links"},s("nano-nav-item",{class:"nano-global-nav user-nav nano-global-nav-menu"},this.myAccountUser.name,s("nano-icon",{slot:"icon-end",name:"solid/chevron-right"}),s("div",{slot:"secondary"},s("div",{class:"content"},s("button",{class:"back-btn",onClick:this.subMenuClose},s("nano-icon",{slot:"icon-end",name:"solid/chevron-left","aria-label":"go back"}),this.myAccountUser.name),!!((t=this.myAccountUser)===null||t===void 0?void 0:t.small_avatar_url)&&s("nano-global-nav-user-profile",{myAccountUser:this.myAccountUser,userProfileUrl:this.userProfileUrl}),s("div",{class:"content--sub"},s("slot",{name:"loggedin",onSlotchange:this.assessSlottedContent}),this.loggedInNavItms.map((t=>s("nano-nav-item",{class:"nano-global-nav nano-global-nav-menu"},s("a",{href:t.address,target:t.target},t.title)))),s("nano-nav-item",{class:"nano-global-nav nano-global-nav-menu"},s("a",{href:this.myAccData.urls.forgot_password+this.ssoRedirect},"Change Password"))))))),s("slot",{name:"promotion",onSlotchange:this.assessSlottedContent}),this.myAccData&&this.myAccData.urls.logout&&s("div",{class:"login-btn logout-btn"},s("a",{href:this.myAccData.urls.logout+this.ssoRedirect},"Logout"))))),s("div",{class:"sticker-trigger"}),s("nano-sticker",{"auto-resize":"false","break-point-max":"800",quietMode:{h:600,w:800}},s("div",{class:"bars"},s("nav",{class:"main-bar","aria-label":"Main site navigation",tabindex:"-1",ref:t=>this.mainBarDiv=t,role:!!this.mainSlotLen&&this.threshold>=this.THRESHOLDLIMIT-b.main?"menu":undefined},(this.hasPromotionSlot||!!this.overflowSlotLen||(this.myAccData||!!this.iconSlotLen)&&this.threshold<this.THRESHOLDLIMIT-b.icon||this.isLoggedIn&&(!!this.loggedInNavItms.length||this.hasLoggedinSlot)&&this.threshold<this.THRESHOLDLIMIT-b.login||!!this.mainSlotLen&&this.threshold<this.THRESHOLDLIMIT-b.main||(!!this.aboutSlotLen||!!this.aboutNavItms.length)&&this.threshold<this.THRESHOLDLIMIT-b.about||this.hasSiteSlot||!!this.siteNavItms.length)&&s("button",{class:"menu-btn icon-btn",onMouseDown:this.menuOpen,onKeyDown:this.onMenuBtnKeyDown,"aria-expanded":this.modalOpen?"true":"false","aria-controls":"global-nav-menu",ref:t=>this.menuBtn=t},s("nano-icon",{name:"light/bars","aria-label":"open menu"})),this.showLogo&&s("a",{href:this.logoUrl,class:"logo-link"},s("img",{src:a(`../nano-assets/ont-logo.svg`),alt:"Oxford Nanopore Technologies Logo",class:"logo"})),!this.showLogo&&s("div",{class:"logo-link"},s("slot",{name:"logo",onSlotchange:this.assessSlottedContent})),s("div",{class:"nav-links nav-links--main"},s("slot",{name:"main",onSlotchange:this.assessSlottedContent})),this.mainSlotLen===0&&this.threshold>=this.THRESHOLDLIMIT-b.search&&[this.showSearch&&!!this.internalSearchIndeces.length&&s("div",{class:"search-widget",role:"combobox","aria-owns":"autocomplete-results","aria-expanded":this.showAutocomplete&&this.autocompleteResults?"true":"false"},n),(!this.showSearch||!this.myAccData)&&!!this.searchSlotLen&&s("slot",{name:"search",onSlotchange:this.assessSlottedContent})],(this.mainSlotLen>0||this.threshold<this.THRESHOLDLIMIT-b.search)&&(this.showSearch&&!!this.internalSearchIndeces.length||!!this.searchSlotLen)&&s("button",{class:{"icon-btn":true,"search-btn":true,"search-btn--open":this.searchBarShown},"aria-controls":"global-nav-search-bar","aria-expanded":this.searchBarShown?"true":"false",onMouseDown:this.onSearchBtnClick,onKeyDown:this.onSearchBtnKeyDown},s("nano-icon",{name:"light/search"})),this.threshold>=this.THRESHOLDLIMIT-b.icon&&[!!this.iconSlotLen&&s("slot",{name:"icon"}),this.myAccData&&(!this.activeMyAccountSections||this.activeMyAccountSections.includes("icons"))&&[this.msgUrl&&s("a",{href:this.msgUrl,class:"icon-btn"},s("nano-icon",{name:"light/bell"}),this.msgCount>0&&s("span",{class:"gn-menu_actions-counter"},this.msgCount)),this.cartUrl&&!!this.cartCount&&s("a",{href:this.cartUrl,class:"icon-btn"},s("nano-icon",{name:"light/shopping-cart"}),this.cartCount>0&&s("span",{class:"gn-menu_actions-counter"},this.cartCount))]],(!!this.aboutSlotLen||!!this.aboutNavItms.length)&&this.threshold>=this.THRESHOLDLIMIT-b.about&&s("nav",{class:"nav-links nav-links--sub","aria-label":"About the company. Links",role:"menu"},s("slot",{name:"about",onSlotchange:this.assessSlottedContent}),!!this.aboutNavItms.length&&s("nano-nav-item",{class:"nano-global-nav nano-global-nav-bar"},s("a",{href:this.aboutNavItms[0].address,target:this.aboutNavItms[0].target},this.aboutNavItms[0].title))),this.myAccData&&(!this.activeMyAccountSections||this.activeMyAccountSections.includes("loggedin"))&&this.threshold>=this.THRESHOLDLIMIT-b.login&&[this.myAccData.urls.login&&s("a",{href:this.myAccData.urls.login+this.ssoRedirect,class:"login-btn"},"Login / Register"),this.myAccountUser&&s("div",{class:"user-links"},s("button",{class:{"icon-btn":true,"user-links-btn":true,open:this.userMenuOpen},onMouseDown:this.onUserBtnClick,onKeyDown:this.onUserBtnKeyDown}," ",this.myAccountUser.name,s("nano-icon",{name:"solid/caret-down"})),s("div",{class:"user-links-panel",tabindex:"-1",ref:t=>this.userLinkPanel=t},!!((i=this.myAccountUser)===null||i===void 0?void 0:i.small_avatar_url)&&s("nano-global-nav-user-profile",{myAccountUser:this.myAccountUser,userProfileUrl:this.userProfileUrl}),s("div",{class:"user-links-panel-content"},this.loggedInNavItms.map((t=>s("a",{href:t.address,target:t.target},t.title)))),s("div",{class:"user-links-panel-foot"},s("a",{href:this.myAccData.urls.forgot_password+this.ssoRedirect},"Change Password"),s("a",{href:this.myAccData.urls.logout+this.ssoRedirect},"Logout"))))],s("span",{class:"measure-ele"})),(this.mainSlotLen>0||this.threshold<this.THRESHOLDLIMIT-b.search)&&s("div",{id:"global-nav-search-bar",class:{"search-bar":true,show:this.searchBarShown},"aria-expanded":this.searchBarShown?"true":"false",role:"region",tabindex:"-1",ref:t=>this.searchBarEl=t},s("div",{class:"search-widget"},this.showSearch&&!!this.internalSearchIndeces.length&&s("div",null,n),(!this.showSearch||!this.myAccData)&&!!this.searchSlotLen&&s("slot",{name:"search",onSlotchange:this.assessSlottedContent}))))),(this.threshold<this.THRESHOLDLIMIT-3||this.menuFullScreen)&&s("div",{class:{mask:true,open:this.modalOpen},onClick:this.menuClose,onTouchEnd:this.menuClose})),s("div",{class:"site-content"},s("slot",null)))}domainFor(t){if(!this.myAccData)return"";const i=this.myAccData.domains.find((i=>i.origin===t));return i?i.domain:""}processSearchResults(t){const i=t;const e=t;if(i.results){i.results.forEach(((t,e)=>{i.results[e]=this.processSearchResults(t)}));return i}else{e.hits.map((t=>{if(t.url&&!t.url.match(/^http/))t.url=location.protocol+"//"+this.domainFor(t.origin)+t.url}));return e}}processMyAccData(){if(!this.myAccData||!this.myAccData.search.indeces.length)return;if(this.myAccData.search.api_key)this.searchApiKey=this.myAccData.search.api_key;if(this.myAccData.search.app_id)this.searchAppId=this.myAccData.search.app_id;if(this.myAccData.cart.count)this.cartCount=this.myAccData.cart.count;if(this.myAccData.notifications.count)this.msgCount=this.myAccData.notifications.count;if(!this.searchAppId||!this.searchApiKey)return;this.internalSearchIndeces=[...this.myAccData.search.indeces,...this.searchIndeces];if(this.myAccData.urls.cart&&!this.cartUrl)this.cartUrl=this.myAccData.urls.cart;if(this.myAccData.urls.messages&&!this.msgUrl)this.msgUrl=this.myAccData.urls.messages}processMyAccLinks(){if(!this.myAccData.links||!this.myAccData.links.length)return;this.myAccData.links.forEach((t=>{switch(t.area){case"left-side-logged-in":case"left-side-logged-out":if(this.activeMyAccountSections&&!this.activeMyAccountSections.includes("sites"))break;if(this.isLoggedIn&&t.area==="left-side-logged-in")this.siteNavItms.push(t);else if(!this.isLoggedIn&&t.area==="left-side-logged-out")this.siteNavItms.push(t);break;case"right-side-logged-in":case"right-side-logged-out":if(this.activeMyAccountSections&&!this.activeMyAccountSections.includes("about"))break;if(this.isLoggedIn&&t.area==="right-side-logged-in")this.aboutNavItms.push(t);else if(!this.isLoggedIn&&t.area==="right-side-logged-out")this.aboutNavItms.push(t);break;case"profile-panel-list":if(this.activeMyAccountSections&&!this.activeMyAccountSections.includes("loggedin"))break;this.loggedInNavItms.push(t);break}}))}get el(){return r(this)}static get watchers(){return{myAccountData:["handleMyAccountData"],env:["getMyAccData"],ssoDataUrl:["getMyAccData"],searchIndex:["currentSelectedIndex"],searchValInternal:["changeInternalSearchVal"],searchApiKey:["initAlgoliaClient"],searchAppId:["initAlgoliaClient"],searchIndeces:["addIndeces"],internalSearchIndeces:["addAlgoliaIndeces"],threshold:["thresholdChange"],intersectRatio:["ratioChange"],thresholdReady:["assessReady"],remoteDataReady:["assessReady","remoteReady"],ready:["isReady"],showAutocomplete:["setupAutocompleteBlur","resetHitFocus"],secondaryMenuOpen:["closeSearchBar"],aboutSlotLen:["slotChange"],iconSlotLen:["slotChange"],mainSlotLen:["slotChange"],overflowSlotLen:["slotChange"],searchSlotLen:["slotChange"],userMenuOpen:["handleUserMenu"]}}};m.style=g;export{m as nano_global_nav};
|
5
|
+
//# sourceMappingURL=p-f2d89239.entry.js.map
|