@nanoporetech-digital/components 6.8.4 → 6.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/{component-store-7427cb36.js → component-store-c2e19934.js} +16 -3
  3. package/dist/cjs/component-store-c2e19934.js.map +1 -0
  4. package/dist/cjs/nano-algolia-filter.cjs.entry.js +1 -1
  5. package/dist/cjs/nano-algolia.cjs.entry.js +1 -1
  6. package/dist/cjs/nano-dialog.cjs.entry.js +1 -1
  7. package/dist/cjs/nano-drawer.cjs.entry.js +1 -1
  8. package/dist/cjs/nano-global-nav.cjs.entry.js +1 -1
  9. package/dist/cjs/nano-global-search-results.cjs.entry.js +1 -1
  10. package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
  11. package/dist/cjs/nano-tab-group.cjs.entry.js +1 -1
  12. package/dist/cjs/{nano-table-80887e1e.js → nano-table-0f34020f.js} +2 -2
  13. package/dist/cjs/{nano-table-80887e1e.js.map → nano-table-0f34020f.js.map} +1 -1
  14. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  15. package/dist/cjs/{table.worker-e47dba3a.js → table.worker-5cba101f.js} +2 -2
  16. package/dist/cjs/table.worker-5cba101f.js.map +1 -0
  17. package/dist/collection/components/checkbox/__tests__/__fixtures__/checkbox-templates.js +4 -4
  18. package/dist/collection/components/checkbox/__tests__/__fixtures__/checkbox-templates.js.map +1 -1
  19. package/dist/collection/components/global-search-results/global-search-results.js +1 -1
  20. package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
  21. package/dist/collection/utils/store/get-set.js +15 -2
  22. package/dist/collection/utils/store/get-set.js.map +1 -1
  23. package/dist/components/component-store.js +15 -2
  24. package/dist/components/component-store.js.map +1 -1
  25. package/dist/components/nano-global-search-results.js +1 -1
  26. package/dist/components/nano-global-search-results.js.map +1 -1
  27. package/dist/esm/{component-store-486d9d7a.js → component-store-64043183.js} +16 -3
  28. package/dist/esm/component-store-64043183.js.map +1 -0
  29. package/dist/esm/nano-algolia-filter.entry.js +1 -1
  30. package/dist/esm/nano-algolia.entry.js +1 -1
  31. package/dist/esm/nano-dialog.entry.js +1 -1
  32. package/dist/esm/nano-drawer.entry.js +1 -1
  33. package/dist/esm/nano-global-nav.entry.js +1 -1
  34. package/dist/esm/nano-global-search-results.entry.js +1 -1
  35. package/dist/esm/nano-global-search-results.entry.js.map +1 -1
  36. package/dist/esm/nano-tab-group.entry.js +1 -1
  37. package/dist/esm/{nano-table-b752fe01.js → nano-table-fc25f277.js} +2 -2
  38. package/dist/esm/{nano-table-b752fe01.js.map → nano-table-fc25f277.js.map} +1 -1
  39. package/dist/esm/nano-table.entry.js +1 -1
  40. package/dist/esm/{table.worker-c8338436.js → table.worker-55afec8e.js} +2 -2
  41. package/dist/esm/table.worker-55afec8e.js.map +1 -0
  42. package/dist/nano-components/component-store-64043183.js +5 -0
  43. package/dist/nano-components/component-store-64043183.js.map +1 -0
  44. package/dist/nano-components/nano-algolia-filter.entry.js +1 -1
  45. package/dist/nano-components/nano-algolia.entry.js +1 -1
  46. package/dist/nano-components/nano-dialog.entry.js +1 -1
  47. package/dist/nano-components/nano-drawer.entry.js +1 -1
  48. package/dist/nano-components/nano-global-nav.entry.js +1 -1
  49. package/dist/nano-components/nano-global-search-results.entry.js +1 -1
  50. package/dist/nano-components/nano-global-search-results.entry.js.map +1 -1
  51. package/dist/nano-components/nano-tab-group.entry.js +1 -1
  52. package/dist/nano-components/{nano-table-b752fe01.js → nano-table-fc25f277.js} +2 -2
  53. package/dist/nano-components/nano-table.entry.js +1 -1
  54. package/dist/nano-components/{table.worker-c8338436.js → table.worker-55afec8e.js} +2 -2
  55. package/docs-json.json +1 -1
  56. package/hydrate/index.js +16 -3
  57. package/package.json +2 -2
  58. package/dist/cjs/component-store-7427cb36.js.map +0 -1
  59. package/dist/cjs/table.worker-e47dba3a.js.map +0 -1
  60. package/dist/esm/component-store-486d9d7a.js.map +0 -1
  61. package/dist/esm/table.worker-c8338436.js.map +0 -1
  62. package/dist/nano-components/component-store-486d9d7a.js +0 -5
  63. package/dist/nano-components/component-store-486d9d7a.js.map +0 -1
  64. /package/dist/nano-components/{nano-table-b752fe01.js.map → nano-table-fc25f277.js.map} +0 -0
  65. /package/dist/nano-components/{table.worker-c8338436.js.map → table.worker-55afec8e.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- export { T as nano_table } from './nano-table-b752fe01.js';
4
+ export { T as nano_table } from './nano-table-fc25f277.js';
5
5
  import './index-9695db0a.js';
6
6
  import './math-c02ddfda.js';
7
7
  import './throttle-ac4fcefa.js';
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import { c as createWorker } from './nano-table-b752fe01.js';
4
+ import { c as createWorker } from './nano-table-fc25f277.js';
5
5
  import './index-9695db0a.js';
6
6
  import './math-c02ddfda.js';
7
7
  import './throttle-ac4fcefa.js';
@@ -18,4 +18,4 @@ URL.revokeObjectURL(url);
18
18
 
19
19
  export { worker, workerMsgId, workerName, workerPath };
20
20
 
21
- //# sourceMappingURL=table.worker-c8338436.js.map
21
+ //# sourceMappingURL=table.worker-55afec8e.js.map
@@ -0,0 +1 @@
1
+ {"file":"table.worker-55afec8e.js","mappings":";;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Web Components for Nanopore digital Web Apps
3
+ */
4
+ import{g as t}from"./index-9695db0a.js";import{d as e}from"./throttle-ac4fcefa.js";function s(t,e){const s=new URLSearchParams([...new URLSearchParams(t)].map((([t,e])=>[t.replace(/([[\]])/g,((t,e)=>e==="["?".":"")),e])));const n={};new Set(s.keys()).forEach((t=>{const r=s.getAll(t).join(",").split(",").map((t=>decodeURIComponent(t.replace(/\+/g," "))));const i=r.length===1?r[0]:r;let u=t;let o=e?e({firstRawValue:s.get(t).split(","),key:u,rawValue:r,value:i}):i;if(u.includes(".")){const[t,...e]=u.split(".");const s=n[t]||{};const r=e.pop();e.reduce(((t,e)=>t[e]??={}),s)[r]=o;u=t;o=s}n[u]=o}));return n}function n(t,e){if(!t)return"";const s=[["",t]];const n=new URLSearchParams;while(s.length){const[t,r]=s.pop();Object.entries(r).forEach((([r,i])=>{if(i==null&&e==null)return;const u=typeof i;const o=t?`${t}.${r}`:r;if(i!==null&&u==="object"&&!Array.isArray(i)){s.push([o,i])}else{let t=u==="string"?i:"";if(Array.isArray(i))t=i.join(",");else if(i?.toJSON)t=i.toJSON();else if(i?.toString)t=i.toString();else t=String(i);const s=e?e({flattenedKey:o,key:r,rawValue:i,value:t}):t;s!=null&&n.append(o,s)}}))}n.sort();return n.toString()}const r="nano-component-store:";const i=(t="hash",e=window)=>{if(!e||!e.location)return{};if(t==="hash"&&e.location.hash&&e.location.hash.match(/&|=/))return s(e.location.hash.replace(/^\#/,""));else if(t==="query"&&e.location.search&&e.location.search.match(/&|=/))return s(e.location.search.replace(/^\?/,""));return{}};const u=(t,e="hash",s=window,r="replace")=>{if(!s||!s.history)return;const i=e==="query"?s.location.search:s.location.hash;const u=e==="query"?s.location.pathname:s.location.pathname+s.location.search;let o=n(t);if(!o||!o.length){if(!i||!i.length)return;if(r==="replace")s.history.replaceState(null,null,u);else s.history.pushState(null,null,u);return}if(e==="hash"&&s.location.hash==="#"+o){try{document.querySelector("#"+o).focus()}catch(t){}return}o=(e==="hash"?"#":"?")+o;if(o===i)return;if(r==="replace")s.history.replaceState(null,null,u+o);else s.history.pushState(null,null,u+o)};const o=(t,e,n="hash",r=window,o="replace")=>{t=Object.keys(s(t))[0];const h={};for(const t in e){if(!e[t]||Array.isArray(e[t])&&!e[t].length){delete e[t]}}h[t]=e;let c=i(n,r);if(!c[t]&&!h[t])return;c={...c,...h};u(c,n,r,o)};const h=(t,e="hash",n=window)=>{t=Object.keys(s(t))[0];const r=i(e,n);return r[t]||null};const c=(t,e,s=window)=>{try{if(!e){s.sessionStorage.removeItem(r+t);return}s.sessionStorage.setItem(r+t,JSON.stringify(e))}catch(t){throw t}};const a=(t,e=window)=>{try{const s=e.sessionStorage.getItem(r+t);return s!==null?JSON.parse(s):null}catch(t){throw t}};const l=(t,e,s=window)=>{try{if(!e){s.localStorage.removeItem(r+t);return}s.localStorage.setItem(r+t,JSON.stringify(e))}catch(t){throw t}};const f=(t,e=window)=>{try{const s=e.localStorage.getItem(r+t);return s!==null?JSON.parse(s):null}catch(t){throw t}};const w=new Map;const d={init(e,s,n,r){const i=r||e.storeId||t(e).id;if(!i){console.error("No id set. You can only instantiate a new component store with an id. ");return}if(w.get(i)){console.error("Duplicate store id usage. A store ID must be unique!",i);return}const u=s.reduce(((t,s)=>{if(typeof e[s]!==undefined)t[s]=e[s];return t}),{});w.set(i,new p(i,e,s,u,n));const o=w.get(i);o.dispatchToProps();const h=e.connectedCallback;e.connectedCallback=function(){w.set(i,new p(i,e,s,u,n));const t=w.get(i);if(h){h.call(e)}if(t)t.dispatchToProps()};const c=e.componentDidRender;e.componentDidRender=function(){const t=w.get(i);if(c){c.call(e)}if(t)t.savePropsToStore()};const a=e.disconnectedCallback;e.disconnectedCallback=function(){const t=w.get(i);if(t)t.delete();w.delete(i);if(a){a.call(e)}}}};class p{constructor(t,s,n,r,i){this.method="session";this.initialState={};this.updateStore=true;this.onUrlChange=()=>{this.dispatchToProps(false)};this.savePropsToStore=()=>{if(this.updateStore){this.save(this.getData)}else if(!this.updateStore)this.updateStore=true};this.dispatchToProps=(t=true)=>{const e=this.retrieve();if(!e&&t)return;this.updateStore=t;this.keys.forEach((t=>{this.component[t]=e?e[t]:undefined}))};this.delete=()=>{if(this.method==="url-hash-push"||this.method==="url-query-push"){window.removeEventListener("popstate",this.onUrlChange)}};if(!t)throw new Error("No id set. You can only instantiate a new component store with an id");this.id=t;this.keys=n;this.component=s;if(r)this.initialState=r;if(i)this.method=i;this.savePropsToStore=e(this.savePropsToStore,500);if(this.method==="url-hash-push"||this.method==="url-query-push"){window.addEventListener("popstate",this.onUrlChange)}}equality(t,e){if(typeof t!==typeof e)return false;if(typeof t!=="object")return t===e;return JSON.stringify(t)===JSON.stringify(e)}get getData(){const t=this.keys.reduce(((t,e)=>{const s=this.equality(this.component[e],this.initialState[e]);if(typeof this.component[e]!=="undefined"&&!s){t[e]=this.component[e]}else if(s)delete t[e];return t}),{});return Object.keys(t).length?t:undefined}retrieve(){switch(this.method){case"url-hash":case"url-hash-push":return h(this.id,"hash");case"url-query":case"url-query-push":return h(this.id,"query");case"local":return f(this.id);default:return a(this.id)}}save(t){switch(this.method){case"url-hash":return o(this.id,t,"hash");case"url-query":return o(this.id,t,"query");case"url-hash-push":return o(this.id,t,"hash",window,"push");case"url-query-push":return o(this.id,t,"query",window,"push");case"local":return l(this.id,t);default:return c(this.id,t)}}}export{d as C};
5
+ //# sourceMappingURL=component-store-64043183.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["parse","searchParams","replacer","params","URLSearchParams","map","k","v","replace","_","s","t","Set","keys","forEach","paramKey","rawValue","getAll","join","split","n","decodeURIComponent","value","length","key","firstRawValue","get","includes","f","kl","o","l","pop","reduce","p","stringify","input","stack","sp","itemKey","itemValue","Object","entries","typeOfValue","flattenedKey","Array","isArray","push","toJSON","toString","String","vv","append","sort","STORAGE_NAME_SPACE","urlRead","from","win","window","location","hash","match","search","urlSave","object","to","method","history","oldQuery","basePath","pathname","queryStr","replaceState","pushState","document","querySelector","focus","e","urlSet","id","data","currentData","urlGet","sessionSet","sessionStorage","removeItem","setItem","JSON","sessionGet","configStr","getItem","storageSet","localStorage","storageGet","store","Map","ComponentStore","init","component","getId","storeId","getElement","console","error","initialState","acc","undefined","set","Store","componentstore","dispatchToProps","connectedCallback","call","componentDidRender","savePropsToStore","disconnectedCallback","delete","constructor","this","updateStore","onUrlChange","save","getData","savedData","retrieve","removeEventListener","Error","debounce","addEventListener","equality","val1","val2","isEqual","getset.urlGet","getset.storageGet","getset.sessionGet","getset.urlSet","getset.storageSet","getset.sessionSet"],"sources":["./node_modules/tyqs/dist/parse.js","./node_modules/tyqs/dist/stringify.js","./src/utils/store/get-set.ts","./src/utils/store/component-store.ts"],"sourcesContent":["export function parse(searchParams, replacer) {\n const params = new URLSearchParams([...new URLSearchParams(searchParams)].map(([k, v]) => [\n k.replace(/([[\\]])/g, (_, s) => s === '[' ? '.' : ''),\n v,\n ]));\n const t = {};\n new Set(params.keys()).forEach((paramKey) => {\n const rawValue = params\n .getAll(paramKey)\n .join(',')\n .split(',')\n .map(n => decodeURIComponent(n.replace(/\\+/g, ' ')));\n const value = rawValue.length === 1 ? rawValue[0] : rawValue;\n let key = paramKey;\n let v = replacer ?\n replacer({\n firstRawValue: params.get(paramKey).split(','),\n key,\n rawValue,\n value,\n }) :\n value;\n if (key.includes('.')) {\n const [f, ...kl] = key.split('.');\n const o = (t[f] || {});\n const l = kl.pop();\n (kl.reduce((p, n) => (p[n] ??= {}), o))[l] = v;\n key = f;\n v = o;\n }\n t[key] = v;\n });\n return t;\n}\n//# sourceMappingURL=parse.js.map","export function stringify(input, replacer) {\n if (!input)\n return '';\n const stack = [['', input]];\n const sp = new URLSearchParams();\n while (stack.length) {\n const [itemKey, itemValue] = stack.pop();\n Object.entries(itemValue).forEach(([key, rawValue]) => {\n if (rawValue == null && replacer == null)\n return;\n const typeOfValue = typeof (rawValue);\n const flattenedKey = itemKey ? `${itemKey}.${key}` : key;\n if (rawValue !== null && typeOfValue === 'object' && !Array.isArray(rawValue)) {\n stack.push([flattenedKey, rawValue]);\n }\n else {\n let value = typeOfValue === 'string' ? rawValue : '';\n if (Array.isArray(rawValue))\n value = rawValue.join(',');\n else if (rawValue?.toJSON)\n value = rawValue.toJSON();\n else if (rawValue?.toString)\n value = rawValue.toString();\n else\n value = String(rawValue);\n const vv = replacer ?\n replacer({ flattenedKey, key, rawValue, value }) :\n value;\n vv != null && sp.append(flattenedKey, vv);\n }\n });\n }\n sp.sort();\n return sp.toString();\n}\n//# sourceMappingURL=stringify.js.map","import { parse, stringify } from 'tyqs';\n\nconst STORAGE_NAME_SPACE = 'nano-component-store:';\n\nconst urlRead = (\n from: 'hash' | 'query' = 'hash',\n win: Window = window\n): void | object => {\n if (!win || !win.location) return {};\n if (from === 'hash' && win.location.hash && win.location.hash.match(/&|=/))\n return parse(win.location.hash.replace(/^\\#/, ''));\n else if (\n from === 'query' &&\n win.location.search &&\n win.location.search.match(/&|=/)\n )\n return parse(win.location.search.replace(/^\\?/, ''));\n return {};\n};\n\nconst urlSave = (\n object: object,\n to: 'hash' | 'query' = 'hash',\n win: Window = window,\n method: 'replace' | 'push' = 'replace'\n) => {\n if (!win || !win.history) return;\n const oldQuery = to === 'query' ? win.location.search : win.location.hash;\n const basePath =\n to === 'query'\n ? win.location.pathname\n : win.location.pathname + win.location.search;\n let queryStr = stringify(object);\n\n if (!queryStr || !queryStr.length) {\n if (!oldQuery || !oldQuery.length) return;\n if (method === 'replace') win.history.replaceState(null, null, basePath);\n else win.history.pushState(null, null, basePath);\n return;\n }\n\n if (to === 'hash' && win.location.hash === '#' + queryStr) {\n try {\n (document.querySelector('#' + queryStr) as HTMLElement).focus();\n } catch (e) {}\n return;\n }\n queryStr = (to === 'hash' ? '#' : '?') + queryStr;\n if (queryStr === oldQuery) return;\n if (method === 'replace')\n win.history.replaceState(null, null, basePath + queryStr);\n else win.history.pushState(null, null, basePath + queryStr);\n};\n\nexport const urlSet = (\n id: string,\n data: object,\n to: 'hash' | 'query' = 'hash',\n win: Window = window,\n method: 'replace' | 'push' = 'replace'\n) => {\n // sanitize the incoming key\n id = Object.keys(parse(id))[0];\n const object = {};\n\n // delete all empty incoming values\n for (const key in data) {\n if (!data[key] || (Array.isArray(data[key]) && !data[key].length)) {\n delete data[key];\n }\n }\n\n object[id] = data;\n let currentData = urlRead(to, win);\n\n // current data is empty and incoming data is empty\n // let's not do anything\n if (!currentData[id] && !object[id]) return;\n\n // let's merge current and incoming data and write it to the url\n currentData = { ...currentData, ...object };\n urlSave(currentData, to, win, method);\n};\n\nexport const urlGet = (\n key: string,\n to: 'hash' | 'query' = 'hash',\n win: Window = window\n) => {\n // sanitize the incoming key\n key = Object.keys(parse(key))[0];\n const currentData = urlRead(to, win);\n return currentData[key] || null;\n};\n\nexport const sessionSet = (\n key: string,\n object: object,\n win: Window = window\n) => {\n try {\n if (!object) {\n win.sessionStorage.removeItem(STORAGE_NAME_SPACE + key);\n return;\n }\n win.sessionStorage.setItem(\n STORAGE_NAME_SPACE + key,\n JSON.stringify(object)\n );\n } catch (e) {\n throw e;\n }\n};\n\nexport const sessionGet = (key: string, win: Window = window) => {\n try {\n const configStr = win.sessionStorage.getItem(STORAGE_NAME_SPACE + key);\n return configStr !== null ? JSON.parse(configStr) : null;\n } catch (e) {\n throw e;\n }\n};\n\nexport const storageSet = (\n key: string,\n object: object,\n win: Window = window\n) => {\n try {\n if (!object) {\n win.localStorage.removeItem(STORAGE_NAME_SPACE + key);\n return;\n }\n win.localStorage.setItem(STORAGE_NAME_SPACE + key, JSON.stringify(object));\n } catch (e) {\n throw e;\n }\n};\n\nexport const storageGet = (key: string, win: Window = window) => {\n try {\n const configStr = win.localStorage.getItem(STORAGE_NAME_SPACE + key);\n return configStr !== null ? JSON.parse(configStr) : null;\n } catch (e) {\n throw e;\n }\n};\n","import { getElement } from '@stencil/core';\nimport { debounce } from '../throttle';\nimport * as getset from './get-set';\n\nexport type StorageParams = Record<string, any>;\n\nexport type StorageMethods =\n | 'url-hash'\n | 'url-query'\n | 'url-hash-push'\n | 'url-query-push'\n | 'local'\n | 'session';\n\ninterface Component {\n connectedCallback?(): void;\n disconnectedCallback?(): void;\n componentDidRender?(): void;\n [key: string]: any;\n}\n\nconst store = new Map<string, Store>();\n\nexport const ComponentStore = {\n init(\n component: Component,\n keys: string[],\n method?: StorageMethods,\n id?: string\n ) {\n const getId = id || component.storeId || getElement(component).id;\n if (!getId) {\n console.error(\n 'No id set. You can only instantiate a new component store with an id. '\n );\n return;\n }\n if (store.get(getId)) {\n console.error(\n 'Duplicate store id usage. A store ID must be unique!',\n getId\n );\n return;\n }\n\n const initialState = keys.reduce((acc, key) => {\n if (typeof component[key] !== undefined) acc[key] = component[key];\n return acc;\n }, {});\n\n store.set(getId, new Store(getId, component, keys, initialState, method));\n const componentstore = store.get(getId);\n componentstore.dispatchToProps();\n\n const connectedCallback = component.connectedCallback;\n component.connectedCallback = function () {\n store.set(getId, new Store(getId, component, keys, initialState, method));\n const componentstore = store.get(getId);\n if (connectedCallback) {\n connectedCallback.call(component);\n }\n if (componentstore) componentstore.dispatchToProps();\n };\n\n const componentDidRender = component.componentDidRender;\n component.componentDidRender = function () {\n const componentstore = store.get(getId);\n if (componentDidRender) {\n componentDidRender.call(component);\n }\n if (componentstore) componentstore.savePropsToStore();\n };\n\n const disconnectedCallback = component.disconnectedCallback;\n component.disconnectedCallback = function () {\n const componentstore = store.get(getId);\n if (componentstore) componentstore.delete();\n store.delete(getId);\n if (disconnectedCallback) {\n disconnectedCallback.call(component);\n }\n };\n },\n};\n\nclass Store {\n private method: StorageMethods = 'session';\n private keys: string[];\n private id: string;\n private component: Component;\n private initialState: { [key: string]: any } = {};\n private updateStore: boolean = true;\n\n constructor(\n id: string,\n component: Component,\n keys: string[],\n initialState?: any,\n method?: StorageMethods\n ) {\n if (!id)\n throw new Error(\n 'No id set. You can only instantiate a new component store with an id'\n );\n this.id = id;\n this.keys = keys;\n this.component = component;\n if (initialState) this.initialState = initialState;\n if (method) this.method = method;\n\n this.savePropsToStore = debounce(this.savePropsToStore, 500);\n\n if (this.method === 'url-hash-push' || this.method === 'url-query-push') {\n window.addEventListener('popstate', this.onUrlChange);\n }\n }\n\n private onUrlChange = () => {\n this.dispatchToProps(false);\n };\n\n private equality(val1: any, val2: any) {\n if (typeof val1 !== typeof val2) return false;\n if (typeof val1 !== 'object') return val1 === val2;\n return JSON.stringify(val1) === JSON.stringify(val2);\n }\n\n get getData() {\n const data = this.keys.reduce((acc, key) => {\n const isEqual = this.equality(\n this.component[key],\n this.initialState[key]\n );\n if (typeof this.component[key] !== 'undefined' && !isEqual) {\n acc[key] = this.component[key];\n } else if (isEqual) delete acc[key];\n return acc;\n }, {});\n return Object.keys(data).length ? data : undefined;\n }\n\n private retrieve() {\n switch (this.method) {\n case 'url-hash':\n case 'url-hash-push':\n return getset.urlGet(this.id, 'hash');\n case 'url-query':\n case 'url-query-push':\n return getset.urlGet(this.id, 'query');\n case 'local':\n return getset.storageGet(this.id);\n default:\n return getset.sessionGet(this.id);\n }\n }\n\n private save(data: any) {\n switch (this.method) {\n case 'url-hash':\n return getset.urlSet(this.id, data, 'hash');\n case 'url-query':\n return getset.urlSet(this.id, data, 'query');\n case 'url-hash-push':\n return getset.urlSet(this.id, data, 'hash', window, 'push');\n case 'url-query-push':\n return getset.urlSet(this.id, data, 'query', window, 'push');\n case 'local':\n return getset.storageSet(this.id, data);\n default:\n return getset.sessionSet(this.id, data);\n }\n }\n\n public savePropsToStore = () => {\n if (this.updateStore) {\n this.save(this.getData);\n } else if (!this.updateStore) this.updateStore = true;\n };\n\n public dispatchToProps = (updateStore = true) => {\n const savedData = this.retrieve();\n if (!savedData && updateStore) return;\n\n // console.log('dispatching', savedData, this.id, this.initialState);\n this.updateStore = updateStore;\n\n this.keys.forEach((key) => {\n this.component[key] = savedData ? savedData[key] : undefined;\n });\n };\n\n public delete = () => {\n if (this.method === 'url-hash-push' || this.method === 'url-query-push') {\n window.removeEventListener('popstate', this.onUrlChange);\n }\n };\n}\n"],"mappings":"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"}
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{r as t,c as i,w as s,h as e,a as h,g as n}from"./index-9695db0a.js";import{C as l}from"./component-store-486d9d7a.js";import{W as o}from"./algolia-data-1b42827c.js";import"./throttle-ac4fcefa.js";const r=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{display:none}:host ::slotted([slot=filter-template]){display:none !important}:host(.show-filter){display:block}";const a=class{constructor(s){t(this,s);this.nanoFilterChanged=i(this,"nanoFilterChanged",7);this.nanoTplUpdated=i(this,"nanoTplUpdated",7);this.filterId=null;this.tplWillRnder=new Promise((t=>{this.tplDidRnder=t}));this.changeEvent=undefined;this.internalValue=[undefined];this.showFilter=false;this.indexResults=null;this.filterChanged=null;this.facets=undefined;this.tplRenderFn=undefined;this.globalStoreMethod=undefined;this.filterName=null;this.value="";this.operator="or";this.storeId=undefined;this.storeMethod="session"}valueSet(){const t=this.value;let i;if(typeof t==="string")i=t.length?t.split("|"):[];else i=this.value;if(this.didValueChange(i)){const t=this.setFieldValues(i);if(t&&t.length)this.internalValue=i;else{this.tplWillRnder.then((t=>{this.setFieldValues(i);this.internalValue=i}))}}}valueChanged(){this.value=this.internalValue;this.nanoFilterChanged.emit({filterId:this.filterId,facetName:this.filterName,value:this.internalValue,operator:this.operator})}appliedFilterChanged(){if(this.filterName&&this.filterChanged&&(this.filterChanged!==this.filterId||this.operator==="and")){this.updateContent()}}tplUpdate(){this.updateContent()}handleFilterChange(){if(this.indexResults&&this.indexResults.appliedFilters){const t=this.indexResults.appliedFilters.find((t=>t.name===this.filterName));if(!t)return;this.tplWillRnder.then((i=>{const s=this.setFieldValues(t.values);if(s&&s.length)this.value=s}))}this.updateContent()}handleChangeEvent(){const t=this.getFieldValues();if(this.didValueChange(t)){this.internalValue=t;return true}return false}updateContent(){const t=this.outputSlot||this.outputEle;if(!this.el)return;if(!this.templateStr)this.showFilter=true;else if(!this.filterName||!t||this.templateStr&&(!this.indexResults||!this.indexResults.origFilters[this.filterName])){this.showFilter=false}if(!t)return;if(!this.indexResults){if(this.templateStr){s((()=>{t.innerHTML=this.tplRenderFn(this.templateStr,{orig:{},dyn:{},selected:this.internalValue&&this.internalValue.length?this.internalValue:this.value});if(!this.value||!this.value.length)this.handleChangeEvent()}))}else if(!this.value||!this.value.length)this.handleChangeEvent();return}s((()=>{t.innerHTML=this.tplRenderFn(this.templateStr,{orig:{...this.indexResults.origFilters[this.filterName]},dyn:{...this.indexResults.dynFilters[this.filterName]},selected:this.internalValue&&this.internalValue.length?this.internalValue:this.value});this.tplDidRnder();this.setFieldValues();if(!this.showFilter)this.showFilter=true;this.nanoTplUpdated.emit(this.el)}))}getFieldValues(){const t=[];const i=this.outputSlot.querySelectorAll('input[type="checkbox"], input[type="radio"], select');for(let s=0;s<i.length;s++){const e=i[s];if(e.type==="select-multiple"){const i=e;for(let s=0;s<i.options.length;s++){if(!i.options[s].selected||!i.options[s].value.length)continue;t.push(i.options[s].value)}}else if(e.type!=="checkbox"&&e.type!=="radio"||e.checked&&e.value.length){t.push(e.value)}}return t}setFieldValues(t){t=t||this.internalValue;if(!t)return;const i=[];const s=this.outputSlot.querySelectorAll('input[type="checkbox"], input[type="radio"], select, nano-select, nano-checkbox');for(let e=0;e<s.length;e++){const h=s[e];if(h.disabled||h.type==="file"||h.type==="reset"||h.type==="submit"||h.type==="button")continue;if(h.type==="select-multiple"||h.type==="select-one"){const s=h;for(let e=0;e<s.options.length;e++){if(!t.includes(s.options[e].value))s.options[e].selected=false;else{i.push(s.value);s.options[e].selected=true;if(h.type==="select-one")s.value=s.options[e].value}}}else if(["checkbox","radio","tag","segment","segment-pill"].includes(h.type)){if(t.includes(h.value)){i.push(h.value);h.checked=true}else if(!t.length&&!h.value.length){h.checked=true}else h.checked=false}}return i}didValueChange(t){if(!!this.internalValue&&!t)return true;if(!this.internalValue&&!t)return false;if(this.internalValue&&t.length!==this.internalValue.length)return true;let i=false;for(let s=0;s<t.length;s++){if(!i&&(!this.internalValue||!this.internalValue.includes(t[s])))i=true}return i}connectedCallback(){this.templateSlot=this.el.querySelector('[slot="filter-template"]');this.outputSlot=this.el.querySelector('[slot="output"]');this.filterId=this.filterName+"_"+f++;if(!!this.templateSlot){this.templateStr=this.templateSlot.innerHTML;this.templateStr=this.templateStr.replace(/=&gt;/gm,"=>")}}componentWillLoad(){if(this.storeId)l.init(this,["value"],this.storeMethod||this.globalStoreMethod,this.storeId)}componentDidLoad(){this.updateContent();if(this.templateStr&&this.filterName&&this.indexResults&&this.indexResults.origFilters[this.filterName])this.showFilter=true}render(){return e(h,{class:{"show-filter":this.showFilter}},e("div",{ref:t=>this.outputEle=t},e("slot",{name:"output"})))}get el(){return n(this)}static get watchers(){return{value:["valueSet"],internalValue:["valueChanged"],facets:["appliedFilterChanged"],tplRenderFn:["tplUpdate"],indexResults:["handleFilterChange"]}}};o(a,["globalStoreMethod","indexResults","filterChanged","facets","tplRenderFn","changeEvent"]);let f=0;a.style=r;export{a as nano_algolia_filter};
4
+ import{r as t,c as i,w as s,h as e,a as h,g as n}from"./index-9695db0a.js";import{C as l}from"./component-store-64043183.js";import{W as o}from"./algolia-data-1b42827c.js";import"./throttle-ac4fcefa.js";const r=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{display:none}:host ::slotted([slot=filter-template]){display:none !important}:host(.show-filter){display:block}";const a=class{constructor(s){t(this,s);this.nanoFilterChanged=i(this,"nanoFilterChanged",7);this.nanoTplUpdated=i(this,"nanoTplUpdated",7);this.filterId=null;this.tplWillRnder=new Promise((t=>{this.tplDidRnder=t}));this.changeEvent=undefined;this.internalValue=[undefined];this.showFilter=false;this.indexResults=null;this.filterChanged=null;this.facets=undefined;this.tplRenderFn=undefined;this.globalStoreMethod=undefined;this.filterName=null;this.value="";this.operator="or";this.storeId=undefined;this.storeMethod="session"}valueSet(){const t=this.value;let i;if(typeof t==="string")i=t.length?t.split("|"):[];else i=this.value;if(this.didValueChange(i)){const t=this.setFieldValues(i);if(t&&t.length)this.internalValue=i;else{this.tplWillRnder.then((t=>{this.setFieldValues(i);this.internalValue=i}))}}}valueChanged(){this.value=this.internalValue;this.nanoFilterChanged.emit({filterId:this.filterId,facetName:this.filterName,value:this.internalValue,operator:this.operator})}appliedFilterChanged(){if(this.filterName&&this.filterChanged&&(this.filterChanged!==this.filterId||this.operator==="and")){this.updateContent()}}tplUpdate(){this.updateContent()}handleFilterChange(){if(this.indexResults&&this.indexResults.appliedFilters){const t=this.indexResults.appliedFilters.find((t=>t.name===this.filterName));if(!t)return;this.tplWillRnder.then((i=>{const s=this.setFieldValues(t.values);if(s&&s.length)this.value=s}))}this.updateContent()}handleChangeEvent(){const t=this.getFieldValues();if(this.didValueChange(t)){this.internalValue=t;return true}return false}updateContent(){const t=this.outputSlot||this.outputEle;if(!this.el)return;if(!this.templateStr)this.showFilter=true;else if(!this.filterName||!t||this.templateStr&&(!this.indexResults||!this.indexResults.origFilters[this.filterName])){this.showFilter=false}if(!t)return;if(!this.indexResults){if(this.templateStr){s((()=>{t.innerHTML=this.tplRenderFn(this.templateStr,{orig:{},dyn:{},selected:this.internalValue&&this.internalValue.length?this.internalValue:this.value});if(!this.value||!this.value.length)this.handleChangeEvent()}))}else if(!this.value||!this.value.length)this.handleChangeEvent();return}s((()=>{t.innerHTML=this.tplRenderFn(this.templateStr,{orig:{...this.indexResults.origFilters[this.filterName]},dyn:{...this.indexResults.dynFilters[this.filterName]},selected:this.internalValue&&this.internalValue.length?this.internalValue:this.value});this.tplDidRnder();this.setFieldValues();if(!this.showFilter)this.showFilter=true;this.nanoTplUpdated.emit(this.el)}))}getFieldValues(){const t=[];const i=this.outputSlot.querySelectorAll('input[type="checkbox"], input[type="radio"], select');for(let s=0;s<i.length;s++){const e=i[s];if(e.type==="select-multiple"){const i=e;for(let s=0;s<i.options.length;s++){if(!i.options[s].selected||!i.options[s].value.length)continue;t.push(i.options[s].value)}}else if(e.type!=="checkbox"&&e.type!=="radio"||e.checked&&e.value.length){t.push(e.value)}}return t}setFieldValues(t){t=t||this.internalValue;if(!t)return;const i=[];const s=this.outputSlot.querySelectorAll('input[type="checkbox"], input[type="radio"], select, nano-select, nano-checkbox');for(let e=0;e<s.length;e++){const h=s[e];if(h.disabled||h.type==="file"||h.type==="reset"||h.type==="submit"||h.type==="button")continue;if(h.type==="select-multiple"||h.type==="select-one"){const s=h;for(let e=0;e<s.options.length;e++){if(!t.includes(s.options[e].value))s.options[e].selected=false;else{i.push(s.value);s.options[e].selected=true;if(h.type==="select-one")s.value=s.options[e].value}}}else if(["checkbox","radio","tag","segment","segment-pill"].includes(h.type)){if(t.includes(h.value)){i.push(h.value);h.checked=true}else if(!t.length&&!h.value.length){h.checked=true}else h.checked=false}}return i}didValueChange(t){if(!!this.internalValue&&!t)return true;if(!this.internalValue&&!t)return false;if(this.internalValue&&t.length!==this.internalValue.length)return true;let i=false;for(let s=0;s<t.length;s++){if(!i&&(!this.internalValue||!this.internalValue.includes(t[s])))i=true}return i}connectedCallback(){this.templateSlot=this.el.querySelector('[slot="filter-template"]');this.outputSlot=this.el.querySelector('[slot="output"]');this.filterId=this.filterName+"_"+f++;if(!!this.templateSlot){this.templateStr=this.templateSlot.innerHTML;this.templateStr=this.templateStr.replace(/=&gt;/gm,"=>")}}componentWillLoad(){if(this.storeId)l.init(this,["value"],this.storeMethod||this.globalStoreMethod,this.storeId)}componentDidLoad(){this.updateContent();if(this.templateStr&&this.filterName&&this.indexResults&&this.indexResults.origFilters[this.filterName])this.showFilter=true}render(){return e(h,{class:{"show-filter":this.showFilter}},e("div",{ref:t=>this.outputEle=t},e("slot",{name:"output"})))}get el(){return n(this)}static get watchers(){return{value:["valueSet"],internalValue:["valueChanged"],facets:["appliedFilterChanged"],tplRenderFn:["tplUpdate"],indexResults:["handleFilterChange"]}}};o(a,["globalStoreMethod","indexResults","filterChanged","facets","tplRenderFn","changeEvent"]);let f=0;a.style=r;export{a as nano_algolia_filter};
5
5
  //# sourceMappingURL=nano-algolia-filter.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{g as t,e,r as i,c as s,w as n,d as r,h as o,a as l}from"./index-9695db0a.js";import{a as h}from"./algoliasearch-lite.esm.browser-d71a28dc.js";import{g as a}from"./dom-8599fac1.js";import{C as c}from"./component-store-486d9d7a.js";import{d as f}from"./throttle-ac4fcefa.js";import{S as u}from"./algolia-data-1b42827c.js";var d=new Map;var p=function(t,e){var i=t.fields,s=t.updater;i.forEach((function(t){s(t,e[t])}))};var m={create:function(e,i){var s=t(e);var n=new Map;var r={wormholes:n,state:i};d.set(e,r);var o=e.connectedCallback;e.connectedCallback=function(){d.set(e,r);if(o){o.call(e)}};var l=e.disconnectedCallback;e.disconnectedCallback=function(){d.delete(e);if(l){l.call(e)}};s.addEventListener("openWormhole",(function(t){t.stopPropagation();var e=t.detail,i=e.consumer,s=e.onOpen;if(n.has(i))return;if(typeof i!=="symbol"){var o=i.connectedCallback,l=i.disconnectedCallback;i.connectedCallback=function(){n.set(i,t.detail);if(o){o.call(i)}};i.disconnectedCallback=function(){n.delete(i);if(l){l.call(i)}}}n.set(i,t.detail);p(t.detail,r.state);s===null||s===void 0?void 0:s.resolve((function(){n.delete(i)}))}));s.addEventListener("closeWormhole",(function(t){var e=t.detail;n.delete(e)}))},Provider:function(t,i){var s=t.state;var n=e();if(d.has(n)){var r=d.get(n);r.state=s;r.wormholes.forEach((function(t){p(t,s)}))}return i}};class g{constructor(){this.queue=[];this.workingOnPromise=false;this.stop=false;this.limit=null}enqueue(t){return new Promise(((e,i)=>{this.queue.push({promise:t,resolve:e,reject:i});this.dequeue()}))}dequeue(){if(this.workingOnPromise){return false}if(this.stop){this.queue=[];this.stop=false;return}const t=this.queue.shift();if(!t){return false}try{this.workingOnPromise=true;t.promise().then((e=>{this.workingOnPromise=false;t.resolve(e);this.dequeue()})).catch((e=>{this.workingOnPromise=false;t.reject(e);this.dequeue()}))}catch(e){this.workingOnPromise=false;t.reject(e);this.dequeue()}return true}}g.pendingPromise=false;function y(t,e){if(Object.setPrototypeOf){Object.setPrototypeOf(t,e)}else{t.__proto__=e}}function w(t){const e=new Error(t);y(e,w.prototype);return e}w.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:false}});function b(t,e,i){const s=e.slice(0,i).split(/\n/);const n=s.length;const r=s[n-1].length+1;t+=" at line "+n+" col "+r+":\n\n"+" "+e.split(/\n/)[n-1]+"\n"+" "+Array(r).join(" ")+"^";throw w(t)}const v=new Function("return this")().Promise;let x=false;try{x=new Function("return (async function(){}).constructor")()}catch(t){if(!(t instanceof SyntaxError)){throw t}}function F(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function C(t,e,i){for(const s in e){if(F(e,s)){if(e[s]!=null&&typeof e[s]=="object"&&(s==="storage"||s==="prefixes")&&!i){t[s]=C({},e[s])}else{t[s]=e[s]}}}return t}function I(t,e,i,s){let n;let r;if(typeof e.autoTrim==="string"){n=r=e.autoTrim}else if(Array.isArray(e.autoTrim)){n=e.autoTrim[1];r=e.autoTrim[0]}if(i||i===false){n=i}if(s||s===false){r=s}if(n==="slurp"&&r==="slurp"){return t.trim()}if(n==="_"||n==="slurp"){if(!!String.prototype.trimLeft){t=t.trimLeft()}else{t=t.replace(/^[\s\uFEFF\xA0]+/,"")}}else if(n==="-"||n==="nl"){t=t.replace(/^(?:\n|\r|\r\n)/,"")}if(r==="_"||r==="slurp"){if(!!String.prototype.trimRight){t=t.trimRight()}else{t=t.replace(/[\s\uFEFF\xA0]+$/,"")}}else if(r==="-"||r==="nl"){t=t.replace(/(?:\n|\r|\r\n)$/,"")}return t}const S=/^async +/;const j=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g;const z=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g;const A=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;const R=/[.*+\-?^${}()|[\]\\]/g;function _(t){return R.test(t)?t.replace(R,"\\$&"):t}function k(t,e){if(e.rmWhitespace){t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")}j.lastIndex=0;z.lastIndex=0;A.lastIndex=0;const i=e.prefixes;const s=[i.h,i.b,i.i,i.r,i.c,i.e].reduce((function(t,e){if(t&&e){return t+"|"+_(e)}else if(e){return _(e)}else{return t}}),"");const n=new RegExp("([|()]|=>)|"+"('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+_(e.tags[1])+")","g");const r=new RegExp("([^]*?)"+_(e.tags[0])+"(-|_)?\\s*("+s+")?\\s*","g");let o=0;let l=false;function h(i,s){const h={f:[]};let a=0;let c="c";if(s==="h"||s==="b"||s==="c"){c="n"}else if(s==="r"){h.raw=true;s="i"}function f(i){const s=t.slice(o,i);let n=s.trim();if(c==="f"){if(n==="safe"){h.raw=true}else{if(e.async&&S.test(n)){n=n.replace(S,"");h.f.push([n,"",true])}else{h.f.push([n,""])}}}else if(c==="fp"){h.f[h.f.length-1][1]+=n}else if(c==="err"){if(n){const e=s.search(/\S/);b("invalid syntax",t,o+e)}}else{h[c]=n}o=i+1}n.lastIndex=o;let u;while((u=n.exec(t))!==null){const e=u[1];const i=u[2];const d=u[3];const p=u[4];const m=u[5];const g=u.index;if(e){if(e==="("){if(a===0){if(c==="n"){f(g);c="p"}else if(c==="f"){f(g);c="fp"}}a++}else if(e===")"){a--;if(a===0&&c!=="c"){f(g);c="err"}}else if(a===0&&e==="|"){f(g);c="f"}else if(e==="=>"){f(g);o+=1;c="res"}}else if(i){if(i==="/*"){const e=t.indexOf("*/",n.lastIndex);if(e===-1){b("unclosed comment",t,u.index)}n.lastIndex=e+2}else if(i==="'"){z.lastIndex=u.index;const e=z.exec(t);if(e){n.lastIndex=z.lastIndex}else{b("unclosed string",t,u.index)}}else if(i==='"'){A.lastIndex=u.index;const e=A.exec(t);if(e){n.lastIndex=A.lastIndex}else{b("unclosed string",t,u.index)}}else if(i==="`"){j.lastIndex=u.index;const e=j.exec(t);if(e){n.lastIndex=j.lastIndex}else{b("unclosed string",t,u.index)}}}else if(d){f(g);o=g+u[0].length;r.lastIndex=o;l=m;if(p&&s==="h"){s="s"}h.t=s;return h}}b("unclosed tag",t,i);return h}function a(s,n){s.b=[];s.d=[];let c=false;let f=[];function u(t,i){if(t){t=I(t,e,l,i);if(t){t=t.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n");f.push(t)}}}let d;while((d=r.exec(t))!==null){const n=d[1];const r=d[2];const l=d[3]||"";let p;for(const t in i){if(i[t]===l){p=t;break}}u(n,r);o=d.index+d[0].length;if(!p){b("unrecognized tag type: "+l,t,o)}let m=h(d.index,p);const g=m.t;if(g==="h"){const t=m.n||"";if(e.async&&S.test(t)){m.a=true;m.n=t.replace(S,"")}m=a(m);f.push(m)}else if(g==="c"){if(s.n===m.n){if(c){c.d=f;s.b.push(c)}else{s.d=f}return s}else{b("Helper start and end don't match",t,d.index+d[0].length)}}else if(g==="b"){if(c){c.d=f;s.b.push(c)}else{s.d=f}const t=m.n||"";if(e.async&&S.test(t)){m.a=true;m.n=t.replace(S,"")}c=m;f=[]}else if(g==="s"){const t=m.n||"";if(e.async&&S.test(t)){m.a=true;m.n=t.replace(S,"")}f.push(m)}else{f.push(m)}}if(n){u(t.slice(o,t.length),false);s.d=f}else{throw w('unclosed helper "'+s.n+'"')}return s}const c=a({f:[]},true);if(e.plugins){for(let t=0;t<e.plugins.length;t++){const i=e.plugins[t];if(i.processAST){c.d=i.processAST(c.d,e)}}}return c.d}function T(t,e){const i=k(t,e);let s="var tR='';"+(e.useWith?"with("+e.varName+"||{}){":"")+q(i,e)+"if(cb){cb(null,tR)} return tR"+(e.useWith?"}":"");if(e.plugins){for(let t=0;t<e.plugins.length;t++){const i=e.plugins[t];if(i.processFnString){s=i.processFnString(s,e)}}}return s}function P(t,e){for(let i=0;i<e.length;i++){const s=e[i][0];const n=e[i][1];const r=e[i][2];t=(r?"await ":"")+"c.l('F','"+s+"')("+t;if(n){t+=","+n}t+=")"}return t}function O(t,e,i,s,n,r){let o="{exec:"+(n?"async ":"")+N(i,e,t)+",params:["+s+"]";if(r){o+=",name:'"+r+"'"}if(n){o+=",async:true"}o+="}";return o}function E(t,e){let i="[";for(let s=0;s<t.length;s++){const n=t[s];i+=O(e,n.res||"",n.d,n.p||"",n.a,n.n);if(s<t.length){i+=","}}i+="]";return i}function N(t,e,i){return"function("+e+"){var tR='';"+q(t,i)+"return tR}"}function q(t,e){let i=0;const s=t.length;let n="";for(i;i<s;i++){const s=t[i];if(typeof s==="string"){const t=s;n+="tR+='"+t+"';"}else{const t=s.t;let i=s.c||"";const r=s.f;const o=s.n||"";const l=s.p||"";const h=s.res||"";const a=s.b;const c=!!s.a;if(t==="i"){if(e.defaultFilter){i="c.l('F','"+e.defaultFilter+"')("+i+")"}let t=P(i,r);if(!s.raw&&e.autoEscape){t="c.l('F','e')("+t+")"}n+="tR+="+t+";"}else if(t==="h"){if(e.storage.nativeHelpers.get(o)){n+=e.storage.nativeHelpers.get(o)(s,e)}else{let t=(c?"await ":"")+"c.l('H','"+o+"')("+O(e,h,s.d,l,c);if(a){t+=","+E(a,e)}else{t+=",[]"}t+=",c)";n+="tR+="+P(t,r)+";"}}else if(t==="s"){n+="tR+="+P((c?"await ":"")+"c.l('H','"+o+"')({params:["+l+"]},[],c)",r)+";"}else if(t==="e"){n+=i+"\n"}}}return n}class H{constructor(t){this.cache=t}define(t,e){this.cache[t]=e}get(t){return this.cache[t]}remove(t){delete this.cache[t]}reset(){this.cache={}}load(t){C(this.cache,t,true)}}function L(t,e,i,s){if(e&&e.length>0){throw w((s?"Native":"")+"Helper '"+t+"' doesn't accept blocks")}if(i&&i.length>0){throw w((s?"Native":"")+"Helper '"+t+"' doesn't accept filters")}}function $(t,e,i,s,n){i(t[e],e).then((function(r){s+=r;if(e===t.length-1){n(s)}else{$(t,e+1,i,s,n)}}))}function D(t,e,i,s,n,r){s(e[i],t[e[i]]).then((function(o){n+=o;if(i===e.length-1){r(n)}else{D(t,e,i+1,s,n,r)}}))}const M={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function W(t){return M[t]}function U(t){const e=String(t);if(/[&<>"']/.test(e)){return e.replace(/[&<>"']/g,W)}else{return e}}const B=new H({});const K=new H({each:function(t,e){let i="";const s=t.params[0];L("each",e,false);if(t.async){return new Promise((function(e){$(s,0,t.exec,i,e)}))}else{for(let e=0;e<s.length;e++){i+=t.exec(s[e],e)}return i}},foreach:function(t,e){const i=t.params[0];L("foreach",e,false);if(t.async){return new Promise((function(e){D(i,Object.keys(i),0,t.exec,"",e)}))}else{let e="";for(const s in i){if(!F(i,s))continue;e+=t.exec(s,i[s])}return e}},include:function(t,e,i){L("include",e,false);const s=i.storage.templates.get(t.params[0]);if(!s){throw w('Could not fetch template "'+t.params[0]+'"')}return s(t.params[1],i)},extends:function(t,e,i){const s=t.params[1]||{};s.content=t.exec();for(let t=0;t<e.length;t++){const i=e[t];s[i.name]=i.exec()}const n=i.storage.templates.get(t.params[0]);if(!n){throw w('Could not fetch template "'+t.params[0]+'"')}return n(s,i)},useScope:function(t,e){L("useScope",e,false);return t.exec(t.params[0])}});const Q=new H({if:function(t,e){L("if",false,t.f,true);let i="if("+t.p+"){"+q(t.d,e)+"}";if(t.b){for(let s=0;s<t.b.length;s++){const n=t.b[s];if(n.n==="else"){i+="else{"+q(n.d,e)+"}"}else if(n.n==="elif"){i+="else if("+n.p+"){"+q(n.d,e)+"}"}}}return i},try:function(t,e){L("try",false,t.f,true);if(!t.b||t.b.length!==1||t.b[0].n!=="catch"){throw w("native helper 'try' only accepts 1 block, 'catch'")}let i="try{"+q(t.d,e)+"}";const s=t.b[0];i+="catch"+(s.res?"("+s.res+")":"")+"{"+q(s.d,e)+"}";return i},block:function(t,e){L("block",t.b,t.f,true);const i="if(!"+e.varName+"["+t.p+"]){tR+=("+N(t.d,"",e)+")()}else{tR+="+e.varName+"["+t.p+"]}";return i}});const G=new H({e:U});const J={varName:"it",autoTrim:[false,"nl"],autoEscape:true,defaultFilter:false,tags:["{{","}}"],l:function(t,e){if(t==="H"){const t=this.storage.helpers.get(e);if(t){return t}else{throw w("Can't find helper '"+e+"'")}}else if(t==="F"){const t=this.storage.filters.get(e);if(t){return t}else{throw w("Can't find filter '"+e+"'")}}},async:false,storage:{helpers:K,nativeHelpers:Q,filters:G,templates:B},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:false,plugins:[],useWith:false};J.l.bind(J);function V(t,e){const i={};C(i,J);if(e){C(i,e)}if(t){C(i,t)}i.l.bind(i);return i}function X(t,e){const i=V(e||{});let s=Function;if(i.async){if(x){s=x}else{throw w("This environment doesn't support async/await")}}try{return new s(i.varName,"c","cb",T(t,i))}catch(e){if(e instanceof SyntaxError){throw w("Bad template syntax\n\n"+e.message+"\n"+Array(e.message.length+1).join("=")+"\n"+T(t,i))}else{throw e}}}function Y(t,e){let i;if(e.cache&&e.name&&e.storage.templates.get(e.name)){return e.storage.templates.get(e.name)}if(typeof t==="function"){i=t}else{i=X(t,e)}if(e.cache&&e.name){e.storage.templates.define(e.name,i)}return i}function Z(t,e,i,s){const n=V(i||{});if(n.async){let i;if(!s){if(typeof v==="function"){return new v((function(s,r){try{i=Y(t,n)(e,n);s(i)}catch(t){r(t)}}))}else{throw w("Please provide a callback function, this env doesn't support Promises")}}else{try{Y(t,n)(e,n,s)}catch(t){return s(t)}}}else{return Y(t,n)(e,n)}}const tt=Object.freeze({__proto__:null,compileToString:T,compileScope:q,compileScopeIntoFunction:N,compile:X,parse:k,render:Z,helpers:K,nativeHelpers:Q,filters:G,templates:B,defaultConfig:J,getConfig:V});G.define("date_long",((t,e={year:"numeric",month:"long",day:"numeric"})=>{if(!t)return;const i=new Date(parseInt(t)*1e3);t=i.toLocaleDateString("en-GB",e);return t}));G.define("date_short",((t,e="d/m/y")=>{if(!t)return;const i=new Date(parseInt(t)*1e3);t=e.replace(/(d)/,i.getDate().toString());t=t.replace(/(m)/,(i.getMonth()+1).toString());t=t.replace(/(y)/,i.getFullYear().toString());return t}));G.define("public_name",(t=>{if(!t)return;t=t.split("_").map((t=>t.length<3?t.toUpperCase():t)).join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}));G.define("trim_to",((t,e=100)=>{if(!t)return;if(t.length<=e)return t;return t.substr(0,e)+"..."}));G.define("classname",(t=>{if(!t)return;return t.replace(/[\W]+/g,"")}));G.define("abs_url",((t,e=null,i)=>{if(!e)return t;if(!t)return;let s=undefined;if(e.domains&&i&&i.origin){const t=e.domains.find((t=>t.origin===i.origin));s=t?t.domain:""}else if(e.domain)s=e.domain;if(t.match(/^http/)||!s)return t;if(!t.startsWith("/"))t="/"+t;return location.protocol+"//"+s+t}));G.define("replace",((t,e,i)=>t.replace(e,i)));G.define("remove_spaces",(t=>t.replace(/ /g,"_")));G.define("add_spaces",(t=>t=t.replace(/[_\-]/g," ")));G.define("capitalise",(t=>t=t.charAt(0).toUpperCase()+t.slice(1)));G.define("lowercase",(t=>t=t.toLowerCase()));const et=tt;const it=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{position:relative;display:block}:host ::slotted([slot=search-template]){display:none !important}.loader{opacity:0;position:fixed;block-size:100%;inline-size:100%;min-block-size:100%;max-block-size:100vh !important;max-inline-size:100vw !important;inset-inline-start:0;inset-block-start:0;z-index:-10;font-size:60px;display:flex;align-items:center;justify-content:center;transition:opacity 0.2s ease, z-index 0.01s ease 0.2s}.loader.loading{opacity:1;z-index:10;transition:z-index 0.01s ease, opacity 0.2s ease 0.01s}.default{block-size:100%}.default:focus{outline:none}.results{opacity:0;outline:none;overflow:auto;transition:transform 0.3s ease, opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s;transform:translate(0, 100px);visibility:hidden;z-index:-1;position:absolute;inset-block-start:0;inset-inline-start:0;display:none}.results-container{position:relative}.results.show{transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.3s ease 0.01s, opacity 0.3s ease 0.01s, overflow 0.01s ease 0.31s;transform:translate(0, 0);visibility:visible;opacity:1;z-index:10;overflow:hidden}.results.shown{block-size:auto !important;inline-size:auto !important;display:block;position:static;transform:none;z-index:auto;visibility:inherit;opacity:initial;overflow:visible}";const st=class{constructor(t){i(this,t);this.nanoDidLoad=s(this,"nanoDidLoad",7);this.nanoResultsShown=s(this,"nanoResultsShown",3);this.nanoBeforeQuery=s(this,"nanoBeforeQuery",7);this.nanoAfterQuery=s(this,"nanoAfterQuery",7);this.nanoNewResults=s(this,"nanoNewResults",7);this.staticFacetFilters={};this.dynFacetFilters={};this.hasLoadSlot=false;this.placedAlgoliaEles=[];this.promiseQueue=new g;this.searchChange=async()=>{if(!this.algoliaIndex)return;if(!this.query||this.query.length<this.minChars){if(!this.browseIndex){if(!this.query||this.query.length===0){this.handleSearchReset();return}else return}else if(this.query!=="*"){this.query="*";return}}this.isLoading=true;setTimeout((async()=>{this.resetPage();await this.algoliaSearch(u.Init);await this.updateContent();setTimeout((t=>this.isLoading=false),800);this.showResults=true;this.nanoResultsShown.emit({meta:this.indexResults,client:{appId:this.appId,apiKey:this.apiKey}})}),200)};this.makeAppliedFilters=()=>{const t=[];const e=e=>{Object.values(e).forEach((e=>{if(e.value&&e.value.length){const i=t.find((t=>t.name===e.facetName));if(!i)t.push({name:e.facetName,values:[...e.value]});else i.values=[...i.values,...e.value]}}))};e(this.dynFacetFilters);e(this.staticFacetFilters);if(t.length)return t;return null};this.algoliaSearch=async t=>this.promiseQueue.enqueue((()=>this.queueSearch(t)));this.queueSearch=async t=>{if(!this.algoliaIndex||!this.query||!this.searchIndex||!this.searchIndex.index)return;this.nanoBeforeQuery.emit(this.indexResults);if(u.Init===t)this.clearAllFacetFilters();const e={filters:this.algoliaFilterStr(),page:this.indexResults?this.indexResults.currentPage:0,clickAnalytics:true};if(this.searchIndex.filters)e.facets=this.searchIndex.filters;if(this.searchIndex.hitsPerPage)e.hitsPerPage=this.searchIndex.hitsPerPage;let i=await this.algoliaIndex.search(this.query,e);i=this.fixDomain(i);this.changeEvent=t;if(t===u.Init||!this.indexResults){this.indexResults={queryID:i.queryID,currentPage:0,totalHits:i.nbHits,hitsPerPage:null,origFilters:i.facets,query:this.query,domain:this.searchIndex.domain||null,totalHitsWithFilters:0,results:[],totalPages:0,appliedFilters:this.makeAppliedFilters(),indexName:this.searchIndex.name||null,index:this.searchIndex.index,searchIndex:this.searchIndex}}this.indexResults.dynFilters=i.facets;this.indexResults.results=i.hits;this.indexResults.totalHitsWithFilters=i.nbHits;this.indexResults.currentPage=i.page;this.indexResults.totalPages=i.nbPages;this.indexResults.hitsPerPage=i.hitsPerPage;this.indexResults.query=i.query;if(this.changeEvent!==u.Page&&this.changeEvent!==u.Replica){this.facets=i.facets}this.nanoAfterQuery.emit(this.indexResults);return new Promise((t=>{setTimeout((()=>t("tpl updated")),20)})).then((t=>{this.currentHits=this.indexResults.results;this.resultsPage=this.indexResults.currentPage}))};this.handleSearchReset=()=>{this.showResults=false;this.indexResults=null};this.onResultDisplay=()=>{n((()=>{this.resultsDiv.removeEventListener("transitionend",this.onResultDisplay);if(!this.showResults)this.resultsDiv.style.display="none";else{this.defaultDiv.style.display="none";this.resultsDiv.classList.add("shown");this.resultsDiv.style.minHeight="";this.resultsDiv.style.width=""}}))};this._dynFacetFilters={};this.inputField=undefined;this.algoliaIndex=undefined;this.indeces=[];this.indexResults=undefined;this.filterChanged="";this.currentHits=undefined;this.changeEvent=u.Init;this.isLoading=false;this.wormholeState=this;this.showResults=false;this.resultsPage=0;this.appId=undefined;this.apiKey=undefined;this.searchIndex={};this.searchIndexName="";this.listenTo=null;this.query="";this.operator="and";this.filters=[];this.tplRenderFn=et.render;this.replicaIndex="";this.browseIndex=false;this.minChars=2;this.storeId=undefined;this.storeMethod="session"}handleListenToChange(){if(!this.listenTo)return;const t=document.querySelector(this.listenTo);if(["nano-input","input"].includes(t.tagName.toLocaleLowerCase())){this.inputField=t}}async removeFilters(t,e){if(!t&&!e)this.clearAllFacetFilters();else{Object.keys(this._dynFacetFilters).forEach((i=>{if(t&&this._dynFacetFilters[i].facetName===t){if(!e)this._dynFacetFilters[i].element.value="";else{this._dynFacetFilters[i].element.value=this._dynFacetFilters[i].value.filter((t=>t!==e))}}}))}}onAllTplUpdate(t){t.stopPropagation();if(t.target.tagName==="NANO-ALGOLIA-RESULTS"){requestAnimationFrame((()=>{this.nanoNewResults.emit(this.indexResults)}))}}async onPageChange(t){if(!this.indexResults)return;let e=this.resultsPage;if(t){t.stopPropagation();e=t.detail.page}e=Math.min(this.indexResults.totalPages-1,e);e=Math.max(e,0);if(this.indexResults.currentPage===e)return;this.indexResults.currentPage=e;await this.algoliaSearch(u.Page)}async onFilterChange(t){t.stopPropagation();const e={};const i=t.detail;i.element=t.target;if(this.indexResults){if(this.staticFacetFilters[i.filterId])this.staticFacetFilters[i.filterId]=i;else{e[i.filterId]=i;this._dynFacetFilters={...this._dynFacetFilters,...e}}this.indexResults.appliedFilters=this.makeAppliedFilters()}else this.staticFacetFilters[i.filterId]=i;this.filterChanged=i.value&&i.value.length?i.filterId:"all";this.resetPage();this.algoliaSearch(u.Filter)}dynFacetFiltersChange(){Object.values(this._dynFacetFilters).forEach((t=>{if(this.host.ownerDocument===t.element.ownerDocument)this.dynFacetFilters[t.filterId]=t;else delete this.dynFacetFilters[t.filterId]}))}browseIndexChange(){if(this.browseIndex&&(!this.query||this.query.length<this.minChars)){this.query="*"}}inputFieldSet(){if(!this.inputField)return;if(this.query!=="*"&&this.inputField&&this.inputField.value!==this.query)this.inputField.value=this.query}queryChange(){this.searchChange()}async internalIndexSwitch(){if(!this.replicaIndex||!this.indexResults||this.indexResults.index===this.replicaIndex)return;this.indexResults.index=this.replicaIndex;this.algoliaIndex=this.algoliaClient.initIndex(this.indexResults.index);this.resetPage();this.algoliaSearch(u.Replica)}pageChange(){this.onPageChange()}searchIndexNameChange(){if(!this.searchIndexName||!this.searchIndexName.length||this.searchIndex&&this.searchIndex.index===this.searchIndexName)return;this.searchIndex={index:this.searchIndexName}}initAlgoliaClient(){if(!this.appId||!this.apiKey)return;this.algoliaClient=h(this.appId,this.apiKey)}initAlgoliaIndex(){if(!this.algoliaClient||!this.searchIndex)return;if(this.searchIndex.index){if(!this.searchIndex.hitsPerPage)this.searchIndex.hitsPerPage=100;if(this.replicaIndex)this.searchIndex.index=this.replicaIndex;this.searchIndexName=this.searchIndex.index;this.algoliaIndex=this.algoliaClient.initIndex(this.searchIndex.index);this.searchChange()}}showResultsChange(){if(!this.resultsDiv||!this.defaultDiv)return;if(this.showResults){this.resultsDiv.style.width=this.host.scrollWidth+"px";this.resultsDiv.style.minHeight=this.host.scrollHeight+"px";n((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.style.display="block";setTimeout((()=>this.resultsDiv.classList.add("show")),50)}))}else{n((()=>{this.resultsDiv.classList.remove("shown");this.defaultDiv.style.display="block";setTimeout((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.classList.remove("show");if(!!this.slottedInput)this.slottedInput.focus({preventScroll:true});else this.defaultDiv.focus({preventScroll:true})}),50)}))}}handleFilterpropChange(){this.algoliaSearch(u.Init)}fixDomain(t){if(!this.searchIndex||!this.searchIndex.domain)return t;t.hits.map((t=>{if(t.url&&!t.url.match(/^http/))t.url=location.protocol+"//"+this.searchIndex.domain+t.url}));return t}resetPage(){if(!this.indexResults)return;this.indexResults.currentPage=0}clearAllFacetFilters(){Object.values(this._dynFacetFilters).forEach((t=>{t.element.value=""}));this._dynFacetFilters={}}algoliaFilterStr(){const t={};const e=e=>{let i;let s;Object.keys(e).forEach((n=>{i=e[n];t[n]=t[n]||{name:i.facetName,or:[],and:[],not:[]};s=t[n][i.operator];if(i.value&&i.value.length){t[n][i.operator]=[...s,...i.value]}}))};e(this.dynFacetFilters);e(this.staticFacetFilters);const i=(t,e)=>{if(e.indexOf(" ")>-1)return t+':"'+e+'"';else return t+":"+e};let s=[];let n;let r;Object.values(t).forEach((function(t){Object.keys(t).filter((t=>t.match(/(or|and|not)/))).forEach((e=>{n=t;r=t.name;if(e==="or"||e==="and"){if(n[e].length){s.push("( "+n[e].map((t=>{if(t.length)return i(r,t)})).join(" "+e.toLocaleUpperCase()+" ")+" )")}}else{if(n.not.length){s.push("( "+n[e].map((t=>{if(t.length)return"NOT "+i(r,t)})).join(" AND ")+" )")}}}))}));s=[...this.filters,...s];return s.join(" "+this.operator.toLocaleUpperCase()+" ")}handleInputChange(t){if(t.target!==this.inputField)return;this.query=this.inputField.value}async updateContent(){return this.promiseQueue.enqueue((()=>this.updateContentQueue()))}async updateContentQueue(){const t=this.outputSlot||this.resultsDiv;if(!t||!this.tpl)return"no tpl";const e=document.createElement("div");e.innerHTML=this.tpl;const i=[];this.placedAlgoliaEles=[];Array.from(e.querySelectorAll("nano-algolia, nano-algolia-filter, nano-algolia-results")).forEach(((t,e)=>{const s=document.createElement("div");s.dataset.placeholderId=e.toString();s.classList.add("nano-ele-placeholder");i.push(t);t.parentNode.replaceChild(s,t)}));t.innerHTML=this.tplRenderFn(e.innerHTML.replace(/&gt;/gm,">").replace(/&lt;/gm,"<").replace(/&amp;/gm,"&"),this.indexResults);Array.from(t.querySelectorAll("div.nano-ele-placeholder")).forEach((t=>{t.parentNode.replaceChild(i[parseInt(t.dataset.placeholderId)],t);this.placedAlgoliaEles.push(i[parseInt(t.dataset.placeholderId)])}));if(!this.placedAlgoliaEles.length)return Promise.resolve("algolia setup");return new Promise((e=>{const i=s=>{this.placedAlgoliaEles=this.placedAlgoliaEles.filter((t=>t!==s.detail));if(!this.placedAlgoliaEles.length){setTimeout((()=>e("tpl updated")),500);t.removeEventListener("nanoTplUpdated",i)}};t.addEventListener("nanoTplUpdated",i)}))}componentWillLoad(){r((t=>{this.tplSlot=a(this.host,'[slot="template"]')[0];this.outputSlot=a(this.host,'[slot="output"]')[0];this.slottedInput=a(this.host,'[slot="search-input"]')[0];this.hasLoadSlot=!!a(this.host,'[slot="loader"]')[0];if(!!this.tplSlot)this.tpl=this.tplSlot.innerHTML||this.tplSlot.innerText;if(this.slottedInput&&(this.slottedInput.tagName.toLocaleLowerCase()==="nano-input"||this.slottedInput instanceof HTMLInputElement)){this.inputField=this.slottedInput}else if(this.slottedInput){this.inputField=this.slottedInput.querySelector('nano-input, input:not([type="radio"]):not([type="checkbox"])')}else this.handleListenToChange();n((t=>{if(this.showResults&&this.tpl)this.searchChange()}))}));this.searchIndexNameChange();this.initAlgoliaClient();this.initAlgoliaIndex();m.create(this,this.wormholeState);if(this.storeId){c.init(this,["query","replicaIndex"],this.storeMethod,this.storeId);c.init(this,["apiKey","appId","searchIndex"],"session",this.storeId+"_api")}this.internalIndexSwitch()}connectedCallback(){this.searchChange=f(this.searchChange,300);this.browseIndexChange();this.host.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.host}))}render(){const t={indexResults:this.indexResults,results:this.currentHits,filterChanged:this.filterChanged,tplRenderFn:this.tplRenderFn,resultsPage:this.resultsPage,changeEvent:this.changeEvent,facets:this.facets,algoliaIndex:this.algoliaIndex,searchIndex:this.searchIndex,globalStoreMethod:this.storeMethod,isLoading:this.isLoading};return o(l,{class:{"show-results":this.showResults,"is-loading":this.isLoading},"aria-busy":this.isLoading},this.hasLoadSlot&&o("div",{hidden:!this.isLoading},o("slot",{name:"loader"})),!this.hasLoadSlot&&o("div",{class:{loader:true,loading:this.isLoading}},o("nano-spinner",{overlay:true,type:"circle"})),o(m.Provider,{state:t},o("slot",{name:"search-input"}),o("div",{class:"results-container","aria-live":"polite"},o("div",{ref:t=>this.resultsDiv=t,class:"results"},o("slot",{name:"output"})))),o("div",{ref:t=>this.defaultDiv=t,class:"default",tabindex:"-1"},o("slot",null)))}get host(){return t(this)}static get watchers(){return{listenTo:["handleListenToChange"],_dynFacetFilters:["dynFacetFiltersChange"],browseIndex:["browseIndexChange"],inputField:["inputFieldSet"],query:["queryChange"],replicaIndex:["internalIndexSwitch"],resultsPage:["pageChange"],searchIndexName:["searchIndexNameChange"],apiKey:["initAlgoliaClient"],appId:["initAlgoliaClient"],searchIndex:["initAlgoliaIndex"],showResults:["showResultsChange"],filters:["handleFilterpropChange"]}}};st.style=it;export{st as nano_algolia};
4
+ import{g as t,e,r as i,c as s,w as n,d as r,h as o,a as l}from"./index-9695db0a.js";import{a as h}from"./algoliasearch-lite.esm.browser-d71a28dc.js";import{g as a}from"./dom-8599fac1.js";import{C as c}from"./component-store-64043183.js";import{d as f}from"./throttle-ac4fcefa.js";import{S as u}from"./algolia-data-1b42827c.js";var d=new Map;var p=function(t,e){var i=t.fields,s=t.updater;i.forEach((function(t){s(t,e[t])}))};var m={create:function(e,i){var s=t(e);var n=new Map;var r={wormholes:n,state:i};d.set(e,r);var o=e.connectedCallback;e.connectedCallback=function(){d.set(e,r);if(o){o.call(e)}};var l=e.disconnectedCallback;e.disconnectedCallback=function(){d.delete(e);if(l){l.call(e)}};s.addEventListener("openWormhole",(function(t){t.stopPropagation();var e=t.detail,i=e.consumer,s=e.onOpen;if(n.has(i))return;if(typeof i!=="symbol"){var o=i.connectedCallback,l=i.disconnectedCallback;i.connectedCallback=function(){n.set(i,t.detail);if(o){o.call(i)}};i.disconnectedCallback=function(){n.delete(i);if(l){l.call(i)}}}n.set(i,t.detail);p(t.detail,r.state);s===null||s===void 0?void 0:s.resolve((function(){n.delete(i)}))}));s.addEventListener("closeWormhole",(function(t){var e=t.detail;n.delete(e)}))},Provider:function(t,i){var s=t.state;var n=e();if(d.has(n)){var r=d.get(n);r.state=s;r.wormholes.forEach((function(t){p(t,s)}))}return i}};class g{constructor(){this.queue=[];this.workingOnPromise=false;this.stop=false;this.limit=null}enqueue(t){return new Promise(((e,i)=>{this.queue.push({promise:t,resolve:e,reject:i});this.dequeue()}))}dequeue(){if(this.workingOnPromise){return false}if(this.stop){this.queue=[];this.stop=false;return}const t=this.queue.shift();if(!t){return false}try{this.workingOnPromise=true;t.promise().then((e=>{this.workingOnPromise=false;t.resolve(e);this.dequeue()})).catch((e=>{this.workingOnPromise=false;t.reject(e);this.dequeue()}))}catch(e){this.workingOnPromise=false;t.reject(e);this.dequeue()}return true}}g.pendingPromise=false;function y(t,e){if(Object.setPrototypeOf){Object.setPrototypeOf(t,e)}else{t.__proto__=e}}function w(t){const e=new Error(t);y(e,w.prototype);return e}w.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:false}});function b(t,e,i){const s=e.slice(0,i).split(/\n/);const n=s.length;const r=s[n-1].length+1;t+=" at line "+n+" col "+r+":\n\n"+" "+e.split(/\n/)[n-1]+"\n"+" "+Array(r).join(" ")+"^";throw w(t)}const v=new Function("return this")().Promise;let x=false;try{x=new Function("return (async function(){}).constructor")()}catch(t){if(!(t instanceof SyntaxError)){throw t}}function F(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function C(t,e,i){for(const s in e){if(F(e,s)){if(e[s]!=null&&typeof e[s]=="object"&&(s==="storage"||s==="prefixes")&&!i){t[s]=C({},e[s])}else{t[s]=e[s]}}}return t}function I(t,e,i,s){let n;let r;if(typeof e.autoTrim==="string"){n=r=e.autoTrim}else if(Array.isArray(e.autoTrim)){n=e.autoTrim[1];r=e.autoTrim[0]}if(i||i===false){n=i}if(s||s===false){r=s}if(n==="slurp"&&r==="slurp"){return t.trim()}if(n==="_"||n==="slurp"){if(!!String.prototype.trimLeft){t=t.trimLeft()}else{t=t.replace(/^[\s\uFEFF\xA0]+/,"")}}else if(n==="-"||n==="nl"){t=t.replace(/^(?:\n|\r|\r\n)/,"")}if(r==="_"||r==="slurp"){if(!!String.prototype.trimRight){t=t.trimRight()}else{t=t.replace(/[\s\uFEFF\xA0]+$/,"")}}else if(r==="-"||r==="nl"){t=t.replace(/(?:\n|\r|\r\n)$/,"")}return t}const S=/^async +/;const j=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g;const z=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g;const A=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;const R=/[.*+\-?^${}()|[\]\\]/g;function _(t){return R.test(t)?t.replace(R,"\\$&"):t}function k(t,e){if(e.rmWhitespace){t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")}j.lastIndex=0;z.lastIndex=0;A.lastIndex=0;const i=e.prefixes;const s=[i.h,i.b,i.i,i.r,i.c,i.e].reduce((function(t,e){if(t&&e){return t+"|"+_(e)}else if(e){return _(e)}else{return t}}),"");const n=new RegExp("([|()]|=>)|"+"('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+_(e.tags[1])+")","g");const r=new RegExp("([^]*?)"+_(e.tags[0])+"(-|_)?\\s*("+s+")?\\s*","g");let o=0;let l=false;function h(i,s){const h={f:[]};let a=0;let c="c";if(s==="h"||s==="b"||s==="c"){c="n"}else if(s==="r"){h.raw=true;s="i"}function f(i){const s=t.slice(o,i);let n=s.trim();if(c==="f"){if(n==="safe"){h.raw=true}else{if(e.async&&S.test(n)){n=n.replace(S,"");h.f.push([n,"",true])}else{h.f.push([n,""])}}}else if(c==="fp"){h.f[h.f.length-1][1]+=n}else if(c==="err"){if(n){const e=s.search(/\S/);b("invalid syntax",t,o+e)}}else{h[c]=n}o=i+1}n.lastIndex=o;let u;while((u=n.exec(t))!==null){const e=u[1];const i=u[2];const d=u[3];const p=u[4];const m=u[5];const g=u.index;if(e){if(e==="("){if(a===0){if(c==="n"){f(g);c="p"}else if(c==="f"){f(g);c="fp"}}a++}else if(e===")"){a--;if(a===0&&c!=="c"){f(g);c="err"}}else if(a===0&&e==="|"){f(g);c="f"}else if(e==="=>"){f(g);o+=1;c="res"}}else if(i){if(i==="/*"){const e=t.indexOf("*/",n.lastIndex);if(e===-1){b("unclosed comment",t,u.index)}n.lastIndex=e+2}else if(i==="'"){z.lastIndex=u.index;const e=z.exec(t);if(e){n.lastIndex=z.lastIndex}else{b("unclosed string",t,u.index)}}else if(i==='"'){A.lastIndex=u.index;const e=A.exec(t);if(e){n.lastIndex=A.lastIndex}else{b("unclosed string",t,u.index)}}else if(i==="`"){j.lastIndex=u.index;const e=j.exec(t);if(e){n.lastIndex=j.lastIndex}else{b("unclosed string",t,u.index)}}}else if(d){f(g);o=g+u[0].length;r.lastIndex=o;l=m;if(p&&s==="h"){s="s"}h.t=s;return h}}b("unclosed tag",t,i);return h}function a(s,n){s.b=[];s.d=[];let c=false;let f=[];function u(t,i){if(t){t=I(t,e,l,i);if(t){t=t.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n");f.push(t)}}}let d;while((d=r.exec(t))!==null){const n=d[1];const r=d[2];const l=d[3]||"";let p;for(const t in i){if(i[t]===l){p=t;break}}u(n,r);o=d.index+d[0].length;if(!p){b("unrecognized tag type: "+l,t,o)}let m=h(d.index,p);const g=m.t;if(g==="h"){const t=m.n||"";if(e.async&&S.test(t)){m.a=true;m.n=t.replace(S,"")}m=a(m);f.push(m)}else if(g==="c"){if(s.n===m.n){if(c){c.d=f;s.b.push(c)}else{s.d=f}return s}else{b("Helper start and end don't match",t,d.index+d[0].length)}}else if(g==="b"){if(c){c.d=f;s.b.push(c)}else{s.d=f}const t=m.n||"";if(e.async&&S.test(t)){m.a=true;m.n=t.replace(S,"")}c=m;f=[]}else if(g==="s"){const t=m.n||"";if(e.async&&S.test(t)){m.a=true;m.n=t.replace(S,"")}f.push(m)}else{f.push(m)}}if(n){u(t.slice(o,t.length),false);s.d=f}else{throw w('unclosed helper "'+s.n+'"')}return s}const c=a({f:[]},true);if(e.plugins){for(let t=0;t<e.plugins.length;t++){const i=e.plugins[t];if(i.processAST){c.d=i.processAST(c.d,e)}}}return c.d}function T(t,e){const i=k(t,e);let s="var tR='';"+(e.useWith?"with("+e.varName+"||{}){":"")+q(i,e)+"if(cb){cb(null,tR)} return tR"+(e.useWith?"}":"");if(e.plugins){for(let t=0;t<e.plugins.length;t++){const i=e.plugins[t];if(i.processFnString){s=i.processFnString(s,e)}}}return s}function P(t,e){for(let i=0;i<e.length;i++){const s=e[i][0];const n=e[i][1];const r=e[i][2];t=(r?"await ":"")+"c.l('F','"+s+"')("+t;if(n){t+=","+n}t+=")"}return t}function O(t,e,i,s,n,r){let o="{exec:"+(n?"async ":"")+N(i,e,t)+",params:["+s+"]";if(r){o+=",name:'"+r+"'"}if(n){o+=",async:true"}o+="}";return o}function E(t,e){let i="[";for(let s=0;s<t.length;s++){const n=t[s];i+=O(e,n.res||"",n.d,n.p||"",n.a,n.n);if(s<t.length){i+=","}}i+="]";return i}function N(t,e,i){return"function("+e+"){var tR='';"+q(t,i)+"return tR}"}function q(t,e){let i=0;const s=t.length;let n="";for(i;i<s;i++){const s=t[i];if(typeof s==="string"){const t=s;n+="tR+='"+t+"';"}else{const t=s.t;let i=s.c||"";const r=s.f;const o=s.n||"";const l=s.p||"";const h=s.res||"";const a=s.b;const c=!!s.a;if(t==="i"){if(e.defaultFilter){i="c.l('F','"+e.defaultFilter+"')("+i+")"}let t=P(i,r);if(!s.raw&&e.autoEscape){t="c.l('F','e')("+t+")"}n+="tR+="+t+";"}else if(t==="h"){if(e.storage.nativeHelpers.get(o)){n+=e.storage.nativeHelpers.get(o)(s,e)}else{let t=(c?"await ":"")+"c.l('H','"+o+"')("+O(e,h,s.d,l,c);if(a){t+=","+E(a,e)}else{t+=",[]"}t+=",c)";n+="tR+="+P(t,r)+";"}}else if(t==="s"){n+="tR+="+P((c?"await ":"")+"c.l('H','"+o+"')({params:["+l+"]},[],c)",r)+";"}else if(t==="e"){n+=i+"\n"}}}return n}class H{constructor(t){this.cache=t}define(t,e){this.cache[t]=e}get(t){return this.cache[t]}remove(t){delete this.cache[t]}reset(){this.cache={}}load(t){C(this.cache,t,true)}}function L(t,e,i,s){if(e&&e.length>0){throw w((s?"Native":"")+"Helper '"+t+"' doesn't accept blocks")}if(i&&i.length>0){throw w((s?"Native":"")+"Helper '"+t+"' doesn't accept filters")}}function $(t,e,i,s,n){i(t[e],e).then((function(r){s+=r;if(e===t.length-1){n(s)}else{$(t,e+1,i,s,n)}}))}function D(t,e,i,s,n,r){s(e[i],t[e[i]]).then((function(o){n+=o;if(i===e.length-1){r(n)}else{D(t,e,i+1,s,n,r)}}))}const M={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function W(t){return M[t]}function U(t){const e=String(t);if(/[&<>"']/.test(e)){return e.replace(/[&<>"']/g,W)}else{return e}}const B=new H({});const K=new H({each:function(t,e){let i="";const s=t.params[0];L("each",e,false);if(t.async){return new Promise((function(e){$(s,0,t.exec,i,e)}))}else{for(let e=0;e<s.length;e++){i+=t.exec(s[e],e)}return i}},foreach:function(t,e){const i=t.params[0];L("foreach",e,false);if(t.async){return new Promise((function(e){D(i,Object.keys(i),0,t.exec,"",e)}))}else{let e="";for(const s in i){if(!F(i,s))continue;e+=t.exec(s,i[s])}return e}},include:function(t,e,i){L("include",e,false);const s=i.storage.templates.get(t.params[0]);if(!s){throw w('Could not fetch template "'+t.params[0]+'"')}return s(t.params[1],i)},extends:function(t,e,i){const s=t.params[1]||{};s.content=t.exec();for(let t=0;t<e.length;t++){const i=e[t];s[i.name]=i.exec()}const n=i.storage.templates.get(t.params[0]);if(!n){throw w('Could not fetch template "'+t.params[0]+'"')}return n(s,i)},useScope:function(t,e){L("useScope",e,false);return t.exec(t.params[0])}});const Q=new H({if:function(t,e){L("if",false,t.f,true);let i="if("+t.p+"){"+q(t.d,e)+"}";if(t.b){for(let s=0;s<t.b.length;s++){const n=t.b[s];if(n.n==="else"){i+="else{"+q(n.d,e)+"}"}else if(n.n==="elif"){i+="else if("+n.p+"){"+q(n.d,e)+"}"}}}return i},try:function(t,e){L("try",false,t.f,true);if(!t.b||t.b.length!==1||t.b[0].n!=="catch"){throw w("native helper 'try' only accepts 1 block, 'catch'")}let i="try{"+q(t.d,e)+"}";const s=t.b[0];i+="catch"+(s.res?"("+s.res+")":"")+"{"+q(s.d,e)+"}";return i},block:function(t,e){L("block",t.b,t.f,true);const i="if(!"+e.varName+"["+t.p+"]){tR+=("+N(t.d,"",e)+")()}else{tR+="+e.varName+"["+t.p+"]}";return i}});const G=new H({e:U});const J={varName:"it",autoTrim:[false,"nl"],autoEscape:true,defaultFilter:false,tags:["{{","}}"],l:function(t,e){if(t==="H"){const t=this.storage.helpers.get(e);if(t){return t}else{throw w("Can't find helper '"+e+"'")}}else if(t==="F"){const t=this.storage.filters.get(e);if(t){return t}else{throw w("Can't find filter '"+e+"'")}}},async:false,storage:{helpers:K,nativeHelpers:Q,filters:G,templates:B},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:false,plugins:[],useWith:false};J.l.bind(J);function V(t,e){const i={};C(i,J);if(e){C(i,e)}if(t){C(i,t)}i.l.bind(i);return i}function X(t,e){const i=V(e||{});let s=Function;if(i.async){if(x){s=x}else{throw w("This environment doesn't support async/await")}}try{return new s(i.varName,"c","cb",T(t,i))}catch(e){if(e instanceof SyntaxError){throw w("Bad template syntax\n\n"+e.message+"\n"+Array(e.message.length+1).join("=")+"\n"+T(t,i))}else{throw e}}}function Y(t,e){let i;if(e.cache&&e.name&&e.storage.templates.get(e.name)){return e.storage.templates.get(e.name)}if(typeof t==="function"){i=t}else{i=X(t,e)}if(e.cache&&e.name){e.storage.templates.define(e.name,i)}return i}function Z(t,e,i,s){const n=V(i||{});if(n.async){let i;if(!s){if(typeof v==="function"){return new v((function(s,r){try{i=Y(t,n)(e,n);s(i)}catch(t){r(t)}}))}else{throw w("Please provide a callback function, this env doesn't support Promises")}}else{try{Y(t,n)(e,n,s)}catch(t){return s(t)}}}else{return Y(t,n)(e,n)}}const tt=Object.freeze({__proto__:null,compileToString:T,compileScope:q,compileScopeIntoFunction:N,compile:X,parse:k,render:Z,helpers:K,nativeHelpers:Q,filters:G,templates:B,defaultConfig:J,getConfig:V});G.define("date_long",((t,e={year:"numeric",month:"long",day:"numeric"})=>{if(!t)return;const i=new Date(parseInt(t)*1e3);t=i.toLocaleDateString("en-GB",e);return t}));G.define("date_short",((t,e="d/m/y")=>{if(!t)return;const i=new Date(parseInt(t)*1e3);t=e.replace(/(d)/,i.getDate().toString());t=t.replace(/(m)/,(i.getMonth()+1).toString());t=t.replace(/(y)/,i.getFullYear().toString());return t}));G.define("public_name",(t=>{if(!t)return;t=t.split("_").map((t=>t.length<3?t.toUpperCase():t)).join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}));G.define("trim_to",((t,e=100)=>{if(!t)return;if(t.length<=e)return t;return t.substr(0,e)+"..."}));G.define("classname",(t=>{if(!t)return;return t.replace(/[\W]+/g,"")}));G.define("abs_url",((t,e=null,i)=>{if(!e)return t;if(!t)return;let s=undefined;if(e.domains&&i&&i.origin){const t=e.domains.find((t=>t.origin===i.origin));s=t?t.domain:""}else if(e.domain)s=e.domain;if(t.match(/^http/)||!s)return t;if(!t.startsWith("/"))t="/"+t;return location.protocol+"//"+s+t}));G.define("replace",((t,e,i)=>t.replace(e,i)));G.define("remove_spaces",(t=>t.replace(/ /g,"_")));G.define("add_spaces",(t=>t=t.replace(/[_\-]/g," ")));G.define("capitalise",(t=>t=t.charAt(0).toUpperCase()+t.slice(1)));G.define("lowercase",(t=>t=t.toLowerCase()));const et=tt;const it=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{position:relative;display:block}:host ::slotted([slot=search-template]){display:none !important}.loader{opacity:0;position:fixed;block-size:100%;inline-size:100%;min-block-size:100%;max-block-size:100vh !important;max-inline-size:100vw !important;inset-inline-start:0;inset-block-start:0;z-index:-10;font-size:60px;display:flex;align-items:center;justify-content:center;transition:opacity 0.2s ease, z-index 0.01s ease 0.2s}.loader.loading{opacity:1;z-index:10;transition:z-index 0.01s ease, opacity 0.2s ease 0.01s}.default{block-size:100%}.default:focus{outline:none}.results{opacity:0;outline:none;overflow:auto;transition:transform 0.3s ease, opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s;transform:translate(0, 100px);visibility:hidden;z-index:-1;position:absolute;inset-block-start:0;inset-inline-start:0;display:none}.results-container{position:relative}.results.show{transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.3s ease 0.01s, opacity 0.3s ease 0.01s, overflow 0.01s ease 0.31s;transform:translate(0, 0);visibility:visible;opacity:1;z-index:10;overflow:hidden}.results.shown{block-size:auto !important;inline-size:auto !important;display:block;position:static;transform:none;z-index:auto;visibility:inherit;opacity:initial;overflow:visible}";const st=class{constructor(t){i(this,t);this.nanoDidLoad=s(this,"nanoDidLoad",7);this.nanoResultsShown=s(this,"nanoResultsShown",3);this.nanoBeforeQuery=s(this,"nanoBeforeQuery",7);this.nanoAfterQuery=s(this,"nanoAfterQuery",7);this.nanoNewResults=s(this,"nanoNewResults",7);this.staticFacetFilters={};this.dynFacetFilters={};this.hasLoadSlot=false;this.placedAlgoliaEles=[];this.promiseQueue=new g;this.searchChange=async()=>{if(!this.algoliaIndex)return;if(!this.query||this.query.length<this.minChars){if(!this.browseIndex){if(!this.query||this.query.length===0){this.handleSearchReset();return}else return}else if(this.query!=="*"){this.query="*";return}}this.isLoading=true;setTimeout((async()=>{this.resetPage();await this.algoliaSearch(u.Init);await this.updateContent();setTimeout((t=>this.isLoading=false),800);this.showResults=true;this.nanoResultsShown.emit({meta:this.indexResults,client:{appId:this.appId,apiKey:this.apiKey}})}),200)};this.makeAppliedFilters=()=>{const t=[];const e=e=>{Object.values(e).forEach((e=>{if(e.value&&e.value.length){const i=t.find((t=>t.name===e.facetName));if(!i)t.push({name:e.facetName,values:[...e.value]});else i.values=[...i.values,...e.value]}}))};e(this.dynFacetFilters);e(this.staticFacetFilters);if(t.length)return t;return null};this.algoliaSearch=async t=>this.promiseQueue.enqueue((()=>this.queueSearch(t)));this.queueSearch=async t=>{if(!this.algoliaIndex||!this.query||!this.searchIndex||!this.searchIndex.index)return;this.nanoBeforeQuery.emit(this.indexResults);if(u.Init===t)this.clearAllFacetFilters();const e={filters:this.algoliaFilterStr(),page:this.indexResults?this.indexResults.currentPage:0,clickAnalytics:true};if(this.searchIndex.filters)e.facets=this.searchIndex.filters;if(this.searchIndex.hitsPerPage)e.hitsPerPage=this.searchIndex.hitsPerPage;let i=await this.algoliaIndex.search(this.query,e);i=this.fixDomain(i);this.changeEvent=t;if(t===u.Init||!this.indexResults){this.indexResults={queryID:i.queryID,currentPage:0,totalHits:i.nbHits,hitsPerPage:null,origFilters:i.facets,query:this.query,domain:this.searchIndex.domain||null,totalHitsWithFilters:0,results:[],totalPages:0,appliedFilters:this.makeAppliedFilters(),indexName:this.searchIndex.name||null,index:this.searchIndex.index,searchIndex:this.searchIndex}}this.indexResults.dynFilters=i.facets;this.indexResults.results=i.hits;this.indexResults.totalHitsWithFilters=i.nbHits;this.indexResults.currentPage=i.page;this.indexResults.totalPages=i.nbPages;this.indexResults.hitsPerPage=i.hitsPerPage;this.indexResults.query=i.query;if(this.changeEvent!==u.Page&&this.changeEvent!==u.Replica){this.facets=i.facets}this.nanoAfterQuery.emit(this.indexResults);return new Promise((t=>{setTimeout((()=>t("tpl updated")),20)})).then((t=>{this.currentHits=this.indexResults.results;this.resultsPage=this.indexResults.currentPage}))};this.handleSearchReset=()=>{this.showResults=false;this.indexResults=null};this.onResultDisplay=()=>{n((()=>{this.resultsDiv.removeEventListener("transitionend",this.onResultDisplay);if(!this.showResults)this.resultsDiv.style.display="none";else{this.defaultDiv.style.display="none";this.resultsDiv.classList.add("shown");this.resultsDiv.style.minHeight="";this.resultsDiv.style.width=""}}))};this._dynFacetFilters={};this.inputField=undefined;this.algoliaIndex=undefined;this.indeces=[];this.indexResults=undefined;this.filterChanged="";this.currentHits=undefined;this.changeEvent=u.Init;this.isLoading=false;this.wormholeState=this;this.showResults=false;this.resultsPage=0;this.appId=undefined;this.apiKey=undefined;this.searchIndex={};this.searchIndexName="";this.listenTo=null;this.query="";this.operator="and";this.filters=[];this.tplRenderFn=et.render;this.replicaIndex="";this.browseIndex=false;this.minChars=2;this.storeId=undefined;this.storeMethod="session"}handleListenToChange(){if(!this.listenTo)return;const t=document.querySelector(this.listenTo);if(["nano-input","input"].includes(t.tagName.toLocaleLowerCase())){this.inputField=t}}async removeFilters(t,e){if(!t&&!e)this.clearAllFacetFilters();else{Object.keys(this._dynFacetFilters).forEach((i=>{if(t&&this._dynFacetFilters[i].facetName===t){if(!e)this._dynFacetFilters[i].element.value="";else{this._dynFacetFilters[i].element.value=this._dynFacetFilters[i].value.filter((t=>t!==e))}}}))}}onAllTplUpdate(t){t.stopPropagation();if(t.target.tagName==="NANO-ALGOLIA-RESULTS"){requestAnimationFrame((()=>{this.nanoNewResults.emit(this.indexResults)}))}}async onPageChange(t){if(!this.indexResults)return;let e=this.resultsPage;if(t){t.stopPropagation();e=t.detail.page}e=Math.min(this.indexResults.totalPages-1,e);e=Math.max(e,0);if(this.indexResults.currentPage===e)return;this.indexResults.currentPage=e;await this.algoliaSearch(u.Page)}async onFilterChange(t){t.stopPropagation();const e={};const i=t.detail;i.element=t.target;if(this.indexResults){if(this.staticFacetFilters[i.filterId])this.staticFacetFilters[i.filterId]=i;else{e[i.filterId]=i;this._dynFacetFilters={...this._dynFacetFilters,...e}}this.indexResults.appliedFilters=this.makeAppliedFilters()}else this.staticFacetFilters[i.filterId]=i;this.filterChanged=i.value&&i.value.length?i.filterId:"all";this.resetPage();this.algoliaSearch(u.Filter)}dynFacetFiltersChange(){Object.values(this._dynFacetFilters).forEach((t=>{if(this.host.ownerDocument===t.element.ownerDocument)this.dynFacetFilters[t.filterId]=t;else delete this.dynFacetFilters[t.filterId]}))}browseIndexChange(){if(this.browseIndex&&(!this.query||this.query.length<this.minChars)){this.query="*"}}inputFieldSet(){if(!this.inputField)return;if(this.query!=="*"&&this.inputField&&this.inputField.value!==this.query)this.inputField.value=this.query}queryChange(){this.searchChange()}async internalIndexSwitch(){if(!this.replicaIndex||!this.indexResults||this.indexResults.index===this.replicaIndex)return;this.indexResults.index=this.replicaIndex;this.algoliaIndex=this.algoliaClient.initIndex(this.indexResults.index);this.resetPage();this.algoliaSearch(u.Replica)}pageChange(){this.onPageChange()}searchIndexNameChange(){if(!this.searchIndexName||!this.searchIndexName.length||this.searchIndex&&this.searchIndex.index===this.searchIndexName)return;this.searchIndex={index:this.searchIndexName}}initAlgoliaClient(){if(!this.appId||!this.apiKey)return;this.algoliaClient=h(this.appId,this.apiKey)}initAlgoliaIndex(){if(!this.algoliaClient||!this.searchIndex)return;if(this.searchIndex.index){if(!this.searchIndex.hitsPerPage)this.searchIndex.hitsPerPage=100;if(this.replicaIndex)this.searchIndex.index=this.replicaIndex;this.searchIndexName=this.searchIndex.index;this.algoliaIndex=this.algoliaClient.initIndex(this.searchIndex.index);this.searchChange()}}showResultsChange(){if(!this.resultsDiv||!this.defaultDiv)return;if(this.showResults){this.resultsDiv.style.width=this.host.scrollWidth+"px";this.resultsDiv.style.minHeight=this.host.scrollHeight+"px";n((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.style.display="block";setTimeout((()=>this.resultsDiv.classList.add("show")),50)}))}else{n((()=>{this.resultsDiv.classList.remove("shown");this.defaultDiv.style.display="block";setTimeout((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.classList.remove("show");if(!!this.slottedInput)this.slottedInput.focus({preventScroll:true});else this.defaultDiv.focus({preventScroll:true})}),50)}))}}handleFilterpropChange(){this.algoliaSearch(u.Init)}fixDomain(t){if(!this.searchIndex||!this.searchIndex.domain)return t;t.hits.map((t=>{if(t.url&&!t.url.match(/^http/))t.url=location.protocol+"//"+this.searchIndex.domain+t.url}));return t}resetPage(){if(!this.indexResults)return;this.indexResults.currentPage=0}clearAllFacetFilters(){Object.values(this._dynFacetFilters).forEach((t=>{t.element.value=""}));this._dynFacetFilters={}}algoliaFilterStr(){const t={};const e=e=>{let i;let s;Object.keys(e).forEach((n=>{i=e[n];t[n]=t[n]||{name:i.facetName,or:[],and:[],not:[]};s=t[n][i.operator];if(i.value&&i.value.length){t[n][i.operator]=[...s,...i.value]}}))};e(this.dynFacetFilters);e(this.staticFacetFilters);const i=(t,e)=>{if(e.indexOf(" ")>-1)return t+':"'+e+'"';else return t+":"+e};let s=[];let n;let r;Object.values(t).forEach((function(t){Object.keys(t).filter((t=>t.match(/(or|and|not)/))).forEach((e=>{n=t;r=t.name;if(e==="or"||e==="and"){if(n[e].length){s.push("( "+n[e].map((t=>{if(t.length)return i(r,t)})).join(" "+e.toLocaleUpperCase()+" ")+" )")}}else{if(n.not.length){s.push("( "+n[e].map((t=>{if(t.length)return"NOT "+i(r,t)})).join(" AND ")+" )")}}}))}));s=[...this.filters,...s];return s.join(" "+this.operator.toLocaleUpperCase()+" ")}handleInputChange(t){if(t.target!==this.inputField)return;this.query=this.inputField.value}async updateContent(){return this.promiseQueue.enqueue((()=>this.updateContentQueue()))}async updateContentQueue(){const t=this.outputSlot||this.resultsDiv;if(!t||!this.tpl)return"no tpl";const e=document.createElement("div");e.innerHTML=this.tpl;const i=[];this.placedAlgoliaEles=[];Array.from(e.querySelectorAll("nano-algolia, nano-algolia-filter, nano-algolia-results")).forEach(((t,e)=>{const s=document.createElement("div");s.dataset.placeholderId=e.toString();s.classList.add("nano-ele-placeholder");i.push(t);t.parentNode.replaceChild(s,t)}));t.innerHTML=this.tplRenderFn(e.innerHTML.replace(/&gt;/gm,">").replace(/&lt;/gm,"<").replace(/&amp;/gm,"&"),this.indexResults);Array.from(t.querySelectorAll("div.nano-ele-placeholder")).forEach((t=>{t.parentNode.replaceChild(i[parseInt(t.dataset.placeholderId)],t);this.placedAlgoliaEles.push(i[parseInt(t.dataset.placeholderId)])}));if(!this.placedAlgoliaEles.length)return Promise.resolve("algolia setup");return new Promise((e=>{const i=s=>{this.placedAlgoliaEles=this.placedAlgoliaEles.filter((t=>t!==s.detail));if(!this.placedAlgoliaEles.length){setTimeout((()=>e("tpl updated")),500);t.removeEventListener("nanoTplUpdated",i)}};t.addEventListener("nanoTplUpdated",i)}))}componentWillLoad(){r((t=>{this.tplSlot=a(this.host,'[slot="template"]')[0];this.outputSlot=a(this.host,'[slot="output"]')[0];this.slottedInput=a(this.host,'[slot="search-input"]')[0];this.hasLoadSlot=!!a(this.host,'[slot="loader"]')[0];if(!!this.tplSlot)this.tpl=this.tplSlot.innerHTML||this.tplSlot.innerText;if(this.slottedInput&&(this.slottedInput.tagName.toLocaleLowerCase()==="nano-input"||this.slottedInput instanceof HTMLInputElement)){this.inputField=this.slottedInput}else if(this.slottedInput){this.inputField=this.slottedInput.querySelector('nano-input, input:not([type="radio"]):not([type="checkbox"])')}else this.handleListenToChange();n((t=>{if(this.showResults&&this.tpl)this.searchChange()}))}));this.searchIndexNameChange();this.initAlgoliaClient();this.initAlgoliaIndex();m.create(this,this.wormholeState);if(this.storeId){c.init(this,["query","replicaIndex"],this.storeMethod,this.storeId);c.init(this,["apiKey","appId","searchIndex"],"session",this.storeId+"_api")}this.internalIndexSwitch()}connectedCallback(){this.searchChange=f(this.searchChange,300);this.browseIndexChange();this.host.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.host}))}render(){const t={indexResults:this.indexResults,results:this.currentHits,filterChanged:this.filterChanged,tplRenderFn:this.tplRenderFn,resultsPage:this.resultsPage,changeEvent:this.changeEvent,facets:this.facets,algoliaIndex:this.algoliaIndex,searchIndex:this.searchIndex,globalStoreMethod:this.storeMethod,isLoading:this.isLoading};return o(l,{class:{"show-results":this.showResults,"is-loading":this.isLoading},"aria-busy":this.isLoading},this.hasLoadSlot&&o("div",{hidden:!this.isLoading},o("slot",{name:"loader"})),!this.hasLoadSlot&&o("div",{class:{loader:true,loading:this.isLoading}},o("nano-spinner",{overlay:true,type:"circle"})),o(m.Provider,{state:t},o("slot",{name:"search-input"}),o("div",{class:"results-container","aria-live":"polite"},o("div",{ref:t=>this.resultsDiv=t,class:"results"},o("slot",{name:"output"})))),o("div",{ref:t=>this.defaultDiv=t,class:"default",tabindex:"-1"},o("slot",null)))}get host(){return t(this)}static get watchers(){return{listenTo:["handleListenToChange"],_dynFacetFilters:["dynFacetFiltersChange"],browseIndex:["browseIndexChange"],inputField:["inputFieldSet"],query:["queryChange"],replicaIndex:["internalIndexSwitch"],resultsPage:["pageChange"],searchIndexName:["searchIndexNameChange"],apiKey:["initAlgoliaClient"],appId:["initAlgoliaClient"],searchIndex:["initAlgoliaIndex"],showResults:["showResultsChange"],filters:["handleFilterpropChange"]}}};st.style=it;export{st as nano_algolia};
5
5
  //# sourceMappingURL=nano-algolia.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{r as i,c as o,h as a,a as t,g as s}from"./index-9695db0a.js";import{M as e}from"./modal-88c117cd.js";import{l as n,u as r}from"./scroll-762b3e1a.js";import{h as l}from"./slot-8126e238.js";import{C as d}from"./component-store-486d9d7a.js";import"./tabbable-26a66a22.js";import"./dom-8599fac1.js";import"./throttle-ac4fcefa.js";const h=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--border-radius:var(--nano-layer-border-radius, var(--nano-border-radius-medium, 4px));--content-background:#fafafa;--footer-content:#e4e6e8;--scrim-color:var(--nano-layer-overlay-dark, rgb(74 74 74 / 50%));--box-shadow:var(--nano-layer-shadow-large, 0 2px 8px rgba(0, 0, 0, 0.2));--close-button-color:#b5aea7;--width:60rem;--tint-color:#00607b;--body-padding-v:var(--nano-spacing-large, 20px);--body-padding-h:var(--nano-spacing-large, 20px);--header-padding-v:var(--nano-spacing-medium, 16px);--header-padding-h:var(--nano-spacing-large, 20px);--footer-padding-v:var(--nano-spacing-medium, 16px);--footer-padding-h:var(--nano-spacing-large, 20px)}.dialog{display:flex;align-items:center;justify-content:center;position:fixed;inset:0;z-index:var(--nano-layer-index-modal, 700);border:none;inline-size:unset;block-size:unset;color:unset;background-color:unset}.dialog::backdrop{display:none}.dialog__panel{display:flex;flex-direction:column;z-index:2;inline-size:var(--width);max-inline-size:calc(100% - (var(--nano-spacing-xlarge, 24px) + var(--nano-scroll-lock-size)));max-block-size:calc(92vh - var(--nano-spacing-xlarge, 24px));background-color:var(--content-background);border-radius:var(--border-radius);box-shadow:var(--box-shadow);opacity:0;transform:scale(0.8);transition:var(--nano-transition-fast, 0.3s) opacity, var(--nano-transition-fast, 0.3s) transform}.dialog__panel:focus{outline:none}.dialog--with-ribbon .dialog__panel{border-block-start:5px solid var(--tint-color)}.dialog--open .dialog__panel{display:flex;opacity:1;transform:none}.dialog--nodismiss .dialog__panel{animation:cannotClose 0.25s ease-in-out 1}@keyframes cannotClose{0%{transform:scale(1)}50%{transform:scale(1.08)}100%{transform:scale(1)}}.dialog__header{flex:0 0 auto;display:flex;inline-size:100%;background-color:var(--content-background);border-radius:var(--border-radius) var(--border-radius) 0 0;transition:var(--nano-transition-fast, 0.1s) box-shadow;min-inline-size:auto}[stuck] .dialog__header{box-shadow:var(--nano-layer-shadow-medium, 0 2px 4px rgba(0, 0, 0, 0.2))}.dialog__title{flex:1 1 auto;font-size:var(--nano-fontsize-large, 1.25rem);line-height:1.6;padding-block:var(--header-padding-v);padding-inline:var(--header-padding-h)}.dialog .dialog__close-icon{flex:0 0 auto;display:flex;align-items:center;font-size:var(--nano-fontsize-xlarge, 1.5rem);padding-block:0;padding-inline:var(--header-padding-h);--color:var(--close-button-color)}.dialog__body{padding-block:0 var(--body-padding-v);padding-inline:var(--body-padding-h)}.dialog:not(.dialog--has-header) .dialog__body{padding-block-start:var(--body-padding-v)}.dialog__body ::slotted(*){max-inline-size:100%}.dialog__body-wrap{flex:1 1 auto;overflow:auto;-webkit-overflow-scrolling:touch;border-radius:var(--border-radius)}.dialog:not(.dialog--has-header) .dialog__body-wrap{border-radius:0 0 inherit inherit}.dialog:not(.dialog--has-footer) .dialog__body-wrap{border-radius:inherit inherit 0 0}.dialog__footer{inline-size:100%;padding-block:var(--footer-padding-v);padding-inline:var(--footer-padding-h);background:var(--footer-content);border-radius:0 0 var(--border-radius) var(--border-radius);position:relative;inset-block-start:1px;min-inline-size:auto}.dialog__footer ::slotted(button){margin-inline-end:var(--nano-spacing-small, 8px) !important}.dialog:not(.dialog--has-footer) .dialog__footer{display:none}.dialog__close-txt{color:var(--tint-color);border:none;text-decoration:underline;margin:0;text-underline-offset:4px;background-color:transparent;font:inherit;-webkit-box-align:center;cursor:pointer;font-size:var(--nano-fontsize-small, 0.875rem);padding:0.5rem;border-radius:var(--nano-border-radius-small, 2px);transition:box-shadow 100ms ease-in-out}.dialog__close-txt:focus{outline:none;box-shadow:var(--nano-control-focus-shadow, 0 0 0 0.1875rem var(--nano-control-focus-color, rgba(144, 198, 231, 0.8)))}.dialog__overlay{position:fixed;inset:0 !important;background-color:var(--scrim-color);opacity:0;transition:var(--nano-transition-fast, 0.3s) opacity;-webkit-backdrop-filter:blur(var(--nano-layer-overlay-blur, 3px));backdrop-filter:blur(var(--nano-layer-overlay-blur, 3px))}.dialog--open .dialog__overlay{opacity:1}";let c=0;const p=class{constructor(a){i(this,a);this.nanoShow=o(this,"nanoShow",7);this.nanoAfterShow=o(this,"nanoAfterShow",7);this.nanoHide=o(this,"nanoHide",7);this.nanoAfterHide=o(this,"nanoAfterHide",7);this.nanoInitialFocus=o(this,"nanoInitialFocus",7);this.nanoRequestClose=o(this,"nanoRequestClose",7);this.componentId=`dialog-${++c}`;this.willShow=false;this.willHide=false;this.handleKeyDown=i=>{if(i.key==="Escape"){this.requestClose()}};this.requestClose=()=>{const i=this.nanoRequestClose.emit();if(!i.defaultPrevented&&!this.noUserDismiss){this.hide()}else{this.noDismiss=true;setTimeout((()=>this.noDismiss=false),250)}};this.handleTransitionEnd=i=>{if(i.propertyName==="opacity"&&i.composedPath().find((i=>i===this.panel||i===this.overlay))){this.willShow=false;this.willHide=false;this.open?this.nanoAfterShow.emit():this.nanoAfterHide.emit();if(!this.open)this.dialog.hidden=true}};this.handleSlotChange=()=>{this.hasFooter=l(this.host,"footer")};this.noDismiss=false;this.hasFooter=false;this.showRibbon=true;this.open=false;this.label=undefined;this.noHeader=false;this.noFooter=false;this.noUserDismiss=false;this.storeId=undefined;this.storeMethod="url-hash";this.hoist=false}get panel(){return this._panel}set panel(i){if(this._panel){this.panel.removeEventListener("transitionend",this.handleTransitionEnd)}i.addEventListener("transitionend",this.handleTransitionEnd);this._panel=i}handleOpenChange(){this.open?this.show():this.hide()}handleHoistChange(){if(globalThis.HTMLElement.prototype.hasOwnProperty("popover")||!this.hoist||Array.from(document.body.children).includes(this.host))return;document.body.prepend(this.host)}async show(){if(this.willShow){return}const i=this.nanoShow.emit();if(i.defaultPrevented){this.open=false;return}if(this.dialog)this.dialog.hidden=false;this.originalTrigger=document.activeElement;this.willShow=true;this.open=true;this.modal.activate();if(typeof this.dialog?.showPopover==="function"){this.dialog.showPopover()}n(this.host);if(this.open){this.host.addEventListener("nanoAfterShow",(()=>{const i=this.nanoInitialFocus.emit();if(!i.defaultPrevented){this.panel.focus({preventScroll:true})}}),{once:true})}}async hide(){if(this.willHide){return}const i=this.nanoHide.emit();if(i.defaultPrevented){this.open=true;return}this.willHide=true;this.open=false;this.modal.deactivate();this.stopVideos();const o=this.originalTrigger;if(o&&typeof o.focus==="function"){setTimeout((()=>o.focus()))}setTimeout((()=>{if(!this.open&&typeof this.dialog?.hidePopover==="function"){this.dialog.hidePopover()}r(this.host)}),300)}stopVideos(){const i=Array.from(this.host.querySelectorAll("iframe,video"));i.forEach((i=>{if(i.tagName.toLowerCase()==="video")i.pause();else{const o=i.src;i.src=o}}))}connectedCallback(){this.handleHoistChange();this.modal=new e(this.host)}componentWillLoad(){this.handleSlotChange();if(this.open)this.show();if(this.storeId)d.init(this,["open"],this.storeMethod,this.storeId)}componentDidLoad(){this.dialog.hidden=!this.open}disconnectedCallback(){r(this.host);if(!this.panel)return;this.panel.removeEventListener("transitionend",this.handleTransitionEnd)}render(){return a(t,null,a("div",{part:"base",class:{dialog:true,"dialog--open":this.open,"dialog--has-footer":!this.noFooter,"dialog--has-header":!this.noHeader,"dialog--nodismiss":this.noDismiss,"dialog--with-ribbon":this.showRibbon},onKeyDown:this.handleKeyDown,ref:i=>this.dialog=i,popover:"manual"},a("div",{part:"overlay",class:"dialog__overlay",ref:i=>this.overlay=i,onClick:this.requestClose}),a("div",{ref:i=>this.panel=i,part:"panel",class:"dialog__panel",role:"dialog","aria-modal":"true","aria-hidden":this.open?"false":"true","aria-label":this.noHeader?this.label:null,"aria-labelledby":!this.noHeader?`${this.componentId}-title`:null,tabIndex:-1},a("div",{class:"dialog__body-wrap"},!this.noHeader&&a("nano-sticker",null,a("header",{part:"header",class:"dialog__header"},a("span",{part:"title",class:"dialog__title",id:`${this.componentId}-title`},a("slot",{name:"label"},this.label||String.fromCharCode(65279))),!this.noUserDismiss&&a("nano-icon-button",{part:"close-button",exportparts:"base:close-button__base",class:"dialog__close-icon",label:"close dialog",onClick:this.requestClose,iconName:"light/times"}))),a("div",{part:"body",class:"dialog__body"},a("slot",null)),!this.noFooter&&(this.hasFooter||!this.noUserDismiss)&&a("nano-sticker",{position:"bottom"},a("footer",{part:"footer",class:"dialog__footer"},a("slot",{name:"footer",onSlotchange:this.handleSlotChange}),!this.noUserDismiss&&a("button",{class:"dialog__close-txt",onClick:this.requestClose},"Close")))))))}get host(){return s(this)}static get watchers(){return{open:["handleOpenChange"],hoist:["handleHoistChange"]}}};p.style=h;export{p as nano_dialog};
4
+ import{r as i,c as o,h as a,a as t,g as s}from"./index-9695db0a.js";import{M as e}from"./modal-88c117cd.js";import{l as n,u as r}from"./scroll-762b3e1a.js";import{h as l}from"./slot-8126e238.js";import{C as d}from"./component-store-64043183.js";import"./tabbable-26a66a22.js";import"./dom-8599fac1.js";import"./throttle-ac4fcefa.js";const h=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--border-radius:var(--nano-layer-border-radius, var(--nano-border-radius-medium, 4px));--content-background:#fafafa;--footer-content:#e4e6e8;--scrim-color:var(--nano-layer-overlay-dark, rgb(74 74 74 / 50%));--box-shadow:var(--nano-layer-shadow-large, 0 2px 8px rgba(0, 0, 0, 0.2));--close-button-color:#b5aea7;--width:60rem;--tint-color:#00607b;--body-padding-v:var(--nano-spacing-large, 20px);--body-padding-h:var(--nano-spacing-large, 20px);--header-padding-v:var(--nano-spacing-medium, 16px);--header-padding-h:var(--nano-spacing-large, 20px);--footer-padding-v:var(--nano-spacing-medium, 16px);--footer-padding-h:var(--nano-spacing-large, 20px)}.dialog{display:flex;align-items:center;justify-content:center;position:fixed;inset:0;z-index:var(--nano-layer-index-modal, 700);border:none;inline-size:unset;block-size:unset;color:unset;background-color:unset}.dialog::backdrop{display:none}.dialog__panel{display:flex;flex-direction:column;z-index:2;inline-size:var(--width);max-inline-size:calc(100% - (var(--nano-spacing-xlarge, 24px) + var(--nano-scroll-lock-size)));max-block-size:calc(92vh - var(--nano-spacing-xlarge, 24px));background-color:var(--content-background);border-radius:var(--border-radius);box-shadow:var(--box-shadow);opacity:0;transform:scale(0.8);transition:var(--nano-transition-fast, 0.3s) opacity, var(--nano-transition-fast, 0.3s) transform}.dialog__panel:focus{outline:none}.dialog--with-ribbon .dialog__panel{border-block-start:5px solid var(--tint-color)}.dialog--open .dialog__panel{display:flex;opacity:1;transform:none}.dialog--nodismiss .dialog__panel{animation:cannotClose 0.25s ease-in-out 1}@keyframes cannotClose{0%{transform:scale(1)}50%{transform:scale(1.08)}100%{transform:scale(1)}}.dialog__header{flex:0 0 auto;display:flex;inline-size:100%;background-color:var(--content-background);border-radius:var(--border-radius) var(--border-radius) 0 0;transition:var(--nano-transition-fast, 0.1s) box-shadow;min-inline-size:auto}[stuck] .dialog__header{box-shadow:var(--nano-layer-shadow-medium, 0 2px 4px rgba(0, 0, 0, 0.2))}.dialog__title{flex:1 1 auto;font-size:var(--nano-fontsize-large, 1.25rem);line-height:1.6;padding-block:var(--header-padding-v);padding-inline:var(--header-padding-h)}.dialog .dialog__close-icon{flex:0 0 auto;display:flex;align-items:center;font-size:var(--nano-fontsize-xlarge, 1.5rem);padding-block:0;padding-inline:var(--header-padding-h);--color:var(--close-button-color)}.dialog__body{padding-block:0 var(--body-padding-v);padding-inline:var(--body-padding-h)}.dialog:not(.dialog--has-header) .dialog__body{padding-block-start:var(--body-padding-v)}.dialog__body ::slotted(*){max-inline-size:100%}.dialog__body-wrap{flex:1 1 auto;overflow:auto;-webkit-overflow-scrolling:touch;border-radius:var(--border-radius)}.dialog:not(.dialog--has-header) .dialog__body-wrap{border-radius:0 0 inherit inherit}.dialog:not(.dialog--has-footer) .dialog__body-wrap{border-radius:inherit inherit 0 0}.dialog__footer{inline-size:100%;padding-block:var(--footer-padding-v);padding-inline:var(--footer-padding-h);background:var(--footer-content);border-radius:0 0 var(--border-radius) var(--border-radius);position:relative;inset-block-start:1px;min-inline-size:auto}.dialog__footer ::slotted(button){margin-inline-end:var(--nano-spacing-small, 8px) !important}.dialog:not(.dialog--has-footer) .dialog__footer{display:none}.dialog__close-txt{color:var(--tint-color);border:none;text-decoration:underline;margin:0;text-underline-offset:4px;background-color:transparent;font:inherit;-webkit-box-align:center;cursor:pointer;font-size:var(--nano-fontsize-small, 0.875rem);padding:0.5rem;border-radius:var(--nano-border-radius-small, 2px);transition:box-shadow 100ms ease-in-out}.dialog__close-txt:focus{outline:none;box-shadow:var(--nano-control-focus-shadow, 0 0 0 0.1875rem var(--nano-control-focus-color, rgba(144, 198, 231, 0.8)))}.dialog__overlay{position:fixed;inset:0 !important;background-color:var(--scrim-color);opacity:0;transition:var(--nano-transition-fast, 0.3s) opacity;-webkit-backdrop-filter:blur(var(--nano-layer-overlay-blur, 3px));backdrop-filter:blur(var(--nano-layer-overlay-blur, 3px))}.dialog--open .dialog__overlay{opacity:1}";let c=0;const p=class{constructor(a){i(this,a);this.nanoShow=o(this,"nanoShow",7);this.nanoAfterShow=o(this,"nanoAfterShow",7);this.nanoHide=o(this,"nanoHide",7);this.nanoAfterHide=o(this,"nanoAfterHide",7);this.nanoInitialFocus=o(this,"nanoInitialFocus",7);this.nanoRequestClose=o(this,"nanoRequestClose",7);this.componentId=`dialog-${++c}`;this.willShow=false;this.willHide=false;this.handleKeyDown=i=>{if(i.key==="Escape"){this.requestClose()}};this.requestClose=()=>{const i=this.nanoRequestClose.emit();if(!i.defaultPrevented&&!this.noUserDismiss){this.hide()}else{this.noDismiss=true;setTimeout((()=>this.noDismiss=false),250)}};this.handleTransitionEnd=i=>{if(i.propertyName==="opacity"&&i.composedPath().find((i=>i===this.panel||i===this.overlay))){this.willShow=false;this.willHide=false;this.open?this.nanoAfterShow.emit():this.nanoAfterHide.emit();if(!this.open)this.dialog.hidden=true}};this.handleSlotChange=()=>{this.hasFooter=l(this.host,"footer")};this.noDismiss=false;this.hasFooter=false;this.showRibbon=true;this.open=false;this.label=undefined;this.noHeader=false;this.noFooter=false;this.noUserDismiss=false;this.storeId=undefined;this.storeMethod="url-hash";this.hoist=false}get panel(){return this._panel}set panel(i){if(this._panel){this.panel.removeEventListener("transitionend",this.handleTransitionEnd)}i.addEventListener("transitionend",this.handleTransitionEnd);this._panel=i}handleOpenChange(){this.open?this.show():this.hide()}handleHoistChange(){if(globalThis.HTMLElement.prototype.hasOwnProperty("popover")||!this.hoist||Array.from(document.body.children).includes(this.host))return;document.body.prepend(this.host)}async show(){if(this.willShow){return}const i=this.nanoShow.emit();if(i.defaultPrevented){this.open=false;return}if(this.dialog)this.dialog.hidden=false;this.originalTrigger=document.activeElement;this.willShow=true;this.open=true;this.modal.activate();if(typeof this.dialog?.showPopover==="function"){this.dialog.showPopover()}n(this.host);if(this.open){this.host.addEventListener("nanoAfterShow",(()=>{const i=this.nanoInitialFocus.emit();if(!i.defaultPrevented){this.panel.focus({preventScroll:true})}}),{once:true})}}async hide(){if(this.willHide){return}const i=this.nanoHide.emit();if(i.defaultPrevented){this.open=true;return}this.willHide=true;this.open=false;this.modal.deactivate();this.stopVideos();const o=this.originalTrigger;if(o&&typeof o.focus==="function"){setTimeout((()=>o.focus()))}setTimeout((()=>{if(!this.open&&typeof this.dialog?.hidePopover==="function"){this.dialog.hidePopover()}r(this.host)}),300)}stopVideos(){const i=Array.from(this.host.querySelectorAll("iframe,video"));i.forEach((i=>{if(i.tagName.toLowerCase()==="video")i.pause();else{const o=i.src;i.src=o}}))}connectedCallback(){this.handleHoistChange();this.modal=new e(this.host)}componentWillLoad(){this.handleSlotChange();if(this.open)this.show();if(this.storeId)d.init(this,["open"],this.storeMethod,this.storeId)}componentDidLoad(){this.dialog.hidden=!this.open}disconnectedCallback(){r(this.host);if(!this.panel)return;this.panel.removeEventListener("transitionend",this.handleTransitionEnd)}render(){return a(t,null,a("div",{part:"base",class:{dialog:true,"dialog--open":this.open,"dialog--has-footer":!this.noFooter,"dialog--has-header":!this.noHeader,"dialog--nodismiss":this.noDismiss,"dialog--with-ribbon":this.showRibbon},onKeyDown:this.handleKeyDown,ref:i=>this.dialog=i,popover:"manual"},a("div",{part:"overlay",class:"dialog__overlay",ref:i=>this.overlay=i,onClick:this.requestClose}),a("div",{ref:i=>this.panel=i,part:"panel",class:"dialog__panel",role:"dialog","aria-modal":"true","aria-hidden":this.open?"false":"true","aria-label":this.noHeader?this.label:null,"aria-labelledby":!this.noHeader?`${this.componentId}-title`:null,tabIndex:-1},a("div",{class:"dialog__body-wrap"},!this.noHeader&&a("nano-sticker",null,a("header",{part:"header",class:"dialog__header"},a("span",{part:"title",class:"dialog__title",id:`${this.componentId}-title`},a("slot",{name:"label"},this.label||String.fromCharCode(65279))),!this.noUserDismiss&&a("nano-icon-button",{part:"close-button",exportparts:"base:close-button__base",class:"dialog__close-icon",label:"close dialog",onClick:this.requestClose,iconName:"light/times"}))),a("div",{part:"body",class:"dialog__body"},a("slot",null)),!this.noFooter&&(this.hasFooter||!this.noUserDismiss)&&a("nano-sticker",{position:"bottom"},a("footer",{part:"footer",class:"dialog__footer"},a("slot",{name:"footer",onSlotchange:this.handleSlotChange}),!this.noUserDismiss&&a("button",{class:"dialog__close-txt",onClick:this.requestClose},"Close")))))))}get host(){return s(this)}static get watchers(){return{open:["handleOpenChange"],hoist:["handleHoistChange"]}}};p.style=h;export{p as nano_dialog};
5
5
  //# sourceMappingURL=nano-dialog.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{r as e,c as a,h as t,g as r}from"./index-9695db0a.js";import{M as i}from"./modal-88c117cd.js";import{l as s,u as n}from"./scroll-762b3e1a.js";import{h as o}from"./slot-8126e238.js";import{w as d}from"./events-6a805b42.js";import{C as l}from"./component-store-486d9d7a.js";import"./tabbable-26a66a22.js";import"./dom-8599fac1.js";import"./throttle-ac4fcefa.js";const h=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--size:25rem;--panel-background:white;--panel-shadow:var(--nano-layer-shadow-xlarge, 0 4px 16px rgba(0, 0, 0, 0.4));--scrim-color:var(--nano-layer-overlay-dark, rgb(74 74 74 / 50%));--header-button-color:#b5aea7;--footer-background:#e4e6e8;--header-background:var(--panel-background);--header-spacing:var(--nano-spacing-large, 20px);--body-spacing:var(--nano-spacing-large, 20px);--footer-spacing:var(--nano-spacing-medium, 16px) var(--nano-spacing-large, 20px);--dir:1}:host(:dir(rtl)){--dir:-1}:host-context([dir=rtl]){--dir:-1}.drawer{inset-block-start:0;inset-inline-start:0;inline-size:100%;block-size:100%;pointer-events:none;overflow:hidden}.drawer--contained{position:absolute;z-index:initial}.drawer--fixed{position:fixed;z-index:var(--nano-layer-index-modal, 700)}.drawer__panel{position:absolute;z-index:2;max-inline-size:100%;max-block-size:100%;background-color:var(--panel-background);box-shadow:var(--panel-shadow);pointer-events:all;transition:var(--nano-transition-fast, 0.3s) opacity, var(--nano-transition-fast, 0.3s) transform;display:flex;flex-direction:column}@media (forced-colors: active){.drawer__panel{border:solid 1px #4a4a4a}}.drawer__panel:focus{outline:none}.drawer--nodismiss .drawer__panel{animation:cannotClose 0.25s ease-in-out 1}@keyframes cannotClose{0%{transform:scale(1)}50%{transform:scale(1.08)}100%{transform:scale(1)}}.drawer--top .drawer__panel{inset-block:0 auto;inset-inline:0 auto;inline-size:100%;block-size:var(--size);opacity:0;transform:translateY(-100%)}.drawer--bottom .drawer__panel{inset-block:auto 0;inset-inline:0 auto;inline-size:100%;block-size:var(--size);opacity:0;transform:translateY(100%)}.drawer--top.drawer--open .drawer__panel,.drawer--bottom.drawer--open .drawer__panel{opacity:1;transform:translateY(0)}.drawer--start .drawer__panel{inset-block:0 auto;inset-inline:0 auto;inline-size:var(--size);block-size:100%;opacity:0;transform:translateX(calc(var(--dir) * -100%))}.drawer--end .drawer__panel{inset-block:0 auto;inset-inline:auto 0;inline-size:var(--size);block-size:100%;opacity:0;transform:translateX(calc(var(--dir) * 100%))}.drawer--start.drawer--open .drawer__panel,.drawer--end.drawer--open .drawer__panel{opacity:1;transform:translateX(0)}.drawer__header{inline-size:100%;display:flex;background-color:var(--header-background)}[stuck] .drawer__header{box-shadow:var(--nano-layer-shadow-medium, 0 2px 4px rgba(0, 0, 0, 0.2))}.drawer__title{flex:1 1 auto;font:inherit;font-size:var(--nano-fontsize-large, 1.25rem);line-height:1.2;padding:var(--header-spacing);margin:0}.drawer__header-actions{flex-shrink:0;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--nano-spacing-xsmall, 4px);padding:0 var(--header-spacing)}.drawer__header-actions .drawer__close,.drawer__header-actions ::slotted(nano-icon-button){flex:0 0 auto;display:flex;align-items:center;font-size:var(--nano-fontsize-xlarge, 1.5rem);--color:var(--header-button-color)}.drawer__main{display:flex;flex-direction:column;overflow:auto;-webkit-overflow-scrolling:touch;flex:1 1 auto}.drawer__body{display:block;flex:1 1 auto;padding:var(--body-spacing);padding-block:0 var(--body-spacing);padding-inline:var(--body-spacing)}.drawer:not(.drawer--has-header) .drawer__body{padding-block-start:var(--body-spacing)}.drawer__footer{inline-size:100%;text-align:end;padding:var(--footer-spacing);background:var(--footer-background);inset-block-start:1px;position:relative}.drawer__footer ::slotted(button:not(:last-of-type)){margin-inline-end:var(--nano-spacing-xsmall, 4px)}.drawer:not(.drawer--has-footer) .drawer__footer{display:none}.drawer__overlay{display:block;position:fixed;inset:0;background-color:var(--scrim-color);pointer-events:all;-webkit-backdrop-filter:blur(var(--nano-layer-overlay-blur, 3px));backdrop-filter:blur(var(--nano-layer-overlay-blur, 3px));opacity:0;transition:var(--nano-transition-fast, 0.3s) opacity}.drawer--open .drawer__overlay{opacity:1}.drawer--contained .drawer__overlay{display:none}";const c=class{constructor(t){e(this,t);this.nanoShow=a(this,"nanoShow",7);this.nanoHide=a(this,"nanoHide",7);this.nanoAfterHide=a(this,"nanoAfterHide",7);this.nanoAfterShow=a(this,"nanoAfterShow",7);this.nanoInitialFocus=a(this,"nanoInitialFocus",7);this.nanoRquestClose=a(this,"nanoRquestClose",7);this.handleDocumentKeyDown=e=>{if(this.contained){return}if(e.key==="Escape"&&this.modal.isActive()&&this.open){e.stopImmediatePropagation();this.requestClose("keyboard")}};this.handleTransitionEnd=e=>{if(e.propertyName==="opacity"&&e.composedPath().find((e=>e===this.panel||e===this.overlay))){if(!this.open){this.drawer.hidden=true;this.overlay.hidden=false;this.panel.hidden=false}this.open?this.nanoAfterShow.emit():this.nanoAfterHide.emit()}};this.handleSlotChange=()=>{this.hasFooter=o(this.host,"footer")};this.noDismiss=false;this.hasFooter=undefined;this.open=false;this.label=undefined;this.placement="end";this.contained=false;this.noHeader=false;this.storeId=undefined;this.storeMethod="url-hash";this.noUserDismiss=false;this.hoist=false}get panel(){return this._panel}set panel(e){if(this._panel){this.panel.removeEventListener("animationend",this.handleTransitionEnd)}if(!e)return;e.addEventListener("transitionend",this.handleTransitionEnd);this._panel=e}handleHoistChange(){if(!this.hoist||Array.from(document.body.children).includes(this.host))return;document.body.prepend(this.host)}async show(){if(this.open)return undefined;this.open=true;return d(this.host,"nanoAfterShow")}async hide(){if(!this.open)return undefined;this.open=false;return d(this.host,"nanoAfterHide")}requestClose(e){const a=this.nanoRquestClose.emit({source:e});if(a.defaultPrevented||this.noUserDismiss){this.noDismiss=true;setTimeout((()=>this.noDismiss=false),250);return}this.hide()}handleNoModalChange(){if(this.open&&!this.contained){this.modal.activate();s(this.host)}if(this.open&&this.contained){this.modal.deactivate();n(this.host)}}async handleOpenChange(){if(this.open){this.nanoShow.emit();this.addOpenListeners();this.originalTrigger=document.activeElement;if(!this.contained){this.modal.activate();s(this.host)}const e=this.host.querySelector("[autofocus]");if(e){e.removeAttribute("autofocus")}this.drawer.hidden=false;requestAnimationFrame((()=>{const a=this.nanoInitialFocus.emit();if(!a.defaultPrevented){if(e){e.focus({preventScroll:true})}else{this.panel.focus({preventScroll:true})}}if(e){e.setAttribute("autofocus","")}}));this.nanoAfterShow.emit();return}this.nanoHide.emit();this.removeOpenListeners();if(!this.contained){this.modal.deactivate();n(this.host)}const e=this.originalTrigger;if(typeof e?.focus==="function"){setTimeout((()=>e.focus()))}}addOpenListeners(){document.addEventListener("keydown",this.handleDocumentKeyDown)}removeOpenListeners(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}connectedCallback(){this.handleHoistChange();this.modal=new i(this.host)}disconnectedCallback(){n(this.host)}componentWillLoad(){this.handleSlotChange();if(this.open)this.show();if(this.storeId)l.init(this,["open"],this.storeMethod,this.storeId)}componentDidLoad(){this.drawer.hidden=!this.open;if(this.open){this.addOpenListeners();if(!this.contained){this.modal.activate();s(this.host)}}}render(){return t("div",{ref:e=>this.drawer=e,part:"base",class:{drawer:true,"drawer--open":this.open,[`drawer--${this.placement}`]:true,"drawer--contained":this.contained,"drawer--fixed":!this.contained,"drawer--has-footer":o(this.host,"footer"),"drawer--has-header":!this.noHeader,"drawer--nodismiss":this.noDismiss}},t("div",{ref:e=>this.overlay=e,part:"overlay",class:"drawer__overlay",onClick:()=>this.requestClose("overlay"),tabindex:"-1"}),t("div",{ref:e=>this.panel=e,part:"panel",class:"drawer__panel",role:"dialog","aria-modal":"true","aria-hidden":this.open?"false":"true","aria-label":this.noHeader?this.label:undefined,"aria-labelledby":!this.noHeader?"title":undefined,tabindex:"0"},t("div",{class:"drawer__main"},!this.noHeader&&t("nano-sticker",null,t("div",{part:"header",class:"drawer__header"},t("h2",{part:"title",class:"drawer__title",id:"title"},t("slot",{name:"label"},this.label.length>0?this.label:String.fromCharCode(65279))),t("div",{part:"header-actions",class:"drawer__header-actions"},t("slot",{name:"header-actions"}),!this.noUserDismiss&&t("nano-icon-button",{part:"close-button",exportparts:"base:close-button__base",class:"drawer__close",iconName:"light/times",label:"Close",onClick:()=>this.requestClose("close-button")})))),t("div",{part:"body",class:"drawer__body"},t("slot",null)),t("nano-sticker",{position:"bottom"},t("footer",{part:"footer",class:"drawer__footer"},t("slot",{name:"footer",onSlotchange:this.handleSlotChange}))))))}get host(){return r(this)}static get watchers(){return{hoist:["handleHoistChange"],contained:["handleNoModalChange"],open:["handleOpenChange"]}}};c.style=h;export{c as nano_drawer};
4
+ import{r as e,c as a,h as t,g as r}from"./index-9695db0a.js";import{M as i}from"./modal-88c117cd.js";import{l as s,u as n}from"./scroll-762b3e1a.js";import{h as o}from"./slot-8126e238.js";import{w as d}from"./events-6a805b42.js";import{C as l}from"./component-store-64043183.js";import"./tabbable-26a66a22.js";import"./dom-8599fac1.js";import"./throttle-ac4fcefa.js";const h=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--size:25rem;--panel-background:white;--panel-shadow:var(--nano-layer-shadow-xlarge, 0 4px 16px rgba(0, 0, 0, 0.4));--scrim-color:var(--nano-layer-overlay-dark, rgb(74 74 74 / 50%));--header-button-color:#b5aea7;--footer-background:#e4e6e8;--header-background:var(--panel-background);--header-spacing:var(--nano-spacing-large, 20px);--body-spacing:var(--nano-spacing-large, 20px);--footer-spacing:var(--nano-spacing-medium, 16px) var(--nano-spacing-large, 20px);--dir:1}:host(:dir(rtl)){--dir:-1}:host-context([dir=rtl]){--dir:-1}.drawer{inset-block-start:0;inset-inline-start:0;inline-size:100%;block-size:100%;pointer-events:none;overflow:hidden}.drawer--contained{position:absolute;z-index:initial}.drawer--fixed{position:fixed;z-index:var(--nano-layer-index-modal, 700)}.drawer__panel{position:absolute;z-index:2;max-inline-size:100%;max-block-size:100%;background-color:var(--panel-background);box-shadow:var(--panel-shadow);pointer-events:all;transition:var(--nano-transition-fast, 0.3s) opacity, var(--nano-transition-fast, 0.3s) transform;display:flex;flex-direction:column}@media (forced-colors: active){.drawer__panel{border:solid 1px #4a4a4a}}.drawer__panel:focus{outline:none}.drawer--nodismiss .drawer__panel{animation:cannotClose 0.25s ease-in-out 1}@keyframes cannotClose{0%{transform:scale(1)}50%{transform:scale(1.08)}100%{transform:scale(1)}}.drawer--top .drawer__panel{inset-block:0 auto;inset-inline:0 auto;inline-size:100%;block-size:var(--size);opacity:0;transform:translateY(-100%)}.drawer--bottom .drawer__panel{inset-block:auto 0;inset-inline:0 auto;inline-size:100%;block-size:var(--size);opacity:0;transform:translateY(100%)}.drawer--top.drawer--open .drawer__panel,.drawer--bottom.drawer--open .drawer__panel{opacity:1;transform:translateY(0)}.drawer--start .drawer__panel{inset-block:0 auto;inset-inline:0 auto;inline-size:var(--size);block-size:100%;opacity:0;transform:translateX(calc(var(--dir) * -100%))}.drawer--end .drawer__panel{inset-block:0 auto;inset-inline:auto 0;inline-size:var(--size);block-size:100%;opacity:0;transform:translateX(calc(var(--dir) * 100%))}.drawer--start.drawer--open .drawer__panel,.drawer--end.drawer--open .drawer__panel{opacity:1;transform:translateX(0)}.drawer__header{inline-size:100%;display:flex;background-color:var(--header-background)}[stuck] .drawer__header{box-shadow:var(--nano-layer-shadow-medium, 0 2px 4px rgba(0, 0, 0, 0.2))}.drawer__title{flex:1 1 auto;font:inherit;font-size:var(--nano-fontsize-large, 1.25rem);line-height:1.2;padding:var(--header-spacing);margin:0}.drawer__header-actions{flex-shrink:0;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--nano-spacing-xsmall, 4px);padding:0 var(--header-spacing)}.drawer__header-actions .drawer__close,.drawer__header-actions ::slotted(nano-icon-button){flex:0 0 auto;display:flex;align-items:center;font-size:var(--nano-fontsize-xlarge, 1.5rem);--color:var(--header-button-color)}.drawer__main{display:flex;flex-direction:column;overflow:auto;-webkit-overflow-scrolling:touch;flex:1 1 auto}.drawer__body{display:block;flex:1 1 auto;padding:var(--body-spacing);padding-block:0 var(--body-spacing);padding-inline:var(--body-spacing)}.drawer:not(.drawer--has-header) .drawer__body{padding-block-start:var(--body-spacing)}.drawer__footer{inline-size:100%;text-align:end;padding:var(--footer-spacing);background:var(--footer-background);inset-block-start:1px;position:relative}.drawer__footer ::slotted(button:not(:last-of-type)){margin-inline-end:var(--nano-spacing-xsmall, 4px)}.drawer:not(.drawer--has-footer) .drawer__footer{display:none}.drawer__overlay{display:block;position:fixed;inset:0;background-color:var(--scrim-color);pointer-events:all;-webkit-backdrop-filter:blur(var(--nano-layer-overlay-blur, 3px));backdrop-filter:blur(var(--nano-layer-overlay-blur, 3px));opacity:0;transition:var(--nano-transition-fast, 0.3s) opacity}.drawer--open .drawer__overlay{opacity:1}.drawer--contained .drawer__overlay{display:none}";const c=class{constructor(t){e(this,t);this.nanoShow=a(this,"nanoShow",7);this.nanoHide=a(this,"nanoHide",7);this.nanoAfterHide=a(this,"nanoAfterHide",7);this.nanoAfterShow=a(this,"nanoAfterShow",7);this.nanoInitialFocus=a(this,"nanoInitialFocus",7);this.nanoRquestClose=a(this,"nanoRquestClose",7);this.handleDocumentKeyDown=e=>{if(this.contained){return}if(e.key==="Escape"&&this.modal.isActive()&&this.open){e.stopImmediatePropagation();this.requestClose("keyboard")}};this.handleTransitionEnd=e=>{if(e.propertyName==="opacity"&&e.composedPath().find((e=>e===this.panel||e===this.overlay))){if(!this.open){this.drawer.hidden=true;this.overlay.hidden=false;this.panel.hidden=false}this.open?this.nanoAfterShow.emit():this.nanoAfterHide.emit()}};this.handleSlotChange=()=>{this.hasFooter=o(this.host,"footer")};this.noDismiss=false;this.hasFooter=undefined;this.open=false;this.label=undefined;this.placement="end";this.contained=false;this.noHeader=false;this.storeId=undefined;this.storeMethod="url-hash";this.noUserDismiss=false;this.hoist=false}get panel(){return this._panel}set panel(e){if(this._panel){this.panel.removeEventListener("animationend",this.handleTransitionEnd)}if(!e)return;e.addEventListener("transitionend",this.handleTransitionEnd);this._panel=e}handleHoistChange(){if(!this.hoist||Array.from(document.body.children).includes(this.host))return;document.body.prepend(this.host)}async show(){if(this.open)return undefined;this.open=true;return d(this.host,"nanoAfterShow")}async hide(){if(!this.open)return undefined;this.open=false;return d(this.host,"nanoAfterHide")}requestClose(e){const a=this.nanoRquestClose.emit({source:e});if(a.defaultPrevented||this.noUserDismiss){this.noDismiss=true;setTimeout((()=>this.noDismiss=false),250);return}this.hide()}handleNoModalChange(){if(this.open&&!this.contained){this.modal.activate();s(this.host)}if(this.open&&this.contained){this.modal.deactivate();n(this.host)}}async handleOpenChange(){if(this.open){this.nanoShow.emit();this.addOpenListeners();this.originalTrigger=document.activeElement;if(!this.contained){this.modal.activate();s(this.host)}const e=this.host.querySelector("[autofocus]");if(e){e.removeAttribute("autofocus")}this.drawer.hidden=false;requestAnimationFrame((()=>{const a=this.nanoInitialFocus.emit();if(!a.defaultPrevented){if(e){e.focus({preventScroll:true})}else{this.panel.focus({preventScroll:true})}}if(e){e.setAttribute("autofocus","")}}));this.nanoAfterShow.emit();return}this.nanoHide.emit();this.removeOpenListeners();if(!this.contained){this.modal.deactivate();n(this.host)}const e=this.originalTrigger;if(typeof e?.focus==="function"){setTimeout((()=>e.focus()))}}addOpenListeners(){document.addEventListener("keydown",this.handleDocumentKeyDown)}removeOpenListeners(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}connectedCallback(){this.handleHoistChange();this.modal=new i(this.host)}disconnectedCallback(){n(this.host)}componentWillLoad(){this.handleSlotChange();if(this.open)this.show();if(this.storeId)l.init(this,["open"],this.storeMethod,this.storeId)}componentDidLoad(){this.drawer.hidden=!this.open;if(this.open){this.addOpenListeners();if(!this.contained){this.modal.activate();s(this.host)}}}render(){return t("div",{ref:e=>this.drawer=e,part:"base",class:{drawer:true,"drawer--open":this.open,[`drawer--${this.placement}`]:true,"drawer--contained":this.contained,"drawer--fixed":!this.contained,"drawer--has-footer":o(this.host,"footer"),"drawer--has-header":!this.noHeader,"drawer--nodismiss":this.noDismiss}},t("div",{ref:e=>this.overlay=e,part:"overlay",class:"drawer__overlay",onClick:()=>this.requestClose("overlay"),tabindex:"-1"}),t("div",{ref:e=>this.panel=e,part:"panel",class:"drawer__panel",role:"dialog","aria-modal":"true","aria-hidden":this.open?"false":"true","aria-label":this.noHeader?this.label:undefined,"aria-labelledby":!this.noHeader?"title":undefined,tabindex:"0"},t("div",{class:"drawer__main"},!this.noHeader&&t("nano-sticker",null,t("div",{part:"header",class:"drawer__header"},t("h2",{part:"title",class:"drawer__title",id:"title"},t("slot",{name:"label"},this.label.length>0?this.label:String.fromCharCode(65279))),t("div",{part:"header-actions",class:"drawer__header-actions"},t("slot",{name:"header-actions"}),!this.noUserDismiss&&t("nano-icon-button",{part:"close-button",exportparts:"base:close-button__base",class:"drawer__close",iconName:"light/times",label:"Close",onClick:()=>this.requestClose("close-button")})))),t("div",{part:"body",class:"drawer__body"},t("slot",null)),t("nano-sticker",{position:"bottom"},t("footer",{part:"footer",class:"drawer__footer"},t("slot",{name:"footer",onSlotchange:this.handleSlotChange}))))))}get host(){return r(this)}static get watchers(){return{hoist:["handleHoistChange"],contained:["handleNoModalChange"],open:["handleOpenChange"]}}};c.style=h;export{c as nano_drawer};
5
5
  //# sourceMappingURL=nano-drawer.entry.js.map