@kodaris/krubble-app-components 1.0.166 → 1.0.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chatbot.d.ts +10 -1
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +29 -0
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +29 -0
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +25 -9
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +29 -0
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +21 -5
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/dist/krubble-shell-chatbot.umd.js +29 -0
- package/dist/krubble-shell-chatbot.umd.js.map +1 -1
- package/dist/krubble-shell-chatbot.umd.min.js +170 -154
- package/dist/krubble-shell-chatbot.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const w=globalThis,$=w.trustedTypes,S=$?$.createPolicy("lit-html",{createHTML:e=>e}):void 0,C="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,z="?"+E,D=`<${z}>`,T=document,O=()=>T.createComment(""),A=e=>null===e||"object"!=typeof e&&"function"!=typeof e,I=Array.isArray,R="[ \t\n\f\r]",M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,P=/-->/g,L=/>/g,q=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,F=/"/g,B=/^(?:script|style|textarea|title)$/i,j=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),
|
|
17
|
+
const w=globalThis,$=w.trustedTypes,S=$?$.createPolicy("lit-html",{createHTML:e=>e}):void 0,C="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,z="?"+E,D=`<${z}>`,T=document,O=()=>T.createComment(""),A=e=>null===e||"object"!=typeof e&&"function"!=typeof e,I=Array.isArray,R="[ \t\n\f\r]",M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,P=/-->/g,L=/>/g,q=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,F=/"/g,B=/^(?:script|style|textarea|title)$/i,j=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),N=Symbol.for("lit-noChange"),H=Symbol.for("lit-nothing"),U=new WeakMap,W=T.createTreeWalker(T,129);function K(e,t){if(!I(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(t):t}class Y{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let o=0,r=0;const n=e.length-1,a=this.parts,[l,d]=((e,t)=>{const i=e.length-1,s=[];let o,r=2===t?"<svg>":3===t?"<math>":"",n=M;for(let t=0;t<i;t++){const i=e[t];let a,l,d=-1,h=0;for(;h<i.length&&(n.lastIndex=h,l=n.exec(i),null!==l);)h=n.lastIndex,n===M?"!--"===l[1]?n=P:void 0!==l[1]?n=L:void 0!==l[2]?(B.test(l[2])&&(o=RegExp("</"+l[2],"g")),n=q):void 0!==l[3]&&(n=q):n===q?">"===l[0]?(n=o??M,d=-1):void 0===l[1]?d=-2:(d=n.lastIndex-l[2].length,a=l[1],n=void 0===l[3]?q:'"'===l[3]?F:V):n===F||n===V?n=q:n===P||n===L?n=M:(n=q,o=void 0);const c=n===q&&e[t+1].startsWith("/>")?" ":"";r+=n===M?i+D:d>=0?(s.push(a),i.slice(0,d)+C+i.slice(d)+E+c):i+E+(-2===d?t:c)}return[K(e,r+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]})(e,t);if(this.el=Y.createElement(l,i),W.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=W.nextNode())&&a.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(C)){const t=d[r++],i=s.getAttribute(e).split(E),n=/([.?@])?(.*)/.exec(t);a.push({type:1,index:o,name:n[2],strings:i,ctor:"."===n[1]?G:"?"===n[1]?ee:"@"===n[1]?te:J}),s.removeAttribute(e)}else e.startsWith(E)&&(a.push({type:6,index:o}),s.removeAttribute(e));if(B.test(s.tagName)){const e=s.textContent.split(E),t=e.length-1;if(t>0){s.textContent=$?$.emptyScript:"";for(let i=0;i<t;i++)s.append(e[i],O()),W.nextNode(),a.push({type:2,index:++o});s.append(e[t],O())}}}else if(8===s.nodeType)if(s.data===z)a.push({type:2,index:o});else{let e=-1;for(;-1!==(e=s.data.indexOf(E,e+1));)a.push({type:7,index:o}),e+=E.length-1}o++}}static createElement(e,t){const i=T.createElement("template");return i.innerHTML=e,i}}function X(e,t,i=e,s){if(t===N)return t;let o=void 0!==s?i._$Co?.[s]:i._$Cl;const r=A(t)?void 0:t._$litDirective$;return o?.constructor!==r&&(o?._$AO?.(!1),void 0===r?o=void 0:(o=new r(e),o._$AT(e,i,s)),void 0!==s?(i._$Co??=[])[s]=o:i._$Cl=o),void 0!==o&&(t=X(e,o._$AS(e,t.values),o,s)),t}class Z{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??T).importNode(t,!0);W.currentNode=s;let o=W.nextNode(),r=0,n=0,a=i[0];for(;void 0!==a;){if(r===a.index){let t;2===a.type?t=new Q(o,o.nextSibling,this,e):1===a.type?t=new a.ctor(o,a.name,a.strings,this,e):6===a.type&&(t=new ie(o,this,e)),this._$AV.push(t),a=i[++n]}r!==a?.index&&(o=W.nextNode(),r++)}return W.currentNode=T,s}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class Q{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=H,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=X(this,e,t),A(e)?e===H||null==e||""===e?(this._$AH!==H&&this._$AR(),this._$AH=H):e!==this._$AH&&e!==N&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>I(e)||"function"==typeof e?.[Symbol.iterator])(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!==H&&A(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,s="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=Y.createElement(K(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new Z(s,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=U.get(e.strings);return void 0===t&&U.set(e.strings,t=new Y(e)),t}k(e){I(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const o of e)s===t.length?t.push(i=new Q(this.O(O()),this.O(O()),this,this.options)):i=t[s],i._$AI(o),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class J{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,o){this.type=1,this._$AH=H,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=H}_$AI(e,t=this,i,s){const o=this.strings;let r=!1;if(void 0===o)e=X(this,e,t,0),r=!A(e)||e!==this._$AH&&e!==N,r&&(this._$AH=e);else{const s=e;let n,a;for(e=o[0],n=0;n<o.length-1;n++)a=X(this,s[i+n],t,n),a===N&&(a=this._$AH[n]),r||=!A(a)||a!==this._$AH[n],a===H?e=H:e!==H&&(e+=(a??"")+o[n+1]),this._$AH[n]=a}r&&!s&&this.j(e)}j(e){e===H?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class G extends J{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===H?void 0:e}}class ee extends J{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==H)}}class te extends J{constructor(e,t,i,s,o){super(e,t,i,s,o),this.type=5}_$AI(e,t=this){if((e=X(this,e,t,0)??H)===N)return;const i=this._$AH,s=e===H&&i!==H||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==H&&(i===H||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ie{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){X(this,e)}}const se={I:Q},oe=w.litHtmlPolyfillSupport;oe?.(Y,Q),(w.litHtmlVersions??=[]).push("3.3.2");const re=(e,t,i)=>{const s=i?.renderBefore??t;let o=s._$litPart$;if(void 0===o){const e=i?.renderBefore??null;s._$litPart$=o=new Q(t.insertBefore(O(),e),e,void 0,i??{})}return o._$AI(e),o
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/},ne=globalThis;let ae=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=re(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return
|
|
22
|
+
*/},ne=globalThis;let ae=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=re(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return N}};ae._$litElement$=!0,ae.finalized=!0,ne.litElementHydrateSupport?.({LitElement:ae});const le=ne.litElementPolyfillSupport;le?.({LitElement:ae}),(ne.litElementVersions??=[]).push("4.2.2");
|
|
23
23
|
/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
@@ -51,7 +51,7 @@ function ue(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright 2018 Google LLC
|
|
53
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
-
*/const ye=_e(class extends ve{constructor(e){if(super(e),e.type!==ge||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const i=e.element.classList;for(const e of this.st)e in t||(i.remove(e),this.st.delete(e));for(const e in t){const s=!!t[e];s===this.st.has(e)||this.nt?.has(e)||(s?(i.add(e),this.st.add(e)):(i.remove(e),this.st.delete(e)))}return
|
|
54
|
+
*/const ye=_e(class extends ve{constructor(e){if(super(e),e.type!==ge||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const i=e.element.classList;for(const e of this.st)e in t||(i.remove(e),this.st.delete(e));for(const e in t){const s=!!t[e];s===this.st.has(e)||this.nt?.has(e)||(s?(i.add(e),this.st.add(e)):(i.remove(e),this.st.delete(e)))}return N}}),ke="important",xe=" !"+ke,we=_e(class extends ve{constructor(e){if(super(e),e.type!==ge||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const s=e[i];return null==s?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const s=t[e];if(null!=s){this.ft.add(e);const t="string"==typeof s&&s.endsWith(xe);e.includes("-")||t?i.setProperty(e,t?s.slice(0,-11):s,t?ke:""):i[e]=s}}return N}});
|
|
55
55
|
/**
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright 2018 Google LLC
|
|
@@ -62,12 +62,12 @@ function ue(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
62
62
|
* Copyright 2017 Google LLC
|
|
63
63
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
64
64
|
*/
|
|
65
|
-
class $e extends ve{constructor(e){if(super(e),this.it=
|
|
65
|
+
class $e extends ve{constructor(e){if(super(e),this.it=H,e.type!==fe)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===H||null==e)return this._t=void 0,this.it=e;if(e===N)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}$e.directiveName="unsafeHTML",$e.resultType=1;const Se=_e($e),{I:Ce}=se,Ee=()=>document.createComment(""),ze=(e,t,i)=>{const s=e._$AA.parentNode,o=void 0===t?e._$AB:t._$AA;if(void 0===i){const t=s.insertBefore(Ee(),o),r=s.insertBefore(Ee(),o);i=new Ce(t,r,e,e.options)}else{const t=i._$AB.nextSibling,r=i._$AM,n=r!==e;if(n){let t;i._$AQ?.(e),i._$AM=e,void 0!==i._$AP&&(t=e._$AU)!==r._$AU&&i._$AP(t)}if(t!==o||n){let e=i._$AA;for(;e!==t;){const t=e.nextSibling;s.insertBefore(e,o),e=t}}}return i},De=(e,t,i=e)=>(e._$AI(t,i),e),Te={},Oe=(e,t=Te)=>e._$AH=t,Ae=e=>{e._$AR(),e._$AA.remove()},Ie=(e,t,i)=>{const s=new Map;for(let o=t;o<=i;o++)s.set(e[o],o);return s},Re=_e(class extends ve{constructor(e){if(super(e),e.type!==fe)throw Error("repeat() can only be used in text expressions")}dt(e,t,i){let s;void 0===i?i=t:void 0!==t&&(s=t);const o=[],r=[];let n=0;for(const t of e)o[n]=s?s(t,n):n,r[n]=i(t,n),n++;return{values:r,keys:o}}render(e,t,i){return this.dt(e,t,i).values}update(e,[t,i,s]){const o=(e=>e._$AH)(e),{values:r,keys:n}=this.dt(t,i,s);if(!Array.isArray(o))return this.ut=n,r;const a=this.ut??=[],l=[];let d,h,c=0,p=o.length-1,u=0,g=r.length-1;for(;c<=p&&u<=g;)if(null===o[c])c++;else if(null===o[p])p--;else if(a[c]===n[u])l[u]=De(o[c],r[u]),c++,u++;else if(a[p]===n[g])l[g]=De(o[p],r[g]),p--,g--;else if(a[c]===n[g])l[g]=De(o[c],r[g]),ze(e,l[g+1],o[c]),c++,g--;else if(a[p]===n[u])l[u]=De(o[p],r[u]),ze(e,o[c],o[p]),p--,u++;else if(void 0===d&&(d=Ie(n,u,g),h=Ie(a,c,p)),d.has(a[c]))if(d.has(a[p])){const t=h.get(n[u]),i=void 0!==t?o[t]:null;if(null===i){const t=ze(e,o[c]);De(t,r[u]),l[u]=t}else l[u]=De(i,r[u]),ze(e,o[c],i),o[t]=null;u++}else Ae(o[p]),p--;else Ae(o[c]),c++;for(;u<=g;){const t=ze(e,l[g+1]);De(t,r[u]),l[u++]=t}for(;c<=p;){const e=o[c++];null!==e&&Ae(e)}return this.ut=n,Oe(e,l),N}});
|
|
66
66
|
/**
|
|
67
67
|
* @license
|
|
68
68
|
* Copyright 2020 Google LLC
|
|
69
69
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
70
|
-
*/function Me(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Pe={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Le(e){Pe=e}const qe=/[&<>"']/,Ve=new RegExp(qe.source,"g"),Fe=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Be=new RegExp(Fe.source,"g"),je={"&":"&","<":"<",">":">",'"':""","'":"'"},He=e=>je[e];function Ne(e,t){if(t){if(qe.test(e))return e.replace(Ve,He)}else if(Fe.test(e))return e.replace(Be,He);return e}const Ue=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function We(e){return e.replace(Ue,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Ke=/(^|[^\[])\^/g;function Ye(e,t){let i="string"==typeof e?e:e.source;t=t||"";const s={replace:(e,t)=>{let o="string"==typeof t?t:t.source;return o=o.replace(Ke,"$1"),i=i.replace(e,o),s},getRegex:()=>new RegExp(i,t)};return s}function Xe(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const Ze={exec:()=>null};function Qe(e,t){const i=e.replace(/\|/g,((e,t,i)=>{let s=!1,o=t;for(;--o>=0&&"\\"===i[o];)s=!s;return s?"|":" |"})).split(/ \|/);let s=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;s<i.length;s++)i[s]=i[s].trim().replace(/\\\|/g,"|");return i}function Je(e,t,i){const s=e.length;if(0===s)return"";let o=0;for(;o<s;){if(e.charAt(s-o-1)!==t)break;o++}return e.slice(0,s-o)}function Ge(e,t,i,s){const o=t.href,r=t.title?Ne(t.title):null,n=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){s.state.inLink=!0;const e={type:"link",raw:i,href:o,title:r,text:n,tokens:s.inlineTokens(n)};return s.state.inLink=!1,e}return{type:"image",raw:i,href:o,title:r,text:Ne(n)}}class et{options;rules;lexer;constructor(e){this.options=e||Pe}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Je(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],i=function(e,t){const i=e.match(/^(\s+)(?:```)/);if(null===i)return t;const s=i[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[i]=t;return i.length>=s.length?e.slice(s.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=Je(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1");e=Je(e.replace(/^ *>[ \t]?/gm,""),"\n");const i=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(e);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:s,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=t[1].trim();const s=i.length>1,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");const r=new RegExp(`^( {0,3}${i})((?:[\t ][^\\n]*)?(?:\\n|$))`);let n="",a="",l=!1;for(;e;){let i=!1;if(!(t=r.exec(e)))break;if(this.rules.block.hr.test(e))break;n=t[0],e=e.substring(n.length);let s=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),d=e.split("\n",1)[0],h=0;this.options.pedantic?(h=2,a=s.trimStart()):(h=t[2].search(/[^ ]/),h=h>4?1:h,a=s.slice(h),h+=t[1].length);let c=!1;if(!s&&/^ *$/.test(d)&&(n+=d+"\n",e=e.substring(d.length+1),i=!0),!i){const t=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),i=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),o=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),r=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(d=l,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),o.test(d))break;if(r.test(d))break;if(t.test(d))break;if(i.test(e))break;if(d.search(/[^ ]/)>=h||!d.trim())a+="\n"+d.slice(h);else{if(c)break;if(s.search(/[^ ]/)>=4)break;if(o.test(s))break;if(r.test(s))break;if(i.test(s))break;a+="\n"+d}c||d.trim()||(c=!0),n+=l+"\n",e=e.substring(l.length+1),s=d.slice(h)}}o.loose||(l?o.loose=!0:/\n *\n *$/.test(n)&&(l=!0));let p,u=null;this.options.gfm&&(u=/^\[[ xX]\] /.exec(a),u&&(p="[ ] "!==u[0],a=a.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:n,task:!!u,checked:p,loose:!1,text:a,tokens:[]}),o.raw+=n}o.items[o.items.length-1].raw=n.trimEnd(),o.items[o.items.length-1].text=a.trimEnd(),o.raw=o.raw.trimEnd();for(let e=0;e<o.items.length;e++)if(this.lexer.state.top=!1,o.items[e].tokens=this.lexer.blockTokens(o.items[e].text,[]),!o.loose){const t=o.items[e].tokens.filter((e=>"space"===e.type)),i=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));o.loose=i}if(o.loose)for(let e=0;e<o.items.length;e++)o.items[e].loose=!0;return o}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:i,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const i=Qe(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),o=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(i.length===s.length){for(const e of s)/^ *-+: *$/.test(e)?r.align.push("right"):/^ *:-+: *$/.test(e)?r.align.push("center"):/^ *:-+ *$/.test(e)?r.align.push("left"):r.align.push(null);for(const e of i)r.header.push({text:e,tokens:this.lexer.inline(e)});for(const e of o)r.rows.push(Qe(e,r.header.length).map((e=>({text:e,tokens:this.lexer.inline(e)}))));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Ne(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=Je(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let i=0;for(let s=0;s<e.length;s++)if("\\"===e[s])s++;else if(e[s]===t[0])i++;else if(e[s]===t[1]&&(i--,i<0))return s;return-1}(t[2],"()");if(e>-1){const i=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,i).trim(),t[3]=""}}let i=t[2],s="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);e&&(i=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(i=this.options.pedantic&&!/>$/.test(e)?i.slice(1):i.slice(1,-1)),Ge(t,{href:i?i.replace(this.rules.inline.anyPunctuation,"$1"):i,title:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s},t[0],this.lexer)}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){const e=t[(i[2]||i[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=i[0].charAt(0);return{type:"text",raw:e,text:e}}return Ge(i,e,i[0],this.lexer)}}emStrong(e,t,i=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s)return;if(s[3]&&i.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!i||this.rules.inline.punctuation.exec(i)){const i=[...s[0]].length-1;let o,r,n=i,a=0;const l="*"===s[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+i);null!=(s=l.exec(t));){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(r=[...o].length,s[3]||s[4]){n+=r;continue}if((s[5]||s[6])&&i%3&&!((i+r)%3)){a+=r;continue}if(n-=r,n>0)continue;r=Math.min(r,r+n+a);const t=[...s[0]][0].length,l=e.slice(0,i+s.index+t+r);if(Math.min(i,r)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const d=l.slice(2,-2);return{type:"strong",raw:l,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const i=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return i&&s&&(e=e.substring(1,e.length-1)),e=Ne(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,i;return"@"===t[2]?(e=Ne(t[1]),i="mailto:"+e):(e=Ne(t[1]),i=e),{type:"link",raw:t[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,i;if("@"===t[2])e=Ne(t[0]),i="mailto:"+e;else{let s;do{s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(s!==t[0]);e=Ne(t[0]),i="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:Ne(t[0]),{type:"text",raw:t[0],text:e}}}}const tt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,it=/(?:[*+-]|\d{1,9}[.)])/,st=Ye(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,it).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),ot=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rt=/(?!\s*\])(?:\\.|[^\[\]\\])+/,nt=Ye(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",rt).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),at=Ye(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,it).getRegex(),lt="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",dt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ht=Ye("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",dt).replace("tag",lt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ct=Ye(ot).replace("hr",tt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",lt).getRegex(),pt={blockquote:Ye(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ct).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:nt,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:tt,html:ht,lheading:st,list:at,newline:/^(?: *(?:\n|$))+/,paragraph:ct,table:Ze,text:/^[^\n]+/},ut=Ye("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",tt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",lt).getRegex(),gt={...pt,table:ut,paragraph:Ye(ot).replace("hr",tt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ut).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",lt).getRegex()},ft={...pt,html:Ye("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",dt).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ze,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ye(ot).replace("hr",tt).replace("heading"," *#{1,6} *[^\n]").replace("lheading",st).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},bt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,mt=/^( {2,}|\\)\n(?!\s*$)/,_t="\\p{P}\\p{S}",vt=Ye(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,_t).getRegex(),yt=Ye(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,_t).getRegex(),kt=Ye("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,_t).getRegex(),xt=Ye("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,_t).getRegex(),wt=Ye(/\\([punct])/,"gu").replace(/punct/g,_t).getRegex(),$t=Ye(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),St=Ye(dt).replace("(?:--\x3e|$)","--\x3e").getRegex(),Ct=Ye("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",St).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Et=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,zt=Ye(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Et).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Dt=Ye(/^!?\[(label)\]\[(ref)\]/).replace("label",Et).replace("ref",rt).getRegex(),Tt=Ye(/^!?\[(ref)\](?:\[\])?/).replace("ref",rt).getRegex(),Ot={_backpedal:Ze,anyPunctuation:wt,autolink:$t,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:mt,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Ze,emStrongLDelim:yt,emStrongRDelimAst:kt,emStrongRDelimUnd:xt,escape:bt,link:zt,nolink:Tt,punctuation:vt,reflink:Dt,reflinkSearch:Ye("reflink|nolink(?!\\()","g").replace("reflink",Dt).replace("nolink",Tt).getRegex(),tag:Ct,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Ze},At={...Ot,link:Ye(/^!?\[(label)\]\((.*?)\)/).replace("label",Et).getRegex(),reflink:Ye(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Et).getRegex()},It={...Ot,escape:Ye(bt).replace("])","~|])").getRegex(),url:Ye(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Rt={...It,br:Ye(mt).replace("{2,}","*").getRegex(),text:Ye(It.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Mt={normal:pt,gfm:gt,pedantic:ft},Pt={normal:Ot,gfm:It,breaks:Rt,pedantic:At};class Lt{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Pe,this.options.tokenizer=this.options.tokenizer||new et,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Mt.normal,inline:Pt.normal};this.options.pedantic?(t.block=Mt.pedantic,t.inline=Pt.pedantic):this.options.gfm&&(t.block=Mt.gfm,this.options.breaks?t.inline=Pt.breaks:t.inline=Pt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Mt,inline:Pt}}static lex(e,t){return new Lt(t).lex(e)}static lexInline(e,t){return new Lt(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){let i,s,o,r;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,i)=>t+" ".repeat(i.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>!!(i=s.call({lexer:this},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)))))if(i=this.tokenizer.space(e))e=e.substring(i.raw.length),1===i.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(i);else if(i=this.tokenizer.code(e))e=e.substring(i.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?t.push(i):(s.raw+="\n"+i.raw,s.text+="\n"+i.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(i=this.tokenizer.fences(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.heading(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.hr(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.blockquote(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.list(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.html(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.def(e))e=e.substring(i.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}):(s.raw+="\n"+i.raw,s.text+="\n"+i.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(i=this.tokenizer.table(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.lheading(e))e=e.substring(i.raw.length),t.push(i);else{if(o=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const i=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},i),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(o)))s=t[t.length-1],r&&"paragraph"===s.type?(s.raw+="\n"+i.raw,s.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(i),r=o.length!==e.length,e=e.substring(i.raw.length);else if(i=this.tokenizer.text(e))e=e.substring(i.raw.length),s=t[t.length-1],s&&"text"===s.type?(s.raw+="\n"+i.raw,s.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(i);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let i,s,o,r,n,a,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,r.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(n||(a=""),n=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>!!(i=s.call({lexer:this},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)))))if(i=this.tokenizer.escape(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.tag(e))e=e.substring(i.raw.length),s=t[t.length-1],s&&"text"===i.type&&"text"===s.type?(s.raw+=i.raw,s.text+=i.text):t.push(i);else if(i=this.tokenizer.link(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(i.raw.length),s=t[t.length-1],s&&"text"===i.type&&"text"===s.type?(s.raw+=i.raw,s.text+=i.text):t.push(i);else if(i=this.tokenizer.emStrong(e,l,a))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.codespan(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.br(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.del(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.autolink(e))e=e.substring(i.raw.length),t.push(i);else if(this.state.inLink||!(i=this.tokenizer.url(e))){if(o=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const i=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},i),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(i=this.tokenizer.inlineText(o))e=e.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(a=i.raw.slice(-1)),n=!0,s=t[t.length-1],s&&"text"===s.type?(s.raw+=i.raw,s.text+=i.text):t.push(i);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(i.raw.length),t.push(i);return t}}class qt{options;constructor(e){this.options=e||Pe}code(e,t,i){const s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",s?'<pre><code class="language-'+Ne(s)+'">'+(i?e:Ne(e,!0))+"</code></pre>\n":"<pre><code>"+(i?e:Ne(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,i){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,i){const s=t?"ol":"ul";return"<"+s+(t&&1!==i?' start="'+i+'"':"")+">\n"+e+"</"+s+">\n"}listitem(e,t,i){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const i=t.header?"th":"td";return(t.align?`<${i} align="${t.align}">`:`<${i}>`)+e+`</${i}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,i){const s=Xe(e);if(null===s)return i;let o='<a href="'+(e=s)+'"';return t&&(o+=' title="'+t+'"'),o+=">"+i+"</a>",o}image(e,t,i){const s=Xe(e);if(null===s)return i;let o=`<img src="${e=s}" alt="${i}"`;return t&&(o+=` title="${t}"`),o+=">",o}text(e){return e}}class Vt{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,i){return""+i}image(e,t,i){return""+i}br(){return""}}class Ft{options;renderer;textRenderer;constructor(e){this.options=e||Pe,this.options.renderer=this.options.renderer||new qt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Vt}static parse(e,t){return new Ft(t).parse(e)}static parseInline(e,t){return new Ft(t).parseInline(e)}parse(e,t=!0){let i="";for(let s=0;s<e.length;s++){const o=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const e=o,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){i+=t||"";continue}}switch(o.type){case"space":continue;case"hr":i+=this.renderer.hr();continue;case"heading":{const e=o;i+=this.renderer.heading(this.parseInline(e.tokens),e.depth,We(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=o;i+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=o;let t="",s="";for(let t=0;t<e.header.length;t++)s+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(s);let r="";for(let t=0;t<e.rows.length;t++){const i=e.rows[t];s="";for(let t=0;t<i.length;t++)s+=this.renderer.tablecell(this.parseInline(i[t].tokens),{header:!1,align:e.align[t]});r+=this.renderer.tablerow(s)}i+=this.renderer.table(t,r);continue}case"blockquote":{const e=o,t=this.parse(e.tokens);i+=this.renderer.blockquote(t);continue}case"list":{const e=o,t=e.ordered,s=e.start,r=e.loose;let n="";for(let t=0;t<e.items.length;t++){const i=e.items[t],s=i.checked,o=i.task;let a="";if(i.task){const e=this.renderer.checkbox(!!s);r?i.tokens.length>0&&"paragraph"===i.tokens[0].type?(i.tokens[0].text=e+" "+i.tokens[0].text,i.tokens[0].tokens&&i.tokens[0].tokens.length>0&&"text"===i.tokens[0].tokens[0].type&&(i.tokens[0].tokens[0].text=e+" "+i.tokens[0].tokens[0].text)):i.tokens.unshift({type:"text",text:e+" "}):a+=e+" "}a+=this.parse(i.tokens,r),n+=this.renderer.listitem(a,o,!!s)}i+=this.renderer.list(n,t,s);continue}case"html":{const e=o;i+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=o;i+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=o,n=r.tokens?this.parseInline(r.tokens):r.text;for(;s+1<e.length&&"text"===e[s+1].type;)r=e[++s],n+="\n"+(r.tokens?this.parseInline(r.tokens):r.text);i+=t?this.renderer.paragraph(n):n;continue}default:{const e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return i}parseInline(e,t){t=t||this.renderer;let i="";for(let s=0;s<e.length;s++){const o=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const e=this.options.extensions.renderers[o.type].call({parser:this},o);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=e||"";continue}}switch(o.type){case"escape":{const e=o;i+=t.text(e.text);break}case"html":{const e=o;i+=t.html(e.text);break}case"link":{const e=o;i+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=o;i+=t.image(e.href,e.title,e.text);break}case"strong":{const e=o;i+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=o;i+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=o;i+=t.codespan(e.text);break}case"br":i+=t.br();break;case"del":{const e=o;i+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=o;i+=t.text(e.text);break}default:{const e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return i}}class Bt{options;constructor(e){this.options=e||Pe}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const jt=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#e(Lt.lex,Ft.parse);parseInline=this.#e(Lt.lexInline,Ft.parseInline);Parser=Ft;Renderer=qt;TextRenderer=Vt;Lexer=Lt;Tokenizer=et;Hooks=Bt;constructor(...e){this.use(...e)}walkTokens(e,t){let i=[];for(const s of e)switch(i=i.concat(t.call(this,s)),s.type){case"table":{const e=s;for(const s of e.header)i=i.concat(this.walkTokens(s.tokens,t));for(const s of e.rows)for(const e of s)i=i.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=s;i=i.concat(this.walkTokens(e.items,t));break}default:{const e=s;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((s=>{const o=e[s].flat(1/0);i=i.concat(this.walkTokens(o,t))})):e.tokens&&(i=i.concat(this.walkTokens(e.tokens,t)))}}return i}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const i={...e};if(i.async=this.defaults.async||i.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const i=t.renderers[e.name];t.renderers[e.name]=i?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=i.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const i=t[e.level];i?i.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),i.extensions=t),e.renderer){const t=this.defaults.renderer||new qt(this.defaults);for(const i in e.renderer){if(!(i in t))throw new Error(`renderer '${i}' does not exist`);if("options"===i)continue;const s=i,o=e.renderer[s],r=t[s];t[s]=(...e)=>{let i=o.apply(t,e);return!1===i&&(i=r.apply(t,e)),i||""}}i.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new et(this.defaults);for(const i in e.tokenizer){if(!(i in t))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const s=i,o=e.tokenizer[s],r=t[s];t[s]=(...e)=>{let i=o.apply(t,e);return!1===i&&(i=r.apply(t,e)),i}}i.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new Bt;for(const i in e.hooks){if(!(i in t))throw new Error(`hook '${i}' does not exist`);if("options"===i)continue;const s=i,o=e.hooks[s],r=t[s];Bt.passThroughHooks.has(i)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(o.call(t,e)).then((e=>r.call(t,e)));const i=o.call(t,e);return r.call(t,i)}:t[s]=(...e)=>{let i=o.apply(t,e);return!1===i&&(i=r.apply(t,e)),i}}i.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;i.walkTokens=function(e){let i=[];return i.push(s.call(this,e)),t&&(i=i.concat(t.call(this,e))),i}}this.defaults={...this.defaults,...i}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Lt.lex(e,t??this.defaults)}parser(e,t){return Ft.parse(e,t??this.defaults)}#e(e,t){return(i,s)=>{const o={...s},r={...this.defaults,...o};!0===this.defaults.async&&!1===o.async&&(r.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),r.async=!0);const n=this.#t(!!r.silent,!!r.async);if(null==i)return n(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof i)return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(i):i).then((t=>e(t,r))).then((e=>r.hooks?r.hooks.processAllTokens(e):e)).then((e=>r.walkTokens?Promise.all(this.walkTokens(e,r.walkTokens)).then((()=>e)):e)).then((e=>t(e,r))).then((e=>r.hooks?r.hooks.postprocess(e):e)).catch(n);try{r.hooks&&(i=r.hooks.preprocess(i));let s=e(i,r);r.hooks&&(s=r.hooks.processAllTokens(s)),r.walkTokens&&this.walkTokens(s,r.walkTokens);let o=t(s,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(e){return n(e)}}}#t(e,t){return i=>{if(i.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+Ne(i.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(i);throw i}}};function Ht(e,t){return jt.parse(e,t)}Ht.options=Ht.setOptions=function(e){return jt.setOptions(e),Ht.defaults=jt.defaults,Le(Ht.defaults),Ht},Ht.getDefaults=Me,Ht.defaults=Pe,Ht.use=function(...e){return jt.use(...e),Ht.defaults=jt.defaults,Le(Ht.defaults),Ht},Ht.walkTokens=function(e,t){return jt.walkTokens(e,t)},Ht.parseInline=jt.parseInline,Ht.Parser=Ft,Ht.parser=Ft.parse,Ht.Renderer=qt,Ht.TextRenderer=Vt,Ht.Lexer=Lt,Ht.lexer=Lt.lex,Ht.Tokenizer=et,Ht.Hooks=Bt,Ht.parse=Ht,Ht.options,Ht.setOptions,Ht.use,Ht.walkTokens,Ht.parseInline,Ft.parse,Lt.lex;const Nt=n`
|
|
70
|
+
*/function Me(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Pe={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Le(e){Pe=e}const qe=/[&<>"']/,Ve=new RegExp(qe.source,"g"),Fe=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Be=new RegExp(Fe.source,"g"),je={"&":"&","<":"<",">":">",'"':""","'":"'"},Ne=e=>je[e];function He(e,t){if(t){if(qe.test(e))return e.replace(Ve,Ne)}else if(Fe.test(e))return e.replace(Be,Ne);return e}const Ue=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function We(e){return e.replace(Ue,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Ke=/(^|[^\[])\^/g;function Ye(e,t){let i="string"==typeof e?e:e.source;t=t||"";const s={replace:(e,t)=>{let o="string"==typeof t?t:t.source;return o=o.replace(Ke,"$1"),i=i.replace(e,o),s},getRegex:()=>new RegExp(i,t)};return s}function Xe(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const Ze={exec:()=>null};function Qe(e,t){const i=e.replace(/\|/g,((e,t,i)=>{let s=!1,o=t;for(;--o>=0&&"\\"===i[o];)s=!s;return s?"|":" |"})).split(/ \|/);let s=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;s<i.length;s++)i[s]=i[s].trim().replace(/\\\|/g,"|");return i}function Je(e,t,i){const s=e.length;if(0===s)return"";let o=0;for(;o<s;){if(e.charAt(s-o-1)!==t)break;o++}return e.slice(0,s-o)}function Ge(e,t,i,s){const o=t.href,r=t.title?He(t.title):null,n=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){s.state.inLink=!0;const e={type:"link",raw:i,href:o,title:r,text:n,tokens:s.inlineTokens(n)};return s.state.inLink=!1,e}return{type:"image",raw:i,href:o,title:r,text:He(n)}}class et{options;rules;lexer;constructor(e){this.options=e||Pe}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Je(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],i=function(e,t){const i=e.match(/^(\s+)(?:```)/);if(null===i)return t;const s=i[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[i]=t;return i.length>=s.length?e.slice(s.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=Je(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1");e=Je(e.replace(/^ *>[ \t]?/gm,""),"\n");const i=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(e);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:s,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=t[1].trim();const s=i.length>1,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");const r=new RegExp(`^( {0,3}${i})((?:[\t ][^\\n]*)?(?:\\n|$))`);let n="",a="",l=!1;for(;e;){let i=!1;if(!(t=r.exec(e)))break;if(this.rules.block.hr.test(e))break;n=t[0],e=e.substring(n.length);let s=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),d=e.split("\n",1)[0],h=0;this.options.pedantic?(h=2,a=s.trimStart()):(h=t[2].search(/[^ ]/),h=h>4?1:h,a=s.slice(h),h+=t[1].length);let c=!1;if(!s&&/^ *$/.test(d)&&(n+=d+"\n",e=e.substring(d.length+1),i=!0),!i){const t=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),i=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),o=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),r=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(d=l,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),o.test(d))break;if(r.test(d))break;if(t.test(d))break;if(i.test(e))break;if(d.search(/[^ ]/)>=h||!d.trim())a+="\n"+d.slice(h);else{if(c)break;if(s.search(/[^ ]/)>=4)break;if(o.test(s))break;if(r.test(s))break;if(i.test(s))break;a+="\n"+d}c||d.trim()||(c=!0),n+=l+"\n",e=e.substring(l.length+1),s=d.slice(h)}}o.loose||(l?o.loose=!0:/\n *\n *$/.test(n)&&(l=!0));let p,u=null;this.options.gfm&&(u=/^\[[ xX]\] /.exec(a),u&&(p="[ ] "!==u[0],a=a.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:n,task:!!u,checked:p,loose:!1,text:a,tokens:[]}),o.raw+=n}o.items[o.items.length-1].raw=n.trimEnd(),o.items[o.items.length-1].text=a.trimEnd(),o.raw=o.raw.trimEnd();for(let e=0;e<o.items.length;e++)if(this.lexer.state.top=!1,o.items[e].tokens=this.lexer.blockTokens(o.items[e].text,[]),!o.loose){const t=o.items[e].tokens.filter((e=>"space"===e.type)),i=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));o.loose=i}if(o.loose)for(let e=0;e<o.items.length;e++)o.items[e].loose=!0;return o}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:i,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const i=Qe(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),o=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(i.length===s.length){for(const e of s)/^ *-+: *$/.test(e)?r.align.push("right"):/^ *:-+: *$/.test(e)?r.align.push("center"):/^ *:-+ *$/.test(e)?r.align.push("left"):r.align.push(null);for(const e of i)r.header.push({text:e,tokens:this.lexer.inline(e)});for(const e of o)r.rows.push(Qe(e,r.header.length).map((e=>({text:e,tokens:this.lexer.inline(e)}))));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:He(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=Je(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let i=0;for(let s=0;s<e.length;s++)if("\\"===e[s])s++;else if(e[s]===t[0])i++;else if(e[s]===t[1]&&(i--,i<0))return s;return-1}(t[2],"()");if(e>-1){const i=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,i).trim(),t[3]=""}}let i=t[2],s="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);e&&(i=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(i=this.options.pedantic&&!/>$/.test(e)?i.slice(1):i.slice(1,-1)),Ge(t,{href:i?i.replace(this.rules.inline.anyPunctuation,"$1"):i,title:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s},t[0],this.lexer)}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){const e=t[(i[2]||i[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=i[0].charAt(0);return{type:"text",raw:e,text:e}}return Ge(i,e,i[0],this.lexer)}}emStrong(e,t,i=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s)return;if(s[3]&&i.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!i||this.rules.inline.punctuation.exec(i)){const i=[...s[0]].length-1;let o,r,n=i,a=0;const l="*"===s[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+i);null!=(s=l.exec(t));){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(r=[...o].length,s[3]||s[4]){n+=r;continue}if((s[5]||s[6])&&i%3&&!((i+r)%3)){a+=r;continue}if(n-=r,n>0)continue;r=Math.min(r,r+n+a);const t=[...s[0]][0].length,l=e.slice(0,i+s.index+t+r);if(Math.min(i,r)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const d=l.slice(2,-2);return{type:"strong",raw:l,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const i=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return i&&s&&(e=e.substring(1,e.length-1)),e=He(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,i;return"@"===t[2]?(e=He(t[1]),i="mailto:"+e):(e=He(t[1]),i=e),{type:"link",raw:t[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,i;if("@"===t[2])e=He(t[0]),i="mailto:"+e;else{let s;do{s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(s!==t[0]);e=He(t[0]),i="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:He(t[0]),{type:"text",raw:t[0],text:e}}}}const tt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,it=/(?:[*+-]|\d{1,9}[.)])/,st=Ye(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,it).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),ot=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rt=/(?!\s*\])(?:\\.|[^\[\]\\])+/,nt=Ye(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",rt).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),at=Ye(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,it).getRegex(),lt="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",dt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ht=Ye("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",dt).replace("tag",lt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ct=Ye(ot).replace("hr",tt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",lt).getRegex(),pt={blockquote:Ye(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ct).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:nt,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:tt,html:ht,lheading:st,list:at,newline:/^(?: *(?:\n|$))+/,paragraph:ct,table:Ze,text:/^[^\n]+/},ut=Ye("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",tt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",lt).getRegex(),gt={...pt,table:ut,paragraph:Ye(ot).replace("hr",tt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ut).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",lt).getRegex()},ft={...pt,html:Ye("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",dt).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ze,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ye(ot).replace("hr",tt).replace("heading"," *#{1,6} *[^\n]").replace("lheading",st).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},bt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,mt=/^( {2,}|\\)\n(?!\s*$)/,_t="\\p{P}\\p{S}",vt=Ye(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,_t).getRegex(),yt=Ye(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,_t).getRegex(),kt=Ye("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,_t).getRegex(),xt=Ye("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,_t).getRegex(),wt=Ye(/\\([punct])/,"gu").replace(/punct/g,_t).getRegex(),$t=Ye(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),St=Ye(dt).replace("(?:--\x3e|$)","--\x3e").getRegex(),Ct=Ye("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",St).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Et=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,zt=Ye(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Et).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Dt=Ye(/^!?\[(label)\]\[(ref)\]/).replace("label",Et).replace("ref",rt).getRegex(),Tt=Ye(/^!?\[(ref)\](?:\[\])?/).replace("ref",rt).getRegex(),Ot={_backpedal:Ze,anyPunctuation:wt,autolink:$t,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:mt,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Ze,emStrongLDelim:yt,emStrongRDelimAst:kt,emStrongRDelimUnd:xt,escape:bt,link:zt,nolink:Tt,punctuation:vt,reflink:Dt,reflinkSearch:Ye("reflink|nolink(?!\\()","g").replace("reflink",Dt).replace("nolink",Tt).getRegex(),tag:Ct,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Ze},At={...Ot,link:Ye(/^!?\[(label)\]\((.*?)\)/).replace("label",Et).getRegex(),reflink:Ye(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Et).getRegex()},It={...Ot,escape:Ye(bt).replace("])","~|])").getRegex(),url:Ye(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Rt={...It,br:Ye(mt).replace("{2,}","*").getRegex(),text:Ye(It.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Mt={normal:pt,gfm:gt,pedantic:ft},Pt={normal:Ot,gfm:It,breaks:Rt,pedantic:At};class Lt{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Pe,this.options.tokenizer=this.options.tokenizer||new et,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Mt.normal,inline:Pt.normal};this.options.pedantic?(t.block=Mt.pedantic,t.inline=Pt.pedantic):this.options.gfm&&(t.block=Mt.gfm,this.options.breaks?t.inline=Pt.breaks:t.inline=Pt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Mt,inline:Pt}}static lex(e,t){return new Lt(t).lex(e)}static lexInline(e,t){return new Lt(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){let i,s,o,r;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,i)=>t+" ".repeat(i.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>!!(i=s.call({lexer:this},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)))))if(i=this.tokenizer.space(e))e=e.substring(i.raw.length),1===i.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(i);else if(i=this.tokenizer.code(e))e=e.substring(i.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?t.push(i):(s.raw+="\n"+i.raw,s.text+="\n"+i.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(i=this.tokenizer.fences(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.heading(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.hr(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.blockquote(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.list(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.html(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.def(e))e=e.substring(i.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}):(s.raw+="\n"+i.raw,s.text+="\n"+i.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(i=this.tokenizer.table(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.lheading(e))e=e.substring(i.raw.length),t.push(i);else{if(o=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const i=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},i),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(o)))s=t[t.length-1],r&&"paragraph"===s.type?(s.raw+="\n"+i.raw,s.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(i),r=o.length!==e.length,e=e.substring(i.raw.length);else if(i=this.tokenizer.text(e))e=e.substring(i.raw.length),s=t[t.length-1],s&&"text"===s.type?(s.raw+="\n"+i.raw,s.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(i);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let i,s,o,r,n,a,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,r.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(n||(a=""),n=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>!!(i=s.call({lexer:this},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)))))if(i=this.tokenizer.escape(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.tag(e))e=e.substring(i.raw.length),s=t[t.length-1],s&&"text"===i.type&&"text"===s.type?(s.raw+=i.raw,s.text+=i.text):t.push(i);else if(i=this.tokenizer.link(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(i.raw.length),s=t[t.length-1],s&&"text"===i.type&&"text"===s.type?(s.raw+=i.raw,s.text+=i.text):t.push(i);else if(i=this.tokenizer.emStrong(e,l,a))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.codespan(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.br(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.del(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.autolink(e))e=e.substring(i.raw.length),t.push(i);else if(this.state.inLink||!(i=this.tokenizer.url(e))){if(o=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const i=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},i),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(i=this.tokenizer.inlineText(o))e=e.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(a=i.raw.slice(-1)),n=!0,s=t[t.length-1],s&&"text"===s.type?(s.raw+=i.raw,s.text+=i.text):t.push(i);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(i.raw.length),t.push(i);return t}}class qt{options;constructor(e){this.options=e||Pe}code(e,t,i){const s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",s?'<pre><code class="language-'+He(s)+'">'+(i?e:He(e,!0))+"</code></pre>\n":"<pre><code>"+(i?e:He(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,i){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,i){const s=t?"ol":"ul";return"<"+s+(t&&1!==i?' start="'+i+'"':"")+">\n"+e+"</"+s+">\n"}listitem(e,t,i){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const i=t.header?"th":"td";return(t.align?`<${i} align="${t.align}">`:`<${i}>`)+e+`</${i}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,i){const s=Xe(e);if(null===s)return i;let o='<a href="'+(e=s)+'"';return t&&(o+=' title="'+t+'"'),o+=">"+i+"</a>",o}image(e,t,i){const s=Xe(e);if(null===s)return i;let o=`<img src="${e=s}" alt="${i}"`;return t&&(o+=` title="${t}"`),o+=">",o}text(e){return e}}class Vt{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,i){return""+i}image(e,t,i){return""+i}br(){return""}}class Ft{options;renderer;textRenderer;constructor(e){this.options=e||Pe,this.options.renderer=this.options.renderer||new qt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Vt}static parse(e,t){return new Ft(t).parse(e)}static parseInline(e,t){return new Ft(t).parseInline(e)}parse(e,t=!0){let i="";for(let s=0;s<e.length;s++){const o=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const e=o,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){i+=t||"";continue}}switch(o.type){case"space":continue;case"hr":i+=this.renderer.hr();continue;case"heading":{const e=o;i+=this.renderer.heading(this.parseInline(e.tokens),e.depth,We(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=o;i+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=o;let t="",s="";for(let t=0;t<e.header.length;t++)s+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(s);let r="";for(let t=0;t<e.rows.length;t++){const i=e.rows[t];s="";for(let t=0;t<i.length;t++)s+=this.renderer.tablecell(this.parseInline(i[t].tokens),{header:!1,align:e.align[t]});r+=this.renderer.tablerow(s)}i+=this.renderer.table(t,r);continue}case"blockquote":{const e=o,t=this.parse(e.tokens);i+=this.renderer.blockquote(t);continue}case"list":{const e=o,t=e.ordered,s=e.start,r=e.loose;let n="";for(let t=0;t<e.items.length;t++){const i=e.items[t],s=i.checked,o=i.task;let a="";if(i.task){const e=this.renderer.checkbox(!!s);r?i.tokens.length>0&&"paragraph"===i.tokens[0].type?(i.tokens[0].text=e+" "+i.tokens[0].text,i.tokens[0].tokens&&i.tokens[0].tokens.length>0&&"text"===i.tokens[0].tokens[0].type&&(i.tokens[0].tokens[0].text=e+" "+i.tokens[0].tokens[0].text)):i.tokens.unshift({type:"text",text:e+" "}):a+=e+" "}a+=this.parse(i.tokens,r),n+=this.renderer.listitem(a,o,!!s)}i+=this.renderer.list(n,t,s);continue}case"html":{const e=o;i+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=o;i+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=o,n=r.tokens?this.parseInline(r.tokens):r.text;for(;s+1<e.length&&"text"===e[s+1].type;)r=e[++s],n+="\n"+(r.tokens?this.parseInline(r.tokens):r.text);i+=t?this.renderer.paragraph(n):n;continue}default:{const e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return i}parseInline(e,t){t=t||this.renderer;let i="";for(let s=0;s<e.length;s++){const o=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const e=this.options.extensions.renderers[o.type].call({parser:this},o);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=e||"";continue}}switch(o.type){case"escape":{const e=o;i+=t.text(e.text);break}case"html":{const e=o;i+=t.html(e.text);break}case"link":{const e=o;i+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=o;i+=t.image(e.href,e.title,e.text);break}case"strong":{const e=o;i+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=o;i+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=o;i+=t.codespan(e.text);break}case"br":i+=t.br();break;case"del":{const e=o;i+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=o;i+=t.text(e.text);break}default:{const e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return i}}class Bt{options;constructor(e){this.options=e||Pe}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const jt=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#e(Lt.lex,Ft.parse);parseInline=this.#e(Lt.lexInline,Ft.parseInline);Parser=Ft;Renderer=qt;TextRenderer=Vt;Lexer=Lt;Tokenizer=et;Hooks=Bt;constructor(...e){this.use(...e)}walkTokens(e,t){let i=[];for(const s of e)switch(i=i.concat(t.call(this,s)),s.type){case"table":{const e=s;for(const s of e.header)i=i.concat(this.walkTokens(s.tokens,t));for(const s of e.rows)for(const e of s)i=i.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=s;i=i.concat(this.walkTokens(e.items,t));break}default:{const e=s;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((s=>{const o=e[s].flat(1/0);i=i.concat(this.walkTokens(o,t))})):e.tokens&&(i=i.concat(this.walkTokens(e.tokens,t)))}}return i}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const i={...e};if(i.async=this.defaults.async||i.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const i=t.renderers[e.name];t.renderers[e.name]=i?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=i.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const i=t[e.level];i?i.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),i.extensions=t),e.renderer){const t=this.defaults.renderer||new qt(this.defaults);for(const i in e.renderer){if(!(i in t))throw new Error(`renderer '${i}' does not exist`);if("options"===i)continue;const s=i,o=e.renderer[s],r=t[s];t[s]=(...e)=>{let i=o.apply(t,e);return!1===i&&(i=r.apply(t,e)),i||""}}i.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new et(this.defaults);for(const i in e.tokenizer){if(!(i in t))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const s=i,o=e.tokenizer[s],r=t[s];t[s]=(...e)=>{let i=o.apply(t,e);return!1===i&&(i=r.apply(t,e)),i}}i.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new Bt;for(const i in e.hooks){if(!(i in t))throw new Error(`hook '${i}' does not exist`);if("options"===i)continue;const s=i,o=e.hooks[s],r=t[s];Bt.passThroughHooks.has(i)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(o.call(t,e)).then((e=>r.call(t,e)));const i=o.call(t,e);return r.call(t,i)}:t[s]=(...e)=>{let i=o.apply(t,e);return!1===i&&(i=r.apply(t,e)),i}}i.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;i.walkTokens=function(e){let i=[];return i.push(s.call(this,e)),t&&(i=i.concat(t.call(this,e))),i}}this.defaults={...this.defaults,...i}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Lt.lex(e,t??this.defaults)}parser(e,t){return Ft.parse(e,t??this.defaults)}#e(e,t){return(i,s)=>{const o={...s},r={...this.defaults,...o};!0===this.defaults.async&&!1===o.async&&(r.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),r.async=!0);const n=this.#t(!!r.silent,!!r.async);if(null==i)return n(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof i)return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(i):i).then((t=>e(t,r))).then((e=>r.hooks?r.hooks.processAllTokens(e):e)).then((e=>r.walkTokens?Promise.all(this.walkTokens(e,r.walkTokens)).then((()=>e)):e)).then((e=>t(e,r))).then((e=>r.hooks?r.hooks.postprocess(e):e)).catch(n);try{r.hooks&&(i=r.hooks.preprocess(i));let s=e(i,r);r.hooks&&(s=r.hooks.processAllTokens(s)),r.walkTokens&&this.walkTokens(s,r.walkTokens);let o=t(s,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(e){return n(e)}}}#t(e,t){return i=>{if(i.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+He(i.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(i);throw i}}};function Nt(e,t){return jt.parse(e,t)}Nt.options=Nt.setOptions=function(e){return jt.setOptions(e),Nt.defaults=jt.defaults,Le(Nt.defaults),Nt},Nt.getDefaults=Me,Nt.defaults=Pe,Nt.use=function(...e){return jt.use(...e),Nt.defaults=jt.defaults,Le(Nt.defaults),Nt},Nt.walkTokens=function(e,t){return jt.walkTokens(e,t)},Nt.parseInline=jt.parseInline,Nt.Parser=Ft,Nt.parser=Ft.parse,Nt.Renderer=qt,Nt.TextRenderer=Vt,Nt.Lexer=Lt,Nt.lexer=Lt.lex,Nt.Tokenizer=et,Nt.Hooks=Bt,Nt.parse=Nt,Nt.options,Nt.setOptions,Nt.use,Nt.walkTokens,Nt.parseInline,Ft.parse,Lt.lex;const Ht=n`
|
|
71
71
|
:host,
|
|
72
72
|
*,
|
|
73
73
|
*::before,
|
|
@@ -223,7 +223,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
223
223
|
>
|
|
224
224
|
${e[this.type]}
|
|
225
225
|
<div class="content">
|
|
226
|
-
${this.label||this.title?j`<h4 class="header">${this.label||this.title}</h4>`:
|
|
226
|
+
${this.label||this.title?j`<h4 class="header">${this.label||this.title}</h4>`:H}
|
|
227
227
|
<div class="message">
|
|
228
228
|
<slot></slot>
|
|
229
229
|
</div>
|
|
@@ -248,7 +248,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
248
248
|
/>
|
|
249
249
|
</svg>
|
|
250
250
|
</button>
|
|
251
|
-
`:
|
|
251
|
+
`:H}
|
|
252
252
|
</div>
|
|
253
253
|
`}}Yt.styles=n`
|
|
254
254
|
:host {
|
|
@@ -370,7 +370,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
370
370
|
<a
|
|
371
371
|
class="dropdown-item"
|
|
372
372
|
href=${e.href}
|
|
373
|
-
target=${e.hrefTarget||
|
|
373
|
+
target=${e.hrefTarget||H}
|
|
374
374
|
@click=${this._handleOptionLinkClick}
|
|
375
375
|
>${e.label}</a>
|
|
376
376
|
`:j`
|
|
@@ -386,7 +386,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
386
386
|
</span>
|
|
387
387
|
${"idle"!==this._state?j`<span class="state-overlay">
|
|
388
388
|
${"loading"===this._state?j`<span class="spinner"></span>`:this._stateText}
|
|
389
|
-
</span>`:
|
|
389
|
+
</span>`:H}
|
|
390
390
|
</div>
|
|
391
391
|
<div class="split-divider"></div>
|
|
392
392
|
<div class="split-trigger" @click=${this._handleSplitTriggerClick}>
|
|
@@ -420,22 +420,22 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
420
420
|
>
|
|
421
421
|
<path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/>
|
|
422
422
|
</svg>
|
|
423
|
-
`:
|
|
423
|
+
`:H}
|
|
424
424
|
${"idle"!==this._state?j`
|
|
425
425
|
<span class="state-overlay">
|
|
426
426
|
${"loading"===this._state?j`<span class="spinner"></span>`:this._stateText}
|
|
427
427
|
</span>
|
|
428
|
-
`:
|
|
428
|
+
`:H}
|
|
429
429
|
${this.options.length?j`
|
|
430
430
|
<div class=${ye({dropdown:!0,"dropdown--opened":this._dropdownOpened})}>
|
|
431
431
|
${this.options.map((e=>this._renderDropdownItem(e)))}
|
|
432
432
|
</div>
|
|
433
|
-
`:
|
|
433
|
+
`:H}
|
|
434
434
|
`;return this.href?j`
|
|
435
435
|
<a
|
|
436
436
|
class="link"
|
|
437
437
|
href=${this.href}
|
|
438
|
-
target=${this.target||
|
|
438
|
+
target=${this.target||H}
|
|
439
439
|
>${e}</a>
|
|
440
440
|
`:e}}Zt.styles=n`
|
|
441
441
|
:host {
|
|
@@ -925,7 +925,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
925
925
|
<pre class="code"><code>${Se(this.highlightedCode)}</code></pre>
|
|
926
926
|
</div>
|
|
927
927
|
|
|
928
|
-
`}}Jt.styles=[
|
|
928
|
+
`}}Jt.styles=[Ht,n`
|
|
929
929
|
:host {
|
|
930
930
|
display: block;
|
|
931
931
|
border: 1px solid #d5dbdb;
|
|
@@ -1320,7 +1320,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
1320
1320
|
Apply
|
|
1321
1321
|
</krs-button>
|
|
1322
1322
|
</div>
|
|
1323
|
-
`:"relative"===this.mode?
|
|
1323
|
+
`:"relative"===this.mode?H:"absolute"===this._activeTab?j`
|
|
1324
1324
|
<div class="footer">
|
|
1325
1325
|
<krs-button
|
|
1326
1326
|
variant="outline"
|
|
@@ -1338,7 +1338,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
1338
1338
|
Apply
|
|
1339
1339
|
</krs-button>
|
|
1340
1340
|
</div>
|
|
1341
|
-
`:
|
|
1341
|
+
`:H}_handleStartDateChange(e){this._tempStartDate=e.target.value}_handleEndDateChange(e){this._tempEndDate=e.target.value}render(){return j`
|
|
1342
1342
|
<button
|
|
1343
1343
|
part="trigger"
|
|
1344
1344
|
class=${ye({trigger:!0,"trigger--invalid":this.invalid})}
|
|
@@ -1378,7 +1378,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
1378
1378
|
</button>
|
|
1379
1379
|
|
|
1380
1380
|
<div part="dropdown" class=${ye({dropdown:!0,"dropdown--open":this._isOpen})}>
|
|
1381
|
-
${this.mode?
|
|
1381
|
+
${this.mode?H:j`
|
|
1382
1382
|
<div class="tabs">
|
|
1383
1383
|
<button
|
|
1384
1384
|
class=${ye({tab:!0,"tab--active":"relative"===this._activeTab})}
|
|
@@ -1832,7 +1832,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
1832
1832
|
outline: 2px solid #3b82f6;
|
|
1833
1833
|
outline-offset: 2px;
|
|
1834
1834
|
}
|
|
1835
|
-
`,hi.activeSnackbars=[],di([ce({type:String})],hi.prototype,"type",void 0),di([ce({type:String})],hi.prototype,"title",void 0),di([ce({type:String})],hi.prototype,"message",void 0),di([ce({type:Number})],hi.prototype,"duration",void 0),di([ce({attribute:!1})],hi.prototype,"action",void 0),customElements.get("krs-snackbar")||customElements.define("krs-snackbar",hi);var ci=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class pi extends ae{constructor(){super(...arguments),this.justified=!1,this.size="medium"}updated(e){e.has("activeTabId")&&this._updateActiveTab()}firstUpdated(){this._updateActiveTab()}_getTabs(){return Array.from(this.querySelectorAll("krs-tab"))}_updateActiveTab(){const e=this._getTabs();0!==e.length&&(this.activeTabId||(this.activeTabId=e[0]?.id),e.forEach((e=>{e.active=e.id===this.activeTabId})),this.requestUpdate())}_handleTabClick(e){e.disabled||(this.activeTabId=e.id,this.dispatchEvent(new CustomEvent("tab-change",{detail:{activeTabId:e.id},bubbles:!0,composed:!0})))}_handleTabDismiss(e,t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("tab-dismiss",{detail:{tabId:e.id},bubbles:!0,composed:!0}))}_handleKeyDown(e){const t=this._getTabs().filter((e=>!e.disabled)),i=t.findIndex((e=>e.id===this.activeTabId));let s=-1;switch(e.key){case"ArrowLeft":s=i>0?i-1:t.length-1;break;case"ArrowRight":s=i<t.length-1?i+1:0;break;case"Home":s=0;break;case"End":s=t.length-1}if(s>=0){e.preventDefault();const i=t[s];this.activeTabId=i.id,this.dispatchEvent(new CustomEvent("tab-change",{detail:{activeTabId:i.id},bubbles:!0,composed:!0}));const o=this.shadowRoot?.querySelectorAll(".label"),r=Array.from(o||[]).find((e=>e.getAttribute("data-tab-id")===i.id));r?.focus()}}_renderTabIcon(e){const t=e.getIconElement();if(!t)return
|
|
1835
|
+
`,hi.activeSnackbars=[],di([ce({type:String})],hi.prototype,"type",void 0),di([ce({type:String})],hi.prototype,"title",void 0),di([ce({type:String})],hi.prototype,"message",void 0),di([ce({type:Number})],hi.prototype,"duration",void 0),di([ce({attribute:!1})],hi.prototype,"action",void 0),customElements.get("krs-snackbar")||customElements.define("krs-snackbar",hi);var ci=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class pi extends ae{constructor(){super(...arguments),this.justified=!1,this.size="medium"}updated(e){e.has("activeTabId")&&this._updateActiveTab()}firstUpdated(){this._updateActiveTab()}_getTabs(){return Array.from(this.querySelectorAll("krs-tab"))}_updateActiveTab(){const e=this._getTabs();0!==e.length&&(this.activeTabId||(this.activeTabId=e[0]?.id),e.forEach((e=>{e.active=e.id===this.activeTabId})),this.requestUpdate())}_handleTabClick(e){e.disabled||(this.activeTabId=e.id,this.dispatchEvent(new CustomEvent("tab-change",{detail:{activeTabId:e.id},bubbles:!0,composed:!0})))}_handleTabDismiss(e,t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("tab-dismiss",{detail:{tabId:e.id},bubbles:!0,composed:!0}))}_handleKeyDown(e){const t=this._getTabs().filter((e=>!e.disabled)),i=t.findIndex((e=>e.id===this.activeTabId));let s=-1;switch(e.key){case"ArrowLeft":s=i>0?i-1:t.length-1;break;case"ArrowRight":s=i<t.length-1?i+1:0;break;case"Home":s=0;break;case"End":s=t.length-1}if(s>=0){e.preventDefault();const i=t[s];this.activeTabId=i.id,this.dispatchEvent(new CustomEvent("tab-change",{detail:{activeTabId:i.id},bubbles:!0,composed:!0}));const o=this.shadowRoot?.querySelectorAll(".label"),r=Array.from(o||[]).find((e=>e.getAttribute("data-tab-id")===i.id));r?.focus()}}_renderTabIcon(e){const t=e.getIconElement();if(!t)return H;const i=t.cloneNode(!0);return i.removeAttribute("slot"),j`<span class="label-icon">${i}</span>`}render(){return j`
|
|
1836
1836
|
<div
|
|
1837
1837
|
class="header"
|
|
1838
1838
|
role="tablist"
|
|
@@ -1851,7 +1851,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
1851
1851
|
>
|
|
1852
1852
|
${this._renderTabIcon(e)}
|
|
1853
1853
|
<span>${e.label}</span>
|
|
1854
|
-
${e.badge?j`<span class="label-badge" style=${we({backgroundColor:e.badgeBackground,color:e.badgeColor})}>${e.badge}</span>`:
|
|
1854
|
+
${e.badge?j`<span class="label-badge" style=${we({backgroundColor:e.badgeBackground,color:e.badgeColor})}>${e.badge}</span>`:H}
|
|
1855
1855
|
${e.dismissible?j`
|
|
1856
1856
|
<button
|
|
1857
1857
|
class="label-dismiss"
|
|
@@ -1872,7 +1872,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
1872
1872
|
/>
|
|
1873
1873
|
</svg>
|
|
1874
1874
|
</button>
|
|
1875
|
-
`:
|
|
1875
|
+
`:H}
|
|
1876
1876
|
</button>
|
|
1877
1877
|
`))}
|
|
1878
1878
|
</div>
|
|
@@ -1883,7 +1883,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
1883
1883
|
>
|
|
1884
1884
|
<slot @slotchange=${this._updateActiveTab}></slot>
|
|
1885
1885
|
</div>
|
|
1886
|
-
`}}pi.styles=[
|
|
1886
|
+
`}}pi.styles=[Ht,n`
|
|
1887
1887
|
:host {
|
|
1888
1888
|
display: flex;
|
|
1889
1889
|
flex-direction: column;
|
|
@@ -2016,7 +2016,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2016
2016
|
::slotted(krs-tab[active]) {
|
|
2017
2017
|
display: block;
|
|
2018
2018
|
}
|
|
2019
|
-
`],ci([ce({type:String,attribute:"active-tab-id"})],pi.prototype,"activeTabId",void 0),ci([ce({type:Boolean})],pi.prototype,"justified",void 0),ci([ce({type:String,reflect:!0})],pi.prototype,"size",void 0),customElements.get("krs-tab-group")||customElements.define("krs-tab-group",pi);var ui=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class gi extends ae{constructor(){super(...arguments),this.id="",this.label="",this.badge="",this.badgeBackground="",this.badgeColor="",this.disabled=!1,this.dismissible=!1,this.active=!1}updated(){const e=this.closest("krs-tab-group");e&&e.requestUpdate()}getIconElement(){return this.querySelector('[slot="icon"]')}render(){return j`<slot></slot>`}}gi.styles=[
|
|
2019
|
+
`],ci([ce({type:String,attribute:"active-tab-id"})],pi.prototype,"activeTabId",void 0),ci([ce({type:Boolean})],pi.prototype,"justified",void 0),ci([ce({type:String,reflect:!0})],pi.prototype,"size",void 0),customElements.get("krs-tab-group")||customElements.define("krs-tab-group",pi);var ui=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class gi extends ae{constructor(){super(...arguments),this.id="",this.label="",this.badge="",this.badgeBackground="",this.badgeColor="",this.disabled=!1,this.dismissible=!1,this.active=!1}updated(){const e=this.closest("krs-tab-group");e&&e.requestUpdate()}getIconElement(){return this.querySelector('[slot="icon"]')}render(){return j`<slot></slot>`}}gi.styles=[Ht,n`
|
|
2020
2020
|
:host {
|
|
2021
2021
|
display: none;
|
|
2022
2022
|
}
|
|
@@ -2033,7 +2033,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2033
2033
|
${this.label}
|
|
2034
2034
|
${this.required?j`<span class="required" aria-hidden="true">*</span>`:""}
|
|
2035
2035
|
</label>
|
|
2036
|
-
`:
|
|
2036
|
+
`:H}
|
|
2037
2037
|
<div class="select-wrapper">
|
|
2038
2038
|
<button
|
|
2039
2039
|
class=${ye({"select-trigger":!0,"select-trigger--open":this._isOpen,"select-trigger--invalid":this._touched&&this.required&&!this.value})}
|
|
@@ -2077,7 +2077,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2077
2077
|
<div class="options-slot">
|
|
2078
2078
|
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
2079
2079
|
</div>
|
|
2080
|
-
`}}bi.styles=[
|
|
2080
|
+
`}}bi.styles=[Ht,n`
|
|
2081
2081
|
:host {
|
|
2082
2082
|
display: block;
|
|
2083
2083
|
font-family: inherit;
|
|
@@ -2257,7 +2257,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2257
2257
|
:host {
|
|
2258
2258
|
display: none;
|
|
2259
2259
|
}
|
|
2260
|
-
`,mi([ce({type:String})],_i.prototype,"value",void 0),mi([ce({type:Boolean})],_i.prototype,"disabled",void 0),customElements.get("krs-select-option")||customElements.define("krs-select-option",_i);const vi={equals:{key:"equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Equals"},n_equals:{key:"n_equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Doesn't equal"},contains:{key:"contains",type:"comparison",dataTypes:["string"],label:"Contains"},n_contains:{key:"n_contains",type:"comparison",dataTypes:["string"],label:"Doesn't contain"},starts_with:{key:"starts_with",type:"comparison",dataTypes:["string"],label:"Starts with"},ends_with:{key:"ends_with",type:"comparison",dataTypes:["string"],label:"Ends with"},less_than:{key:"less_than",type:"comparison",dataTypes:["number","date"],label:"Less than"},less_than_equal:{key:"less_than_equal",type:"comparison",dataTypes:["number","date"],label:"Less than or equal"},greater_than:{key:"greater_than",type:"comparison",dataTypes:["number","date"],label:"Greater than"},greater_than_equal:{key:"greater_than_equal",type:"comparison",dataTypes:["number","date"],label:"Greater than or equal"},between:{key:"between",type:"range",dataTypes:["number","date"],label:"Between"},in:{key:"in",type:"list",dataTypes:["string","number"],label:"In"},n_in:{key:"n_in",type:"list",dataTypes:["string","number","date","boolean"],label:"Not In"},empty:{key:"empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Empty"},n_empty:{key:"n_empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Not empty"}};function yi(e){const t=[];for(const i of Object.values(vi))i.dataTypes.includes(e)&&t.push({key:i.key,label:i.label});return t}const ki=['"',"+","-","&&","||","!","(",")","{","}","[","]","^","~","*","?",":"],xi=['\\"',"\\+","\\-","\\&\\&","\\|\\|","\\!","\\(","\\)","\\{","\\}","\\[","\\]","\\^","\\~","\\*","\\?","\\:"];function wi(e,t=!0){return!0===e||!1===e?e.toString():null===e?"(*:* NOT *)":"number"==typeof e?e.toString():"string"==typeof e?(ki.forEach(((t,i)=>{var s;e=e.replace(new RegExp(`${s=t,"string"!=typeof s?s:s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}`,"g"),xi[i])})),t?`"${e}"`:e.replace(/ /g,"\\ ")):e}function $i(e,t=!1){const i=new Date(e);return i.setMinutes(i.getMinutes()-i.getTimezoneOffset()),t&&(i.setUTCHours(23),i.setUTCMinutes(59),i.setUTCSeconds(59),i.setUTCMilliseconds(999)),i.toISOString().replace(/:/g,"\\:")}function Si(e,t){let i,s,o,r;if(e&&"start"in e&&"end"in e)i=new Date(e.start),s=new Date(e.end),o=t[0],r=t[1];else{if(!(e instanceof Date))return"[* TO *]";i=new Date(e),s=new Date(e),o=t[0],r=t[0]}return"year"===o?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0)):"month"===o?(i.setUTCDate(1),i.setUTCHours(0,0,0,0)):"day"===o?i.setUTCHours(0,0,0,0):"time"===o&&i.setUTCSeconds(0,0),"year"===r?(s.setUTCMonth(11,31),s.setUTCHours(23,59,59,999)):"month"===r?(s.setUTCMonth(s.getUTCMonth()+1),s.setUTCDate(0),s.setUTCHours(23,59,59,999)):"day"===r?s.setUTCHours(23,59,59,999):"time"===r&&s.setUTCSeconds(59,999),`[${i.toISOString().replace(/:/g,"\\:")} TO ${s.toISOString().replace(/:/g,"\\:")}]`}function Ci(e,t){let i,s,o,r,n,a;return e&&"start"in e&&"end"in e?(i=new Date(e.start),s=new Date(e.end),o=t[0],r=t[1]):(i=new Date(e),s=new Date(e),o=t[0],r=t[0]),"year"===o?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0),n=i):"month"===o?(i.setUTCDate(1),i.setUTCHours(0,0,0,0),n=i):"day"===o?(i.setUTCHours(0,0,0,0),n=i):"time"===o?(i.setUTCSeconds(0,0),n=i):n=i,"year"===r?(s.setUTCMonth(11,31),s.setUTCHours(23,59,59,999),a=s):"month"===r?(s.setUTCMonth(s.getUTCMonth()+1),s.setUTCDate(0),s.setUTCHours(23,59,59,999),a=s):"day"===r?(s.setUTCHours(23,59,59,999),a=s):"time"===r?(s.setUTCSeconds(59,999),a=s):a=s,[n.toISOString().replace(/\..+/,"").replace("T"," "),a.toISOString().replace(/\..+/,"").replace("T"," ")]}function Ei(e){return e=e.trim(),/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/.test(e)||/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.test(e)?"day":/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)||/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)?"time":/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/.test(e)?"day":/^(\d{2})$/.test(e)||/^(\d{4})$/.test(e)?"year":/^([A-Za-z]+)\s+(\d{4})$/.test(e)?"month":null}class zi{constructor(){this.field="",this.operator="equals",this.value=null,this.kql="",this.text="",this.type="",this.specificity=[]}setKql(e){if(this.kql=e.trim(),this.text="",this.specificity=[],this.value=null,this.kql)if(e.startsWith("="))this.operator="equals",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("!="))this.operator="n_equals",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("~")&&"string"===this.type)this.operator="contains",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("!~")&&"string"===this.type)this.operator="n_contains",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.endsWith("*")&&"string"===this.type)this.operator="starts_with",this.text=e.substring(0,e.length-1),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("*")&&"string"===this.type)this.operator="ends_with",this.text=e.substring(1),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if("EMPTY"===e)this.operator="empty",this.value=null,this.specificity=[];else if("NOT EMPTY"===e)this.operator="n_empty",this.value=null,this.specificity=[];else if(e.startsWith("<="))this.operator="less_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("<"))this.operator="less_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith(">="))this.operator="greater_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith(">"))this.operator="greater_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("[")&&e.endsWith("]")&&e.indexOf(" TO ")>-1){this.operator="between";const t=e.indexOf(" TO "),i=e.substring(1,t).trim(),s=e.substring(t+4,e.length-1).trim();this.text=`${i} - ${s}`,this.value={start:this._parse(i),end:this._parse(s)},this.specificity=[Ei(i),Ei(s)]}else e.startsWith("!(")&&e.endsWith(")")?(this.operator="n_in",this.text=e.substring(2,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[Ei(this.text)]):e.startsWith("(")&&e.endsWith(")")?(this.operator="in",this.text=e.substring(1,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[Ei(this.text)]):"date"===this.type||"boolean"===this.type||"number"===this.type?(this.operator="equals",this.text=this.kql,this.value=this._parse(this.text),this.specificity=[Ei(this.text)]):(this.operator="contains",this.text=e,this.value=this._parse(this.text),this.specificity=[Ei(this.text)]);else"string"===this.type?this.operator="contains":this.operator="equals"}setOperator(e){"empty"===this.operator||"n_empty"===this.operator||"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this.operator=e,"empty"===this.operator?(this.value="EMPTY",this.text="EMPTY"):"n_empty"===this.operator?(this.value="NOT EMPTY",this.text="NOT EMPTY"):"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this._buildKql()}setValue(e,t){this.value=e,t?this.specificity=[t]:e instanceof Date?this.specificity=["time"]:this.specificity=[],this._buildText(),this._buildKql()}setStart(e,t){void 0===this.value?.start&&(this.value={start:null,end:null}),this.value.start=e,t?this.specificity[0]=t:e instanceof Date&&(this.specificity[0]="time"),this._buildText(),this._buildKql()}setEnd(e,t){void 0===this.value?.end&&(this.value={start:null,end:null}),this.value.end=e,t?this.specificity[1]=t:e instanceof Date&&(this.specificity[1]="time"),this._buildText(),this._buildKql()}clear(){"string"===this.type?this.operator="contains":this.operator="equals",this.value=null,this.kql="",this.text="",this.specificity=[]}isEmpty(){return"empty"===this.operator||"n_empty"===this.operator?!this.text:"between"===this.operator?!this.value?.start&&!this.value?.end:"in"===this.operator||"n_in"===this.operator?!this.value?.length:void 0===this.value||null===this.value||""===this.value}has(e){return!("in"!==this.operator&&"n_in"!==this.operator||!Array.isArray(this.value))&&("boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1)),this.value.indexOf(e)>=0)}toggle(e){"in"!==this.operator&&"n_in"!==this.operator&&this.setOperator("in"),"boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1));const t=this.value.indexOf(e);t>=0?this.value.splice(t,1):this.value.push(e),this._buildText(),this._buildKql()}isValid(){return!this.kql||!!this.field&&(!!this.operator&&("empty"===this.operator||("n_empty"===this.operator||("in"===this.operator||"n_in"===this.operator?Array.isArray(this.value)&&this.value.length>0:"date"===this.type?"between"===this.operator?this.value?.start instanceof Date&&this.value?.end instanceof Date&&!isNaN(this.value.start.getTime())&&!isNaN(this.value.end.getTime()):this.value instanceof Date&&!isNaN(this.value.getTime()):"number"===this.type?"between"===this.operator?"number"==typeof this.value?.start&&"number"==typeof this.value?.end:"number"==typeof this.value:"boolean"===this.type?"boolean"==typeof this.value:"string"==typeof this.value&&!!this.value.trim().length))))}toSolrData(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null};switch(e.name=this.field,this.operator){case"equals":this.value instanceof Date?(e.operation="EXPRESSION",e.value=Si(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":this.value instanceof Date?(e.operation="EXPRESSION",e.not=!0,e.value=Si(this.value,this.specificity)):(e.operation="IS",e.not=!0,e.value=this.value);break;case"contains":e.operation="EXPRESSION",e.value=`*${wi(this.value,!1)}*`;break;case"n_contains":e.operation="EXPRESSION",e.not=!0,e.value=`*${wi(this.value,!1)}*`;break;case"starts_with":e.operation="EXPRESSION",e.value=`${wi(this.value,!1)}*`;break;case"ends_with":e.operation="EXPRESSION",e.value=`*${wi(this.value,!1)}`;break;case"empty":e.operation="EXPRESSION",e.not=!0,e.value="[* TO *]";break;case"n_empty":e.operation="EXPRESSION",e.value="[* TO *]";break;case"less_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${$i(this.value)}}`):(e.operation="EXPRESSION",e.value=`[* TO ${wi(this.value,!0)}}`);break;case"less_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${$i(this.value,!0)}]`):(e.operation="EXPRESSION",e.value=`[* TO ${wi(this.value,!0)}]`);break;case"greater_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`{${$i(this.value,!0)} TO *]`):(e.operation="EXPRESSION",e.value=`{${wi(this.value,!0)} TO *]`);break;case"greater_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[${$i(this.value)} TO *]`):(e.operation="EXPRESSION",e.value=`[${wi(this.value,!0)} TO *]`);break;case"between":this.value?.start instanceof Date&&this.value?.end instanceof Date?(e.operation="EXPRESSION",e.value=Si(this.value,this.specificity)):(e.operation="EXPRESSION",e.value=`[${this.value.start} TO ${this.value.end}]`);break;case"in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.value=`(${this.value.map((e=>wi(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.value=wi(this.value,!0));break;case"n_in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.not=!0,e.value=`(${this.value.map((e=>wi(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.not=!0,e.value=wi(this.value,!0));break;default:e.operation="EXPRESSION",e.value=wi(this.value,!0)}return e}toDbParams(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null,values:null};switch(e.name=this.field,this.operator){case"equals":"date"===this.type?(e.operation="BETWEEN",e.values=Ci(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":"date"===this.type?(e.operation="BETWEEN",e.not=!0,e.values=Ci(this.value,this.specificity)):(e.operation="IS",e.value=this.value,e.not=!0);break;case"contains":e.operation="CONTAINS",e.value=this.value;break;case"n_contains":e.operation="CONTAINS",e.value=this.value,e.not=!0;break;case"starts_with":e.operation="STARTS_WITH",e.value=this.value;break;case"ends_with":e.operation="ENDS_WITH",e.value=this.value;break;case"empty":e.operation="IS_BLANK";break;case"n_empty":e.operation="IS_NOT_BLANK";break;case"less_than":e.operation="LESS_THAN",e.value=this.value;break;case"less_than_equal":e.operation="LESS_THAN_EQUAL",e.value=this.value;break;case"greater_than":e.operation="GREATER_THAN",e.value=this.value;break;case"greater_than_equal":e.operation="GREATER_THAN_EQUAL",e.value=this.value;break;case"between":e.operation="BETWEEN","date"===this.type?e.values=Ci(this.value,this.specificity):e.values=[this.value.start,this.value.end];break;case"in":e.operation="IN",e.values=this.value??[];break;case"n_in":e.operation="IN",e.not=!0,e.values=this.value??[];break;default:throw Error(`${this.operator} operator not supported by db params.`)}return e}toOpensearchData(){switch(this.operator){case"equals":return{term:{[this.field]:this.value}};case"n_equals":return{bool:{must_not:[{term:{[this.field]:this.value}}]}};case"contains":return{wildcard:{[this.field]:{value:`*${this.value}*`,case_insensitive:!0}}};case"n_contains":return{bool:{must_not:[{wildcard:{[this.field]:{value:`*${this.value}*`,case_insensitive:!0}}}]}};case"starts_with":return{wildcard:{[this.field]:{value:`${this.value}*`,case_insensitive:!0}}};case"ends_with":return{wildcard:{[this.field]:{value:`*${this.value}`,case_insensitive:!0}}};case"empty":return{bool:{must_not:[{exists:{field:this.field}}]}};case"n_empty":return{exists:{field:this.field}};case"less_than":return{range:{[this.field]:{lt:this.value}}};case"less_than_equal":return{range:{[this.field]:{lte:this.value}}};case"greater_than":return{range:{[this.field]:{gt:this.value}}};case"greater_than_equal":return{range:{[this.field]:{gte:this.value}}};case"between":return{range:{[this.field]:{gte:this.value?.start,lte:this.value?.end}}};case"in":return{terms:{[this.field]:this.value??[]}};case"n_in":return{bool:{must_not:[{terms:{[this.field]:this.value??[]}}]}};default:throw Error(`${this.operator} operator not supported by opensearch data.`)}}_buildText(){this.isEmpty()?this.text="":"between"===this.operator?this.text=`${this._format(this.value?.start)} - ${this._format(this.value?.end)}`:"in"===this.operator||"n_in"===this.operator?this.text=this.value.map((e=>this._format(e))).join(","):this.text=this._format(this.value)}_format(e){if(e instanceof Date&&!isNaN(e.getTime())){return`${String(e.getUTCMonth()+1).padStart(2,"0")}/${String(e.getUTCDate()).padStart(2,"0")}/${e.getUTCFullYear()}`}return"boolean"==typeof e?e?"Yes":"No":String(e??"")}_parse(e){if(null==e||""===e)return null;if(this.type)switch(this.type){case"boolean":{const t=e.toString().toLowerCase();return!0===e||!1!==e&&("yes"===t||"no"!==t&&("1"===t||"0"!==t&&null))}case"date":return this._parseDate(e);case"number":{const t=Number(e.toString().replace(/[$,]+/g,""));return isNaN(t)?null:t}default:return e.toString()}return e}_parseDate(e){if(null==e||""===e)return null;const t={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11};let i;if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){let e=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==e&&(e+=12),"AM"===i[6].toUpperCase()&&12===e&&(e=0)),new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2]),e,parseInt(i[5])))}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){const e=t[i[1].toLowerCase()];if(void 0!==e){let t=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==t&&(t+=12),"AM"===i[6].toUpperCase()&&12===t&&(t=0)),new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2]),t,parseInt(i[5])))}}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2])))}if(i=e.match(/^(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[1]),0,1));if(i=e.match(/^(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[1]),0,1));if(i=e.match(/^([A-Za-z]+)\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[2]),e,1))}return null}_buildKql(){if(this.isEmpty())this.kql="";else switch(this.operator){case"equals":this.kql=`= ${this.text}`;break;case"n_equals":this.kql=`!= ${this.text}`;break;case"contains":this.kql=`~ ${this.text}`;break;case"n_contains":this.kql=`!~ ${this.text}`;break;case"starts_with":this.kql=`${this.text}*`;break;case"ends_with":this.kql=`*${this.text}`;break;case"empty":this.kql="EMPTY";break;case"n_empty":this.kql="NOT EMPTY";break;case"less_than":this.kql=`< ${this.text}`;break;case"less_than_equal":this.kql=`<= ${this.text}`;break;case"greater_than":this.kql=`> ${this.text}`;break;case"greater_than_equal":this.kql=`>= ${this.text}`;break;case"between":this.kql=`[${this._format(this.value?.start??"")} TO ${this._format(this.value?.end??"")}]`;break;case"in":this.kql=`(${this.value.map((e=>this._format(e))).join(",")})`;break;case"n_in":this.kql=`!(${this.value.map((e=>this._format(e))).join(",")})`;break;default:throw Error(`Unknown operator ${this.operator}`)}}}var Di=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class Ti{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null}}class Oi extends ae{constructor(){super(...arguments),this._scrollStyle="edge",this._filterPanelPos={top:0,left:0},this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._measuredColumnIds=new Set,this._model=new Ti,this.def={columns:[]},this.variant="default",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._sorts=[],this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.columns.find((e=>e.id===this._resizing.columnId));if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this._measuredColumnIds.delete(t.id),this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener("mousemove",this._handleResizeMove),document.removeEventListener("mouseup",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle("kr-table--scroll-overlay","overlay"===this._scrollStyle),this.classList.toggle("kr-table--scroll-edge","edge"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener("click",this._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition(),this._unlockColumnWidths()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._measuredColumnIds.clear(),this._model=new Ti,this._buckets=new Map,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable||e.options?.length)&&(t.filter=new zi,t.filter.field=e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):!e.facetable&&!e.options?.length||e.filterable?"string"===t.filter.type&&(t.filter.operator="contains"):(t.filter.operator="in",t.filter.value=[])),e.options?.length&&this._buckets.set(e.id,e.options.map((e=>({val:e})))),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const s=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&s>0&&(t[i].width=`${s}px`,this._measuredColumnIds.add(t[i].id))}))}_unlockColumnWidths(){0!==this._measuredColumnIds.size&&(this.getDisplayedColumns().forEach((e=>{this._measuredColumnIds.has(e.id)&&(e.width=void 0)})),this._measuredColumnIds.clear(),this.requestUpdate())}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const s=e.render(t);if(!s)return;const o=document.createElement("span");o.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(o.style.display="flex",o.style.gap="8px"),"string"==typeof s?o.innerHTML=s:re(s,o),this.appendChild(o)}))})))}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:wi(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let e;this._dataState="loading",e="db"===this._model.dataSource.mode?this._toDbParams():this._toSolrData(),this._model.dataSource.fetch(e).then((e=>{switch(this._model.dataSource?.mode){case"opensearch":throw Error("Opensearch not supported yet");case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size,this._parseFacetResults(t)}}this._dataState="success",this._updateSearchPosition()})).catch((e=>{this._dataState="error";let t="Failed to load data";e instanceof Error&&(t=e.message),hi.show({message:t,type:"error"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const s=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&s.unshift({val:null,count:e.count}),null!==e.name&&s.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)s.some((t=>t.val===e))||s.push({val:e,count:0});this._buckets.set(t.id,s)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_updateSearchPosition(){if(this._searchPositionLocked)return;if("card"===this.variant)return;const e=this.shadowRoot?.querySelector(".search"),t=e?.querySelector(".search-field");e&&t&&(e.style.justifyContent="center",t.style.marginLeft="",requestAnimationFrame((()=>{const i=e.getBoundingClientRect(),s=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${s}px`,this._searchPositionLocked=!0})))}_handleColumnPickerClick(){this._columnPickerOpen=!this._columnPickerOpen}_handleColumnToggle(e){this._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const s=window.getSelection();s&&s.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.columns.find((t=>t.id===e)))).sort(((e,t)=>"actions"===e.type&&"actions"!==t.type?1:"actions"!==e.type&&"actions"===t.type?-1:0))}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(".content");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle("kr-table--scroll-left-available",this._canScrollLeft),this.classList.toggle("kr-table--scroll-right-available",this._canScrollRight),this.classList.toggle("kr-table--scroll-horizontal-available",this._canScrollHorizontal),this.classList.toggle("kr-table--sticky-left",this.getDisplayedColumns().some((e=>"left"===e.sticky))),this.classList.toggle("kr-table--sticky-right",this.getDisplayedColumns().some((e=>"right"===e.sticky)))}_handleResizeStart(e,t){e.preventDefault(),this.getDisplayedColumns().forEach((e=>{if(e.width||"actions"===e.type)return;const t=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${e.id}"]`);t?.offsetWidth&&(e.width=`${t.offsetWidth}px`)}));const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${t}"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener("mousemove",this._handleResizeMove),document.addEventListener("mouseup",this._handleResizeEnd)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return N;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return j`
|
|
2260
|
+
`,mi([ce({type:String})],_i.prototype,"value",void 0),mi([ce({type:Boolean})],_i.prototype,"disabled",void 0),customElements.get("krs-select-option")||customElements.define("krs-select-option",_i);const vi={equals:{key:"equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Equals"},n_equals:{key:"n_equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Doesn't equal"},contains:{key:"contains",type:"comparison",dataTypes:["string"],label:"Contains"},n_contains:{key:"n_contains",type:"comparison",dataTypes:["string"],label:"Doesn't contain"},starts_with:{key:"starts_with",type:"comparison",dataTypes:["string"],label:"Starts with"},ends_with:{key:"ends_with",type:"comparison",dataTypes:["string"],label:"Ends with"},less_than:{key:"less_than",type:"comparison",dataTypes:["number","date"],label:"Less than"},less_than_equal:{key:"less_than_equal",type:"comparison",dataTypes:["number","date"],label:"Less than or equal"},greater_than:{key:"greater_than",type:"comparison",dataTypes:["number","date"],label:"Greater than"},greater_than_equal:{key:"greater_than_equal",type:"comparison",dataTypes:["number","date"],label:"Greater than or equal"},between:{key:"between",type:"range",dataTypes:["number","date"],label:"Between"},in:{key:"in",type:"list",dataTypes:["string","number"],label:"In"},n_in:{key:"n_in",type:"list",dataTypes:["string","number","date","boolean"],label:"Not In"},empty:{key:"empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Empty"},n_empty:{key:"n_empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Not empty"}};function yi(e){const t=[];for(const i of Object.values(vi))i.dataTypes.includes(e)&&t.push({key:i.key,label:i.label});return t}const ki=['"',"+","-","&&","||","!","(",")","{","}","[","]","^","~","*","?",":"],xi=['\\"',"\\+","\\-","\\&\\&","\\|\\|","\\!","\\(","\\)","\\{","\\}","\\[","\\]","\\^","\\~","\\*","\\?","\\:"];function wi(e,t=!0){return!0===e||!1===e?e.toString():null===e?"(*:* NOT *)":"number"==typeof e?e.toString():"string"==typeof e?(ki.forEach(((t,i)=>{var s;e=e.replace(new RegExp(`${s=t,"string"!=typeof s?s:s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}`,"g"),xi[i])})),t?`"${e}"`:e.replace(/ /g,"\\ ")):e}function $i(e,t=!1){const i=new Date(e);return i.setMinutes(i.getMinutes()-i.getTimezoneOffset()),t&&(i.setUTCHours(23),i.setUTCMinutes(59),i.setUTCSeconds(59),i.setUTCMilliseconds(999)),i.toISOString().replace(/:/g,"\\:")}function Si(e,t){let i,s,o,r;if(e&&"start"in e&&"end"in e)i=new Date(e.start),s=new Date(e.end),o=t[0],r=t[1];else{if(!(e instanceof Date))return"[* TO *]";i=new Date(e),s=new Date(e),o=t[0],r=t[0]}return"year"===o?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0)):"month"===o?(i.setUTCDate(1),i.setUTCHours(0,0,0,0)):"day"===o?i.setUTCHours(0,0,0,0):"time"===o&&i.setUTCSeconds(0,0),"year"===r?(s.setUTCMonth(11,31),s.setUTCHours(23,59,59,999)):"month"===r?(s.setUTCMonth(s.getUTCMonth()+1),s.setUTCDate(0),s.setUTCHours(23,59,59,999)):"day"===r?s.setUTCHours(23,59,59,999):"time"===r&&s.setUTCSeconds(59,999),`[${i.toISOString().replace(/:/g,"\\:")} TO ${s.toISOString().replace(/:/g,"\\:")}]`}function Ci(e,t){let i,s,o,r,n,a;return e&&"start"in e&&"end"in e?(i=new Date(e.start),s=new Date(e.end),o=t[0],r=t[1]):(i=new Date(e),s=new Date(e),o=t[0],r=t[0]),"year"===o?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0),n=i):"month"===o?(i.setUTCDate(1),i.setUTCHours(0,0,0,0),n=i):"day"===o?(i.setUTCHours(0,0,0,0),n=i):"time"===o?(i.setUTCSeconds(0,0),n=i):n=i,"year"===r?(s.setUTCMonth(11,31),s.setUTCHours(23,59,59,999),a=s):"month"===r?(s.setUTCMonth(s.getUTCMonth()+1),s.setUTCDate(0),s.setUTCHours(23,59,59,999),a=s):"day"===r?(s.setUTCHours(23,59,59,999),a=s):"time"===r?(s.setUTCSeconds(59,999),a=s):a=s,[n.toISOString().replace(/\..+/,"").replace("T"," "),a.toISOString().replace(/\..+/,"").replace("T"," ")]}function Ei(e){return e=e.trim(),/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/.test(e)||/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.test(e)?"day":/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)||/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)?"time":/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/.test(e)?"day":/^(\d{2})$/.test(e)||/^(\d{4})$/.test(e)?"year":/^([A-Za-z]+)\s+(\d{4})$/.test(e)?"month":null}class zi{constructor(){this.field="",this.operator="equals",this.value=null,this.kql="",this.text="",this.type="",this.specificity=[]}setKql(e){if(this.kql=e.trim(),this.text="",this.specificity=[],this.value=null,this.kql)if(e.startsWith("="))this.operator="equals",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("!="))this.operator="n_equals",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("~")&&"string"===this.type)this.operator="contains",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("!~")&&"string"===this.type)this.operator="n_contains",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.endsWith("*")&&"string"===this.type)this.operator="starts_with",this.text=e.substring(0,e.length-1),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("*")&&"string"===this.type)this.operator="ends_with",this.text=e.substring(1),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if("EMPTY"===e)this.operator="empty",this.value=null,this.specificity=[];else if("NOT EMPTY"===e)this.operator="n_empty",this.value=null,this.specificity=[];else if(e.startsWith("<="))this.operator="less_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("<"))this.operator="less_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith(">="))this.operator="greater_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith(">"))this.operator="greater_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("[")&&e.endsWith("]")&&e.indexOf(" TO ")>-1){this.operator="between";const t=e.indexOf(" TO "),i=e.substring(1,t).trim(),s=e.substring(t+4,e.length-1).trim();this.text=`${i} - ${s}`,this.value={start:this._parse(i),end:this._parse(s)},this.specificity=[Ei(i),Ei(s)]}else e.startsWith("!(")&&e.endsWith(")")?(this.operator="n_in",this.text=e.substring(2,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[Ei(this.text)]):e.startsWith("(")&&e.endsWith(")")?(this.operator="in",this.text=e.substring(1,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[Ei(this.text)]):"date"===this.type||"boolean"===this.type||"number"===this.type?(this.operator="equals",this.text=this.kql,this.value=this._parse(this.text),this.specificity=[Ei(this.text)]):(this.operator="contains",this.text=e,this.value=this._parse(this.text),this.specificity=[Ei(this.text)]);else"string"===this.type?this.operator="contains":this.operator="equals"}setOperator(e){"empty"===this.operator||"n_empty"===this.operator||"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this.operator=e,"empty"===this.operator?(this.value="EMPTY",this.text="EMPTY"):"n_empty"===this.operator?(this.value="NOT EMPTY",this.text="NOT EMPTY"):"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this._buildKql()}setValue(e,t){this.value=e,t?this.specificity=[t]:e instanceof Date?this.specificity=["time"]:this.specificity=[],this._buildText(),this._buildKql()}setStart(e,t){void 0===this.value?.start&&(this.value={start:null,end:null}),this.value.start=e,t?this.specificity[0]=t:e instanceof Date&&(this.specificity[0]="time"),this._buildText(),this._buildKql()}setEnd(e,t){void 0===this.value?.end&&(this.value={start:null,end:null}),this.value.end=e,t?this.specificity[1]=t:e instanceof Date&&(this.specificity[1]="time"),this._buildText(),this._buildKql()}clear(){"string"===this.type?this.operator="contains":this.operator="equals",this.value=null,this.kql="",this.text="",this.specificity=[]}isEmpty(){return"empty"===this.operator||"n_empty"===this.operator?!this.text:"between"===this.operator?!this.value?.start&&!this.value?.end:"in"===this.operator||"n_in"===this.operator?!this.value?.length:void 0===this.value||null===this.value||""===this.value}has(e){return!("in"!==this.operator&&"n_in"!==this.operator||!Array.isArray(this.value))&&("boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1)),this.value.indexOf(e)>=0)}toggle(e){"in"!==this.operator&&"n_in"!==this.operator&&this.setOperator("in"),"boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1));const t=this.value.indexOf(e);t>=0?this.value.splice(t,1):this.value.push(e),this._buildText(),this._buildKql()}isValid(){return!this.kql||!!this.field&&(!!this.operator&&("empty"===this.operator||("n_empty"===this.operator||("in"===this.operator||"n_in"===this.operator?Array.isArray(this.value)&&this.value.length>0:"date"===this.type?"between"===this.operator?this.value?.start instanceof Date&&this.value?.end instanceof Date&&!isNaN(this.value.start.getTime())&&!isNaN(this.value.end.getTime()):this.value instanceof Date&&!isNaN(this.value.getTime()):"number"===this.type?"between"===this.operator?"number"==typeof this.value?.start&&"number"==typeof this.value?.end:"number"==typeof this.value:"boolean"===this.type?"boolean"==typeof this.value:"string"==typeof this.value&&!!this.value.trim().length))))}toSolrData(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null};switch(e.name=this.field,this.operator){case"equals":this.value instanceof Date?(e.operation="EXPRESSION",e.value=Si(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":this.value instanceof Date?(e.operation="EXPRESSION",e.not=!0,e.value=Si(this.value,this.specificity)):(e.operation="IS",e.not=!0,e.value=this.value);break;case"contains":e.operation="EXPRESSION",e.value=`*${wi(this.value,!1)}*`;break;case"n_contains":e.operation="EXPRESSION",e.not=!0,e.value=`*${wi(this.value,!1)}*`;break;case"starts_with":e.operation="EXPRESSION",e.value=`${wi(this.value,!1)}*`;break;case"ends_with":e.operation="EXPRESSION",e.value=`*${wi(this.value,!1)}`;break;case"empty":e.operation="EXPRESSION",e.not=!0,e.value="[* TO *]";break;case"n_empty":e.operation="EXPRESSION",e.value="[* TO *]";break;case"less_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${$i(this.value)}}`):(e.operation="EXPRESSION",e.value=`[* TO ${wi(this.value,!0)}}`);break;case"less_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${$i(this.value,!0)}]`):(e.operation="EXPRESSION",e.value=`[* TO ${wi(this.value,!0)}]`);break;case"greater_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`{${$i(this.value,!0)} TO *]`):(e.operation="EXPRESSION",e.value=`{${wi(this.value,!0)} TO *]`);break;case"greater_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[${$i(this.value)} TO *]`):(e.operation="EXPRESSION",e.value=`[${wi(this.value,!0)} TO *]`);break;case"between":this.value?.start instanceof Date&&this.value?.end instanceof Date?(e.operation="EXPRESSION",e.value=Si(this.value,this.specificity)):(e.operation="EXPRESSION",e.value=`[${this.value.start} TO ${this.value.end}]`);break;case"in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.value=`(${this.value.map((e=>wi(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.value=wi(this.value,!0));break;case"n_in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.not=!0,e.value=`(${this.value.map((e=>wi(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.not=!0,e.value=wi(this.value,!0));break;default:e.operation="EXPRESSION",e.value=wi(this.value,!0)}return e}toDbParams(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null,values:null};switch(e.name=this.field,this.operator){case"equals":"date"===this.type?(e.operation="BETWEEN",e.values=Ci(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":"date"===this.type?(e.operation="BETWEEN",e.not=!0,e.values=Ci(this.value,this.specificity)):(e.operation="IS",e.value=this.value,e.not=!0);break;case"contains":e.operation="CONTAINS",e.value=this.value;break;case"n_contains":e.operation="CONTAINS",e.value=this.value,e.not=!0;break;case"starts_with":e.operation="STARTS_WITH",e.value=this.value;break;case"ends_with":e.operation="ENDS_WITH",e.value=this.value;break;case"empty":e.operation="IS_BLANK";break;case"n_empty":e.operation="IS_NOT_BLANK";break;case"less_than":e.operation="LESS_THAN",e.value=this.value;break;case"less_than_equal":e.operation="LESS_THAN_EQUAL",e.value=this.value;break;case"greater_than":e.operation="GREATER_THAN",e.value=this.value;break;case"greater_than_equal":e.operation="GREATER_THAN_EQUAL",e.value=this.value;break;case"between":e.operation="BETWEEN","date"===this.type?e.values=Ci(this.value,this.specificity):e.values=[this.value.start,this.value.end];break;case"in":e.operation="IN",e.values=this.value??[];break;case"n_in":e.operation="IN",e.not=!0,e.values=this.value??[];break;default:throw Error(`${this.operator} operator not supported by db params.`)}return e}toOpensearchData(){switch(this.operator){case"equals":return{term:{[this.field]:this.value}};case"n_equals":return{bool:{must_not:[{term:{[this.field]:this.value}}]}};case"contains":return{wildcard:{[this.field]:{value:`*${this.value}*`,case_insensitive:!0}}};case"n_contains":return{bool:{must_not:[{wildcard:{[this.field]:{value:`*${this.value}*`,case_insensitive:!0}}}]}};case"starts_with":return{wildcard:{[this.field]:{value:`${this.value}*`,case_insensitive:!0}}};case"ends_with":return{wildcard:{[this.field]:{value:`*${this.value}`,case_insensitive:!0}}};case"empty":return{bool:{must_not:[{exists:{field:this.field}}]}};case"n_empty":return{exists:{field:this.field}};case"less_than":return{range:{[this.field]:{lt:this.value}}};case"less_than_equal":return{range:{[this.field]:{lte:this.value}}};case"greater_than":return{range:{[this.field]:{gt:this.value}}};case"greater_than_equal":return{range:{[this.field]:{gte:this.value}}};case"between":return{range:{[this.field]:{gte:this.value?.start,lte:this.value?.end}}};case"in":return{terms:{[this.field]:this.value??[]}};case"n_in":return{bool:{must_not:[{terms:{[this.field]:this.value??[]}}]}};default:throw Error(`${this.operator} operator not supported by opensearch data.`)}}_buildText(){this.isEmpty()?this.text="":"between"===this.operator?this.text=`${this._format(this.value?.start)} - ${this._format(this.value?.end)}`:"in"===this.operator||"n_in"===this.operator?this.text=this.value.map((e=>this._format(e))).join(","):this.text=this._format(this.value)}_format(e){if(e instanceof Date&&!isNaN(e.getTime())){return`${String(e.getUTCMonth()+1).padStart(2,"0")}/${String(e.getUTCDate()).padStart(2,"0")}/${e.getUTCFullYear()}`}return"boolean"==typeof e?e?"Yes":"No":String(e??"")}_parse(e){if(null==e||""===e)return null;if(this.type)switch(this.type){case"boolean":{const t=e.toString().toLowerCase();return!0===e||!1!==e&&("yes"===t||"no"!==t&&("1"===t||"0"!==t&&null))}case"date":return this._parseDate(e);case"number":{const t=Number(e.toString().replace(/[$,]+/g,""));return isNaN(t)?null:t}default:return e.toString()}return e}_parseDate(e){if(null==e||""===e)return null;const t={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11};let i;if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){let e=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==e&&(e+=12),"AM"===i[6].toUpperCase()&&12===e&&(e=0)),new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2]),e,parseInt(i[5])))}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){const e=t[i[1].toLowerCase()];if(void 0!==e){let t=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==t&&(t+=12),"AM"===i[6].toUpperCase()&&12===t&&(t=0)),new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2]),t,parseInt(i[5])))}}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2])))}if(i=e.match(/^(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[1]),0,1));if(i=e.match(/^(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[1]),0,1));if(i=e.match(/^([A-Za-z]+)\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[2]),e,1))}return null}_buildKql(){if(this.isEmpty())this.kql="";else switch(this.operator){case"equals":this.kql=`= ${this.text}`;break;case"n_equals":this.kql=`!= ${this.text}`;break;case"contains":this.kql=`~ ${this.text}`;break;case"n_contains":this.kql=`!~ ${this.text}`;break;case"starts_with":this.kql=`${this.text}*`;break;case"ends_with":this.kql=`*${this.text}`;break;case"empty":this.kql="EMPTY";break;case"n_empty":this.kql="NOT EMPTY";break;case"less_than":this.kql=`< ${this.text}`;break;case"less_than_equal":this.kql=`<= ${this.text}`;break;case"greater_than":this.kql=`> ${this.text}`;break;case"greater_than_equal":this.kql=`>= ${this.text}`;break;case"between":this.kql=`[${this._format(this.value?.start??"")} TO ${this._format(this.value?.end??"")}]`;break;case"in":this.kql=`(${this.value.map((e=>this._format(e))).join(",")})`;break;case"n_in":this.kql=`!(${this.value.map((e=>this._format(e))).join(",")})`;break;default:throw Error(`Unknown operator ${this.operator}`)}}}var Di=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class Ti{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null}}class Oi extends ae{constructor(){super(...arguments),this._scrollStyle="edge",this._filterPanelPos={top:0,left:0},this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._measuredColumnIds=new Set,this._model=new Ti,this.def={columns:[]},this.variant="default",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._sorts=[],this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.columns.find((e=>e.id===this._resizing.columnId));if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this._measuredColumnIds.delete(t.id),this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener("mousemove",this._handleResizeMove),document.removeEventListener("mouseup",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle("kr-table--scroll-overlay","overlay"===this._scrollStyle),this.classList.toggle("kr-table--scroll-edge","edge"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener("click",this._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition(),this._unlockColumnWidths()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._measuredColumnIds.clear(),this._model=new Ti,this._buckets=new Map,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable||e.options?.length)&&(t.filter=new zi,t.filter.field=e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):!e.facetable&&!e.options?.length||e.filterable?"string"===t.filter.type&&(t.filter.operator="contains"):(t.filter.operator="in",t.filter.value=[])),e.options?.length&&this._buckets.set(e.id,e.options.map((e=>({val:e})))),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const s=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&s>0&&(t[i].width=`${s}px`,this._measuredColumnIds.add(t[i].id))}))}_unlockColumnWidths(){0!==this._measuredColumnIds.size&&(this.getDisplayedColumns().forEach((e=>{this._measuredColumnIds.has(e.id)&&(e.width=void 0)})),this._measuredColumnIds.clear(),this.requestUpdate())}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const s=e.render(t);if(!s)return;const o=document.createElement("span");o.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(o.style.display="flex",o.style.gap="8px"),"string"==typeof s?o.innerHTML=s:re(s,o),this.appendChild(o)}))})))}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:wi(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let e;this._dataState="loading",e="db"===this._model.dataSource.mode?this._toDbParams():this._toSolrData(),this._model.dataSource.fetch(e).then((e=>{switch(this._model.dataSource?.mode){case"opensearch":throw Error("Opensearch not supported yet");case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size,this._parseFacetResults(t)}}this._dataState="success",this._updateSearchPosition()})).catch((e=>{this._dataState="error";let t="Failed to load data";e instanceof Error&&(t=e.message),hi.show({message:t,type:"error"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const s=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&s.unshift({val:null,count:e.count}),null!==e.name&&s.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)s.some((t=>t.val===e))||s.push({val:e,count:0});this._buckets.set(t.id,s)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_updateSearchPosition(){if(this._searchPositionLocked)return;if("card"===this.variant)return;const e=this.shadowRoot?.querySelector(".search"),t=e?.querySelector(".search-field");e&&t&&(e.style.justifyContent="center",t.style.marginLeft="",requestAnimationFrame((()=>{const i=e.getBoundingClientRect(),s=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${s}px`,this._searchPositionLocked=!0})))}_handleColumnPickerClick(){this._columnPickerOpen=!this._columnPickerOpen}_handleColumnToggle(e){this._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const s=window.getSelection();s&&s.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.columns.find((t=>t.id===e)))).sort(((e,t)=>"actions"===e.type&&"actions"!==t.type?1:"actions"!==e.type&&"actions"===t.type?-1:0))}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(".content");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle("kr-table--scroll-left-available",this._canScrollLeft),this.classList.toggle("kr-table--scroll-right-available",this._canScrollRight),this.classList.toggle("kr-table--scroll-horizontal-available",this._canScrollHorizontal),this.classList.toggle("kr-table--sticky-left",this.getDisplayedColumns().some((e=>"left"===e.sticky))),this.classList.toggle("kr-table--sticky-right",this.getDisplayedColumns().some((e=>"right"===e.sticky)))}_handleResizeStart(e,t){e.preventDefault(),this.getDisplayedColumns().forEach((e=>{if(e.width||"actions"===e.type)return;const t=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${e.id}"]`);t?.offsetWidth&&(e.width=`${t.offsetWidth}px`)}));const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${t}"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener("mousemove",this._handleResizeMove),document.addEventListener("mouseup",this._handleResizeEnd)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return H;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return j`
|
|
2261
2261
|
<span class="header-cell__sort" @click=${t=>this._handleSortClick(t,e)}>
|
|
2262
2262
|
<svg
|
|
2263
2263
|
class="header-cell__sort-arrow header-cell__sort-arrow--ghost"
|
|
@@ -2279,7 +2279,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2279
2279
|
</svg>
|
|
2280
2280
|
${this._sorts.length>1?j`
|
|
2281
2281
|
<span class="header-cell__sort-priority">${t+1}</span>
|
|
2282
|
-
`:
|
|
2282
|
+
`:H}
|
|
2283
2283
|
</span>
|
|
2284
2284
|
`}_handleAction(e){e.href||this.dispatchEvent(new CustomEvent("action",{detail:{action:e.id},bubbles:!0,composed:!0}))}_handleKqlChange(e,t){const i=e.target.value.trim();if(i){if(t.filter.setKql(i),this.requestUpdate(),!t.filter.isValid())return}else t.filter.clear(),this.requestUpdate();this._page=1,this._fetch()}_handleFilterPanelToggle(e,t){if(e.stopPropagation(),this._filterPanelOpened===t.id)this._filterPanelOpened=null;else{const i=e.currentTarget.getBoundingClientRect();let s=202;t.filterable&&(s=328),this._filterPanelPos={top:i.bottom+4,left:Math.max(0,i.right-s)},this._filterPanelOpened=t.id,t.facetable?this._filterPanelTab="counts":this._filterPanelTab="filter"}}_handleKqlClear(e){e.filter.clear(),this._page=1,this._fetch()}_handleFilterClear(){const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));e&&(e.filter.clear(),e.facetable&&!e.filterable&&(e.filter.operator="in",e.filter.value=[])),this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterTextKeydown(e,t){"Enter"===e.key&&(e.preventDefault(),this._handleFilterApply())}_handleOperatorChange(e,t){t.filter.setOperator(e.target.value),this.requestUpdate()}_handleFilterStringChange(e,t){t.filter.setValue(e.target.value),this.requestUpdate()}_handleFilterNumberChange(e,t){t.filter.setValue(Number(e.target.value)),this.requestUpdate()}_handleFilterDateChange(e,t){t.filter.setValue(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterBooleanChange(e,t){t.filter.setValue("true"===e.target.value),this.requestUpdate()}_handleFilterDateStartChange(e,t){t.filter.setStart(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterDateEndChange(e,t){t.filter.setEnd(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterNumberStartChange(e,t){t.filter.setStart(Number(e.target.value)),this.requestUpdate()}_handleFilterNumberEndChange(e,t){t.filter.setEnd(Number(e.target.value)),this.requestUpdate()}_handleFilterListChange(e,t){const i=e.target.value.split(",").map((e=>e.trim())).filter((e=>""!==e));"number"===t.type?t.filter.setValue(i.map((e=>Number(e)))):t.filter.setValue(i),this.requestUpdate()}_handleFilterApply(){this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterPanelTabChange(e){this._filterPanelTab=e.detail.activeTabId}_handleBucketToggle(e,t,i){t.filter.toggle(i.val),this._page=1,this._fetch()}_renderCellContent(e,t,i){const s=t[e.id];if(e.render)return j`<slot name="cell-${i}-${e.id}"></slot>`;if(null==s)return"";switch(e.type){case"number":return"currency"===e.format&&"number"==typeof s?s.toLocaleString("en-US",{style:"currency",currency:"USD"}):String(s);case"date":{let e;if(s instanceof Date)e=s;else if("string"==typeof s&&/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(s)){const t=s.replace(/(\d{2}:\d{2}:\d{2}):(\d+)$/,"$1.$2").replace(" ","T")+"Z";e=new Date(t)}else e=new Date(s);return e.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}case"boolean":return!0===s?"Yes":!1===s?"No":"";default:return String(s)}}_getCellStyle(e,t){const i={};if("left"===e.sticky){let e=0;for(let i=0;i<t;i++){const t=this.getDisplayedColumns()[i];"left"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.left=`${e}px`}if("right"===e.sticky){let e=0;for(let i=t+1;i<this.getDisplayedColumns().length;i++){const t=this.getDisplayedColumns()[i];"right"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.right=`${e}px`}return i}_renderPagination(){const e=(this._page-1)*this._pageSize+1,t=Math.min(this._page*this._pageSize,this._totalItems);return j`
|
|
2285
2285
|
<div class="pagination">
|
|
@@ -2301,14 +2301,14 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2301
2301
|
</svg>
|
|
2302
2302
|
</span>
|
|
2303
2303
|
</div>
|
|
2304
|
-
`}_renderCardHeader(){return"card"!==this.variant?
|
|
2304
|
+
`}_renderCardHeader(){return"card"!==this.variant?H:this._model.title||this._model.description?j`
|
|
2305
2305
|
<div class="card-header">
|
|
2306
|
-
${this._model.title?j`<h2 class="card-header__title">${this._model.title}</h2>`:
|
|
2307
|
-
${this._model.description?j`<p class="card-header__description">${this._model.description}</p>`:
|
|
2306
|
+
${this._model.title?j`<h2 class="card-header__title">${this._model.title}</h2>`:H}
|
|
2307
|
+
${this._model.description?j`<p class="card-header__description">${this._model.description}</p>`:H}
|
|
2308
2308
|
</div>
|
|
2309
|
-
`:
|
|
2309
|
+
`:H}_renderHeader(){return!this._model.title&&!this._model.actions?.length&&this._totalPages<=1?H:j`
|
|
2310
2310
|
<div class="header">
|
|
2311
|
-
${this._model.title&&"card"!==this.variant?j`<div class="title">${this._model.title}</div>`:
|
|
2311
|
+
${this._model.title&&"card"!==this.variant?j`<div class="title">${this._model.title}</div>`:H}
|
|
2312
2312
|
${"db"!==this._model.dataSource?.mode||this._model.columns.some((e=>e.searchable))?j`
|
|
2313
2313
|
<div class="search">
|
|
2314
2314
|
<!-- TODO: Saved views dropdown
|
|
@@ -2388,10 +2388,10 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2388
2388
|
>
|
|
2389
2389
|
Actions
|
|
2390
2390
|
</krs-button>
|
|
2391
|
-
`:
|
|
2391
|
+
`:H}
|
|
2392
2392
|
</div>
|
|
2393
2393
|
</div>
|
|
2394
|
-
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?j`<div class="status">Loading...</div>`:"error"===this._dataState&&0===this._data.length?j`<div class="status status--error">Error loading data</div>`:0===this._data.length?j`<div class="status">No data available</div>`:
|
|
2394
|
+
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?j`<div class="status">Loading...</div>`:"error"===this._dataState&&0===this._data.length?j`<div class="status status--error">Error loading data</div>`:0===this._data.length?j`<div class="status">No data available</div>`:H}_renderFilterPanel(){if(!this._filterPanelOpened)return H;const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));let t=j``;t="empty"===e.filter.operator||"n_empty"===e.filter.operator?j`
|
|
2395
2395
|
<input
|
|
2396
2396
|
type="text"
|
|
2397
2397
|
class="filter-panel__input"
|
|
@@ -2486,11 +2486,11 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2486
2486
|
</div>
|
|
2487
2487
|
`,s=this._buckets.get(e.id)||[];let o,r;if(o=s.length?j`
|
|
2488
2488
|
<div class="buckets">
|
|
2489
|
-
${s.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let s=e.filter.has(t.val);"n_in"===e.filter.operator&&(s=!s);let o=
|
|
2489
|
+
${s.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let s=e.filter.has(t.val);"n_in"===e.filter.operator&&(s=!s);let o=H;s&&(o=j`
|
|
2490
2490
|
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
2491
2491
|
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
|
|
2492
2492
|
</svg>
|
|
2493
|
-
`);let r=
|
|
2493
|
+
`);let r=H;return(t.count||0===t.count)&&(r=j`<span class="bucket__count">${t.count}</span>`),j`
|
|
2494
2494
|
<div
|
|
2495
2495
|
class="bucket"
|
|
2496
2496
|
@click=${i=>this._handleBucketToggle(i,e,t)}
|
|
@@ -2516,7 +2516,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2516
2516
|
${o}
|
|
2517
2517
|
</krs-tab>
|
|
2518
2518
|
</krs-tab-group>
|
|
2519
|
-
`}else r=e.facetable||e.options?.length?o:i;let n=
|
|
2519
|
+
`}else r=e.facetable||e.options?.length?o:i;let n=H;return e.filterable&&(n=j`
|
|
2520
2520
|
<div class="filter-panel__actions">
|
|
2521
2521
|
<krs-button
|
|
2522
2522
|
variant="outline"
|
|
@@ -2561,7 +2561,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2561
2561
|
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
|
2562
2562
|
</svg>
|
|
2563
2563
|
</button>
|
|
2564
|
-
`:
|
|
2564
|
+
`:H}
|
|
2565
2565
|
<button
|
|
2566
2566
|
class=${ye({"filter-cell__advanced":!0,"filter-cell__advanced--opened":this._filterPanelOpened===t.id})}
|
|
2567
2567
|
@click=${e=>this._handleFilterPanelToggle(e,t)}
|
|
@@ -2579,7 +2579,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2579
2579
|
></div>
|
|
2580
2580
|
`))}
|
|
2581
2581
|
</div>
|
|
2582
|
-
`:
|
|
2582
|
+
`:H}_renderGrid(){return j`
|
|
2583
2583
|
<div class="wrapper">
|
|
2584
2584
|
<div class="overlay-left"></div>
|
|
2585
2585
|
<div class="overlay-right"></div>
|
|
@@ -2598,7 +2598,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2598
2598
|
${!1!==e.resizable?j`<div
|
|
2599
2599
|
class="header-cell__resize"
|
|
2600
2600
|
@mousedown=${t=>this._handleResizeStart(t,e.id)}
|
|
2601
|
-
></div>`:
|
|
2601
|
+
></div>`:H}
|
|
2602
2602
|
</div>
|
|
2603
2603
|
`))}
|
|
2604
2604
|
</div>
|
|
@@ -2634,7 +2634,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
2634
2634
|
${this._renderHeader()}
|
|
2635
2635
|
${this._renderGrid()}
|
|
2636
2636
|
${this._renderFilterPanel()}
|
|
2637
|
-
`:j`<slot></slot>`}}Oi.styles=[
|
|
2637
|
+
`:j`<slot></slot>`}}Oi.styles=[Ht,n`
|
|
2638
2638
|
/* -------------------------------------------------------------------------
|
|
2639
2639
|
* Host
|
|
2640
2640
|
* ----------------------------------------------------------------------- */
|
|
@@ -3580,13 +3580,13 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
3580
3580
|
${this.label?j`
|
|
3581
3581
|
<span class="checkbox__label">
|
|
3582
3582
|
${this.label}
|
|
3583
|
-
${this.required?j`<span class="required" aria-hidden="true">*</span>`:
|
|
3583
|
+
${this.required?j`<span class="required" aria-hidden="true">*</span>`:H}
|
|
3584
3584
|
</span>
|
|
3585
|
-
`:
|
|
3585
|
+
`:H}
|
|
3586
3586
|
</div>
|
|
3587
|
-
${this._touched&&this.required&&!this.checked?j`<div class="validation-message">This field is required</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:
|
|
3587
|
+
${this._touched&&this.required&&!this.checked?j`<div class="validation-message">This field is required</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:H}
|
|
3588
3588
|
</div>
|
|
3589
|
-
`}}Ii.styles=[
|
|
3589
|
+
`}}Ii.styles=[Ht,n`
|
|
3590
3590
|
:host {
|
|
3591
3591
|
display: inline-block;
|
|
3592
3592
|
font-family: inherit;
|
|
@@ -3669,7 +3669,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
3669
3669
|
color: var(--kr-checkbox-error-color, #ef4444);
|
|
3670
3670
|
margin-left: 26px;
|
|
3671
3671
|
}
|
|
3672
|
-
`],Ii.formAssociated=!0,Ai([ce({type:String})],Ii.prototype,"label",void 0),Ai([ce({type:String})],Ii.prototype,"name",void 0),Ai([ce({type:String})],Ii.prototype,"value",void 0),Ai([ce({type:Boolean})],Ii.prototype,"checked",void 0),Ai([ce({type:Boolean})],Ii.prototype,"disabled",void 0),Ai([ce({type:Boolean})],Ii.prototype,"required",void 0),Ai([ce({type:String})],Ii.prototype,"hint",void 0),Ai([ce({type:Boolean,reflect:!0})],Ii.prototype,"dirty",void 0),Ai([ce({attribute:"save-mode"})],Ii.prototype,"saveMode",void 0),Ai([ce({type:Boolean,reflect:!0})],Ii.prototype,"saving",void 0),Ai([pe()],Ii.prototype,"_touched",void 0),customElements.get("krs-checkbox")||customElements.define("krs-checkbox",Ii);var Ri=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class Mi{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null,this.rowSelectable=!1,this.rowKey=null}}class Pi extends ae{constructor(){super(...arguments),this._scrollStyle="edge",this._filterPanelPos={top:0,left:0},this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._columnWidthsLocked=!1,this._model=new Mi,this._selectedRows=new Set,this.def={columns:[]},this.variant="default",this.scrollMode="contain",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._sorts=[],this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.columns.find((e=>e.id===this._resizing.columnId));if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener("mousemove",this._handleResizeMove),document.removeEventListener("mouseup",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle("kr-table--scroll-overlay","overlay"===this._scrollStyle),this.classList.toggle("kr-table--scroll-edge","edge"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener("click",this._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._columnWidthsLocked=!1,this._model=new Mi,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this.def.rowKey&&(this._model.rowKey=this.def.rowKey),this.def.rowSelectable&&this.def.rowKey&&(this._model.rowSelectable=!0),this._selectedRows.clear(),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable)&&(t.filter=new zi,t.filter.field=e.searchField??e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):e.facetable&&!e.filterable?(t.filter.operator="in",t.filter.value=[]):"string"===t.filter.type&&(t.filter.operator="contains")),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this.classList.toggle("kr-table--page","page"===this.variant),this.classList.toggle("kr-table--dialog","dialog"===this.variant),this.classList.toggle("kr-table--scroll-auto","auto"===this.scrollMode&&"page"!==this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(this._columnWidthsLocked||0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell:not(.header-cell--select)");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const s=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&s>0&&(t[i].width=`${s}px`,this._columnWidthsLocked=!0)}))}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const s=e.render(t);if(!s)return;const o=document.createElement("span");o.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(o.style.display="flex",o.style.gap="8px"),"string"==typeof s?o.innerHTML=s:re(s,o),this.appendChild(o)}))})))}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}getSelectedRows(){return this._model.rowSelectable?this._data.filter((e=>this._selectedRows.has(this._model.rowKey(e)))):[]}clearSelection(){this._selectedRows.clear(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("selection-change",{detail:{rows:[]},bubbles:!0,composed:!0}))}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:wi(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_toOpensearchParams(){const e={from:(this._page-1)*this._pageSize,size:this._pageSize,sort:this._sorts.map((e=>({[this._model.columns.find((t=>t.id===e.sortBy))?.searchField??e.sortBy]:e.sortDirection}))),query:{bool:{must:[],filter:[]}}};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.query.bool.filter.push(t.filter.toOpensearchData());const t=this._searchQuery?.trim().replace(/([*?\\])/g,"\\$1");return t?e.query.bool.must.push({bool:{should:this._model.columns.filter((e=>e.searchable)).map((e=>({wildcard:{[e.searchField??e.id]:{value:`*${t}*`,case_insensitive:!0}}}))),minimum_should_match:1}}):e.query.bool.must.push({match_all:{}}),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let e;this._dataState="loading",e="db"===this._model.dataSource.mode?this._toDbParams():"opensearch"===this._model.dataSource.mode?this._toOpensearchParams():"array"===this._model.dataSource.mode?void 0:this._toSolrData(),this._model.dataSource.fetch(e).then((e=>{switch(this._model.dataSource?.mode){case"array":this._data=e,this._totalItems=e.length,this._totalPages=1,this._pageSize=e.length;break;case"opensearch":this._data=(e?.data?.hits?.hits||[]).map((e=>e._source)),this._totalItems=e?.data?.hits?.total?.value??0,this._totalPages=Math.ceil(this._totalItems/this._pageSize)||1;break;case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size,this._parseFacetResults(t)}}this._dataState="success",this._updateSearchPosition()})).catch((e=>{this._dataState="error";let t="Failed to load data";e instanceof Error&&(t=e.message),hi.show({message:t,type:"error"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const s=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&s.unshift({val:null,count:e.count}),null!==e.name&&s.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)s.some((t=>t.val===e))||s.push({val:e,count:0});this._buckets.set(t.id,s)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_updateSearchPosition(){if(this._searchPositionLocked)return;if("card"===this.variant||"dialog"===this.variant)return;const e=this.shadowRoot?.querySelector(".search"),t=e?.querySelector(".search-field");e&&t&&(e.style.justifyContent="center",t.style.marginLeft="",requestAnimationFrame((()=>{const i=e.getBoundingClientRect(),s=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${s}px`,this._searchPositionLocked=!0})))}_handleColumnPickerClick(){this._columnPickerOpen=!this._columnPickerOpen}_handleColumnToggle(e){this._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const s=window.getSelection();s&&s.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}_handleSelectCellClick(e){e.stopPropagation(),e.preventDefault()}_handleRowSelectToggle(e,t){const i=this._model.rowKey(t);this._selectedRows.has(i)?this._selectedRows.delete(i):this._selectedRows.add(i),this.requestUpdate(),this.dispatchEvent(new CustomEvent("selection-change",{detail:{rows:this.getSelectedRows()},bubbles:!0,composed:!0}))}_handleSelectAllToggle(){this._data.every((e=>this._selectedRows.has(this._model.rowKey(e))))?this._data.forEach((e=>this._selectedRows.delete(this._model.rowKey(e)))):this._data.forEach((e=>this._selectedRows.add(this._model.rowKey(e)))),this.requestUpdate(),this.dispatchEvent(new CustomEvent("selection-change",{detail:{rows:this.getSelectedRows()},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.columns.find((t=>t.id===e)))).sort(((e,t)=>"actions"===e.type&&"actions"!==t.type?1:"actions"!==e.type&&"actions"===t.type?-1:0))}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(".content");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle("kr-table--scroll-left-available",this._canScrollLeft),this.classList.toggle("kr-table--scroll-right-available",this._canScrollRight),this.classList.toggle("kr-table--scroll-horizontal-available",this._canScrollHorizontal),this.classList.toggle("kr-table--sticky-left",this.getDisplayedColumns().some((e=>"left"===e.sticky))),this.classList.toggle("kr-table--sticky-right",this.getDisplayedColumns().some((e=>"right"===e.sticky)))}_handleResizeStart(e,t){e.preventDefault();const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${t}"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener("mousemove",this._handleResizeMove),document.addEventListener("mouseup",this._handleResizeEnd)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return N;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return j`
|
|
3672
|
+
`],Ii.formAssociated=!0,Ai([ce({type:String})],Ii.prototype,"label",void 0),Ai([ce({type:String})],Ii.prototype,"name",void 0),Ai([ce({type:String})],Ii.prototype,"value",void 0),Ai([ce({type:Boolean})],Ii.prototype,"checked",void 0),Ai([ce({type:Boolean})],Ii.prototype,"disabled",void 0),Ai([ce({type:Boolean})],Ii.prototype,"required",void 0),Ai([ce({type:String})],Ii.prototype,"hint",void 0),Ai([ce({type:Boolean,reflect:!0})],Ii.prototype,"dirty",void 0),Ai([ce({attribute:"save-mode"})],Ii.prototype,"saveMode",void 0),Ai([ce({type:Boolean,reflect:!0})],Ii.prototype,"saving",void 0),Ai([pe()],Ii.prototype,"_touched",void 0),customElements.get("krs-checkbox")||customElements.define("krs-checkbox",Ii);var Ri=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class Mi{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null,this.rowSelectable=!1,this.rowKey=null}}class Pi extends ae{constructor(){super(...arguments),this._scrollStyle="edge",this._filterPanelPos={top:0,left:0},this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._columnWidthsLocked=!1,this._model=new Mi,this._selectedRows=new Set,this.def={columns:[]},this.variant="default",this.scrollMode="contain",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._sorts=[],this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.columns.find((e=>e.id===this._resizing.columnId));if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener("mousemove",this._handleResizeMove),document.removeEventListener("mouseup",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle("kr-table--scroll-overlay","overlay"===this._scrollStyle),this.classList.toggle("kr-table--scroll-edge","edge"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener("click",this._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._columnWidthsLocked=!1,this._model=new Mi,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this.def.rowKey&&(this._model.rowKey=this.def.rowKey),this.def.rowSelectable&&this.def.rowKey&&(this._model.rowSelectable=!0),this._selectedRows.clear(),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable)&&(t.filter=new zi,t.filter.field=e.searchField??e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):e.facetable&&!e.filterable?(t.filter.operator="in",t.filter.value=[]):"string"===t.filter.type&&(t.filter.operator="contains")),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this.classList.toggle("kr-table--page","page"===this.variant),this.classList.toggle("kr-table--dialog","dialog"===this.variant),this.classList.toggle("kr-table--scroll-auto","auto"===this.scrollMode&&"page"!==this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(this._columnWidthsLocked||0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell:not(.header-cell--select)");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const s=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&s>0&&(t[i].width=`${s}px`,this._columnWidthsLocked=!0)}))}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const s=e.render(t);if(!s)return;const o=document.createElement("span");o.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(o.style.display="flex",o.style.gap="8px"),"string"==typeof s?o.innerHTML=s:re(s,o),this.appendChild(o)}))})))}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}getSelectedRows(){return this._model.rowSelectable?this._data.filter((e=>this._selectedRows.has(this._model.rowKey(e)))):[]}clearSelection(){this._selectedRows.clear(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("selection-change",{detail:{rows:[]},bubbles:!0,composed:!0}))}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:wi(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_toOpensearchParams(){const e={from:(this._page-1)*this._pageSize,size:this._pageSize,sort:this._sorts.map((e=>({[this._model.columns.find((t=>t.id===e.sortBy))?.searchField??e.sortBy]:e.sortDirection}))),query:{bool:{must:[],filter:[]}}};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.query.bool.filter.push(t.filter.toOpensearchData());const t=this._searchQuery?.trim().replace(/([*?\\])/g,"\\$1");return t?e.query.bool.must.push({bool:{should:this._model.columns.filter((e=>e.searchable)).map((e=>({wildcard:{[e.searchField??e.id]:{value:`*${t}*`,case_insensitive:!0}}}))),minimum_should_match:1}}):e.query.bool.must.push({match_all:{}}),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let e;this._dataState="loading",e="db"===this._model.dataSource.mode?this._toDbParams():"opensearch"===this._model.dataSource.mode?this._toOpensearchParams():"array"===this._model.dataSource.mode?void 0:this._toSolrData(),this._model.dataSource.fetch(e).then((e=>{switch(this._model.dataSource?.mode){case"array":this._data=e,this._totalItems=e.length,this._totalPages=1,this._pageSize=e.length;break;case"opensearch":this._data=(e?.data?.hits?.hits||[]).map((e=>e._source)),this._totalItems=e?.data?.hits?.total?.value??0,this._totalPages=Math.ceil(this._totalItems/this._pageSize)||1;break;case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size,this._parseFacetResults(t)}}this._dataState="success",this._updateSearchPosition()})).catch((e=>{this._dataState="error";let t="Failed to load data";e instanceof Error&&(t=e.message),hi.show({message:t,type:"error"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const s=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&s.unshift({val:null,count:e.count}),null!==e.name&&s.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)s.some((t=>t.val===e))||s.push({val:e,count:0});this._buckets.set(t.id,s)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_updateSearchPosition(){if(this._searchPositionLocked)return;if("card"===this.variant||"dialog"===this.variant)return;const e=this.shadowRoot?.querySelector(".search"),t=e?.querySelector(".search-field");e&&t&&(e.style.justifyContent="center",t.style.marginLeft="",requestAnimationFrame((()=>{const i=e.getBoundingClientRect(),s=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${s}px`,this._searchPositionLocked=!0})))}_handleColumnPickerClick(){this._columnPickerOpen=!this._columnPickerOpen}_handleColumnToggle(e){this._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const s=window.getSelection();s&&s.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}_handleSelectCellClick(e){e.stopPropagation(),e.preventDefault()}_handleRowSelectToggle(e,t){const i=this._model.rowKey(t);this._selectedRows.has(i)?this._selectedRows.delete(i):this._selectedRows.add(i),this.requestUpdate(),this.dispatchEvent(new CustomEvent("selection-change",{detail:{rows:this.getSelectedRows()},bubbles:!0,composed:!0}))}_handleSelectAllToggle(){this._data.every((e=>this._selectedRows.has(this._model.rowKey(e))))?this._data.forEach((e=>this._selectedRows.delete(this._model.rowKey(e)))):this._data.forEach((e=>this._selectedRows.add(this._model.rowKey(e)))),this.requestUpdate(),this.dispatchEvent(new CustomEvent("selection-change",{detail:{rows:this.getSelectedRows()},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.columns.find((t=>t.id===e)))).sort(((e,t)=>"actions"===e.type&&"actions"!==t.type?1:"actions"!==e.type&&"actions"===t.type?-1:0))}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(".content");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle("kr-table--scroll-left-available",this._canScrollLeft),this.classList.toggle("kr-table--scroll-right-available",this._canScrollRight),this.classList.toggle("kr-table--scroll-horizontal-available",this._canScrollHorizontal),this.classList.toggle("kr-table--sticky-left",this.getDisplayedColumns().some((e=>"left"===e.sticky))),this.classList.toggle("kr-table--sticky-right",this.getDisplayedColumns().some((e=>"right"===e.sticky)))}_handleResizeStart(e,t){e.preventDefault();const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${t}"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener("mousemove",this._handleResizeMove),document.addEventListener("mouseup",this._handleResizeEnd)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return H;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return j`
|
|
3673
3673
|
<span class="header-cell__sort" @click=${t=>this._handleSortClick(t,e)}>
|
|
3674
3674
|
<svg
|
|
3675
3675
|
class="header-cell__sort-arrow header-cell__sort-arrow--ghost"
|
|
@@ -3691,7 +3691,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
3691
3691
|
</svg>
|
|
3692
3692
|
${this._sorts.length>1?j`
|
|
3693
3693
|
<span class="header-cell__sort-priority">${t+1}</span>
|
|
3694
|
-
`:
|
|
3694
|
+
`:H}
|
|
3695
3695
|
</span>
|
|
3696
3696
|
`}_handleAction(e){e.href||this.dispatchEvent(new CustomEvent("action",{detail:{action:e.id},bubbles:!0,composed:!0}))}showActionLoading(){this.shadowRoot?.querySelector(".actions")?.showLoading()}showActionSuccess(e="Done"){this.shadowRoot?.querySelector(".actions")?.showSuccess(e)}showActionError(e="Failed"){this.shadowRoot?.querySelector(".actions")?.showError(e)}resetAction(){this.shadowRoot?.querySelector(".actions")?.reset()}_handleKqlChange(e,t){const i=e.target.value.trim();if(i){if(t.filter.setKql(i),this.requestUpdate(),!t.filter.isValid())return}else t.filter.clear(),this.requestUpdate();this._page=1,this._fetch()}_handleFilterPanelToggle(e,t){if(e.stopPropagation(),this._filterPanelOpened===t.id)this._filterPanelOpened=null;else{const i=e.currentTarget.getBoundingClientRect();let s=i.left;s+328>window.innerWidth&&(s=window.innerWidth-328),this._filterPanelPos={top:i.bottom+4,left:s},this._filterPanelOpened=t.id,t.facetable?this._filterPanelTab="counts":this._filterPanelTab="filter"}}_handleKqlClear(e){e.filter.clear(),this._page=1,this._fetch()}_handleFilterClear(){const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));e&&(e.filter.clear(),e.facetable&&!e.filterable&&(e.filter.operator="in",e.filter.value=[])),this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterTextKeydown(e,t){"Enter"===e.key&&(e.preventDefault(),this._handleFilterApply())}_handleOperatorChange(e,t){t.filter.setOperator(e.target.value),this.requestUpdate()}_handleFilterStringChange(e,t){t.filter.setValue(e.target.value),this.requestUpdate()}_handleFilterNumberChange(e,t){t.filter.setValue(Number(e.target.value)),this.requestUpdate()}_handleFilterDateChange(e,t){t.filter.setValue(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterBooleanChange(e,t){t.filter.setValue("true"===e.target.value),this.requestUpdate()}_handleFilterDateStartChange(e,t){t.filter.setStart(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterDateEndChange(e,t){t.filter.setEnd(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterNumberStartChange(e,t){t.filter.setStart(Number(e.target.value)),this.requestUpdate()}_handleFilterNumberEndChange(e,t){t.filter.setEnd(Number(e.target.value)),this.requestUpdate()}_handleFilterListChange(e,t){const i=e.target.value.split(",").map((e=>e.trim())).filter((e=>""!==e));"number"===t.type?t.filter.setValue(i.map((e=>Number(e)))):t.filter.setValue(i),this.requestUpdate()}_handleFilterApply(){this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterPanelTabChange(e){this._filterPanelTab=e.detail.activeTabId}_handleBucketToggle(e,t,i){t.filter.toggle(i.val),this._page=1,this._fetch()}_renderCellContent(e,t,i){const s=t[e.id];if(e.render)return j`<slot name="cell-${i}-${e.id}"></slot>`;if(null==s)return"";switch(e.type){case"number":return"currency"===e.format&&"number"==typeof s?s.toLocaleString("en-US",{style:"currency",currency:"USD"}):String(s);case"date":{let e;if(s instanceof Date)e=s;else if("string"==typeof s&&/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(s)){const t=s.replace(/(\d{2}:\d{2}:\d{2}):(\d+)$/,"$1.$2").replace(" ","T")+"Z";e=new Date(t)}else e=new Date(s);return e.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}case"boolean":return!0===s?"Yes":!1===s?"No":"";default:return String(s)}}_getCellStyle(e,t){const i={};if("left"===e.sticky){let e=0;this._model.rowSelectable&&(e+=54);for(let i=0;i<t;i++){const t=this.getDisplayedColumns()[i];"left"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.left=`${e}px`}if("right"===e.sticky){let e=0;for(let i=t+1;i<this.getDisplayedColumns().length;i++){const t=this.getDisplayedColumns()[i];"right"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.right=`${e}px`}return i}_renderPagination(){const e=(this._page-1)*this._pageSize+1,t=Math.min(this._page*this._pageSize,this._totalItems);return j`
|
|
3697
3697
|
<div class="pagination">
|
|
@@ -3713,26 +3713,26 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
3713
3713
|
</svg>
|
|
3714
3714
|
</span>
|
|
3715
3715
|
</div>
|
|
3716
|
-
`}_renderCardHeader(){return"card"!==this.variant?
|
|
3716
|
+
`}_renderCardHeader(){return"card"!==this.variant?H:this._model.title||this._model.description?j`
|
|
3717
3717
|
<div class="card-header">
|
|
3718
3718
|
${this._model.title?j`
|
|
3719
3719
|
<h2 class="card-header__title">
|
|
3720
3720
|
${this._model.title}
|
|
3721
3721
|
</h2>
|
|
3722
|
-
`:
|
|
3722
|
+
`:H}
|
|
3723
3723
|
${this._model.description?j`
|
|
3724
3724
|
<p class="card-header__description">
|
|
3725
3725
|
${this._model.description}
|
|
3726
3726
|
</p>
|
|
3727
|
-
`:
|
|
3727
|
+
`:H}
|
|
3728
3728
|
</div>
|
|
3729
|
-
`:
|
|
3729
|
+
`:H}_renderHeader(){if("dialog"!==this.variant&&!this._model.title&&!this._model.actions?.length&&this._totalPages<=1)return H;let e=!0;return"array"===this._model.dataSource?.mode?e=!1:"db"!==this._model.dataSource?.mode||this._model.columns.some((e=>e.searchable))||(e=!1),j`
|
|
3730
3730
|
<div class="header">
|
|
3731
3731
|
${this._model.title&&"card"!==this.variant&&"dialog"!==this.variant?j`
|
|
3732
3732
|
<div class="title">
|
|
3733
3733
|
${this._model.title}
|
|
3734
3734
|
</div>
|
|
3735
|
-
`:
|
|
3735
|
+
`:H}
|
|
3736
3736
|
${this._renderPagination()}
|
|
3737
3737
|
${e?j`
|
|
3738
3738
|
<div class="search">
|
|
@@ -3812,10 +3812,10 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
3812
3812
|
>
|
|
3813
3813
|
Actions
|
|
3814
3814
|
</krs-button>
|
|
3815
|
-
`:
|
|
3815
|
+
`:H}
|
|
3816
3816
|
</div>
|
|
3817
3817
|
</div>
|
|
3818
|
-
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?j`<div class="status">Loading...</div>`:"error"===this._dataState&&0===this._data.length?j`<div class="status status--error">Error loading data</div>`:0===this._data.length?j`<div class="status">No data available</div>`:
|
|
3818
|
+
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?j`<div class="status">Loading...</div>`:"error"===this._dataState&&0===this._data.length?j`<div class="status status--error">Error loading data</div>`:0===this._data.length?j`<div class="status">No data available</div>`:H}_renderFilterPanel(){if(!this._filterPanelOpened)return H;const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));let t=j``;t="empty"===e.filter.operator||"n_empty"===e.filter.operator?j`
|
|
3819
3819
|
<input
|
|
3820
3820
|
type="text"
|
|
3821
3821
|
class="filter-panel__input"
|
|
@@ -3910,7 +3910,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
3910
3910
|
</div>
|
|
3911
3911
|
`,s=this._buckets.get(e.id)||[];let o,r;return o=s.length?j`
|
|
3912
3912
|
<div class="buckets">
|
|
3913
|
-
${s.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let s=e.filter.has(t.val);"n_in"===e.filter.operator&&(s=!s);let o=
|
|
3913
|
+
${s.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let s=e.filter.has(t.val);"n_in"===e.filter.operator&&(s=!s);let o=H;return s&&(o=j`
|
|
3914
3914
|
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
3915
3915
|
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
|
|
3916
3916
|
</svg>
|
|
@@ -3962,7 +3962,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
3962
3962
|
</div>
|
|
3963
3963
|
`}_renderFilterRow(){const e=this.getDisplayedColumns();return e.some((e=>e.filterable||e.facetable))?j`
|
|
3964
3964
|
<div class="filter-row">
|
|
3965
|
-
${this._model.rowSelectable?j`<div class="filter-cell filter-cell--select"></div>`:
|
|
3965
|
+
${this._model.rowSelectable?j`<div class="filter-cell filter-cell--select"></div>`:H}
|
|
3966
3966
|
${e.map(((t,i)=>t.filterable||t.facetable?j`
|
|
3967
3967
|
<div
|
|
3968
3968
|
class=${ye({"filter-cell":!0,"filter-cell--sticky-left":"left"===t.sticky,"filter-cell--sticky-right":"right"===t.sticky,"filter-cell--sticky-right-first":"right"===t.sticky&&!e.slice(0,i).some((e=>"right"===e.sticky))})}
|
|
@@ -3984,7 +3984,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
3984
3984
|
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
|
3985
3985
|
</svg>
|
|
3986
3986
|
</button>
|
|
3987
|
-
`:
|
|
3987
|
+
`:H}
|
|
3988
3988
|
<button
|
|
3989
3989
|
class=${ye({"filter-cell__advanced":!0,"filter-cell__advanced--opened":this._filterPanelOpened===t.id})}
|
|
3990
3990
|
@click=${e=>this._handleFilterPanelToggle(e,t)}
|
|
@@ -4000,7 +4000,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
4000
4000
|
style=${we(this._getCellStyle(t,i))}
|
|
4001
4001
|
></div>`))}
|
|
4002
4002
|
</div>
|
|
4003
|
-
`:
|
|
4003
|
+
`:H}_renderTable(){const e=this.getDisplayedColumns().map((e=>e.width?e.width:"actions"===e.type?"max-content":"minmax(80px, auto)"));return this._model.rowSelectable&&e.unshift("54px"),j`
|
|
4004
4004
|
<div class="wrapper">
|
|
4005
4005
|
<div class="overlay-left"></div>
|
|
4006
4006
|
<div class="overlay-right"></div>
|
|
@@ -4016,7 +4016,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
4016
4016
|
@change=${this._handleSelectAllToggle}
|
|
4017
4017
|
></krs-checkbox>
|
|
4018
4018
|
</div>
|
|
4019
|
-
`:
|
|
4019
|
+
`:H}
|
|
4020
4020
|
${this.getDisplayedColumns().map(((e,t)=>j`
|
|
4021
4021
|
<div
|
|
4022
4022
|
class=${ye({"header-cell":!0,"header-cell--sortable":!!e.sortable,"header-cell--align-center":"center"===e.align,"header-cell--align-right":"right"===e.align,"header-cell--sticky-left":"left"===e.sticky,"header-cell--sticky-left-last":"left"===e.sticky&&!this.getDisplayedColumns().slice(t+1).some((e=>"left"===e.sticky)),"header-cell--sticky-right":"right"===e.sticky,"header-cell--sticky-right-first":"right"===e.sticky&&!this.getDisplayedColumns().slice(0,t).some((e=>"right"===e.sticky))})}
|
|
@@ -4028,7 +4028,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
4028
4028
|
${!1!==e.resizable?j`<div
|
|
4029
4029
|
class="header-cell__resize"
|
|
4030
4030
|
@mousedown=${t=>this._handleResizeStart(t,e.id)}
|
|
4031
|
-
></div>`:
|
|
4031
|
+
></div>`:H}
|
|
4032
4032
|
</div>
|
|
4033
4033
|
`))}
|
|
4034
4034
|
</div>
|
|
@@ -4072,7 +4072,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
4072
4072
|
${this._renderHeader()}
|
|
4073
4073
|
${this._renderTable()}
|
|
4074
4074
|
${this._renderFilterPanel()}
|
|
4075
|
-
`:j`<slot></slot>`}}Pi.styles=[
|
|
4075
|
+
`:j`<slot></slot>`}}Pi.styles=[Ht,n`
|
|
4076
4076
|
/* -------------------------------------------------------------------------
|
|
4077
4077
|
* Host
|
|
4078
4078
|
* ----------------------------------------------------------------------- */
|
|
@@ -5166,10 +5166,10 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
5166
5166
|
</button>
|
|
5167
5167
|
${this.title||this.description?j`
|
|
5168
5168
|
<div class="dialog__header">
|
|
5169
|
-
${this.title?j`<h2 class="dialog__title">${this.title}</h2>`:
|
|
5170
|
-
${this.description?j`<p class="dialog__description">${this.description}</p>`:
|
|
5169
|
+
${this.title?j`<h2 class="dialog__title">${this.title}</h2>`:H}
|
|
5170
|
+
${this.description?j`<p class="dialog__description">${this.description}</p>`:H}
|
|
5171
5171
|
</div>
|
|
5172
|
-
`:
|
|
5172
|
+
`:H}
|
|
5173
5173
|
<div class="dialog__body">
|
|
5174
5174
|
<krs-grid variant="dialog" .def=${this.def}></krs-grid>
|
|
5175
5175
|
${this.actions.length?j`
|
|
@@ -5185,10 +5185,10 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
5185
5185
|
</krs-button>
|
|
5186
5186
|
`))}
|
|
5187
5187
|
</div>
|
|
5188
|
-
`:
|
|
5188
|
+
`:H}
|
|
5189
5189
|
</div>
|
|
5190
5190
|
</div>
|
|
5191
|
-
`}}Vi.styles=[
|
|
5191
|
+
`}}Vi.styles=[Ht,n`
|
|
5192
5192
|
:host {
|
|
5193
5193
|
position: fixed;
|
|
5194
5194
|
inset: 0;
|
|
@@ -5357,7 +5357,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
5357
5357
|
stroke: currentColor;
|
|
5358
5358
|
stroke-linecap: round;
|
|
5359
5359
|
}
|
|
5360
|
-
`,Fi([ce({type:String,reflect:!0})],Bi.prototype,"size",void 0),Fi([ce({type:String,reflect:!0})],Bi.prototype,"color",void 0),customElements.get("krs-spinner")||customElements.define("krs-spinner",Bi);var ji=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class
|
|
5360
|
+
`,Fi([ce({type:String,reflect:!0})],Bi.prototype,"size",void 0),Fi([ce({type:String,reflect:!0})],Bi.prototype,"color",void 0),customElements.get("krs-spinner")||customElements.define("krs-spinner",Bi);var ji=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class Ni extends ae{constructor(){super(...arguments),this.color="dark"}render(){let e="",t="";return e="dark"===this.color?"#163052":"light"===this.color?"#ffffff":this.color,t=this.trackColor?this.trackColor:"light"===this.color?"#ffffff4d":"#0000001a",j`
|
|
5361
5361
|
<div
|
|
5362
5362
|
class="progress-bar"
|
|
5363
5363
|
style=${we({background:t})}
|
|
@@ -5366,7 +5366,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
5366
5366
|
>
|
|
5367
5367
|
<div class="fill" style=${we({background:e})}></div>
|
|
5368
5368
|
</div>
|
|
5369
|
-
`}}
|
|
5369
|
+
`}}Ni.styles=n`
|
|
5370
5370
|
:host {
|
|
5371
5371
|
display: block;
|
|
5372
5372
|
width: 100%;
|
|
@@ -5398,7 +5398,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
5398
5398
|
left: 100%;
|
|
5399
5399
|
}
|
|
5400
5400
|
}
|
|
5401
|
-
`,ji([ce({type:String,reflect:!0})],
|
|
5401
|
+
`,ji([ce({type:String,reflect:!0})],Ni.prototype,"color",void 0),ji([ce({type:String,reflect:!0})],Ni.prototype,"trackColor",void 0),customElements.get("krs-progress-bar")||customElements.define("krs-progress-bar",Ni);var Hi=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class Ui extends ae{constructor(){super(...arguments),this._zoom=100,this._panX=0,this._panY=0,this._dragging=!1,this._dragStartX=0,this._dragStartY=0,this._panStartX=0,this._panStartY=0,this.src="",this.name="",this._zoomLevel=100,this._textContent=null,this._handleKeydown=e=>{"Escape"===e.key&&this._close()},this._close=()=>{this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})),Ui._activePreview===this&&(Ui._activePreview=null),this.remove()},this._handleDragMove=e=>{this._dragging&&(this._panX=this._panStartX+(e.clientX-this._dragStartX),this._panY=this._panStartY+(e.clientY-this._dragStartY),this.requestUpdate())},this._handleDragEnd=()=>{this._dragging=!1,document.removeEventListener("mousemove",this._handleDragMove),document.removeEventListener("mouseup",this._handleDragEnd)}}static open(e){this._activePreview&&this._activePreview._close();const t=document.createElement("krs-file-preview");return t.src=e.src,t.name=e.name,document.body.appendChild(t),this._activePreview=t,t}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._handleKeydown),this._isText()&&this._loadTextContent()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleKeydown)}_handleDownload(){this.dispatchEvent(new CustomEvent("download",{bubbles:!0,composed:!0,detail:{src:this.src,name:this.name}}))}_handleZoomIn(){this._zoomLevel=Math.min(this._zoomLevel+25,300),this._zoomLevel<=100&&(this._panX=0,this._panY=0)}_handleZoomOut(){this._zoomLevel=Math.max(this._zoomLevel-25,25),this._zoomLevel<=100&&(this._panX=0,this._panY=0)}_handleZoomReset(){this._zoomLevel=100,this._panX=0,this._panY=0}_handleDragStart(e){this._zoomLevel<=100||(e.preventDefault(),this._dragging=!0,this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._panStartX=this._panX,this._panStartY=this._panY,document.addEventListener("mousemove",this._handleDragMove),document.addEventListener("mouseup",this._handleDragEnd))}_handleBackdropClick(e){e.target===e.currentTarget&&this._close()}_getExtension(){return(this.name||"").split(".").pop()?.toLowerCase()||""}_isImage(){return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(this._getExtension())}_isText(){return["csv","txt","json","xml","log","md","yml","yaml","ini","cfg","conf","env","sh","bat"].includes(this._getExtension())}_loadTextContent(){fetch(this.src).then((e=>e.text())).then((e=>{if(this._textContent=e,"csv"!==this._getExtension())return;const t=e.trim().split("\n");if(!t.length)return;const i=t.map((e=>e.split(",").map((e=>e.trim())))),s=Math.max(...i.map((e=>e.length))),o=[];for(let e=0;e<s;e++){let t=0;for(const s of i){const i=(s[e]||"").length;i>t&&(t=i)}o.push(t)}this._textContent=i.map((e=>e.map(((e,t)=>e.padEnd(o[t]||0))).join(" "))).join("\n")})).catch((()=>{this._textContent="Failed to load file content."}))}_renderFallbackIcon(e){return["doc","docx","rtf","txt"].includes(e)?j`<svg
|
|
5402
5402
|
xmlns="http://www.w3.org/2000/svg"
|
|
5403
5403
|
viewBox="0 0 24 24"
|
|
5404
5404
|
fill="currentColor"
|
|
@@ -5483,7 +5483,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
5483
5483
|
</svg>
|
|
5484
5484
|
</button>
|
|
5485
5485
|
<div class="toolbar__separator"></div>
|
|
5486
|
-
`:
|
|
5486
|
+
`:H}
|
|
5487
5487
|
<button
|
|
5488
5488
|
class="toolbar__btn"
|
|
5489
5489
|
@click=${this._handleDownload}
|
|
@@ -5707,7 +5707,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
5707
5707
|
height: 18px;
|
|
5708
5708
|
fill: currentColor;
|
|
5709
5709
|
}
|
|
5710
|
-
`,Ui._activePreview=null,
|
|
5710
|
+
`,Ui._activePreview=null,Hi([ce({type:String})],Ui.prototype,"src",void 0),Hi([ce({type:String})],Ui.prototype,"name",void 0),Hi([pe()],Ui.prototype,"_zoomLevel",void 0),Hi([pe()],Ui.prototype,"_textContent",void 0),customElements.get("krs-file-preview")||customElements.define("krs-file-preview",Ui);var Wi=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class Ki extends ae{constructor(){super(...arguments),this.files=[],this.emptyMessage="No files"}_handleFileClick(e){if(this.dispatchEvent(new CustomEvent("file-click",{bubbles:!0,composed:!0,detail:{file:e}})),e.url){Ui.open({src:e.url,name:e.name}).addEventListener("download",(()=>{this._handleDownload(e)}))}}_handleDownload(e){this.dispatchEvent(new CustomEvent("download",{bubbles:!0,composed:!0,detail:{file:e}}))}_handleDelete(e){this.dispatchEvent(new CustomEvent("delete",{bubbles:!0,composed:!0,detail:{file:e}}))}_renderExtIcon(e){return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(e)?j`
|
|
5711
5711
|
<svg
|
|
5712
5712
|
xmlns="http://www.w3.org/2000/svg"
|
|
5713
5713
|
viewBox="0 0 24 24"
|
|
@@ -5915,12 +5915,12 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
5915
5915
|
* @license
|
|
5916
5916
|
* Copyright 2018 Google LLC
|
|
5917
5917
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5918
|
-
*/;const Yi=e=>e??
|
|
5918
|
+
*/;const Yi=e=>e??H
|
|
5919
5919
|
/**
|
|
5920
5920
|
* @license
|
|
5921
5921
|
* Copyright 2020 Google LLC
|
|
5922
5922
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5923
|
-
*/,Xi=_e(class extends ve{constructor(e){if(super(e),e.type!==be&&e.type!==ge&&e.type!==me)throw Error("The `live` directive is not allowed on child or event bindings");if(!(e=>void 0===e.strings)(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===
|
|
5923
|
+
*/,Xi=_e(class extends ve{constructor(e){if(super(e),e.type!==be&&e.type!==ge&&e.type!==me)throw Error("The `live` directive is not allowed on child or event bindings");if(!(e=>void 0===e.strings)(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===N||t===H)return t;const i=e.element,s=e.name;if(e.type===be){if(t===i[s])return N}else if(e.type===me){if(!!t===i.hasAttribute(s))return N}else if(e.type===ge&&i.getAttribute(s)===t+"")return N;return Oe(e),t}});var Zi=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class Qi extends ae{constructor(){super(),this._dirtyValue="",this.label="",this.name="",this.value="",this.valueAsNumber=null,this.placeholder="",this.type="text",this.required=!1,this.disabled=!1,this.readonly=!1,this.autocomplete="",this.hint="",this.dirty=!1,this.saving=!1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.classList.add("kr-form-field"),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("value")&&this.dirty&&this.value!==this._dirtyValue&&"autosave"===t&&(this.value=this._dirtyValue)}updated(e){if((e.has("required")||e.has("value"))&&this._updateValidity(),e.has("value")){const e=Number(this.value);""===this.value||Number.isNaN(e)?this.valueAsNumber=null:this.valueAsNumber=e}}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this.dirty=!1,this.saving=!1,this._internals.setFormValue(""),this._internals.setValidity({})}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyValue=this.value}formStateRestoreCallback(e){this.value=e}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleInput(e){this.value=e.target.value,this.dirty=!0,this._dirtyValue=this.value,this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleChange(e){this.value=e.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage)}render(){let e="";return this._touched&&this._input&&!this._input.validity.valid&&(e=this._input.validationMessage),j`
|
|
5924
5924
|
<div class="wrapper">
|
|
5925
5925
|
${this.label?j`
|
|
5926
5926
|
<label for="input">
|
|
@@ -6020,9 +6020,9 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
6020
6020
|
${this.label?j`
|
|
6021
6021
|
<label for="textarea">
|
|
6022
6022
|
${this.label}
|
|
6023
|
-
${this.required?j`<span class="required" aria-hidden="true">*</span>`:
|
|
6023
|
+
${this.required?j`<span class="required" aria-hidden="true">*</span>`:H}
|
|
6024
6024
|
</label>
|
|
6025
|
-
`:
|
|
6025
|
+
`:H}
|
|
6026
6026
|
<textarea
|
|
6027
6027
|
id="textarea"
|
|
6028
6028
|
class=${ye({"textarea--invalid":this._touched&&this._textarea&&!this._textarea.validity.valid})}
|
|
@@ -6041,7 +6041,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
6041
6041
|
@change=${this._handleChange}
|
|
6042
6042
|
@blur=${this._handleBlur}
|
|
6043
6043
|
></textarea>
|
|
6044
|
-
${e?j`<div class="validation-message">${e}</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:
|
|
6044
|
+
${e?j`<div class="validation-message">${e}</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:H}
|
|
6045
6045
|
</div>
|
|
6046
6046
|
`}}Gi.styles=n`
|
|
6047
6047
|
:host {
|
|
@@ -6115,7 +6115,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
6115
6115
|
}
|
|
6116
6116
|
`,Gi.formAssociated=!0,Ji([ce({type:String})],Gi.prototype,"label",void 0),Ji([ce({type:String})],Gi.prototype,"name",void 0),Ji([ce({type:String})],Gi.prototype,"value",void 0),Ji([ce({type:String})],Gi.prototype,"placeholder",void 0),Ji([ce({type:Boolean})],Gi.prototype,"required",void 0),Ji([ce({type:Boolean})],Gi.prototype,"disabled",void 0),Ji([ce({type:Boolean})],Gi.prototype,"readonly",void 0),Ji([ce({type:Number})],Gi.prototype,"rows",void 0),Ji([ce({type:Number})],Gi.prototype,"cols",void 0),Ji([ce({type:Number})],Gi.prototype,"minlength",void 0),Ji([ce({type:Number})],Gi.prototype,"maxlength",void 0),Ji([ce({type:String})],Gi.prototype,"autocomplete",void 0),Ji([ce({type:String})],Gi.prototype,"hint",void 0),Ji([ce({type:Boolean,reflect:!0})],Gi.prototype,"dirty",void 0),Ji([ce({attribute:"save-mode"})],Gi.prototype,"saveMode",void 0),Ji([ce({type:Boolean,reflect:!0})],Gi.prototype,"saving",void 0),Ji([pe()],Gi.prototype,"_touched",void 0),Ji([ue("textarea")],Gi.prototype,"_textarea",void 0),customElements.get("krs-textarea-field")||customElements.define("krs-textarea-field",Gi);var es=function(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class ts extends ae{constructor(){super(...arguments),this.label="",this.value=""}render(){let e=!1;""!==this.value&&null!==this.value&&void 0!==this.value||(e=!0);let t=this.value;return e&&(t="None"),j`
|
|
6117
6117
|
<div class="wrapper">
|
|
6118
|
-
${this.label?j`<label>${this.label}</label>`:
|
|
6118
|
+
${this.label?j`<label>${this.label}</label>`:H}
|
|
6119
6119
|
<div class=${ye({value:!0,"value--empty":e})}>${t}</div>
|
|
6120
6120
|
</div>
|
|
6121
6121
|
`}}ts.styles=n`
|
|
@@ -6156,14 +6156,14 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
6156
6156
|
>
|
|
6157
6157
|
${e.label||e.value}
|
|
6158
6158
|
</button>
|
|
6159
|
-
`}render(){let e=
|
|
6159
|
+
`}render(){let e=H;return this._touched&&this._input&&!this._input.validity.valid?e=j`<div class="validation-message">${this._input.validationMessage}</div>`:this.hint&&(e=j`<div class="hint">${this.hint}</div>`),j`
|
|
6160
6160
|
<div class="wrapper">
|
|
6161
6161
|
${this.label?j`
|
|
6162
6162
|
<label>
|
|
6163
6163
|
${this.label}
|
|
6164
|
-
${this.required?j`<span class="required">*</span>`:
|
|
6164
|
+
${this.required?j`<span class="required">*</span>`:H}
|
|
6165
6165
|
</label>
|
|
6166
|
-
`:
|
|
6166
|
+
`:H}
|
|
6167
6167
|
|
|
6168
6168
|
<div class="input-wrapper">
|
|
6169
6169
|
<input
|
|
@@ -6186,7 +6186,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
6186
6186
|
@keydown=${this._handleKeyDown}
|
|
6187
6187
|
/>
|
|
6188
6188
|
<div class="icon-wrapper">
|
|
6189
|
-
${!this.value||this.disabled||this.readonly?
|
|
6189
|
+
${!this.value||this.disabled||this.readonly?H:j`
|
|
6190
6190
|
<svg
|
|
6191
6191
|
class="clear"
|
|
6192
6192
|
viewBox="0 0 24 24"
|
|
@@ -6197,7 +6197,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
6197
6197
|
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
|
6198
6198
|
</svg>
|
|
6199
6199
|
`}
|
|
6200
|
-
${this.value||this.disabled||this.readonly?
|
|
6200
|
+
${this.value||this.disabled||this.readonly?H:j`
|
|
6201
6201
|
<svg
|
|
6202
6202
|
class="search-icon"
|
|
6203
6203
|
viewBox="0 0 24 24"
|
|
@@ -6393,17 +6393,17 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
6393
6393
|
?disabled=${e.disabled}
|
|
6394
6394
|
@click=${t=>this._handleCheckboxClick(t,e)}
|
|
6395
6395
|
></krs-checkbox>
|
|
6396
|
-
`:
|
|
6396
|
+
`:H}
|
|
6397
6397
|
${this._getOptionLabel(e)}
|
|
6398
6398
|
</button>
|
|
6399
|
-
`}render(){let e=!!this._selectedOption,t=this.placeholder;if(this.multiple){let i=[];Array.isArray(this.value)&&(i=this.value),e=i.length>0,e&&(t=i.map((e=>{const t=this._selectedOptions.get(e);return t?this._getOptionLabel(t):e})).join(", "))}else this._selectedOption?t=this._getOptionLabel(this._selectedOption):this.value&&!this.fetchSelection&&(e=!0,t=this.value);let i=
|
|
6399
|
+
`}render(){let e=!!this._selectedOption,t=this.placeholder;if(this.multiple){let i=[];Array.isArray(this.value)&&(i=this.value),e=i.length>0,e&&(t=i.map((e=>{const t=this._selectedOptions.get(e);return t?this._getOptionLabel(t):e})).join(", "))}else this._selectedOption?t=this._getOptionLabel(this._selectedOption):this.value&&!this.fetchSelection&&(e=!0,t=this.value);let i=H;return this._touched&&this.required&&!e?i=j`<div class="validation-message">Please select an option</div>`:this.hint&&(i=j`<div class="hint">${this.hint}</div>`),j`
|
|
6400
6400
|
<div class="wrapper">
|
|
6401
6401
|
${this.label?j`
|
|
6402
6402
|
<label>
|
|
6403
6403
|
${this.label}
|
|
6404
|
-
${this.required?j`<span class="required">*</span>`:
|
|
6404
|
+
${this.required?j`<span class="required">*</span>`:H}
|
|
6405
6405
|
</label>
|
|
6406
|
-
`:
|
|
6406
|
+
`:H}
|
|
6407
6407
|
|
|
6408
6408
|
<button
|
|
6409
6409
|
class=${ye({trigger:!0,"trigger--open":this._isOpen,"trigger--invalid":this._touched&&this.required&&!e})}
|
|
@@ -6418,7 +6418,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
6418
6418
|
<span class=${ye({trigger__value:!0,trigger__placeholder:!e})}>
|
|
6419
6419
|
${t}
|
|
6420
6420
|
</span>
|
|
6421
|
-
${!this.clearable||this.multiple||!e||this.disabled||this.readonly?
|
|
6421
|
+
${!this.clearable||this.multiple||!e||this.disabled||this.readonly?H:j`
|
|
6422
6422
|
<svg
|
|
6423
6423
|
class="trigger__clear"
|
|
6424
6424
|
viewBox="0 0 24 24"
|
|
@@ -6705,9 +6705,9 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
6705
6705
|
${this.label?j`
|
|
6706
6706
|
<label>
|
|
6707
6707
|
${this.label}
|
|
6708
|
-
${this.required?j`<span class="required" aria-hidden="true">*</span>`:
|
|
6708
|
+
${this.required?j`<span class="required" aria-hidden="true">*</span>`:H}
|
|
6709
6709
|
</label>
|
|
6710
|
-
`:
|
|
6710
|
+
`:H}
|
|
6711
6711
|
<div
|
|
6712
6712
|
class=${ye({cards:!0,"cards--row":"row"===this.direction,"cards--column":"column"===this.direction})}
|
|
6713
6713
|
role="radiogroup"
|
|
@@ -6724,18 +6724,18 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
6724
6724
|
@keydown=${e=>this._handleKeyDown(e,t)}
|
|
6725
6725
|
>
|
|
6726
6726
|
<div class="card__radio">
|
|
6727
|
-
${i?j`<div class="card__radio-dot"></div>`:
|
|
6727
|
+
${i?j`<div class="card__radio-dot"></div>`:H}
|
|
6728
6728
|
</div>
|
|
6729
6729
|
<div class="card__content">
|
|
6730
6730
|
<div class="card__label">${e.label}</div>
|
|
6731
|
-
${e.description?j`<div class="card__description">${e.description}</div>`:
|
|
6731
|
+
${e.description?j`<div class="card__description">${e.description}</div>`:H}
|
|
6732
6732
|
</div>
|
|
6733
6733
|
</div>
|
|
6734
6734
|
`}))}
|
|
6735
6735
|
</div>
|
|
6736
|
-
${this._touched&&this.required&&!this.value?j`<div class="validation-message">Please select an option</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:
|
|
6736
|
+
${this._touched&&this.required&&!this.value?j`<div class="validation-message">Please select an option</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:H}
|
|
6737
6737
|
</div>
|
|
6738
|
-
`}}as.styles=[
|
|
6738
|
+
`}}as.styles=[Ht,n`
|
|
6739
6739
|
:host {
|
|
6740
6740
|
display: block;
|
|
6741
6741
|
font-family: inherit;
|
|
@@ -6879,7 +6879,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
6879
6879
|
${this.label}
|
|
6880
6880
|
${this.required?j`<span class="required" aria-hidden="true">*</span>`:""}
|
|
6881
6881
|
</label>
|
|
6882
|
-
`:
|
|
6882
|
+
`:H}
|
|
6883
6883
|
<div
|
|
6884
6884
|
part="trigger"
|
|
6885
6885
|
class=${ye({trigger:!0,"trigger--invalid":!!i,"trigger--disabled":this.disabled,"trigger--readonly":this.readonly})}
|
|
@@ -6995,7 +6995,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
6995
6995
|
${this._renderCalendar()}
|
|
6996
6996
|
</div>
|
|
6997
6997
|
</div>
|
|
6998
|
-
`}}ds.styles=[
|
|
6998
|
+
`}}ds.styles=[Ht,n`
|
|
6999
6999
|
:host {
|
|
7000
7000
|
display: block;
|
|
7001
7001
|
font-family: inherit;
|
|
@@ -7382,7 +7382,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7382
7382
|
</button>
|
|
7383
7383
|
`))}
|
|
7384
7384
|
</div>
|
|
7385
|
-
`:
|
|
7385
|
+
`:H}
|
|
7386
7386
|
<button
|
|
7387
7387
|
class="mode-trigger"
|
|
7388
7388
|
aria-haspopup="true"
|
|
@@ -7416,14 +7416,14 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7416
7416
|
${this._pendingActions.map((e=>j`
|
|
7417
7417
|
<li class="confirmation__list-item">
|
|
7418
7418
|
<span class="confirmation__list-name">${e.displayName||e.toolName}</span>
|
|
7419
|
-
${e.confirmationMessage?j`<span class="confirmation__list-desc">${e.confirmationMessage}</span>`:
|
|
7420
|
-
${this._showConfirmationInput&&this._inlineConfirm&&e.input&&Object.keys(e.input).length?j`<pre class="confirmation__details-input">${JSON.stringify(e.input,null,2)}</pre>`:
|
|
7419
|
+
${e.confirmationMessage?j`<span class="confirmation__list-desc">${e.confirmationMessage}</span>`:H}
|
|
7420
|
+
${this._showConfirmationInput&&this._inlineConfirm&&e.input&&Object.keys(e.input).length?j`<pre class="confirmation__details-input">${JSON.stringify(e.input,null,2)}</pre>`:H}
|
|
7421
7421
|
</li>
|
|
7422
7422
|
`))}
|
|
7423
7423
|
</ol>
|
|
7424
7424
|
`:j`
|
|
7425
7425
|
<p class="confirmation__message">${this._pendingActions[0]?.confirmationMessage||"The assistant wants to take an action. Is that OK?"}</p>
|
|
7426
|
-
${this._showConfirmationInput&&this._inlineConfirm&&this._pendingActions[0]?.input&&Object.keys(this._pendingActions[0].input).length?j`<pre class="confirmation__details-input">${JSON.stringify(this._pendingActions[0].input,null,2)}</pre>`:
|
|
7426
|
+
${this._showConfirmationInput&&this._inlineConfirm&&this._pendingActions[0]?.input&&Object.keys(this._pendingActions[0].input).length?j`<pre class="confirmation__details-input">${JSON.stringify(this._pendingActions[0].input,null,2)}</pre>`:H}
|
|
7427
7427
|
`}
|
|
7428
7428
|
<div class="confirmation__actions">
|
|
7429
7429
|
${bs.map(((e,t)=>j`
|
|
@@ -7474,7 +7474,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7474
7474
|
>
|
|
7475
7475
|
Test Context Limit
|
|
7476
7476
|
</button>
|
|
7477
|
-
`:
|
|
7477
|
+
`:H}
|
|
7478
7478
|
</div>
|
|
7479
7479
|
${e.length?j`
|
|
7480
7480
|
<ul class="skill-menu__list">
|
|
@@ -7487,12 +7487,12 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7487
7487
|
<span class="skill-menu__name">${e.name}</span>
|
|
7488
7488
|
${e.summary?j`
|
|
7489
7489
|
<span class="skill-menu__desc">${e.summary}</span>
|
|
7490
|
-
`:
|
|
7490
|
+
`:H}
|
|
7491
7491
|
</button>
|
|
7492
7492
|
</li>
|
|
7493
7493
|
`))}
|
|
7494
7494
|
</ul>
|
|
7495
|
-
`:
|
|
7495
|
+
`:H}
|
|
7496
7496
|
</div>
|
|
7497
7497
|
`}_renderSkillBrowse(){return j`
|
|
7498
7498
|
<krs-dialog
|
|
@@ -7552,7 +7552,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7552
7552
|
<span class="skill-detail__title">${this._skillBrowseDetail.name}</span>
|
|
7553
7553
|
${this._skillBrowseDetail.summary?j`
|
|
7554
7554
|
<p class="skill-detail__summary">${this._skillBrowseDetail.summary}</p>
|
|
7555
|
-
`:
|
|
7555
|
+
`:H}
|
|
7556
7556
|
</div>
|
|
7557
7557
|
<div class="skill-detail__row">
|
|
7558
7558
|
<span class="skill-detail__label">Author</span>
|
|
@@ -7563,7 +7563,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7563
7563
|
<span class="skill-detail__label">Price</span>
|
|
7564
7564
|
<span class="skill-detail__value">${this._skillBrowseDetail.priceLabel}</span>
|
|
7565
7565
|
</div>
|
|
7566
|
-
`:
|
|
7566
|
+
`:H}
|
|
7567
7567
|
${this._skillBrowseDetail.allowedRoles?.length?j`
|
|
7568
7568
|
<div class="skill-detail__row">
|
|
7569
7569
|
<span class="skill-detail__label">Roles</span>
|
|
@@ -7573,10 +7573,10 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7573
7573
|
`))}
|
|
7574
7574
|
</div>
|
|
7575
7575
|
</div>
|
|
7576
|
-
`:
|
|
7576
|
+
`:H}
|
|
7577
7577
|
</div>
|
|
7578
7578
|
<div class="skill-detail__footer">
|
|
7579
|
-
${!1===this._skillBrowseDetail.canRun||this._skillBrowseDetail.global&&!this._skillBrowseDetail.enabled?
|
|
7579
|
+
${!1===this._skillBrowseDetail.canRun||this._skillBrowseDetail.global&&!this._skillBrowseDetail.enabled?H:j`
|
|
7580
7580
|
<krs-button
|
|
7581
7581
|
variant="flat"
|
|
7582
7582
|
color="primary"
|
|
@@ -7589,7 +7589,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7589
7589
|
color=${this._skillBrowseDetail.enabled?"secondary":"primary"}
|
|
7590
7590
|
@click=${this._handleSkillDetailEnable}
|
|
7591
7591
|
>${this._skillBrowseDetail.enabled?"Uninstall":"Install"}</krs-button>
|
|
7592
|
-
`:
|
|
7592
|
+
`:H}
|
|
7593
7593
|
</div>
|
|
7594
7594
|
</div>
|
|
7595
7595
|
`:j`
|
|
@@ -7609,7 +7609,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7609
7609
|
<krs-tab id="kodaris" label="Kodaris">
|
|
7610
7610
|
${this._renderSkillGrid(!0)}
|
|
7611
7611
|
</krs-tab>
|
|
7612
|
-
`:
|
|
7612
|
+
`:H}
|
|
7613
7613
|
</krs-tab-group>
|
|
7614
7614
|
`}
|
|
7615
7615
|
</div>
|
|
@@ -7627,10 +7627,10 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7627
7627
|
<span class="skill-card__name">${t.name}</span>
|
|
7628
7628
|
${t.summary?j`
|
|
7629
7629
|
<span class="skill-card__desc">${t.summary}</span>
|
|
7630
|
-
`:
|
|
7630
|
+
`:H}
|
|
7631
7631
|
${!e&&t.global?j`
|
|
7632
7632
|
<span class="skill-card__badge">Global</span>
|
|
7633
|
-
`:
|
|
7633
|
+
`:H}
|
|
7634
7634
|
${e?j`
|
|
7635
7635
|
<div class="skill-card__footer">
|
|
7636
7636
|
<span class="skill-card__price">${t.priceLabel}</span>
|
|
@@ -7642,11 +7642,11 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7642
7642
|
@click=${e=>this._handleGlobalSkillEnable(t,e)}
|
|
7643
7643
|
>${t.enabled?"Uninstall":"Install"}</krs-button>
|
|
7644
7644
|
</div>
|
|
7645
|
-
`:
|
|
7645
|
+
`:H}
|
|
7646
7646
|
</div>
|
|
7647
7647
|
`))}
|
|
7648
7648
|
</div>
|
|
7649
|
-
`:
|
|
7649
|
+
`:H}_renderUserContent(e){const t=e.match(/^\/(\S+)(\s[\s\S]*)?$/);return t?j`<span class="message-skill">/${t[1]}</span>${t[2]||""}`:e}_fmtTokens(e){return null==e||isNaN(e)?"—":e.toLocaleString("en-US")}_fmtCost(e){return null==e||isNaN(e)?"—":"~$"+e.toFixed(4)}_fmtPrice(e){return null==e||isNaN(e)?"—":"$"+e.toFixed(2)}_getCustomerPriceLabel(){const e=this._telemetry?.customerPricePerThousandTokens;return null==e||isNaN(e)?"Customer price":`Customer price ($${e}/1K)`}_renderHistoryContent(){return j`
|
|
7650
7650
|
<div class="history">
|
|
7651
7651
|
${this._conversationsLoading?j`
|
|
7652
7652
|
<div class="history__empty">Loading…</div>
|
|
@@ -7663,7 +7663,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7663
7663
|
<span class="history__item-title">${e.title||"Untitled conversation"}</span>
|
|
7664
7664
|
${t?j`
|
|
7665
7665
|
<span class="history__item-date">${t}</span>
|
|
7666
|
-
`:
|
|
7666
|
+
`:H}
|
|
7667
7667
|
</button>
|
|
7668
7668
|
`}))}
|
|
7669
7669
|
</div>
|
|
@@ -7674,7 +7674,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7674
7674
|
class=${ye({drawer:!0,"drawer--open":this._drawerOpen,"drawer--resizing":this._isDrawerResizing,"drawer--full":"floating"===this.variant})}
|
|
7675
7675
|
style=${we("floating"===this.variant?{}:{width:`${this._drawerWidth}px`})}
|
|
7676
7676
|
>
|
|
7677
|
-
${"floating"===this.variant?
|
|
7677
|
+
${"floating"===this.variant?H:j`
|
|
7678
7678
|
<div
|
|
7679
7679
|
class="drawer__resize"
|
|
7680
7680
|
@mousedown=${this._handleDrawerResizeMouseDown}
|
|
@@ -7702,7 +7702,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7702
7702
|
/>
|
|
7703
7703
|
</svg>
|
|
7704
7704
|
</button>
|
|
7705
|
-
`:
|
|
7705
|
+
`:H}
|
|
7706
7706
|
<span class="drawer__title">${t}</span>
|
|
7707
7707
|
${"history"===this._drawerView?j`
|
|
7708
7708
|
<krs-button
|
|
@@ -7728,8 +7728,8 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7728
7728
|
</svg>
|
|
7729
7729
|
New conversation
|
|
7730
7730
|
</krs-button>
|
|
7731
|
-
`:
|
|
7732
|
-
${"floating"===this.variant?
|
|
7731
|
+
`:H}
|
|
7732
|
+
${"floating"===this.variant?H:j`
|
|
7733
7733
|
<button
|
|
7734
7734
|
class="header-action"
|
|
7735
7735
|
@click=${this._handleCloseDrawer}
|
|
@@ -7829,7 +7829,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7829
7829
|
`}
|
|
7830
7830
|
</span>
|
|
7831
7831
|
</button>
|
|
7832
|
-
${this._toolDetailInputOpen?j`<pre class="tool-detail__code">${this._formatToolJson(this._toolDetail.use.data?.toolInput)||"(no input)"}</pre>`:
|
|
7832
|
+
${this._toolDetailInputOpen?j`<pre class="tool-detail__code">${this._formatToolJson(this._toolDetail.use.data?.toolInput)||"(no input)"}</pre>`:H}
|
|
7833
7833
|
</div>
|
|
7834
7834
|
<div class="tool-detail__section">
|
|
7835
7835
|
<button
|
|
@@ -7877,7 +7877,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7877
7877
|
`}
|
|
7878
7878
|
</span>
|
|
7879
7879
|
</button>
|
|
7880
|
-
${this._toolDetailOutputOpen?j`<pre class="tool-detail__code">${this._formatToolJson(this._toolDetail.result?.data?.toolResultString)||"(no output yet)"}</pre>`:
|
|
7880
|
+
${this._toolDetailOutputOpen?j`<pre class="tool-detail__code">${this._formatToolJson(this._toolDetail.result?.data?.toolResultString)||"(no output yet)"}</pre>`:H}
|
|
7881
7881
|
</div>
|
|
7882
7882
|
</div>
|
|
7883
7883
|
`}_renderDebugContent(){return j`
|
|
@@ -7909,8 +7909,14 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7909
7909
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnCacheReadTokens)}</span>
|
|
7910
7910
|
<span class="debug-metrics__key">Hit rate</span>
|
|
7911
7911
|
<span class="debug-metrics__val">${this._telemetry.turnHitRate??"—"}%</span>
|
|
7912
|
+
<span class="debug-metrics__key">Total tokens</span>
|
|
7913
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnTotalTokens)}</span>
|
|
7914
|
+
<span class="debug-metrics__key">Reported total</span>
|
|
7915
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnReportedTotalTokens)}</span>
|
|
7912
7916
|
<span class="debug-metrics__key">Cost</span>
|
|
7913
7917
|
<span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.turnCostUsd)}</span>
|
|
7918
|
+
<span class="debug-metrics__key">${this._getCustomerPriceLabel()}</span>
|
|
7919
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.turnCustomerUsd)}</span>
|
|
7914
7920
|
</div>
|
|
7915
7921
|
</div>
|
|
7916
7922
|
|
|
@@ -7925,8 +7931,12 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7925
7931
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheReadTokens)}</span>
|
|
7926
7932
|
<span class="debug-metrics__key">Cache write</span>
|
|
7927
7933
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheWriteTokens)}</span>
|
|
7934
|
+
<span class="debug-metrics__key">Total tokens</span>
|
|
7935
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationTotalTokens)}</span>
|
|
7928
7936
|
<span class="debug-metrics__key">Cost so far</span>
|
|
7929
7937
|
<span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.conversationCostUsd)}</span>
|
|
7938
|
+
<span class="debug-metrics__key">${this._getCustomerPriceLabel()} so far</span>
|
|
7939
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.conversationCustomerUsd)}</span>
|
|
7930
7940
|
</div>
|
|
7931
7941
|
</div>
|
|
7932
7942
|
`:j`
|
|
@@ -7946,7 +7956,10 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7946
7956
|
<th>Cache R</th>
|
|
7947
7957
|
<th>Cache W</th>
|
|
7948
7958
|
<th>Hit</th>
|
|
7959
|
+
<th>Total</th>
|
|
7960
|
+
<th>Reported</th>
|
|
7949
7961
|
<th>Cost</th>
|
|
7962
|
+
<th>Price</th>
|
|
7950
7963
|
<th>Ckpt</th>
|
|
7951
7964
|
</tr>
|
|
7952
7965
|
</thead>
|
|
@@ -7959,7 +7972,10 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7959
7972
|
<td>${this._fmtTokens(e.iterationCacheRead)}</td>
|
|
7960
7973
|
<td>${this._fmtTokens(e.iterationCacheWrite)}</td>
|
|
7961
7974
|
<td>${e.iterationHitRate??"—"}%</td>
|
|
7975
|
+
<td>${this._fmtTokens(e.iterationTotalTokens)}</td>
|
|
7976
|
+
<td>${this._fmtTokens(e.reportedTotalTokens)}</td>
|
|
7962
7977
|
<td class="debug-cost">${this._fmtCost(e.iterationCostUsd)}</td>
|
|
7978
|
+
<td class="debug-cost">${this._fmtPrice(e.iterationCustomerUsd)}</td>
|
|
7963
7979
|
<td>${t?t.mode:"—"}</td>
|
|
7964
7980
|
</tr>
|
|
7965
7981
|
`}))}
|
|
@@ -7967,9 +7983,9 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
7967
7983
|
</table>
|
|
7968
7984
|
</div>
|
|
7969
7985
|
</div>
|
|
7970
|
-
`:
|
|
7986
|
+
`:H}
|
|
7971
7987
|
`}render(){const e="inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled,t={};this._drawerOpen&&"inline"===this.variant&&(t.paddingRight=`${this._drawerWidth}px`);const i=[];return this.messages.forEach((e=>{const t=i[i.length-1];"user"!==e.type&&t&&"user"!==t[0].type?t.push(e):i.push([e])})),j`
|
|
7972
|
-
${this.hideToggle||"inline"===this.variant?
|
|
7988
|
+
${this.hideToggle||"inline"===this.variant?H:j`
|
|
7973
7989
|
<button
|
|
7974
7990
|
class=${ye({toggle:!0,"toggle--hidden":this.opened})}
|
|
7975
7991
|
@click=${this._handleToggle}
|
|
@@ -8014,8 +8030,8 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8014
8030
|
</svg>
|
|
8015
8031
|
<span>Drop images to attach</span>
|
|
8016
8032
|
</div>
|
|
8017
|
-
`:
|
|
8018
|
-
${"inline"===this.variant?
|
|
8033
|
+
`:H}
|
|
8034
|
+
${"inline"===this.variant?H:j`
|
|
8019
8035
|
<div
|
|
8020
8036
|
class="resize resize--n"
|
|
8021
8037
|
data-dir="n"
|
|
@@ -8105,7 +8121,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8105
8121
|
/>
|
|
8106
8122
|
</svg>
|
|
8107
8123
|
</button>
|
|
8108
|
-
`:
|
|
8124
|
+
`:H}
|
|
8109
8125
|
<button
|
|
8110
8126
|
class="header-action"
|
|
8111
8127
|
@click=${()=>this._toggleDrawer("settings")}
|
|
@@ -8152,8 +8168,8 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8152
8168
|
/>
|
|
8153
8169
|
</svg>
|
|
8154
8170
|
</button>
|
|
8155
|
-
`:
|
|
8156
|
-
${"inline"===this.variant?
|
|
8171
|
+
`:H}
|
|
8172
|
+
${"inline"===this.variant?H:j`
|
|
8157
8173
|
<button
|
|
8158
8174
|
class="header-action"
|
|
8159
8175
|
@click=${this._handleToggle}
|
|
@@ -8199,10 +8215,10 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8199
8215
|
>${e.label}</button>
|
|
8200
8216
|
`))}
|
|
8201
8217
|
</div>
|
|
8202
|
-
`:
|
|
8218
|
+
`:H}
|
|
8203
8219
|
</div>
|
|
8204
|
-
`:
|
|
8205
|
-
${i.map((e=>{const t=e.map((e=>{const t=this.messages.indexOf(e);if(!("assistant"!==e.type||e.content||e.reasoning||this._isStreaming&&e===this.messages[this.messages.length-1]))return
|
|
8220
|
+
`:H}
|
|
8221
|
+
${i.map((e=>{const t=e.map((e=>{const t=this.messages.indexOf(e);if(!("assistant"!==e.type||e.content||e.reasoning||this._isStreaming&&e===this.messages[this.messages.length-1]))return H;let i,s=[];if("tool_result"===e.type&&"offer_skill"===e.data?.toolName)try{s=JSON.parse(e.data.toolResultString).skills||[]}catch{}if(!("tool_use"!==e.type&&"tool_result"!==e.type||this._showTools||s.length))return H;if("tool_result"===e.type&&!s.length)return H;let o="",r="",n=0;if("tool_use"===e.type&&("tool_result"===this.messages[t+1]?.type&&this.messages[t+1].data?.toolUseId===e.data?.toolUseId&&(i=this.messages[t+1].data),this._showToolInputs&&e.data?.toolInput&&(o=String(e.data.toolInput).replace(/\s+/g," ").trim(),o.length>80&&(o=`${o.slice(0,79)}…`)),this._showToolInputs&&i?.toolResultString)){let e;try{e=JSON.stringify(JSON.parse(i.toolResultString),null,2)}catch{e=String(i.toolResultString)}const t=e.split("\n");r=t.slice(0,3).join("\n"),r.length>200&&(r=`${r.slice(0,200)}…`),n=Math.max(0,t.length-3)}let a="Approved",l=[];return"action_decision"===e.type&&("denied"===e.data?.outcome?a="Denied":"alwaysAllowed"===e.data?.outcome&&(a="Always allowed"),l=(e.data?.tools||[]).map((e=>e.displayName||e.toolName))),j`
|
|
8206
8222
|
<div class=${ye({message:!0,"message--user":"user"===e.type,"message--assistant":"user"!==e.type})}>
|
|
8207
8223
|
${"tool_use"===e.type?j`
|
|
8208
8224
|
<div class="tool-activity-block">
|
|
@@ -8213,7 +8229,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8213
8229
|
>
|
|
8214
8230
|
<span class="tool-activity__chevron">›</span>
|
|
8215
8231
|
<span class="tool-activity__label">${e.data?.displayName||e.data?.toolName||"Tool"}</span>
|
|
8216
|
-
${o?j`<span class="tool-activity__input">(${o})</span>`:
|
|
8232
|
+
${o?j`<span class="tool-activity__input">(${o})</span>`:H}
|
|
8217
8233
|
</button>
|
|
8218
8234
|
${this._showToolInputs&&i?.toolResultString?j`
|
|
8219
8235
|
<button
|
|
@@ -8222,11 +8238,11 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8222
8238
|
@click=${()=>this._openToolDetail(e)}
|
|
8223
8239
|
>
|
|
8224
8240
|
<span class="tool-activity__connector">⎿</span>
|
|
8225
|
-
<pre class="tool-activity__result-body">${r}${n>0?j`\n<span class="tool-activity__more">… +${n} lines</span>`:
|
|
8241
|
+
<pre class="tool-activity__result-body">${r}${n>0?j`\n<span class="tool-activity__more">… +${n} lines</span>`:H}</pre>
|
|
8226
8242
|
</button>
|
|
8227
|
-
`:
|
|
8243
|
+
`:H}
|
|
8228
8244
|
</div>
|
|
8229
|
-
`:
|
|
8245
|
+
`:H}
|
|
8230
8246
|
${s.length?j`
|
|
8231
8247
|
<div
|
|
8232
8248
|
class="confirmation confirmation--inline skill-offer"
|
|
@@ -8243,7 +8259,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8243
8259
|
<span class="confirmation__list-name">${e.name}</span>
|
|
8244
8260
|
${e.summary?j`
|
|
8245
8261
|
<span class="confirmation__list-desc">${e.summary}</span>
|
|
8246
|
-
`:
|
|
8262
|
+
`:H}
|
|
8247
8263
|
<span class="confirmation__list-desc">
|
|
8248
8264
|
<strong>Price:</strong>
|
|
8249
8265
|
${e.priceLabel}
|
|
@@ -8254,7 +8270,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8254
8270
|
`:j`
|
|
8255
8271
|
${s[0].summary?j`
|
|
8256
8272
|
<p class="confirmation__message">${s[0].summary}</p>
|
|
8257
|
-
`:
|
|
8273
|
+
`:H}
|
|
8258
8274
|
<p class="confirmation__message">
|
|
8259
8275
|
<strong>Price:</strong>
|
|
8260
8276
|
${s[0].priceLabel}
|
|
@@ -8281,7 +8297,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8281
8297
|
`}
|
|
8282
8298
|
</div>
|
|
8283
8299
|
</div>
|
|
8284
|
-
`:
|
|
8300
|
+
`:H}
|
|
8285
8301
|
${"action_decision"===e.type?j`
|
|
8286
8302
|
<div class=${ye({decision:!0,"decision--denied":"denied"===e.data?.outcome})}>
|
|
8287
8303
|
<span class="decision__icon">
|
|
@@ -8296,9 +8312,9 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8296
8312
|
${"denied"===e.data?.outcome?j`<path d="M18 6 6 18M6 6l12 12" />`:j`<path d="M20 6 9 17l-5-5" />`}
|
|
8297
8313
|
</svg>
|
|
8298
8314
|
</span>
|
|
8299
|
-
<span class="decision__label">${a}${l.length?" "+l.join(", "):
|
|
8315
|
+
<span class="decision__label">${a}${l.length?" "+l.join(", "):H}</span>
|
|
8300
8316
|
</div>
|
|
8301
|
-
`:
|
|
8317
|
+
`:H}
|
|
8302
8318
|
${e.reasoning?this._reasoningAsMessage?j`
|
|
8303
8319
|
<div class="message-content">${e.reasoning}</div>
|
|
8304
8320
|
`:j`
|
|
@@ -8306,7 +8322,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8306
8322
|
<summary>Thinking</summary>
|
|
8307
8323
|
<div class="reasoning-content">${e.reasoning}</div>
|
|
8308
8324
|
</details>
|
|
8309
|
-
`:
|
|
8325
|
+
`:H}
|
|
8310
8326
|
${e.conversationFiles&&e.conversationFiles.length?j`
|
|
8311
8327
|
<div class="attachments">
|
|
8312
8328
|
${e.conversationFiles.map((e=>{const t=e.niceName||e.name||"File";let i=_s.includes(this._getFileExtension(t));return e.mimeType&&(i=e.mimeType.startsWith("image/")),i?j`
|
|
@@ -8333,19 +8349,19 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8333
8349
|
</button>
|
|
8334
8350
|
`}))}
|
|
8335
8351
|
</div>
|
|
8336
|
-
`:
|
|
8352
|
+
`:H}
|
|
8337
8353
|
${e.content?j`
|
|
8338
8354
|
<div class="message-content">
|
|
8339
|
-
${"user"===e.type?this._renderUserContent(e.content):Se(
|
|
8355
|
+
${"user"===e.type?this._renderUserContent(e.content):Se(Nt.parse(e.content,{breaks:!0}))}
|
|
8340
8356
|
</div>
|
|
8341
|
-
`:
|
|
8357
|
+
`:H}
|
|
8342
8358
|
${"assistant"===e.type&&this._isStreaming&&e===this.messages[this.messages.length-1]?j`
|
|
8343
8359
|
<div class="typing">
|
|
8344
8360
|
<span></span>
|
|
8345
8361
|
<span></span>
|
|
8346
8362
|
<span></span>
|
|
8347
8363
|
</div>
|
|
8348
|
-
`:
|
|
8364
|
+
`:H}
|
|
8349
8365
|
${e.content?j`
|
|
8350
8366
|
<button
|
|
8351
8367
|
class="message-copy"
|
|
@@ -8383,7 +8399,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8383
8399
|
</svg>
|
|
8384
8400
|
`}
|
|
8385
8401
|
</button>
|
|
8386
|
-
`:
|
|
8402
|
+
`:H}
|
|
8387
8403
|
</div>
|
|
8388
8404
|
`})),s=e===i[i.length-1],o=s&&this._pendingActions.length&&this._inlineConfirm;if("user"===e[0].type)return j`
|
|
8389
8405
|
${t}
|
|
@@ -8391,7 +8407,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8391
8407
|
<div class="agent-turn">
|
|
8392
8408
|
${this._renderConfirmation()}
|
|
8393
8409
|
</div>
|
|
8394
|
-
`:
|
|
8410
|
+
`:H}
|
|
8395
8411
|
`;const r=this.messages[this.messages.length-1],n=s&&this._isStreaming&&!this._pendingActions.length&&"assistant"!==r?.type;return j`
|
|
8396
8412
|
<div class="agent-turn">
|
|
8397
8413
|
${t}
|
|
@@ -8401,14 +8417,14 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8401
8417
|
<span></span>
|
|
8402
8418
|
<span></span>
|
|
8403
8419
|
</div>
|
|
8404
|
-
`:
|
|
8405
|
-
${o?this._renderConfirmation():
|
|
8420
|
+
`:H}
|
|
8421
|
+
${o?this._renderConfirmation():H}
|
|
8406
8422
|
</div>
|
|
8407
8423
|
`}))}
|
|
8408
8424
|
</div>
|
|
8409
8425
|
</div>
|
|
8410
8426
|
|
|
8411
|
-
${this._pendingActions.length&&!this._inlineConfirm?this._renderConfirmation():
|
|
8427
|
+
${this._pendingActions.length&&!this._inlineConfirm?this._renderConfirmation():H}
|
|
8412
8428
|
|
|
8413
8429
|
${this._error?j`
|
|
8414
8430
|
<div class="error">
|
|
@@ -8458,7 +8474,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8458
8474
|
</svg>
|
|
8459
8475
|
</button>
|
|
8460
8476
|
</div>
|
|
8461
|
-
`:
|
|
8477
|
+
`:H}
|
|
8462
8478
|
|
|
8463
8479
|
<div class="footer">
|
|
8464
8480
|
${this._pendingConversationFiles.length?j`
|
|
@@ -8498,7 +8514,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8498
8514
|
</div>
|
|
8499
8515
|
`))}
|
|
8500
8516
|
</div>
|
|
8501
|
-
`:
|
|
8517
|
+
`:H}
|
|
8502
8518
|
<input
|
|
8503
8519
|
class="file-input"
|
|
8504
8520
|
type="file"
|
|
@@ -8507,7 +8523,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8507
8523
|
hidden
|
|
8508
8524
|
@change=${this._handleFileInputChange}
|
|
8509
8525
|
/>
|
|
8510
|
-
${this._skillMenuOpened?this._renderSkillMenu():
|
|
8526
|
+
${this._skillMenuOpened?this._renderSkillMenu():H}
|
|
8511
8527
|
<div class="input-wrapper">
|
|
8512
8528
|
<button
|
|
8513
8529
|
class="input-plus"
|
|
@@ -8571,7 +8587,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8571
8587
|
</svg>
|
|
8572
8588
|
</button>
|
|
8573
8589
|
`}
|
|
8574
|
-
`:
|
|
8590
|
+
`:H}
|
|
8575
8591
|
${this._isStreaming?j`
|
|
8576
8592
|
<button
|
|
8577
8593
|
class="stop"
|
|
@@ -8615,7 +8631,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8615
8631
|
`}
|
|
8616
8632
|
</div>
|
|
8617
8633
|
</div>
|
|
8618
|
-
${this._skillBrowseOpened?this._renderSkillBrowse():
|
|
8634
|
+
${this._skillBrowseOpened?this._renderSkillBrowse():H}
|
|
8619
8635
|
${this._skillInstallConfirm?j`
|
|
8620
8636
|
<krs-dialog
|
|
8621
8637
|
opened
|
|
@@ -8641,7 +8657,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8641
8657
|
>Install</krs-button>
|
|
8642
8658
|
</krs-dialog-footer>
|
|
8643
8659
|
</krs-dialog>
|
|
8644
|
-
`:
|
|
8660
|
+
`:H}
|
|
8645
8661
|
${this._skillOfferConfirm?j`
|
|
8646
8662
|
<krs-dialog
|
|
8647
8663
|
opened
|
|
@@ -8672,7 +8688,7 @@ class $e extends ve{constructor(e){if(super(e),this.it=N,e.type!==fe)throw Error
|
|
|
8672
8688
|
>Install</krs-button>
|
|
8673
8689
|
</krs-dialog-footer>
|
|
8674
8690
|
</krs-dialog>
|
|
8675
|
-
`:
|
|
8691
|
+
`:H}
|
|
8676
8692
|
${this._renderDrawer()}
|
|
8677
8693
|
</div>
|
|
8678
8694
|
`}}ys.styles=n`
|