@spectric/ui 0.0.21 → 0.0.23

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 (46) hide show
  1. package/dist/components/dialog/dialog.d.ts +1 -0
  2. package/dist/components/pagination/pagination.d.ts +1 -1
  3. package/dist/components/query_bar/QueryBar.d.ts +30 -10
  4. package/dist/components/query_bar/dateTimePopup.d.ts +2 -0
  5. package/dist/components/query_bar/geojsonPopup.d.ts +2 -0
  6. package/dist/components/query_bar/querylanguage/kuery/functions/geospatial.d.ts +19 -0
  7. package/dist/components/query_bar/querylanguage/outputTypes/toCQL.d.ts +2 -1
  8. package/dist/components/query_bar/querylanguage/outputTypes/toMongo.d.ts +6 -1
  9. package/dist/components/symbols.d.ts +6 -0
  10. package/dist/components/table/cell.d.ts +1 -1
  11. package/dist/components/table/table.d.ts +14 -1
  12. package/dist/custom-elements.json +6 -6
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.es.js +4405 -2803
  15. package/dist/index.es.js.map +1 -1
  16. package/dist/index.umd.js +361 -252
  17. package/dist/index.umd.js.map +1 -1
  18. package/dist/style.css +1 -1
  19. package/package.json +6 -1
  20. package/src/components/dialog/dialog.css.ts +29 -29
  21. package/src/components/dialog/dialog.ts +3 -1
  22. package/src/components/input.css +5 -0
  23. package/src/components/input.ts +50 -41
  24. package/src/components/pagination/pagination.ts +167 -113
  25. package/src/components/query_bar/QueryBar.ts +438 -187
  26. package/src/components/query_bar/dateTimePopup.ts +54 -0
  27. package/src/components/query_bar/geojsonPopup.ts +44 -0
  28. package/src/components/query_bar/querylanguage/kuery/ast/_generated_/kuery.js +1836 -2745
  29. package/src/components/query_bar/querylanguage/kuery/ast/ast.ts +15 -13
  30. package/src/components/query_bar/querylanguage/kuery/ast/kuery.peg +92 -126
  31. package/src/components/query_bar/querylanguage/kuery/functions/geospatial.ts +25 -0
  32. package/src/components/query_bar/querylanguage/kuery/functions/index.ts +9 -7
  33. package/src/components/query_bar/querylanguage/outputTypes/toCQL.ts +56 -34
  34. package/src/components/query_bar/querylanguage/outputTypes/toMongo.ts +46 -34
  35. package/src/components/symbols.ts +6 -0
  36. package/src/components/table/__tests__/table.spec.ts +2 -2
  37. package/src/components/table/cell.ts +28 -11
  38. package/src/components/table/header.ts +3 -2
  39. package/src/components/table/table.css +11 -4
  40. package/src/components/table/table.ts +75 -5
  41. package/src/components/table/virtualBody.ts +8 -3
  42. package/src/components/tooltip/popover.ts +263 -225
  43. package/src/stories/Dialog.stories.ts +59 -0
  44. package/src/stories/QueryBar.stories.ts +46 -37
  45. package/src/stories/fixtures/data.ts +229 -37
  46. package/src/stories/table.stories.ts +77 -29
package/dist/index.umd.js CHANGED
@@ -1,30 +1,30 @@
1
- (function(h,le){typeof exports=="object"&&typeof module<"u"?le(exports):typeof define=="function"&&define.amd?define(["exports"],le):(h=typeof globalThis<"u"?globalThis:h||self,le(h["Spectric-UI"]={}))})(this,function(h){"use strict";/**
1
+ (function(h,be){typeof exports=="object"&&typeof module<"u"?be(exports):typeof define=="function"&&define.amd?define(["exports"],be):(h=typeof globalThis<"u"?globalThis:h||self,be(h["Spectric-UI"]={}))})(this,function(h){"use strict";/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */var Ui;const le=globalThis,Qt=le.ShadowRoot&&(le.ShadyCSS===void 0||le.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qt=Symbol(),Zr=new WeakMap;let Kr=class{constructor(e,s,i){if(this._$cssResult$=!0,i!==qt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=s}get styleSheet(){let e=this.o;const s=this.t;if(Qt&&e===void 0){const i=s!==void 0&&s.length===1;i&&(e=Zr.get(s)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Zr.set(s,e))}return e}toString(){return this.cssText}};const Zs=n=>new Kr(typeof n=="string"?n:n+"",void 0,qt),F=(n,...e)=>{const s=n.length===1?n[0]:e.reduce((i,o,t)=>i+(c=>{if(c._$cssResult$===!0)return c.cssText;if(typeof c=="number")return c;throw Error("Value passed to 'css' function must be a 'css' function result: "+c+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+n[t+1],n[0]);return new Kr(s,n,qt)},Ks=(n,e)=>{if(Qt)n.adoptedStyleSheets=e.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(const s of e){const i=document.createElement("style"),o=le.litNonce;o!==void 0&&i.setAttribute("nonce",o),i.textContent=s.cssText,n.appendChild(i)}},Xr=Qt?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let s="";for(const i of e.cssRules)s+=i.cssText;return Zs(s)})(n):n;/**
5
+ */var ps;const be=globalThis,ui=be.ShadowRoot&&(be.ShadyCSS===void 0||be.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,pi=Symbol(),fr=new WeakMap;let gr=class{constructor(e,i,s){if(this._$cssResult$=!0,s!==pi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o;const i=this.t;if(ui&&e===void 0){const s=i!==void 0&&i.length===1;s&&(e=fr.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&fr.set(i,e))}return e}toString(){return this.cssText}};const Ds=r=>new gr(typeof r=="string"?r:r+"",void 0,pi),Z=(r,...e)=>{const i=r.length===1?r[0]:e.reduce((s,t,a)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(t)+r[a+1],r[0]);return new gr(i,r,pi)},Ns=(r,e)=>{if(ui)r.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(const i of e){const s=document.createElement("style"),t=be.litNonce;t!==void 0&&s.setAttribute("nonce",t),s.textContent=i.cssText,r.appendChild(s)}},br=ui?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let i="";for(const s of e.cssRules)i+=s.cssText;return Ds(i)})(r):r;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:Xs,defineProperty:Gs,getOwnPropertyDescriptor:Js,getOwnPropertyNames:en,getOwnPropertySymbols:tn,getPrototypeOf:rn}=Object,ce=globalThis,Gr=ce.trustedTypes,sn=Gr?Gr.emptyScript:"",Wt=ce.reactiveElementPolyfillSupport,Ke=(n,e)=>n,vt={toAttribute(n,e){switch(e){case Boolean:n=n?sn:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let s=n;switch(e){case Boolean:s=n!==null;break;case Number:s=n===null?null:Number(n);break;case Object:case Array:try{s=JSON.parse(n)}catch{s=null}}return s}},Vt=(n,e)=>!Xs(n,e),Jr={attribute:!0,type:String,converter:vt,reflect:!1,hasChanged:Vt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ce.litPropertyMetadata??(ce.litPropertyMetadata=new WeakMap);class Le extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,s=Jr){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(e,s),!s.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(e,i,s);o!==void 0&&Gs(this.prototype,e,o)}}static getPropertyDescriptor(e,s,i){const{get:o,set:t}=Js(this.prototype,e)??{get(){return this[s]},set(c){this[s]=c}};return{get(){return o==null?void 0:o.call(this)},set(c){const f=o==null?void 0:o.call(this);t.call(this,c),this.requestUpdate(e,f,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Jr}static _$Ei(){if(this.hasOwnProperty(Ke("elementProperties")))return;const e=rn(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ke("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ke("properties"))){const s=this.properties,i=[...en(s),...tn(s)];for(const o of i)this.createProperty(o,s[o])}const e=this[Symbol.metadata];if(e!==null){const s=litPropertyMetadata.get(e);if(s!==void 0)for(const[i,o]of s)this.elementProperties.set(i,o)}this._$Eh=new Map;for(const[s,i]of this.elementProperties){const o=this._$Eu(s,i);o!==void 0&&this._$Eh.set(o,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const s=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const o of i)s.unshift(Xr(o))}else e!==void 0&&s.push(Xr(e));return s}static _$Eu(e,s){const i=s.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(s=>this.enableUpdating=s),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(s=>s(this))}addController(e){var s;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((s=e.hostConnected)==null||s.call(e))}removeController(e){var s;(s=this._$EO)==null||s.delete(e)}_$E_(){const e=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ks(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(s=>{var i;return(i=s.hostConnected)==null?void 0:i.call(s)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(s=>{var i;return(i=s.hostDisconnected)==null?void 0:i.call(s)})}attributeChangedCallback(e,s,i){this._$AK(e,i)}_$EC(e,s){var t;const i=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,i);if(o!==void 0&&i.reflect===!0){const c=(((t=i.converter)==null?void 0:t.toAttribute)!==void 0?i.converter:vt).toAttribute(s,i.type);this._$Em=e,c==null?this.removeAttribute(o):this.setAttribute(o,c),this._$Em=null}}_$AK(e,s){var t;const i=this.constructor,o=i._$Eh.get(e);if(o!==void 0&&this._$Em!==o){const c=i.getPropertyOptions(o),f=typeof c.converter=="function"?{fromAttribute:c.converter}:((t=c.converter)==null?void 0:t.fromAttribute)!==void 0?c.converter:vt;this._$Em=o,this[o]=f.fromAttribute(s,c.type),this._$Em=null}}requestUpdate(e,s,i){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??Vt)(this[e],s))return;this.P(e,s,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,s,i){this._$AL.has(e)||this._$AL.set(e,s),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[t,c]of this._$Ep)this[t]=c;this._$Ep=void 0}const o=this.constructor.elementProperties;if(o.size>0)for(const[t,c]of o)c.wrapped!==!0||this._$AL.has(t)||this[t]===void 0||this.P(t,this[t],c)}let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),(i=this._$EO)==null||i.forEach(o=>{var t;return(t=o.hostUpdate)==null?void 0:t.call(o)}),this.update(s)):this._$EU()}catch(o){throw e=!1,this._$EU(),o}e&&this._$AE(s)}willUpdate(e){}_$AE(e){var s;(s=this._$EO)==null||s.forEach(i=>{var o;return(o=i.hostUpdated)==null?void 0:o.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(s=>this._$EC(s,this[s]))),this._$EU()}updated(e){}firstUpdated(e){}}Le.elementStyles=[],Le.shadowRootOptions={mode:"open"},Le[Ke("elementProperties")]=new Map,Le[Ke("finalized")]=new Map,Wt==null||Wt({ReactiveElement:Le}),(ce.reactiveElementVersions??(ce.reactiveElementVersions=[])).push("2.0.4");/**
9
+ */const{is:Ms,defineProperty:zs,getOwnPropertyDescriptor:Is,getOwnPropertyNames:Rs,getOwnPropertySymbols:js,getPrototypeOf:Bs}=Object,ye=globalThis,yr=ye.trustedTypes,Us=yr?yr.emptyScript:"",hi=ye.reactiveElementPolyfillSupport,bt=(r,e)=>r,Bt={toAttribute(r,e){switch(e){case Boolean:r=r?Us:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let i=r;switch(e){case Boolean:i=r!==null;break;case Number:i=r===null?null:Number(r);break;case Object:case Array:try{i=JSON.parse(r)}catch{i=null}}return i}},di=(r,e)=>!Ms(r,e),vr={attribute:!0,type:String,converter:Bt,reflect:!1,hasChanged:di};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ye.litPropertyMetadata??(ye.litPropertyMetadata=new WeakMap);class Qe extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,i=vr){if(i.state&&(i.attribute=!1),this._$Ei(),this.elementProperties.set(e,i),!i.noAccessor){const s=Symbol(),t=this.getPropertyDescriptor(e,s,i);t!==void 0&&zs(this.prototype,e,t)}}static getPropertyDescriptor(e,i,s){const{get:t,set:a}=Is(this.prototype,e)??{get(){return this[i]},set(o){this[i]=o}};return{get(){return t==null?void 0:t.call(this)},set(o){const d=t==null?void 0:t.call(this);a.call(this,o),this.requestUpdate(e,d,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??vr}static _$Ei(){if(this.hasOwnProperty(bt("elementProperties")))return;const e=Bs(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(bt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(bt("properties"))){const i=this.properties,s=[...Rs(i),...js(i)];for(const t of s)this.createProperty(t,i[t])}const e=this[Symbol.metadata];if(e!==null){const i=litPropertyMetadata.get(e);if(i!==void 0)for(const[s,t]of i)this.elementProperties.set(s,t)}this._$Eh=new Map;for(const[i,s]of this.elementProperties){const t=this._$Eu(i,s);t!==void 0&&this._$Eh.set(t,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const i=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const t of s)i.unshift(br(t))}else e!==void 0&&i.push(br(e));return i}static _$Eu(e,i){const s=i.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(i=>i(this))}addController(e){var i;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)==null||i.call(e))}removeController(e){var i;(i=this._$EO)==null||i.delete(e)}_$E_(){const e=new Map,i=this.constructor.elementProperties;for(const s of i.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ns(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(i=>{var s;return(s=i.hostConnected)==null?void 0:s.call(i)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(i=>{var s;return(s=i.hostDisconnected)==null?void 0:s.call(i)})}attributeChangedCallback(e,i,s){this._$AK(e,s)}_$EC(e,i){var a;const s=this.constructor.elementProperties.get(e),t=this.constructor._$Eu(e,s);if(t!==void 0&&s.reflect===!0){const o=(((a=s.converter)==null?void 0:a.toAttribute)!==void 0?s.converter:Bt).toAttribute(i,s.type);this._$Em=e,o==null?this.removeAttribute(t):this.setAttribute(t,o),this._$Em=null}}_$AK(e,i){var a;const s=this.constructor,t=s._$Eh.get(e);if(t!==void 0&&this._$Em!==t){const o=s.getPropertyOptions(t),d=typeof o.converter=="function"?{fromAttribute:o.converter}:((a=o.converter)==null?void 0:a.fromAttribute)!==void 0?o.converter:Bt;this._$Em=t,this[t]=d.fromAttribute(i,o.type),this._$Em=null}}requestUpdate(e,i,s){if(e!==void 0){if(s??(s=this.constructor.getPropertyOptions(e)),!(s.hasChanged??di)(this[e],i))return;this.P(e,i,s)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,i,s){this._$AL.has(e)||this._$AL.set(e,i),s.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(i){Promise.reject(i)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[a,o]of this._$Ep)this[a]=o;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[a,o]of t)o.wrapped!==!0||this._$AL.has(a)||this[a]===void 0||this.P(a,this[a],o)}let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),(s=this._$EO)==null||s.forEach(t=>{var a;return(a=t.hostUpdate)==null?void 0:a.call(t)}),this.update(i)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(i)}willUpdate(e){}_$AE(e){var i;(i=this._$EO)==null||i.forEach(s=>{var t;return(t=s.hostUpdated)==null?void 0:t.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(i=>this._$EC(i,this[i]))),this._$EU()}updated(e){}firstUpdated(e){}}Qe.elementStyles=[],Qe.shadowRootOptions={mode:"open"},Qe[bt("elementProperties")]=new Map,Qe[bt("finalized")]=new Map,hi==null||hi({ReactiveElement:Qe}),(ye.reactiveElementVersions??(ye.reactiveElementVersions=[])).push("2.0.4");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const Xe=globalThis,bt=Xe.trustedTypes,ei=bt?bt.createPolicy("lit-html",{createHTML:n=>n}):void 0,Yt="$lit$",ne=`lit$${Math.random().toFixed(9).slice(2)}$`,Zt="?"+ne,nn=`<${Zt}>`,me=document,Ge=()=>me.createComment(""),Je=n=>n===null||typeof n!="object"&&typeof n!="function",Kt=Array.isArray,ti=n=>Kt(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Xt=`[
14
- \f\r]`,et=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ri=/-->/g,ii=/>/g,ye=RegExp(`>|${Xt}(?:([^\\s"'>=/]+)(${Xt}*=${Xt}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),si=/'/g,ni=/"/g,oi=/^(?:script|style|textarea|title)$/i,on=n=>(e,...s)=>({_$litType$:n,strings:e,values:s}),w=on(1),pe=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),ai=new WeakMap,$e=me.createTreeWalker(me,129);function li(n,e){if(!Kt(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return ei!==void 0?ei.createHTML(e):e}const ci=(n,e)=>{const s=n.length-1,i=[];let o,t=e===2?"<svg>":e===3?"<math>":"",c=et;for(let f=0;f<s;f++){const d=n[f];let y,C,$=-1,E=0;for(;E<d.length&&(c.lastIndex=E,C=c.exec(d),C!==null);)E=c.lastIndex,c===et?C[1]==="!--"?c=ri:C[1]!==void 0?c=ii:C[2]!==void 0?(oi.test(C[2])&&(o=RegExp("</"+C[2],"g")),c=ye):C[3]!==void 0&&(c=ye):c===ye?C[0]===">"?(c=o??et,$=-1):C[1]===void 0?$=-2:($=c.lastIndex-C[2].length,y=C[1],c=C[3]===void 0?ye:C[3]==='"'?ni:si):c===ni||c===si?c=ye:c===ri||c===ii?c=et:(c=ye,o=void 0);const x=c===ye&&n[f+1].startsWith("/>")?" ":"";t+=c===et?d+nn:$>=0?(i.push(y),d.slice(0,$)+Yt+d.slice($)+ne+x):d+ne+($===-2?f:x)}return[li(n,t+(n[s]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class tt{constructor({strings:e,_$litType$:s},i){let o;this.parts=[];let t=0,c=0;const f=e.length-1,d=this.parts,[y,C]=ci(e,s);if(this.el=tt.createElement(y,i),$e.currentNode=this.el.content,s===2||s===3){const $=this.el.content.firstChild;$.replaceWith(...$.childNodes)}for(;(o=$e.nextNode())!==null&&d.length<f;){if(o.nodeType===1){if(o.hasAttributes())for(const $ of o.getAttributeNames())if($.endsWith(Yt)){const E=C[c++],x=o.getAttribute($).split(ne),k=/([.?@])?(.*)/.exec(E);d.push({type:1,index:t,name:k[2],strings:x,ctor:k[1]==="."?ui:k[1]==="?"?hi:k[1]==="@"?di:rt}),o.removeAttribute($)}else $.startsWith(ne)&&(d.push({type:6,index:t}),o.removeAttribute($));if(oi.test(o.tagName)){const $=o.textContent.split(ne),E=$.length-1;if(E>0){o.textContent=bt?bt.emptyScript:"";for(let x=0;x<E;x++)o.append($[x],Ge()),$e.nextNode(),d.push({type:2,index:++t});o.append($[E],Ge())}}}else if(o.nodeType===8)if(o.data===Zt)d.push({type:2,index:t});else{let $=-1;for(;($=o.data.indexOf(ne,$+1))!==-1;)d.push({type:7,index:t}),$+=ne.length-1}t++}}static createElement(e,s){const i=me.createElement("template");return i.innerHTML=e,i}}function we(n,e,s=n,i){var c,f;if(e===pe)return e;let o=i!==void 0?(c=s._$Co)==null?void 0:c[i]:s._$Cl;const t=Je(e)?void 0:e._$litDirective$;return(o==null?void 0:o.constructor)!==t&&((f=o==null?void 0:o._$AO)==null||f.call(o,!1),t===void 0?o=void 0:(o=new t(n),o._$AT(n,s,i)),i!==void 0?(s._$Co??(s._$Co=[]))[i]=o:s._$Cl=o),o!==void 0&&(e=we(n,o._$AS(n,e.values),o,i)),e}let pi=class{constructor(e,s){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:s},parts:i}=this._$AD,o=((e==null?void 0:e.creationScope)??me).importNode(s,!0);$e.currentNode=o;let t=$e.nextNode(),c=0,f=0,d=i[0];for(;d!==void 0;){if(c===d.index){let y;d.type===2?y=new ze(t,t.nextSibling,this,e):d.type===1?y=new d.ctor(t,d.name,d.strings,this,e):d.type===6&&(y=new fi(t,this,e)),this._$AV.push(y),d=i[++f]}c!==(d==null?void 0:d.index)&&(t=$e.nextNode(),c++)}return $e.currentNode=me,o}p(e){let s=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,s),s+=i.strings.length-2):i._$AI(e[s])),s++}};class ze{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,s,i,o){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=e,this._$AB=s,this._$AM=i,this.options=o,this._$Cv=(o==null?void 0:o.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const s=this._$AM;return s!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=s.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,s=this){e=we(this,e,s),Je(e)?e===P||e==null||e===""?(this._$AH!==P&&this._$AR(),this._$AH=P):e!==this._$AH&&e!==pe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ti(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==P&&Je(this._$AH)?this._$AA.nextSibling.data=e:this.T(me.createTextNode(e)),this._$AH=e}$(e){var t;const{values:s,_$litType$:i}=e,o=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=tt.createElement(li(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)==null?void 0:t._$AD)===o)this._$AH.p(s);else{const c=new pi(o,this),f=c.u(this.options);c.p(s),this.T(f),this._$AH=c}}_$AC(e){let s=ai.get(e.strings);return s===void 0&&ai.set(e.strings,s=new tt(e)),s}k(e){Kt(this._$AH)||(this._$AH=[],this._$AR());const s=this._$AH;let i,o=0;for(const t of e)o===s.length?s.push(i=new ze(this.O(Ge()),this.O(Ge()),this,this.options)):i=s[o],i._$AI(t),o++;o<s.length&&(this._$AR(i&&i._$AB.nextSibling,o),s.length=o)}_$AR(e=this._$AA.nextSibling,s){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,s);e&&e!==this._$AB;){const o=e.nextSibling;e.remove(),e=o}}setConnected(e){var s;this._$AM===void 0&&(this._$Cv=e,(s=this._$AP)==null||s.call(this,e))}}class rt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,s,i,o,t){this.type=1,this._$AH=P,this._$AN=void 0,this.element=e,this.name=s,this._$AM=o,this.options=t,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=P}_$AI(e,s=this,i,o){const t=this.strings;let c=!1;if(t===void 0)e=we(this,e,s,0),c=!Je(e)||e!==this._$AH&&e!==pe,c&&(this._$AH=e);else{const f=e;let d,y;for(e=t[0],d=0;d<t.length-1;d++)y=we(this,f[i+d],s,d),y===pe&&(y=this._$AH[d]),c||(c=!Je(y)||y!==this._$AH[d]),y===P?e=P:e!==P&&(e+=(y??"")+t[d+1]),this._$AH[d]=y}c&&!o&&this.j(e)}j(e){e===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ui extends rt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===P?void 0:e}}class hi extends rt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==P)}}class di extends rt{constructor(e,s,i,o,t){super(e,s,i,o,t),this.type=5}_$AI(e,s=this){if((e=we(this,e,s,0)??P)===pe)return;const i=this._$AH,o=e===P&&i!==P||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,t=e!==P&&(i===P||o);o&&this.element.removeEventListener(this.name,this,i),t&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var s;typeof this._$AH=="function"?this._$AH.call(((s=this.options)==null?void 0:s.host)??this.element,e):this._$AH.handleEvent(e)}}class fi{constructor(e,s,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=s,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){we(this,e)}}const an={M:Yt,P:ne,A:Zt,C:1,L:ci,R:pi,D:ti,V:we,I:ze,H:rt,N:hi,U:di,B:ui,F:fi},Gt=Xe.litHtmlPolyfillSupport;Gt==null||Gt(tt,ze),(Xe.litHtmlVersions??(Xe.litHtmlVersions=[])).push("3.2.1");const mt=(n,e,s)=>{const i=(s==null?void 0:s.renderBefore)??e;let o=i._$litPart$;if(o===void 0){const t=(s==null?void 0:s.renderBefore)??null;i._$litPart$=o=new ze(e.insertBefore(Ge(),t),t,void 0,s??{})}return o._$AI(n),o};/**
13
+ */const yt=globalThis,Ut=yt.trustedTypes,mr=Ut?Ut.createPolicy("lit-html",{createHTML:r=>r}):void 0,fi="$lit$",ue=`lit$${Math.random().toFixed(9).slice(2)}$`,gi="?"+ue,Hs=`<${gi}>`,Ee=document,vt=()=>Ee.createComment(""),mt=r=>r===null||typeof r!="object"&&typeof r!="function",bi=Array.isArray,$r=r=>bi(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",yi=`[
14
+ \f\r]`,$t=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_r=/-->/g,wr=/>/g,Ae=RegExp(`>|${yi}(?:([^\\s"'>=/]+)(${yi}*=${yi}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Sr=/'/g,xr=/"/g,kr=/^(?:script|style|textarea|title)$/i,Fs=r=>(e,...i)=>({_$litType$:r,strings:e,values:i}),$=Fs(1),ve=Symbol.for("lit-noChange"),M=Symbol.for("lit-nothing"),Er=new WeakMap,Ce=Ee.createTreeWalker(Ee,129);function Ar(r,e){if(!bi(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return mr!==void 0?mr.createHTML(e):e}const Cr=(r,e)=>{const i=r.length-1,s=[];let t,a=e===2?"<svg>":e===3?"<math>":"",o=$t;for(let d=0;d<i;d++){const c=r[d];let b,_,y=-1,C=0;for(;C<c.length&&(o.lastIndex=C,_=o.exec(c),_!==null);)C=o.lastIndex,o===$t?_[1]==="!--"?o=_r:_[1]!==void 0?o=wr:_[2]!==void 0?(kr.test(_[2])&&(t=RegExp("</"+_[2],"g")),o=Ae):_[3]!==void 0&&(o=Ae):o===Ae?_[0]===">"?(o=t??$t,y=-1):_[1]===void 0?y=-2:(y=o.lastIndex-_[2].length,b=_[1],o=_[3]===void 0?Ae:_[3]==='"'?xr:Sr):o===xr||o===Sr?o=Ae:o===_r||o===wr?o=$t:(o=Ae,t=void 0);const w=o===Ae&&r[d+1].startsWith("/>")?" ":"";a+=o===$t?c+Hs:y>=0?(s.push(b),c.slice(0,y)+fi+c.slice(y)+ue+w):c+ue+(y===-2?d:w)}return[Ar(r,a+(r[i]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};class _t{constructor({strings:e,_$litType$:i},s){let t;this.parts=[];let a=0,o=0;const d=e.length-1,c=this.parts,[b,_]=Cr(e,i);if(this.el=_t.createElement(b,s),Ce.currentNode=this.el.content,i===2||i===3){const y=this.el.content.firstChild;y.replaceWith(...y.childNodes)}for(;(t=Ce.nextNode())!==null&&c.length<d;){if(t.nodeType===1){if(t.hasAttributes())for(const y of t.getAttributeNames())if(y.endsWith(fi)){const C=_[o++],w=t.getAttribute(y).split(ue),S=/([.?@])?(.*)/.exec(C);c.push({type:1,index:a,name:S[2],strings:w,ctor:S[1]==="."?Pr:S[1]==="?"?Tr:S[1]==="@"?Lr:wt}),t.removeAttribute(y)}else y.startsWith(ue)&&(c.push({type:6,index:a}),t.removeAttribute(y));if(kr.test(t.tagName)){const y=t.textContent.split(ue),C=y.length-1;if(C>0){t.textContent=Ut?Ut.emptyScript:"";for(let w=0;w<C;w++)t.append(y[w],vt()),Ce.nextNode(),c.push({type:2,index:++a});t.append(y[C],vt())}}}else if(t.nodeType===8)if(t.data===gi)c.push({type:2,index:a});else{let y=-1;for(;(y=t.data.indexOf(ue,y+1))!==-1;)c.push({type:7,index:a}),y+=ue.length-1}a++}}static createElement(e,i){const s=Ee.createElement("template");return s.innerHTML=e,s}}function Oe(r,e,i=r,s){var o,d;if(e===ve)return e;let t=s!==void 0?(o=i._$Co)==null?void 0:o[s]:i._$Cl;const a=mt(e)?void 0:e._$litDirective$;return(t==null?void 0:t.constructor)!==a&&((d=t==null?void 0:t._$AO)==null||d.call(t,!1),a===void 0?t=void 0:(t=new a(r),t._$AT(r,i,s)),s!==void 0?(i._$Co??(i._$Co=[]))[s]=t:i._$Cl=t),t!==void 0&&(e=Oe(r,t._$AS(r,e.values),t,s)),e}let Or=class{constructor(e,i){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:i},parts:s}=this._$AD,t=((e==null?void 0:e.creationScope)??Ee).importNode(i,!0);Ce.currentNode=t;let a=Ce.nextNode(),o=0,d=0,c=s[0];for(;c!==void 0;){if(o===c.index){let b;c.type===2?b=new qe(a,a.nextSibling,this,e):c.type===1?b=new c.ctor(a,c.name,c.strings,this,e):c.type===6&&(b=new Dr(a,this,e)),this._$AV.push(b),c=s[++d]}o!==(c==null?void 0:c.index)&&(a=Ce.nextNode(),o++)}return Ce.currentNode=Ee,t}p(e){let i=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,i),i+=s.strings.length-2):s._$AI(e[i])),i++}};class qe{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,i,s,t){this.type=2,this._$AH=M,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=s,this.options=t,this._$Cv=(t==null?void 0:t.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const i=this._$AM;return i!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=i.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,i=this){e=Oe(this,e,i),mt(e)?e===M||e==null||e===""?(this._$AH!==M&&this._$AR(),this._$AH=M):e!==this._$AH&&e!==ve&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):$r(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==M&&mt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ee.createTextNode(e)),this._$AH=e}$(e){var a;const{values:i,_$litType$:s}=e,t=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=_t.createElement(Ar(s.h,s.h[0]),this.options)),s);if(((a=this._$AH)==null?void 0:a._$AD)===t)this._$AH.p(i);else{const o=new Or(t,this),d=o.u(this.options);o.p(i),this.T(d),this._$AH=o}}_$AC(e){let i=Er.get(e.strings);return i===void 0&&Er.set(e.strings,i=new _t(e)),i}k(e){bi(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,t=0;for(const a of e)t===i.length?i.push(s=new qe(this.O(vt()),this.O(vt()),this,this.options)):s=i[t],s._$AI(a),t++;t<i.length&&(this._$AR(s&&s._$AB.nextSibling,t),i.length=t)}_$AR(e=this._$AA.nextSibling,i){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,i);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var i;this._$AM===void 0&&(this._$Cv=e,(i=this._$AP)==null||i.call(this,e))}}class wt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,i,s,t,a){this.type=1,this._$AH=M,this._$AN=void 0,this.element=e,this.name=i,this._$AM=t,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=M}_$AI(e,i=this,s,t){const a=this.strings;let o=!1;if(a===void 0)e=Oe(this,e,i,0),o=!mt(e)||e!==this._$AH&&e!==ve,o&&(this._$AH=e);else{const d=e;let c,b;for(e=a[0],c=0;c<a.length-1;c++)b=Oe(this,d[s+c],i,c),b===ve&&(b=this._$AH[c]),o||(o=!mt(b)||b!==this._$AH[c]),b===M?e=M:e!==M&&(e+=(b??"")+a[c+1]),this._$AH[c]=b}o&&!t&&this.j(e)}j(e){e===M?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Pr extends wt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===M?void 0:e}}class Tr extends wt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==M)}}class Lr extends wt{constructor(e,i,s,t,a){super(e,i,s,t,a),this.type=5}_$AI(e,i=this){if((e=Oe(this,e,i,0)??M)===ve)return;const s=this._$AH,t=e===M&&s!==M||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,a=e!==M&&(s===M||t);t&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var i;typeof this._$AH=="function"?this._$AH.call(((i=this.options)==null?void 0:i.host)??this.element,e):this._$AH.handleEvent(e)}}class Dr{constructor(e,i,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){Oe(this,e)}}const Qs={M:fi,P:ue,A:gi,C:1,L:Cr,R:Or,D:$r,V:Oe,I:qe,H:wt,N:Tr,U:Lr,B:Pr,F:Dr},vi=yt.litHtmlPolyfillSupport;vi==null||vi(_t,qe),(yt.litHtmlVersions??(yt.litHtmlVersions=[])).push("3.2.1");const Ht=(r,e,i)=>{const s=(i==null?void 0:i.renderBefore)??e;let t=s._$litPart$;if(t===void 0){const a=(i==null?void 0:i.renderBefore)??null;s._$litPart$=t=new qe(e.insertBefore(vt(),a),a,void 0,i??{})}return t._$AI(r),t};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */let z=class extends Le{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var s;const e=super.createRenderRoot();return(s=this.renderOptions).renderBefore??(s.renderBefore=e.firstChild),e}update(e){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=mt(s,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return pe}};z._$litElement$=!0,z.finalized=!0,(Ui=globalThis.litElementHydrateSupport)==null||Ui.call(globalThis,{LitElement:z});const Jt=globalThis.litElementPolyfillSupport;Jt==null||Jt({LitElement:z}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");/**
19
+ */let B=class extends Qe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var i;const e=super.createRenderRoot();return(i=this.renderOptions).renderBefore??(i.renderBefore=e.firstChild),e}update(e){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ht(i,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return ve}};B._$litElement$=!0,B.finalized=!0,(ps=globalThis.litElementHydrateSupport)==null||ps.call(globalThis,{LitElement:B});const mi=globalThis.litElementPolyfillSupport;mi==null||mi({LitElement:B}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");/**
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
- */const er={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},it=n=>(...e)=>({_$litDirective$:n,values:e});let yt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,s,i){this._$Ct=e,this._$AM=s,this._$Ci=i}_$AS(e,s){return this.update(e,s)}update(e,s){return this.render(...s)}};/**
23
+ */const $i={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},St=r=>(...e)=>({_$litDirective$:r,values:e});let Ft=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,i,s){this._$Ct=e,this._$AM=i,this._$Ci=s}_$AS(e,i){return this.update(e,i)}update(e,i){return this.render(...i)}};/**
24
24
  * @license
25
25
  * Copyright 2018 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const gi="important",ln=" !"+gi,tr=it(class extends yt{constructor(n){var e;if(super(n),n.type!==er.ATTRIBUTE||n.name!=="style"||((e=n.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(n){return Object.keys(n).reduce((e,s)=>{const i=n[s];return i==null?e:e+`${s=s.includes("-")?s:s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(n,[e]){const{style:s}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?s.removeProperty(i):s[i]=null);for(const i in e){const o=e[i];if(o!=null){this.ft.add(i);const t=typeof o=="string"&&o.endsWith(ln);i.includes("-")||t?s.setProperty(i,t?o.slice(0,-11):o,t?gi:""):s[i]=o}}return pe}}),cn=F`
27
+ */const Nr="important",qs=" !"+Nr,_i=St(class extends Ft{constructor(r){var e;if(super(r),r.type!==$i.ATTRIBUTE||r.name!=="style"||((e=r.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((e,i)=>{const s=r[i];return s==null?e:e+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(r,[e]){const{style:i}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const s of this.ft)e[s]==null&&(this.ft.delete(s),s.includes("-")?i.removeProperty(s):i[s]=null);for(const s in e){const t=e[s];if(t!=null){this.ft.add(s);const a=typeof t=="string"&&t.endsWith(qs);s.includes("-")||a?i.setProperty(s,a?t.slice(0,-11):t,a?Nr:""):i[s]=t}}return ve}}),Vs=Z`
28
28
  :host{
29
29
  display: inline-block;
30
30
  --text-on-color: var(--spectric-text-on-color, #ffffff);
@@ -282,72 +282,72 @@ opacity:1
282
282
  * @license
283
283
  * Copyright 2017 Google LLC
284
284
  * SPDX-License-Identifier: BSD-3-Clause
285
- */const T=n=>(e,s)=>{s!==void 0?s.addInitializer(()=>{customElements.define(n,e)}):customElements.define(n,e)};/**
285
+ */const I=r=>(e,i)=>{i!==void 0?i.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)};/**
286
286
  * @license
287
287
  * Copyright 2017 Google LLC
288
288
  * SPDX-License-Identifier: BSD-3-Clause
289
- */const pn={attribute:!0,type:String,converter:vt,reflect:!1,hasChanged:Vt},un=(n=pn,e,s)=>{const{kind:i,metadata:o}=s;let t=globalThis.litPropertyMetadata.get(o);if(t===void 0&&globalThis.litPropertyMetadata.set(o,t=new Map),t.set(s.name,n),i==="accessor"){const{name:c}=s;return{set(f){const d=e.get.call(this);e.set.call(this,f),this.requestUpdate(c,d,n)},init(f){return f!==void 0&&this.P(c,void 0,n),f}}}if(i==="setter"){const{name:c}=s;return function(f){const d=this[c];e.call(this,f),this.requestUpdate(c,d,n)}}throw Error("Unsupported decorator location: "+i)};function v(n){return(e,s)=>typeof s=="object"?un(n,e,s):((i,o,t)=>{const c=o.hasOwnProperty(t);return o.constructor.createProperty(t,c?{...i,wrapped:!0}:i),c?Object.getOwnPropertyDescriptor(o,t):void 0})(n,e,s)}/**
289
+ */const Ws={attribute:!0,type:String,converter:Bt,reflect:!1,hasChanged:di},Gs=(r=Ws,e,i)=>{const{kind:s,metadata:t}=i;let a=globalThis.litPropertyMetadata.get(t);if(a===void 0&&globalThis.litPropertyMetadata.set(t,a=new Map),a.set(i.name,r),s==="accessor"){const{name:o}=i;return{set(d){const c=e.get.call(this);e.set.call(this,d),this.requestUpdate(o,c,r)},init(d){return d!==void 0&&this.P(o,void 0,r),d}}}if(s==="setter"){const{name:o}=i;return function(d){const c=this[o];e.call(this,d),this.requestUpdate(o,c,r)}}throw Error("Unsupported decorator location: "+s)};function g(r){return(e,i)=>typeof i=="object"?Gs(r,e,i):((s,t,a)=>{const o=t.hasOwnProperty(a);return t.constructor.createProperty(a,o?{...s,wrapped:!0}:s),o?Object.getOwnPropertyDescriptor(t,a):void 0})(r,e,i)}/**
290
290
  * @license
291
291
  * Copyright 2017 Google LLC
292
292
  * SPDX-License-Identifier: BSD-3-Clause
293
- */function Q(n){return v({...n,state:!0,attribute:!1})}/**
293
+ */function W(r){return g({...r,state:!0,attribute:!1})}/**
294
294
  * @license
295
295
  * Copyright 2017 Google LLC
296
296
  * SPDX-License-Identifier: BSD-3-Clause
297
- */function _e(n){return(e,s)=>{const i=typeof e=="function"?e:e[s];Object.assign(i,n)}}/**
297
+ */function Pe(r){return(e,i)=>{const s=typeof e=="function"?e:e[i];Object.assign(s,r)}}/**
298
298
  * @license
299
299
  * Copyright 2017 Google LLC
300
300
  * SPDX-License-Identifier: BSD-3-Clause
301
- */const vi=(n,e,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(n,e,s),s);/**
301
+ */const Mr=(r,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,i),i);/**
302
302
  * @license
303
303
  * Copyright 2017 Google LLC
304
304
  * SPDX-License-Identifier: BSD-3-Clause
305
- */function ue(n,e){return(s,i,o)=>{const t=c=>{var f;return((f=c.renderRoot)==null?void 0:f.querySelector(n))??null};return vi(s,i,{get(){return t(this)}})}}/**
305
+ */function pe(r,e){return(i,s,t)=>{const a=o=>{var d;return((d=o.renderRoot)==null?void 0:d.querySelector(r))??null};return Mr(i,s,{get(){return a(this)}})}}/**
306
306
  * @license
307
307
  * Copyright 2017 Google LLC
308
308
  * SPDX-License-Identifier: BSD-3-Clause
309
- */function st(n){return(e,s)=>vi(e,s,{async get(){var i;return await this.updateComplete,((i=this.renderRoot)==null?void 0:i.querySelector(n))??null}})}let rr=0;const bi=()=>rr;class mi{constructor(e,s,i,o){this._handler=i,this._type=s,this._handler=i,this._options=o||!1,e instanceof Promise?e.then(t=>{this._handler&&(this._node=t,this._node.addEventListener(this._type,this._handler,this._options))}):typeof e=="function"?(this._node=e(),this._node.addEventListener(this._type,this._handler,this._options)):(this._node=e,this._node.addEventListener(this._type,this._handler,this._options)),rr+=1}dispose(){this._handler&&(this._node&&(rr-=1,this._node.removeEventListener(this._type,this._handler,this._options)),this._node=void 0,this._handler=void 0)}}class K extends z{constructor(){super(...arguments),this._disposables=new Set,this._isDisposed=!1,this._disposableListeners=[],this._connected=!1}addDisposableListener(e,s,i,o){if(this._disposableListeners.find(c=>c.event===s&&c.target===e&&c.handler===i)){console.warn("Event handler already exists best practice is to add the this in the constructor");return}this._disposableListeners.push({target:e,event:s,handler:i,options:o}),this._connected&&this.registerDisposable(new mi(e,s,i,o))}registerDisposable(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?console.warn(new Error("Trying to add a disposable to something that has already been disposed of. The added object will be leaked!").stack):this._disposables.add(e),e}connectedCallback(){super.connectedCallback(),this._connected=!0,this._isDisposed=!1,this._disposableListeners.forEach(({target:e,event:s,handler:i,options:o})=>{this.registerDisposable(new mi(e,s,i,o))})}disconnectedCallback(){super.disconnectedCallback(),this._connected=!1,this._disposables.forEach(e=>{e.dispose()}),this._isDisposed=!0}}var hn=Object.defineProperty,dn=Object.getOwnPropertyDescriptor,X=(n,e,s,i)=>{for(var o=i>1?void 0:i?dn(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&hn(e,s,o),o},ir=(n=>(n.large="large",n.medium="medium",n.small="small",n.xsmall="xsmall",n.xxsmall="xxsmall",n.tiny="tiny",n))(ir||{}),sr=(n=>(n.primary="primary",n.secondary="secondary",n.text="text",n))(sr||{});const fn={primary:"spectric-button--primary",secondary:"spectric-button--secondary",text:"spectric-button--text"};h.SpectricButton=class extends K{constructor(){super(),this.variant="primary",this.disabled=!1,this.size="small",this.label="",this.danger=!1,this.icon=!1,this.tooltipPosition="right",this.addDisposableListener(this,"click",this._onClick,{capture:!0}),this._onClick=this._onClick.bind(this)}_onClick(e){if(!(e instanceof CustomEvent)&&this.disabled){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}}updated(e){this.tooltip&&this.tooltip!==""&&mt(w`<spectric-tooltip slot="tooltip" .text=${this.tooltip} .position=${this.tooltipPosition||"right"}></spectric-tooltip>`,this)}render(){const e=fn[this.variant]||"spectric-button--primary";return w`
309
+ */function xt(r){return(e,i)=>Mr(e,i,{async get(){var s;return await this.updateComplete,((s=this.renderRoot)==null?void 0:s.querySelector(r))??null}})}let wi=0;const zr=()=>wi;class Ir{constructor(e,i,s,t){this._handler=s,this._type=i,this._handler=s,this._options=t||!1,e instanceof Promise?e.then(a=>{this._handler&&(this._node=a,this._node.addEventListener(this._type,this._handler,this._options))}):typeof e=="function"?(this._node=e(),this._node.addEventListener(this._type,this._handler,this._options)):(this._node=e,this._node.addEventListener(this._type,this._handler,this._options)),wi+=1}dispose(){this._handler&&(this._node&&(wi-=1,this._node.removeEventListener(this._type,this._handler,this._options)),this._node=void 0,this._handler=void 0)}}class re extends B{constructor(){super(...arguments),this._disposables=new Set,this._isDisposed=!1,this._disposableListeners=[],this._connected=!1}addDisposableListener(e,i,s,t){if(this._disposableListeners.find(o=>o.event===i&&o.target===e&&o.handler===s)){console.warn("Event handler already exists best practice is to add the this in the constructor");return}this._disposableListeners.push({target:e,event:i,handler:s,options:t}),this._connected&&this.registerDisposable(new Ir(e,i,s,t))}registerDisposable(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?console.warn(new Error("Trying to add a disposable to something that has already been disposed of. The added object will be leaked!").stack):this._disposables.add(e),e}connectedCallback(){super.connectedCallback(),this._connected=!0,this._isDisposed=!1,this._disposableListeners.forEach(({target:e,event:i,handler:s,options:t})=>{this.registerDisposable(new Ir(e,i,s,t))})}disconnectedCallback(){super.disconnectedCallback(),this._connected=!1,this._disposables.forEach(e=>{e.dispose()}),this._isDisposed=!0}}var Ys=Object.defineProperty,Zs=Object.getOwnPropertyDescriptor,se=(r,e,i,s)=>{for(var t=s>1?void 0:s?Zs(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&Ys(e,i,t),t},Si=(r=>(r.large="large",r.medium="medium",r.small="small",r.xsmall="xsmall",r.xxsmall="xxsmall",r.tiny="tiny",r))(Si||{}),xi=(r=>(r.primary="primary",r.secondary="secondary",r.text="text",r))(xi||{});const Js={primary:"spectric-button--primary",secondary:"spectric-button--secondary",text:"spectric-button--text"};h.SpectricButton=class extends re{constructor(){super(),this.variant="primary",this.disabled=!1,this.size="small",this.label="",this.danger=!1,this.icon=!1,this.tooltipPosition="right",this.addDisposableListener(this,"click",this._onClick,{capture:!0}),this._onClick=this._onClick.bind(this)}_onClick(e){if(!(e instanceof CustomEvent)&&this.disabled){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}}updated(e){this.tooltip&&this.tooltip!==""&&Ht($`<spectric-tooltip slot="tooltip" .text=${this.tooltip} .position=${this.tooltipPosition||"right"}></spectric-tooltip>`,this)}render(){const e=Js[this.variant]||"spectric-button--primary";return $`
310
310
  <slot name="tooltip"></slot>
311
311
  <button
312
312
  type="button"
313
313
  ?disabled=${this.disabled}
314
314
  class=${["spectric-button",`spectric-button-danger--${this.danger||!1}`,`spectric-button--${this.size||"medium"}`,e].join(" ")}
315
- style=${tr({backgroundColor:this.backgroundColor})}
315
+ style=${_i({backgroundColor:this.backgroundColor})}
316
316
  >
317
317
  <span class="animation"></span>
318
318
  <slot>${this.label}</slot>
319
319
  </button>
320
- `}},h.SpectricButton.styles=cn,X([v({type:String,reflect:!0})],h.SpectricButton.prototype,"variant",2),X([v({type:Boolean,reflect:!0})],h.SpectricButton.prototype,"disabled",2),X([v({type:String,reflect:!0})],h.SpectricButton.prototype,"backgroundColor",2),X([v({type:String,reflect:!0})],h.SpectricButton.prototype,"size",2),X([v({type:String,reflect:!0})],h.SpectricButton.prototype,"label",2),X([v({type:Boolean,reflect:!0})],h.SpectricButton.prototype,"danger",2),X([v({type:Boolean,reflect:!0})],h.SpectricButton.prototype,"icon",2),X([v({type:String,reflect:!0})],h.SpectricButton.prototype,"tooltip",2),X([v({type:String,reflect:!0})],h.SpectricButton.prototype,"tooltipPosition",2),h.SpectricButton=X([T("spectric-button")],h.SpectricButton);/**
320
+ `}},h.SpectricButton.styles=Vs,se([g({type:String,reflect:!0})],h.SpectricButton.prototype,"variant",2),se([g({type:Boolean,reflect:!0})],h.SpectricButton.prototype,"disabled",2),se([g({type:String,reflect:!0})],h.SpectricButton.prototype,"backgroundColor",2),se([g({type:String,reflect:!0})],h.SpectricButton.prototype,"size",2),se([g({type:String,reflect:!0})],h.SpectricButton.prototype,"label",2),se([g({type:Boolean,reflect:!0})],h.SpectricButton.prototype,"danger",2),se([g({type:Boolean,reflect:!0})],h.SpectricButton.prototype,"icon",2),se([g({type:String,reflect:!0})],h.SpectricButton.prototype,"tooltip",2),se([g({type:String,reflect:!0})],h.SpectricButton.prototype,"tooltipPosition",2),h.SpectricButton=se([I("spectric-button")],h.SpectricButton);/**
321
321
  * @license
322
322
  * Copyright 2020 Google LLC
323
323
  * SPDX-License-Identifier: BSD-3-Clause
324
- */const{I:gn}=an,yi=(n,e)=>(n==null?void 0:n._$litType$)!==void 0,vn=n=>{var e;return((e=n==null?void 0:n._$litType$)==null?void 0:e.h)!=null},bn=n=>n.strings===void 0,$i=()=>document.createComment(""),Se=(n,e,s)=>{var t;const i=n._$AA.parentNode,o=e===void 0?n._$AB:e._$AA;if(s===void 0){const c=i.insertBefore($i(),o),f=i.insertBefore($i(),o);s=new gn(c,f,n,n.options)}else{const c=s._$AB.nextSibling,f=s._$AM,d=f!==n;if(d){let y;(t=s._$AQ)==null||t.call(s,n),s._$AM=n,s._$AP!==void 0&&(y=n._$AU)!==f._$AU&&s._$AP(y)}if(c!==o||d){let y=s._$AA;for(;y!==c;){const C=y.nextSibling;i.insertBefore(y,o),y=C}}}return s},Ae=(n,e,s=n)=>(n._$AI(e,s),n),mn={},nr=(n,e=mn)=>n._$AH=e,or=n=>n._$AH,ar=n=>{var i;(i=n._$AP)==null||i.call(n,!1,!0);let e=n._$AA;const s=n._$AB.nextSibling;for(;e!==s;){const o=e.nextSibling;e.remove(),e=o}},yn=n=>{n._$AR()};/**
324
+ */const{I:Ks}=Qs,Rr=(r,e)=>(r==null?void 0:r._$litType$)!==void 0,Xs=r=>{var e;return((e=r==null?void 0:r._$litType$)==null?void 0:e.h)!=null},en=r=>r.strings===void 0,jr=()=>document.createComment(""),Te=(r,e,i)=>{var a;const s=r._$AA.parentNode,t=e===void 0?r._$AB:e._$AA;if(i===void 0){const o=s.insertBefore(jr(),t),d=s.insertBefore(jr(),t);i=new Ks(o,d,r,r.options)}else{const o=i._$AB.nextSibling,d=i._$AM,c=d!==r;if(c){let b;(a=i._$AQ)==null||a.call(i,r),i._$AM=r,i._$AP!==void 0&&(b=r._$AU)!==d._$AU&&i._$AP(b)}if(o!==t||c){let b=i._$AA;for(;b!==o;){const _=b.nextSibling;s.insertBefore(b,t),b=_}}}return i},Le=(r,e,i=r)=>(r._$AI(e,i),r),tn={},ki=(r,e=tn)=>r._$AH=e,Ei=r=>r._$AH,Ai=r=>{var s;(s=r._$AP)==null||s.call(r,!1,!0);let e=r._$AA;const i=r._$AB.nextSibling;for(;e!==i;){const t=e.nextSibling;e.remove(),e=t}},rn=r=>{r._$AR()};/**
325
325
  * @license
326
326
  * Copyright 2017 Google LLC
327
327
  * SPDX-License-Identifier: BSD-3-Clause
328
- */const nt=(n,e)=>{var i;const s=n._$AN;if(s===void 0)return!1;for(const o of s)(i=o._$AO)==null||i.call(o,e,!1),nt(o,e);return!0},$t=n=>{let e,s;do{if((e=n._$AM)===void 0)break;s=e._$AN,s.delete(n),n=e}while((s==null?void 0:s.size)===0)},wi=n=>{for(let e;e=n._$AM;n=e){let s=e._$AN;if(s===void 0)e._$AN=s=new Set;else if(s.has(n))break;s.add(n),_n(e)}};function $n(n){this._$AN!==void 0?($t(this),this._$AM=n,wi(this)):this._$AM=n}function wn(n,e=!1,s=0){const i=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(i))for(let t=s;t<i.length;t++)nt(i[t],!1),$t(i[t]);else i!=null&&(nt(i,!1),$t(i));else nt(this,n)}const _n=n=>{n.type==er.CHILD&&(n._$AP??(n._$AP=wn),n._$AQ??(n._$AQ=$n))};class _i extends yt{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,s,i){super._$AT(e,s,i),wi(this),this.isConnected=e._$AU}_$AO(e,s=!0){var i,o;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(o=this.disconnected)==null||o.call(this)),s&&(nt(this,e),$t(this))}setValue(e){if(bn(this._$Ct))this._$Ct._$AI(e,this);else{const s=[...this._$Ct._$AH];s[this._$Ci]=e,this._$Ct._$AI(s,this,0)}}disconnected(){}reconnected(){}}/**
328
+ */const kt=(r,e)=>{var s;const i=r._$AN;if(i===void 0)return!1;for(const t of i)(s=t._$AO)==null||s.call(t,e,!1),kt(t,e);return!0},Qt=r=>{let e,i;do{if((e=r._$AM)===void 0)break;i=e._$AN,i.delete(r),r=e}while((i==null?void 0:i.size)===0)},Br=r=>{for(let e;e=r._$AM;r=e){let i=e._$AN;if(i===void 0)e._$AN=i=new Set;else if(i.has(r))break;i.add(r),on(e)}};function sn(r){this._$AN!==void 0?(Qt(this),this._$AM=r,Br(this)):this._$AM=r}function nn(r,e=!1,i=0){const s=this._$AH,t=this._$AN;if(t!==void 0&&t.size!==0)if(e)if(Array.isArray(s))for(let a=i;a<s.length;a++)kt(s[a],!1),Qt(s[a]);else s!=null&&(kt(s,!1),Qt(s));else kt(this,r)}const on=r=>{r.type==$i.CHILD&&(r._$AP??(r._$AP=nn),r._$AQ??(r._$AQ=sn))};class Ur extends Ft{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,i,s){super._$AT(e,i,s),Br(this),this.isConnected=e._$AU}_$AO(e,i=!0){var s,t;e!==this.isConnected&&(this.isConnected=e,e?(s=this.reconnected)==null||s.call(this):(t=this.disconnected)==null||t.call(this)),i&&(kt(this,e),Qt(this))}setValue(e){if(en(this._$Ct))this._$Ct._$AI(e,this);else{const i=[...this._$Ct._$AH];i[this._$Ci]=e,this._$Ct._$AI(i,this,0)}}disconnected(){}reconnected(){}}/**
329
329
  * @license
330
330
  * Copyright 2020 Google LLC
331
331
  * SPDX-License-Identifier: BSD-3-Clause
332
- */const ot=()=>new Sn;let Sn=class{};const lr=new WeakMap,at=it(class extends _i{render(n){return P}update(n,[e]){var i;const s=e!==this.Y;return s&&this.Y!==void 0&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.Y=e,this.ht=(i=n.options)==null?void 0:i.host,this.rt(this.ct=n.element)),P}rt(n){if(this.isConnected||(n=void 0),typeof this.Y=="function"){const e=this.ht??globalThis;let s=lr.get(e);s===void 0&&(s=new WeakMap,lr.set(e,s)),s.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),s.set(this.Y,n),n!==void 0&&this.Y.call(this.ht,n)}else this.Y.value=n}get lt(){var n,e;return typeof this.Y=="function"?(n=lr.get(this.ht??globalThis))==null?void 0:n.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),cr=class{constructor(e){return this.buffer=e,this.u8=new Uint8Array(e),new Proxy(this,{get(s,i){return s[i]?s[i]:s.getBit(i)}})}getBit(e){var s=this.u8[e>>3],i=e&7;return s>>7-i&1}setBit(e,s){var i=e&7;s?this.u8[e>>3]|=128>>i:this.u8[e>>3]&=~(128>>i)}get length(){return this.u8.byteLength*8}set(e,s){for(let i=s||0,o=0,t=e.length;o<t;i++,o++)this.setBit(i,e[o])}subarray(e,s){let i=[];e=e||0,s=s||this.length,s=s>this.length?this.length:s;for(let o=e;o<s;o++)i.push(this.getBit(o));return i}},Si=(n,e)=>{let s;return(...i)=>{clearTimeout(s),s=window.setTimeout(()=>n.apply(void 0,i),e)}},lt=n=>{var e;return(...s)=>{e&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{n.apply(void 0,s)})}};var An=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,Ce=(n,e,s,i)=>{for(var o=i>1?void 0:i?Cn(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&An(e,s,o),o};const xn=["mousemove","click","dblclick","mousedown","mouseup","contextmenu"],wt={width:200,height:200},_t={width:10,height:10};h.BitDisplayCanvas=class extends K{constructor(){super(),this.arrayBuffer=new ArrayBuffer(0),this.frameWidth=100,this.scale=1,this.width=200,this.height=200,this.state={},this.yStart=0,this.xStart=0,this.refs={viewport:ot(),canvas:ot(),scrollDiv:ot()},this.color="#000000",this.onThemeChange=()=>{let i=getComputedStyle(this);this.color!=i.color&&(this.color=i.color,this.paint())},this.onResize=()=>{this.calculateViewport()},this.handleScroll=()=>{if(!this.refs.viewport.value)return;const i=this.getPxPerBit();this.yStart=this.refs.viewport.value.scrollTop?Math.floor(this.refs.viewport.value.scrollTop/i)+1:0,this.xStart=this.refs.viewport.value.scrollLeft?Math.floor(this.refs.viewport.value.scrollLeft/i)+1:0,this.paint()};let e=new ResizeObserver(this.onResize);e.dispose=()=>{this.resizeObserver.disconnect()},this.resizeObserver=e,this.addDisposableListener(document.body,"theme-change",this.onThemeChange);var s={};xn.forEach(i=>{this.addDisposableListener(this._canvas,i,lt(async o=>{o.stopImmediatePropagation(),o.stopPropagation(),o.preventDefault();var t=await this._canvas;let c=t.getBoundingClientRect(),f={x:Math.floor(Math.abs(o.clientX-c.left)),y:Math.floor(Math.abs(o.clientY-c.top))},d=this.canvasPositionToBit(f);if(i==="mousemove"&&s[i]==d)return;s[i]=d;let y="bit"+String(i).charAt(0).toUpperCase()+String(i).slice(1);if(d!=-1){let C=new CustomEvent(y,{detail:{bitIndex:d,position:f,nativeEvent:o}});this.dispatchEvent(C)}}))})}connectedCallback(){this.onResize(),super.connectedCallback(),this.registerDisposable(this.resizeObserver),this.resizeObserver.observe(this)}updated(e){e.has("arrayBuffer")&&this.arrayBuffer&&(this._bitArray=new cr(this.arrayBuffer));const s=["arrayBuffer","scale","frameWidth","width","height"];for(const i of s)if(e.has(i)){this.paint();return}}canvasPositionToBit(e){let s=Math.floor(e.x/this.scale),i=Math.floor(e.y/this.scale);return s>this.frameWidth-1?-1:this.yStart*this.frameWidth+this.xStart+(i*this.frameWidth+s)}paint(){if(!this.refs.canvas.value||!this._bitArray)return;const{frameWidth:e,_bitArray:s}=this;if(e<=0)return;this.calculateViewport();const{width:i=wt.width,height:o=wt.height}=this,t=this.getPxPerBit(),c=this.refs.canvas.value.getContext("2d");if(!c)return;this.state.scale!=t&&(c.reset(),c.scale(t,t));let f=getComputedStyle(this);c.fillStyle=f.color,c.clearRect(0,0,i,o);let d=0;for(let y=this.yStart*e+this.xStart,C=s.length;y<C;y++){let $=y%e-this.xStart;if(!($<0)){if(Math.floor($*t)>i){d++,y=d*e+this.yStart*e+this.xStart-1;continue}if(Math.floor(d*t)>o)break;s.getBit(y)===1&&c.fillRect($,d,1,1),(y+1)%e===0&&y>=e-1&&d++}}}getPxPerBit(){return this.scale>0?this.scale:1}calculateViewport(){const{frameWidth:e,_bitArray:s}=this;if(this.refs.scrollDiv.value){var i=this.getPxPerBit();const o=s.length/e*i,t=e*i,c=this.refs.scrollDiv.value;c.style.width=t+"px",c.style.height=o+"px"}}render(){const{height:e=wt.height,width:s=wt.width}=this;return w`
332
+ */const Ve=()=>new an;let an=class{};const Ci=new WeakMap,We=St(class extends Ur{render(r){return M}update(r,[e]){var s;const i=e!==this.Y;return i&&this.Y!==void 0&&this.rt(void 0),(i||this.lt!==this.ct)&&(this.Y=e,this.ht=(s=r.options)==null?void 0:s.host,this.rt(this.ct=r.element)),M}rt(r){if(this.isConnected||(r=void 0),typeof this.Y=="function"){const e=this.ht??globalThis;let i=Ci.get(e);i===void 0&&(i=new WeakMap,Ci.set(e,i)),i.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),i.set(this.Y,r),r!==void 0&&this.Y.call(this.ht,r)}else this.Y.value=r}get lt(){var r,e;return typeof this.Y=="function"?(r=Ci.get(this.ht??globalThis))==null?void 0:r.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oi=class{constructor(e){return this.buffer=e,this.u8=new Uint8Array(e),new Proxy(this,{get(i,s){return i[s]?i[s]:i.getBit(s)}})}getBit(e){var i=this.u8[e>>3],s=e&7;return i>>7-s&1}setBit(e,i){var s=e&7;i?this.u8[e>>3]|=128>>s:this.u8[e>>3]&=~(128>>s)}get length(){return this.u8.byteLength*8}set(e,i){for(let s=i||0,t=0,a=e.length;t<a;s++,t++)this.setBit(s,e[t])}subarray(e,i){let s=[];e=e||0,i=i||this.length,i=i>this.length?this.length:i;for(let t=e;t<i;t++)s.push(this.getBit(t));return s}},Hr=(r,e)=>{let i;return(...s)=>{clearTimeout(i),i=window.setTimeout(()=>r.apply(void 0,s),e)}},Et=r=>{var e;return(...i)=>{e&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{r.apply(void 0,i)})}};var ln=Object.defineProperty,cn=Object.getOwnPropertyDescriptor,De=(r,e,i,s)=>{for(var t=s>1?void 0:s?cn(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&ln(e,i,t),t};const un=["mousemove","click","dblclick","mousedown","mouseup","contextmenu"],qt={width:200,height:200},Vt={width:10,height:10};h.BitDisplayCanvas=class extends re{constructor(){super(),this.arrayBuffer=new ArrayBuffer(0),this.frameWidth=100,this.scale=1,this.width=200,this.height=200,this.state={},this.yStart=0,this.xStart=0,this.refs={viewport:Ve(),canvas:Ve(),scrollDiv:Ve()},this.color="#000000",this.onThemeChange=()=>{let s=getComputedStyle(this);this.color!=s.color&&(this.color=s.color,this.paint())},this.onResize=()=>{this.calculateViewport()},this.handleScroll=()=>{if(!this.refs.viewport.value)return;const s=this.getPxPerBit();this.yStart=this.refs.viewport.value.scrollTop?Math.floor(this.refs.viewport.value.scrollTop/s)+1:0,this.xStart=this.refs.viewport.value.scrollLeft?Math.floor(this.refs.viewport.value.scrollLeft/s)+1:0,this.paint()};let e=new ResizeObserver(this.onResize);e.dispose=()=>{this.resizeObserver.disconnect()},this.resizeObserver=e,this.addDisposableListener(document.body,"theme-change",this.onThemeChange);var i={};un.forEach(s=>{this.addDisposableListener(this._canvas,s,Et(async t=>{t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault();var a=await this._canvas;let o=a.getBoundingClientRect(),d={x:Math.floor(Math.abs(t.clientX-o.left)),y:Math.floor(Math.abs(t.clientY-o.top))},c=this.canvasPositionToBit(d);if(s==="mousemove"&&i[s]==c)return;i[s]=c;let b="bit"+String(s).charAt(0).toUpperCase()+String(s).slice(1);if(c!=-1){let _=new CustomEvent(b,{detail:{bitIndex:c,position:d,nativeEvent:t}});this.dispatchEvent(_)}}))})}connectedCallback(){this.onResize(),super.connectedCallback(),this.registerDisposable(this.resizeObserver),this.resizeObserver.observe(this)}updated(e){e.has("arrayBuffer")&&this.arrayBuffer&&(this._bitArray=new Oi(this.arrayBuffer));const i=["arrayBuffer","scale","frameWidth","width","height"];for(const s of i)if(e.has(s)){this.paint();return}}canvasPositionToBit(e){let i=Math.floor(e.x/this.scale),s=Math.floor(e.y/this.scale);return i>this.frameWidth-1?-1:this.yStart*this.frameWidth+this.xStart+(s*this.frameWidth+i)}paint(){if(!this.refs.canvas.value||!this._bitArray)return;const{frameWidth:e,_bitArray:i}=this;if(e<=0)return;this.calculateViewport();const{width:s=qt.width,height:t=qt.height}=this,a=this.getPxPerBit(),o=this.refs.canvas.value.getContext("2d");if(!o)return;this.state.scale!=a&&(o.reset(),o.scale(a,a));let d=getComputedStyle(this);o.fillStyle=d.color,o.clearRect(0,0,s,t);let c=0;for(let b=this.yStart*e+this.xStart,_=i.length;b<_;b++){let y=b%e-this.xStart;if(!(y<0)){if(Math.floor(y*a)>s){c++,b=c*e+this.yStart*e+this.xStart-1;continue}if(Math.floor(c*a)>t)break;i.getBit(b)===1&&o.fillRect(y,c,1,1),(b+1)%e===0&&b>=e-1&&c++}}}getPxPerBit(){return this.scale>0?this.scale:1}calculateViewport(){const{frameWidth:e,_bitArray:i}=this;if(this.refs.scrollDiv.value){var s=this.getPxPerBit();const t=i.length/e*s,a=e*s,o=this.refs.scrollDiv.value;o.style.width=a+"px",o.style.height=t+"px"}}render(){const{height:e=qt.height,width:i=qt.width}=this;return $`
333
333
  <div
334
334
  id="viewport"
335
- ${at(this.refs.viewport)}
335
+ ${We(this.refs.viewport)}
336
336
  @scroll=${this.handleScroll}
337
- style=${`width:${s+_t.width}px;height:${e+_t.height}px;overflow:auto;position:relative`}
337
+ style=${`width:${i+Vt.width}px;height:${e+Vt.height}px;overflow:auto;position:relative`}
338
338
  >
339
339
  <div
340
340
  id="fakescrolldiv"
341
- ${at(this.refs.scrollDiv)}
341
+ ${We(this.refs.scrollDiv)}
342
342
  >
343
343
  </div>
344
344
  </div>
345
345
  <canvas
346
- ${at(this.refs.canvas)}
347
- width=${s}
346
+ ${We(this.refs.canvas)}
347
+ width=${i}
348
348
  height=${e}
349
349
  ></canvas>
350
- `}},h.BitDisplayCanvas.styles=F`
350
+ `}},h.BitDisplayCanvas.styles=Z`
351
351
  :host{
352
352
  position: relative;
353
353
  --border-radius: var(--spectric-border-radius,4em);
@@ -371,8 +371,8 @@ opacity:1
371
371
  background-color:var(--background-color);
372
372
  }
373
373
  ::-webkit-scrollbar {
374
- height: ${_t.height}px;
375
- width: ${_t.width}px;
374
+ height: ${Vt.height}px;
375
+ width: ${Vt.width}px;
376
376
 
377
377
  }
378
378
 
@@ -443,7 +443,7 @@ opacity:1
443
443
 
444
444
  }
445
445
 
446
- `,Ce([v({type:Object,attribute:!1})],h.BitDisplayCanvas.prototype,"arrayBuffer",2),Ce([v({type:Number})],h.BitDisplayCanvas.prototype,"frameWidth",2),Ce([v({type:Number})],h.BitDisplayCanvas.prototype,"scale",2),Ce([v({type:Number})],h.BitDisplayCanvas.prototype,"width",2),Ce([v({type:Number})],h.BitDisplayCanvas.prototype,"height",2),Ce([st("canvas")],h.BitDisplayCanvas.prototype,"_canvas",2),h.BitDisplayCanvas=Ce([T("spectric-bit-display")],h.BitDisplayCanvas);const En=F`.spectric-header {
446
+ `,De([g({type:Object,attribute:!1})],h.BitDisplayCanvas.prototype,"arrayBuffer",2),De([g({type:Number})],h.BitDisplayCanvas.prototype,"frameWidth",2),De([g({type:Number})],h.BitDisplayCanvas.prototype,"scale",2),De([g({type:Number})],h.BitDisplayCanvas.prototype,"width",2),De([g({type:Number})],h.BitDisplayCanvas.prototype,"height",2),De([xt("canvas")],h.BitDisplayCanvas.prototype,"_canvas",2),h.BitDisplayCanvas=De([I("spectric-bit-display")],h.BitDisplayCanvas);const pn=Z`.spectric-header {
447
447
  display: flex;
448
448
  justify-content: space-between;
449
449
  align-items: center;
@@ -478,7 +478,7 @@ opacity:1
478
478
  color: #333;
479
479
  font-size: 14px;
480
480
  }
481
- `;var kn=Object.defineProperty,Pn=Object.getOwnPropertyDescriptor,St=(n,e,s,i)=>{for(var o=i>1?void 0:i?Pn(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&kn(e,s,o),o};h.Header=class extends z{constructor(){super(...arguments),this.showCreateAccount=!1,this.showLoginButton=!1,this.username="",this.onLogout=()=>{const e={bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("logout",e))},this.onLogin=()=>{const e={bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("login",e))},this.onCreateAccount=()=>{const e={bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("createAccount",e))}}render(){return w`
481
+ `;var hn=Object.defineProperty,dn=Object.getOwnPropertyDescriptor,Wt=(r,e,i,s)=>{for(var t=s>1?void 0:s?dn(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&hn(e,i,t),t};h.Header=class extends B{constructor(){super(...arguments),this.showCreateAccount=!1,this.showLoginButton=!1,this.username="",this.onLogout=()=>{const e={bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("logout",e))},this.onLogin=()=>{const e={bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("login",e))},this.onCreateAccount=()=>{const e={bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("createAccount",e))}}render(){return $`
482
482
  <header>
483
483
  <div class="spectric-header">
484
484
  <div style="flex-grow:1;">
@@ -486,10 +486,10 @@ opacity:1
486
486
  <h1><slot name="name"></slot></h1>
487
487
  <slot name="center"></slot>
488
488
  </div>
489
- ${this.showLoginButton!==!1?w`
489
+ ${this.showLoginButton!==!1?$`
490
490
  <div>
491
- ${this.username&&this.username!==""?w`<spectric-button variant="secondary" size="small" @click=${this.onLogout}>Log out</spectric-button>`:w`
492
- ${this.showCreateAccount!==!1?w`<spectric-button variant="text" size="small" @click=${this.onCreateAccount}>Sign up</spectric-button>`:null}
491
+ ${this.username&&this.username!==""?$`<spectric-button variant="secondary" size="small" @click=${this.onLogout}>Log out</spectric-button>`:$`
492
+ ${this.showCreateAccount!==!1?$`<spectric-button variant="text" size="small" @click=${this.onCreateAccount}>Sign up</spectric-button>`:null}
493
493
  <spectric-button variant="primary" size="small" @click=${this.onLogin}>Log in</spectric-button>`}
494
494
 
495
495
 
@@ -497,16 +497,16 @@ opacity:1
497
497
  <slot name="end"></slot>
498
498
  </div>
499
499
  </header>
500
- `}},h.Header.styles=En,St([v({type:Boolean,reflect:!0})],h.Header.prototype,"showCreateAccount",2),St([v({type:Boolean,reflect:!0})],h.Header.prototype,"showLoginButton",2),St([v({type:String,reflect:!0})],h.Header.prototype,"username",2),h.Header=St([T("spectric-header")],h.Header);var Tn=Object.defineProperty,On=Object.getOwnPropertyDescriptor,Ne=(n,e,s,i)=>{for(var o=i>1?void 0:i?On(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&Tn(e,s,o),o};const Dn={display:"flex",alignItems:"center",backgroundColor:"black",color:"white",textAlign:"center"};let xe=class extends z{constructor(){super(...arguments),this.dismissable=!1,this.text="",this.bannerId="",this.headerStyle={},this._dismissed=!1,this.onDismiss=n=>{n.preventDefault(),n.stopPropagation();const e={bubbles:!0,composed:!0};this._dismissed=!0;let{bannerId:s,text:i,headerStyle:o,dismissable:t}=this;this.dispatchEvent(new CustomEvent("bannerDismissed",{detail:{bannerId:s,text:i,headerStyle:o,dismissable:t},...e}))}}render(){if(!this._dismissed)return w`
501
- <header style=${tr({...Dn,...this.headerStyle})}>
500
+ `}},h.Header.styles=pn,Wt([g({type:Boolean,reflect:!0})],h.Header.prototype,"showCreateAccount",2),Wt([g({type:Boolean,reflect:!0})],h.Header.prototype,"showLoginButton",2),Wt([g({type:String,reflect:!0})],h.Header.prototype,"username",2),h.Header=Wt([I("spectric-header")],h.Header);var fn=Object.defineProperty,gn=Object.getOwnPropertyDescriptor,Ge=(r,e,i,s)=>{for(var t=s>1?void 0:s?gn(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&fn(e,i,t),t};const bn={display:"flex",alignItems:"center",backgroundColor:"black",color:"white",textAlign:"center"};let Ne=class extends B{constructor(){super(...arguments),this.dismissable=!1,this.text="",this.bannerId="",this.headerStyle={},this._dismissed=!1,this.onDismiss=r=>{r.preventDefault(),r.stopPropagation();const e={bubbles:!0,composed:!0};this._dismissed=!0;let{bannerId:i,text:s,headerStyle:t,dismissable:a}=this;this.dispatchEvent(new CustomEvent("bannerDismissed",{detail:{bannerId:i,text:s,headerStyle:t,dismissable:a},...e}))}}render(){if(!this._dismissed)return $`
501
+ <header style=${_i({...bn,...this.headerStyle})}>
502
502
  <div style="flex-grow:1">
503
503
  <slot name="text">${this.text}</slot><slot></slot>
504
504
  </div>
505
- ${this.dismissable?w`<spectric-button size="small" @click=${this.onDismiss} icon
505
+ ${this.dismissable?$`<spectric-button size="small" @click=${this.onDismiss} icon
506
506
  >X</spectric-button
507
507
  >`:null}
508
508
  </header>
509
- `}};Ne([v({type:Boolean,reflect:!0})],xe.prototype,"dismissable",2),Ne([v({type:String,reflect:!0})],xe.prototype,"text",2),Ne([v({type:String,reflect:!0})],xe.prototype,"bannerId",2),Ne([v({type:Object})],xe.prototype,"headerStyle",2),Ne([v({state:!0,type:Boolean,attribute:!1})],xe.prototype,"_dismissed",2),xe=Ne([T("spectric-banner")],xe);const Ln=F`
509
+ `}};Ge([g({type:Boolean,reflect:!0})],Ne.prototype,"dismissable",2),Ge([g({type:String,reflect:!0})],Ne.prototype,"text",2),Ge([g({type:String,reflect:!0})],Ne.prototype,"bannerId",2),Ge([g({type:Object})],Ne.prototype,"headerStyle",2),Ge([g({state:!0,type:Boolean,attribute:!1})],Ne.prototype,"_dismissed",2),Ne=Ge([I("spectric-banner")],Ne);const yn=Z`
510
510
 
511
511
  :host {
512
512
  height:100vh;
@@ -666,33 +666,34 @@ article{
666
666
  * @license
667
667
  * Copyright 2018 Google LLC
668
668
  * SPDX-License-Identifier: BSD-3-Clause
669
- */const pr=n=>n??P;class ur extends _i{constructor(){super(...arguments),this.prevData={}}render(e){return P}update(e,[s]){var i;this.element!==e.element&&(this.element=e.element),this.host=((i=e.options)==null?void 0:i.host)||this.element,this.apply(s),this.groom(s),this.prevData={...s}}apply(e){if(!e)return;const{element:s}=this;for(const i in e){const o=e[i];s[i]!==o&&(s[i]=o)}}groom(e){const{prevData:s,element:i}=this;if(s)for(const o in s)(!e||!(o in e)&&i[o]===s[o])&&(i[o]=void 0)}}const Ee=it(ur);var hr=(n=>(n.None="none",n.Uscui="us.cui",n.Usclassified="us.classified",n.Usunclassified="us.unclassified",n.Usconfidential="us.confidential",n.Ussecret="us.secret",n.Ustopsecret="us.topsecret",n.UstopsecretSi="us.topsecret.si",n.Uknotset="uk.notset",n.Ukofficial="uk.official",n.Uksecret="uk.secret",n.Uktopsecret="uk.topsecret",n.Caprotected_a="ca.protected_a",n.Caprotected_b="ca.protected_b",n.Caprotected_c="ca.protected_c",n.Caconfidential="ca.confidential",n.Casecret="ca.secret",n.Catopsecret="ca.topsecret",n.Auunofficial="au.unofficial",n.Auofficial="au.official",n.Auofficialsensitive="au.officialsensitive",n.Auconfidential="au.confidential",n.Ausecret="au.secret",n.Autopsecret="au.topsecret",n))(hr||{});const At={none:{},"us.cui":{color:"white",backgroundColor:"#3D1E5A",content:"Controlled Unclassified Information"},"us.classified":{color:"white",backgroundColor:"#723D9A",content:"Classified"},"us.unclassified":{color:"white",backgroundColor:"#007A33",content:"Unclassified"},"us.confidential":{color:"white",backgroundColor:"#0033A0",content:"Confidential"},"us.secret":{color:"white",backgroundColor:"#C8102E",content:"Secret"},"us.topsecret":{color:"white",backgroundColor:"#FF671F",content:"Top Secret"},"us.topsecret.si":{color:"black",backgroundColor:"#F7EA48",content:"Top Secret//SI"},"uk.notset":{color:"white",backgroundColor:" #616161",content:"Not Set"},"uk.official":{color:"white",backgroundColor:"#2B71C7",content:"For Offical Use"},"uk.secret":{color:"white",backgroundColor:"#F39C2C",content:"Secret"},"uk.topsecret":{color:"white",backgroundColor:"#AA0000",content:"Top Secret"},"ca.protected_a":{color:"white",backgroundColor:"#227ABC",content:"PROTECTED A"},"ca.protected_b":{color:"white",backgroundColor:"#900FB5",content:"PROTECTED B"},"ca.protected_c":{color:"white",backgroundColor:"#460FB5",content:"PROTECTED C"},"ca.confidential":{color:"white",backgroundColor:"#0033a0",content:"Confidential"},"ca.secret":{color:"white",backgroundColor:"#c8102e",content:"Secret"},"ca.topsecret":{color:"white",backgroundColor:"#ff671f",content:"Top Secret"},"au.unofficial":{color:"#666",backgroundColor:"#ffffffff",content:"Unofficial"},"au.official":{color:"#666",backgroundColor:"#ffffffff",content:"Official"},"au.officialsensitive":{color:"#666",backgroundColor:"#ffffffff",content:"Official Sentitive"},"au.confidential":{color:"white",backgroundColor:"#4F81BD",content:"Confidential"},"au.secret":{color:"black",backgroundColor:" #E5B8B7",content:"Secret"},"au.topsecret":{color:"black",backgroundColor:"#AA0000",content:"Top Secret"}};var zn=Object.defineProperty,Nn=Object.getOwnPropertyDescriptor,G=(n,e,s,i)=>{for(var o=i>1?void 0:i?Nn(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&zn(e,s,o),o};h.SpectricPage=class extends z{constructor(){super(...arguments),this.showHeader=!0,this.headerSticky=!0,this.classificationLevel=hr.None,this.classificationText="",this.notifications=[],this.showCreateAccount=!1,this.showLoginButton=!0,this.username=""}render(){this.classificationLevel&&!At[this.classificationLevel]&&(console.warn("Unknown classification",this.classificationLevel),this.classificationLevel=hr.None);const e=this.classificationLevel?this.classificationText||At[this.classificationLevel].content:"",s=this.showHeader?w`<spectric-header ?showCreateAccount=${this.showCreateAccount} .showLoginButton=${this.showLoginButton} username=${pr(this.username)}>
669
+ */const Pi=r=>r??M;class Ti extends Ur{constructor(){super(...arguments),this.prevData={}}render(e){return M}update(e,[i]){var s;this.element!==e.element&&(this.element=e.element),this.host=((s=e.options)==null?void 0:s.host)||this.element,this.apply(i),this.groom(i),this.prevData={...i}}apply(e){if(!e)return;const{element:i}=this;for(const s in e){const t=e[s];i[s]!==t&&(i[s]=t)}}groom(e){const{prevData:i,element:s}=this;if(i)for(const t in i)(!e||!(t in e)&&s[t]===i[t])&&(s[t]=void 0)}}const Me=St(Ti);var Li=(r=>(r.None="none",r.Uscui="us.cui",r.Usclassified="us.classified",r.Usunclassified="us.unclassified",r.Usconfidential="us.confidential",r.Ussecret="us.secret",r.Ustopsecret="us.topsecret",r.UstopsecretSi="us.topsecret.si",r.Uknotset="uk.notset",r.Ukofficial="uk.official",r.Uksecret="uk.secret",r.Uktopsecret="uk.topsecret",r.Caprotected_a="ca.protected_a",r.Caprotected_b="ca.protected_b",r.Caprotected_c="ca.protected_c",r.Caconfidential="ca.confidential",r.Casecret="ca.secret",r.Catopsecret="ca.topsecret",r.Auunofficial="au.unofficial",r.Auofficial="au.official",r.Auofficialsensitive="au.officialsensitive",r.Auconfidential="au.confidential",r.Ausecret="au.secret",r.Autopsecret="au.topsecret",r))(Li||{});const Gt={none:{},"us.cui":{color:"white",backgroundColor:"#3D1E5A",content:"Controlled Unclassified Information"},"us.classified":{color:"white",backgroundColor:"#723D9A",content:"Classified"},"us.unclassified":{color:"white",backgroundColor:"#007A33",content:"Unclassified"},"us.confidential":{color:"white",backgroundColor:"#0033A0",content:"Confidential"},"us.secret":{color:"white",backgroundColor:"#C8102E",content:"Secret"},"us.topsecret":{color:"white",backgroundColor:"#FF671F",content:"Top Secret"},"us.topsecret.si":{color:"black",backgroundColor:"#F7EA48",content:"Top Secret//SI"},"uk.notset":{color:"white",backgroundColor:" #616161",content:"Not Set"},"uk.official":{color:"white",backgroundColor:"#2B71C7",content:"For Offical Use"},"uk.secret":{color:"white",backgroundColor:"#F39C2C",content:"Secret"},"uk.topsecret":{color:"white",backgroundColor:"#AA0000",content:"Top Secret"},"ca.protected_a":{color:"white",backgroundColor:"#227ABC",content:"PROTECTED A"},"ca.protected_b":{color:"white",backgroundColor:"#900FB5",content:"PROTECTED B"},"ca.protected_c":{color:"white",backgroundColor:"#460FB5",content:"PROTECTED C"},"ca.confidential":{color:"white",backgroundColor:"#0033a0",content:"Confidential"},"ca.secret":{color:"white",backgroundColor:"#c8102e",content:"Secret"},"ca.topsecret":{color:"white",backgroundColor:"#ff671f",content:"Top Secret"},"au.unofficial":{color:"#666",backgroundColor:"#ffffffff",content:"Unofficial"},"au.official":{color:"#666",backgroundColor:"#ffffffff",content:"Official"},"au.officialsensitive":{color:"#666",backgroundColor:"#ffffffff",content:"Official Sentitive"},"au.confidential":{color:"white",backgroundColor:"#4F81BD",content:"Confidential"},"au.secret":{color:"black",backgroundColor:" #E5B8B7",content:"Secret"},"au.topsecret":{color:"black",backgroundColor:"#AA0000",content:"Top Secret"}};var vn=Object.defineProperty,mn=Object.getOwnPropertyDescriptor,ne=(r,e,i,s)=>{for(var t=s>1?void 0:s?mn(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&vn(e,i,t),t};h.SpectricPage=class extends B{constructor(){super(...arguments),this.showHeader=!0,this.headerSticky=!0,this.classificationLevel=Li.None,this.classificationText="",this.notifications=[],this.showCreateAccount=!1,this.showLoginButton=!0,this.username=""}render(){this.classificationLevel&&!Gt[this.classificationLevel]&&(console.warn("Unknown classification",this.classificationLevel),this.classificationLevel=Li.None);const e=this.classificationLevel?this.classificationText||Gt[this.classificationLevel].content:"",i=this.showHeader?$`<spectric-header ?showCreateAccount=${this.showCreateAccount} .showLoginButton=${this.showLoginButton} username=${Pi(this.username)}>
670
670
  <slot name="branding" slot="branding"></slot>
671
671
  <slot name="name" slot="name"></slot>
672
672
  <slot name="center" slot="center"></slot>
673
673
  <slot name="end" slot="end"></slot>
674
- </spectric-header>`:null;return w`
675
- ${this.classificationLevel&&e?w`
674
+ </spectric-header>`:null;return $`
675
+ ${this.classificationLevel&&e?$`
676
676
  <!-- Classification Banner -->
677
- <spectric-banner ${Ee({text:e,headerStyle:At[this.classificationLevel]})}></spectric-banner>
677
+ <spectric-banner ${Me({text:e,headerStyle:Gt[this.classificationLevel]})}></spectric-banner>
678
678
  `:null}
679
- <spectric-theme theme=${pr(this.theme)}>
680
- ${this.notifications?this.notifications.map(i=>w`<spectric-banner ${Ee(i)} ></spectric-banner>`):null}
681
- ${this.headerSticky?s:null}
679
+ <spectric-theme theme=${Pi(this.theme)}>
680
+ ${this.notifications?this.notifications.map(s=>$`<spectric-banner ${Me(s)} ></spectric-banner>`):null}
681
+ ${this.headerSticky?i:null}
682
682
  <article>
683
- ${this.headerSticky?null:s}
683
+ ${this.headerSticky?null:i}
684
684
  <section class="spectric-page">
685
685
  <slot name="content"></slot>
686
686
  <slot></slot>
687
687
  </section>
688
688
  </article>
689
689
  </spectric-theme>
690
- ${this.classificationLevel&&e?w`<spectric-banner ${Ee({text:e,headerStyle:At[this.classificationLevel]})}></spectric-banner>`:null}
690
+ ${this.classificationLevel&&e?$`<spectric-banner ${Me({text:e,headerStyle:Gt[this.classificationLevel]})}></spectric-banner>`:null}
691
691
 
692
- `}},h.SpectricPage.styles=Ln,G([v({type:Boolean,reflect:!0})],h.SpectricPage.prototype,"showHeader",2),G([v({type:Boolean,reflect:!0})],h.SpectricPage.prototype,"headerSticky",2),G([v({type:String,reflect:!0})],h.SpectricPage.prototype,"classificationLevel",2),G([v({type:String,reflect:!0})],h.SpectricPage.prototype,"classificationText",2),G([v({type:Array,reflect:!0})],h.SpectricPage.prototype,"notifications",2),G([v({type:Boolean,reflect:!0})],h.SpectricPage.prototype,"showCreateAccount",2),G([v({type:Boolean,reflect:!0})],h.SpectricPage.prototype,"showLoginButton",2),G([v({type:String,reflect:!0})],h.SpectricPage.prototype,"username",2),G([v({type:String,reflect:!0})],h.SpectricPage.prototype,"theme",2),h.SpectricPage=G([T("spectric-page")],h.SpectricPage);var Bn=Object.defineProperty,Mn=Object.getOwnPropertyDescriptor,O=(n,e,s,i)=>{for(var o=i>1?void 0:i?Mn(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&Bn(e,s,o),o},dr=(n=>(n.Text="text",n.TextArea="text-area",n.number="number",n.color="color",n.date="date",n.datePopup="popup-date",n.datetime="datetime-local",n.email="email",n.file="file",n.hidden="hidden",n.password="password",n.checkbox="checkbox",n.range="range",n))(dr||{});h.SpectricInput=class extends z{constructor(){super(...arguments),this.files=null,this.placeholder="",this.readonly=!1,this.variant="text",this.disabled=!1,this.label="",this.hidePasswordLabel="Hide",this.showPasswordLabel="Show",this.showPasswordVisibilityToggle=!0,this.helperText="",this.invalid=!1,this.required=!1,this.invalidText="",this.name="",this.pattern="",this.maxCount=0,this._value="",this._showPassword=!1,this.autocomplete="off",this._handleInput=({target:e})=>{const s=e;this.variant=="file"?this.files=s.files:this.value=s.value,this.invalid=!s.validity.valid},this.handleTogglePasswordVisibility=()=>{this._showPassword=!this._showPassword,this.requestUpdate()}}createRenderRoot(){return this}get selectionStart(){return this._input?this._input.selectionStart:null}get value(){return this._input?this.variant=="number"?parseFloat(this._input.value):this._input.value:this._value}set value(e){const s=this._value;this._value=e,this.requestUpdate("value",s),this._input&&(this._input.value=String(e))}blur(){this._input&&this._input.blur()}focus(e){this._input&&(this._input.blur(),this._input.focus(e))}setSelectionRange(e,s,i="none"){this._input&&this._input.setSelectionRange(e,s,i)}updated(e){e.has("checked")&&this.dispatchEvent(new Event("change",{bubbles:!0}))}_handleChange(e){e.stopPropagation(),this.variant==="file"?this.files=e.target.files:this.value=e.target.value,this.dispatchEvent(new Event("change",{bubbles:!0}))}render(){const e=w`<spectric-calendar
693
- .popup=${this.variant==="popup-date"}
694
- @select=${s=>{var i;this.value=s.detail.toISOString(),(i=this.querySelector("spectric-popover"))==null||i.hidePopover()}}>
695
- </spectric-calendar>`;switch(this.variant){case"text":case"password":case"number":case"email":case"date":case"popup-date":case"datetime-local":case"file":case"range":return w`
692
+ `}},h.SpectricPage.styles=yn,ne([g({type:Boolean,reflect:!0})],h.SpectricPage.prototype,"showHeader",2),ne([g({type:Boolean,reflect:!0})],h.SpectricPage.prototype,"headerSticky",2),ne([g({type:String,reflect:!0})],h.SpectricPage.prototype,"classificationLevel",2),ne([g({type:String,reflect:!0})],h.SpectricPage.prototype,"classificationText",2),ne([g({type:Array,reflect:!0})],h.SpectricPage.prototype,"notifications",2),ne([g({type:Boolean,reflect:!0})],h.SpectricPage.prototype,"showCreateAccount",2),ne([g({type:Boolean,reflect:!0})],h.SpectricPage.prototype,"showLoginButton",2),ne([g({type:String,reflect:!0})],h.SpectricPage.prototype,"username",2),ne([g({type:String,reflect:!0})],h.SpectricPage.prototype,"theme",2),h.SpectricPage=ne([I("spectric-page")],h.SpectricPage);var $n=Object.defineProperty,_n=Object.getOwnPropertyDescriptor,R=(r,e,i,s)=>{for(var t=s>1?void 0:s?_n(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&$n(e,i,t),t},Di=(r=>(r.Text="text",r.TextArea="text-area",r.number="number",r.color="color",r.date="date",r.datePopup="popup-date",r.datetime="datetime-local",r.email="email",r.file="file",r.hidden="hidden",r.password="password",r.checkbox="checkbox",r.range="range",r))(Di||{});h.SpectricInput=class extends B{constructor(){super(...arguments),this.checked=!1,this.files=null,this.placeholder="",this.readonly=!1,this.variant="text",this.disabled=!1,this.label="",this.hidePasswordLabel="Hide",this.showPasswordLabel="Show",this.showPasswordVisibilityToggle=!0,this.helperText="",this.invalid=!1,this.required=!1,this.invalidText="",this.name="",this.pattern="",this.maxCount=0,this._value="",this._showPassword=!1,this.autocomplete="off",this._handleInput=({target:e})=>{const i=e;this.variant=="file"?this.files=i.files:this.value=i.value,this.invalid=!i.validity.valid},this.handleTogglePasswordVisibility=()=>{this._showPassword=!this._showPassword,this.requestUpdate()}}createRenderRoot(){return this}get selectionStart(){return this._input?this._input.selectionStart:null}get value(){return this._input?this.variant=="number"?parseFloat(this._input.value):this._input.value:this._value}set value(e){const i=this._value;this._value=e,this.requestUpdate("value",i),this._input&&(this._input.value=String(e))}blur(){this._input&&this._input.blur()}focus(e){this._input&&(this._input.blur(),this._input.focus(e))}setSelectionRange(e,i,s="none"){this._input&&this._input.setSelectionRange(e,i,s)}updated(e){e.has("checked")&&e.get("checked")!==void 0&&this.dispatchEvent(new Event("change",{bubbles:!0}))}_handleChange(e){e.stopPropagation(),this.variant==="file"?this.files=e.target.files:this.value=e.target.value,this.dispatchEvent(new Event("change",{bubbles:!0}))}render(){const e=$`<spectric-calendar
693
+ .popup=${this.variant==="popup-date"}
694
+ @select=${i=>{var s;this.value=i.detail.toISOString(),(s=this.querySelector("spectric-popover"))==null||s.hidePopover()}}
695
+ >
696
+ </spectric-calendar>`;switch(this.variant){case"text":case"password":case"number":case"email":case"date":case"popup-date":case"datetime-local":case"file":case"range":return $`
696
697
  <div class="inputWrapper">
697
698
  <div class="text-input__label-helper-wrapper">
698
699
  <div class="--text-input__label-wrapper">
@@ -708,21 +709,21 @@ article{
708
709
  ?disabled="${this.disabled}"
709
710
  aria-describedby="helper-text"
710
711
  id="input"
711
- name="${Be(this.name)}"
712
- pattern="${Be(this.pattern)}"
713
- placeholder="${Be(this.placeholder)}"
714
- autocomplete="${Be(this.autocomplete)}"
712
+ name="${Ye(this.name)}"
713
+ pattern="${Ye(this.pattern)}"
714
+ placeholder="${Ye(this.placeholder)}"
715
+ autocomplete="${Ye(this.autocomplete)}"
715
716
  ?readonly="${this.readonly}"
716
717
  ?required="${this.required}"
717
- type="${Be(this.variant!=="password"?this.variant!=="date"?this.variant:"text":this._showPassword?"text":"password")}"
718
+ type="${Ye(this.variant!=="password"?this.variant!=="date"?this.variant:"text":this._showPassword?"text":"password")}"
718
719
  .value="${this._value}"
719
- maxlength="${Be(this.maxCount>0?this.maxCount:void 0)}"
720
+ maxlength="${Ye(this.maxCount>0?this.maxCount:void 0)}"
720
721
  @input="${this._handleInput}"
721
722
  @change=${this._handleChange}
722
723
  />
723
724
 
724
- ${this.variant==="popup-date"?e:null}
725
- ${this.variant==="password"&&this.showPasswordVisibilityToggle?w`
725
+ ${this.variant==="popup-date"?e:null}
726
+ ${this.variant==="password"&&this.showPasswordVisibilityToggle?$`
726
727
  <spectric-button
727
728
  icon
728
729
  class="input-button-right"
@@ -745,7 +746,7 @@ article{
745
746
  </div>
746
747
  </div>
747
748
  </div>
748
- `;case"color":return w`<div class="inputWrapper">
749
+ `;case"color":return $`<div class="inputWrapper">
749
750
  <div class="text-input__label-helper-wrapper">
750
751
  <div class="--text-input__label-wrapper">
751
752
  ${this.label} ${this.maxCount>0&&this._value?`${this._value.length}/${this.maxCount}`:null}
@@ -755,8 +756,8 @@ article{
755
756
  <div ?data-invalid="${this.invalid}" class="inputContainer">
756
757
  <input type="hidden" .value=${String(this.value)} > </input>
757
758
  <spectric-colorpicker
758
- @cancel=${s=>{this.value=s.target.value}}
759
- @change=${s=>{s.stopPropagation(),this.value=s.target.value,this._handleChange(s)}} .value=${String(this.value)}></spectric-colorpicker>
759
+ @cancel=${i=>{this.value=i.target.value}}
760
+ @change=${i=>{i.stopPropagation(),this.value=i.target.value,this._handleChange(i)}} .value=${String(this.value)}></spectric-colorpicker>
760
761
  </div>
761
762
  <div
762
763
  id="helper-text"
@@ -766,110 +767,80 @@ article{
766
767
  </div>
767
768
 
768
769
  </div>
769
- </div>`;case"hidden":return w`<input type="hidden" />`;case"checkbox":return w`
770
+ </div>`;case"hidden":return $`<input type="hidden" />`;case"checkbox":return $`
770
771
  <div class="checkbox">
771
772
  <spectric-button
772
773
  .tooltip=${this.helperText}
773
774
  @click=${()=>{this.checked=!this.checked,this.value=!!this.checked}} icon size=${this.size||"xxsmall"} variant=${this.checked?"primary":"secondary"}>${this.checked?"✓":" "}</spectric-button>
774
-
775
- ${this.label}
775
+ ${this.label.length?$`<span>${this.label}</span>`:null}
776
776
  </div>
777
777
  </label>
778
- `}return`Not yet implemented ${this.variant}`}},O([v({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"checked",2),O([v({type:String,reflect:!0})],h.SpectricInput.prototype,"placeholder",2),O([v({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"readonly",2),O([v({type:String,reflect:!0})],h.SpectricInput.prototype,"variant",2),O([v({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"disabled",2),O([v({type:String,reflect:!0})],h.SpectricInput.prototype,"label",2),O([v()],h.SpectricInput.prototype,"hidePasswordLabel",2),O([v()],h.SpectricInput.prototype,"showPasswordLabel",2),O([v({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"showPasswordVisibilityToggle",2),O([v({type:String,reflect:!0})],h.SpectricInput.prototype,"helperText",2),O([v({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"invalid",2),O([v({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"required",2),O([v({type:String,reflect:!0})],h.SpectricInput.prototype,"invalidText",2),O([v()],h.SpectricInput.prototype,"name",2),O([v()],h.SpectricInput.prototype,"pattern",2),O([v({type:Number,reflect:!0})],h.SpectricInput.prototype,"maxCount",2),O([v({reflect:!0})],h.SpectricInput.prototype,"autocomplete",2),O([v({reflect:!0})],h.SpectricInput.prototype,"value",1),O([ue("input")],h.SpectricInput.prototype,"_input",2),O([_e({capture:!0})],h.SpectricInput.prototype,"_handleChange",1),h.SpectricInput=O([T("spectric-input")],h.SpectricInput);const Be=n=>pr(n===""?void 0:n??void 0),jn="end of input",Rn={fieldName:"field name",value:"value",literal:"literal",whitespace:"whitespace"};class Ai extends Error{constructor(e,s){let i=e.message;if(e.expected){const c=e.expected.map(d=>Rn[d.description]||d.description).join(", ");let f=e.found?`"${e.found}"`:jn;i=`Expected ${c} but ${f} found.`}const o=[i,s,"-".repeat(e.location.start.offset)+"^"].join(`
779
- `);super(o),this.name="DQLSyntaxError",this.shortMessage=i}}function Me(n){return{type:"literal",value:n}}function fr(n){return n.value}const In=Object.freeze(Object.defineProperty({__proto__:null,buildNode:Me,toOpenSearchQuery:fr},Symbol.toStringTag,{value:"Module"})),{SyntaxError:mc,parse:Ct}=function(){function n(i,o){function t(){this.constructor=i}t.prototype=o.prototype,i.prototype=new t}function e(i,o,t,c){this.message=i,this.expected=o,this.found=t,this.location=c,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,e)}n(e,Error);function s(i){var o=arguments.length>1?arguments[1]:{},t={},c={start:Ts,Literal:Wr},f=Ts,d=function(r,a){return a.type==="cursor"?{...a,suggestionTypes:["conjunction"]}:r!==null?r:De.function.buildNode("is","*","*")},y=function(){return uc},C=function(r,a){const p=[r,a].find(u=>u.type==="cursor");return p||se("or",[r,a])},$=function(r,a){const p=[r,a].find(u=>u.type==="cursor");return p||se("and",[r,a])},E=function(r){return r.type==="cursor"?r:se("not",[r])},x="(",k={type:"literal",value:"(",description:'"("'},D=")",I={type:"literal",value:")",description:'")"'},H=function(r,a){return a.type==="cursor"?{...a,suggestionTypes:["conjunction"]}:r},re=":",W={type:"literal",value:":",description:'":"'},Qe="{",Dr={type:"literal",value:"{",description:'"{"'},Lr="}",zr={type:"literal",value:"}",description:'"}"'},ja=function(r,a,p){return a.type==="cursor"?{...a,nestedPath:a.nestedPath?`${r.value}.${a.nestedPath}`:r.value}:p.type==="cursor"?{...p,suggestionTypes:["conjunction"]}:se("nested",[r,a])},Ra={type:"other",description:"fieldName"},Ia=function(r,a,p){if(p.type==="cursor")return{...p,suggestionTypes:["conjunction"]};const u=vc(a,p);return se("range",[r,u])},Ua=function(r,a){return a.type==="cursor"?{...a,fieldName:r.value,suggestionTypes:["value","conjunction"]}:a(r)},Ha=function(r){if(r.type==="cursor"){const p=`${r.prefix}${r.suffix}`.trim();return{...r,fieldName:p,suggestionTypes:["field","operator","conjunction"]}}const a=ve(null);return r(a)},Fa=function(r,a){return a.type==="cursor"?{...a,suggestionTypes:["conjunction"]}:r},Qa=function(r,a){const p=[r,a].find(u=>u.type==="cursor");return p?{...p,suggestionTypes:["value"]}:u=>se("or",[r(u),a(u)])},qa=function(r,a){const p=[r,a].find(u=>u.type==="cursor");return p?{...p,suggestionTypes:["value"]}:u=>se("and",[r(u),a(u)])},Wa=function(r){return r.type==="cursor"?{...list,suggestionTypes:["value"]}:a=>se("not",[r(a)])},Va={type:"other",description:"value"},Ya=function(r){if(r.type==="cursor")return r;const a=ve(!0);return p=>se("is",[p,r,a])},Za=function(r){if(r.type==="cursor")return r;!fc&&r.type==="wildcard"&&De.wildcard.hasLeadingWildcard(r)&&Y("Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.");const a=ve(!1);return p=>se("is",[p,r,a])},Ka={type:"other",description:"OR"},Hi="or",Fi={type:"literal",value:"or",description:'"or"'},Xa={type:"other",description:"AND"},Qi="and",qi={type:"literal",value:"and",description:'"and"'},Ga={type:"other",description:"NOT"},Wi="not",Vi={type:"literal",value:"not",description:'"not"'},Ja={type:"other",description:"literal"},pt='"',ut={type:"literal",value:'"',description:'"\\""'},Nr=function(r,a,p){const{start:u,end:b}=Fl();return{type:"cursor",start:u.offset,end:b.offset-a.length,prefix:r.join(""),suffix:p.join(""),text:Hl().replace(a,"")}},el=function(r){return ve(r.join(""))},ht="\\",dt={type:"literal",value:"\\",description:'"\\\\"'},tl=/^[\\"]/,rl={type:"class",value:'[\\\\"]',description:'[\\\\"]'},Ot=function(r){return r},il=/^[^"]/,sl={type:"class",value:'[^"]',description:'[^"]'},nl=function(r){const a=r.join("").trim();return a==="null"?ve(null):a==="true"?ve(!0):a==="false"?ve(!1):r.includes(Ws)?gc(a):ve(/^(-?[1-9]+\d*([.]\d+)?)$|^(-?0[.]\d*[1-9]+)$|^0$|^0.0$|^[.]\d{1,}$/.test(a)?isFinite(a)&&(a>Number.MAX_SAFE_INTEGER||a<Number.MIN_SAFE_INTEGER)?BigInt(a):Number(a):a)},Yi={type:"any",description:"any character"},Dt="*",Lt={type:"literal",value:"*",description:'"*"'},ol=function(){return Ws},Zi="\\t",al={type:"literal",value:"\\t",description:'"\\\\t"'},ll=function(){return" "},Ki="\\r",cl={type:"literal",value:"\\r",description:'"\\\\r"'},pl=function(){return"\r"},Xi="\\n",ul={type:"literal",value:"\\n",description:'"\\\\n"'},hl=function(){return`
780
- `},dl=function(r){return r},fl=/^[\\():<>"*{}]/,gl={type:"class",value:'[\\\\():<>"*{}]',description:'[\\\\():<>"*{}]'},Gi="<=",vl={type:"literal",value:"<=",description:'"<="'},bl=function(){return"lte"},Ji=">=",ml={type:"literal",value:">=",description:'">="'},yl=function(){return"gte"},es="<",ts={type:"literal",value:"<",description:'"<"'},$l=function(){return"lt"},rs=">",is={type:"literal",value:">",description:'">"'},wl=function(){return"gt"},_l={type:"other",description:"whitespace"},Sl=/^[ \t\r\n]/,Al={type:"class",value:"[\\ \\t\\r\\n]",description:"[\\ \\t\\r\\n]"},Cl=function(){return hc},ss="@kuery-cursor@",xl={type:"literal",value:"@kuery-cursor@",description:'"@kuery-cursor@"'},El=function(){return dc},ns="||",kl={type:"literal",value:"||",description:'"||"'},Pl=function(){Y("LuceneOr")},os="&&",Tl={type:"literal",value:"&&",description:'"&&"'},as=function(){Y("LuceneAnd")},ls="+",cs={type:"literal",value:"+",description:'"+"'},ps="-",us={type:"literal",value:"-",description:'"-"'},hs=function(){Y("LuceneNot")},ds="!",fs={type:"literal",value:"!",description:'"!"'},gs="_exists_",Ol={type:"literal",value:"_exists_",description:'"_exists_"'},Dl=function(){Y("LuceneExists")},vs=function(){Y("LuceneRange")},bs="?",ms={type:"literal",value:"?",description:'"?"'},Ll=function(){Y("LuceneWildcard")},Br="/",Mr={type:"literal",value:"/",description:'"/"'},ys=/^[^\/]/,$s={type:"class",value:"[^/]",description:"[^/]"},zl=function(){Y("LuceneRegex")},jr="~",Rr={type:"literal",value:"~",description:'"~"'},qe=/^[0-9]/,We={type:"class",value:"[0-9]",description:"[0-9]"},Nl=function(){Y("LuceneFuzzy")},Bl=function(){Y("LuceneProximity")},ws="^",_s={type:"literal",value:"^",description:'"^"'},Ml=function(){Y("LuceneBoost")},jl=function(){return char},Rl="=",Il={type:"literal",value:"=",description:'"="'},Ss="[",As={type:"literal",value:"[",description:'"["'},Cs="]",xs={type:"literal",value:"]",description:'"]"'},Es="TO",Ul={type:"literal",value:"TO",description:'"TO"'},l=0,A=0,zt=[{line:1,column:1,seenCR:!1}],ie=0,Ir=[],g=0,Nt;if("startRule"in o){if(!(o.startRule in c))throw new Error(`Can't start parsing from rule "`+o.startRule+'".');f=c[o.startRule]}function Hl(){return i.substring(A,l)}function Fl(){return Bt(A,l)}function Y(r){throw Ps(r,null,i.substring(A,l),Bt(A,l))}function ks(r){var a=zt[r],p,u;if(a)return a;for(p=r-1;!zt[p];)p--;for(a=zt[p],a={line:a.line,column:a.column,seenCR:a.seenCR};p<r;)u=i.charAt(p),u===`
781
- `?(a.seenCR||a.line++,a.column=1,a.seenCR=!1):u==="\r"||u==="\u2028"||u==="\u2029"?(a.line++,a.column=1,a.seenCR=!0):(a.column++,a.seenCR=!1),p++;return zt[r]=a,a}function Bt(r,a){var p=ks(r),u=ks(a);return{start:{offset:r,line:p.line,column:p.column},end:{offset:a,line:u.line,column:u.column}}}function m(r){l<ie||(l>ie&&(ie=l,Ir=[]),Ir.push(r))}function Ps(r,a,p,u){function b(L){var N=1;for(L.sort(function(be,Z){return be.description<Z.description?-1:be.description>Z.description?1:0});N<L.length;)L[N-1]===L[N]?L.splice(N,1):N++}function S(L,N){function be(bc){function Ft(ae){return ae.charCodeAt(0).toString(16).toUpperCase()}return bc.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(ae){return"\\x0"+Ft(ae)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(ae){return"\\x"+Ft(ae)}).replace(/[\u0100-\u0FFF]/g,function(ae){return"\\u0"+Ft(ae)}).replace(/[\u1000-\uFFFF]/g,function(ae){return"\\u"+Ft(ae)})}var Z=new Array(L.length),Vs,Ys,gt;for(gt=0;gt<L.length;gt++)Z[gt]=L[gt].description;return Vs=L.length>1?Z.slice(0,-1).join(", ")+" or "+Z[L.length-1]:Z[0],Ys=N?'"'+be(N)+'"':"end of input","Expected "+Vs+" but "+Ys+" found."}return a!==null&&b(a),new e(r!==null?r:S(a,p),a,p,u)}function Ts(){var r,a,p,u;for(r=l,a=[],p=_();p!==t;)a.push(p),p=_();return a!==t?(p=Mt(),p===t&&(p=null),p!==t?(u=Ut(),u!==t?(A=r,a=d(p,u),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t),r}function Mt(){var r,a,p,u;return r=l,A=l,a=y(),a?a=void 0:a=t,a!==t?(p=Jl(),p!==t?(a=[a,p],r=a):(l=r,r=t)):(l=r,r=t),r===t&&(r=l,a=Ur(),a!==t?(p=jt(),p!==t?(u=Mt(),u!==t?(A=r,a=C(a,u),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t),r===t&&(r=Ur())),r}function Ur(){var r,a,p,u;return r=l,a=Os(),a!==t?(p=Rt(),p!==t?(u=Ur(),u!==t?(A=r,a=$(a,u),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t),r===t&&(r=Os()),r}function Os(){var r,a,p;return r=l,a=qr(),a!==t?(p=Ds(),p!==t?(A=r,a=E(p),r=a):(l=r,r=t)):(l=r,r=t),r===t&&(r=Ds()),r}function Ds(){var r,a,p,u,b,S;if(r=l,i.charCodeAt(l)===40?(a=x,l++):(a=t,g===0&&m(k)),a!==t){for(p=[],u=_();u!==t;)p.push(u),u=_();p!==t?(u=Mt(),u!==t?(b=Ut(),b!==t?(i.charCodeAt(l)===41?(S=D,l++):(S=t,g===0&&m(I)),S!==t?(A=r,a=H(u,b),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;return r===t&&(r=Ql()),r}function Ql(){var r,a,p,u,b,S,L,N,be,Z;if(r=l,a=Hr(),a!==t){for(p=[],u=_();u!==t;)p.push(u),u=_();if(p!==t)if(i.charCodeAt(l)===58?(u=re,l++):(u=t,g===0&&m(W)),u!==t){for(b=[],S=_();S!==t;)b.push(S),S=_();if(b!==t)if(i.charCodeAt(l)===123?(S=Qe,l++):(S=t,g===0&&m(Dr)),S!==t){for(L=[],N=_();N!==t;)L.push(N),N=_();L!==t?(N=Mt(),N!==t?(be=Ut(),be!==t?(i.charCodeAt(l)===125?(Z=Lr,l++):(Z=t,g===0&&m(zr)),Z!==t?(A=r,a=ja(a,N,be),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;else l=r,r=t}else l=r,r=t;else l=r,r=t}else l=r,r=t;return r===t&&(r=ql()),r}function ql(){var r;return r=Wl(),r===t&&(r=Vl(),r===t&&(r=Yl())),r}function Hr(){var r;return g++,r=Wr(),g--,r===t&&g===0&&m(Ra),r}function Wl(){var r,a,p,u,b,S;if(r=l,a=Hr(),a!==t){for(p=[],u=_();u!==t;)p.push(u),u=_();if(p!==t)if(u=js(),u!==t){for(b=[],S=_();S!==t;)b.push(S),S=_();b!==t?(S=Wr(),S!==t?(A=r,a=Ia(a,u,S),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;else l=r,r=t}else l=r,r=t;return r}function Vl(){var r,a,p,u,b,S;if(r=l,a=Hr(),a!==t){for(p=[],u=_();u!==t;)p.push(u),u=_();if(p!==t)if(i.charCodeAt(l)===58?(u=re,l++):(u=t,g===0&&m(W)),u!==t){for(b=[],S=_();S!==t;)b.push(S),S=_();b!==t?(S=Fr(),S!==t?(A=r,a=Ua(a,S),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;else l=r,r=t}else l=r,r=t;return r}function Yl(){var r,a;return r=l,a=Ns(),a!==t&&(A=r,a=Ha(a)),r=a,r}function Fr(){var r,a,p,u,b,S;if(r=l,i.charCodeAt(l)===40?(a=x,l++):(a=t,g===0&&m(k)),a!==t){for(p=[],u=_();u!==t;)p.push(u),u=_();p!==t?(u=Ls(),u!==t?(b=Ut(),b!==t?(i.charCodeAt(l)===41?(S=D,l++):(S=t,g===0&&m(I)),S!==t?(A=r,a=Fa(u,b),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;return r===t&&(r=Ns()),r}function Ls(){var r,a,p,u;return r=l,a=Qr(),a!==t?(p=jt(),p!==t?(u=Ls(),u!==t?(A=r,a=Qa(a,u),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t),r===t&&(r=Qr()),r}function Qr(){var r,a,p,u;return r=l,a=zs(),a!==t?(p=Rt(),p!==t?(u=Qr(),u!==t?(A=r,a=qa(a,u),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t),r===t&&(r=zs()),r}function zs(){var r,a,p;return r=l,a=qr(),a!==t?(p=Fr(),p!==t?(A=r,a=Wa(p),r=a):(l=r,r=t)):(l=r,r=t),r===t&&(r=Fr()),r}function Ns(){var r,a;return g++,r=l,a=It(),a!==t&&(A=r,a=Ya(a)),r=a,r===t&&(r=l,a=Bs(),a!==t&&(A=r,a=Za(a)),r=a),g--,r===t&&(a=t,g===0&&m(Va)),r}function jt(){var r,a,p,u,b;if(g++,r=l,a=[],p=_(),p!==t)for(;p!==t;)a.push(p),p=_();else a=t;if(a!==t)if(i.substr(l,2).toLowerCase()===Hi?(p=i.substr(l,2),l+=2):(p=t,g===0&&m(Fi)),p!==t){if(u=[],b=_(),b!==t)for(;b!==t;)u.push(b),b=_();else u=t;u!==t?(a=[a,p,u],r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r===t&&(r=l,A=l,a=y(),a?a=void 0:a=t,a!==t?(p=Rs(),p!==t?(a=[a,p],r=a):(l=r,r=t)):(l=r,r=t)),g--,r===t&&(a=t,g===0&&m(Ka)),r}function Rt(){var r,a,p,u,b;if(g++,r=l,a=[],p=_(),p!==t)for(;p!==t;)a.push(p),p=_();else a=t;if(a!==t)if(i.substr(l,3).toLowerCase()===Qi?(p=i.substr(l,3),l+=3):(p=t,g===0&&m(qi)),p!==t){if(u=[],b=_(),b!==t)for(;b!==t;)u.push(b),b=_();else u=t;u!==t?(a=[a,p,u],r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r===t&&(r=l,A=l,a=y(),a?a=void 0:a=t,a!==t?(p=Is(),p!==t?(a=[a,p],r=a):(l=r,r=t)):(l=r,r=t)),g--,r===t&&(a=t,g===0&&m(Xa)),r}function qr(){var r,a,p,u;if(g++,r=l,i.substr(l,3).toLowerCase()===Wi?(a=i.substr(l,3),l+=3):(a=t,g===0&&m(Vi)),a!==t){if(p=[],u=_(),u!==t)for(;u!==t;)p.push(u),u=_();else p=t;p!==t?(a=[a,p],r=a):(l=r,r=t)}else l=r,r=t;return r===t&&(r=l,A=l,a=y(),a?a=void 0:a=t,a!==t?(p=Us(),p!==t?(a=[a,p],r=a):(l=r,r=t)):(l=r,r=t)),g--,r===t&&(a=t,g===0&&m(Ga)),r}function Wr(){var r;return g++,r=It(),r===t&&(r=Bs()),g--,r===t&&g===0&&m(Ja),r}function It(){var r,a,p,u,b,S;if(r=l,i.charCodeAt(l)===34?(a=pt,l++):(a=t,g===0&&m(ut)),a!==t){for(p=[],u=Ve();u!==t;)p.push(u),u=Ve();if(p!==t)if(u=ft(),u!==t){for(b=[],S=Ve();S!==t;)b.push(S),S=Ve();b!==t?(i.charCodeAt(l)===34?(S=pt,l++):(S=t,g===0&&m(ut)),S!==t?(A=r,a=Nr(p,u,b),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;else l=r,r=t}else l=r,r=t;if(r===t)if(r=l,i.charCodeAt(l)===34?(a=pt,l++):(a=t,g===0&&m(ut)),a!==t){for(p=[],u=Ve();u!==t;)p.push(u),u=Ve();p!==t?(i.charCodeAt(l)===34?(u=pt,l++):(u=t,g===0&&m(ut)),u!==t?(A=r,a=el(p),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;return r}function Ve(){var r,a,p;return r=Vr(),r===t&&(r=l,i.charCodeAt(l)===92?(a=ht,l++):(a=t,g===0&&m(dt)),a!==t?(tl.test(i.charAt(l))?(p=i.charAt(l),l++):(p=t,g===0&&m(rl)),p!==t?(A=r,a=Ot(p),r=a):(l=r,r=t)):(l=r,r=t),r===t&&(r=l,a=l,g++,p=ft(),g--,p===t?a=void 0:(l=a,a=t),a!==t?(il.test(i.charAt(l))?(p=i.charAt(l),l++):(p=t,g===0&&m(sl)),p!==t?(A=r,a=Ot(p),r=a):(l=r,r=t)):(l=r,r=t))),r}function Bs(){var r,a,p,u,b;for(r=l,a=[],p=Ye();p!==t;)a.push(p),p=Ye();if(a!==t)if(p=ft(),p!==t){for(u=[],b=Ye();b!==t;)u.push(b),b=Ye();u!==t?(A=r,a=Nr(a,p,u),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;if(r===t){if(r=l,a=[],p=Ye(),p!==t)for(;p!==t;)a.push(p),p=Ye();else a=t;a!==t&&(A=r,a=nl(a)),r=a}return r}function Ye(){var r,a,p,u,b;return r=Vr(),r===t&&(r=Kl(),r===t&&(r=Xl(),r===t&&(r=Zl(),r===t&&(r=l,a=l,g++,p=Ms(),g--,p===t?a=void 0:(l=a,a=t),a!==t?(p=l,g++,u=Gl(),g--,u===t?p=void 0:(l=p,p=t),p!==t?(u=l,g++,b=ft(),g--,b===t?u=void 0:(l=u,u=t),u!==t?(i.length>l?(b=i.charAt(l),l++):(b=t,g===0&&m(Yi)),b!==t?(A=r,a=Ot(b),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)):(l=r,r=t))))),r}function Zl(){var r,a;return r=l,i.charCodeAt(l)===42?(a=Dt,l++):(a=t,g===0&&m(Lt)),a!==t&&(A=r,a=ol()),r=a,r}function Ut(){var r,a,p,u,b;for(r=l,a=[],p=_();p!==t;)a.push(p),p=_();if(a!==t)if(p=ft(),p!==t){for(u=[],b=_();b!==t;)u.push(b),b=_();u!==t?(A=r,a=Nr(a,p,u),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;if(r===t)for(r=[],a=_();a!==t;)r.push(a),a=_();return r}function Vr(){var r,a;return r=l,i.substr(l,2)===Zi?(a=Zi,l+=2):(a=t,g===0&&m(al)),a!==t&&(A=r,a=ll()),r=a,r===t&&(r=l,i.substr(l,2)===Ki?(a=Ki,l+=2):(a=t,g===0&&m(cl)),a!==t&&(A=r,a=pl()),r=a,r===t&&(r=l,i.substr(l,2)===Xi?(a=Xi,l+=2):(a=t,g===0&&m(ul)),a!==t&&(A=r,a=hl()),r=a)),r}function Kl(){var r,a,p;return r=l,i.charCodeAt(l)===92?(a=ht,l++):(a=t,g===0&&m(dt)),a!==t?(p=Ms(),p!==t?(A=r,a=Ot(p),r=a):(l=r,r=t)):(l=r,r=t),r}function Xl(){var r,a,p;return r=l,i.charCodeAt(l)===92?(a=ht,l++):(a=t,g===0&&m(dt)),a!==t?(i.substr(l,2).toLowerCase()===Hi?(p=i.substr(l,2),l+=2):(p=t,g===0&&m(Fi)),p===t&&(i.substr(l,3).toLowerCase()===Qi?(p=i.substr(l,3),l+=3):(p=t,g===0&&m(qi)),p===t&&(i.substr(l,3).toLowerCase()===Wi?(p=i.substr(l,3),l+=3):(p=t,g===0&&m(Vi)))),p!==t?(A=r,a=dl(p),r=a):(l=r,r=t)):(l=r,r=t),r}function Gl(){var r;return r=jt(),r===t&&(r=Rt(),r===t&&(r=qr())),r}function Ms(){var r;return fl.test(i.charAt(l))?(r=i.charAt(l),l++):(r=t,g===0&&m(gl)),r}function js(){var r,a;return r=l,i.substr(l,2)===Gi?(a=Gi,l+=2):(a=t,g===0&&m(vl)),a!==t&&(A=r,a=bl()),r=a,r===t&&(r=l,i.substr(l,2)===Ji?(a=Ji,l+=2):(a=t,g===0&&m(ml)),a!==t&&(A=r,a=yl()),r=a,r===t&&(r=l,i.charCodeAt(l)===60?(a=es,l++):(a=t,g===0&&m(ts)),a!==t&&(A=r,a=$l()),r=a,r===t&&(r=l,i.charCodeAt(l)===62?(a=rs,l++):(a=t,g===0&&m(is)),a!==t&&(A=r,a=wl()),r=a))),r}function _(){var r;return g++,Sl.test(i.charAt(l))?(r=i.charAt(l),l++):(r=t,g===0&&m(Al)),g--,r===t&&g===0&&m(_l),r}function ft(){var r,a,p;return r=l,A=l,a=Cl(),a?a=void 0:a=t,a!==t?(i.substr(l,14)===ss?(p=ss,l+=14):(p=t,g===0&&m(xl)),p!==t?(A=r,a=El(),r=a):(l=r,r=t)):(l=r,r=t),r}function Rs(){var r,a,p,u,b;for(r=l,a=[],p=_();p!==t;)a.push(p),p=_();if(a!==t)if(i.substr(l,2)===ns?(p=ns,l+=2):(p=t,g===0&&m(kl)),p!==t){for(u=[],b=_();b!==t;)u.push(b),b=_();u!==t?(A=r,a=Pl(),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r}function Is(){var r,a,p,u,b;for(r=l,a=[],p=_();p!==t;)a.push(p),p=_();if(a!==t)if(i.substr(l,2)===os?(p=os,l+=2):(p=t,g===0&&m(Tl)),p!==t){for(u=[],b=_();b!==t;)u.push(b),b=_();u!==t?(A=r,a=as(),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r===t&&(r=l,i.charCodeAt(l)===43?(a=ls,l++):(a=t,g===0&&m(cs)),a!==t&&(A=r,a=as()),r=a),r}function Us(){var r,a;return r=l,i.charCodeAt(l)===45?(a=ps,l++):(a=t,g===0&&m(us)),a!==t&&(A=r,a=hs()),r=a,r===t&&(r=l,i.charCodeAt(l)===33?(a=ds,l++):(a=t,g===0&&m(fs)),a!==t&&(A=r,a=hs()),r=a),r}function Jl(){var r;return r=ec(),r===t&&(r=Hs(),r===t&&(r=tc())),r}function ec(){var r,a,p,u,b,S;if(r=l,a=Ze(),a!==t){for(p=[],u=_();u!==t;)p.push(u),u=_();if(p!==t)if(i.charCodeAt(l)===58?(u=re,l++):(u=t,g===0&&m(W)),u!==t){for(b=[],S=_();S!==t;)b.push(S),S=_();b!==t?(S=Hs(),S!==t?(a=[a,p,u,b,S],r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;else l=r,r=t}else l=r,r=t;return r}function Hs(){var r;return r=rc(),r===t&&(r=Yr(),r===t&&(r=ic(),r===t&&(r=sc(),r===t&&(r=nc(),r===t&&(r=oc()))))),r}function tc(){var r,a,p,u,b,S;if(r=l,i.substr(l,8)===gs?(a=gs,l+=8):(a=t,g===0&&m(Ol)),a!==t){for(p=[],u=_();u!==t;)p.push(u),u=_();if(p!==t)if(i.charCodeAt(l)===58?(u=re,l++):(u=t,g===0&&m(W)),u!==t){for(b=[],S=_();S!==t;)b.push(S),S=_();b!==t?(S=Ze(),S!==t?(A=r,a=Dl(),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;else l=r,r=t}else l=r,r=t;return r}function rc(){var r,a,p,u,b,S,L;if(r=l,a=js(),a!==t){for(p=[],u=_();u!==t;)p.push(u),u=_();p!==t?(u=Ze(),u!==t?(A=r,a=vs(),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;if(r===t)if(r=l,a=cc(),a!==t){for(p=[],u=_();u!==t;)p.push(u),u=_();p!==t?(u=Ze(),u!==t?(b=qs(),b!==t?(S=Ze(),S!==t?(L=pc(),L!==t?(A=r,a=vs(),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;return r}function Yr(){var r,a,p,u,b;for(r=l,a=[],p=Ht(),p===t&&(i.charCodeAt(l)===42?(p=Dt,l++):(p=t,g===0&&m(Lt)));p!==t;)a.push(p),p=Ht(),p===t&&(i.charCodeAt(l)===42?(p=Dt,l++):(p=t,g===0&&m(Lt)));if(a!==t)if(i.charCodeAt(l)===63?(p=bs,l++):(p=t,g===0&&m(ms)),p!==t){for(u=[],b=Yr();b!==t;)u.push(b),b=Yr();u!==t?(A=r,a=Ll(),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r}function ic(){var r,a,p,u;if(r=l,i.charCodeAt(l)===47?(a=Br,l++):(a=t,g===0&&m(Mr)),a!==t){for(p=[],ys.test(i.charAt(l))?(u=i.charAt(l),l++):(u=t,g===0&&m($s));u!==t;)p.push(u),ys.test(i.charAt(l))?(u=i.charAt(l),l++):(u=t,g===0&&m($s));p!==t?(i.charCodeAt(l)===47?(u=Br,l++):(u=t,g===0&&m(Mr)),u!==t?(A=r,a=zl(),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;return r}function sc(){var r,a,p,u,b;if(r=l,a=Fs(),a!==t)if(i.charCodeAt(l)===126?(p=jr,l++):(p=t,g===0&&m(Rr)),p!==t){for(u=[],qe.test(i.charAt(l))?(b=i.charAt(l),l++):(b=t,g===0&&m(We));b!==t;)u.push(b),qe.test(i.charAt(l))?(b=i.charAt(l),l++):(b=t,g===0&&m(We));u!==t?(A=r,a=Nl(),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r}function nc(){var r,a,p,u,b;if(r=l,a=It(),a!==t)if(i.charCodeAt(l)===126?(p=jr,l++):(p=t,g===0&&m(Rr)),p!==t){for(u=[],qe.test(i.charAt(l))?(b=i.charAt(l),l++):(b=t,g===0&&m(We));b!==t;)u.push(b),qe.test(i.charAt(l))?(b=i.charAt(l),l++):(b=t,g===0&&m(We));u!==t?(A=r,a=Bl(),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r}function oc(){var r,a,p,u,b;if(r=l,a=Ze(),a!==t)if(i.charCodeAt(l)===94?(p=ws,l++):(p=t,g===0&&m(_s)),p!==t){for(u=[],qe.test(i.charAt(l))?(b=i.charAt(l),l++):(b=t,g===0&&m(We));b!==t;)u.push(b),qe.test(i.charAt(l))?(b=i.charAt(l),l++):(b=t,g===0&&m(We));u!==t?(A=r,a=Ml(),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r}function Ze(){var r;return r=It(),r===t&&(r=Fs()),r}function Fs(){var r,a;if(r=[],a=Ht(),a!==t)for(;a!==t;)r.push(a),a=Ht();else r=t;return r}function Ht(){var r,a,p,u;return r=Vr(),r===t&&(r=lc(),r===t&&(r=l,a=l,g++,p=Qs(),g--,p===t?a=void 0:(l=a,a=t),a!==t?(p=l,g++,u=ac(),g--,u===t?p=void 0:(l=p,p=t),p!==t?(i.length>l?(u=i.charAt(l),l++):(u=t,g===0&&m(Yi)),u!==t?(a=[a,p,u],r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t))),r}function ac(){var r;return r=jt(),r===t&&(r=Rt(),r===t&&(r=Rs(),r===t&&(r=Is(),r===t&&(r=Us(),r===t&&(r=qs()))))),r}function lc(){var r,a,p;return r=l,i.charCodeAt(l)===92?(a=ht,l++):(a=t,g===0&&m(dt)),a!==t?(p=Qs(),p!==t?(A=r,a=jl(),r=a):(l=r,r=t)):(l=r,r=t),r}function Qs(){var r;return i.charCodeAt(l)===43?(r=ls,l++):(r=t,g===0&&m(cs)),r===t&&(i.charCodeAt(l)===45?(r=ps,l++):(r=t,g===0&&m(us)),r===t&&(i.charCodeAt(l)===61?(r=Rl,l++):(r=t,g===0&&m(Il)),r===t&&(i.charCodeAt(l)===62?(r=rs,l++):(r=t,g===0&&m(is)),r===t&&(i.charCodeAt(l)===60?(r=es,l++):(r=t,g===0&&m(ts)),r===t&&(i.charCodeAt(l)===33?(r=ds,l++):(r=t,g===0&&m(fs)),r===t&&(i.charCodeAt(l)===40?(r=x,l++):(r=t,g===0&&m(k)),r===t&&(i.charCodeAt(l)===41?(r=D,l++):(r=t,g===0&&m(I)),r===t&&(i.charCodeAt(l)===123?(r=Qe,l++):(r=t,g===0&&m(Dr)),r===t&&(i.charCodeAt(l)===125?(r=Lr,l++):(r=t,g===0&&m(zr)),r===t&&(i.charCodeAt(l)===91?(r=Ss,l++):(r=t,g===0&&m(As)),r===t&&(i.charCodeAt(l)===93?(r=Cs,l++):(r=t,g===0&&m(xs)),r===t&&(i.charCodeAt(l)===94?(r=ws,l++):(r=t,g===0&&m(_s)),r===t&&(i.charCodeAt(l)===34?(r=pt,l++):(r=t,g===0&&m(ut)),r===t&&(i.charCodeAt(l)===126?(r=jr,l++):(r=t,g===0&&m(Rr)),r===t&&(i.charCodeAt(l)===42?(r=Dt,l++):(r=t,g===0&&m(Lt)),r===t&&(i.charCodeAt(l)===63?(r=bs,l++):(r=t,g===0&&m(ms)),r===t&&(i.charCodeAt(l)===58?(r=re,l++):(r=t,g===0&&m(W)),r===t&&(i.charCodeAt(l)===92?(r=ht,l++):(r=t,g===0&&m(dt)),r===t&&(i.charCodeAt(l)===47?(r=Br,l++):(r=t,g===0&&m(Mr))))))))))))))))))))),r}function qs(){var r,a,p,u,b;if(r=l,a=[],p=_(),p!==t)for(;p!==t;)a.push(p),p=_();else a=t;if(a!==t)if(i.substr(l,2)===Es?(p=Es,l+=2):(p=t,g===0&&m(Ul)),p!==t){if(u=[],b=_(),b!==t)for(;b!==t;)u.push(b),b=_();else u=t;u!==t?(a=[a,p,u],r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r}function cc(){var r;return i.charCodeAt(l)===91?(r=Ss,l++):(r=t,g===0&&m(As)),r===t&&(i.charCodeAt(l)===123?(r=Qe,l++):(r=t,g===0&&m(Dr))),r}function pc(){var r;return i.charCodeAt(l)===93?(r=Cs,l++):(r=t,g===0&&m(xs)),r===t&&(i.charCodeAt(l)===125?(r=Lr,l++):(r=t,g===0&&m(zr))),r}const{errorOnLuceneSyntax:uc,parseCursor:hc,cursorSymbol:dc,allowLeadingWildcards:fc=!0,helpers:{nodeTypes:De}}=o,se=De.function.buildNodeWithArgumentNodes,ve=De.literal.buildNode,gc=De.wildcard.buildNode,vc=De.namedArg.buildNode,{wildcardSymbol:Ws}=De.wildcard;if(Nt=f(),Nt!==t&&l===i.length)return Nt;throw Nt!==t&&l<i.length&&m({type:"end",description:"end of input"}),Ps(null,Ir,ie<i.length?i.charAt(ie):null,ie<i.length?Bt(ie,ie+1):Bt(ie,ie))}return{SyntaxError:e,parse:s}}(),gr=(n,e={},s=Ct)=>{if(typeof n>"u")throw new Error("expression must be a string, got undefined instead");return s(n,{...e,helpers:{nodeTypes:J}})},je=(n,e={})=>gr(n,{...e,startRule:"Literal"},Ct),xt=(n,e={})=>{try{return gr(n,e,Ct)}catch(s){throw s.name==="SyntaxError"?new Ai(s,n):s}},Un=n=>{try{return gr(n,{errorOnLuceneSyntax:!0},Ct),!1}catch(e){return e.message.startsWith("Lucene")}},B=(n,e,s,i)=>(e=void 0,!n||!n.type||!J[n.type]?B(J.function.buildNode("and",[]),e):J[n.type].toOpenSearchQuery(n,e,s,i)),oe="@kuery-wildcard@";function Hn(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fn(n){return n.replace(/[+-=&|><!(){}[\]^"~*?:\\/]/g,"\\$&")}function Qn(n){return n.includes(oe)?{type:"wildcard",value:n}:je(n)}function Ci(n,e){const{value:s}=n,i=s.split(oe).map(Hn).join("[\\s\\S]*");return new RegExp(`^${i}$`).test(e)}function qn(n){const{value:e}=n;return e.split(oe).join("*")}function vr(n){const{value:e}=n;return e.split(oe).map(Fn).join("*")}function Wn(n){const{value:e}=n;return e.startsWith(oe)&&e.replace(oe,"").length>0}const Vn=Object.freeze(Object.defineProperty({__proto__:null,buildNode:Qn,hasLeadingWildcard:Wn,test:Ci,toOpenSearchQuery:qn,toQueryStringQuery:vr,wildcardSymbol:oe},Symbol.toStringTag,{value:"Module"}));function br(n,e){if(!e)return[];if(n.type==="literal"){const s=fr(n),i=e.fields.find(o=>o.name===s);return i?[i]:[]}else if(n.type==="wildcard")return e.fields.filter(i=>Ci(n,i.name))}function yc(n){return n}function xi(n,e,s){const i={...n,value:s?`${s}.${n.value}`:n.value};if(!e||i.type==="wildcard"&&!s)return i;const t=br(i,e).reduce((c,f)=>{const d=f.subType&&f.subType.nested?f.subType.nested.path:void 0;return s&&!d?[...c,`${f.name} is not a nested field but is in nested group "${s}" in the DQL expression.`]:d&&!s?[...c,`${f.name} is a nested field, but is not in a nested group in the DQL expression.`]:d!==s?[...c,`Nested field ${f.name} is being queried with the incorrect nested path. The correct path is ${f.subType.nested.path}.`]:c},[]);if(t.length>0)throw new Error(t.join(`
782
- `));return i}function Yn(n,e,s=!1){if(n===void 0)throw new Error("fieldName is a required argument");if(e===void 0)throw new Error("value is a required argument");const i=typeof n=="string"?je(n):Me(n),o=typeof e=="string"?je(e):Me(e),t=Me(s);return{arguments:[i,o,t]}}function Zn(n,e,s={},i={}){const{arguments:[o,t,c]}=n,f=xi(o,e,i!=null&&i.nested?i.nested.path:void 0),d=B(f),y=t!==void 0?B(t):t,C=c.value?"phrase":"best_fields";if(f.value===null)return t.type==="wildcard"?{query_string:{query:vr(t)}}:{multi_match:{type:C,query:y,lenient:!0}};const $=e?br(f,e):[];$&&$.length===0&&$.push({name:B(f),scripted:!1,type:""});const E=t.type==="wildcard"&&y==="*",x=f.type==="wildcard"&&d==="*"||$&&e&&$.length===e.fields.length;return E&&x?{match_all:{}}:{bool:{should:$.reduce((I,H)=>{const re=W=>{var Qe;return f.type!=="wildcard"||!((Qe=H.subType)!=null&&Qe.nested)||i!=null&&i.nested?W:{nested:{path:H.subType.nested.path,query:W,score_mode:"none"}}};if(H.scripted)return[];if(E)return[...I,re({exists:{field:H.name}})];if(t.type==="wildcard")return[...I,re({query_string:{fields:[H.name],query:vr(t)}})];if(H.type==="date"){const W=s.dateFormatTZ?{time_zone:s.dateFormatTZ}:{};return[...I,re({range:{[H.name]:{gte:y,lte:y,...W}}})]}else{const W=C==="phrase"?"match_phrase":"match";return[...I,re({[W]:{[H.name]:y}})]}},[])||[],minimum_should_match:1}}}const Kn=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:Yn,toOpenSearchQuery:Zn},Symbol.toStringTag,{value:"Module"}));function Xn(n){return{arguments:n}}function Gn(n,e,s={},i={}){return{bool:{filter:(n.arguments||[]).map(t=>B(t,e,s,i))}}}const Jn=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:Xn,toOpenSearchQuery:Gn},Symbol.toStringTag,{value:"Module"}));function eo(n){return{arguments:n}}function to(n,e,s={},i={}){return{bool:{should:(n.arguments||[]).map(t=>B(t,e,s,i)),minimum_should_match:1}}}const ro=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:eo,toOpenSearchQuery:to},Symbol.toStringTag,{value:"Module"}));function io(n){return{arguments:[n]}}function so(n,e,s={},i={}){const[o]=n.arguments;return{bool:{must_not:B(o,e,s,i)}}}const no=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:io,toOpenSearchQuery:so},Symbol.toStringTag,{value:"Module"}));function oo(n,...e){let s={};for(let i of e)s[i]=n[i];return s}function ao(n,e){const s=oo(e,"gt","lt","gte","lte","format"),i=typeof n=="string"?je(n):J.literal.buildNode(n),o=Object.entries(s).map(t=>{let[c,f]=t;return J.namedArg.buildNode(c,f)});return{arguments:[i,...o]}}function lo(n,e,s={},i={}){const[o,...t]=n.arguments,c=xi(o,e,i!=null&&i.nested?i.nested.path:void 0),f=e?br(c,e):[],d=co(t),y=Object.fromEntries(Object.entries(d).map(([$,E])=>[$,B(E)]));return f&&f.length===0&&f.push({name:B(c),scripted:!1,type:""}),{bool:{should:f.map($=>{const E=x=>{var k;return c.type!=="wildcard"||!((k=$.subType)!=null&&k.nested)||i.nested?x:{nested:{path:$.subType.nested.path,query:x,score_mode:"none"}}};if($.scripted)return{};if($.type==="date"){const x=s.dateFormatTZ?{time_zone:s.dateFormatTZ}:{};return E({range:{[$.name]:{...y,...x}}})}return E({range:{[$.name]:y}})}),minimum_should_match:1}}}function co(n){if(n.gt&&n.gte||n.lt&&n.lte)throw new Error("range ends cannot be both inclusive and exclusive");const e=["gte","lte","format"];return n.reduce((s,i,o)=>(i.type==="namedArg"?s[i.name]=i.value:s[e[o]]=i,s),{})}const po=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:ao,toOpenSearchQuery:lo},Symbol.toStringTag,{value:"Module"}));function uo(n){return{arguments:[Me(n)]}}function ho(n,e,s={},i={}){const{arguments:[o]}=n,t={...o,value:i!=null&&i.nested?`${i.nested.path}.${o.value}`:o.value},c=fr(t),f=((e==null?void 0:e.fields)||[]).find(d=>d.name===c);if(f&&f.scripted)throw new Error("Exists query does not support scripted fields");return{exists:{field:c}}}const fo=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:uo,toOpenSearchQuery:ho},Symbol.toStringTag,{value:"Module"}));function go(n,e){return{arguments:[typeof n=="string"?je(n):Me(n),e]}}function vo(n,e,s={},i={}){var d;const[o,t]=n.arguments,c=B(o),f=(d=i==null?void 0:i.nested)!=null&&d.path?`${i.nested.path}.${c}`:c;return{nested:{path:f,query:B(t,e,s,{...i,nested:{path:f}}),score_mode:"none"}}}const mr={is:Kn,and:Jn,or:ro,not:no,range:po,exists:fo,nested:Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:go,toOpenSearchQuery:vo},Symbol.toStringTag,{value:"Module"}))};function bo(n,...e){const s=mr[n];if(s===void 0)throw new Error(`Unknown function "${n}"`);return{type:"function",function:n,...s.buildNodeParams(...e)}}function mo(n,e){if(mr[n]===void 0)throw new Error(`Unknown function "${n}"`);return{type:"function",function:n,arguments:e}}function yo(n,e,s,i){return mr[n.function].toOpenSearchQuery(n,e,s,i)}const $o=Object.freeze(Object.defineProperty({__proto__:null,buildNode:bo,buildNodeWithArgumentNodes:mo,toOpenSearchQuery:yo},Symbol.toStringTag,{value:"Module"}));function wo(n,e){const s=e.type==="literal"?e:J.literal.buildNode(e);return{type:"namedArg",name:n,value:s}}function _o(n){return B(n.value)}const J={function:$o,literal:In,namedArg:Object.freeze(Object.defineProperty({__proto__:null,buildNode:wo,toOpenSearchQuery:_o},Symbol.toStringTag,{value:"Module"})),wildcard:Vn},So=oe,Ao=(n,e)=>"("+(n.arguments||[]).map(i=>ke(i,e)).join(" AND ")+")",Co=(n,e)=>{var{arguments:[s,i,o]}=n;let t="=";i.type==="wildcard"&&(t="");let c=ke(i);o=o.value||typeof c=="string",i.type==="literal"&&o&&(c=`'${c}'`),i.type==="literal"&&!o&&(c=`${c}`);let f=ke(s);return f==null?e&&o?`(${e.filter(d=>d.type==="string").map(d=>`${d.name} ILIKE '%${i.value}%'`).join(" OR ")})`:e&&!o&&(i.value===!0||i.value===!1)?`(${e.filter(d=>d.type==="boolean").map(d=>`${d.name}=${i.value}`).join(" OR ")})`:"":f+t+c},xo=(n,e)=>"("+(n.arguments||[]).map(i=>ke(i,e)).join(" OR ")+")",Eo=(n,e)=>{const[s]=n.arguments;return"NOT ("+ke(s,e)+")"},ko={gt:">",lt:"<",gte:">=",lte:"<="},Po={is:Co,and:Ao,or:xo,not:Eo,range:n=>{const[e,s]=n.arguments;let i=s.value;const o=ko[s.name];let t=ke(i);return i.type==="literal"&&(t=`${t}`),`${e.value} ${o} ${t}`},exists:n=>{const[e]=n.arguments;return`${e.value} IS NOT NULL`},nested:n=>(console.warn("Nested types dont exist in CQL",n),"")},To={function:(n,e)=>Po[n.function](n,e),literal:n=>n.value,wildcard:n=>{const{value:e}=n;return` LIKE '${e.split(So).join("%")}'`}},ke=(n,e)=>{const s=To[n.type];return s(n,e)},Oo=oe,Do=n=>({$and:(n.arguments||[]).map(i=>he(i))}),Lo=n=>{const{arguments:[e,s]}=n;let i=he(s);if(s.type==="wildcard"&&s.value==="@kuery-wildcard@")return Ei(n);let t={};return t[he(e)]={$eq:i},t},zo=n=>({$or:(n.arguments||[]).map(s=>he(s))}),No=n=>{const[e]=n.arguments;let s={};return s={$ne:he(e)},s},Bo={gt:"$gt",lt:"$lt",gte:"$gte",lte:"$lte"},Mo=n=>{const[e,s]=n.arguments;let i=s.value;const o=Bo[s.name];let t=he(i),c={};return c[e.value]={},c[e.value][o]=t,c},Ei=n=>{const[e]=n.arguments;return{[he(e)]:{$ne:null}}},jo={is:Lo,and:Do,or:zo,not:No,range:Mo,exists:Ei,nested:n=>(console.warn("TODO Implement nested search",n),"")},Ro={function:n=>jo[n.function](n),literal:n=>n.value,wildcard:n=>{const{value:e}=n;return`/${e.split(Oo).join(".*")}/`}},he=(n,e)=>{const s=Ro[n.type];return s(n,e)},Io=Object.freeze(Object.defineProperty({__proto__:null,DQLSyntaxError:Ai,doesKueryExpressionHaveLuceneSyntaxError:Un,fromKueryExpression:xt,fromLiteralExpression:je,nodeTypes:J,parse:xt,toCql:ke,toDSL:B,toMongo:he,toOpenSearchQuery:B},Symbol.toStringTag,{value:"Module"})),Uo=F`
783
- :host {
778
+ `}return`Not yet implemented ${this.variant}`}},R([g({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"checked",2),R([g({type:String,reflect:!0})],h.SpectricInput.prototype,"placeholder",2),R([g({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"readonly",2),R([g({type:String,reflect:!0})],h.SpectricInput.prototype,"variant",2),R([g({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"disabled",2),R([g({type:String,reflect:!0})],h.SpectricInput.prototype,"label",2),R([g()],h.SpectricInput.prototype,"hidePasswordLabel",2),R([g()],h.SpectricInput.prototype,"showPasswordLabel",2),R([g({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"showPasswordVisibilityToggle",2),R([g({type:String,reflect:!0})],h.SpectricInput.prototype,"helperText",2),R([g({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"invalid",2),R([g({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"required",2),R([g({type:String,reflect:!0})],h.SpectricInput.prototype,"invalidText",2),R([g()],h.SpectricInput.prototype,"name",2),R([g()],h.SpectricInput.prototype,"pattern",2),R([g({type:Number,reflect:!0})],h.SpectricInput.prototype,"maxCount",2),R([g({reflect:!0})],h.SpectricInput.prototype,"autocomplete",2),R([g({reflect:!0})],h.SpectricInput.prototype,"value",1),R([pe("input")],h.SpectricInput.prototype,"_input",2),R([Pe({capture:!0})],h.SpectricInput.prototype,"_handleChange",1),h.SpectricInput=R([I("spectric-input")],h.SpectricInput);const Ye=r=>Pi(r===""?void 0:r??void 0),wn="end of input",Sn={fieldName:"field name",value:"value",literal:"literal",whitespace:"whitespace"};class Fr extends Error{constructor(e,i){let s=e.message;if(e.expected){const o=e.expected.map(c=>Sn[c.description]||c.description).join(", ");let d=e.found?`"${e.found}"`:wn;s=`Expected ${o} but ${d} found.`}const t=[s,i,"-".repeat(e.location.start.offset)+"^"].join(`
779
+ `);super(t),this.name="DQLSyntaxError",this.shortMessage=s}}function Ze(r){return{type:"literal",value:r}}function Ni(r){return r.value}const xn=Object.freeze(Object.defineProperty({__proto__:null,buildNode:Ze,toOpenSearchQuery:Ni},Symbol.toStringTag,{value:"Module"})),{parse:Yt}=function(){class r extends SyntaxError{constructor(s,t,a,o){super(s),this.expected=t,this.found=a,this.location=o,this.name="SyntaxError"}format(s){let t="Error: "+this.message;if(this.location){let a=null;const o=s.find(_=>_.source===this.location.source);o&&(a=o.text.split(/\r\n|\n|\r/g));const d=this.location.start,c=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(d):d,b=this.location.source+":"+c.line+":"+c.column;if(a){const _=this.location.end,y="".padEnd(c.line.toString().length," "),C=a[d.line-1],S=(d.line===_.line?_.column:C.length+1)-d.column||1;t+=`
780
+ --> `+b+`
781
+ `+y+` |
782
+ `+c.line+" | "+C+`
783
+ `+y+" | "+"".padEnd(d.column-1," ")+"".padEnd(S,"^")}else t+=`
784
+ at `+b}return t}static buildMessage(s,t){function a(S){return S.codePointAt(0).toString(16).toUpperCase()}const o=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function d(S){return o?S.replace(o,A=>"\\u{"+a(A)+"}"):S}function c(S){return d(S.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,A=>"\\x0"+a(A)).replace(/[\x10-\x1F\x7F-\x9F]/g,A=>"\\x"+a(A)))}function b(S){return d(S.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,A=>"\\x0"+a(A)).replace(/[\x10-\x1F\x7F-\x9F]/g,A=>"\\x"+a(A)))}const _={literal(S){return'"'+c(S.text)+'"'},class(S){const A=S.parts.map(L=>Array.isArray(L)?b(L[0])+"-"+b(L[1]):b(L));return"["+(S.inverted?"^":"")+A.join("")+"]"+(S.unicode?"u":"")},any(){return"any character"},end(){return"end of input"},other(S){return S.description}};function y(S){return _[S.type](S)}function C(S){const A=S.map(y);if(A.sort(),A.length>0){let L=1;for(let N=1;N<A.length;N++)A[N-1]!==A[N]&&(A[L]=A[N],L++);A.length=L}switch(A.length){case 1:return A[0];case 2:return A[0]+" or "+A[1];default:return A.slice(0,-1).join(", ")+", or "+A[A.length-1]}}function w(S){return S?'"'+c(S)+'"':"end of input"}return"Expected "+C(s)+" but "+w(t)+" found."}}function e(i,s){s=s!==void 0?s:{};const t={},a=s.grammarSource,o={start:ms,Literal:lr};let d=ms;const c="(",b=")",_=":",y="{",C="}",w="or",S="and",A="not",L=".",N='"',ce="\\",z="*",Y="\\t",H="\\r",ut="\\n",ge="<@",Be="<=",X=">=",ri="<",pt=">",ht="©kuery-cursor©",Dt=/^[0-9]/,xe=/^[\\"]/,La=/^[^"]/,Da=/^[\\():<>"*{}]/,Na=/^[ \t\r\n]/,hs=j("(",!1),ds=j(")",!1),fs=j(":",!1),Ma=j("{",!1),za=j("}",!1),Ia=Ue("fieldName"),Ra=Ue("value"),ja=Ue("OR"),gs=j("or",!0),Ba=Ue("AND"),bs=j("and",!0),Ua=Ue("NOT"),ys=j("not",!0),Ha=Ue("literal"),Fa=j(".",!1),si=zt([["0","9"]],!1,!1,!1),ni=j('"',!1),tr=j("\\",!1),Qa=zt(["\\",'"'],!1,!1,!1),qa=zt(['"'],!0,!1,!1),Va=Fl(),Wa=j("*",!1),Ga=j("\\t",!1),Ya=j("\\r",!1),Za=j("\\n",!1),Ja=zt(["\\","(",")",":","<",">",'"',"*","{","}"],!1,!1,!1),Ka=j("<@",!1),Xa=j("<=",!1),el=j(">=",!1),tl=j("<",!1),il=j(">",!1),rl=Ue("whitespace"),sl=zt([" "," ","\r",`
785
+ `],!1,!1,!1),nl=j("©kuery-cursor©",!1);function ol(n,l){return l.type==="cursor"?{...l,suggestionTypes:["conjunction"],rule:"start"}:n!==null?n:He.function.buildNode("is","*","*")}function al(n,l){const p=[n,l].find(f=>f.type==="cursor");return p||ee("or",[n,l])}function ll(n,l){const p=[n,l].find(f=>f.type==="cursor");return p||ee("and",[n,l])}function cl(n){return n.type==="cursor"?n:ee("not",[n])}function ul(n,l){return l.type==="cursor"?{...l,suggestionTypes:["conjunction"],rule:"SubQuery"}:n}function pl(n,l,p){return l.type==="cursor"?{...l,nestedPath:l.nestedPath?`${n.value}.${l.nestedPath}`:n.value}:p.type==="cursor"?{...p,suggestionTypes:["conjunction"]}:ee("nested",[n,l])}function hl(n,l,p){return p.type==="cursor"?{...p,fieldName:n.value,suggestionTypes:["geo_value","conjunction"],rule:"FieldGeoSpatialExpression"}:{type:"function",function:"geospatial",arguments:[n,l,p]}}function dl(n,l,p){if(p.type==="cursor")return{...p,fieldName:n.value,suggestionTypes:["geo_value","conjunction"],rule:"FieldMultiGeoSpatialExpression"};Ps(l,p(n));const f=p(n);return f.function=="is"?ee("geospatial",[n,l,f.arguments[1]]):{...f,arguments:f.arguments.map(v=>ee("geospatial",{type:"function",function:"geospatial",arguments:[n,l,v.arguments[1]]}))}}function fl(n,l,p){if(p.type==="cursor")return{...p,fieldName:n.value,suggestionTypes:["value","conjunction"],rule:"FieldRangeExpression"};const f=Ps(l,p);return ee("range",[n,f])}function gl(n,l){return l.type==="cursor"?l.prefix.includes(ur)?{...l,fieldName:n.value,suggestionTypes:["conjunction"],rule:"FieldValueExpression"}:{...l,fieldName:n.value,suggestionTypes:["value","conjunction"],rule:"FieldValueExpression"}:l(n)}function bl(n){if(n.type==="cursor"){const p=`${n.prefix}${n.suffix}`.trim();return{...n,fieldName:p,suggestionTypes:["field","operator","conjunction"],rule:"ValueExpression"}}const l=ke(null);return n(l)}function yl(n,l){return l.type==="cursor"?{...l,suggestionTypes:["conjunction"],rule:"ListOfValues"}:n}function vl(n,l){const p=[n,l].find(f=>f.type==="cursor");return p?{...p,suggestionTypes:["value"],rule:"OrListOfValues"}:f=>ee("or",[n(f),l(f)])}function ml(n,l){const p=[n,l].find(f=>f.type==="cursor");return p?{...p,suggestionTypes:["value"],rule:"AndListOfValues"}:f=>ee("and",[n(f),l(f)])}function $l(n){return n.type==="cursor"?{...list,suggestionTypes:["value"],rule:"NotListOfValues"}:l=>ee("not",[n(l)])}function _l(n){if(n.type==="cursor")return n;const l=ke(!0);return p=>ee("is",[p,n,l])}function wl(n){if(n.type==="cursor")return n;!uc&&n.type==="wildcard"&&He.wildcard.hasLeadingWildcard(n)&&Ul("Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.");const l=ke(!1);return p=>ee("is",[p,n,l])}function Sl(){return parseFloat(Mt())}function xl(){return parseInt(Mt(),10)}function kl(n,l,p){const{start:f,end:v}=ir();return{type:"cursor",start:f.offset,end:v.offset-l.length,prefix:n.join(""),suffix:p.join(""),text:Mt().replace(l,""),rule:"QuotedString"}}function El(n){return ke(n.join(""))}function wc(n){return n}function Sc(n){return n}function Al(n,l,p){const{start:f,end:v}=ir();return{type:"cursor",start:f.offset,end:v.offset-l.length,prefix:n.join(""),suffix:p.join(""),text:Mt().replace(l,""),rule:"UnquotedLiteral"}}function Cl(n){const l=n.join("").trim();return l==="null"?ke(null):l==="true"?ke(!0):l==="false"?ke(!1):n.includes(ur)?pc(l):ke(/^(-?[1-9]+\d*([.]\d+)?)$|^(-?0[.]\d*[1-9]+)$|^0$|^0.0$|^[.]\d{1,}$/.test(l)?isFinite(l)&&(l>Number.MAX_SAFE_INTEGER||l<Number.MIN_SAFE_INTEGER)?BigInt(l):Number(l):l)}function xc(n){return n}function Ol(){return ur}function Pl(n,l,p){const{start:f,end:v}=ir();return{type:"cursor",start:f.offset,end:v.offset-l.length,prefix:n.join(""),suffix:p.join(""),text:Mt().replace(l,""),rule:"OptionalSpace"}}function Tl(){return" "}function Ll(){return"\r"}function Dl(){return`
786
+ `}function kc(n){return n}function Ec(n){return n}function Nl(){return"within"}function Ml(){return"lte"}function zl(){return"gte"}function Il(){return"lt"}function Rl(){return"gt"}function jl(){return lc}function Bl(){return cc}let u=s.peg$currPos|0,P=u;const dt=[{line:1,column:1}];let ie=u,oi=s.peg$maxFailExpected||[],m=s.peg$silentFails|0,Nt;if(s.startRule){if(!(s.startRule in o))throw new Error(`Can't start parsing from rule "`+s.startRule+'".');d=o[s.startRule]}function Mt(){return i.substring(P,u)}function ir(){return ai(P,u)}function Ul(n,l){throw l=l!==void 0?l:ai(P,u),ql(n,l)}function Hl(n=u){const l=i.codePointAt(n);return l===void 0?"":String.fromCodePoint(l)}function j(n,l){return{type:"literal",text:n,ignoreCase:l}}function zt(n,l,p,f){return{type:"class",parts:n,inverted:l,ignoreCase:p,unicode:f}}function Fl(){return{type:"any"}}function Ql(){return{type:"end"}}function Ue(n){return{type:"other",description:n}}function vs(n){let l=dt[n],p;if(l)return l;if(n>=dt.length)p=dt.length-1;else for(p=n;!dt[--p];);for(l=dt[p],l={line:l.line,column:l.column};p<n;)i.charCodeAt(p)===10?(l.line++,l.column=1):l.column++,p++;return dt[n]=l,l}function ai(n,l,p){const f=vs(n),v=vs(l);return{source:a,start:{offset:n,line:f.line,column:f.column},end:{offset:l,line:v.line,column:v.column}}}function E(n){u<ie||(u>ie&&(ie=u,oi=[]),oi.push(n))}function ql(n,l){return new r(n,null,null,l)}function Vl(n,l,p){return new r(r.buildMessage(n,l),n,l,p)}function ms(){let n,l,p,f;for(n=u,l=[],p=O();p!==t;)l.push(p),p=O();return p=li(),p===t&&(p=null),f=Rt(),f!==t?(P=n,n=ol(p,f)):(u=n,n=t),n}function li(){let n,l,p,f;return n=u,l=rr(),l!==t?(p=nr(),p!==t?(f=li(),f!==t?(P=n,n=al(l,f)):(u=n,n=t)):(u=n,n=t)):(u=n,n=t),n===t&&(n=rr()),n}function rr(){let n,l,p,f;return n=u,l=$s(),l!==t?(p=or(),p!==t?(f=rr(),f!==t?(P=n,n=ll(l,f)):(u=n,n=t)):(u=n,n=t)):(u=n,n=t),n===t&&(n=$s()),n}function $s(){let n,l,p;return n=u,l=ar(),l!==t?(p=_s(),p!==t?(P=n,n=cl(p)):(u=n,n=t)):(u=n,n=t),n===t&&(n=_s()),n}function _s(){let n,l,p,f,v,k;if(n=u,i.charCodeAt(u)===40?(l=c,u++):(l=t,m===0&&E(hs)),l!==t){for(p=[],f=O();f!==t;)p.push(f),f=O();f=li(),f!==t?(v=Rt(),v!==t?(i.charCodeAt(u)===41?(k=b,u++):(k=t,m===0&&E(ds)),k!==t?(P=n,n=ul(f,v)):(u=n,n=t)):(u=n,n=t)):(u=n,n=t)}else u=n,n=t;return n===t&&(n=Wl()),n}function Wl(){let n,l,p,f,v,k,Ls,Fe,hr,dr;if(n=u,l=It(),l!==t){for(p=[],f=O();f!==t;)p.push(f),f=O();if(i.charCodeAt(u)===58?(f=_,u++):(f=t,m===0&&E(fs)),f!==t){for(v=[],k=O();k!==t;)v.push(k),k=O();if(i.charCodeAt(u)===123?(k=y,u++):(k=t,m===0&&E(Ma)),k!==t){for(Ls=[],Fe=O();Fe!==t;)Ls.push(Fe),Fe=O();Fe=li(),Fe!==t?(hr=Rt(),hr!==t?(i.charCodeAt(u)===125?(dr=C,u++):(dr=t,m===0&&E(za)),dr!==t?(P=n,n=pl(l,Fe,hr)):(u=n,n=t)):(u=n,n=t)):(u=n,n=t)}else u=n,n=t}else u=n,n=t}else u=n,n=t;return n===t&&(n=Gl()),n}function Gl(){let n;return n=Yl(),n===t&&(n=Zl(),n===t&&(n=Jl(),n===t&&(n=Kl(),n===t&&(n=Xl())))),n}function It(){let n;return m++,n=lr(),m--,n===t&&m===0&&E(Ia),n}function Yl(){let n,l,p,f,v,k;if(n=u,l=It(),l!==t){for(p=[],f=O();f!==t;)p.push(f),f=O();if(f=Os(),f!==t){for(v=[],k=O();k!==t;)v.push(k),k=O();k=lr(),k!==t?(P=n,n=hl(l,f,k)):(u=n,n=t)}else u=n,n=t}else u=n,n=t;return n}function Zl(){let n,l,p,f,v,k;if(n=u,l=It(),l!==t){for(p=[],f=O();f!==t;)p.push(f),f=O();if(f=Os(),f!==t){for(v=[],k=O();k!==t;)v.push(k),k=O();k=ci(),k!==t?(P=n,n=dl(l,f,k)):(u=n,n=t)}else u=n,n=t}else u=n,n=t;return n}function Jl(){let n,l,p,f,v,k;if(n=u,l=It(),l!==t){for(p=[],f=O();f!==t;)p.push(f),f=O();if(f=ac(),f!==t){for(v=[],k=O();k!==t;)v.push(k),k=O();k=ic(),k!==t?(P=n,n=fl(l,f,k)):(u=n,n=t)}else u=n,n=t}else u=n,n=t;return n}function Kl(){let n,l,p,f,v,k;if(n=u,l=It(),l!==t){for(p=[],f=O();f!==t;)p.push(f),f=O();if(i.charCodeAt(u)===58?(f=_,u++):(f=t,m===0&&E(fs)),f!==t){for(v=[],k=O();k!==t;)v.push(k),k=O();k=ci(),k!==t?(P=n,n=gl(l,k)):(u=n,n=t)}else u=n,n=t}else u=n,n=t;return n}function Xl(){let n,l;return n=u,l=xs(),l!==t&&(P=n,l=bl(l)),n=l,n}function ci(){let n,l,p,f,v,k;if(n=u,i.charCodeAt(u)===40?(l=c,u++):(l=t,m===0&&E(hs)),l!==t){for(p=[],f=O();f!==t;)p.push(f),f=O();f=ws(),f!==t?(v=Rt(),v!==t?(i.charCodeAt(u)===41?(k=b,u++):(k=t,m===0&&E(ds)),k!==t?(P=n,n=yl(f,v)):(u=n,n=t)):(u=n,n=t)):(u=n,n=t)}else u=n,n=t;return n===t&&(n=xs()),n}function ws(){let n,l,p,f;return n=u,l=sr(),l!==t?(p=nr(),p!==t?(f=ws(),f!==t?(P=n,n=vl(l,f)):(u=n,n=t)):(u=n,n=t)):(u=n,n=t),n===t&&(n=sr()),n}function sr(){let n,l,p,f;return n=u,l=Ss(),l!==t?(p=or(),p!==t?(f=sr(),f!==t?(P=n,n=ml(l,f)):(u=n,n=t)):(u=n,n=t)):(u=n,n=t),n===t&&(n=Ss()),n}function Ss(){let n,l,p;return n=u,l=ar(),l!==t?(p=ci(),p!==t?(P=n,n=$l(p)):(u=n,n=t)):(u=n,n=t),n===t&&(n=ci()),n}function xs(){let n,l;return m++,n=u,l=cr(),l!==t&&(P=n,l=_l(l)),n=l,n===t&&(n=u,l=Es(),l!==t&&(P=n,l=wl(l)),n=l),m--,n===t&&(l=t,m===0&&E(Ra)),n}function nr(){let n,l,p,f,v;if(m++,n=u,l=[],p=O(),p!==t)for(;p!==t;)l.push(p),p=O();else l=t;if(l!==t)if(p=i.substr(u,2),p.toLowerCase()===w?u+=2:(p=t,m===0&&E(gs)),p!==t){if(f=[],v=O(),v!==t)for(;v!==t;)f.push(v),v=O();else f=t;f!==t?(l=[l,p,f],n=l):(u=n,n=t)}else u=n,n=t;else u=n,n=t;return m--,n===t&&(l=t,m===0&&E(ja)),n}function or(){let n,l,p,f,v;if(m++,n=u,l=[],p=O(),p!==t)for(;p!==t;)l.push(p),p=O();else l=t;if(l!==t)if(p=i.substr(u,3),p.toLowerCase()===S?u+=3:(p=t,m===0&&E(bs)),p!==t){if(f=[],v=O(),v!==t)for(;v!==t;)f.push(v),v=O();else f=t;f!==t?(l=[l,p,f],n=l):(u=n,n=t)}else u=n,n=t;else u=n,n=t;return m--,n===t&&(l=t,m===0&&E(Ba)),n}function ar(){let n,l,p,f;if(m++,n=u,l=i.substr(u,3),l.toLowerCase()===A?u+=3:(l=t,m===0&&E(ys)),l!==t){if(p=[],f=O(),f!==t)for(;f!==t;)p.push(f),f=O();else p=t;p!==t?(l=[l,p],n=l):(u=n,n=t)}else u=n,n=t;return m--,n===t&&(l=t,m===0&&E(Ua)),n}function lr(){let n;return m++,n=cr(),n===t&&(n=Es()),m--,n===t&&m===0&&E(Ha),n}function ec(){let n;return n=tc(),n===t&&(n=ks()),n}function tc(){let n,l,p,f,v;if(n=u,l=ks(),l!==t)if(i.charCodeAt(u)===46?(p=L,u++):(p=t,m===0&&E(Fa)),p!==t){if(f=[],v=i.charAt(u),Dt.test(v)?u++:(v=t,m===0&&E(si)),v!==t)for(;v!==t;)f.push(v),v=i.charAt(u),Dt.test(v)?u++:(v=t,m===0&&E(si));else f=t;f!==t?(P=n,n=Sl()):(u=n,n=t)}else u=n,n=t;else u=n,n=t;return n}function ks(){let n,l,p;if(n=u,l=[],p=i.charAt(u),Dt.test(p)?u++:(p=t,m===0&&E(si)),p!==t)for(;p!==t;)l.push(p),p=i.charAt(u),Dt.test(p)?u++:(p=t,m===0&&E(si));else l=t;return l!==t&&(P=n,l=xl()),n=l,n}function cr(){let n,l,p,f,v,k;if(n=u,i.charCodeAt(u)===34?(l=N,u++):(l=t,m===0&&E(ni)),l!==t){for(p=[],f=ft();f!==t;)p.push(f),f=ft();if(f=jt(),f!==t){for(v=[],k=ft();k!==t;)v.push(k),k=ft();i.charCodeAt(u)===34?(k=N,u++):(k=t,m===0&&E(ni)),k!==t?(P=n,n=kl(p,f,v)):(u=n,n=t)}else u=n,n=t}else u=n,n=t;if(n===t)if(n=u,i.charCodeAt(u)===34?(l=N,u++):(l=t,m===0&&E(ni)),l!==t){for(p=[],f=ft();f!==t;)p.push(f),f=ft();i.charCodeAt(u)===34?(f=N,u++):(f=t,m===0&&E(ni)),f!==t?(P=n,n=El(p)):(u=n,n=t)}else u=n,n=t;return n}function ic(){let n;return n=ec(),n===t&&(n=cr(),n===t&&(n=Rt())),n}function ft(){let n,l,p;return n=As(),n===t&&(n=u,i.charCodeAt(u)===92?(l=ce,u++):(l=t,m===0&&E(tr)),l!==t?(p=i.charAt(u),xe.test(p)?u++:(p=t,m===0&&E(Qa)),p!==t?(P=n,n=p):(u=n,n=t)):(u=n,n=t),n===t&&(n=u,l=u,m++,p=jt(),m--,p===t?l=void 0:(u=l,l=t),l!==t?(p=i.charAt(u),La.test(p)?u++:(p=t,m===0&&E(qa)),p!==t?(P=n,n=p):(u=n,n=t)):(u=n,n=t))),n}function Es(){let n,l,p,f,v;for(n=u,l=[],p=gt();p!==t;)l.push(p),p=gt();if(p=jt(),p!==t){for(f=[],v=gt();v!==t;)f.push(v),v=gt();P=n,n=Al(l,p,f)}else u=n,n=t;if(n===t){if(n=u,l=[],p=gt(),p!==t)for(;p!==t;)l.push(p),p=gt();else l=t;l!==t&&(P=n,l=Cl(l)),n=l}return n}function gt(){let n,l,p,f,v;return n=As(),n===t&&(n=sc(),n===t&&(n=nc(),n===t&&(n=rc(),n===t&&(n=u,l=u,m++,p=Cs(),m--,p===t?l=void 0:(u=l,l=t),l!==t?(p=u,m++,f=oc(),m--,f===t?p=void 0:(u=p,p=t),p!==t?(f=u,m++,v=jt(),m--,v===t?f=void 0:(u=f,f=t),f!==t?(i.length>u?(v=i.charAt(u),u++):(v=t,m===0&&E(Va)),v!==t?(P=n,n=v):(u=n,n=t)):(u=n,n=t)):(u=n,n=t)):(u=n,n=t))))),n}function rc(){let n,l;return n=u,i.charCodeAt(u)===42?(l=z,u++):(l=t,m===0&&E(Wa)),l!==t&&(P=n,l=Ol()),n=l,n}function Rt(){let n,l,p,f,v;for(n=u,l=[],p=O();p!==t;)l.push(p),p=O();if(p=jt(),p!==t){for(f=[],v=O();v!==t;)f.push(v),v=O();P=n,n=Pl(l,p,f)}else u=n,n=t;if(n===t)for(n=[],l=O();l!==t;)n.push(l),l=O();return n}function As(){let n,l;return n=u,i.substr(u,2)===Y?(l=Y,u+=2):(l=t,m===0&&E(Ga)),l!==t&&(P=n,l=Tl()),n=l,n===t&&(n=u,i.substr(u,2)===H?(l=H,u+=2):(l=t,m===0&&E(Ya)),l!==t&&(P=n,l=Ll()),n=l,n===t&&(n=u,i.substr(u,2)===ut?(l=ut,u+=2):(l=t,m===0&&E(Za)),l!==t&&(P=n,l=Dl()),n=l)),n}function sc(){let n,l,p;return n=u,i.charCodeAt(u)===92?(l=ce,u++):(l=t,m===0&&E(tr)),l!==t?(p=Cs(),p!==t?(P=n,n=p):(u=n,n=t)):(u=n,n=t),n}function nc(){let n,l,p;return n=u,i.charCodeAt(u)===92?(l=ce,u++):(l=t,m===0&&E(tr)),l!==t?(p=i.substr(u,2),p.toLowerCase()===w?u+=2:(p=t,m===0&&E(gs)),p===t&&(p=i.substr(u,3),p.toLowerCase()===S?u+=3:(p=t,m===0&&E(bs)),p===t&&(p=i.substr(u,3),p.toLowerCase()===A?u+=3:(p=t,m===0&&E(ys)))),p!==t?(P=n,n=p):(u=n,n=t)):(u=n,n=t),n}function oc(){let n;return n=nr(),n===t&&(n=or(),n===t&&(n=ar())),n}function Cs(){let n;return n=i.charAt(u),Da.test(n)?u++:(n=t,m===0&&E(Ja)),n}function Os(){let n,l;return n=u,i.substr(u,2)===ge?(l=ge,u+=2):(l=t,m===0&&E(Ka)),l!==t&&(P=n,l=Nl()),n=l,n}function ac(){let n,l;return n=u,i.substr(u,2)===Be?(l=Be,u+=2):(l=t,m===0&&E(Xa)),l!==t&&(P=n,l=Ml()),n=l,n===t&&(n=u,i.substr(u,2)===X?(l=X,u+=2):(l=t,m===0&&E(el)),l!==t&&(P=n,l=zl()),n=l,n===t&&(n=u,i.charCodeAt(u)===60?(l=ri,u++):(l=t,m===0&&E(tl)),l!==t&&(P=n,l=Il()),n=l,n===t&&(n=u,i.charCodeAt(u)===62?(l=pt,u++):(l=t,m===0&&E(il)),l!==t&&(P=n,l=Rl()),n=l))),n}function O(){let n;return m++,n=i.charAt(u),Na.test(n)?u++:(n=t,m===0&&E(sl)),m--,n===t&&m===0&&E(rl),n}function jt(){let n,l,p;return n=u,P=u,l=jl(),l?l=void 0:l=t,l!==t?(i.substr(u,14)===ht?(p=ht,u+=14):(p=t,m===0&&E(nl)),p!==t?(P=n,n=Bl()):(u=n,n=t)):(u=n,n=t),n}const{errorOnLuceneSyntax:Ac,parseCursor:lc,cursorSymbol:cc,allowLeadingWildcards:uc=!0,helpers:{nodeTypes:He}}=s,ee=He.function.buildNodeWithArgumentNodes,ke=He.literal.buildNode,pc=He.wildcard.buildNode,Ps=He.namedArg.buildNode,{wildcardSymbol:ur}=He.wildcard;Nt=d();const pr=Nt!==t&&u===i.length;function Ts(){throw Nt!==t&&u<i.length&&E(Ql()),Vl(oi,ie<i.length?Hl(ie):null,ie<i.length?ai(ie,ie+1):ai(ie,ie))}if(s.peg$library)return{peg$result:Nt,peg$currPos:u,peg$FAILED:t,peg$maxFailExpected:oi,peg$maxFailPos:ie,peg$success:pr,peg$throw:pr?void 0:Ts};if(pr)return Nt;Ts()}return{StartRules:["start","Literal"],SyntaxError:r,parse:e}}(),Mi=(r,e={},i=Yt)=>{if(typeof r>"u")throw new Error("expression must be a string, got undefined instead");return i(r,{...e,helpers:{nodeTypes:ae}})},Je=(r,e={})=>Mi(r,{...e,startRule:"Literal"},Yt),Zt=(r,e={})=>{try{return Mi(r,e,Yt)}catch(i){throw i.name==="SyntaxError"?new Fr(i,r):i}},kn=r=>{try{return Mi(r,{errorOnLuceneSyntax:!0},Yt),!1}catch(e){return e.message.startsWith("Lucene")}},F=(r,e,i,s)=>(e=void 0,!r||!r.type||!ae[r.type]?F(ae.function.buildNode("and",[]),e):ae[r.type].toOpenSearchQuery(r,e,i,s)),he="@kuery-wildcard@";function En(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function An(r){return r.replace(/[+-=&|><!(){}[\]^"~*?:\\/]/g,"\\$&")}function Cn(r){return r.includes(he)?{type:"wildcard",value:r}:Je(r)}function Qr(r,e){const{value:i}=r,s=i.split(he).map(En).join("[\\s\\S]*");return new RegExp(`^${s}$`).test(e)}function On(r){const{value:e}=r;return e.split(he).join("*")}function zi(r){const{value:e}=r;return e.split(he).map(An).join("*")}function Pn(r){const{value:e}=r;return e.startsWith(he)&&e.replace(he,"").length>0}const Tn=Object.freeze(Object.defineProperty({__proto__:null,buildNode:Cn,hasLeadingWildcard:Pn,test:Qr,toOpenSearchQuery:On,toQueryStringQuery:zi,wildcardSymbol:he},Symbol.toStringTag,{value:"Module"}));function Ii(r,e){if(!e)return[];if(r.type==="literal"){const i=Ni(r),s=e.fields.find(t=>t.name===i);return s?[s]:[]}else if(r.type==="wildcard")return e.fields.filter(s=>Qr(r,s.name))}function hc(r){return r}function qr(r,e,i){const s={...r,value:i?`${i}.${r.value}`:r.value};if(!e||s.type==="wildcard"&&!i)return s;const a=Ii(s,e).reduce((o,d)=>{const c=d.subType&&d.subType.nested?d.subType.nested.path:void 0;return i&&!c?[...o,`${d.name} is not a nested field but is in nested group "${i}" in the DQL expression.`]:c&&!i?[...o,`${d.name} is a nested field, but is not in a nested group in the DQL expression.`]:c!==i?[...o,`Nested field ${d.name} is being queried with the incorrect nested path. The correct path is ${d.subType.nested.path}.`]:o},[]);if(a.length>0)throw new Error(a.join(`
787
+ `));return s}function Ln(r,e,i=!1){if(r===void 0)throw new Error("fieldName is a required argument");if(e===void 0)throw new Error("value is a required argument");const s=typeof r=="string"?Je(r):Ze(r),t=typeof e=="string"?Je(e):Ze(e),a=Ze(i);return{arguments:[s,t,a]}}function Dn(r,e,i={},s={}){const{arguments:[t,a,o]}=r,d=qr(t,e,s!=null&&s.nested?s.nested.path:void 0),c=F(d),b=a!==void 0?F(a):a,_=o.value?"phrase":"best_fields";if(d.value===null)return a.type==="wildcard"?{query_string:{query:zi(a)}}:{multi_match:{type:_,query:b,lenient:!0}};const y=e?Ii(d,e):[];y&&y.length===0&&y.push({name:F(d),scripted:!1,type:""});const C=a.type==="wildcard"&&b==="*",w=d.type==="wildcard"&&c==="*"||y&&e&&y.length===e.fields.length;return C&&w?{match_all:{}}:{bool:{should:y.reduce((L,N)=>{const ce=z=>{var Y;return d.type!=="wildcard"||!((Y=N.subType)!=null&&Y.nested)||s!=null&&s.nested?z:{nested:{path:N.subType.nested.path,query:z,score_mode:"none"}}};if(N.scripted)return[];if(C)return[...L,ce({exists:{field:N.name}})];if(a.type==="wildcard")return[...L,ce({query_string:{fields:[N.name],query:zi(a)}})];if(N.type==="date"){const z=i.dateFormatTZ?{time_zone:i.dateFormatTZ}:{};return[...L,ce({range:{[N.name]:{gte:b,lte:b,...z}}})]}else{const z=_==="phrase"?"match_phrase":"match";return[...L,ce({[z]:{[N.name]:b}})]}},[])||[],minimum_should_match:1}}}const Nn=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:Ln,toOpenSearchQuery:Dn},Symbol.toStringTag,{value:"Module"}));function Mn(r){return{arguments:r}}function zn(r,e,i={},s={}){return{bool:{filter:(r.arguments||[]).map(a=>F(a,e,i,s))}}}const In=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:Mn,toOpenSearchQuery:zn},Symbol.toStringTag,{value:"Module"}));function Rn(r){return{arguments:r}}function jn(r,e,i={},s={}){return{bool:{should:(r.arguments||[]).map(a=>F(a,e,i,s)),minimum_should_match:1}}}const Bn=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:Rn,toOpenSearchQuery:jn},Symbol.toStringTag,{value:"Module"}));function Un(r){return{arguments:[r]}}function Hn(r,e,i={},s={}){const[t]=r.arguments;return{bool:{must_not:F(t,e,i,s)}}}const Fn=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:Un,toOpenSearchQuery:Hn},Symbol.toStringTag,{value:"Module"}));function Qn(r,...e){let i={};for(let s of e)i[s]=r[s];return i}function qn(r,e){const i=Qn(e,"gt","lt","gte","lte","format"),s=typeof r=="string"?Je(r):ae.literal.buildNode(r),t=Object.entries(i).map(a=>{let[o,d]=a;return ae.namedArg.buildNode(o,d)});return{arguments:[s,...t]}}function Vn(r,e,i={},s={}){const[t,...a]=r.arguments,o=qr(t,e,s!=null&&s.nested?s.nested.path:void 0),d=e?Ii(o,e):[],c=Wn(a),b=Object.fromEntries(Object.entries(c).map(([y,C])=>[y,F(C)]));return d&&d.length===0&&d.push({name:F(o),scripted:!1,type:""}),{bool:{should:d.map(y=>{const C=w=>{var S;return o.type!=="wildcard"||!((S=y.subType)!=null&&S.nested)||s.nested?w:{nested:{path:y.subType.nested.path,query:w,score_mode:"none"}}};if(y.scripted)return{};if(y.type==="date"){const w=i.dateFormatTZ?{time_zone:i.dateFormatTZ}:{};return C({range:{[y.name]:{...b,...w}}})}return C({range:{[y.name]:b}})}),minimum_should_match:1}}}function Wn(r){if(r.gt&&r.gte||r.lt&&r.lte)throw new Error("range ends cannot be both inclusive and exclusive");const e=["gte","lte","format"];return r.reduce((i,s,t)=>(s.type==="namedArg"?i[s.name]=s.value:i[e[t]]=s,i),{})}const Gn=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:qn,toOpenSearchQuery:Vn},Symbol.toStringTag,{value:"Module"}));function Yn(r){return{arguments:[Ze(r)]}}function Zn(r,e,i={},s={}){const{arguments:[t]}=r,a={...t,value:s!=null&&s.nested?`${s.nested.path}.${t.value}`:t.value},o=Ni(a),d=((e==null?void 0:e.fields)||[]).find(c=>c.name===o);if(d&&d.scripted)throw new Error("Exists query does not support scripted fields");return{exists:{field:o}}}const Jn=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:Yn,toOpenSearchQuery:Zn},Symbol.toStringTag,{value:"Module"}));function Kn(r,e){return{arguments:[typeof r=="string"?Je(r):Ze(r),e]}}function Xn(r,e,i={},s={}){var c;const[t,a]=r.arguments,o=F(t),d=(c=s==null?void 0:s.nested)!=null&&c.path?`${s.nested.path}.${o}`:o;return{nested:{path:d,query:F(a,e,i,{...s,nested:{path:d}}),score_mode:"none"}}}const eo=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:Kn,toOpenSearchQuery:Xn},Symbol.toStringTag,{value:"Module"}));/* @preserve
788
+ * @terraformer/wkt - v2.2.0 - MIT
789
+ * Copyright (c) 2012-2024 Environmental Systems Research Institute, Inc.
790
+ * Wed May 15 2024 14:35:51 GMT-0700 (Pacific Daylight Time)
791
+ */var x=function(e,i,s,t){for(s=s||{},t=e.length;t--;s[e[t]]=i);return s},Ke=[1,9],Xe=[1,10],et=[1,11],tt=[1,12],it=[1,13],rt=[1,14],st=[1,15],U=[1,60],T=[5,15,19],de=[1,67],oe=[1,73],At=[1,87],Ct=[1,104],D=[15,19],me=[1,110],fe=[1,116],Jt=[1,130],Kt=[1,136],Ot={trace:function(){},yy:{},symbols_:{error:2,expressions:3,point:4,EOF:5,linestring:6,polygon:7,multipoint:8,multilinestring:9,multipolygon:10,geometrycollection:11,coordinate:12,DOUBLE_TOK:13,ptarray:14,COMMA:15,ring_list:16,ring:17,"(":18,")":19,POINT:20,Z:21,ZM:22,M:23,EMPTY:24,point_untagged:25,polygon_list:26,polygon_untagged:27,point_list:28,LINESTRING:29,POLYGON:30,MULTIPOINT:31,MULTILINESTRING:32,MULTIPOLYGON:33,geometry:34,geometry_collection:35,GEOMETRYCOLLECTION:36,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",13:"DOUBLE_TOK",15:"COMMA",18:"(",19:")",20:"POINT",21:"Z",22:"ZM",23:"M",24:"EMPTY",29:"LINESTRING",30:"POLYGON",31:"MULTIPOINT",32:"MULTILINESTRING",33:"MULTIPOLYGON",36:"GEOMETRYCOLLECTION"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[12,2],[12,3],[12,4],[14,3],[14,1],[16,3],[16,1],[17,3],[4,4],[4,5],[4,5],[4,5],[4,2],[25,1],[25,3],[26,3],[26,1],[27,3],[28,3],[28,1],[6,4],[6,5],[6,5],[6,5],[6,2],[7,4],[7,5],[7,5],[7,5],[7,2],[8,4],[8,5],[8,5],[8,5],[8,2],[9,4],[9,5],[9,5],[9,5],[9,2],[10,4],[10,5],[10,5],[10,5],[10,2],[34,1],[34,1],[34,1],[34,1],[34,1],[34,1],[34,1],[35,3],[35,1],[11,4],[11,5],[11,5],[11,5],[11,2]],performAction:function(e,i,s,t,a,o,d){var c=o.length-1;switch(a){case 1:case 2:case 3:case 4:case 5:case 6:case 7:return o[c-1];case 8:this.$=new Pt([Number(o[c-1]),Number(o[c])]);break;case 9:this.$=new Pt([Number(o[c-2]),Number(o[c-1]),Number(o[c])]);break;case 10:this.$=new Pt([Number(o[c-3]),Number(o[c-2]),Number(o[c-1]),Number(o[c])]);break;case 11:case 26:this.$=o[c-2].addPoint(o[c]);break;case 12:case 21:case 27:case 53:case 54:case 55:case 56:case 57:case 58:case 59:this.$=o[c];break;case 13:this.$=o[c-2].addRing(o[c]);break;case 14:this.$=new Ri(o[c]);break;case 15:this.$=new Wr(o[c-1]);break;case 16:this.$={type:"Point",coordinates:o[c-1].data[0]};break;case 17:this.$={type:"Point",coordinates:o[c-1].data[0],properties:{z:!0}};break;case 18:this.$={type:"Point",coordinates:o[c-1].data[0],properties:{z:!0,m:!0}};break;case 19:this.$={type:"Point",coordinates:o[c-1].data[0],properties:{m:!0}};break;case 20:this.$={type:"Point",coordinates:[]};break;case 22:case 25:this.$=o[c-1];break;case 23:this.$=o[c-2].addPolygon(o[c]);break;case 24:this.$=new Bi(o[c]);break;case 28:this.$={type:"LineString",coordinates:o[c-1].data};break;case 29:this.$={type:"LineString",coordinates:o[c-1].data,properties:{z:!0}};break;case 30:this.$={type:"LineString",coordinates:o[c-1].data,properties:{m:!0}};break;case 31:this.$={type:"LineString",coordinates:o[c-1].data,properties:{z:!0,m:!0}};break;case 32:this.$={type:"LineString",coordinates:[]};break;case 33:this.$={type:"Polygon",coordinates:o[c-1].toJSON()};break;case 34:this.$={type:"Polygon",coordinates:o[c-1].toJSON(),properties:{z:!0}};break;case 35:this.$={type:"Polygon",coordinates:o[c-1].toJSON(),properties:{m:!0}};break;case 36:this.$={type:"Polygon",coordinates:o[c-1].toJSON(),properties:{z:!0,m:!0}};break;case 37:this.$={type:"Polygon",coordinates:[]};break;case 38:this.$={type:"MultiPoint",coordinates:o[c-1].data};break;case 39:this.$={type:"MultiPoint",coordinates:o[c-1].data,properties:{z:!0}};break;case 40:this.$={type:"MultiPoint",coordinates:o[c-1].data,properties:{m:!0}};break;case 41:this.$={type:"MultiPoint",coordinates:o[c-1].data,properties:{z:!0,m:!0}};break;case 42:this.$={type:"MultiPoint",coordinates:[]};break;case 43:this.$={type:"MultiLineString",coordinates:o[c-1].toJSON()};break;case 44:this.$={type:"MultiLineString",coordinates:o[c-1].toJSON(),properties:{z:!0}};break;case 45:this.$={type:"MultiLineString",coordinates:o[c-1].toJSON(),properties:{m:!0}};break;case 46:this.$={type:"MultiLineString",coordinates:o[c-1].toJSON(),properties:{z:!0,m:!0}};break;case 47:this.$={type:"MultiLineString",coordinates:[]};break;case 48:this.$={type:"MultiPolygon",coordinates:o[c-1].toJSON()};break;case 49:this.$={type:"MultiPolygon",coordinates:o[c-1].toJSON(),properties:{z:!0}};break;case 50:this.$={type:"MultiPolygon",coordinates:o[c-1].toJSON(),properties:{m:!0}};break;case 51:this.$={type:"MultiPolygon",coordinates:o[c-1].toJSON(),properties:{z:!0,m:!0}};break;case 52:this.$={type:"MultiPolygon",coordinates:[]};break;case 60:this.$=o[c-2].addGeometry(o[c]);break;case 61:this.$=new ji(o[c]);break;case 62:this.$={type:"GeometryCollection",geometries:o[c-1].toJSON()};break;case 63:this.$={type:"GeometryCollection",geometries:o[c-1].toJSON(),properties:{z:!0}};break;case 64:this.$={type:"GeometryCollection",geometries:o[c-1].toJSON(),properties:{m:!0}};break;case 65:this.$={type:"GeometryCollection",geometries:o[c-1].toJSON(),properties:{z:!0,m:!0}};break;case 66:this.$={type:"GeometryCollection",geometries:[]};break}},table:[{3:1,4:2,6:3,7:4,8:5,9:6,10:7,11:8,20:Ke,29:Xe,30:et,31:tt,32:it,33:rt,36:st},{1:[3]},{5:[1,16]},{5:[1,17]},{5:[1,18]},{5:[1,19]},{5:[1,20]},{5:[1,21]},{5:[1,22]},{18:[1,23],21:[1,24],22:[1,25],23:[1,26],24:[1,27]},{18:[1,28],21:[1,29],22:[1,31],23:[1,30],24:[1,32]},{18:[1,33],21:[1,34],22:[1,36],23:[1,35],24:[1,37]},{18:[1,38],21:[1,39],22:[1,41],23:[1,40],24:[1,42]},{18:[1,43],21:[1,44],22:[1,46],23:[1,45],24:[1,47]},{18:[1,48],21:[1,49],22:[1,51],23:[1,50],24:[1,52]},{18:[1,53],21:[1,54],22:[1,56],23:[1,55],24:[1,57]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{1:[2,7]},{12:59,13:U,14:58},{18:[1,61]},{18:[1,62]},{18:[1,63]},x(T,[2,20]),{12:66,13:U,18:de,25:65,28:64},{18:[1,68]},{18:[1,69]},{18:[1,70]},x(T,[2,32]),{16:71,17:72,18:oe},{18:[1,74]},{18:[1,75]},{18:[1,76]},x(T,[2,37]),{12:66,13:U,18:de,25:65,28:77},{18:[1,78]},{18:[1,79]},{18:[1,80]},x(T,[2,42]),{16:81,17:72,18:oe},{18:[1,82]},{18:[1,83]},{18:[1,84]},x(T,[2,47]),{18:At,26:85,27:86},{18:[1,88]},{18:[1,89]},{18:[1,90]},x(T,[2,52]),{4:93,6:94,7:95,8:96,9:97,10:98,11:99,20:Ke,29:Xe,30:et,31:tt,32:it,33:rt,34:92,35:91,36:st},{18:[1,100]},{18:[1,101]},{18:[1,102]},x(T,[2,66]),{15:Ct,19:[1,103]},x(D,[2,12]),{13:[1,105]},{12:59,13:U,14:106},{12:59,13:U,14:107},{12:59,13:U,14:108},{15:me,19:[1,109]},x(D,[2,27]),x(D,[2,21]),{12:111,13:U},{12:66,13:U,18:de,25:65,28:112},{12:66,13:U,18:de,25:65,28:113},{12:66,13:U,18:de,25:65,28:114},{15:fe,19:[1,115]},x(D,[2,14]),{12:59,13:U,14:117},{16:118,17:72,18:oe},{16:119,17:72,18:oe},{16:120,17:72,18:oe},{15:me,19:[1,121]},{12:66,13:U,18:de,25:65,28:122},{12:66,13:U,18:de,25:65,28:123},{12:66,13:U,18:de,25:65,28:124},{15:fe,19:[1,125]},{16:126,17:72,18:oe},{16:127,17:72,18:oe},{16:128,17:72,18:oe},{15:Jt,19:[1,129]},x(D,[2,24]),{16:131,17:72,18:oe},{18:At,26:132,27:86},{18:At,26:133,27:86},{18:At,26:134,27:86},{15:Kt,19:[1,135]},x(D,[2,61]),x(D,[2,53]),x(D,[2,54]),x(D,[2,55]),x(D,[2,56]),x(D,[2,57]),x(D,[2,58]),x(D,[2,59]),{4:93,6:94,7:95,8:96,9:97,10:98,11:99,20:Ke,29:Xe,30:et,31:tt,32:it,33:rt,34:92,35:137,36:st},{4:93,6:94,7:95,8:96,9:97,10:98,11:99,20:Ke,29:Xe,30:et,31:tt,32:it,33:rt,34:92,35:138,36:st},{4:93,6:94,7:95,8:96,9:97,10:98,11:99,20:Ke,29:Xe,30:et,31:tt,32:it,33:rt,34:92,35:139,36:st},x(T,[2,16]),{12:140,13:U},x(D,[2,8],{13:[1,141]}),{15:Ct,19:[1,142]},{15:Ct,19:[1,143]},{15:Ct,19:[1,144]},x(T,[2,28]),{12:66,13:U,18:de,25:145},{19:[1,146]},{15:me,19:[1,147]},{15:me,19:[1,148]},{15:me,19:[1,149]},x(T,[2,33]),{17:150,18:oe},{15:Ct,19:[1,151]},{15:fe,19:[1,152]},{15:fe,19:[1,153]},{15:fe,19:[1,154]},x(T,[2,38]),{15:me,19:[1,155]},{15:me,19:[1,156]},{15:me,19:[1,157]},x(T,[2,43]),{15:fe,19:[1,158]},{15:fe,19:[1,159]},{15:fe,19:[1,160]},x(T,[2,48]),{18:At,27:161},{15:fe,19:[1,162]},{15:Jt,19:[1,163]},{15:Jt,19:[1,164]},{15:Jt,19:[1,165]},x(T,[2,62]),{4:93,6:94,7:95,8:96,9:97,10:98,11:99,20:Ke,29:Xe,30:et,31:tt,32:it,33:rt,34:166,36:st},{15:Kt,19:[1,167]},{15:Kt,19:[1,168]},{15:Kt,19:[1,169]},x(D,[2,11]),x(D,[2,9],{13:[1,170]}),x(T,[2,17]),x(T,[2,18]),x(T,[2,19]),x(D,[2,26]),x(D,[2,22]),x(T,[2,29]),x(T,[2,30]),x(T,[2,31]),x(D,[2,13]),x(D,[2,15]),x(T,[2,34]),x(T,[2,35]),x(T,[2,36]),x(T,[2,39]),x(T,[2,40]),x(T,[2,41]),x(T,[2,44]),x(T,[2,45]),x(T,[2,46]),x(D,[2,23]),x(D,[2,25]),x(T,[2,49]),x(T,[2,50]),x(T,[2,51]),x(D,[2,60]),x(T,[2,63]),x(T,[2,64]),x(T,[2,65]),x(D,[2,10])],defaultActions:{16:[2,1],17:[2,2],18:[2,3],19:[2,4],20:[2,5],21:[2,6],22:[2,7]},parseError:function(e,i){if(i.recoverable)this.trace(e);else{var s=new Error(e);throw s.hash=i,s}},parse:function(e){var i=this,s=[0],t=[null],a=[],o=this.table,d="",c=0,b=0,_=2,y=1,C=a.slice.call(arguments,1),w=Object.create(this.lexer),S={yy:{}};for(var A in this.yy)Object.prototype.hasOwnProperty.call(this.yy,A)&&(S.yy[A]=this.yy[A]);w.setInput(e,S.yy),S.yy.lexer=w,S.yy.parser=this,typeof w.yylloc>"u"&&(w.yylloc={});var L=w.yylloc;a.push(L);var N=w.options&&w.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var ce=function(){var xe;return xe=w.lex()||y,typeof xe!="number"&&(xe=i.symbols_[xe]||xe),xe},z,Y,H,ut,ge={},Be,X,ri,pt;;){if(Y=s[s.length-1],this.defaultActions[Y]?H=this.defaultActions[Y]:((z===null||typeof z>"u")&&(z=ce()),H=o[Y]&&o[Y][z]),typeof H>"u"||!H.length||!H[0]){var ht="";pt=[];for(Be in o[Y])this.terminals_[Be]&&Be>_&&pt.push("'"+this.terminals_[Be]+"'");w.showPosition?ht="Parse error on line "+(c+1)+`:
792
+ `+w.showPosition()+`
793
+ Expecting `+pt.join(", ")+", got '"+(this.terminals_[z]||z)+"'":ht="Parse error on line "+(c+1)+": Unexpected "+(z==y?"end of input":"'"+(this.terminals_[z]||z)+"'"),this.parseError(ht,{text:w.match,token:this.terminals_[z]||z,line:w.yylineno,loc:L,expected:pt})}if(H[0]instanceof Array&&H.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Y+", token: "+z);switch(H[0]){case 1:s.push(z),t.push(w.yytext),a.push(w.yylloc),s.push(H[1]),z=null,b=w.yyleng,d=w.yytext,c=w.yylineno,L=w.yylloc;break;case 2:if(X=this.productions_[H[1]][1],ge.$=t[t.length-X],ge._$={first_line:a[a.length-(X||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(X||1)].first_column,last_column:a[a.length-1].last_column},N&&(ge._$.range=[a[a.length-(X||1)].range[0],a[a.length-1].range[1]]),ut=this.performAction.apply(ge,[d,b,c,S.yy,H[1],t,a].concat(C)),typeof ut<"u")return ut;X&&(s=s.slice(0,-1*X*2),t=t.slice(0,-1*X),a=a.slice(0,-1*X)),s.push(this.productions_[H[1]][0]),t.push(ge.$),a.push(ge._$),ri=o[s[s.length-2]][s[s.length-1]],s.push(ri);break;case 3:return!0}}return!0}},to=function(){var r={EOF:1,parseError:function(i,s){if(this.yy.parser)this.yy.parser.parseError(i,s);else throw new Error(i)},setInput:function(i,s){return this.yy=s||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var s=i.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},unput:function(i){var s=i.length,t=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var a=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),t.length-1&&(this.yylineno-=t.length-1);var o=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:t?(t.length===a.length?this.yylloc.first_column:0)+a[a.length-t.length].length-t[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[o[0],o[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
794
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(i){this.unput(this.match.slice(i))},pastInput:function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var i=this.pastInput(),s=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
795
+ `+s+"^"},test_match:function(i,s){var t,a,o;if(this.options.backtrack_lexer&&(o={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(o.yylloc.range=this.yylloc.range.slice(0))),a=i[0].match(/(?:\r\n?|\n).*/g),a&&(this.yylineno+=a.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:a?a[a.length-1].length-a[a.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],t=this.performAction.call(this,this.yy,this,s,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t)return t;if(this._backtrack){for(var d in o)this[d]=o[d];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,s,t,a;this._more||(this.yytext="",this.match="");for(var o=this._currentRules(),d=0;d<o.length;d++)if(t=this._input.match(this.rules[o[d]]),t&&(!s||t[0].length>s[0].length)){if(s=t,a=d,this.options.backtrack_lexer){if(i=this.test_match(t,o[d]),i!==!1)return i;if(this._backtrack){s=!1;continue}else return!1}else if(!this.options.flex)break}return s?(i=this.test_match(s,o[a]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
796
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var i=this.next();return i||this.lex()},begin:function(i){this.conditionStack.push(i)},popState:function(){var i=this.conditionStack.length-1;return i>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(i){return i=this.conditionStack.length-1-Math.abs(i||0),i>=0?this.conditionStack[i]:"INITIAL"},pushState:function(i){this.begin(i)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(i,s,t,a){switch(t){case 0:break;case 1:return 18;case 2:return 19;case 3:return 13;case 4:return 20;case 5:return 29;case 6:return 30;case 7:return 31;case 8:return 32;case 9:return 33;case 10:return 36;case 11:return 15;case 12:return 24;case 13:return 23;case 14:return 21;case 15:return 22;case 16:return 5;case 17:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:\()/,/^(?:\))/,/^(?:-?[0-9]+(\.[0-9]+)?([eE][\-\+]?[0-9]+)?)/,/^(?:POINT\b)/,/^(?:LINESTRING\b)/,/^(?:POLYGON\b)/,/^(?:MULTIPOINT\b)/,/^(?:MULTILINESTRING\b)/,/^(?:MULTIPOLYGON\b)/,/^(?:GEOMETRYCOLLECTION\b)/,/^(?:,)/,/^(?:EMPTY\b)/,/^(?:M\b)/,/^(?:Z\b)/,/^(?:ZM\b)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],inclusive:!0}}};return r}();Ot.lexer=to;function Vr(){this.yy={}}Vr.prototype=Ot,Ot.Parser=Vr,Ot.yy.parseError=function(r){throw r};function Pt(r){this.data=[r],this.type="PointArray"}Pt.prototype.addPoint=function(r){return r.type==="PointArray"?this.data=this.data.concat(r.data):this.data.push(r),this},Pt.prototype.toJSON=function(){return this.data};function Wr(r){this.data=r,this.type="Ring"}Wr.prototype.toJSON=function(){for(var r=[],e=0;e<this.data.data.length;e++)r.push(this.data.data[e]);return r};function Ri(r){this.data=[r],this.type="RingList"}Ri.prototype.addRing=function(r){return this.data.push(r),this},Ri.prototype.toJSON=function(){for(var r=[],e=0;e<this.data.length;e++)r.push(this.data[e].toJSON());return r.length===1,r};function ji(r){this.data=[r],this.type="GeometryList"}ji.prototype.addGeometry=function(r){return this.data.push(r),this},ji.prototype.toJSON=function(){return this.data};function Bi(r){this.data=[r],this.type="PolygonList"}Bi.prototype.addPolygon=function(r){return this.data.push(r),this},Bi.prototype.toJSON=function(){for(var r=[],e=0;e<this.data.length;e++)r=r.concat([this.data[e].toJSON()]);return r};var Gr=function(e){var i;try{i=Ot.parse(e)}catch(s){throw Error("Unable to parse: "+s)}return i};function io(r){const[e,i,s]=r.arguments;return{bool:{must:[{exists:{field:e.value}},{geo_shape:{[e.value]:{relation:i,shape:Gr(s.value)}}}]}}}const Ui={is:Nn,and:In,or:Bn,not:Fn,range:Gn,exists:Jn,nested:eo,geospatial:Object.freeze(Object.defineProperty({__proto__:null,toOpenSearchQuery:io},Symbol.toStringTag,{value:"Module"}))};function ro(r,...e){const i=Ui[r];if(i===void 0)throw new Error(`Unknown function "${r}"`);return{type:"function",function:r,...i.buildNodeParams(...e)}}function so(r,e){if(Ui[r]===void 0)throw new Error(`Unknown function "${r}"`);return{type:"function",function:r,arguments:e}}function no(r,e,i,s){return Ui[r.function].toOpenSearchQuery(r,e,i,s)}const oo=Object.freeze(Object.defineProperty({__proto__:null,buildNode:ro,buildNodeWithArgumentNodes:so,toOpenSearchQuery:no},Symbol.toStringTag,{value:"Module"}));function ao(r,e){const i=e.type==="literal"?e:ae.literal.buildNode(e);return{type:"namedArg",name:r,value:i}}function lo(r){return F(r.value)}const ae={function:oo,literal:xn,namedArg:Object.freeze(Object.defineProperty({__proto__:null,buildNode:ao,toOpenSearchQuery:lo},Symbol.toStringTag,{value:"Module"})),wildcard:Tn},co=he,uo=(r,e)=>"("+(r.arguments||[]).map(s=>ze(s,e)).join(" AND ")+")",po=(r,e)=>{var{arguments:[i,s,t]}=r;let a="=";s.type==="wildcard"&&(a="");let o=ze(s);t=t.value||typeof o=="string",s.type==="literal"&&t&&(o=`'${o}'`),s.type==="literal"&&!t&&(o=`${o}`);let d=ze(i);return d==null?e&&t?`(${e.filter(c=>c.type==="string").map(c=>`${c.name} ILIKE '%${s.value}%'`).join(" OR ")})`:e&&!t&&(s.value===!0||s.value===!1)?`(${e.filter(c=>c.type==="boolean").map(c=>`${c.name}=${s.value}`).join(" OR ")})`:"":d+a+o},ho=(r,e)=>"("+(r.arguments||[]).map(s=>ze(s,e)).join(" OR ")+")",fo=(r,e)=>{const[i]=r.arguments;return"NOT ("+ze(i,e)+")"},go={gt:">",lt:"<",gte:">=",lte:"<="},bo={is:po,and:uo,or:ho,not:fo,range:r=>{const[e,i]=r.arguments;let s=i.value;const t=go[i.name];let a=ze(s);return s.type==="literal"&&(a=`${a}`),`${e.value} ${t} ${a}`},exists:r=>{const[e]=r.arguments;return`${e.value} IS NOT NULL`},nested:r=>(console.warn("Nested types dont exist in CQL",r),""),geospatial:r=>{const[e,i,s]=r.arguments;if(console.log(e,i,s),i==="within")return`WITHIN(${e.value},${s.value})`;throw Error(`Unsupported GEO Operator:${i}`)}},yo={function:(r,e)=>bo[r.function](r,e),literal:r=>r.value,wildcard:r=>{const{value:e}=r;return` LIKE '${e.split(co).join("%")}'`}},ze=(r,e)=>{const i=yo[r.type];return i(r,e)},vo=he,mo=r=>({$and:(r.arguments||[]).map(s=>$e(s))}),$o=r=>{const{arguments:[e,i]}=r;let s=$e(i);if(i.type==="wildcard"&&i.value==="@kuery-wildcard@")return Yr(r);let a={};return a[$e(e)]={$eq:s},a},_o=r=>({$or:(r.arguments||[]).map(i=>$e(i))}),wo=r=>{const[e]=r.arguments;let i={};return i={$ne:$e(e)},i},So={gt:"$gt",lt:"$lt",gte:"$gte",lte:"$lte"},xo=r=>{const[e,i]=r.arguments;let s=i.value;const t=So[i.name];let a=$e(s),o={};return o[e.value]={},o[e.value][t]=a,o},Yr=r=>{const[e]=r.arguments;return{[$e(e)]:{$ne:null}}},ko={is:$o,and:mo,or:_o,not:wo,range:xo,exists:Yr,nested:r=>(console.warn("TODO Implement nested search",r),""),geospatial:r=>{const[e,i,s]=r.arguments;if(i=="within")return{[e.value]:{$geoWithin:Gr(s.value)}}}},Eo={function:r=>ko[r.function](r),literal:r=>r.value,wildcard:r=>{const{value:e}=r;return`/${e.split(vo).join(".*")}/`}},$e=(r,e)=>{const i=Eo[r.type];return i(r,e)},Ao=Object.freeze(Object.defineProperty({__proto__:null,DQLSyntaxError:Fr,doesKueryExpressionHaveLuceneSyntaxError:kn,fromKueryExpression:Zt,fromLiteralExpression:Je,nodeTypes:ae,parse:Zt,toCql:ze,toDSL:F,toMongo:$e,toOpenSearchQuery:F},Symbol.toStringTag,{value:"Module"})),Co=Z`
797
+ :host {
784
798
  --dialog-padding: var(--spectric-dialog-padding, 5px);
785
- --dialog-background:var(--spectric-background,rgb(246, 249, 252));
786
- }
787
- dialog {
788
- border: 0px solid var(--background-inverse);
799
+ --dialog-background: var(--spectric-background, rgb(246, 249, 252));
800
+ --dialog-border-radius: var(--spectric-border-radius, 0.4em);
801
+ }
802
+ dialog {
803
+ border: 0px;
789
804
  --spectric-background: var(--dialog-background);
790
- --panel-color:var(--dialog-background);
805
+ --panel-color: var(--dialog-background);
791
806
  padding: 0;
792
- border-radius: var(--spectric-border-radius);
793
- overflow:hidden;
794
-
795
- }
796
- dialog[open]{
797
- display:flex;
798
- }
799
- spectric-panel{
800
- margin:0px
801
- }
802
- dialog::backdrop {
807
+ border-radius: var(--dialog-border-radius);
808
+ overflow: hidden;
809
+ }
810
+ dialog[open] {
811
+ display: flex;
812
+ }
813
+ spectric-panel {
814
+ margin: 0px;
815
+ }
816
+ dialog::backdrop {
803
817
  background-color: transparent;
804
- }
805
- dialog.backdrop::backdrop {
818
+ }
819
+ dialog.backdrop::backdrop {
806
820
  background-color: rgba(0, 0, 0, 0.5);
807
- }
808
- .modal{
821
+ }
822
+ .modal {
809
823
  display: flex;
810
824
  overflow: hidden;
811
825
  flex-direction: column;
812
826
  height: 100%;
813
- }
814
- .content{
827
+ }
828
+ .content {
815
829
  flex-shrink: 1;
816
830
  overflow: auto;
817
- }
831
+ }
818
832
 
819
- h3 {
833
+ h3 {
820
834
  padding: 1em var(--dialog-padding);
821
835
  margin: 0;
822
- }
836
+ }
823
837
 
824
- spectric-button{
838
+ spectric-button {
825
839
  position: absolute;
826
840
  right: 0;
827
841
  top: 0;
828
- }
829
- `;var Ho=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,de=(n,e,s,i)=>{for(var o=i>1?void 0:i?Fo(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&Ho(e,s,o),o};const Et="spectric-dialog";h.DialogElement=class extends z{constructor(){super(...arguments),this.open=!1,this.dismissable=!0,this.hideBackdrop=!1,this.title="",this.closeOnEscape=!0,this.closeOnOutsideClick=!0,this.clickHandler=async e=>{const s=await this.dialogElement;!this.dismissable||!this.closeOnOutsideClick||s===e.target&&(this.open=!1)},this._handleKeyDown=e=>{this.closeOnEscape||e.preventDefault(),this.open&&this.closeOnEscape&&e.key==="Escape"&&(this.open=!1)},this._onClose=e=>{e.preventDefault(),e.stopPropagation(),this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}}static display(e,s){let i=document.createElement(Et);i.addEventListener("close",()=>{i.remove()});for(let t in e)i[t]=e[t];let o=document.createDocumentFragment();return mt(s,o),i.appendChild(o),i.open=!0,document.body.appendChild(i),i}connectedCallback(){super.connectedCallback(),this.dialogElement.then(e=>e.addEventListener("keydown",this._handleKeyDown))}disconnectedCallback(){super.disconnectedCallback(),this.dialogElement.then(e=>e.removeEventListener("keydown",this._handleKeyDown))}updated(e){e.has("open")&&this.dialogElement.then(s=>{this.open?s.showModal():s.close()})}render(){return w`
830
- <dialog
831
- class=${this.hideBackdrop?"":"backdrop"}
832
- @close=${this._onClose}
833
- @click=${this.clickHandler}
834
- >
835
- <spectric-panel>
836
- <div class="modal">
837
- ${this.dismissable?w`<spectric-button
838
- variant="text"
839
- size="small"
840
- @click=${()=>{this.open=!1}}
841
- icon
842
- >X</spectric-button
843
- >`:null}
844
- <h3>
845
- <slot name="title">
846
- ${this.title.length?this.title:null}
847
- </slot>
848
- </h3>
849
-
850
- <div class="content"><slot></slot></div>
851
- <div class="footer"><slot name="footer"></slot></div>
852
- </div>
853
- </spectric-panel>
854
- </dialog>
855
- `}},h.DialogElement.styles=Uo,de([v({type:Boolean,reflect:!0})],h.DialogElement.prototype,"open",2),de([v({type:Boolean,reflect:!0})],h.DialogElement.prototype,"dismissable",2),de([v({type:Boolean,reflect:!0})],h.DialogElement.prototype,"hideBackdrop",2),de([v({type:String,reflect:!0})],h.DialogElement.prototype,"title",2),de([v({type:Boolean,reflect:!0})],h.DialogElement.prototype,"closeOnEscape",2),de([v({type:Boolean,reflect:!0})],h.DialogElement.prototype,"closeOnOutsideClick",2),de([st("dialog")],h.DialogElement.prototype,"dialogElement",2),h.DialogElement=de([T(Et)],h.DialogElement);var Qo=Object.defineProperty,qo=Object.getOwnPropertyDescriptor,ee=(n,e,s,i)=>{for(var o=i>1?void 0:i?qo(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&Qo(e,s,o),o},yr=(n=>(n.MONGO="toMongo",n.CQL="toCql",n.DSL="toDSL",n.AST="AST",n))(yr||{});const ki={eq:{value:" : ",label:" equals some value"},gt:{value:" > ",label:" is greater than some value"},lt:{value:" < ",label:" is less than some value"},gte:{value:" >= ",label:" is greater than or equal to some value"},lte:{value:" <= ",label:" is less than or equal to some value"}},Wo={exists:{value:": *",label:" exists in any form"}},Vo={eq:{value:": ",label:" equals some value"},exists:{value:": *",label:" exists in any form"}},Yo=[{value:": true",label:" value is true"},{value:": false",label:"value is false"}],Zo=Object.fromEntries(Object.entries(ki).map(([n,e])=>[n,{value:e.value,label:(e.label||"").replace("value","date-time")}]));h.SpectricQuery=class extends z{constructor(){super(),this.placeholder="",this._value="",this.value="",this.outputLanguage="AST",this.completions=[],this.completionIndex=0,this.fields=[],this._parseQuery=(e=void 0)=>{let s;if(e&&(e!=null&&e.currentTarget)&&(this.value=e.currentTarget.value),this.value)try{e&&e.data=="("&&(this.value=this.value+" )",this._input.setSelectionRange(this.value.length-2,this.value.length-2));let t=this.value;this._input.selectionStart!==null&&(t=t.substring(0,this._input.selectionStart)+"@kuery-cursor@"+t.substring(this._input.selectionStart));let c=xt(t,{parseCursor:!0,cursorSymbol:"@kuery-cursor@",allowLeadingWildcards:!1});this.autoComplete(c)}catch{return}try{s=xt(this.value,{allowLeadingWildcards:!1})}catch{return}let i;this.outputLanguage=="AST"?i=s:i=Io[this.outputLanguage](s,this.fields);let o=new CustomEvent("change",{detail:i});this.dispatchEvent(o)},this.getValuesForField=async(e,s)=>(console.log("getValuesForField isn't set no values returned",e,s),[]),this._selectCompletion=async()=>{if(!this.suggestion)return;let e=this.completions[this.completionIndex],s=this.value.substring(0,e.start)+e.value,i=s.length,o=this.value.substring(e.end);if(e.value.includes(o)?this.value=s:this.value=s+this.value.substring(e.end),this._input.value=this.value,this._input.setSelectionRange(i,i),e.onSelect){let t=await e.onSelect();t!==void 0&&(this.value+=t,setTimeout(()=>{this._input.focus()}))}this.completionIndex=0,this.completions=[],this._parseQuery(),this._input.focus()},this._handleArrows=e=>{var s;e.key==="Escape"&&(this.completions=[]),(e.key=="ArrowLeft"||e.key==="ArrowRight")&&setTimeout(this._parseQuery,100),this.completions.length&&["ArrowUp","ArrowDown","Enter","Tab"].includes(e.key)&&this.suggestion&&(e.preventDefault(),(e.key==="ArrowDown"||e.key==="Tab")&&(this.completionIndex+=1,this.completionIndex>this.completions.length-1&&(this.completionIndex=0)),e.key==="ArrowUp"&&(this.completionIndex-=1,this.completionIndex<0&&(this.completionIndex=this.completions.length-1)),(s=this._asyncAutocomplete)==null||s.then(i=>{let o=i.querySelector(".option.active");o&&o.scrollIntoView({block:"nearest"})}),e.key==="Enter"&&this._selectCompletion())},this.uuid=crypto.randomUUID()}createRenderRoot(){return this}async autoComplete(e){var t;if(this.completions=[],e.type!=="cursor")return;let s=[];this.suggestion=e;let{start:i,end:o}=e;for(let c of e.suggestionTypes){if(c=="conjunction"&&e.text.endsWith(" ")&&s.push(...["and ","or "].map(f=>({type:c,value:f,start:o,end:o}))),c==="field"){let f=this.fields.filter(d=>d.name.includes(e.fieldName)||d.name.includes(e.prefix)).map(d=>[{type:c,value:d.name,start:i,end:o}]).flat();s.push(...f)}if(c==="operator"){let f=this.fields.find(d=>d.name===e.fieldName);f&&(["number","integer"].includes(f.type)?s.push(...Object.values(ki).map(d=>({type:c,...d,start:o,end:o}))):f.type==="object"?s.push(...Object.values(Wo).map(d=>({type:c,...d,start:o,end:o}))):f.type==="string"?f.format==="date-time"?s.push(...Object.values(Zo).map(d=>({type:c,...d,start:o,end:o,onSelect:async()=>{let y=await this.getValuesForField(e.fieldName,e.prefix);y.length===0&&(y=["now-1m","now-1d","now-1M"]);let C,$=ot();return await new Promise(E=>{let x=h.DialogElement.display({},w`
856
- <div class="query-bar-date-quick-select">
857
- ${y.map(k=>w`<a href="#" @click=${D=>{D.preventDefault(),C=`"${k}"`,E(C),x.open=!1}}>${k}</a>`)}
858
- </div>
859
- <spectric-input variant="datetime-local" @change=${k=>{if(!k.target)return;C=`"${new Date(k.target.value+":00.000Z").toISOString()}"`,$.value.disabled=C===void 0}}></spectric-input>
860
- <spectric-button ${at($)} .disabled=${!0} @click=${()=>{E(C),x.open=!1}}>Submit</spectric-button>
861
- `)}),C}}))):s.push(...Object.values(Vo).map(d=>({type:c,...d,start:o,end:o}))):f.type==="boolean"&&s.push(...Yo.map(d=>({type:c,...d,start:o,end:o}))))}if(c==="value"){let f=this.fields.find(d=>d.name===e.fieldName);if(f&&f.type=="boolean")s.push({type:c,value:"true",start:i,end:o},{type:c,value:"false",start:i,end:o});else{console.log(`invoke callback to get values for ${e.fieldName}`);let d=await this.getValuesForField(e.fieldName,e.prefix);(f==null?void 0:f.type)==="string"&&(d=d.map(y=>`"${y}"`)),s.push(...d.map(y=>({type:c,value:y,start:i,end:o})))}}}if(this.completions=s,this.completions.length&&this._autocomplete){let{width:c}=this._input.getBoundingClientRect();this._autocomplete.maxWidth=c,this._autocomplete.showPopover(),this._autocomplete.style.width=`${c-15}px`;let f=this._autocomplete.querySelector("[popover]");f&&(f.style.width=`${c-15}px`)}else(t=this._autocomplete)==null||t.hidePopover()}updated(e){e.has("outputLanguage")&&this._parseQuery()}render(){return w`
862
- <spectric-input .value=${this.value} .placeholder=${this.placeholder} style=${`anchor-name:--${this.uuid};`} autocomplete="off" @input=${this._parseQuery} @keydown=${this._handleArrows} @change=${e=>e.stopPropagation()}></spectric-input>
863
- <spectric-popover position="bottom" class="autocomplete" .text=${this.completions.map((e,s)=>w`<div @click=${()=>{this.completionIndex=s,this._selectCompletion()}}
864
- class=${this.completionIndex==s?"option active":"option"}>
865
- <span class="optiontype ${e.type}">${e.type}</span>
866
- <span class="value">${e.value}</span>
867
- <span class="label">${e.label}</span>
868
- </div>
869
- `)}>
870
-
871
- </spectric-popover>
872
- `}},ee([v({type:String,reflect:!0})],h.SpectricQuery.prototype,"placeholder",2),ee([v({type:String,reflect:!0})],h.SpectricQuery.prototype,"value",2),ee([v({type:String,reflect:!0})],h.SpectricQuery.prototype,"outputLanguage",2),ee([Q()],h.SpectricQuery.prototype,"completions",2),ee([Q()],h.SpectricQuery.prototype,"completionIndex",2),ee([v({type:Array,reflect:!0})],h.SpectricQuery.prototype,"fields",2),ee([ue(".autocomplete")],h.SpectricQuery.prototype,"_autocomplete",2),ee([st(".autocomplete")],h.SpectricQuery.prototype,"_asyncAutocomplete",2),ee([ue("spectric-input")],h.SpectricQuery.prototype,"_input",2),h.SpectricQuery=ee([T("spectric-query")],h.SpectricQuery);const Pi=F`
842
+ }
843
+ `,Zr=Z`
873
844
  --panel-color: var(--spectric-background,#f4f4f4);
874
845
  --panel-color-inverse: var(--spectric-background-inverse,#ffffff);
875
846
  border-color: color-mix(in hsl, var(--panel-color, #0b0b0b), var(--spectric-input-color, #000000) 3%);
@@ -879,7 +850,7 @@ spectric-button{
879
850
  --spectric-text-primary:var(--text-primary,#161616);
880
851
  --spectric-text-secondary:var(--text-secondary,#525252);
881
852
  filter: drop-shadow(0px 1px 3px color-mix(in srgb, var(--text-secondary, #3c4c5b), transparent 50%));
882
- `,Ti=F`
853
+ `,Jr=Z`
883
854
  border-color: color-mix(in hsl, var(--panel-color-inverse,#f4f4f4), var(--spectric-input-color, #000000) 3%);
884
855
  background-color: var(--panel-color-inverse,#0b0b0b);
885
856
  color:var(--text-primary,#3c4c5b);
@@ -887,7 +858,7 @@ spectric-button{
887
858
  --spectric-text-primary:var(--text-secondary,#525252);
888
859
  --spectric-text-secondary:var(--text-primary,#161616);
889
860
  filter: drop-shadow(0px 1px 3px color-mix(in srgb, var(--text-primary, #3c4c5b), transparent 70%));
890
- `,Ko=F`
861
+ `,Oo=Z`
891
862
  :host{
892
863
  display:block;
893
864
  border:2px solid black;
@@ -897,20 +868,125 @@ spectric-button{
897
868
 
898
869
  }
899
870
  :host(spectric-panel[level='0']) {
900
- ${Pi};
871
+ ${Zr};
901
872
  }
902
873
 
903
874
  :host(spectric-panel[level='1']) {
904
- ${Ti};
875
+ ${Jr};
905
876
  }
906
877
 
907
878
  :host(spectric-panel[level='2']) {
908
- ${Pi};
879
+ ${Zr};
909
880
  }
910
881
  :host(spectric-panel[level='3']) {
911
- ${Ti};
882
+ ${Jr};
912
883
  }
913
- `;var Xo=Object.defineProperty,Go=Object.getOwnPropertyDescriptor,$r=(n,e,s,i)=>{for(var o=i>1?void 0:i?Go(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&Xo(e,s,o),o};h.SpectricPanel=class extends K{constructor(){super(),this.level=0,this.addDisposableListener(this,"layer-add",()=>{this.layers=this.querySelectorAll("spectric-panel")},{capture:!0})}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("layer-add",{bubbles:!0,cancelable:!0,composed:!0,detail:{layer:this,level:this.level}}))}update(e){this.layers=this.querySelectorAll("spectric-panel"),this.layers.forEach(s=>{s.setAttribute("level",((this.level+1)%4).toString())}),super.update(e)}render(){return w` <slot></slot> `}},h.SpectricPanel.styles=Ko,$r([v({type:Number,reflect:!0})],h.SpectricPanel.prototype,"level",2),$r([v({attribute:!1})],h.SpectricPanel.prototype,"layers",2),h.SpectricPanel=$r([T("spectric-panel")],h.SpectricPanel);var Jo=Object.defineProperty,ea=Object.getOwnPropertyDescriptor,Oi=(n,e,s,i)=>{for(var o=i>1?void 0:i?ea(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&Jo(e,s,o),o};const Di={"--primary":{control:"color"},"--secondary":{control:"color"},"--tertiary":{control:"color"},"--disabled":{control:"color"},"--background":{control:"color"},"--background-inverse":{control:"color"},"--text-primary":{control:"color"},"--text-secondary":{control:"color"},"--text-on-color":{control:"color"},"--border-radius":{control:"text"}},Li={"--secondary":"#77878b","--tertiary":"#c7c7c7","--disabled":"#000000","--text-primary":"#cccccc","--text-secondary":"#cccccc","--text-on-color":"#ededed","--background":"#181818","--background-inverse":"#37373d"},zi={...Li,"--primary":"#ffd45a","--text-on-color":"#4f4f4f"},wr={undefined:{},light:{},dark:Li,spectric:zi,spectricFlat:{...zi,"--border-radius":"1px"}},Ni=Object.fromEntries(Object.keys(wr).map(n=>[n,n])),Bi=["--spectric-background","--spectric-background-hover","--spectric-background-inverse","--spectric-background-inverse-hover","--spectric-border-radius","--spectric-primary","--spectric-secondary","--spectric-tertiary","--spectric-disabled","--panel-color","--panel-color-inverse","--spectric-border-disabled","--spectric-input-color","--spectric-input-bottom","--spectric-text-on-color","--spectric-text-on-color-disabled","--spectric-text-placeholder","--spectric-text-primary","--spectric-text-secondary","--spectric-button-separator","--spectric-button-primary","--spectric-button-secondary","--spectric-button-tertiary","--spectric-button-danger-primary","--spectric-button-danger-secondary","--spectric-button-danger-active","--spectric-button-primary-active","--spectric-button-secondary-active","--spectric-button-tertiary-active","--spectric-button-danger-hover","--spectric-button-primary-hover","--spectric-button-secondary-hover","--spectric-button-tertiary-hover","--spectric-text-on-color-disabled"],ta=`
884
+ `;var Po=Object.defineProperty,To=Object.getOwnPropertyDescriptor,Hi=(r,e,i,s)=>{for(var t=s>1?void 0:s?To(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&Po(e,i,t),t};h.SpectricPanel=class extends re{constructor(){super(),this.level=0,this.addDisposableListener(this,"layer-add",()=>{this.layers=this.querySelectorAll("spectric-panel")},{capture:!0})}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("layer-add",{bubbles:!0,cancelable:!0,composed:!0,detail:{layer:this,level:this.level}}))}update(e){this.layers=this.querySelectorAll("spectric-panel"),this.layers.forEach(i=>{i.setAttribute("level",((this.level+1)%4).toString())}),super.update(e)}render(){return $` <slot></slot> `}},h.SpectricPanel.styles=Oo,Hi([g({type:Number,reflect:!0})],h.SpectricPanel.prototype,"level",2),Hi([g({attribute:!1})],h.SpectricPanel.prototype,"layers",2),h.SpectricPanel=Hi([I("spectric-panel")],h.SpectricPanel);var Lo=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,_e=(r,e,i,s)=>{for(var t=s>1?void 0:s?Do(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&Lo(e,i,t),t};const Xt="spectric-dialog";h.DialogElement=class extends B{constructor(){super(...arguments),this.open=!1,this.dismissable=!0,this.hideBackdrop=!1,this.title="",this.closeOnEscape=!0,this.closeOnOutsideClick=!0,this.clickHandler=async e=>{const i=await this.dialogElement;!this.dismissable||!this.closeOnOutsideClick||i===e.target&&(this.open=!1)},this._handleKeyDown=e=>{this.closeOnEscape||e.preventDefault(),this.open&&this.closeOnEscape&&e.key==="Escape"&&(this.open=!1)},this._onClose=e=>{e.preventDefault(),e.stopPropagation(),this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}}static display(e,i){let s=document.createElement(Xt);s.addEventListener("close",()=>{s.remove()});for(let a in e)s[a]=e[a];let t=document.createDocumentFragment();return Ht(i,t),s.appendChild(t),s.open=!0,document.body.appendChild(s),s}connectedCallback(){super.connectedCallback(),this.dialogElement.then(e=>e.addEventListener("keydown",this._handleKeyDown))}disconnectedCallback(){super.disconnectedCallback(),this.dialogElement.then(e=>e.removeEventListener("keydown",this._handleKeyDown))}updated(e){e.has("open")&&this.dialogElement.then(i=>{this.open?i.showModal():i.close()})}render(){return $`
885
+ <dialog
886
+ class=${this.hideBackdrop?"":"backdrop"}
887
+ @close=${this._onClose}
888
+ @click=${this.clickHandler}
889
+ >
890
+ <spectric-panel>
891
+ <div class="modal">
892
+ ${this.dismissable?$`<spectric-button
893
+ variant="text"
894
+ size="xsmall"
895
+ @click=${()=>{this.open=!1}}
896
+ icon
897
+ >X</spectric-button
898
+ >`:null}
899
+ <h3>
900
+ <slot name="title">
901
+ ${this.title.length?this.title:null}
902
+ </slot>
903
+ </h3>
904
+
905
+ <div class="content"><slot></slot></div>
906
+ <div class="footer"><slot name="footer"></slot></div>
907
+ </div>
908
+ </spectric-panel>
909
+ </dialog>
910
+ `}},h.DialogElement.styles=Co,_e([g({type:Boolean,reflect:!0})],h.DialogElement.prototype,"open",2),_e([g({type:Boolean,reflect:!0})],h.DialogElement.prototype,"dismissable",2),_e([g({type:Boolean,reflect:!0})],h.DialogElement.prototype,"hideBackdrop",2),_e([g({type:String,reflect:!0})],h.DialogElement.prototype,"title",2),_e([g({type:Boolean,reflect:!0})],h.DialogElement.prototype,"closeOnEscape",2),_e([g({type:Boolean,reflect:!0})],h.DialogElement.prototype,"closeOnOutsideClick",2),_e([xt("dialog")],h.DialogElement.prototype,"dialogElement",2),h.DialogElement=_e([I(Xt)],h.DialogElement);const Kr=async r=>{let e,i=Ve();return await new Promise(s=>{let t=h.DialogElement.display({},$`
911
+ <div class="query-bar-date-quick-select">
912
+ ${r.map(a=>{let o=Tt(a);return $`<a
913
+ href="#"
914
+ @click=${d=>{d.preventDefault(),e=`"${o.label}"`,s(e),t.open=!1}}
915
+ >${o.value}</a
916
+ >`})}
917
+ </div>
918
+ <spectric-input
919
+ variant="datetime-local"
920
+ @change=${a=>{if(!a.target)return;e=`"${new Date(a.target.value+":00.000Z").toISOString()}"`,i.value.disabled=e===void 0}}
921
+ ></spectric-input>
922
+ <spectric-button
923
+ ${We(i)}
924
+ .disabled=${!0}
925
+ @click=${()=>{s(e),t.open=!1}}
926
+ >Submit</spectric-button
927
+ >
928
+ `)}),e},Xr=async r=>{let e,i=Ve();return await new Promise(s=>{let t=h.DialogElement.display({},$`
929
+ <div class="query-bar-date-quick-select">
930
+ ${r.map(a=>{let o=Tt(a);return $`<a
931
+ href="#"
932
+ @click=${d=>{d.preventDefault(),e=`"${o.value}"`,s(e),t.open=!1}}
933
+ >${o.label}</a
934
+ >`})}
935
+ </div>
936
+ <div>TODO DISPLAY MAP with drawing tools HERE!!</div>
937
+ <spectric-button
938
+ ${We(i)}
939
+ .disabled=${!0}
940
+ @click=${()=>{s(e),t.open=!1}}
941
+ >Submit</spectric-button
942
+ >
943
+ `)}),e},No="🖉",Mo="🗑",zo="🠈",Io="🠊",Ro="🠉",jo="🠋";var Bo=Object.defineProperty,Uo=Object.getOwnPropertyDescriptor,J=(r,e,i,s)=>{for(var t=s>1?void 0:s?Uo(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&Bo(e,i,t),t},Fi=(r=>(r.MONGO="toMongo",r.CQL="toCql",r.DSL="toDSL",r.AST="AST",r))(Fi||{});const Tt=r=>typeof r=="string"?{label:r,value:r}:{label:r.label||r.value,value:r.value},es={eq:{value:" : ",label:" equals some value"},gt:{value:" > ",label:" is greater than some value"},lt:{value:" < ",label:" is less than some value"},gte:{value:" >= ",label:" is greater than or equal to some value"},lte:{value:" <= ",label:" is less than or equal to some value"}},Ho={within:{value:" <@ ",label:" is contained within geometry"}},Fo={exists:{value:": *",label:" exists in any form"}},Qo={eq:{value:": ",label:" equals some value"},exists:{value:": *",label:" exists in any form"}},qo=[{value:": true",label:" value is true"},{value:": false",label:"value is false"}],Vo=Object.fromEntries(Object.entries(es).map(([r,e])=>[r,{value:e.value,label:(e.label||"").replace("value","date-time")}]));h.SpectricQuery=class extends B{constructor(){super(),this.placeholder="",this._value="",this.value="",this.outputLanguage="AST",this.completions=[],this.completionIndex=0,this.fields=[],this._checkClickLocation=async e=>{console.log(e);let i=null;try{i=this._getSuggestion()}catch(s){console.log(s)}i&&this._showValueHelper(i)},this._setValue=(e,i)=>{e!==void 0&&(this.value=this.value.substring(0,i.start)+e+this.value.substring(i.end),this._input.value=this.value,this._input.setSelectionRange(i.start+e.length,i.start+e.length),this._valueHelper&&this._valueHelper.hidePopover())},this._showValueHelper=async e=>{var a,o;if(this.valueHelper=void 0,!e||e.start===e.end)return;let i=this.fields.find(d=>d.name===e.fieldName);if(!i)return;let s=await this.getValuesForField(e.fieldName,e.prefix);i.format==="date-time"&&!s.length&&(s=["now-1m","now-1d","now-1M"]);let t;i.format=="date-time"?t=Kr:i.format=="geojson"&&(t=Xr),!this.completions.length&&!((a=this._autocomplete)!=null&&a.isOpen())&&(this.valueHelper=$`<div>
944
+ <spectric-button
945
+ tooltip="Delete Value"
946
+ tooltipPosition="top"
947
+ icon
948
+ size="xsmall"
949
+ @click=${()=>{this._setValue("",e)}}
950
+ >${Mo}</spectric-button
951
+ >
952
+ ${t?$`<spectric-button
953
+ icon
954
+ tooltip="Edit Value"
955
+ tooltipPosition="top"
956
+ size="xsmall"
957
+ @click=${async()=>{this._setValue(await t(s),e)}}
958
+ >${No}</spectric-button
959
+ >`:null}
960
+ </div>`,(o=this._valueHelper)==null||o.showPopover())},this._getSuggestion=()=>{let e=this.value;this._input.selectionStart!==null&&(e=e.substring(0,this._input.selectionStart)+"©kuery-cursor©"+e.substring(this._input.selectionStart));let i=Zt(e,{parseCursor:!0,cursorSymbol:"©kuery-cursor©",allowLeadingWildcards:!1});return this._showValueHelper(i),i},this._parseQuery=(e=void 0)=>{let i;if(e&&(e!=null&&e.currentTarget)&&(this.value=e.currentTarget.value),this.value)try{e&&e.data=="("&&(this.value=this.value+" )",this._input.setSelectionRange(this.value.length-2,this.value.length-2));let a=this._getSuggestion();this.autoComplete(a)}catch{return}try{i=Zt(this.value,{allowLeadingWildcards:!1})}catch{return}let s;this.outputLanguage=="AST"?s=i:s=Ao[this.outputLanguage](i,this.fields);let t=new CustomEvent("change",{detail:s});this.dispatchEvent(t)},this.getValuesForField=async(e,i)=>(console.log("getValuesForField isn't set no values returned",e,i),[]),this._selectCompletion=async()=>{var a;if(!this.suggestion)return;let e=this.completions[this.completionIndex],i=this.value.substring(0,e.start)+e.value,s=i.length,t=this.value.substring(e.end);if(e.value.includes(t)?this.value=i:this.value=i+this.value.substring(e.end),this._input.value=this.value,this._input.setSelectionRange(s,s),e.onSelect){let o=await e.onSelect();o!==void 0&&(this.value+=o,setTimeout(()=>{this._input.focus(),this._showValueHelper(this._getSuggestion())}))}(a=this._autocomplete)==null||a.hidePopover(),this.completionIndex=0,this.completions=[],this._parseQuery(),this._input.focus()},this._handleArrows=e=>{var i;e.key==="Escape"&&(this.completions=[]),(e.key=="ArrowLeft"||e.key==="ArrowRight")&&setTimeout(this._parseQuery,100),this.completions.length&&["ArrowUp","ArrowDown","Enter","Tab"].includes(e.key)&&this.suggestion&&(e.preventDefault(),(e.key==="ArrowDown"||e.key==="Tab")&&(this.completionIndex+=1,this.completionIndex>this.completions.length-1&&(this.completionIndex=0)),e.key==="ArrowUp"&&(this.completionIndex-=1,this.completionIndex<0&&(this.completionIndex=this.completions.length-1)),(i=this._asyncAutocomplete)==null||i.then(s=>{let t=s.querySelector(".option.active");t&&t.scrollIntoView({block:"nearest"})}),e.key==="Enter"&&this._selectCompletion())},this.uuid=crypto.randomUUID()}createRenderRoot(){return this}async autoComplete(e){var a,o;if(this.completions=[],e.type!=="cursor")return;let i=[];this.suggestion=e;let{start:s,end:t}=e;for(let d of e.suggestionTypes){if(d=="conjunction"&&e.text.endsWith(" ")&&i.push(...["and ","or "].map(c=>({type:d,value:c,start:t,end:t}))),d==="field"){let c=this.fields.filter(b=>b.name.includes(e.fieldName)||b.name.includes(e.prefix)).map(b=>[{type:d,value:b.name,start:s,end:t}]).flat();i.push(...c)}if(d==="operator"){let c=this.fields.find(b=>b.name===e.fieldName);c&&(["number","integer"].includes(c.type)?i.push(...Object.values(es).map(b=>({type:d,...b,start:t,end:t}))):c.type==="object"?(c.format=="geojson"&&i.push(...Object.values(Ho).map(b=>({type:d,...b,start:t,end:t,onSelect:async()=>{let _=await this.getValuesForField(e.fieldName,e.prefix);return await Xr(_)}}))),i.push(...Object.values(Fo).map(b=>({type:d,...b,start:t,end:t})))):c.type==="string"?c.format==="date-time"?i.push(...Object.values(Vo).map(b=>({type:d,...b,start:t,end:t,onSelect:async()=>{let _=await this.getValuesForField(e.fieldName,e.prefix);return _.length===0&&(_=["now-1m","now-1d","now-1M"]),await Kr(_)}}))):i.push(...Object.values(Qo).map(b=>({type:d,...b,start:t,end:t}))):c.type==="boolean"&&i.push(...qo.map(b=>({type:d,...b,start:t,end:t}))))}if(d==="value"){let c=this.fields.find(b=>b.name===e.fieldName);if(!(c&&c.type=="number"||(c==null?void 0:c.type)=="integer"))if(c&&c.type=="boolean")i.push({type:d,value:"true",start:s,end:t},{type:d,value:"false",start:s,end:t});else{console.log(`invoke callback to get values for ${e.fieldName}`);let b=await this.getValuesForField(e.fieldName,e.prefix);(c==null?void 0:c.type)==="string"&&(b=b.map(_=>`"${_}"`)),i.push(...b.map(Tt).map(_=>({type:d,value:_.value,start:s,end:t})))}}}if(this.completions=i,this.completions.length&&this._autocomplete){(a=this._valueHelper)==null||a.hidePopover();let{width:d}=this._input.getBoundingClientRect();this._autocomplete.maxWidth=d,this._autocomplete.showPopover(),this._autocomplete.style.width=`${d-15}px`;let c=this._autocomplete.querySelector("[popover]");c&&(c.style.width=`${d-15}px`)}else(o=this._autocomplete)==null||o.hidePopover()}updated(e){e.has("outputLanguage")&&this._parseQuery()}render(){return $`
961
+ <spectric-input
962
+ .value=${this.value}
963
+ .placeholder=${this.placeholder}
964
+ style=${`anchor-name:--${this.uuid};`}
965
+ autocomplete="off"
966
+ @input=${this._parseQuery}
967
+ @keydown=${this._handleArrows}
968
+ @change=${e=>e.stopPropagation()}
969
+ @click=${this._checkClickLocation}
970
+ ></spectric-input>
971
+ <spectric-popover
972
+ class="valueHelper"
973
+ .text=${this.valueHelper}
974
+ position="top"
975
+ ></spectric-popover>
976
+ <spectric-popover
977
+ position="bottom"
978
+ class="autocomplete"
979
+ .text=${this.completions.map((e,i)=>$`<div
980
+ @click=${()=>{this.completionIndex=i,this._selectCompletion()}}
981
+ class=${this.completionIndex==i?"option active":"option"}
982
+ >
983
+ <span class="optiontype ${e.type}">${e.type}</span>
984
+ <span class="value">${e.value}</span>
985
+ <span class="label">${e.label}</span>
986
+ </div> `)}
987
+ >
988
+ </spectric-popover>
989
+ `}},J([g({type:String,reflect:!0})],h.SpectricQuery.prototype,"placeholder",2),J([W()],h.SpectricQuery.prototype,"valueHelper",2),J([g({type:String,reflect:!0})],h.SpectricQuery.prototype,"value",2),J([g({type:String,reflect:!0})],h.SpectricQuery.prototype,"outputLanguage",2),J([W()],h.SpectricQuery.prototype,"completions",2),J([W()],h.SpectricQuery.prototype,"completionIndex",2),J([g({type:Array,reflect:!0})],h.SpectricQuery.prototype,"fields",2),J([pe(".autocomplete")],h.SpectricQuery.prototype,"_autocomplete",2),J([pe(".valueHelper")],h.SpectricQuery.prototype,"_valueHelper",2),J([xt(".autocomplete")],h.SpectricQuery.prototype,"_asyncAutocomplete",2),J([pe("spectric-input")],h.SpectricQuery.prototype,"_input",2),h.SpectricQuery=J([I("spectric-query")],h.SpectricQuery);var Wo=Object.defineProperty,Go=Object.getOwnPropertyDescriptor,ts=(r,e,i,s)=>{for(var t=s>1?void 0:s?Go(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&Wo(e,i,t),t};const is={"--primary":{control:"color"},"--secondary":{control:"color"},"--tertiary":{control:"color"},"--disabled":{control:"color"},"--background":{control:"color"},"--background-inverse":{control:"color"},"--text-primary":{control:"color"},"--text-secondary":{control:"color"},"--text-on-color":{control:"color"},"--border-radius":{control:"text"}},rs={"--secondary":"#77878b","--tertiary":"#c7c7c7","--disabled":"#000000","--text-primary":"#cccccc","--text-secondary":"#cccccc","--text-on-color":"#ededed","--background":"#181818","--background-inverse":"#37373d"},ss={...rs,"--primary":"#ffd45a","--text-on-color":"#4f4f4f"},Qi={undefined:{},light:{},dark:rs,spectric:ss,spectricFlat:{...ss,"--border-radius":"1px"}},ns=Object.fromEntries(Object.keys(Qi).map(r=>[r,r])),os=["--spectric-background","--spectric-background-hover","--spectric-background-inverse","--spectric-background-inverse-hover","--spectric-border-radius","--spectric-primary","--spectric-secondary","--spectric-tertiary","--spectric-disabled","--panel-color","--panel-color-inverse","--spectric-border-disabled","--spectric-input-color","--spectric-input-bottom","--spectric-text-on-color","--spectric-text-on-color-disabled","--spectric-text-placeholder","--spectric-text-primary","--spectric-text-secondary","--spectric-button-separator","--spectric-button-primary","--spectric-button-secondary","--spectric-button-tertiary","--spectric-button-danger-primary","--spectric-button-danger-secondary","--spectric-button-danger-active","--spectric-button-primary-active","--spectric-button-secondary-active","--spectric-button-tertiary-active","--spectric-button-danger-hover","--spectric-button-primary-hover","--spectric-button-secondary-hover","--spectric-button-tertiary-hover","--spectric-text-on-color-disabled"],Yo=`
914
990
  --spectric-background: var(--background,#ffffff);
915
991
  --spectric-background-hover:var(--background-hover,rgba(141, 141, 141, 0.12));
916
992
  --spectric-background-inverse: var(--background-inverse,#f4f4f4);
@@ -953,12 +1029,12 @@ spectric-button{
953
1029
  --spectric-text-on-color-disabled: var(--disabled,#c6c6c6)
954
1030
  --spectric-button-disabled: #c6c6c6;
955
1031
  color: var(--spectric-text-primary);
956
- `;h.SpectricThemeProvider=class extends z{constructor(){super(...arguments),this.theme="undefined"}updated(e){if(e.has("theme")&&this.theme!=e.get("theme")){const s={old:e.get("theme"),new:this.theme};this.dispatchEvent(new CustomEvent("theme-change",{detail:s,bubbles:!0,composed:!0}))}}render(){let e=Object.keys(wr).includes(this.theme)?this.theme:"undefined",s=Object.entries(wr[e]).map(i=>`${i[0]}:${i[1]};`).join(`
957
- `);return w`
958
- ${this.theme&&this.theme!=="light"?w`
1032
+ `;h.SpectricThemeProvider=class extends B{constructor(){super(...arguments),this.theme="undefined"}updated(e){if(e.has("theme")&&this.theme!=e.get("theme")){const i={old:e.get("theme"),new:this.theme};this.dispatchEvent(new CustomEvent("theme-change",{detail:i,bubbles:!0,composed:!0}))}}render(){let e=Object.keys(Qi).includes(this.theme)?this.theme:"undefined",i=Object.entries(Qi[e]).map(s=>`${s[0]}:${s[1]};`).join(`
1033
+ `);return $`
1034
+ ${this.theme&&this.theme!=="light"?$`
959
1035
  <style>:host{
960
- ${s};
961
- ${ta}
1036
+ ${i};
1037
+ ${Yo}
962
1038
  }
963
1039
  /* Webkit psudo elements don't pick up variables defined by the host */
964
1040
  ::-webkit-scrollbar-thumb {
@@ -1029,9 +1105,9 @@ spectric-button{
1029
1105
  }
1030
1106
  </style>`:null}
1031
1107
  <slot></slot>
1032
- `}},h.SpectricThemeProvider.styles=F`:host{
1108
+ `}},h.SpectricThemeProvider.styles=Z`:host{
1033
1109
  display:contents;
1034
- }`,Oi([v({reflect:!0})],h.SpectricThemeProvider.prototype,"theme",2),h.SpectricThemeProvider=Oi([T("spectric-theme")],h.SpectricThemeProvider);const ra=F`
1110
+ }`,ts([g({reflect:!0})],h.SpectricThemeProvider.prototype,"theme",2),h.SpectricThemeProvider=ts([I("spectric-theme")],h.SpectricThemeProvider);const Zo=Z`
1035
1111
  :host {
1036
1112
  display: block;
1037
1113
  height: 100%;
@@ -1094,7 +1170,7 @@ spectric-button{
1094
1170
  width: 5px;
1095
1171
  cursor: ew-resize;
1096
1172
  }
1097
- `;var ia=Object.defineProperty,sa=Object.getOwnPropertyDescriptor,q=(n,e,s,i)=>{for(var o=i>1?void 0:i?sa(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&ia(e,s,o),o},_r=(n=>(n.horizontal="horizontal",n.vertical="vertical",n))(_r||{});const Sr="spectric-splitview";h.SplitView=class extends K{constructor(){super(),this.orientation="horizontal",this.percentage=50,this.invisible=!1,this.min=10,this.max=90,this.useSavedState=!0,this.isDragging=!1,this._error=!1,this._emitChange=()=>{let{percentage:s,orientation:i,invisible:o,min:t,max:c,useSavedState:f}=this,d=this.getAttribute("id");d&&this.useSavedState&&localStorage.setItem(`splitview-${d}`,String(s)),this.dispatchEvent(new CustomEvent("change",{detail:{orientation:i,percentage:s,invisible:o,min:t,max:c,useSavedState:f}}))},this._onMouseMove=lt(s=>{if(this.isDragging){const i=this.getBoundingClientRect();let o,t;this.orientation==="horizontal"?(o=s.clientX-i.left,t=o/i.width*100):(o=s.clientY-i.top,t=o/i.height*100),t=Math.min(Math.max(t,this.min),this.max),this.percentage=t,this._emitChange()}}),this._assignSlot=s=>{if(!s.target)return;let o=s.target.assignedNodes().filter(t=>t instanceof HTMLElement);o.length>2&&console.log("cannot assign more than 2 elements to a split view"),o.forEach(t=>{if(this._panel1.assignedNodes().length===0){t.slot="panel1";return}if(this._panel2.assignedNodes().length===0){t.slot="panel2";return}this._error="Too many element assigned to split view splitter can only have a maximum of 2 children",console.warn("Too many element assigned to split view splitter can only have a maximum of 2 children")})};let e=this.getAttribute("id");if(e&&this.useSavedState){let s=localStorage.getItem(`splitview-${e}`);s&&(this.percentage=parseFloat(s))}this.addDisposableListener(this._splitter,"mousedown",()=>{this.isDragging=!0}),this.addDisposableListener(this._splitter,"dblclick",()=>{this.percentage=50,this._emitChange()}),this.addDisposableListener(document.body,"mousemove",this._onMouseMove),this.addDisposableListener(document.body,"mouseup",()=>{this.isDragging=!1})}updated(e){e.has("percentage")&&(this.percentage=Math.min(Math.max(Number(this.percentage),this.min),this.max))}render(){return w`
1173
+ `;var Jo=Object.defineProperty,Ko=Object.getOwnPropertyDescriptor,K=(r,e,i,s)=>{for(var t=s>1?void 0:s?Ko(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&Jo(e,i,t),t},qi=(r=>(r.horizontal="horizontal",r.vertical="vertical",r))(qi||{});const Vi="spectric-splitview";h.SplitView=class extends re{constructor(){super(),this.orientation="horizontal",this.percentage=50,this.invisible=!1,this.min=10,this.max=90,this.useSavedState=!0,this.isDragging=!1,this._error=!1,this._emitChange=()=>{let{percentage:i,orientation:s,invisible:t,min:a,max:o,useSavedState:d}=this,c=this.getAttribute("id");c&&this.useSavedState&&localStorage.setItem(`splitview-${c}`,String(i)),this.dispatchEvent(new CustomEvent("change",{detail:{orientation:s,percentage:i,invisible:t,min:a,max:o,useSavedState:d}}))},this._onMouseMove=Et(i=>{if(this.isDragging){const s=this.getBoundingClientRect();let t,a;this.orientation==="horizontal"?(t=i.clientX-s.left,a=t/s.width*100):(t=i.clientY-s.top,a=t/s.height*100),a=Math.min(Math.max(a,this.min),this.max),this.percentage=a,this._emitChange()}}),this._assignSlot=i=>{if(!i.target)return;let t=i.target.assignedNodes().filter(a=>a instanceof HTMLElement);t.length>2&&console.log("cannot assign more than 2 elements to a split view"),t.forEach(a=>{if(this._panel1.assignedNodes().length===0){a.slot="panel1";return}if(this._panel2.assignedNodes().length===0){a.slot="panel2";return}this._error="Too many element assigned to split view splitter can only have a maximum of 2 children",console.warn("Too many element assigned to split view splitter can only have a maximum of 2 children")})};let e=this.getAttribute("id");if(e&&this.useSavedState){let i=localStorage.getItem(`splitview-${e}`);i&&(this.percentage=parseFloat(i))}this.addDisposableListener(this._splitter,"mousedown",()=>{this.isDragging=!0}),this.addDisposableListener(this._splitter,"dblclick",()=>{this.percentage=50,this._emitChange()}),this.addDisposableListener(document.body,"mousemove",this._onMouseMove),this.addDisposableListener(document.body,"mouseup",()=>{this.isDragging=!1})}updated(e){e.has("percentage")&&(this.percentage=Math.min(Math.max(Number(this.percentage),this.min),this.max))}render(){return $`
1098
1174
  <div class="split-view ${this.orientation} ${this._error?"error":""} ${this.isDragging?"active":""}" style="--split-percentage: ${this.percentage}%;">
1099
1175
  <span class="error-display">${this._error}</span>
1100
1176
  <div class="panel" style="${this.orientation==="horizontal"?"flex: var(--split-percentage, 50%)":"max-height: var(--split-percentage, 50%)"}">
@@ -1106,52 +1182,72 @@ spectric-button{
1106
1182
  </div>
1107
1183
  </div>
1108
1184
  <slot @slotchange=${this._assignSlot} style="display:none"></slot>
1109
- `}},h.SplitView.styles=ra,q([v({type:String})],h.SplitView.prototype,"orientation",2),q([v({type:Number,reflect:!0})],h.SplitView.prototype,"percentage",2),q([v({type:Boolean})],h.SplitView.prototype,"invisible",2),q([v({type:Number,reflect:!0})],h.SplitView.prototype,"min",2),q([v({type:Number,reflect:!0})],h.SplitView.prototype,"max",2),q([v({type:Boolean,reflect:!0})],h.SplitView.prototype,"useSavedState",2),q([Q()],h.SplitView.prototype,"isDragging",2),q([Q()],h.SplitView.prototype,"_error",2),q([st(".splitter")],h.SplitView.prototype,"_splitter",2),q([ue("slot[name='panel1']")],h.SplitView.prototype,"_panel1",2),q([ue("slot[name='panel2']")],h.SplitView.prototype,"_panel2",2),h.SplitView=q([T(Sr)],h.SplitView);var na=Object.defineProperty,oa=Object.getOwnPropertyDescriptor,Pe=(n,e,s,i)=>{for(var o=i>1?void 0:i?oa(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&na(e,s,o),o};const Ar="spectric-pagination";h.PaginationElement=class extends z{constructor(){super(...arguments),this.page=1,this.pageSize=10,this.pageSizeOptions=[10,20,50,100,1e3],this.size="xsmall",this._handlePageUp=()=>{this.page+=1,this._emitChange()},this._handlePageDown=()=>{this.page-=1,this._emitChange()},this._handleSizeChange=e=>{e.stopPropagation(),e.preventDefault();let s=parseInt(e.target.value);this.pageSize=s,this._emitChange()},this._emitChange=()=>{let{page:e,pageSize:s}=this;this.dispatchEvent(new CustomEvent("change",{detail:{page:e,pageSize:s}}))}}createRenderRoot(){return this}update(e){e.has("pageSize")&&!this.pageSizeOptions.includes(this.pageSize)&&(this.pageSizeOptions=[...this.pageSizeOptions,this.pageSize].sort((s,i)=>s-i),requestAnimationFrame(()=>{this.select&&this.select.value!==String(this.pageSize)&&(this.select.value=String(this.pageSize))})),super.update(e)}render(){let e=this.page*this.pageSize,s=!0;this.totalItems&&e<this.totalItems&&(s=!1);let i="";return this.totalItems&&(i=`${this.page} of ${Math.ceil(this.totalItems/this.pageSize)}`),w`
1110
- <div class="spectric-pagination-container">
1185
+ `}},h.SplitView.styles=Zo,K([g({type:String})],h.SplitView.prototype,"orientation",2),K([g({type:Number,reflect:!0})],h.SplitView.prototype,"percentage",2),K([g({type:Boolean})],h.SplitView.prototype,"invisible",2),K([g({type:Number,reflect:!0})],h.SplitView.prototype,"min",2),K([g({type:Number,reflect:!0})],h.SplitView.prototype,"max",2),K([g({type:Boolean,reflect:!0})],h.SplitView.prototype,"useSavedState",2),K([W()],h.SplitView.prototype,"isDragging",2),K([W()],h.SplitView.prototype,"_error",2),K([xt(".splitter")],h.SplitView.prototype,"_splitter",2),K([pe("slot[name='panel1']")],h.SplitView.prototype,"_panel1",2),K([pe("slot[name='panel2']")],h.SplitView.prototype,"_panel2",2),h.SplitView=K([I(Vi)],h.SplitView);var Xo=Object.defineProperty,ea=Object.getOwnPropertyDescriptor,Ie=(r,e,i,s)=>{for(var t=s>1?void 0:s?ea(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&Xo(e,i,t),t};const Wi="spectric-pagination";h.PaginationElement=class extends B{constructor(){super(...arguments),this.page=1,this.pageSize=10,this.pageSizeOptions=[10,20,50,100,1e3],this.size="xsmall",this._handlePageUp=()=>{this.page+=1,this._emitChange()},this._handlePageDown=()=>{this.page-=1,this._emitChange()},this._handleSizeChange=e=>{e.stopPropagation(),e.preventDefault();let i=parseInt(e.target.value);this.pageSize=i,this._emitChange()},this._emitChange=()=>{let{page:e,pageSize:i}=this;this.dispatchEvent(new CustomEvent("change",{detail:{page:e,pageSize:i}}))}}createRenderRoot(){return this}update(e){e.has("pageSize")&&!this.pageSizeOptions.includes(this.pageSize)&&(this.pageSizeOptions=[...this.pageSizeOptions,this.pageSize].sort((i,s)=>i-s),requestAnimationFrame(()=>{this.select&&this.select.value!==String(this.pageSize)&&(this.select.value=String(this.pageSize))})),super.update(e)}render(){let e=this.page*this.pageSize,i=!0;this.totalItems&&e<this.totalItems&&(i=!1);let s="";return this.totalItems&&(s=`${this.page} of ${Math.ceil(this.totalItems/this.pageSize)}`),$`
1186
+ <div class="spectric-pagination-container">
1187
+ <div>
1188
+ <!-- TODO/FIXME Make a select component and use it for cross browser styling-->
1189
+ <select
1190
+ @change=${this._handleSizeChange}
1191
+ .value=${String(this.pageSize)}
1192
+ >
1193
+ ${this.pageSizeOptions.map(t=>$`<option
1194
+ .value=${String(t)}
1195
+ class=${String(t)===String(this.pageSize)?"selected":""}
1196
+ >
1197
+ ${t}
1198
+ </option>`)}
1199
+ </select>
1200
+ </div>
1201
+ ${this.totalItems?$`
1202
+ <div class="spectric-pagination-text">
1203
+ ${`Items ${(this.page-1)*this.pageSize}-${Math.min(this.page*this.pageSize,this.totalItems)} of ${this.totalItems}`}
1204
+ </div>
1205
+ <div class="spectric-pagination-container">
1206
+ <div>${s}</div>
1111
1207
  <div>
1112
- <!-- TODO/FIXME Make a select component and use it for cross browser styling-->
1113
- <select @change=${this._handleSizeChange} .value=${String(this.pageSize)}>
1114
- ${this.pageSizeOptions.map(o=>w`<option .value=${String(o)} class=${String(o)===String(this.pageSize)?"selected":""}>${o}</option>`)}
1115
- </select>
1208
+ <spectric-button
1209
+ size=${this.size}
1210
+ ?disabled=${this.page===1}
1211
+ @click=${this._handlePageDown}
1212
+ icon
1213
+ >${zo}</spectric-button
1214
+ >
1215
+ <spectric-button
1216
+ size=${this.size}
1217
+ ?disabled=${i}
1218
+ @click=${this._handlePageUp}
1219
+ icon
1220
+ >${Io}</spectric-button
1221
+ >
1116
1222
  </div>
1117
- ${this.totalItems?w`
1118
- <div class="spectric-pagination-text">${`Items ${(this.page-1)*this.pageSize}-${Math.min(this.page*this.pageSize,this.totalItems)} of ${this.totalItems}`}</div>
1119
- <div class="spectric-pagination-container">
1120
- <div>
1121
- ${i}
1122
- </div>
1123
- <div>
1124
- <spectric-button size=${this.size} ?disabled=${this.page===1} @click=${this._handlePageDown} icon>🠈</spectric-button>
1125
- <spectric-button size=${this.size} ?disabled=${s} @click=${this._handlePageUp} icon>🠊</spectric-button>
1126
- </div>
1127
- </div>
1128
- `:null}
1129
- </div>
1130
- `}},Pe([v({type:Number,reflect:!0})],h.PaginationElement.prototype,"page",2),Pe([v({type:Number,reflect:!0})],h.PaginationElement.prototype,"pageSize",2),Pe([v({type:Number,reflect:!0})],h.PaginationElement.prototype,"totalItems",2),Pe([v({type:Array})],h.PaginationElement.prototype,"pageSizeOptions",2),Pe([ue("select")],h.PaginationElement.prototype,"select",2),Pe([v({type:String,reflect:!0})],h.PaginationElement.prototype,"size",2),h.PaginationElement=Pe([T(Ar)],h.PaginationElement);const aa=Object.freeze(Object.defineProperty({__proto__:null,BitArray:cr,DisposableElement:K,getListeners:bi},Symbol.toStringTag,{value:"Module"}));var la=Object.defineProperty,ca=Object.getOwnPropertyDescriptor,kt=(n,e,s,i)=>{for(var o=i>1?void 0:i?ca(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&la(e,s,o),o};const pa="spectric-table-header";let ct=class extends K{constructor(){super(),this.columns=[],this._handleSortChange=n=>{this._resizeStart||(n=JSON.parse(JSON.stringify(n)),n.sortable&&(n.sortDirection===M.none||n.sortDirection===void 0?n.sortDirection=M.ascending:n.sortDirection===M.ascending?n.sortDirection=M.descending:n.sortDirection===M.descending&&(n.sortDirection=M.none),this.dispatchEvent(new CustomEvent("sortChange",{composed:!0,bubbles:!0,detail:n}))))},this._handleResizeStart=(n,e)=>{this._resizeStart={event:n,column:e}},this._handleResizeEnd=n=>{var s;if(!this._resizeStart)return;let e=n.pageX-((s=this._resizeStart)==null?void 0:s.event.pageX);if(this._resizeStart.column.width)this._resizeStart.column.width=this._resizeStart.column.width+e;else{let i=this._resizeStart.event.target.closest("td");this._resizeStart.column.width=i.getBoundingClientRect().width+e}this.dispatchEvent(new CustomEvent("columnResize",{detail:this._resizeStart.column})),requestAnimationFrame(()=>{if(this._resizeStart=void 0,window.getSelection){let i=window.getSelection();i&&i.removeAllRanges()}})},this.addDisposableListener(()=>document.body,"mouseup",this._handleResizeEnd)}createRenderRoot(){return this}render(){return w`
1223
+ </div>
1224
+ `:null}
1225
+ </div>
1226
+ `}},Ie([g({type:Number,reflect:!0})],h.PaginationElement.prototype,"page",2),Ie([g({type:Number,reflect:!0})],h.PaginationElement.prototype,"pageSize",2),Ie([g({type:Number,reflect:!0})],h.PaginationElement.prototype,"totalItems",2),Ie([g({type:Array})],h.PaginationElement.prototype,"pageSizeOptions",2),Ie([pe("select")],h.PaginationElement.prototype,"select",2),Ie([g({type:String,reflect:!0})],h.PaginationElement.prototype,"size",2),h.PaginationElement=Ie([I(Wi)],h.PaginationElement);const ta=Object.freeze(Object.defineProperty({__proto__:null,BitArray:Oi,DisposableElement:re,getListeners:zr},Symbol.toStringTag,{value:"Module"}));var ia=Object.defineProperty,ra=Object.getOwnPropertyDescriptor,ei=(r,e,i,s)=>{for(var t=s>1?void 0:s?ra(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&ia(e,i,t),t};const sa="spectric-table-header";let Lt=class extends re{constructor(){super(),this.columns=[],this._handleSortChange=r=>{this._resizeStart||(r=JSON.parse(JSON.stringify(r)),r.sortable&&(r.sortDirection===Q.none||r.sortDirection===void 0?r.sortDirection=Q.ascending:r.sortDirection===Q.ascending?r.sortDirection=Q.descending:r.sortDirection===Q.descending&&(r.sortDirection=Q.none),this.dispatchEvent(new CustomEvent("sortChange",{composed:!0,bubbles:!0,detail:r}))))},this._handleResizeStart=(r,e)=>{this._resizeStart={event:r,column:e}},this._handleResizeEnd=r=>{var i;if(!this._resizeStart)return;let e=r.pageX-((i=this._resizeStart)==null?void 0:i.event.pageX);if(this._resizeStart.column.width)this._resizeStart.column.width=this._resizeStart.column.width+e;else{let s=this._resizeStart.event.target.closest("td");this._resizeStart.column.width=s.getBoundingClientRect().width+e}this.dispatchEvent(new CustomEvent("columnResize",{detail:this._resizeStart.column})),requestAnimationFrame(()=>{if(this._resizeStart=void 0,window.getSelection){let s=window.getSelection();s&&s.removeAllRanges()}})},this.addDisposableListener(()=>document.body,"mouseup",this._handleResizeEnd)}createRenderRoot(){return this}render(){return $`
1131
1227
  <tr>
1132
- ${this.columns.map(n=>this.renderCell(n))}
1228
+ ${this.columns.map(r=>this.renderCell(r))}
1133
1229
  </tr>
1134
- `}renderCell(n){let e=["header-contents"];n.filterable,n.sortable&&e.push("sortable"),this._resizeStart&&e.push("resizing");let s=n.width?`min-width:${n.width}px;max-width:${n.width}px;`:"",i=n.sortDirection===M.ascending?"🠉":n.sortDirection==M.descending?"🠋":"",o=n.sortDirection||M.none,c=n.allowResize||n.allowResize===void 0?w`<div
1230
+ `}renderCell(r){let e=["header-contents"];r.filterable,r.sortable&&e.push("sortable"),this._resizeStart&&e.push("resizing");let i=r.width?`min-width:${r.width}px;max-width:${r.width}px;`:"",s=r.sortDirection===Q.ascending?Ro:r.sortDirection==Q.descending?jo:"",t=r.sortDirection||Q.none,o=r.allowResize||r.allowResize===void 0?$`<div
1135
1231
  class="header-resize-handle"
1136
- @mousedown=${d=>{this._handleResizeStart(d,n)}}
1232
+ @mousedown=${c=>{this._handleResizeStart(c,r)}}
1137
1233
  @mouseup=${this._handleResizeEnd}
1138
- ></div>`:null,f=n.title||n.key;return typeof f=="function"&&(f=f(this.table)||void 0),w` <td
1139
- @click=${()=>this._handleSortChange(n)}
1140
- style="${s}"
1234
+ ></div>`:null,d=r.title||r.key;return typeof d=="function"&&(d=d(this.table)||void 0),$` <td
1235
+ @click=${()=>this._handleSortChange(r)}
1236
+ style="${i}"
1141
1237
  >
1142
- ${c}
1238
+ ${o}
1143
1239
  <div class=${e.join(" ")}>
1144
- ${f}
1145
- <span class="sort-direction ${o}">${i}</span>
1240
+ ${d}
1241
+ <span class="sort-direction ${t}">${s}</span>
1146
1242
  </div>
1147
- </td>`}};kt([v({type:Array,attribute:!1})],ct.prototype,"columns",2),kt([Q()],ct.prototype,"_resizeStart",2),kt([v({type:Object,attribute:!1})],ct.prototype,"table",2),ct=kt([T(pa)],ct);/**
1243
+ </td>`}};ei([g({type:Array,attribute:!1})],Lt.prototype,"columns",2),ei([W()],Lt.prototype,"_resizeStart",2),ei([g({type:Object,attribute:!1})],Lt.prototype,"table",2),Lt=ei([I(sa)],Lt);/**
1148
1244
  * @license
1149
1245
  * Copyright 2017 Google LLC
1150
1246
  * SPDX-License-Identifier: BSD-3-Clause
1151
- */const Mi=n=>vn(n)?n._$litType$.h:n.strings,ua=it(class extends yt{constructor(n){super(n),this.et=new WeakMap}render(n){return[n]}update(n,[e]){const s=yi(this.it)?Mi(this.it):null,i=yi(e)?Mi(e):null;if(s!==null&&(i===null||s!==i)){const o=or(n).pop();let t=this.et.get(s);if(t===void 0){const c=document.createDocumentFragment();t=mt(P,c),t.setConnected(!1),this.et.set(s,t)}nr(t,[o]),Se(t,void 0,o)}if(i!==null){if(s===null||s!==i){const o=this.et.get(i);if(o!==void 0){const t=or(o).pop();yn(n),Se(n,void 0,t),nr(n,[t])}}this.it=e}else this.it=void 0;return this.render(e)}});var ha=Object.defineProperty,da=Object.getOwnPropertyDescriptor,Te=(n,e,s,i)=>{for(var o=i>1?void 0:i?da(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&ha(e,s,o),o};const fa="spectric-table-cell";let fe=class extends z{constructor(){super(...arguments),this.overflow="",this.styleRules={whiteSpace:"",width:""},this._handleFilterOut=()=>{let n;this.column.key&&typeof this.row=="object"&&(n=Re(this.row,this.column.key)),this._emitFilter({include:!1,row:this.row,value:n,column:this.column})},this._handleFilterFor=()=>{let n;this.column.key&&typeof this.row=="object"&&(n=Re(this.row,this.column.key)),this._emitFilter({include:!0,row:this.row,value:n,column:this.column})},this._displayTooltip=()=>{let n=this.querySelector("div.cell-contents"),e=this.querySelector("span");if(n&&e){let s=e.getBoundingClientRect(),i=n.getBoundingClientRect();s.width*s.height>i.width*i.height?(console.log("We need to show a tooltip witht he content because we are overflowing"),this.overflow=this.getRenderedValue(),this.updateComplete.then(()=>{let o=this.querySelector("spectric-tooltip");o&&o.showToolTip()})):this.overflow=""}}}createRenderRoot(){return this}updated(n){}_emitFilter(n){this.dispatchEvent(new CustomEvent("filter",{composed:!0,bubbles:!0,detail:n}))}getRenderedValue(){let n;return this.column.render?n=this.column.render(this.row,this.index,this.table):this.column.key&&typeof this.row=="object"?n=Re(this.row,this.column.key):n=w`error`,n}render(){let n=this.getRenderedValue(),e=["cell-contents"];this.column.filterable&&e.push("filterable");let s=ua(this.column.filterable?w`<div class="table-cell-actions">
1247
+ */const as=r=>Xs(r)?r._$litType$.h:r.strings,na=St(class extends Ft{constructor(r){super(r),this.et=new WeakMap}render(r){return[r]}update(r,[e]){const i=Rr(this.it)?as(this.it):null,s=Rr(e)?as(e):null;if(i!==null&&(s===null||i!==s)){const t=Ei(r).pop();let a=this.et.get(i);if(a===void 0){const o=document.createDocumentFragment();a=Ht(M,o),a.setConnected(!1),this.et.set(i,a)}ki(a,[t]),Te(a,void 0,t)}if(s!==null){if(i===null||i!==s){const t=this.et.get(s);if(t!==void 0){const a=Ei(t).pop();rn(r),Te(r,void 0,a),ki(r,[a])}}this.it=e}else this.it=void 0;return this.render(e)}});var oa=Object.defineProperty,aa=Object.getOwnPropertyDescriptor,Re=(r,e,i,s)=>{for(var t=s>1?void 0:s?aa(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&oa(e,i,t),t};const la="spectric-table-cell";let we=class extends B{constructor(){super(...arguments),this.overflow="",this.styleRules={whiteSpace:"",width:""},this._handleFilterOut=()=>{let r;this.column.key&&typeof this.row=="object"&&(r=nt(this.row,this.column.key)),this._emitFilter({include:!1,row:this.row,value:r,column:this.column})},this._handleFilterFor=()=>{let r;this.column.key&&typeof this.row=="object"&&(r=nt(this.row,this.column.key)),this._emitFilter({include:!0,row:this.row,value:r,column:this.column})},this._displayOverflowTooltip=()=>{if(this.column.disableCellOverflowTooltip){this.overflow=null;return}let r=this.querySelector("div.cell-contents"),e=this.querySelector("span");if(r&&e){let i=e.getBoundingClientRect(),s=r.getBoundingClientRect();i.width*i.height>s.width*s.height?(console.log("We need to show a tooltip with the content because we are overflowing"),this.overflow=this.getRenderedValue(),this.updateComplete.then(()=>{let t=this.querySelector("spectric-tooltip");t&&t.showToolTip()})):this.overflow=""}}}createRenderRoot(){return this}updated(r){}_emitFilter(r){this.dispatchEvent(new CustomEvent("filter",{composed:!0,bubbles:!0,detail:r}))}getRenderedValue(){let r;return this.column.render?r=this.column.render(this.row,this.index,this.table):this.column.key&&typeof this.row=="object"?r=nt(this.row,this.column.key):r=$`error`,r}render(){var a;let r=this.getRenderedValue(),e=["cell-contents"];(this.column.filterable||(a=this.column.cellActions)!=null&&a.length)&&e.push("hasActions");const i=this.table.getCellActionButtonSize();let s=na(this.column.filterable?$`
1152
1248
  <spectric-button
1153
1249
  @click=${this._handleFilterOut}
1154
- size="tiny"
1250
+ .size=${i}
1155
1251
  variant="text"
1156
1252
  icon
1157
1253
  tooltip="Filter Out Value"
@@ -1159,83 +1255,92 @@ spectric-button{
1159
1255
  >
1160
1256
  <spectric-button
1161
1257
  @click=${this._handleFilterFor}
1162
- size="tiny"
1258
+ .size=${i}
1163
1259
  variant="text"
1164
1260
  icon
1165
1261
  tooltip="Filter For Value"
1166
1262
  >+</spectric-button
1167
1263
  >
1168
- </div>`:null);return this.styleRules={width:this.column.width?this.column.width+"px":null,whiteSpace:this.column.whiteSpace||null},w`
1264
+ `:null),t=(this.column.cellActions||[]).map(o=>$`<spectric-button
1265
+ @click=${()=>o.onClick(this.row,this.column)}
1266
+ .size=${i}
1267
+ variant="text"
1268
+ icon
1269
+ .tooltip=${o.tooltip}
1270
+ >${o.icon}</spectric-button
1271
+ >`);return this.styleRules={width:this.column.width?this.column.width+"px":null,whiteSpace:this.column.whiteSpace||null},$`
1169
1272
  <td
1170
- style=${tr(this.styleRules)}
1171
- @mouseenter=${this._displayTooltip}
1273
+ style=${_i(this.styleRules)}
1274
+ @mouseenter=${this._displayOverflowTooltip}
1172
1275
  >
1173
- ${s}
1276
+ <div class="table-cell-actions ${i}">
1277
+ ${t} ${s}
1278
+ </div>
1174
1279
  <div class=${e.join(" ")}>
1175
- ${this.overflow?w`<spectric-tooltip .text=${this.overflow}></spectric-tooltip>`:null}<span>${n}</span>
1280
+ ${this.overflow?$`<spectric-tooltip .text=${this.overflow}></spectric-tooltip>`:null}<span>${r}</span>
1176
1281
  </div>
1177
1282
  </td>
1178
- `}};Te([v({type:Object,attribute:!1})],fe.prototype,"row",2),Te([v({type:Number,attribute:!1})],fe.prototype,"index",2),Te([v({type:Object,attribute:!1})],fe.prototype,"column",2),Te([v({type:Object,attribute:!1})],fe.prototype,"table",2),Te([Q()],fe.prototype,"overflow",2),Te([ue("td")],fe.prototype,"td",2),fe=Te([T(fa)],fe);const Re=(n,e)=>{let s=e.split("."),i=n[s[0]];return i==null||s.length>1&&(i=Re(i,s.slice(1).join("."))),i};/**
1283
+ `}};Re([g({type:Object,attribute:!1})],we.prototype,"row",2),Re([g({type:Number,attribute:!1})],we.prototype,"index",2),Re([g({type:Object,attribute:!1})],we.prototype,"column",2),Re([g({type:Object,attribute:!1})],we.prototype,"table",2),Re([W()],we.prototype,"overflow",2),Re([pe("td")],we.prototype,"td",2),we=Re([I(la)],we);const nt=(r,e)=>{let i=e.split("."),s=r[i[0]];return s==null||i.length>1&&(s=nt(s,i.slice(1).join("."))),s};/**
1179
1284
  * @license
1180
1285
  * Copyright 2017 Google LLC
1181
1286
  * SPDX-License-Identifier: BSD-3-Clause
1182
- */const ji=(n,e,s)=>{const i=new Map;for(let o=e;o<=s;o++)i.set(n[o],o);return i},Pt=it(class extends yt{constructor(n){if(super(n),n.type!==er.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,e,s){let i;s===void 0?s=e:e!==void 0&&(i=e);const o=[],t=[];let c=0;for(const f of n)o[c]=i?i(f,c):c,t[c]=s(f,c),c++;return{values:t,keys:o}}render(n,e,s){return this.dt(n,e,s).values}update(n,[e,s,i]){const o=or(n),{values:t,keys:c}=this.dt(e,s,i);if(!Array.isArray(o))return this.ut=c,t;const f=this.ut??(this.ut=[]),d=[];let y,C,$=0,E=o.length-1,x=0,k=t.length-1;for(;$<=E&&x<=k;)if(o[$]===null)$++;else if(o[E]===null)E--;else if(f[$]===c[x])d[x]=Ae(o[$],t[x]),$++,x++;else if(f[E]===c[k])d[k]=Ae(o[E],t[k]),E--,k--;else if(f[$]===c[k])d[k]=Ae(o[$],t[k]),Se(n,d[k+1],o[$]),$++,k--;else if(f[E]===c[x])d[x]=Ae(o[E],t[x]),Se(n,o[$],o[E]),E--,x++;else if(y===void 0&&(y=ji(c,x,k),C=ji(f,$,E)),y.has(f[$]))if(y.has(f[E])){const D=C.get(c[x]),I=D!==void 0?o[D]:null;if(I===null){const H=Se(n,o[$]);Ae(H,t[x]),d[x]=H}else d[x]=Ae(I,t[x]),Se(n,o[$],I),o[D]=null;x++}else ar(o[E]),E--;else ar(o[$]),$++;for(;x<=k;){const D=Se(n,d[k+1]);Ae(D,t[x]),d[x++]=D}for(;$<=E;){const D=o[$++];D!==null&&ar(D)}return this.ut=c,nr(n,d),pe}});var ga=Object.defineProperty,va=Object.getOwnPropertyDescriptor,Cr=(n,e,s,i)=>{for(var o=i>1?void 0:i?va(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&ga(e,s,o),o};const ba="spectric-table-body";let Tt=class extends z{constructor(){super(...arguments),this.data=[],this.columns=[]}createRenderRoot(){return this}firstUpdated(n){this.data.length>100&&console.warn("Table is rendering excessive amounts of data to the DOM you should set rowHeight and use a virtualized scroll or use pagination")}render(){return w`
1287
+ */const ls=(r,e,i)=>{const s=new Map;for(let t=e;t<=i;t++)s.set(r[t],t);return s},ti=St(class extends Ft{constructor(r){if(super(r),r.type!==$i.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,e,i){let s;i===void 0?i=e:e!==void 0&&(s=e);const t=[],a=[];let o=0;for(const d of r)t[o]=s?s(d,o):o,a[o]=i(d,o),o++;return{values:a,keys:t}}render(r,e,i){return this.dt(r,e,i).values}update(r,[e,i,s]){const t=Ei(r),{values:a,keys:o}=this.dt(e,i,s);if(!Array.isArray(t))return this.ut=o,a;const d=this.ut??(this.ut=[]),c=[];let b,_,y=0,C=t.length-1,w=0,S=a.length-1;for(;y<=C&&w<=S;)if(t[y]===null)y++;else if(t[C]===null)C--;else if(d[y]===o[w])c[w]=Le(t[y],a[w]),y++,w++;else if(d[C]===o[S])c[S]=Le(t[C],a[S]),C--,S--;else if(d[y]===o[S])c[S]=Le(t[y],a[S]),Te(r,c[S+1],t[y]),y++,S--;else if(d[C]===o[w])c[w]=Le(t[C],a[w]),Te(r,t[y],t[C]),C--,w++;else if(b===void 0&&(b=ls(o,w,S),_=ls(d,y,C)),b.has(d[y]))if(b.has(d[C])){const A=_.get(o[w]),L=A!==void 0?t[A]:null;if(L===null){const N=Te(r,t[y]);Le(N,a[w]),c[w]=N}else c[w]=Le(L,a[w]),Te(r,t[y],L),t[A]=null;w++}else Ai(t[C]),C--;else Ai(t[y]),y++;for(;w<=S;){const A=Te(r,c[S+1]);Le(A,a[w]),c[w++]=A}for(;y<=C;){const A=t[y++];A!==null&&Ai(A)}return this.ut=o,ki(r,c),ve}});var ca=Object.defineProperty,ua=Object.getOwnPropertyDescriptor,Gi=(r,e,i,s)=>{for(var t=s>1?void 0:s?ua(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&ca(e,i,t),t};const pa="spectric-table-body";let ii=class extends B{constructor(){super(...arguments),this.data=[],this.columns=[]}createRenderRoot(){return this}firstUpdated(r){this.data.length>100&&console.warn("Table is rendering excessive amounts of data to the DOM you should set rowHeight and use a virtualized scroll or use pagination")}render(){return $`
1183
1288
  <body>
1184
- ${Pt(this.data,(n,e)=>w`
1289
+ ${ti(this.data,(r,e)=>$`
1185
1290
  <tr class="${e%2===0?"odd":""}">
1186
- ${Pt(this.columns,s=>w`<spectric-table-cell .column=${s} .index=${e} .row=${n} .columns=${this.columns}></spectric-table-cell>`)}
1291
+ ${ti(this.columns,i=>$`<spectric-table-cell .column=${i} .index=${e} .row=${r} .columns=${this.columns}></spectric-table-cell>`)}
1187
1292
  </tr>`)}
1188
1293
 
1189
1294
  </body>
1190
- `}};Cr([v({type:Array,attribute:!1})],Tt.prototype,"data",2),Cr([v({type:Array,attribute:!1})],Tt.prototype,"columns",2),Tt=Cr([T(ba)],Tt);var ma=Object.defineProperty,ya=Object.getOwnPropertyDescriptor,Ie=(n,e,s,i)=>{for(var o=i>1?void 0:i?ya(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&ma(e,s,o),o};const $a="spectric-table-virtual-body";let Oe=class extends K{constructor(){super(),this.data=[],this.columns=[],this.rowHeight=30,this.startIndex=0,this.columnsMeasured=!1,this.addDisposableListener(()=>this.table.querySelector(".table-wrapper"),"scroll",()=>{const n=this.table.querySelector(".table-wrapper").scrollTop;requestAnimationFrame(()=>{this.startIndex=Math.floor(n/this.rowHeight)})})}updated(){if(this.columnsMeasured===!1){let n=this.querySelector("tr"),e=n==null?void 0:n.querySelectorAll("spectric-table-cell td");n&&e&&e.length&&(this.columns.forEach((s,i)=>{if(!s.width||s.width===0){let o=e[i].getBoundingClientRect();o.width>0&&(this.columnsMeasured=!0,s.width=o.width-Ue)}}),this.columnsMeasured&&(this.columns=[...this.columns]))}}createRenderRoot(){return this}render(){let n=this.data.length,e=10,s=this.table.querySelector("spectric-table-header").clientHeight,i=this.table.querySelector(".table-wrapper"),o=Math.max(this.startIndex,0);const t=Math.ceil((i.clientHeight-s)/this.rowHeight),c=Math.min(o+t+e,n),f=c-o;let d=n*this.rowHeight,y=o*this.rowHeight+(i.scrollTop-o*this.rowHeight);c===n&&(y=o*this.rowHeight);let C=f*this.rowHeight,$=d-y-C,E=o!=0?w` <tr
1191
- style="height:${y}px"
1295
+ `}};Gi([g({type:Array,attribute:!1})],ii.prototype,"data",2),Gi([g({type:Array,attribute:!1})],ii.prototype,"columns",2),ii=Gi([I(pa)],ii);var ha=Object.defineProperty,da=Object.getOwnPropertyDescriptor,ot=(r,e,i,s)=>{for(var t=s>1?void 0:s?da(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&ha(e,i,t),t};const fa="spectric-table-virtual-body";let je=class extends re{constructor(){super(),this.data=[],this.columns=[],this.rowHeight=30,this.startIndex=0,this.columnsMeasured=!1;let r=0;this.addDisposableListener(()=>this.table.querySelector(".table-wrapper"),"scroll",()=>{const e=this.table.querySelector(".table-wrapper").scrollTop;Math.abs(r-e)<=this.rowHeight/4||(r=e,this.startIndex=Math.floor(e/this.rowHeight))})}updated(){if(this.columnsMeasured===!1){let r=this.querySelector("tr"),e=r==null?void 0:r.querySelectorAll("spectric-table-cell td");r&&e&&e.length&&(this.columns.forEach((i,s)=>{if(!i.width||i.width===0){let t=e[s].getBoundingClientRect();t.width>0&&(this.columnsMeasured=!0,i.width=t.width-at)}}),this.columnsMeasured&&(this.columns=[...this.columns]))}}createRenderRoot(){return this}render(){let r=this.data.length,e=10,i=this.table.querySelector("spectric-table-header").clientHeight,s=this.table.querySelector(".table-wrapper"),t=Math.max(this.startIndex,0);const a=Math.ceil((s.clientHeight-i)/this.rowHeight),o=Math.min(t+a+e,r),d=o-t;let c=r*this.rowHeight,b=t*this.rowHeight+(s.scrollTop-t*this.rowHeight);o===r&&(b=t*this.rowHeight);let _=d*this.rowHeight,y=c-b-_,C=t!=0?$` <tr
1296
+ style="height:${b}px"
1192
1297
  class="virtual-scroll-spacer"
1193
1298
  >
1194
1299
  <td colspan="${this.columns.length}"></td>
1195
- </tr>`:null,x=w` <tr
1196
- style="height:${$}px"
1300
+ </tr>`:null,w=$` <tr
1301
+ style="height:${y}px"
1197
1302
  class="virtual-scroll-spacer"
1198
1303
  >
1199
1304
  <td colspan="${this.columns.length}"></td>
1200
- </tr>`;return w`
1305
+ </tr>`;return $`
1201
1306
  <div
1202
- style="height:${d}px;position: absolute;overflow-x: hidden;overflow-y: hidden;z-index:-1;width:1px;"
1307
+ style="height:${c}px;position: absolute;overflow-x: hidden;overflow-y: hidden;z-index:-1;width:1px;"
1203
1308
  ></div>
1204
1309
  <tbody>
1205
- ${E}
1310
+ ${C}
1206
1311
  </tbody>
1207
1312
  <div
1208
- style="display:table-row-group;max-height:${C}px; overflow:hidden;"
1313
+ style="display:table-row-group;max-height:${_}px; overflow:hidden;"
1209
1314
  >
1210
- ${Pt(this.data.slice(Math.max(o,0),c),(k,D)=>w` <tr
1211
- class="${(D+o)%2===0?"odd":""}"
1315
+ ${ti(this.data.slice(Math.max(t,0),o),(S,A)=>$` <tr
1316
+ class="${(A+t)%2===0?"odd":""}"
1212
1317
  >
1213
- ${Pt(this.columns,I=>w`<spectric-table-cell
1214
- .column=${I}
1215
- .row=${k}
1216
- .index=${D+o}
1318
+ ${ti(this.columns,L=>$`<spectric-table-cell
1319
+ .column=${L}
1320
+ .row=${S}
1321
+ .index=${A+t}
1217
1322
  .columns=${this.columns}
1218
1323
  .table=${this.table}
1219
1324
  ></spectric-table-cell>`)}
1220
1325
  </tr>`)}
1221
1326
  </div>
1222
1327
  <tbody>
1223
- ${$>0?x:null}
1328
+ ${y>0?w:null}
1224
1329
  </tbody>
1225
- `}};Ie([v({type:Array,attribute:!1})],Oe.prototype,"data",2),Ie([v({type:Array,attribute:!1})],Oe.prototype,"columns",2),Ie([v({type:Number,attribute:!1})],Oe.prototype,"rowHeight",2),Ie([v({type:Number,state:!0})],Oe.prototype,"startIndex",2),Ie([v({type:Object,attribute:!1})],Oe.prototype,"table",2),Oe=Ie([T($a)],Oe);function Ri(n){let e=!1,s;return function(...i){return e||(e=!0,s=n.apply(this,i)),s}}const wa=n=>n.map(({key:e,sortDirection:s,compareFn:i})=>(o,t)=>{if(!e)return;let c=Re(o,e),f=Re(t,e);if(i)return i(o,t);if(typeof c=="number"||typeof c=="bigint"||typeof c=="boolean"){let d=c-f;return s===M.descending&&(d=d*-1),d}else if(typeof c=="string")return c.localeCompare(f)*(s===M.descending?-1:1)});var _a=Object.defineProperty,Sa=Object.getOwnPropertyDescriptor,te=(n,e,s,i)=>{for(var o=i>1?void 0:i?Sa(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&_a(e,s,o),o};const xr="spectric-table";var Er=(n=>(n.multi="multi",n.single="single",n.none="none",n))(Er||{}),kr=(n=>(n.multi="multi",n.single="single",n))(kr||{}),M=(n=>(n.ascending="ascending",n.descending="descending",n.none="none",n))(M||{});const Ue=4,Pr=Symbol("spectric-table-selection-column");h.SpectricTableElement=class extends z{constructor(){super(...arguments),this.data=[],this.columns=[],this.select="none",this.sort="single",this.sortOrder=[],this.rowHeight=25,this.fontSize=16,this._handlePaginationChange=e=>{if(this.pagination){let s={...this.pagination,...e.detail},{totalItems:i,page:o,pageSize:t}=s;i&&o&&t&&(o-1)*t>i&&(s.page=1),this.pagination=s}this.dispatchEvent(new CustomEvent("paginationChange",{detail:e.detail})),this._emitChange()},this._handleSortChange=e=>{let s=e.detail,i=this.columns.find(o=>o.key==s.key);if(!i||i.key===void 0){console.warn("Unable to find sort column");return}if(this.sort=="single"&&(this.columns.forEach(o=>{o.sortDirection="none"}),this.sortOrder=[]),i.sortDirection=s.sortDirection,!i.sortDirection||i.sortDirection==="none"){let o=this.sortOrder.findIndex(t=>t===i.key);o!==-1&&this.sortOrder.splice(o,1)}else this.sortOrder.findIndex(t=>t===i.key)===-1&&(this.sortOrder=[...this.sortOrder,i.key]);this.columns=[...this.columns],this._emitChange()},this._handleColumnResize=e=>{let s=e.detail,i=this.columns.findIndex(o=>o.key==s.key);this.columns[i]={...this.columns[i]},this.columns=[...this.columns],this._emitChange()},this._emitChange=()=>{let{pagination:e,columns:s,sortOrder:i}=this;this.dispatchEvent(new CustomEvent("change",{detail:{pagination:e,columns:s,sortOrder:i}}))},this.__DO_NOT_USE_filter=()=>{this.dispatchEvent(new CustomEvent("filter")),this.dispatchEvent(new CustomEvent("sortChange"))},this.selected=[],this._handleSelectAllChange=e=>{e.stopPropagation(),e.target.checked?this.selectAll():this.deselectAll()},this.selectColumnConfig={[Pr]:!0,width:39,title:e=>e.select==="multi"?w`<spectric-input
1330
+ `}};ot([g({type:Array,attribute:!1})],je.prototype,"data",2),ot([g({type:Array,attribute:!1})],je.prototype,"columns",2),ot([g({type:Number,attribute:!1})],je.prototype,"rowHeight",2),ot([g({type:Number,state:!0})],je.prototype,"startIndex",2),ot([g({type:Object,attribute:!1})],je.prototype,"table",2),je=ot([I(fa)],je);function cs(r){let e=!1,i;return function(...s){return e||(e=!0,i=r.apply(this,s)),i}}const ga=r=>r.map(({key:e,sortDirection:i,compareFn:s})=>(t,a)=>{if(!e)return;let o=nt(t,e),d=nt(a,e);if(s)return s(t,a);if(typeof o=="number"||typeof o=="bigint"||typeof o=="boolean"){let c=o-d;return i===Q.descending&&(c=c*-1),c}else if(typeof o=="string")return o.localeCompare(d)*(i===Q.descending?-1:1)});var ba=Object.defineProperty,ya=Object.getOwnPropertyDescriptor,le=(r,e,i,s)=>{for(var t=s>1?void 0:s?ya(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&ba(e,i,t),t};const Yi="spectric-table";var Zi=(r=>(r.multi="multi",r.single="single",r.none="none",r))(Zi||{}),Ji=(r=>(r.multi="multi",r.single="single",r))(Ji||{}),Q=(r=>(r.ascending="ascending",r.descending="descending",r.none="none",r))(Q||{});const at=4,Ki=Symbol("spectric-table-selection-column");h.SpectricTableElement=class extends B{constructor(){super(...arguments),this.data=[],this.columns=[],this.select="none",this.sort="single",this.sortOrder=[],this.rowHeight=25,this.fontSize=16,this.cellActionButtonSize="xxsmall",this._handlePaginationChange=e=>{if(this.pagination){let i={...this.pagination,...e.detail},{totalItems:s,page:t,pageSize:a}=i;s&&t&&a&&(t-1)*a>s&&(i.page=1),this.pagination=i}this.dispatchEvent(new CustomEvent("paginationChange",{detail:e.detail})),this._emitChange()},this._handleSortChange=e=>{let i=e.detail,s=this.columns.find(t=>t.key==i.key);if(!s||s.key===void 0){console.warn("Unable to find sort column");return}if(this.sort=="single"&&(this.columns.forEach(t=>{t.sortDirection="none"}),this.sortOrder=[]),s.sortDirection=i.sortDirection,!s.sortDirection||s.sortDirection==="none"){let t=this.sortOrder.findIndex(a=>a===s.key);t!==-1&&this.sortOrder.splice(t,1)}else this.sortOrder.findIndex(a=>a===s.key)===-1&&(this.sortOrder=[...this.sortOrder,s.key]);this.columns=[...this.columns],this._emitChange()},this._handleColumnResize=e=>{let i=e.detail,s=this.columns.findIndex(t=>t.key==i.key);this.columns[s]={...this.columns[s]},this.columns=[...this.columns],this._emitChange()},this._emitChange=()=>{let{pagination:e,columns:i,sortOrder:s}=this;this.dispatchEvent(new CustomEvent("change",{detail:{pagination:e,columns:i,sortOrder:s}}))},this.__DO_NOT_USE_filter=()=>{this.dispatchEvent(new CustomEvent("filter")),this.dispatchEvent(new CustomEvent("sortChange"))},this.selected=[],this._getRowHeight=()=>{let e=this.rowHeight-at;return e<this.fontSize+at&&(e=this.fontSize+at),e},this._handleSelectAllChange=e=>{e.stopPropagation(),e.target.checked?this.selectAll():this.deselectAll()},this.selectColumnConfig={[Ki]:!0,allowResize:!1,filterable:!1,width:39,title:e=>e.select==="multi"?$`<spectric-input
1226
1331
  variant="checkbox"
1227
1332
  @change=${e._handleSelectAllChange}
1228
1333
  .helperText=${"Select All"}
1229
- ></spectric-input>`:null,render:(e,s,i)=>{let o=i.selected.includes(e);return w`<spectric-input
1334
+ ></spectric-input>`:null,render:(e,i,s)=>{let t=s.selected.includes(e);return $`<spectric-input
1230
1335
  variant="checkbox"
1231
- class="table-checkbox-${i.select}"
1336
+ class="table-checkbox-${s.select}"
1232
1337
  .helperText=${""}
1233
- ${Ee({checked:o})}
1234
- @change=${c=>{c.stopPropagation();let f=i.selected.findIndex(d=>d===e);if(!(c.target.checked&&f!==-1)){{if(!c.target.checked&&f===-1)return;!c.target.checked&&f!==-1&&i.selected.splice(f,1)}c.target.checked&&(i.select==="single"&&(i.selected=[],i.forceRefreshofSelectionColumn()),i.selected.push(e)),i.dispatchEvent(new CustomEvent("selected",{detail:[...i.selected]}))}}}
1235
- ></spectric-input>`}}}static getDefaultDataSorterAndPaginatior(e){return s=>{let i=(s.sortOrder||[]).map(f=>s.columns.find(d=>d.key===f)),o=[...e];if(i.length){let f=wa(i);o.sort((d,y)=>{for(let C of f){let $=C(d,y);if($)return $}return 0})}if(!s.pagination)return o;let{page:t,pageSize:c}=s.pagination;return!t||!c?o:s.pagination?o.slice((t-1)*c,t*c):o}}createRenderRoot(){return this}forceRefreshofSelectionColumn(){let e=this.columns.findIndex(s=>s[Pr]);e!==-1&&(this.columns[e]={...this.selectColumnConfig})}setSelected(e){this.selected=e,this.forceRefreshofSelectionColumn()}deselectAll(){this.selected=[],this.forceRefreshofSelectionColumn(),this.dispatchEvent(new CustomEvent("selected",{detail:this.selected}))}selectAll(){this.selected=[...this.data],this.forceRefreshofSelectionColumn(),this.dispatchEvent(new CustomEvent("selected",{detail:this.selected}))}update(e){e.has("columns")&&this.select!=="none"&&(this.columns.find(s=>s[Pr])||this.columns.unshift(this.selectColumnConfig)),e.has("select")&&this.select==="single"&&this.selected.length>1&&(this.selected=[this.selected[0]],this.dispatchEvent(new CustomEvent("selected",{detail:[...this.selected]}))),super.update(e)}render(){let e=this.columns.filter(i=>!i.hidden),s=this.rowHeight-Ue;return s<this.fontSize+Ue&&(s=this.fontSize+Ue),w`
1338
+ ${Me({checked:t})}
1339
+ @change=${o=>{o.stopPropagation();let d=s.selected.findIndex(c=>c===e);if(!(o.target.checked&&d!==-1)){{if(!o.target.checked&&d===-1)return;!o.target.checked&&d!==-1&&s.selected.splice(d,1)}o.target.checked&&(s.select==="single"&&(s.selected=[],s.forceRefreshofSelectionColumn()),s.selected.push(e)),s.dispatchEvent(new CustomEvent("selected",{detail:[...s.selected]}))}}}
1340
+ ></spectric-input>`}}}getCellActionButtonSize(){return this.cellActionButtonSize}static getDefaultDataSorterAndPaginatior(e){return i=>{let s=(i.sortOrder||[]).map(d=>i.columns.find(c=>c.key===d)),t=[...e];if(s.length){let d=ga(s);t.sort((c,b)=>{for(let _ of d){let y=_(c,b);if(y)return y}return 0})}if(!i.pagination)return t;let{page:a,pageSize:o}=i.pagination;return!a||!o?t:i.pagination?t.slice((a-1)*o,a*o):t}}createRenderRoot(){return this}forceRefreshofSelectionColumn(){let e=this.columns.findIndex(i=>i[Ki]);e!==-1&&(this.columns[e]={...this.selectColumnConfig})}setSelected(e){this.selected=e,this.forceRefreshofSelectionColumn()}getSelected(){return this.selected}deselectAll(){this.selected=[],this.forceRefreshofSelectionColumn(),this.dispatchEvent(new CustomEvent("selected",{detail:this.selected}))}selectAll(){this.selected=[...this.data],this.forceRefreshofSelectionColumn(),this.dispatchEvent(new CustomEvent("selected",{detail:this.selected}))}async scrollToRow(e){let i=-1;if(Number.isInteger(e)?i=e:i=this.data.findIndex(s=>s===e),i!==-1){let s=this.querySelector("spectric-table-virtual-body"),t=this.querySelector(".table-wrapper"),a=i*this._getRowHeight();t.scrollTo({top:a,behavior:"smooth"});for(let o=0;o<100;o++)if(await new Promise(d=>setTimeout(d,10)),t.scrollTop==a){console.log("Scroll complete");break}s&&requestAnimationFrame(()=>{let o=[...s.querySelectorAll("tr")];o=o.filter(d=>{var c;return((c=d.querySelector("spectric-table-cell"))==null?void 0:c.index)===i}),o.length&&o[0].animate([{backgroundColor:"red"},{backgroundColor:"unset"}],{duration:200,iterations:5})})}}update(e){e.has("data")&&(this.selected=this.data.reduce((i,s)=>(this.selected.includes(s)&&i.push(s),i),[])),e.has("columns")&&this.select!=="none"&&(this.columns.find(i=>i[Ki])||this.columns.unshift(this.selectColumnConfig)),e.has("select")&&this.select==="single"&&this.selected.length>1&&(this.selected=[this.selected[0]],this.dispatchEvent(new CustomEvent("selected",{detail:[...this.selected]}))),super.update(e)}render(){let e=this.columns.filter(s=>!s.hidden),i=this._getRowHeight();return $`
1236
1341
  <div
1237
1342
  class="table-wrapper"
1238
- style="--rowHeight:${s}px;--fontSize:${this.fontSize}px;--lineClamp:${Math.floor(s/this.fontSize)}"
1343
+ style="--rowHeight:${i}px;--fontSize:${this.fontSize}px;--lineClamp:${Math.floor(i/this.fontSize)}"
1239
1344
  >
1240
1345
  <div role="table">
1241
1346
  <spectric-table-header
@@ -1248,45 +1353,49 @@ spectric-button{
1248
1353
  .columns=${e}
1249
1354
  .data=${this.data}
1250
1355
  .table=${this}
1251
- .rowHeight=${s}
1356
+ .rowHeight=${i}
1252
1357
  ></spectric-table-virtual-body>
1253
1358
  </div>
1254
1359
  </div>
1255
- ${this.pagination?w`<spectric-pagination
1256
- ${Ee(this.pagination)}
1360
+ ${this.pagination?$`<spectric-pagination
1361
+ ${Me(this.pagination)}
1257
1362
  @change=${this._handlePaginationChange}
1258
1363
  ></spectric-pagination>`:null}
1259
- `}},te([v({type:Array,attribute:!1})],h.SpectricTableElement.prototype,"data",2),te([v({type:Object,attribute:!1})],h.SpectricTableElement.prototype,"pagination",2),te([v({attribute:!1})],h.SpectricTableElement.prototype,"columns",2),te([v({type:String,reflect:!0})],h.SpectricTableElement.prototype,"select",2),te([v({type:String,reflect:!0})],h.SpectricTableElement.prototype,"sort",2),te([v({type:Array,reflect:!1})],h.SpectricTableElement.prototype,"sortOrder",2),te([v({type:Number,reflect:!0})],h.SpectricTableElement.prototype,"rowHeight",2),te([v({type:Number,reflect:!0})],h.SpectricTableElement.prototype,"fontSize",2),te([Q()],h.SpectricTableElement.prototype,"selected",2),h.SpectricTableElement=te([T(xr)],h.SpectricTableElement);var Aa=Object.defineProperty,Ca=Object.getOwnPropertyDescriptor,V=(n,e,s,i)=>{for(var o=i>1?void 0:i?Ca(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&Aa(e,s,o),o};const xa="spectric-popover";let j=class extends K{constructor(){super(),this.delay=100,this.animationDuration=0,this.text="",this.position="right",this.maxWidth=300,this.mouseOffsetX=10,this.mouseOffsetY=0,this.portalTarget=document.body,this.open=!1,this._getMousePosition=n=>{this.mouseLocation={left:n.clientX,top:n.clientY},this.position=="mouse"&&this.open&&!this.mouseframe&&(this.mouseframe=requestAnimationFrame(()=>this.positionTooltip()))},this.applyStyle=n=>{Object.entries(n).forEach(([e,s])=>{this.portalElement.style.setProperty(e,s)})},this.positionTooltip=()=>{if(!this.target)return;let n={};const e=this.target.getBoundingClientRect(),s=this.portalElement.getBoundingClientRect();this.target!==document.body&&this.maxWidth&&this.maxWidth>0&&(s.width=Math.min(s.width,this.maxWidth));let i;this.position==="mouse"&&this.mouseLocation?(this.mouseframe=void 0,i={left:this.mouseLocation.left+this.mouseOffsetX+"px",top:this.mouseLocation.top+this.mouseOffsetY-s.height/2+"px"}):this.position==="top"?i={top:e.top-s.height+"px",left:e.left+e.width/2-s.width/2+"px"}:this.position==="bottom"?i={top:e.bottom+"px",left:e.left+e.width/2-s.width/2+"px"}:this.position==="left"?i={top:Math.max(0,e.top+e.height/2-s.height/2)+"px",left:e.left-s.width+"px"}:this.position==="right"?i={top:Math.max(0,e.top+e.height/2-s.height/2)+"px",left:e.right+"px"}:(i={left:"0px",top:"0px"},console.error("Unknown position... Maybe we sould implement auto?")),this.applyStyle({...n,...i}),this.position!=="mouse"&&this.portalElement.animate({opacity:[0,1]},{duration:this.animationDuration})},this.showPopover=this.showPopover.bind(this),this.hidePopover=this.hidePopover.bind(this),this.addDisposableListener(()=>this.target,"mousemove",this._getMousePosition)}isOpen(){return this.open}get target(){return this.triggerTarget||this.parentElement}createRenderRoot(){return this}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}hidePopover(){this.timer&&clearTimeout(this.timer),this.open=!1,this.portalElement.hidePopover()}async showPopover(){this.timer&&clearTimeout(this.timer),await new Promise(n=>{this.timer=window.setTimeout(n,this.delay)}),this.portalElement.showPopover(),this.open=!0,requestAnimationFrame(this.positionTooltip)}render(){return w`<!-- ToolTip -->
1260
- <div class="spectric-popover-portal ${this.position}" popover>
1364
+ `}},le([g({type:Array,attribute:!1})],h.SpectricTableElement.prototype,"data",2),le([g({type:Object,attribute:!1})],h.SpectricTableElement.prototype,"pagination",2),le([g({attribute:!1})],h.SpectricTableElement.prototype,"columns",2),le([g({type:String,reflect:!0})],h.SpectricTableElement.prototype,"select",2),le([g({type:String,reflect:!0})],h.SpectricTableElement.prototype,"sort",2),le([g({type:Array,reflect:!1})],h.SpectricTableElement.prototype,"sortOrder",2),le([g({type:Number,reflect:!0})],h.SpectricTableElement.prototype,"rowHeight",2),le([g({type:Number,reflect:!0})],h.SpectricTableElement.prototype,"fontSize",2),le([W()],h.SpectricTableElement.prototype,"selected",2),h.SpectricTableElement=le([I(Yi)],h.SpectricTableElement);var va=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,te=(r,e,i,s)=>{for(var t=s>1?void 0:s?ma(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&va(e,i,t),t};const $a="spectric-popover";let q=class extends re{constructor(){super(),this.delay=100,this.animationDuration=0,this.text="",this.position="right",this.maxWidth=300,this.mouseOffsetX=10,this.mouseOffsetY=0,this.portalTarget=document.body,this.open=!1,this._getMousePosition=r=>{this.mouseLocation={left:r.clientX,top:r.clientY},this.position=="mouse"&&this.open&&!this.mouseframe&&(this.mouseframe=requestAnimationFrame(()=>this.positionTooltip()))},this.applyStyle=r=>{Object.entries(r).forEach(([e,i])=>{this.portalElement.style.setProperty(e,i)})},this.positionTooltip=()=>{if(!this.target)return;let r={};const e=this.target.getBoundingClientRect(),i=this.portalElement.getBoundingClientRect();this.target!==document.body&&this.maxWidth&&this.maxWidth>0&&(i.width=Math.min(i.width,this.maxWidth));let s;this.position==="mouse"&&this.mouseLocation?(this.mouseframe=void 0,s={left:this.mouseLocation.left+this.mouseOffsetX+"px",top:this.mouseLocation.top+this.mouseOffsetY-i.height/2+"px"}):this.position==="top"?s={top:e.top-i.height+"px",left:e.left+e.width/2-i.width/2+"px"}:this.position==="bottom"?s={top:e.bottom+"px",left:e.left+e.width/2-i.width/2+"px"}:this.position==="left"?s={top:Math.max(0,e.top+e.height/2-i.height/2)+"px",left:e.left-i.width+"px"}:this.position==="right"?s={top:Math.max(0,e.top+e.height/2-i.height/2)+"px",left:e.right+"px"}:(s={left:"0px",top:"0px"},console.error("Unknown position... Maybe we sould implement auto?")),this.applyStyle({...r,...s}),this.position!=="mouse"&&this.portalElement.animate({opacity:[0,1]},{duration:this.animationDuration})},this.showPopover=this.showPopover.bind(this),this.hidePopover=this.hidePopover.bind(this),this.addDisposableListener(()=>this.target,"mousemove",this._getMousePosition)}isOpen(){return this.open}get target(){return this.triggerTarget||this.parentElement}createRenderRoot(){return this}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}hidePopover(){this.timer&&clearTimeout(this.timer),this.open=!1,this.portalElement.hidePopover()}async showPopover(){this.timer&&clearTimeout(this.timer),await new Promise(r=>{this.timer=window.setTimeout(r,this.delay)}),this.isConnected&&(this.portalElement.showPopover(),this.open=!0,requestAnimationFrame(this.positionTooltip))}render(){return $`<!-- ToolTip -->
1365
+ <div class="spectric-popover-portal ${this.position}" popover>
1261
1366
  <div class="tooltip-container">
1262
- <span class="tooltip-caret"></span>
1263
- <div class="tooltip-content">${this.text}<slot></slot></div>
1367
+ <span class="tooltip-caret"></span>
1368
+ <div class="tooltip-content">${this.text}<slot></slot></div>
1264
1369
  </div>
1265
- </div>`}};j.styles=F`:host{max-height: 0px;
1266
- max-width: 0px;
1267
- display: none;
1268
- pointer-events:none;}`,V([v({type:Number,reflect:!0})],j.prototype,"delay",2),V([v({type:Number,reflect:!0})],j.prototype,"animationDuration",2),V([v({type:String,reflect:!1})],j.prototype,"text",2),V([v({type:String,reflect:!0})],j.prototype,"position",2),V([v({type:Number,reflect:!0})],j.prototype,"maxWidth",2),V([v({type:Number,reflect:!1})],j.prototype,"mouseOffsetX",2),V([v({type:Number,reflect:!1})],j.prototype,"mouseOffsetY",2),V([ue(".spectric-popover-portal")],j.prototype,"portalElement",2),V([v({attribute:!1})],j.prototype,"portalTarget",2),V([v({attribute:!1})],j.prototype,"triggerTarget",2),j=V([T(xa)],j);var Ea=Object.defineProperty,ka=Object.getOwnPropertyDescriptor,ge=(n,e,s,i)=>{for(var o=i>1?void 0:i?ka(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&Ea(e,s,o),o};const Tr="spectric-tooltip";var Or=(n=>(n.top="top",n.bottom="bottom",n.left="left",n.right="right",n.mouse="mouse",n))(Or||{});h.TooltipElement=class extends j{constructor(){super(),this.delay=100,this.animationDuration=0,this.text="",this.position="right",this.maxWidth=300,this.portalTarget=document.body,this.open=!1,this.showToolTip=this.showToolTip.bind(this),this.addDisposableListener(()=>this.target,"mouseover",this.showToolTip),this.addDisposableListener(()=>this.target,"mouseleave",this.hidePopover)}async showToolTip(){await super.showPopover(),this.portalElement.classList.add("spectric-tooltip-portal")}},h.TooltipElement.styles=F`:host{max-height: 0px;
1370
+ </div>`}};q.styles=Z`
1371
+ :host {
1372
+ max-height: 0px;
1373
+ max-width: 0px;
1374
+ display: none;
1375
+ pointer-events: none;
1376
+ }
1377
+ `,te([g({type:Number,reflect:!0})],q.prototype,"delay",2),te([g({type:Number,reflect:!0})],q.prototype,"animationDuration",2),te([g({type:String,reflect:!1})],q.prototype,"text",2),te([g({type:String,reflect:!0})],q.prototype,"position",2),te([g({type:Number,reflect:!0})],q.prototype,"maxWidth",2),te([g({type:Number,reflect:!1})],q.prototype,"mouseOffsetX",2),te([g({type:Number,reflect:!1})],q.prototype,"mouseOffsetY",2),te([pe(".spectric-popover-portal")],q.prototype,"portalElement",2),te([g({attribute:!1})],q.prototype,"portalTarget",2),te([g({attribute:!1})],q.prototype,"triggerTarget",2),q=te([I($a)],q);var _a=Object.defineProperty,wa=Object.getOwnPropertyDescriptor,Se=(r,e,i,s)=>{for(var t=s>1?void 0:s?wa(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&_a(e,i,t),t};const Xi="spectric-tooltip";var er=(r=>(r.top="top",r.bottom="bottom",r.left="left",r.right="right",r.mouse="mouse",r))(er||{});h.TooltipElement=class extends q{constructor(){super(),this.delay=100,this.animationDuration=0,this.text="",this.position="right",this.maxWidth=300,this.portalTarget=document.body,this.open=!1,this.showToolTip=this.showToolTip.bind(this),this.addDisposableListener(()=>this.target,"mouseover",this.showToolTip),this.addDisposableListener(()=>this.target,"mouseleave",this.hidePopover)}async showToolTip(){await super.showPopover(),this.portalElement.classList.add("spectric-tooltip-portal")}},h.TooltipElement.styles=Z`:host{max-height: 0px;
1269
1378
  max-width: 0px;
1270
1379
  display: none;
1271
- pointer-events:none;}`,ge([v({type:Number,reflect:!0})],h.TooltipElement.prototype,"delay",2),ge([v({type:Number,reflect:!0})],h.TooltipElement.prototype,"animationDuration",2),ge([v({type:String,reflect:!1})],h.TooltipElement.prototype,"text",2),ge([v({type:String,reflect:!0})],h.TooltipElement.prototype,"position",2),ge([v({type:Number,reflect:!0})],h.TooltipElement.prototype,"maxWidth",2),ge([v({attribute:!1})],h.TooltipElement.prototype,"portalTarget",2),ge([v({attribute:!1})],h.TooltipElement.prototype,"triggerTarget",2),h.TooltipElement=ge([T(Tr)],h.TooltipElement);var Pa=Object.defineProperty,Ta=Object.getOwnPropertyDescriptor,U=(n,e,s,i)=>{for(var o=i>1?void 0:i?Ta(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&Pa(e,s,o),o};let He;window.hasOwnProperty("EyeDropper")&&(He=new EyeDropper);let R=class extends z{constructor(){super(),this.value="#FF0000FF",this.showAlpha=!0,this.hue=0,this.alpha=1,this.saturation=1,this.lightness=1,this.canvas=ot(),this.sldown=!1,this._handleAlphaChange=this._handleAlphaChange.bind(this),this._handleHueChange=this._handleHueChange.bind(this),this._handleApply=this._handleApply.bind(this),this._cancel=this._cancel.bind(this),this._handleSaturationLightnessClick=this._handleSaturationLightnessClick.bind(this)}createRenderRoot(){return this}update(n){if(n.has("value")){let{h:e,s,l:i,a:o}=Ii(this.value);this.hue=e,this.saturation=s,this.lightness=i,this.alpha=o,this.renderHueSaturationGrid()}super.update(n)}renderHueSaturationGrid(){if(!this.canvas.value)return;let e=this.canvas.value.getContext("2d");if(!e)return;let s=this.canvas.value.width/100,i=this.canvas.value.height/100,o=0,t=0;for(let c of Da(this.hue))e.fillStyle=c,e.fillRect(o,t,s,i),o+=s,o=o%(s*101),o||(t+=i)}_handleSaturationLightnessClick(n){if(!this.canvas.value)return;let{offsetX:e,offsetY:s}=n;this.saturation=e/this.canvas.value.width,this.lightness=(this.canvas.value.height-s)/this.canvas.value.height,this.updateValue()}_handleHueChange(n){n.stopPropagation(),this.hue=parseInt(String(n.target.value))/100*360,n.target.style.setProperty("accent-color",`hsl(${this.hue}deg 100% 50%)`),this.renderHueSaturationGrid(),this.updateValue()}updateValue(){let n=La(this.hue,this.saturation*100,this.lightness*100)+Math.round(this.alpha*255).toString(16).padStart(2,"0");this.value=n}_handleAlphaChange(n){n.stopPropagation(),this.alpha=parseInt(String(n.target.value))/100,this.updateValue()}_handleApply(){var n;this.updateValue(),(n=this.querySelector("spectric-popover"))==null||n.hidePopover(),this.dispatchEvent(new Event("change",{bubbles:!0}))}_cancel(){var n;this.original&&(this.value=this.original),(n=this.querySelector("spectric-popover"))==null||n.hidePopover(),this.dispatchEvent(new Event("cancel"))}async _openPopover(){var e;let n=this.querySelector("spectric-popover");if(!(!n||n.isOpen())){for(this.original=this.value,(e=this.querySelector("spectric-popover"))==null||e.showPopover();!this.canvas.value;)await new Promise(s=>setTimeout(s,100));this.renderHueSaturationGrid()}}getPopover(){return w`
1380
+ pointer-events:none;}`,Se([g({type:Number,reflect:!0})],h.TooltipElement.prototype,"delay",2),Se([g({type:Number,reflect:!0})],h.TooltipElement.prototype,"animationDuration",2),Se([g({type:String,reflect:!1})],h.TooltipElement.prototype,"text",2),Se([g({type:String,reflect:!0})],h.TooltipElement.prototype,"position",2),Se([g({type:Number,reflect:!0})],h.TooltipElement.prototype,"maxWidth",2),Se([g({attribute:!1})],h.TooltipElement.prototype,"portalTarget",2),Se([g({attribute:!1})],h.TooltipElement.prototype,"triggerTarget",2),h.TooltipElement=Se([I(Xi)],h.TooltipElement);var Sa=Object.defineProperty,xa=Object.getOwnPropertyDescriptor,G=(r,e,i,s)=>{for(var t=s>1?void 0:s?xa(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&Sa(e,i,t),t};let lt;window.hasOwnProperty("EyeDropper")&&(lt=new EyeDropper);let V=class extends B{constructor(){super(),this.value="#FF0000FF",this.showAlpha=!0,this.hue=0,this.alpha=1,this.saturation=1,this.lightness=1,this.canvas=Ve(),this.sldown=!1,this._handleAlphaChange=this._handleAlphaChange.bind(this),this._handleHueChange=this._handleHueChange.bind(this),this._handleApply=this._handleApply.bind(this),this._cancel=this._cancel.bind(this),this._handleSaturationLightnessClick=this._handleSaturationLightnessClick.bind(this)}createRenderRoot(){return this}update(r){if(r.has("value")){let{h:e,s:i,l:s,a:t}=us(this.value);this.hue=e,this.saturation=i,this.lightness=s,this.alpha=t,this.renderHueSaturationGrid()}super.update(r)}renderHueSaturationGrid(){if(!this.canvas.value)return;let e=this.canvas.value.getContext("2d");if(!e)return;let i=this.canvas.value.width/100,s=this.canvas.value.height/100,t=0,a=0;for(let o of Ea(this.hue))e.fillStyle=o,e.fillRect(t,a,i,s),t+=i,t=t%(i*101),t||(a+=s)}_handleSaturationLightnessClick(r){if(!this.canvas.value)return;let{offsetX:e,offsetY:i}=r;this.saturation=e/this.canvas.value.width,this.lightness=(this.canvas.value.height-i)/this.canvas.value.height,this.updateValue()}_handleHueChange(r){r.stopPropagation(),this.hue=parseInt(String(r.target.value))/100*360,r.target.style.setProperty("accent-color",`hsl(${this.hue}deg 100% 50%)`),this.renderHueSaturationGrid(),this.updateValue()}updateValue(){let r=Aa(this.hue,this.saturation*100,this.lightness*100)+Math.round(this.alpha*255).toString(16).padStart(2,"0");this.value=r}_handleAlphaChange(r){r.stopPropagation(),this.alpha=parseInt(String(r.target.value))/100,this.updateValue()}_handleApply(){var r;this.updateValue(),(r=this.querySelector("spectric-popover"))==null||r.hidePopover(),this.dispatchEvent(new Event("change",{bubbles:!0}))}_cancel(){var r;this.original&&(this.value=this.original),(r=this.querySelector("spectric-popover"))==null||r.hidePopover(),this.dispatchEvent(new Event("cancel"))}async _openPopover(){var e;let r=this.querySelector("spectric-popover");if(!(!r||r.isOpen())){for(this.original=this.value,(e=this.querySelector("spectric-popover"))==null||e.showPopover();!this.canvas.value;)await new Promise(i=>setTimeout(i,100));this.renderHueSaturationGrid()}}getPopover(){return $`
1272
1381
  <spectric-input label="Hue" class="hue-gradient" variant="range" .value=${this.hue||0} style="accent-color:hsl(${this.hue}deg 100% 50%)" @change=${this._handleHueChange}></spectric-input>
1273
- <canvas ${at(this.canvas)} width=200 height=100 class="color-picker-saturation-lightness-grid" @click=${this._handleSaturationLightnessClick}
1274
- @mousedown=${n=>{this.sldown=!0,n.preventDefault(),n.stopPropagation()}}
1275
- @mouseup=${n=>{this.sldown=!1,n.preventDefault(),n.stopPropagation()}}
1276
- @mousemove=${n=>{this.sldown&&this._handleSaturationLightnessClick(n)}}
1382
+ <canvas ${We(this.canvas)} width=200 height=100 class="color-picker-saturation-lightness-grid" @click=${this._handleSaturationLightnessClick}
1383
+ @mousedown=${r=>{this.sldown=!0,r.preventDefault(),r.stopPropagation()}}
1384
+ @mouseup=${r=>{this.sldown=!1,r.preventDefault(),r.stopPropagation()}}
1385
+ @mousemove=${r=>{this.sldown&&this._handleSaturationLightnessClick(r)}}
1277
1386
  ></canvas>
1278
1387
  <spectric-input class="alpha-gradient" ?hidden=${!this.showAlpha} label="Opacity" variant="range" .value=${(this.alpha||1)*100} @change=${this._handleAlphaChange}></spectric-input>
1279
1388
  <div class="color-picker-footer">
1280
- <spectric-button icon class="color-picker-eyedropper ${He===void 0?"hidden":""}" @click=${async()=>{if(He){let n=await(He==null?void 0:He.open()),{h:e,s,l:i,a:o}=Ii(n.sRGBHex);this.hue=e,this.saturation=s,this.lightness=i,this.alpha=o,this.updateValue()}}}>${Oa}</spectric-button>
1389
+ <spectric-button icon class="color-picker-eyedropper ${lt===void 0?"hidden":""}" @click=${async()=>{if(lt){let r=await(lt==null?void 0:lt.open()),{h:e,s:i,l:s,a:t}=us(r.sRGBHex);this.hue=e,this.saturation=i,this.lightness=s,this.alpha=t,this.updateValue()}}}>${ka}</spectric-button>
1281
1390
  <spectric-button @click=${this._handleApply}>Apply</spectric-button>
1282
1391
  <spectric-button variant="secondary" @click=${this._cancel}>Cancel</spectric-button>
1283
1392
  </div>
1284
- `}render(){return w`
1393
+ `}render(){return $`
1285
1394
  <spectric-button variant="secondary" @click=${this._openPopover} icon>
1286
1395
  <spectric-popover .text=${this.getPopover()} icon variant="text"></spectric-popover>
1287
1396
  <div style="width:15px;height:15px;background-color:${this.value}"></div>
1288
1397
  </spectric-button>
1289
- `}};U([v({type:String,reflect:!0})],R.prototype,"value",2),U([v({type:Boolean,reflect:!0})],R.prototype,"showAlpha",2),U([Q()],R.prototype,"hue",2),U([Q()],R.prototype,"alpha",2),U([Q()],R.prototype,"saturation",2),U([Q()],R.prototype,"lightness",2),U([_e({capture:!0})],R.prototype,"_handleSaturationLightnessClick",1),U([_e({capture:!0})],R.prototype,"_handleHueChange",1),U([_e({capture:!0})],R.prototype,"_handleAlphaChange",1),U([_e({capture:!0})],R.prototype,"_handleApply",1),U([_e({capture:!0})],R.prototype,"_cancel",1),U([_e({capture:!0})],R.prototype,"_openPopover",1),R=U([T("spectric-colorpicker")],R);const Oa=w`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" height="15" width="15" fill="currentColor"><path d="M222,67.34a33.81,33.81,0,0,0-10.64-24.25C198.12,30.56,176.68,31,163.54,44.18L142.82,65l-.63-.63a22,22,0,0,0-31.11,0l-9,9a14,14,0,0,0,0,19.81l3.47,3.47L53.14,149.1a37.79,37.79,0,0,0-9.84,36.73l-8.31,19a11.68,11.68,0,0,0,2.46,13A13.91,13.91,0,0,0,47.32,222,14.15,14.15,0,0,0,53,220.82L71,212.92a37.92,37.92,0,0,0,35.84-10.07l52.44-52.46,3.47,3.48a14,14,0,0,0,19.8,0l9-9a22,22,0,0,0,0-31.12l-.66-.66L212,91.85A33.76,33.76,0,0,0,222,67.34Zm-123.61,127a26,26,0,0,1-26,6.47,6,6,0,0,0-4.16.24l-20,8.75a2,2,0,0,1-2.09-.31l9.12-20.9a5.94,5.94,0,0,0,.19-4.31,25.88,25.88,0,0,1,6.26-26.72l52.44-52.45,36.76,36.78Zm105.16-111L178.17,108.9a6,6,0,0,0,0,8.47l4.88,4.89a10,10,0,0,1,0,14.15l-9,9a2,2,0,0,1-2.82,0l-60.69-60.7a2,2,0,0,1,0-2.83l9-9a10,10,0,0,1,14.14,0l4.89,4.89a6,6,0,0,0,4.24,1.75h0a6,6,0,0,0,4.25-1.77L172,52.66c8.58-8.58,22.52-9,31.08-.85a22,22,0,0,1,.44,31.57Z"/></svg>`;function*Da(n){for(let e=100;e>=0;e--)for(let s=0;s<=100;s++)yield`hsl(${n}, ${s}%, ${e}%)`}function La(n,e,s){s/=100;const i=e*Math.min(s,1-s)/100,o=t=>{const c=(t+n/30)%12,f=s-i*Math.max(Math.min(c-3,9-c,1),-1);return Math.round(255*f).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`}function Ii(n){let e=0,s=0,i=0,o=255;n.length===4||n.length===5?(e=parseInt(n[1]+n[1],16),s=parseInt(n[2]+n[2],16),i=parseInt(n[3]+n[3],16),n.length===5&&(o=parseInt(n[4]+n[4],16))):(n.length===7||n.length===9)&&(e=parseInt(n.substring(1,3),16),s=parseInt(n.substring(3,5),16),i=parseInt(n.substring(5,7),16),n.length===9&&(o=parseInt(n.substring(7,9),16))),e/=255,s/=255,i/=255,o/=255;const t=Math.max(e,s,i),c=Math.min(e,s,i);let f=0,d=0,y=(t+c)/2;if(t===c)f=0,d=0;else{const C=t-c;switch(d=y>.5?C/(2-t-c):C/(t+c),t){case e:f=(s-i)/C+(s<i?6:0);break;case s:f=(i-e)/C+2;break;case i:f=(e-s)/C+4;break}f/=6}return f=Math.round(f*360),{h:f,s:d,l:y,a:o}}const za=Object.freeze(Object.defineProperty({__proto__:null,SpreadPropsDirective:ur,debounce:Si,debounceAnimation:lt,once:Ri,spreadProps:Ee},Symbol.toStringTag,{value:"Module"}));var Na=Object.defineProperty,Ba=Object.getOwnPropertyDescriptor,Fe=(n,e,s,i)=>{for(var o=i>1?void 0:i?Ba(e,s):e,t=n.length-1,c;t>=0;t--)(c=n[t])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&Na(e,s,o),o};h.SpectricCalendar=class extends K{constructor(){super(),this.currentDate=new Date,this.date=new Date,this.popup=!1,this.disabled=!1,this.handleMouseMove=lt(async e=>{const s=await this.calendarElement,i=s.getBoundingClientRect(),o=(e.clientX-i.left)/i.width*100,t=(e.clientY-i.top)/i.height*100;s.style.setProperty("--x",`${o}%`),s.style.setProperty("--y",`${t}%`)}),this.resetMouseMove=async()=>{const e=await this.calendarElement;e.style.setProperty("--x","200%"),e.style.setProperty("--y","200%")},this.addDisposableListener(this.calendarElement,"mousemove",this.handleMouseMove),this.addDisposableListener(this.calendarElement,"mouseleave",this.resetMouseMove)}createRenderRoot(){return this}getMonthDays(e,s){const i=new Date(e,s,1),o=[],t=i.getUTCDay(),c=new Date(e,s+1,0).getUTCDate();for(let f=0;f<t;f++)o.push("");for(let f=1;f<=c;f++)o.push(f);return o}changeMonth(e){const s=new Date(this.date);s.setUTCMonth(s.getUTCMonth()+e),this.currentDate=s}changeYear(e){const s=parseInt(e.target.value,10),i=new Date(this.date);i.setUTCFullYear(s),this.currentDate=i}selectDay(e){let s=this.date.getUTCFullYear(),i=this.date.getUTCMonth(),o=this.date.getUTCHours(),t=this.date.getUTCMinutes(),c=this.date.getUTCSeconds(),f=this.date.getUTCMilliseconds(),d=new Date;d.setUTCFullYear(s,i,e),d.setUTCHours(o,t,c,f),console.log(d.toISOString(),s,i,e),this.date=d;let y=this.querySelector("spectric-popover");y&&y.hidePopover(),this.dispatchEvent(new CustomEvent("select",{detail:d}))}update(e){e.has("currentDate")&&(this.currentDate===void 0?this.date=new Date:this.date=new Date(this.currentDate)),super.update(e)}render(){const e=this.date.getUTCFullYear(),s=this.date.getUTCMonth(),i=this.date.getUTCDate();this.date.toUTCString();const o=new Date(e,s,i).toLocaleString("default",{month:"long"}),t=this.getMonthDays(e,s),c=Array.from({length:21},(d,y)=>e-10+y),f=w`<spectric-panel class="calendar">
1398
+ `}};G([g({type:String,reflect:!0})],V.prototype,"value",2),G([g({type:Boolean,reflect:!0})],V.prototype,"showAlpha",2),G([W()],V.prototype,"hue",2),G([W()],V.prototype,"alpha",2),G([W()],V.prototype,"saturation",2),G([W()],V.prototype,"lightness",2),G([Pe({capture:!0})],V.prototype,"_handleSaturationLightnessClick",1),G([Pe({capture:!0})],V.prototype,"_handleHueChange",1),G([Pe({capture:!0})],V.prototype,"_handleAlphaChange",1),G([Pe({capture:!0})],V.prototype,"_handleApply",1),G([Pe({capture:!0})],V.prototype,"_cancel",1),G([Pe({capture:!0})],V.prototype,"_openPopover",1),V=G([I("spectric-colorpicker")],V);const ka=$`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" height="15" width="15" fill="currentColor"><path d="M222,67.34a33.81,33.81,0,0,0-10.64-24.25C198.12,30.56,176.68,31,163.54,44.18L142.82,65l-.63-.63a22,22,0,0,0-31.11,0l-9,9a14,14,0,0,0,0,19.81l3.47,3.47L53.14,149.1a37.79,37.79,0,0,0-9.84,36.73l-8.31,19a11.68,11.68,0,0,0,2.46,13A13.91,13.91,0,0,0,47.32,222,14.15,14.15,0,0,0,53,220.82L71,212.92a37.92,37.92,0,0,0,35.84-10.07l52.44-52.46,3.47,3.48a14,14,0,0,0,19.8,0l9-9a22,22,0,0,0,0-31.12l-.66-.66L212,91.85A33.76,33.76,0,0,0,222,67.34Zm-123.61,127a26,26,0,0,1-26,6.47,6,6,0,0,0-4.16.24l-20,8.75a2,2,0,0,1-2.09-.31l9.12-20.9a5.94,5.94,0,0,0,.19-4.31,25.88,25.88,0,0,1,6.26-26.72l52.44-52.45,36.76,36.78Zm105.16-111L178.17,108.9a6,6,0,0,0,0,8.47l4.88,4.89a10,10,0,0,1,0,14.15l-9,9a2,2,0,0,1-2.82,0l-60.69-60.7a2,2,0,0,1,0-2.83l9-9a10,10,0,0,1,14.14,0l4.89,4.89a6,6,0,0,0,4.24,1.75h0a6,6,0,0,0,4.25-1.77L172,52.66c8.58-8.58,22.52-9,31.08-.85a22,22,0,0,1,.44,31.57Z"/></svg>`;function*Ea(r){for(let e=100;e>=0;e--)for(let i=0;i<=100;i++)yield`hsl(${r}, ${i}%, ${e}%)`}function Aa(r,e,i){i/=100;const s=e*Math.min(i,1-i)/100,t=a=>{const o=(a+r/30)%12,d=i-s*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*d).toString(16).padStart(2,"0")};return`#${t(0)}${t(8)}${t(4)}`}function us(r){let e=0,i=0,s=0,t=255;r.length===4||r.length===5?(e=parseInt(r[1]+r[1],16),i=parseInt(r[2]+r[2],16),s=parseInt(r[3]+r[3],16),r.length===5&&(t=parseInt(r[4]+r[4],16))):(r.length===7||r.length===9)&&(e=parseInt(r.substring(1,3),16),i=parseInt(r.substring(3,5),16),s=parseInt(r.substring(5,7),16),r.length===9&&(t=parseInt(r.substring(7,9),16))),e/=255,i/=255,s/=255,t/=255;const a=Math.max(e,i,s),o=Math.min(e,i,s);let d=0,c=0,b=(a+o)/2;if(a===o)d=0,c=0;else{const _=a-o;switch(c=b>.5?_/(2-a-o):_/(a+o),a){case e:d=(i-s)/_+(i<s?6:0);break;case i:d=(s-e)/_+2;break;case s:d=(e-i)/_+4;break}d/=6}return d=Math.round(d*360),{h:d,s:c,l:b,a:t}}const Ca=Object.freeze(Object.defineProperty({__proto__:null,SpreadPropsDirective:Ti,debounce:Hr,debounceAnimation:Et,once:cs,spreadProps:Me},Symbol.toStringTag,{value:"Module"}));var Oa=Object.defineProperty,Pa=Object.getOwnPropertyDescriptor,ct=(r,e,i,s)=>{for(var t=s>1?void 0:s?Pa(e,i):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(t=(s?o(e,i,t):o(t))||t);return s&&t&&Oa(e,i,t),t};h.SpectricCalendar=class extends re{constructor(){super(),this.currentDate=new Date,this.date=new Date,this.popup=!1,this.disabled=!1,this.handleMouseMove=Et(async e=>{const i=await this.calendarElement,s=i.getBoundingClientRect(),t=(e.clientX-s.left)/s.width*100,a=(e.clientY-s.top)/s.height*100;i.style.setProperty("--x",`${t}%`),i.style.setProperty("--y",`${a}%`)}),this.resetMouseMove=async()=>{const e=await this.calendarElement;e.style.setProperty("--x","200%"),e.style.setProperty("--y","200%")},this.addDisposableListener(this.calendarElement,"mousemove",this.handleMouseMove),this.addDisposableListener(this.calendarElement,"mouseleave",this.resetMouseMove)}createRenderRoot(){return this}getMonthDays(e,i){const s=new Date(e,i,1),t=[],a=s.getUTCDay(),o=new Date(e,i+1,0).getUTCDate();for(let d=0;d<a;d++)t.push("");for(let d=1;d<=o;d++)t.push(d);return t}changeMonth(e){const i=new Date(this.date);i.setUTCMonth(i.getUTCMonth()+e),this.currentDate=i}changeYear(e){const i=parseInt(e.target.value,10),s=new Date(this.date);s.setUTCFullYear(i),this.currentDate=s}selectDay(e){let i=this.date.getUTCFullYear(),s=this.date.getUTCMonth(),t=this.date.getUTCHours(),a=this.date.getUTCMinutes(),o=this.date.getUTCSeconds(),d=this.date.getUTCMilliseconds(),c=new Date;c.setUTCFullYear(i,s,e),c.setUTCHours(t,a,o,d),console.log(c.toISOString(),i,s,e),this.date=c;let b=this.querySelector("spectric-popover");b&&b.hidePopover(),this.dispatchEvent(new CustomEvent("select",{detail:c}))}update(e){e.has("currentDate")&&(this.currentDate===void 0?this.date=new Date:this.date=new Date(this.currentDate)),super.update(e)}render(){const e=this.date.getUTCFullYear(),i=this.date.getUTCMonth(),s=this.date.getUTCDate();this.date.toUTCString();const t=new Date(e,i,s).toLocaleString("default",{month:"long"}),a=this.getMonthDays(e,i),o=Array.from({length:21},(c,b)=>e-10+b),d=$`<spectric-panel class="calendar">
1290
1399
  <div class="header">
1291
1400
  <spectric-button
1292
1401
  ?disabled=${this.disabled}
@@ -1297,9 +1406,9 @@ spectric-button{
1297
1406
  >🠈</spectric-button
1298
1407
  >
1299
1408
  <div class="month-year">
1300
- <span>${o}</span>
1409
+ <span>${t}</span>
1301
1410
  <select ?disabled=${this.disabled} @change=${this.changeYear}>
1302
- ${c.map(d=>w`<option value=${d} ?selected=${d===e}>${d}</option>`)}
1411
+ ${o.map(c=>$`<option value=${c} ?selected=${c===e}>${c}</option>`)}
1303
1412
  </select>
1304
1413
  </div>
1305
1414
  <spectric-button ?disabled=${this.disabled} size="xsmall" icon @click=${()=>this.changeMonth(1)}
@@ -1307,18 +1416,18 @@ spectric-button{
1307
1416
  >
1308
1417
  </div>
1309
1418
  <div class="days">
1310
- ${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(d=>w`<div class="day">${d}</div>`)}
1311
- ${t.map(d=>d==""?w`<span></span>`:w`<spectric-button
1419
+ ${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(c=>$`<div class="day">${c}</div>`)}
1420
+ ${a.map(c=>c==""?$`<span></span>`:$`<spectric-button
1312
1421
  ?disabled=${this.disabled}
1313
- @click=${()=>this.selectDay(d)}
1314
- .backgroundColor=${d===i?void 0:"var(--spectric-background,#f4f4f4)"}
1422
+ @click=${()=>this.selectDay(c)}
1423
+ .backgroundColor=${c===s?void 0:"var(--spectric-background,#f4f4f4)"}
1315
1424
  icon
1316
1425
  size="xsmall"
1317
- class="date ${d===i?"active":""}"
1318
- >${d}</spectric-button
1426
+ class="date ${c===s?"active":""}"
1427
+ >${c}</spectric-button
1319
1428
  >`)}
1320
1429
  </div>
1321
- </spectric-panel>`;return this.popup?w`
1430
+ </spectric-panel>`;return this.popup?$`
1322
1431
  <spectric-button
1323
1432
  class="input-button-right"
1324
1433
  icon
@@ -1326,7 +1435,7 @@ spectric-button{
1326
1435
  variant="text"
1327
1436
  type="button"
1328
1437
  ?disabled=${this.disabled}
1329
- @click=${d=>{let y=this.querySelector("spectric-popover");y&&d.target&&(y.triggerTarget=d.target,y.showPopover())}}
1438
+ @click=${c=>{let b=this.querySelector("spectric-popover");b&&c.target&&(b.triggerTarget=c.target,b.showPopover())}}
1330
1439
  ><svg
1331
1440
  xmlns="http://www.w3.org/2000/svg"
1332
1441
  xmlns:xlink="http://www.w3.org/1999/xlink"
@@ -1367,6 +1476,6 @@ spectric-button{
1367
1476
  ></path>
1368
1477
  </g></svg>
1369
1478
  </spectric-button>
1370
- <spectric-popover position="left" .text=${f}></spectric-popover>
1371
- `:f}},Fe([st(".days")],h.SpectricCalendar.prototype,"calendarElement",2),Fe([v({attribute:!1})],h.SpectricCalendar.prototype,"currentDate",2),Fe([Q()],h.SpectricCalendar.prototype,"date",2),Fe([v({type:Boolean,reflect:!0})],h.SpectricCalendar.prototype,"popup",2),Fe([v({type:Boolean,reflect:!0})],h.SpectricCalendar.prototype,"disabled",2),h.SpectricCalendar=Fe([T("spectric-calendar")],h.SpectricCalendar);const Ma={...aa,...Object.freeze(Object.defineProperty({__proto__:null,get BitDisplayCanvas(){return h.BitDisplayCanvas},ButtonSizes:ir,ButtonVariants:sr,CSSPropsControls:Di,get DialogElement(){return h.DialogElement},DialogElementTag:Et,ElementTag:Sr,get Header(){return h.Header},InputVariants:dr,Orientations:_r,get PaginationElement(){return h.PaginationElement},PaginationElementTag:Ar,SPECTRIC_CSS_VARIABLES:Bi,get SpectricButton(){return h.SpectricButton},get SpectricCalendar(){return h.SpectricCalendar},get SpectricInput(){return h.SpectricInput},get SpectricPage(){return h.SpectricPage},get SpectricPanel(){return h.SpectricPanel},get SpectricQuery(){return h.SpectricQuery},get SpectricTableElement(){return h.SpectricTableElement},get SpectricThemeProvider(){return h.SpectricThemeProvider},get SplitView(){return h.SplitView},SupportedLanguages:yr,TD_BorderAndPadding:Ue,TableElementTag:xr,TableSelectOptions:Er,TableSortDirection:M,TableSortOption:kr,ThemeSelections:Ni,get TooltipElement(){return h.TooltipElement},TooltipElementTag:Tr,TooltipPostions:Or,nodeTypes:J},Symbol.toStringTag,{value:"Module"})),...za};h.BitArray=cr,h.ButtonSizes=ir,h.ButtonVariants=sr,h.CSSPropsControls=Di,h.DialogElementTag=Et,h.DisposableElement=K,h.ElementTag=Sr,h.InputVariants=dr,h.Orientations=_r,h.PaginationElementTag=Ar,h.SPECTRIC_CSS_VARIABLES=Bi,h.SpreadPropsDirective=ur,h.SupportedLanguages=yr,h.TD_BorderAndPadding=Ue,h.TableElementTag=xr,h.TableSelectOptions=Er,h.TableSortDirection=M,h.TableSortOption=kr,h.ThemeSelections=Ni,h.TooltipElementTag=Tr,h.TooltipPostions=Or,h.debounce=Si,h.debounceAnimation=lt,h.default=Ma,h.getListeners=bi,h.nodeTypes=J,h.once=Ri,h.spreadProps=Ee,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1479
+ <spectric-popover position="left" .text=${d}></spectric-popover>
1480
+ `:d}},ct([xt(".days")],h.SpectricCalendar.prototype,"calendarElement",2),ct([g({attribute:!1})],h.SpectricCalendar.prototype,"currentDate",2),ct([W()],h.SpectricCalendar.prototype,"date",2),ct([g({type:Boolean,reflect:!0})],h.SpectricCalendar.prototype,"popup",2),ct([g({type:Boolean,reflect:!0})],h.SpectricCalendar.prototype,"disabled",2),h.SpectricCalendar=ct([I("spectric-calendar")],h.SpectricCalendar);const Ta={...ta,...Object.freeze(Object.defineProperty({__proto__:null,get BitDisplayCanvas(){return h.BitDisplayCanvas},ButtonSizes:Si,ButtonVariants:xi,CSSPropsControls:is,get DialogElement(){return h.DialogElement},DialogElementTag:Xt,ElementTag:Vi,get Header(){return h.Header},InputVariants:Di,Orientations:qi,get PaginationElement(){return h.PaginationElement},PaginationElementTag:Wi,SPECTRIC_CSS_VARIABLES:os,get SpectricButton(){return h.SpectricButton},get SpectricCalendar(){return h.SpectricCalendar},get SpectricInput(){return h.SpectricInput},get SpectricPage(){return h.SpectricPage},get SpectricPanel(){return h.SpectricPanel},get SpectricQuery(){return h.SpectricQuery},get SpectricTableElement(){return h.SpectricTableElement},get SpectricThemeProvider(){return h.SpectricThemeProvider},get SplitView(){return h.SplitView},SupportedLanguages:Fi,TD_BorderAndPadding:at,TableElementTag:Yi,TableSelectOptions:Zi,TableSortDirection:Q,TableSortOption:Ji,ThemeSelections:ns,get TooltipElement(){return h.TooltipElement},TooltipElementTag:Xi,TooltipPostions:er,nodeTypes:ae,toLabelValue:Tt},Symbol.toStringTag,{value:"Module"})),...Ca};h.BitArray=Oi,h.ButtonSizes=Si,h.ButtonVariants=xi,h.CSSPropsControls=is,h.DialogElementTag=Xt,h.DisposableElement=re,h.ElementTag=Vi,h.InputVariants=Di,h.Orientations=qi,h.PaginationElementTag=Wi,h.SPECTRIC_CSS_VARIABLES=os,h.SpreadPropsDirective=Ti,h.SupportedLanguages=Fi,h.TD_BorderAndPadding=at,h.TableElementTag=Yi,h.TableSelectOptions=Zi,h.TableSortDirection=Q,h.TableSortOption=Ji,h.ThemeSelections=ns,h.TooltipElementTag=Xi,h.TooltipPostions=er,h.debounce=Hr,h.debounceAnimation=Et,h.default=Ta,h.getListeners=zr,h.nodeTypes=ae,h.once=cs,h.spreadProps=Me,h.toLabelValue=Tt,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1372
1481
  //# sourceMappingURL=index.umd.js.map