@kodaris/krubble-app-components 1.0.71 → 1.0.72
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 +65 -0
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +583 -4
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +581 -4
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +396 -56
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +581 -4
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +431 -91
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@kodaris/krubble-components"),require("@kodaris/krubble-http")):"function"==typeof define&&define.amd?define(["exports","@kodaris/krubble-components","@kodaris/krubble-http"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).krApp={},e.kr,e.kr)}(this,(function(e,t,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@kodaris/krubble-components"),require("@kodaris/krubble-http")):"function"==typeof define&&define.amd?define(["exports","@kodaris/krubble-components","@kodaris/krubble-http"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).krApp={},e.kr,e.kr)}(this,(function(e,t,i){"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/const
|
|
6
|
+
*/const s=globalThis,n=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),a=new WeakMap;let o=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=a.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&a.set(t,e))}return e}toString(){return this.cssText}};const l=(e,...t)=>{const i=1===e.length?e[0]:t.reduce(((t,i,s)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[s+1]),e[0]);return new o(i,e,r)},h=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new o("string"==typeof e?e:e+"",void 0,r))(t)})(e):e
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/,{is:
|
|
11
|
+
*/,{is:c,defineProperty:d,getOwnPropertyDescriptor:p,getOwnPropertyNames:u,getOwnPropertySymbols:g,getPrototypeOf:f}=Object,m=globalThis,v=m.trustedTypes,b=v?v.emptyScript:"",x=m.reactiveElementPolyfillSupport,k=(e,t)=>e,_={toAttribute(e,t){switch(t){case Boolean:e=e?b:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},y=(e,t)=>!c(e,t),w={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:y};Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let $=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=w){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);void 0!==s&&d(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:n}=p(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const r=s?.call(this);n?.call(this,t),this.requestUpdate(e,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??w}static _$Ei(){if(this.hasOwnProperty(k("elementProperties")))return;const e=f(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(k("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(k("properties"))){const e=this.properties,t=[...u(e),...g(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(h(e))}else void 0!==e&&t.push(h(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(n)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const i of t){const t=document.createElement("style"),n=s.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=i.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(void 0!==s&&!0===i.reflect){const n=(void 0!==i.converter?.toAttribute?i.converter:_).toAttribute(t,i.type);this._$Em=e,null==n?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(e,t){const i=this.constructor,s=i._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=i.getPropertyOptions(s),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:_;this._$Em=s;const r=n.fromAttribute(t,e.type);this[s]=r??this._$Ej?.get(s)??r,this._$Em=null}}requestUpdate(e,t,i,s=!1,n){if(void 0!==e){const r=this.constructor;if(!1===s&&(n=this[e]),i??=r.getPropertyOptions(e),!((i.hasChanged??y)(n,t)||i.useDefault&&i.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:n},r){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),!0!==n||void 0!==r)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===s&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,i,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[k("elementProperties")]=new Map,$[k("finalized")]=new Map,x?.({ReactiveElement:$}),(m.reactiveElementVersions??=[]).push("2.1.2");
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
17
|
+
const S=globalThis,I=S.trustedTypes,E=I?I.createPolicy("lit-html",{createHTML:e=>e}):void 0,C="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,z="?"+A,M=`<${z}>`,D=document,T=()=>D.createComment(""),R=e=>null===e||"object"!=typeof e&&"function"!=typeof e,N=Array.isArray,P="[ \t\n\f\r]",O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,U=/-->/g,L=/>/g,H=RegExp(`>|${P}(?:([^\\s"'>=/]+)(${P}*=${P}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,F=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),X=Symbol.for("lit-noChange"),Q=Symbol.for("lit-nothing"),W=new WeakMap,Y=D.createTreeWalker(D,129);function Z(e,t){if(!N(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}class V{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let n=0,r=0;const a=e.length-1,o=this.parts,[l,h]=((e,t)=>{const i=e.length-1,s=[];let n,r=2===t?"<svg>":3===t?"<math>":"",a=O;for(let t=0;t<i;t++){const i=e[t];let o,l,h=-1,c=0;for(;c<i.length&&(a.lastIndex=c,l=a.exec(i),null!==l);)c=a.lastIndex,a===O?"!--"===l[1]?a=U:void 0!==l[1]?a=L:void 0!==l[2]?(B.test(l[2])&&(n=RegExp("</"+l[2],"g")),a=H):void 0!==l[3]&&(a=H):a===H?">"===l[0]?(a=n??O,h=-1):void 0===l[1]?h=-2:(h=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?H:'"'===l[3]?F:j):a===F||a===j?a=H:a===U||a===L?a=O:(a=H,n=void 0);const d=a===H&&e[t+1].startsWith("/>")?" ":"";r+=a===O?i+M:h>=0?(s.push(o),i.slice(0,h)+C+i.slice(h)+A+d):i+A+(-2===h?t:d)}return[Z(e,r+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]})(e,t);if(this.el=V.createElement(l,i),Y.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=Y.nextNode())&&o.length<a;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(C)){const t=h[r++],i=s.getAttribute(e).split(A),a=/([.?@])?(.*)/.exec(t);o.push({type:1,index:n,name:a[2],strings:i,ctor:"."===a[1]?te:"?"===a[1]?ie:"@"===a[1]?se:ee}),s.removeAttribute(e)}else e.startsWith(A)&&(o.push({type:6,index:n}),s.removeAttribute(e));if(B.test(s.tagName)){const e=s.textContent.split(A),t=e.length-1;if(t>0){s.textContent=I?I.emptyScript:"";for(let i=0;i<t;i++)s.append(e[i],T()),Y.nextNode(),o.push({type:2,index:++n});s.append(e[t],T())}}}else if(8===s.nodeType)if(s.data===z)o.push({type:2,index:n});else{let e=-1;for(;-1!==(e=s.data.indexOf(A,e+1));)o.push({type:7,index:n}),e+=A.length-1}n++}}static createElement(e,t){const i=D.createElement("template");return i.innerHTML=e,i}}function K(e,t,i=e,s){if(t===X)return t;let n=void 0!==s?i._$Co?.[s]:i._$Cl;const r=R(t)?void 0:t._$litDirective$;return n?.constructor!==r&&(n?._$AO?.(!1),void 0===r?n=void 0:(n=new r(e),n._$AT(e,i,s)),void 0!==s?(i._$Co??=[])[s]=n:i._$Cl=n),void 0!==n&&(t=K(e,n._$AS(e,t.values),n,s)),t}class G{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??D).importNode(t,!0);Y.currentNode=s;let n=Y.nextNode(),r=0,a=0,o=i[0];for(;void 0!==o;){if(r===o.index){let t;2===o.type?t=new J(n,n.nextSibling,this,e):1===o.type?t=new o.ctor(n,o.name,o.strings,this,e):6===o.type&&(t=new ne(n,this,e)),this._$AV.push(t),o=i[++a]}r!==o?.index&&(n=Y.nextNode(),r++)}return Y.currentNode=D,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 J{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=Q,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=K(this,e,t),R(e)?e===Q||null==e||""===e?(this._$AH!==Q&&this._$AR(),this._$AH=Q):e!==this._$AH&&e!==X&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>N(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!==Q&&R(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.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=V.createElement(Z(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new G(s,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=W.get(e.strings);return void 0===t&&W.set(e.strings,t=new V(e)),t}k(e){N(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const n of e)s===t.length?t.push(i=new J(this.O(T()),this.O(T()),this,this.options)):i=t[s],i._$AI(n),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 ee{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,n){this.type=1,this._$AH=Q,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Q}_$AI(e,t=this,i,s){const n=this.strings;let r=!1;if(void 0===n)e=K(this,e,t,0),r=!R(e)||e!==this._$AH&&e!==X,r&&(this._$AH=e);else{const s=e;let a,o;for(e=n[0],a=0;a<n.length-1;a++)o=K(this,s[i+a],t,a),o===X&&(o=this._$AH[a]),r||=!R(o)||o!==this._$AH[a],o===Q?e=Q:e!==Q&&(e+=(o??"")+n[a+1]),this._$AH[a]=o}r&&!s&&this.j(e)}j(e){e===Q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class te extends ee{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Q?void 0:e}}class ie extends ee{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Q)}}class se extends ee{constructor(e,t,i,s,n){super(e,t,i,s,n),this.type=5}_$AI(e,t=this){if((e=K(this,e,t,0)??Q)===X)return;const i=this._$AH,s=e===Q&&i!==Q||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Q&&(i===Q||s);s&&this.element.removeEventListener(this.name,this,i),n&&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 ne{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){K(this,e)}}const re={I:J},ae=S.litHtmlPolyfillSupport;ae?.(V,J),(S.litHtmlVersions??=[]).push("3.3.2");const oe=globalThis;
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/let le=class extends ${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=((e,t,
|
|
22
|
+
*/let le=class extends ${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=((e,t,i)=>{const s=i?.renderBefore??t;let n=s._$litPart$;if(void 0===n){const e=i?.renderBefore??null;s._$litPart$=n=new J(t.insertBefore(T(),e),e,void 0,i??{})}return n._$AI(e),n})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return X}};le._$litElement$=!0,le.finalized=!0,oe.litElementHydrateSupport?.({LitElement:le});const he=oe.litElementPolyfillSupport;he?.({LitElement:le}),(oe.litElementVersions??=[]).push("4.2.2");
|
|
23
23
|
/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
27
|
*/
|
|
28
|
-
const
|
|
28
|
+
const ce=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)}
|
|
29
29
|
/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2017 Google LLC
|
|
32
32
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
-
*/,de={attribute:!0,type:String,converter:
|
|
33
|
+
*/,de={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:y},pe=(e=de,t,i)=>{const{kind:s,metadata:n}=i;let r=globalThis.litPropertyMetadata.get(n);if(void 0===r&&globalThis.litPropertyMetadata.set(n,r=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),r.set(i.name,e),"accessor"===s){const{name:s}=i;return{set(i){const n=t.get.call(this);t.set.call(this,i),this.requestUpdate(s,n,e,!0,i)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=i;return function(i){const n=this[s];t.call(this,i),this.requestUpdate(s,n,e,!0,i)}}throw Error("Unsupported decorator location: "+s)};function ue(e){return(t,i)=>"object"==typeof i?pe(e,t,i):((e,t,i)=>{const s=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),s?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)
|
|
34
34
|
/**
|
|
35
35
|
* @license
|
|
36
36
|
* Copyright 2017 Google LLC
|
|
@@ -46,22 +46,22 @@ const he=e=>(t,s)=>{void 0!==s?s.addInitializer((()=>{customElements.define(e,t)
|
|
|
46
46
|
* Copyright 2017 Google LLC
|
|
47
47
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
48
48
|
*/
|
|
49
|
-
function fe(e,t){return(t,s
|
|
49
|
+
function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i))(t,i,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}
|
|
50
50
|
/**
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright 2017 Google LLC
|
|
53
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
-
*/const me=1,ve=2,be=e=>(...t)=>({_$litDirective$:e,values:t});let xe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,
|
|
54
|
+
*/const me=1,ve=2,be=e=>(...t)=>({_$litDirective$:e,values:t});let xe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}},ke=class extends xe{constructor(e){if(super(e),this.it=Q,e.type!==ve)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Q||null==e)return this._t=void 0,this.it=e;if(e===X)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:[]}}};
|
|
55
55
|
/**
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright 2017 Google LLC
|
|
58
58
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
59
|
-
*/ke.directiveName="unsafeHTML",ke.resultType=1;const
|
|
59
|
+
*/ke.directiveName="unsafeHTML",ke.resultType=1;const _e=be(ke),ye=be(class extends xe{constructor(e){if(super(e),e.type!==me||"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 X}});
|
|
60
60
|
/**
|
|
61
61
|
* @license
|
|
62
62
|
* Copyright 2018 Google LLC
|
|
63
63
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
64
|
-
*/var we=function(e,t,s
|
|
64
|
+
*/var we=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let $e=class extends le{constructor(){super(...arguments),this.label="",this.icon="",this.url="",this.active=!0}connectedCallback(){super.connectedCallback(),this.data&&(this.label=this.data.label||"",this.icon=this.data.icon||"",this.url=this.data.url||"",this.active=!1!==this.data.active)}handleLabelInput(e){const t=e.target;this.label=t.value}handleIconInput(e){const t=e.target;this.icon=t.value}handleUrlInput(e){const t=e.target;this.url=t.value}handleActiveChange(e){this.active=e.target.checked}handleCancel(){this.dialogRef.close(void 0)}handleSave(){this.dialogRef.close({label:this.label,icon:this.icon||void 0,url:this.url||void 0,active:this.active})}handleKeyDown(e){"Enter"===e.key&&this.handleSave()}render(){return q`
|
|
65
65
|
<h2>Edit Navigation Item</h2>
|
|
66
66
|
|
|
67
67
|
<div class="form-group">
|
|
@@ -198,26 +198,26 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
198
198
|
.btn-save:hover {
|
|
199
199
|
background: #d4f472;
|
|
200
200
|
}
|
|
201
|
-
`,we([ge()],$e.prototype,"label",void 0),we([ge()],$e.prototype,"icon",void 0),we([ge()],$e.prototype,"url",void 0),we([ge()],$e.prototype,"active",void 0),$e=we([he("kr-nav-item-edit")],$e);var Ie=function(e,t,s,i){var n,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,s,a):n(t,s))||a);return r>3&&a&&Object.defineProperty(t,s,a),a};e.Scaffold=class extends le{constructor(){super(),this.defaultNavItemIcon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="10"/></svg>',this.originalFetch=null,this.originalXhrOpen=null,this.navItemDragPreview=null,this.navItemDragStartY=0,this.isNavItemDragging=!1,this.navItemDragExpandTimeout=null,this.navInitialized=!1,this.logo="",this.label="",this.homeUrl="/",this.scheme="light",this.nav=[],this.navIconsDisplayed=!1,this.navExpanded=!1,this.user=null,this.subbar=!1,this.navEnabled=!0,this.userType="employee",this.breadcrumbs=[],this.navItemsExpanded=new Set,this.navQuery="",this.activeNavItemId=null,this.isNavScrolled=!1,this.isNavOpened="false"!==localStorage.getItem("kr-scaffold-nav-opened"),this.isEditing=!1,this.isUserMenuOpen=!1,this.pref={nav:{}},this.draggedNavItemId=null,this.navItemDropTargetId=null,this.navItemDropPosition="above",this.pendingRequests=0,this.boundHandleMouseMove=this.handleMouseMove.bind(this),this.boundHandleMouseUp=this.handleMouseUp.bind(this)}connectedCallback(){super.connectedCallback(),this.installFetchInterceptor()}firstUpdated(){this.loadPref()}updated(e){super.updated(e),e.has("nav")&&this.nav.length>0&&(this.updateActiveNavItem(),this.navExpanded&&!this.navInitialized&&(this.navInitialized=!0,this.getComputedNav().filter((e=>"group"===e.type)).forEach((e=>this.navItemsExpanded.add(e.id)))))}disconnectedCallback(){super.disconnectedCallback(),this.uninstallFetchInterceptor()}installFetchInterceptor(){if(this.originalFetch)return;const e=this;this.originalFetch=window.fetch.bind(window);const t=this.originalFetch;window.fetch=function(...s){return e.pendingRequests++,t(...s).finally((()=>{e.pendingRequests--}))},this.originalXhrOpen=XMLHttpRequest.prototype.open;const s=this.originalXhrOpen;XMLHttpRequest.prototype.open=function(t,i,n=!0,r,a){return e.pendingRequests++,this.addEventListener("loadend",(()=>{e.pendingRequests--}),{once:!0}),s.call(this,t,i,n,r,a)}}uninstallFetchInterceptor(){this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null)}resolveUrl(e){if(!e.url)return"#";if(e.external)return e.url;let t=e.url;e.url.startsWith("/")&&(t=e.url.slice(1));const s=document.querySelector("base")?.getAttribute("href")||"/";return s.endsWith("/")?s+t:s+"/"+t}getComputedNav(){const e=[];return this.nav.forEach(((t,s)=>{const i=this.pref.nav[t.id];e.push({...t,...i,order:i?.order??t.order??s,parentId:i?.parentId??null}),"group"===t.type&&t.children&&t.children.forEach(((s,i)=>{const n=this.pref.nav[s.id];let r=t.id;void 0!==n?.parentId&&(r=n.parentId),e.push({...s,...n,order:n?.order??s.order??i,parentId:r})}))})),Object.entries(this.pref.nav).forEach((([t,s])=>{t.startsWith("custom")&&s.type&&s.label&&e.push({id:t,type:s.type,label:s.label,icon:s.icon,url:s.url,active:s.active,order:s.order??e.length,parentId:s.parentId??null})})),e}getNavItemChildren(e){let t=this.getComputedNav().filter((t=>t.parentId===e)).sort(((e,t)=>e.order-t.order));if(this.isEditing||(t=t.filter((e=>!1!==e.active))),this.navQuery){const s=this.navQuery.toLowerCase(),i=this.getComputedNav();if(null!==e){const n=i.find((t=>t.id===e));if(n?.label.toLowerCase().includes(s))return t}t=t.filter((e=>"group"===e.type?e.label.toLowerCase().includes(s)||i.some((t=>t.parentId===e.id&&!1!==t.active&&t.label.toLowerCase().includes(s))):e.label.toLowerCase().includes(s)))}return t}handleNavQueryChange(e){this.navQuery=e.target.value,this.navQuery?this.getComputedNav().forEach((e=>{"group"===e.type&&this.navItemsExpanded.add(e.id)})):this.navItemsExpanded.clear()}handleNavQueryClear(){this.navQuery="",this.navItemsExpanded.clear()}handleMenuClick(){this.isNavOpened=!this.isNavOpened,localStorage.setItem("kr-scaffold-nav-opened",String(this.isNavOpened))}handleNavHeaderClick(){this.activeNavItemId=null;const e=new CustomEvent("nav-item-click",{detail:{item:{url:this.homeUrl}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||(window.location.href=this.homeUrl)}handleNavScroll(e){this.isNavScrolled=e.target.scrollTop>0}toggleNavItem(e){const t=this.shadowRoot?.querySelector(`.nav-item[data-id="${e}"]`),s=t?.nextElementSibling;s&&(this.navItemsExpanded.has(e)?(this.navItemsExpanded.delete(e),s.animate([{height:`${s.scrollHeight}px`},{height:"0px"}],{duration:300,easing:"ease-in-out"}).onfinish=()=>{s.classList.remove("nav-group--expanded")}):(this.navItemsExpanded.add(e),s.classList.add("nav-group--expanded"),s.animate([{height:"0px"},{height:`${s.scrollHeight}px`}],{duration:300,easing:"ease-in-out"})),this.requestUpdate())}handleNavItemClick(e,t){if("group"===t.type)this.toggleNavItem(t.id);else{if(e.ctrlKey||e.metaKey||1===e.button)return;this.activeNavItemId=t.id;const s=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),s.defaultPrevented&&e.preventDefault()}}updateActiveNavItem(){const e=window.location.pathname,t=this.getComputedNav().filter((e=>"item"===e.type&&e.url));let s=null,i=0;for(const n of t){const t=this.resolveUrl(n);e.startsWith(t)&&t.length>i&&(s=n,i=t.length)}s?(this.activeNavItemId=s.id,s.parentId&&this.navItemsExpanded.add(s.parentId)):this.activeNavItemId=null}startEditing(){this.isEditing=!0}cancelEditing(){this.isEditing=!1,this.loadPref()}resetPref(){this.pref.nav={}}savePref(){if("customer"===this.userType)return;let e="/api/system/preference/json/scaffold?global=true",t="POST";this.pref.uuid&&(e=`/api/system/preference/json/scaffold/${this.pref.uuid}?global=true`,t="PUT"),s.Http.fetch({url:e,method:t,body:JSON.stringify({nav:this.pref.nav})}).then((e=>e.json())).then((e=>{this.pref=e.data,this.isEditing=!1})).catch((e=>{console.error("Failed to save nav customizations:",e)}))}loadPref(){"customer"!==this.userType&&s.Http.fetch({url:"/api/system/preference/json/scaffold?global=true",method:"GET"}).then((e=>e.json())).then((e=>{const t=e?.data?.[0];t&&(this.pref=t)})).catch((()=>{}))}handleNavItemContextMenu(e,s){this.isEditing&&(e.preventDefault(),t.ContextMenu.open({x:e.clientX,y:e.clientY,items:[{id:"edit",label:"Edit Item"},{id:"divider-1",label:"",divider:!0},{id:"add-above",label:"Add Item Above"},{id:"add-below",label:"Add Item Below"}]}).then((e=>{if(e)switch(e.id){case"edit":this.openNavItemEdit(s);break;case"add-above":this.addNavItem(s,"above");break;case"add-below":this.addNavItem(s,"below")}})))}openNavItemEdit(e){t.Dialog.open($e,{data:e}).afterClosed().then((t=>{const s=t;s&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id]={...this.pref.nav[e.id],...s},this.requestUpdate())}))}addNavItem(e,t){const s=`custom-${Date.now()}`,i=this.getComputedNav().filter((t=>t.parentId===e.parentId)).sort(((e,t)=>e.order-t.order)),n=i.findIndex((t=>t.id===e.id));let r;r="above"===t?n:n+1,i.forEach(((e,t)=>{t>=r&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id].order=t+1)}));const a={id:s,type:"item",label:"New Item",order:r,parentId:e.parentId,active:!0};this.pref.nav[s]=a,this.requestUpdate(),this.openNavItemEdit(a)}handleNavItemMouseDown(e,t){this.isEditing&&(e.preventDefault(),this.draggedNavItemId=t.id,this.navItemDragStartY=e.clientY,this.isNavItemDragging=!1,document.addEventListener("mousemove",this.boundHandleMouseMove),document.addEventListener("mouseup",this.boundHandleMouseUp))}handleMouseMove(e){if(this.draggedNavItemId){if(!this.isNavItemDragging&&Math.abs(e.clientY-this.navItemDragStartY)>5){this.isNavItemDragging=!0,this.classList.add("kr-scaffold--dragging");const t=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));t&&(this.navItemDragPreview=document.createElement("div"),this.navItemDragPreview.className="nav-item-drag-preview",this.navItemDragPreview.textContent=t.label,this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px",this.shadowRoot?.appendChild(this.navItemDragPreview))}this.isNavItemDragging&&(this.navItemDragPreview&&(this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px"),this.updateNavItemDropTarget(e))}}handleMouseUp(){document.removeEventListener("mousemove",this.boundHandleMouseMove),document.removeEventListener("mouseup",this.boundHandleMouseUp),this.isNavItemDragging&&this.navItemDropTargetId&&this.executeNavItemDrop(),this.draggedNavItemId=null,this.navItemDropTargetId=null,this.isNavItemDragging=!1,this.classList.remove("kr-scaffold--dragging"),this.navItemDragPreview&&(this.navItemDragPreview.remove(),this.navItemDragPreview=null),this.clearNavItemDragExpandTimeout(),this.requestUpdate()}updateNavItemDropTarget(e){const t=this.shadowRoot?.querySelectorAll(".nav-item[data-id]");if(!t)return;let s=!1;t.forEach((t=>{const i=t.getBoundingClientRect(),n=t.getAttribute("data-id");if(!n||n===this.draggedNavItemId)return;if(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom)return;const r=this.getComputedNav().find((e=>e.id===n));if(!r)return;const a=e.clientY-i.top;let o,l;"group"===r.type?a<i.height/3?(o="above",this.clearNavItemDragExpandTimeout()):a>2*i.height/3?(o="below",this.clearNavItemDragExpandTimeout()):(o="center",this.navItemsExpanded.has(r.id)||this.navItemDragExpandTimeout||this.expandNavGroupOnDrag(r.id)):(o=a<i.height/2?"above":"below",this.clearNavItemDragExpandTimeout()),l="center"===o?r.id:r.parentId;const c=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));if(l===this.draggedNavItemId||"group"===c?.type&&null!==l)return this.navItemDropTargetId=null,void this.clearNavItemDragExpandTimeout();this.navItemDropTargetId=r.id,this.navItemDropPosition=o,s=!0})),s||(this.navItemDropTargetId=null,this.clearNavItemDragExpandTimeout()),this.requestUpdate()}clearNavItemDragExpandTimeout(){this.navItemDragExpandTimeout&&(clearTimeout(this.navItemDragExpandTimeout),this.navItemDragExpandTimeout=null)}expandNavGroupOnDrag(e){this.navItemDragExpandTimeout=window.setTimeout((()=>{this.navItemDropTargetId===e&&"center"===this.navItemDropPosition&&(this.navItemsExpanded.add(e),this.requestUpdate()),this.navItemDragExpandTimeout=null}),500)}executeNavItemDrop(){if(!this.draggedNavItemId||!this.navItemDropTargetId)return;const e=this.getComputedNav(),t=e.find((e=>e.id===this.draggedNavItemId)),s=e.find((e=>e.id===this.navItemDropTargetId));if(!t||!s)return;let i;if("center"===this.navItemDropPosition&&"group"===s.type){if(s.id===this.draggedNavItemId)return;i=s.id}else i=s.parentId;if(i===this.draggedNavItemId)return;const n=e.filter((e=>e.parentId===i&&e.id!==this.draggedNavItemId)).sort(((e,t)=>e.order-t.order)),r=this.pref.nav;let a;if("center"===this.navItemDropPosition)a=n.length>0?Math.max(...n.map((e=>e.order)))+1:0;else{const e=n.findIndex((e=>e.id===s.id));a=-1===e?0:"above"===this.navItemDropPosition?e:e+1,n.forEach(((e,t)=>{r[e.id]||(r[e.id]={}),r[e.id].order=t>=a?t+1:t}))}r[this.draggedNavItemId]||(r[this.draggedNavItemId]={}),r[this.draggedNavItemId].order=a,r[this.draggedNavItemId].parentId=i,this.pref.nav=r,this.requestUpdate()}toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}closeUserMenu(){this.isUserMenuOpen=!1}handleCustomize(){this.closeUserMenu(),this.startEditing()}renderNormalFooter(){if(!this.user)return W;const e=this.user.name.split(" ").map((e=>e[0])).join("").toUpperCase().slice(0,2);return B`
|
|
201
|
+
`,we([ge()],$e.prototype,"label",void 0),we([ge()],$e.prototype,"icon",void 0),we([ge()],$e.prototype,"url",void 0),we([ge()],$e.prototype,"active",void 0),$e=we([ce("kr-nav-item-edit")],$e);var Se=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.Scaffold=class extends le{constructor(){super(),this.defaultNavItemIcon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="10"/></svg>',this.originalFetch=null,this.originalXhrOpen=null,this.navItemDragPreview=null,this.navItemDragStartY=0,this.isNavItemDragging=!1,this.navItemDragExpandTimeout=null,this.navInitialized=!1,this.logo="",this.label="",this.homeUrl="/",this.scheme="light",this.nav=[],this.navIconsDisplayed=!1,this.navExpanded=!1,this.user=null,this.subbar=!1,this.navEnabled=!0,this.userType="employee",this.breadcrumbs=[],this.navItemsExpanded=new Set,this.navQuery="",this.activeNavItemId=null,this.isNavScrolled=!1,this.isNavOpened="false"!==localStorage.getItem("kr-scaffold-nav-opened"),this.isEditing=!1,this.isUserMenuOpen=!1,this.pref={nav:{}},this.draggedNavItemId=null,this.navItemDropTargetId=null,this.navItemDropPosition="above",this.pendingRequests=0,this.boundHandleMouseMove=this.handleMouseMove.bind(this),this.boundHandleMouseUp=this.handleMouseUp.bind(this)}connectedCallback(){super.connectedCallback(),this.installFetchInterceptor()}firstUpdated(){this.loadPref()}updated(e){super.updated(e),e.has("nav")&&this.nav.length>0&&(this.updateActiveNavItem(),this.navExpanded&&!this.navInitialized&&(this.navInitialized=!0,this.getComputedNav().filter((e=>"group"===e.type)).forEach((e=>this.navItemsExpanded.add(e.id)))))}disconnectedCallback(){super.disconnectedCallback(),this.uninstallFetchInterceptor()}installFetchInterceptor(){if(this.originalFetch)return;const e=this;this.originalFetch=window.fetch.bind(window);const t=this.originalFetch;window.fetch=function(...i){return e.pendingRequests++,t(...i).finally((()=>{e.pendingRequests--}))},this.originalXhrOpen=XMLHttpRequest.prototype.open;const i=this.originalXhrOpen;XMLHttpRequest.prototype.open=function(t,s,n=!0,r,a){return e.pendingRequests++,this.addEventListener("loadend",(()=>{e.pendingRequests--}),{once:!0}),i.call(this,t,s,n,r,a)}}uninstallFetchInterceptor(){this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null)}resolveUrl(e){if(!e.url)return"#";if(e.external)return e.url;let t=e.url;e.url.startsWith("/")&&(t=e.url.slice(1));const i=document.querySelector("base")?.getAttribute("href")||"/";return i.endsWith("/")?i+t:i+"/"+t}getComputedNav(){const e=[];return this.nav.forEach(((t,i)=>{const s=this.pref.nav[t.id];e.push({...t,...s,order:s?.order??t.order??i,parentId:s?.parentId??null}),"group"===t.type&&t.children&&t.children.forEach(((i,s)=>{const n=this.pref.nav[i.id];let r=t.id;void 0!==n?.parentId&&(r=n.parentId),e.push({...i,...n,order:n?.order??i.order??s,parentId:r})}))})),Object.entries(this.pref.nav).forEach((([t,i])=>{t.startsWith("custom")&&i.type&&i.label&&e.push({id:t,type:i.type,label:i.label,icon:i.icon,url:i.url,active:i.active,order:i.order??e.length,parentId:i.parentId??null})})),e}getNavItemChildren(e){let t=this.getComputedNav().filter((t=>t.parentId===e)).sort(((e,t)=>e.order-t.order));if(this.isEditing||(t=t.filter((e=>!1!==e.active))),this.navQuery){const i=this.navQuery.toLowerCase(),s=this.getComputedNav();if(null!==e){const n=s.find((t=>t.id===e));if(n?.label.toLowerCase().includes(i))return t}t=t.filter((e=>"group"===e.type?e.label.toLowerCase().includes(i)||s.some((t=>t.parentId===e.id&&!1!==t.active&&t.label.toLowerCase().includes(i))):e.label.toLowerCase().includes(i)))}return t}handleNavQueryChange(e){this.navQuery=e.target.value,this.navQuery?this.getComputedNav().forEach((e=>{"group"===e.type&&this.navItemsExpanded.add(e.id)})):this.navItemsExpanded.clear()}handleNavQueryClear(){this.navQuery="",this.navItemsExpanded.clear()}handleMenuClick(){this.isNavOpened=!this.isNavOpened,localStorage.setItem("kr-scaffold-nav-opened",String(this.isNavOpened))}handleNavHeaderClick(){this.activeNavItemId=null;const e=new CustomEvent("nav-item-click",{detail:{item:{url:this.homeUrl}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||(window.location.href=this.homeUrl)}handleNavScroll(e){this.isNavScrolled=e.target.scrollTop>0}toggleNavItem(e){const t=this.shadowRoot?.querySelector(`.nav-item[data-id="${e}"]`),i=t?.nextElementSibling;i&&(this.navItemsExpanded.has(e)?(this.navItemsExpanded.delete(e),i.animate([{height:`${i.scrollHeight}px`},{height:"0px"}],{duration:300,easing:"ease-in-out"}).onfinish=()=>{i.classList.remove("nav-group--expanded")}):(this.navItemsExpanded.add(e),i.classList.add("nav-group--expanded"),i.animate([{height:"0px"},{height:`${i.scrollHeight}px`}],{duration:300,easing:"ease-in-out"})),this.requestUpdate())}handleNavItemClick(e,t){if("group"===t.type)this.toggleNavItem(t.id);else{if(e.ctrlKey||e.metaKey||1===e.button)return;this.activeNavItemId=t.id;const i=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&e.preventDefault()}}updateActiveNavItem(){const e=window.location.pathname,t=this.getComputedNav().filter((e=>"item"===e.type&&e.url));let i=null,s=0;for(const n of t){const t=this.resolveUrl(n);e.startsWith(t)&&t.length>s&&(i=n,s=t.length)}i?(this.activeNavItemId=i.id,i.parentId&&this.navItemsExpanded.add(i.parentId)):this.activeNavItemId=null}startEditing(){this.isEditing=!0}cancelEditing(){this.isEditing=!1,this.loadPref()}resetPref(){this.pref.nav={}}savePref(){if("customer"===this.userType)return;let e="/api/system/preference/json/scaffold?global=true",t="POST";this.pref.uuid&&(e=`/api/system/preference/json/scaffold/${this.pref.uuid}?global=true`,t="PUT"),i.Http.fetch({url:e,method:t,body:JSON.stringify({nav:this.pref.nav})}).then((e=>e.json())).then((e=>{this.pref=e.data,this.isEditing=!1})).catch((e=>{console.error("Failed to save nav customizations:",e)}))}loadPref(){"customer"!==this.userType&&i.Http.fetch({url:"/api/system/preference/json/scaffold?global=true",method:"GET"}).then((e=>e.json())).then((e=>{const t=e?.data?.[0];t&&(this.pref=t)})).catch((()=>{}))}handleNavItemContextMenu(e,i){this.isEditing&&(e.preventDefault(),t.ContextMenu.open({x:e.clientX,y:e.clientY,items:[{id:"edit",label:"Edit Item"},{id:"divider-1",label:"",divider:!0},{id:"add-above",label:"Add Item Above"},{id:"add-below",label:"Add Item Below"}]}).then((e=>{if(e)switch(e.id){case"edit":this.openNavItemEdit(i);break;case"add-above":this.addNavItem(i,"above");break;case"add-below":this.addNavItem(i,"below")}})))}openNavItemEdit(e){t.Dialog.open($e,{data:e}).afterClosed().then((t=>{const i=t;i&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id]={...this.pref.nav[e.id],...i},this.requestUpdate())}))}addNavItem(e,t){const i=`custom-${Date.now()}`,s=this.getComputedNav().filter((t=>t.parentId===e.parentId)).sort(((e,t)=>e.order-t.order)),n=s.findIndex((t=>t.id===e.id));let r;r="above"===t?n:n+1,s.forEach(((e,t)=>{t>=r&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id].order=t+1)}));const a={id:i,type:"item",label:"New Item",order:r,parentId:e.parentId,active:!0};this.pref.nav[i]=a,this.requestUpdate(),this.openNavItemEdit(a)}handleNavItemMouseDown(e,t){this.isEditing&&(e.preventDefault(),this.draggedNavItemId=t.id,this.navItemDragStartY=e.clientY,this.isNavItemDragging=!1,document.addEventListener("mousemove",this.boundHandleMouseMove),document.addEventListener("mouseup",this.boundHandleMouseUp))}handleMouseMove(e){if(this.draggedNavItemId){if(!this.isNavItemDragging&&Math.abs(e.clientY-this.navItemDragStartY)>5){this.isNavItemDragging=!0,this.classList.add("kr-scaffold--dragging");const t=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));t&&(this.navItemDragPreview=document.createElement("div"),this.navItemDragPreview.className="nav-item-drag-preview",this.navItemDragPreview.textContent=t.label,this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px",this.shadowRoot?.appendChild(this.navItemDragPreview))}this.isNavItemDragging&&(this.navItemDragPreview&&(this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px"),this.updateNavItemDropTarget(e))}}handleMouseUp(){document.removeEventListener("mousemove",this.boundHandleMouseMove),document.removeEventListener("mouseup",this.boundHandleMouseUp),this.isNavItemDragging&&this.navItemDropTargetId&&this.executeNavItemDrop(),this.draggedNavItemId=null,this.navItemDropTargetId=null,this.isNavItemDragging=!1,this.classList.remove("kr-scaffold--dragging"),this.navItemDragPreview&&(this.navItemDragPreview.remove(),this.navItemDragPreview=null),this.clearNavItemDragExpandTimeout(),this.requestUpdate()}updateNavItemDropTarget(e){const t=this.shadowRoot?.querySelectorAll(".nav-item[data-id]");if(!t)return;let i=!1;t.forEach((t=>{const s=t.getBoundingClientRect(),n=t.getAttribute("data-id");if(!n||n===this.draggedNavItemId)return;if(e.clientX<s.left||e.clientX>s.right||e.clientY<s.top||e.clientY>s.bottom)return;const r=this.getComputedNav().find((e=>e.id===n));if(!r)return;const a=e.clientY-s.top;let o,l;"group"===r.type?a<s.height/3?(o="above",this.clearNavItemDragExpandTimeout()):a>2*s.height/3?(o="below",this.clearNavItemDragExpandTimeout()):(o="center",this.navItemsExpanded.has(r.id)||this.navItemDragExpandTimeout||this.expandNavGroupOnDrag(r.id)):(o=a<s.height/2?"above":"below",this.clearNavItemDragExpandTimeout()),l="center"===o?r.id:r.parentId;const h=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));if(l===this.draggedNavItemId||"group"===h?.type&&null!==l)return this.navItemDropTargetId=null,void this.clearNavItemDragExpandTimeout();this.navItemDropTargetId=r.id,this.navItemDropPosition=o,i=!0})),i||(this.navItemDropTargetId=null,this.clearNavItemDragExpandTimeout()),this.requestUpdate()}clearNavItemDragExpandTimeout(){this.navItemDragExpandTimeout&&(clearTimeout(this.navItemDragExpandTimeout),this.navItemDragExpandTimeout=null)}expandNavGroupOnDrag(e){this.navItemDragExpandTimeout=window.setTimeout((()=>{this.navItemDropTargetId===e&&"center"===this.navItemDropPosition&&(this.navItemsExpanded.add(e),this.requestUpdate()),this.navItemDragExpandTimeout=null}),500)}executeNavItemDrop(){if(!this.draggedNavItemId||!this.navItemDropTargetId)return;const e=this.getComputedNav(),t=e.find((e=>e.id===this.draggedNavItemId)),i=e.find((e=>e.id===this.navItemDropTargetId));if(!t||!i)return;let s;if("center"===this.navItemDropPosition&&"group"===i.type){if(i.id===this.draggedNavItemId)return;s=i.id}else s=i.parentId;if(s===this.draggedNavItemId)return;const n=e.filter((e=>e.parentId===s&&e.id!==this.draggedNavItemId)).sort(((e,t)=>e.order-t.order)),r=this.pref.nav;let a;if("center"===this.navItemDropPosition)a=n.length>0?Math.max(...n.map((e=>e.order)))+1:0;else{const e=n.findIndex((e=>e.id===i.id));a=-1===e?0:"above"===this.navItemDropPosition?e:e+1,n.forEach(((e,t)=>{r[e.id]||(r[e.id]={}),r[e.id].order=t>=a?t+1:t}))}r[this.draggedNavItemId]||(r[this.draggedNavItemId]={}),r[this.draggedNavItemId].order=a,r[this.draggedNavItemId].parentId=s,this.pref.nav=r,this.requestUpdate()}toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}closeUserMenu(){this.isUserMenuOpen=!1}handleCustomize(){this.closeUserMenu(),this.startEditing()}renderNormalFooter(){if(!this.user)return Q;const e=this.user.name.split(" ").map((e=>e[0])).join("").toUpperCase().slice(0,2);return q`
|
|
202
202
|
<div class="user-menu-container">
|
|
203
|
-
${this.isUserMenuOpen?
|
|
203
|
+
${this.isUserMenuOpen?q`
|
|
204
204
|
<div class="user-menu">
|
|
205
205
|
<button class="user-menu__item" @click=${this.handleCustomize}>
|
|
206
206
|
Customize Navigation
|
|
207
207
|
</button>
|
|
208
208
|
</div>
|
|
209
|
-
`:
|
|
209
|
+
`:Q}
|
|
210
210
|
<div class="user" @click=${this.toggleUserMenu}>
|
|
211
211
|
<div class="user__avatar">
|
|
212
|
-
${this.user.avatar?
|
|
212
|
+
${this.user.avatar?q`<img src=${this.user.avatar} alt=${this.user.name} />`:e}
|
|
213
213
|
</div>
|
|
214
214
|
<div class="user__info">
|
|
215
215
|
<div class="user__name">${this.user.name}</div>
|
|
216
|
-
${this.user.email?
|
|
216
|
+
${this.user.email?q`<div class="user__email">${this.user.email}</div>`:Q}
|
|
217
217
|
</div>
|
|
218
218
|
</div>
|
|
219
219
|
</div>
|
|
220
|
-
`}renderEditFooter(){return
|
|
220
|
+
`}renderEditFooter(){return q`
|
|
221
221
|
<div class="edit-actions">
|
|
222
222
|
<button class="edit-actions__btn edit-actions__btn--primary" @click=${this.savePref}>
|
|
223
223
|
Save
|
|
@@ -231,17 +231,17 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
231
231
|
</button>
|
|
232
232
|
</div>
|
|
233
233
|
</div>
|
|
234
|
-
`}renderNavItem(e,t=!1){if("section"===e.type)return
|
|
234
|
+
`}renderNavItem(e,t=!1){if("section"===e.type)return q`
|
|
235
235
|
<div class="nav-section">${e.label}</div>
|
|
236
|
-
`;if("group"===e.type){const t=this.getNavItemChildren(e.id);return
|
|
236
|
+
`;if("group"===e.type){const t=this.getNavItemChildren(e.id);return q`
|
|
237
237
|
<button
|
|
238
|
-
class=${
|
|
238
|
+
class=${ye({"nav-item":!0,"nav-item--expanded":this.navItemsExpanded.has(e.id),"nav-item--hidden":this.isEditing&&!1===e.active,"nav-item--drop-above":this.navItemDropTargetId===e.id&&"above"===this.navItemDropPosition,"nav-item--drop-below":this.navItemDropTargetId===e.id&&"below"===this.navItemDropPosition,"nav-item--drop-center":this.navItemDropTargetId===e.id&&"center"===this.navItemDropPosition})}
|
|
239
239
|
data-id="${e.id}"
|
|
240
240
|
@mousedown=${t=>this.handleNavItemMouseDown(t,e)}
|
|
241
241
|
@click=${t=>this.handleNavItemClick(t,e)}
|
|
242
242
|
@contextmenu=${t=>this.handleNavItemContextMenu(t,e)}
|
|
243
243
|
>
|
|
244
|
-
${this.navIconsDisplayed?
|
|
244
|
+
${this.navIconsDisplayed?q`<span class="nav-item__icon">${_e(e.icon||this.defaultNavItemIcon)}</span>`:Q}
|
|
245
245
|
<span class="nav-item__label">${e.label}</span>
|
|
246
246
|
<svg
|
|
247
247
|
class="nav-item__chevron"
|
|
@@ -257,24 +257,24 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
257
257
|
/>
|
|
258
258
|
</svg>
|
|
259
259
|
</button>
|
|
260
|
-
<div class=${
|
|
260
|
+
<div class=${ye({"nav-group":!0,"nav-group--expanded":this.navItemsExpanded.has(e.id)})}>
|
|
261
261
|
${t.map((e=>this.renderNavItem(e,!0)))}
|
|
262
262
|
</div>
|
|
263
|
-
`}return
|
|
263
|
+
`}return q`
|
|
264
264
|
<a
|
|
265
|
-
class=${
|
|
265
|
+
class=${ye({"nav-item":!0,"nav-item--active":this.activeNavItemId===e.id,"nav-item--hidden":this.isEditing&&!1===e.active,"nav-item--drop-above":this.navItemDropTargetId===e.id&&"above"===this.navItemDropPosition,"nav-item--drop-below":this.navItemDropTargetId===e.id&&"below"===this.navItemDropPosition})}
|
|
266
266
|
data-id="${e.id}"
|
|
267
267
|
href=${this.resolveUrl(e)}
|
|
268
|
-
target=${e.external?"_blank":
|
|
268
|
+
target=${e.external?"_blank":Q}
|
|
269
269
|
@mousedown=${t=>this.handleNavItemMouseDown(t,e)}
|
|
270
270
|
@click=${t=>this.handleNavItemClick(t,e)}
|
|
271
271
|
@contextmenu=${t=>this.handleNavItemContextMenu(t,e)}
|
|
272
272
|
>
|
|
273
|
-
${this.navIconsDisplayed&&!t?
|
|
273
|
+
${this.navIconsDisplayed&&!t?q`<span class="nav-item__icon">${_e(e.icon||this.defaultNavItemIcon)}</span>`:Q}
|
|
274
274
|
<span class="nav-item__label">${e.label}</span>
|
|
275
275
|
</a>
|
|
276
|
-
`}render(){const e=this.getNavItemChildren(null),t=this.getComputedNav().filter((e=>null===e.parentId)).length;return
|
|
277
|
-
<div class=${
|
|
276
|
+
`}render(){const e=this.getNavItemChildren(null),t=this.getComputedNav().filter((e=>null===e.parentId)).length;return q`
|
|
277
|
+
<div class=${ye({progress:!0,"progress--loading":this.pendingRequests>0})}>
|
|
278
278
|
<div class="progress__track"></div>
|
|
279
279
|
<div class="progress__bar progress__bar--primary">
|
|
280
280
|
<span class="progress__bar-inner"></span>
|
|
@@ -284,7 +284,7 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
284
284
|
</div>
|
|
285
285
|
</div>
|
|
286
286
|
|
|
287
|
-
${this.subbar?
|
|
287
|
+
${this.subbar?q`
|
|
288
288
|
<kr-subbar
|
|
289
289
|
menu
|
|
290
290
|
.breadcrumbs=${this.breadcrumbs}
|
|
@@ -292,20 +292,20 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
292
292
|
>
|
|
293
293
|
<slot name="subbar"></slot>
|
|
294
294
|
</kr-subbar>
|
|
295
|
-
`:
|
|
295
|
+
`:Q}
|
|
296
296
|
|
|
297
297
|
<div class="wrapper">
|
|
298
|
-
${this.navEnabled?
|
|
299
|
-
<nav class=${
|
|
298
|
+
${this.navEnabled?q`
|
|
299
|
+
<nav class=${ye({nav:!0,"nav--scrolled":this.isNavScrolled,"nav--opened":!this.subbar||this.isNavOpened})}>
|
|
300
300
|
<div class="nav-header" @click=${this.handleNavHeaderClick}>
|
|
301
|
-
${this.label?
|
|
301
|
+
${this.label?q`<span class="nav-title">${this.label}</span>`:this.logo?q`<img
|
|
302
302
|
class="nav-logo"
|
|
303
303
|
src=${this.logo}
|
|
304
304
|
alt="Logo"
|
|
305
|
-
/>`:
|
|
305
|
+
/>`:Q}
|
|
306
306
|
</div>
|
|
307
307
|
<div class="nav-content" @scroll=${this.handleNavScroll}>
|
|
308
|
-
${t>20?
|
|
308
|
+
${t>20?q`
|
|
309
309
|
<div class="nav-search">
|
|
310
310
|
<div class="nav-search__wrapper">
|
|
311
311
|
<span class="nav-search__icon">
|
|
@@ -324,7 +324,7 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
324
324
|
.value=${this.navQuery}
|
|
325
325
|
@input=${this.handleNavQueryChange}
|
|
326
326
|
/>
|
|
327
|
-
${this.navQuery?
|
|
327
|
+
${this.navQuery?q`
|
|
328
328
|
<button class="nav-search__clear" @click=${this.handleNavQueryClear}>
|
|
329
329
|
<svg
|
|
330
330
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -334,10 +334,10 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
334
334
|
<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"/>
|
|
335
335
|
</svg>
|
|
336
336
|
</button>
|
|
337
|
-
`:
|
|
337
|
+
`:Q}
|
|
338
338
|
</div>
|
|
339
339
|
</div>
|
|
340
|
-
`:
|
|
340
|
+
`:Q}
|
|
341
341
|
<div class="nav-items">
|
|
342
342
|
${e.map((e=>this.renderNavItem(e)))}
|
|
343
343
|
</div>
|
|
@@ -346,7 +346,7 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
346
346
|
${this.isEditing?this.renderEditFooter():this.renderNormalFooter()}
|
|
347
347
|
</div> -->
|
|
348
348
|
</nav>
|
|
349
|
-
`:
|
|
349
|
+
`:Q}
|
|
350
350
|
|
|
351
351
|
<main class="main">
|
|
352
352
|
<slot></slot>
|
|
@@ -1078,21 +1078,21 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
1078
1078
|
transform: scaleX(0.08);
|
|
1079
1079
|
}
|
|
1080
1080
|
}
|
|
1081
|
-
`,
|
|
1081
|
+
`,Se([ue({type:String})],e.Scaffold.prototype,"logo",void 0),Se([ue({type:String})],e.Scaffold.prototype,"label",void 0),Se([ue({type:String,attribute:"home-url"})],e.Scaffold.prototype,"homeUrl",void 0),Se([ue({type:String,reflect:!0})],e.Scaffold.prototype,"scheme",void 0),Se([ue({type:Array})],e.Scaffold.prototype,"nav",void 0),Se([ue({type:Boolean,attribute:"nav-icons-displayed",reflect:!0})],e.Scaffold.prototype,"navIconsDisplayed",void 0),Se([ue({type:Boolean,attribute:"nav-expanded"})],e.Scaffold.prototype,"navExpanded",void 0),Se([ue({type:Object})],e.Scaffold.prototype,"user",void 0),Se([ue({type:Boolean})],e.Scaffold.prototype,"subbar",void 0),Se([ue({type:Boolean,attribute:"nav-enabled"})],e.Scaffold.prototype,"navEnabled",void 0),Se([ue({type:String,attribute:"user-type"})],e.Scaffold.prototype,"userType",void 0),Se([ue({type:Array})],e.Scaffold.prototype,"breadcrumbs",void 0),Se([ge()],e.Scaffold.prototype,"navItemsExpanded",void 0),Se([ge()],e.Scaffold.prototype,"navQuery",void 0),Se([ge()],e.Scaffold.prototype,"activeNavItemId",void 0),Se([ge()],e.Scaffold.prototype,"isNavScrolled",void 0),Se([ge()],e.Scaffold.prototype,"isNavOpened",void 0),Se([ge()],e.Scaffold.prototype,"isEditing",void 0),Se([ge()],e.Scaffold.prototype,"isUserMenuOpen",void 0),Se([ge()],e.Scaffold.prototype,"pref",void 0),Se([ge()],e.Scaffold.prototype,"draggedNavItemId",void 0),Se([ge()],e.Scaffold.prototype,"navItemDropTargetId",void 0),Se([ge()],e.Scaffold.prototype,"navItemDropPosition",void 0),Se([ge()],e.Scaffold.prototype,"pendingRequests",void 0),e.Scaffold=Se([ce("kr-scaffold")],e.Scaffold);var Ie=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.ScreenNav=class extends le{constructor(){super(...arguments),this.label="",this.subLabel="",this.items=[],this.activeId="",this.handlePopstate=()=>{this.syncActiveFromUrl()}}connectedCallback(){super.connectedCallback(),requestAnimationFrame((()=>this.syncActiveFromUrl())),window.addEventListener("popstate",this.handlePopstate)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopstate)}handleNavItemClick(e,t){const i=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&e.preventDefault(),this.activeId=t.id}syncActiveFromUrl(){const e=window.location.pathname,t=this.items.find((t=>!!t.url&&(t.url.startsWith("/")?e===t.url:e.endsWith("/"+t.url))));t&&(this.activeId=t.id)}render(){return q`
|
|
1082
1082
|
<nav class="nav">
|
|
1083
|
-
${this.label?
|
|
1083
|
+
${this.label?q`
|
|
1084
1084
|
<div class="nav-header">
|
|
1085
1085
|
<div class="nav-header__text">
|
|
1086
|
-
${this.subLabel?
|
|
1086
|
+
${this.subLabel?q`<div class="nav-header__subtitle">${this.subLabel}</div>`:Q}
|
|
1087
1087
|
<div class="nav-header__title">${this.label}</div>
|
|
1088
1088
|
</div>
|
|
1089
1089
|
</div>
|
|
1090
|
-
`:
|
|
1090
|
+
`:Q}
|
|
1091
1091
|
<div class="nav-content">
|
|
1092
1092
|
<div class="nav-items">
|
|
1093
|
-
${this.items.map((e=>
|
|
1093
|
+
${this.items.map((e=>q`
|
|
1094
1094
|
<a
|
|
1095
|
-
class=${
|
|
1095
|
+
class=${ye({"nav-item":!0,"nav-item--active":e.id===this.activeId})}
|
|
1096
1096
|
href=${e.url||"#"}
|
|
1097
1097
|
@click=${t=>this.handleNavItemClick(t,e)}
|
|
1098
1098
|
>
|
|
@@ -1198,7 +1198,7 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
1198
1198
|
flex: 1;
|
|
1199
1199
|
overflow-y: auto;
|
|
1200
1200
|
}
|
|
1201
|
-
`,
|
|
1201
|
+
`,Ie([ue({type:String})],e.ScreenNav.prototype,"label",void 0),Ie([ue({type:String})],e.ScreenNav.prototype,"subLabel",void 0),Ie([ue({type:Array})],e.ScreenNav.prototype,"items",void 0),Ie([ue({type:String})],e.ScreenNav.prototype,"activeId",void 0),e.ScreenNav=Ie([ce("kr-screen-nav")],e.ScreenNav);var Ee=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.ScreenDetail=class extends le{constructor(){super(...arguments),this.title=""}render(){return q`
|
|
1202
1202
|
<div class="header">
|
|
1203
1203
|
<h2 class="header__title">${this.title}</h2>
|
|
1204
1204
|
<div class="header__actions">
|
|
@@ -1254,8 +1254,8 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
1254
1254
|
width: 100%;
|
|
1255
1255
|
max-width: 700px;
|
|
1256
1256
|
}
|
|
1257
|
-
`,Ee([ue({type:String})],e.ScreenDetail.prototype,"title",void 0),e.ScreenDetail=Ee([
|
|
1258
|
-
${this.menu?
|
|
1257
|
+
`,Ee([ue({type:String})],e.ScreenDetail.prototype,"title",void 0),e.ScreenDetail=Ee([ce("kr-screen-detail")],e.ScreenDetail);var Ce=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.Subbar=class extends le{constructor(){super(...arguments),this.breadcrumbs=[],this.menu=!1}_handleMenuClick(){this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0}))}resolveUrl(e){if(!e.url)return"#";let t=e.url;e.url.startsWith("/")&&(t=e.url.slice(1));const i=document.querySelector("base")?.getAttribute("href")||"/";return i.endsWith("/")?i+t:i+"/"+t}_handleBreadcrumbClick(e,t,i){if(i||!t.url)return void e.preventDefault();if(e.ctrlKey||e.metaKey||1===e.button)return;const s=new CustomEvent("breadcrumb-click",{detail:{breadcrumb:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),s.defaultPrevented&&e.preventDefault()}render(){return q`
|
|
1258
|
+
${this.menu?q`
|
|
1259
1259
|
<div class="menu" @click=${this._handleMenuClick}>
|
|
1260
1260
|
<svg
|
|
1261
1261
|
class="menu__icon"
|
|
@@ -1284,14 +1284,14 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
1284
1284
|
></line>
|
|
1285
1285
|
</svg>
|
|
1286
1286
|
</div>
|
|
1287
|
-
`:
|
|
1287
|
+
`:Q}
|
|
1288
1288
|
<div class="breadcrumbs">
|
|
1289
|
-
${this.breadcrumbs.map(((e,t)=>{const
|
|
1290
|
-
${t>0?
|
|
1289
|
+
${this.breadcrumbs.map(((e,t)=>{const i=t===this.breadcrumbs.length-1;return q`
|
|
1290
|
+
${t>0?q`<span class="breadcrumb-separator">/</span>`:""}
|
|
1291
1291
|
<a
|
|
1292
|
-
class=${
|
|
1292
|
+
class=${ye({breadcrumb:!0,"breadcrumb--current":i})}
|
|
1293
1293
|
href=${this.resolveUrl(e)}
|
|
1294
|
-
@click=${t=>this._handleBreadcrumbClick(t,e,
|
|
1294
|
+
@click=${t=>this._handleBreadcrumbClick(t,e,i)}
|
|
1295
1295
|
>${e.label}</a>
|
|
1296
1296
|
`}))}
|
|
1297
1297
|
</div>
|
|
@@ -1365,26 +1365,102 @@ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Ref
|
|
|
1365
1365
|
width: 18px;
|
|
1366
1366
|
height: 18px;
|
|
1367
1367
|
}
|
|
1368
|
-
`,
|
|
1368
|
+
`,Ce([ue({type:Array})],e.Subbar.prototype,"breadcrumbs",void 0),Ce([ue({type:Boolean})],e.Subbar.prototype,"menu",void 0),e.Subbar=Ce([ce("kr-subbar")],e.Subbar);var Ae=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class ze{static configure(e){ze.base=e.base,ze.routes=e.routes,window.addEventListener("click",(e=>{const t=e.composedPath().find((e=>e instanceof HTMLAnchorElement));t&&t.origin===window.location.origin&&t.pathname.startsWith(ze.base)&&(e.preventDefault(),ze.navigate(t.pathname))}))}static navigate(e){let t=e;e.startsWith("/")||(t=ze.base+"/"+e),window.history.pushState({},"",t),window.dispatchEvent(new PopStateEvent("popstate"))}static getParams(){const e=ze.matchAll(),t={};for(const i of e)for(const e in i.params)t[e]=decodeURIComponent(i.params[e]);return t}static outlet(e){const t=ze.matchAll();if(e>=t.length)return null;const i=t[e].route.component,s=ze.elementCache.get(e+":"+i);if(s)return s;for(const t of ze.elementCache.keys())t.startsWith(e+":")&&ze.elementCache.delete(t);const n=document.createElement(i);return ze.elementCache.set(e+":"+i,n),n}static matchAll(){const e=window.location.pathname;let t=e;e.startsWith(ze.base)&&(t=e.slice(ze.base.length));const i=t.split("/").filter((e=>e));return ze.matchRoutes(ze.routes,i)}static matchRoutes(e,t){for(const i of e){const e=i.path.split("/").filter((e=>e));if(0===e.length&&0===t.length)return[{route:i,params:{}}];if(0===e.length)continue;if(t.length<e.length)continue;const s={};let n=!0;for(let i=0;i<e.length;i++)if(e[i].startsWith(":"))s[e[i].slice(1)]=t[i];else if(e[i]!==t[i]){n=!1;break}if(!n)continue;const r=t.slice(e.length);if(r.length>0&&!i.children)continue;const a=[{route:i,params:s}];if(i.children&&r.length>0){const e=ze.matchRoutes(i.children,r);if(e.length>0)return a.push(...e),a}if(i.children&&0===r.length&&i.default){window.history.replaceState({},"",window.location.pathname+"/"+i.default);const e=ze.matchRoutes(i.children,[i.default]);if(e.length>0)return a.push(...e),a}return a}return[]}}ze.base="",ze.routes=[],ze.elementCache=new Map,e.RouterOutlet=class extends le{constructor(){super(...arguments),this.level=-1,this.handlePopState=()=>{this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.level=this.detectLevel(),window.addEventListener("popstate",this.handlePopState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopState)}detectLevel(){let e=0,t=this;for(;t;)t instanceof ShadowRoot?t=t.host:(t instanceof HTMLElement&&"KR-ROUTER-OUTLET"===t.tagName&&t!==this&&e++,t=t instanceof HTMLElement?t.parentNode:null);return e}render(){const e=ze.outlet(this.level);return e?q`${e}`:q``}},e.RouterOutlet.styles=l`
|
|
1369
1369
|
:host {
|
|
1370
1370
|
display: block;
|
|
1371
1371
|
height: 100%;
|
|
1372
1372
|
}
|
|
1373
|
-
`,e.RouterOutlet=
|
|
1373
|
+
`,e.RouterOutlet=Ae([ce("kr-router-outlet")],e.RouterOutlet);
|
|
1374
1374
|
/**
|
|
1375
1375
|
* @license
|
|
1376
1376
|
* Copyright 2020 Google LLC
|
|
1377
1377
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1378
1378
|
*/
|
|
1379
|
-
const{I:
|
|
1379
|
+
const{I:Me}=re,De=()=>document.createComment(""),Te=(e,t,i)=>{const s=e._$AA.parentNode,n=void 0===t?e._$AB:t._$AA;if(void 0===i){const t=s.insertBefore(De(),n),r=s.insertBefore(De(),n);i=new Me(t,r,e,e.options)}else{const t=i._$AB.nextSibling,r=i._$AM,a=r!==e;if(a){let t;i._$AQ?.(e),i._$AM=e,void 0!==i._$AP&&(t=e._$AU)!==r._$AU&&i._$AP(t)}if(t!==n||a){let e=i._$AA;for(;e!==t;){const t=e.nextSibling;s.insertBefore(e,n),e=t}}}return i},Re=(e,t,i=e)=>(e._$AI(t,i),e),Ne={},Pe=(e,t=Ne)=>e._$AH=t,Oe=e=>{e._$AR(),e._$AA.remove()},Ue=(e,t,i)=>{const s=new Map;for(let n=t;n<=i;n++)s.set(e[n],n);return s},Le=be(class extends xe{constructor(e){if(super(e),e.type!==ve)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 n=[],r=[];let a=0;for(const t of e)n[a]=s?s(t,a):a,r[a]=i(t,a),a++;return{values:r,keys:n}}render(e,t,i){return this.dt(e,t,i).values}update(e,[t,i,s]){const n=(e=>e._$AH)(e),{values:r,keys:a}=this.dt(t,i,s);if(!Array.isArray(n))return this.ut=a,r;const o=this.ut??=[],l=[];let h,c,d=0,p=n.length-1,u=0,g=r.length-1;for(;d<=p&&u<=g;)if(null===n[d])d++;else if(null===n[p])p--;else if(o[d]===a[u])l[u]=Re(n[d],r[u]),d++,u++;else if(o[p]===a[g])l[g]=Re(n[p],r[g]),p--,g--;else if(o[d]===a[g])l[g]=Re(n[d],r[g]),Te(e,l[g+1],n[d]),d++,g--;else if(o[p]===a[u])l[u]=Re(n[p],r[u]),Te(e,n[d],n[p]),p--,u++;else if(void 0===h&&(h=Ue(a,u,g),c=Ue(o,d,p)),h.has(o[d]))if(h.has(o[p])){const t=c.get(a[u]),i=void 0!==t?n[t]:null;if(null===i){const t=Te(e,n[d]);Re(t,r[u]),l[u]=t}else l[u]=Re(i,r[u]),Te(e,n[d],i),n[t]=null;u++}else Oe(n[p]),p--;else Oe(n[d]),d++;for(;u<=g;){const t=Te(e,l[g+1]);Re(t,r[u]),l[u++]=t}for(;d<=p;){const e=n[d++];null!==e&&Oe(e)}return this.ut=a,Pe(e,l),X}});
|
|
1380
1380
|
/**
|
|
1381
1381
|
* @license
|
|
1382
1382
|
* Copyright 2017 Google LLC
|
|
1383
1383
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1384
|
-
*/function je(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let He={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Fe(e){He=e}const qe=/[&<>"']/,Be=new RegExp(qe.source,"g"),Xe=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,We=new RegExp(Xe.source,"g"),Qe={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye=e=>Qe[e];function Ze(e,t){if(t){if(qe.test(e))return e.replace(Be,Ye)}else if(Xe.test(e))return e.replace(We,Ye);return e}const Ve=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Ke(e){return e.replace(Ve,((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 Ge=/(^|[^\[])\^/g;function Je(e,t){let s="string"==typeof e?e:e.source;t=t||"";const i={replace:(e,t)=>{let n="string"==typeof t?t:t.source;return n=n.replace(Ge,"$1"),s=s.replace(e,n),i},getRegex:()=>new RegExp(s,t)};return i}function et(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const tt={exec:()=>null};function st(e,t){const s=e.replace(/\|/g,((e,t,s)=>{let i=!1,n=t;for(;--n>=0&&"\\"===s[n];)i=!i;return i?"|":" |"})).split(/ \|/);let i=0;if(s[0].trim()||s.shift(),s.length>0&&!s[s.length-1].trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(/\\\|/g,"|");return s}function it(e,t,s){const i=e.length;if(0===i)return"";let n=0;for(;n<i;){if(e.charAt(i-n-1)!==t)break;n++}return e.slice(0,i-n)}function nt(e,t,s,i){const n=t.href,r=t.title?Ze(t.title):null,a=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){i.state.inLink=!0;const e={type:"link",raw:s,href:n,title:r,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,e}return{type:"image",raw:s,href:n,title:r,text:Ze(a)}}class rt{options;rules;lexer;constructor(e){this.options=e||He}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:it(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],s=function(e,t){const s=e.match(/^(\s+)(?:```)/);if(null===s)return t;const i=s[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[s]=t;return s.length>=i.length?e.slice(i.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:s}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=it(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=it(e.replace(/^ *>[ \t]?/gm,""),"\n");const s=this.lexer.state.top;this.lexer.state.top=!0;const i=this.lexer.blockTokens(e);return this.lexer.state.top=s,{type:"blockquote",raw:t[0],tokens:i,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim();const i=s.length>1,n={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");const r=new RegExp(`^( {0,3}${s})((?:[\t ][^\\n]*)?(?:\\n|$))`);let a="",o="",l=!1;for(;e;){let s=!1;if(!(t=r.exec(e)))break;if(this.rules.block.hr.test(e))break;a=t[0],e=e.substring(a.length);let i=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],h=0;this.options.pedantic?(h=2,o=i.trimStart()):(h=t[2].search(/[^ ]/),h=h>4?1:h,o=i.slice(h),h+=t[1].length);let d=!1;if(!i&&/^ *$/.test(c)&&(a+=c+"\n",e=e.substring(c.length+1),s=!0),!s){const t=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),s=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),n=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(c=l,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),n.test(c))break;if(r.test(c))break;if(t.test(c))break;if(s.test(e))break;if(c.search(/[^ ]/)>=h||!c.trim())o+="\n"+c.slice(h);else{if(d)break;if(i.search(/[^ ]/)>=4)break;if(n.test(i))break;if(r.test(i))break;if(s.test(i))break;o+="\n"+c}d||c.trim()||(d=!0),a+=l+"\n",e=e.substring(l.length+1),i=c.slice(h)}}n.loose||(l?n.loose=!0:/\n *\n *$/.test(a)&&(l=!0));let p,u=null;this.options.gfm&&(u=/^\[[ xX]\] /.exec(o),u&&(p="[ ] "!==u[0],o=o.replace(/^\[[ xX]\] +/,""))),n.items.push({type:"list_item",raw:a,task:!!u,checked:p,loose:!1,text:o,tokens:[]}),n.raw+=a}n.items[n.items.length-1].raw=a.trimEnd(),n.items[n.items.length-1].text=o.trimEnd(),n.raw=n.raw.trimEnd();for(let e=0;e<n.items.length;e++)if(this.lexer.state.top=!1,n.items[e].tokens=this.lexer.blockTokens(n.items[e].text,[]),!n.loose){const t=n.items[e].tokens.filter((e=>"space"===e.type)),s=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));n.loose=s}if(n.loose)for(let e=0;e<n.items.length;e++)n.items[e].loose=!0;return n}}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," "),s=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=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:s,title:i}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const s=st(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),n=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(s.length===i.length){for(const e of i)/^ *-+: *$/.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 s)r.header.push({text:e,tokens:this.lexer.inline(e)});for(const e of n)r.rows.push(st(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:Ze(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=it(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 s=0;for(let i=0;i<e.length;i++)if("\\"===e[i])i++;else if(e[i]===t[0])s++;else if(e[i]===t[1]&&(s--,s<0))return i;return-1}(t[2],"()");if(e>-1){const s=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,s).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);e&&(s=e[1],i=e[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),/^</.test(s)&&(s=this.options.pedantic&&!/>$/.test(e)?s.slice(1):s.slice(1,-1)),nt(t,{href:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s,title:i?i.replace(this.rules.inline.anyPunctuation,"$1"):i},t[0],this.lexer)}}reflink(e,t){let s;if((s=this.rules.inline.reflink.exec(e))||(s=this.rules.inline.nolink.exec(e))){const e=t[(s[2]||s[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=s[0].charAt(0);return{type:"text",raw:e,text:e}}return nt(s,e,s[0],this.lexer)}}emStrong(e,t,s=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i)return;if(i[3]&&s.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!s||this.rules.inline.punctuation.exec(s)){const s=[...i[0]].length-1;let n,r,a=s,o=0;const l="*"===i[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+s);null!=(i=l.exec(t));){if(n=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!n)continue;if(r=[...n].length,i[3]||i[4]){a+=r;continue}if((i[5]||i[6])&&s%3&&!((s+r)%3)){o+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+o);const t=[...i[0]][0].length,l=e.slice(0,s+i.index+t+r);if(Math.min(s,r)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const s=/[^ ]/.test(e),i=/^ /.test(e)&&/ $/.test(e);return s&&i&&(e=e.substring(1,e.length-1)),e=Ze(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,s;return"@"===t[2]?(e=Ze(t[1]),s="mailto:"+e):(e=Ze(t[1]),s=e),{type:"link",raw:t[0],text:e,href:s,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,s;if("@"===t[2])e=Ze(t[0]),s="mailto:"+e;else{let i;do{i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(i!==t[0]);e=Ze(t[0]),s="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:s,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]:Ze(t[0]),{type:"text",raw:t[0],text:e}}}}const at=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ot=/(?:[*+-]|\d{1,9}[.)])/,lt=Je(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,ot).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(),ct=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ht=/(?!\s*\])(?:\\.|[^\[\]\\])+/,dt=Je(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",ht).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),pt=Je(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ot).getRegex(),ut="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",gt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ft=Je("^ {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",gt).replace("tag",ut).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),mt=Je(ct).replace("hr",at).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",ut).getRegex(),vt={blockquote:Je(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",mt).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:dt,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:at,html:ft,lheading:lt,list:pt,newline:/^(?: *(?:\n|$))+/,paragraph:mt,table:tt,text:/^[^\n]+/},bt=Je("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",at).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",ut).getRegex(),xt={...vt,table:bt,paragraph:Je(ct).replace("hr",at).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",bt).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",ut).getRegex()},kt={...vt,html:Je("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",gt).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:tt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Je(ct).replace("hr",at).replace("heading"," *#{1,6} *[^\n]").replace("lheading",lt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},yt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,_t=/^( {2,}|\\)\n(?!\s*$)/,wt="\\p{P}\\p{S}",$t=Je(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,wt).getRegex(),It=Je(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,wt).getRegex(),St=Je("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,wt).getRegex(),Et=Je("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,wt).getRegex(),At=Je(/\\([punct])/,"gu").replace(/punct/g,wt).getRegex(),zt=Je(/^<(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(),Ct=Je(gt).replace("(?:--\x3e|$)","--\x3e").getRegex(),Dt=Je("^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",Ct).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Tt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Rt=Je(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Tt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Nt=Je(/^!?\[(label)\]\[(ref)\]/).replace("label",Tt).replace("ref",ht).getRegex(),Mt=Je(/^!?\[(ref)\](?:\[\])?/).replace("ref",ht).getRegex(),Pt={_backpedal:tt,anyPunctuation:At,autolink:zt,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:_t,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:tt,emStrongLDelim:It,emStrongRDelimAst:St,emStrongRDelimUnd:Et,escape:yt,link:Rt,nolink:Mt,punctuation:$t,reflink:Nt,reflinkSearch:Je("reflink|nolink(?!\\()","g").replace("reflink",Nt).replace("nolink",Mt).getRegex(),tag:Dt,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:tt},Ot={...Pt,link:Je(/^!?\[(label)\]\((.*?)\)/).replace("label",Tt).getRegex(),reflink:Je(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Tt).getRegex()},Ut={...Pt,escape:Je(yt).replace("])","~|])").getRegex(),url:Je(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Lt={...Ut,br:Je(_t).replace("{2,}","*").getRegex(),text:Je(Ut.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},jt={normal:vt,gfm:xt,pedantic:kt},Ht={normal:Pt,gfm:Ut,breaks:Lt,pedantic:Ot};class Ft{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||He,this.options.tokenizer=this.options.tokenizer||new rt,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:jt.normal,inline:Ht.normal};this.options.pedantic?(t.block=jt.pedantic,t.inline=Ht.pedantic):this.options.gfm&&(t.block=jt.gfm,this.options.breaks?t.inline=Ht.breaks:t.inline=Ht.gfm),this.tokenizer.rules=t}static get rules(){return{block:jt,inline:Ht}}static lex(e,t){return new Ft(t).lex(e)}static lexInline(e,t){return new Ft(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 s,i,n,r;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,s)=>t+" ".repeat(s.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((i=>!!(s=i.call({lexer:this},e,t))&&(e=e.substring(s.raw.length),t.push(s),!0)))))if(s=this.tokenizer.space(e))e=e.substring(s.raw.length),1===s.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(s);else if(s=this.tokenizer.code(e))e=e.substring(s.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?t.push(s):(i.raw+="\n"+s.raw,i.text+="\n"+s.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(s=this.tokenizer.fences(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.heading(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.hr(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.blockquote(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.list(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.html(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.def(e))e=e.substring(s.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title}):(i.raw+="\n"+s.raw,i.text+="\n"+s.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(s=this.tokenizer.table(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.lheading(e))e=e.substring(s.raw.length),t.push(s);else{if(n=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const s=e.slice(1);let i;this.options.extensions.startBlock.forEach((e=>{i=e.call({lexer:this},s),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(n=e.substring(0,t+1))}if(this.state.top&&(s=this.tokenizer.paragraph(n)))i=t[t.length-1],r&&"paragraph"===i.type?(i.raw+="\n"+s.raw,i.text+="\n"+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s),r=n.length!==e.length,e=e.substring(s.raw.length);else if(s=this.tokenizer.text(e))e=e.substring(s.raw.length),i=t[t.length-1],i&&"text"===i.type?(i.raw+="\n"+s.raw,i.text+="\n"+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s);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 s,i,n,r,a,o,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(a||(o=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((i=>!!(s=i.call({lexer:this},e,t))&&(e=e.substring(s.raw.length),t.push(s),!0)))))if(s=this.tokenizer.escape(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.tag(e))e=e.substring(s.raw.length),i=t[t.length-1],i&&"text"===s.type&&"text"===i.type?(i.raw+=s.raw,i.text+=s.text):t.push(s);else if(s=this.tokenizer.link(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(s.raw.length),i=t[t.length-1],i&&"text"===s.type&&"text"===i.type?(i.raw+=s.raw,i.text+=s.text):t.push(s);else if(s=this.tokenizer.emStrong(e,l,o))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.codespan(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.br(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.del(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.autolink(e))e=e.substring(s.raw.length),t.push(s);else if(this.state.inLink||!(s=this.tokenizer.url(e))){if(n=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const s=e.slice(1);let i;this.options.extensions.startInline.forEach((e=>{i=e.call({lexer:this},s),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(n=e.substring(0,t+1))}if(s=this.tokenizer.inlineText(n))e=e.substring(s.raw.length),"_"!==s.raw.slice(-1)&&(o=s.raw.slice(-1)),a=!0,i=t[t.length-1],i&&"text"===i.type?(i.raw+=s.raw,i.text+=s.text):t.push(s);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(s.raw.length),t.push(s);return t}}class qt{options;constructor(e){this.options=e||He}code(e,t,s){const i=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",i?'<pre><code class="language-'+Ze(i)+'">'+(s?e:Ze(e,!0))+"</code></pre>\n":"<pre><code>"+(s?e:Ze(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,s){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,s){const i=t?"ol":"ul";return"<"+i+(t&&1!==s?' start="'+s+'"':"")+">\n"+e+"</"+i+">\n"}listitem(e,t,s){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 s=t.header?"th":"td";return(t.align?`<${s} align="${t.align}">`:`<${s}>`)+e+`</${s}>\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,s){const i=et(e);if(null===i)return s;let n='<a href="'+(e=i)+'"';return t&&(n+=' title="'+t+'"'),n+=">"+s+"</a>",n}image(e,t,s){const i=et(e);if(null===i)return s;let n=`<img src="${e=i}" alt="${s}"`;return t&&(n+=` title="${t}"`),n+=">",n}text(e){return e}}class Bt{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,s){return""+s}image(e,t,s){return""+s}br(){return""}}class Xt{options;renderer;textRenderer;constructor(e){this.options=e||He,this.options.renderer=this.options.renderer||new qt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Bt}static parse(e,t){return new Xt(t).parse(e)}static parseInline(e,t){return new Xt(t).parseInline(e)}parse(e,t=!0){let s="";for(let i=0;i<e.length;i++){const n=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){const e=n,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)){s+=t||"";continue}}switch(n.type){case"space":continue;case"hr":s+=this.renderer.hr();continue;case"heading":{const e=n;s+=this.renderer.heading(this.parseInline(e.tokens),e.depth,Ke(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=n;s+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=n;let t="",i="";for(let t=0;t<e.header.length;t++)i+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(i);let r="";for(let t=0;t<e.rows.length;t++){const s=e.rows[t];i="";for(let t=0;t<s.length;t++)i+=this.renderer.tablecell(this.parseInline(s[t].tokens),{header:!1,align:e.align[t]});r+=this.renderer.tablerow(i)}s+=this.renderer.table(t,r);continue}case"blockquote":{const e=n,t=this.parse(e.tokens);s+=this.renderer.blockquote(t);continue}case"list":{const e=n,t=e.ordered,i=e.start,r=e.loose;let a="";for(let t=0;t<e.items.length;t++){const s=e.items[t],i=s.checked,n=s.task;let o="";if(s.task){const e=this.renderer.checkbox(!!i);r?s.tokens.length>0&&"paragraph"===s.tokens[0].type?(s.tokens[0].text=e+" "+s.tokens[0].text,s.tokens[0].tokens&&s.tokens[0].tokens.length>0&&"text"===s.tokens[0].tokens[0].type&&(s.tokens[0].tokens[0].text=e+" "+s.tokens[0].tokens[0].text)):s.tokens.unshift({type:"text",text:e+" "}):o+=e+" "}o+=this.parse(s.tokens,r),a+=this.renderer.listitem(o,n,!!i)}s+=this.renderer.list(a,t,i);continue}case"html":{const e=n;s+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=n;s+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=n,a=r.tokens?this.parseInline(r.tokens):r.text;for(;i+1<e.length&&"text"===e[i+1].type;)r=e[++i],a+="\n"+(r.tokens?this.parseInline(r.tokens):r.text);s+=t?this.renderer.paragraph(a):a;continue}default:{const e='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return s}parseInline(e,t){t=t||this.renderer;let s="";for(let i=0;i<e.length;i++){const n=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){const e=this.options.extensions.renderers[n.type].call({parser:this},n);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){s+=e||"";continue}}switch(n.type){case"escape":{const e=n;s+=t.text(e.text);break}case"html":{const e=n;s+=t.html(e.text);break}case"link":{const e=n;s+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=n;s+=t.image(e.href,e.title,e.text);break}case"strong":{const e=n;s+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=n;s+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=n;s+=t.codespan(e.text);break}case"br":s+=t.br();break;case"del":{const e=n;s+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=n;s+=t.text(e.text);break}default:{const e='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return s}}class Wt{options;constructor(e){this.options=e||He}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const Qt=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(Ft.lex,Xt.parse);parseInline=this.#e(Ft.lexInline,Xt.parseInline);Parser=Xt;Renderer=qt;TextRenderer=Bt;Lexer=Ft;Tokenizer=rt;Hooks=Wt;constructor(...e){this.use(...e)}walkTokens(e,t){let s=[];for(const i of e)switch(s=s.concat(t.call(this,i)),i.type){case"table":{const e=i;for(const i of e.header)s=s.concat(this.walkTokens(i.tokens,t));for(const i of e.rows)for(const e of i)s=s.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=i;s=s.concat(this.walkTokens(e.items,t));break}default:{const e=i;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((i=>{const n=e[i].flat(1/0);s=s.concat(this.walkTokens(n,t))})):e.tokens&&(s=s.concat(this.walkTokens(e.tokens,t)))}}return s}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const s={...e};if(s.async=this.defaults.async||s.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const s=t.renderers[e.name];t.renderers[e.name]=s?function(...t){let i=e.renderer.apply(this,t);return!1===i&&(i=s.apply(this,t)),i}: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 s=t[e.level];s?s.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)})),s.extensions=t),e.renderer){const t=this.defaults.renderer||new qt(this.defaults);for(const s in e.renderer){if(!(s in t))throw new Error(`renderer '${s}' does not exist`);if("options"===s)continue;const i=s,n=e.renderer[i],r=t[i];t[i]=(...e)=>{let s=n.apply(t,e);return!1===s&&(s=r.apply(t,e)),s||""}}s.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new rt(this.defaults);for(const s in e.tokenizer){if(!(s in t))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const i=s,n=e.tokenizer[i],r=t[i];t[i]=(...e)=>{let s=n.apply(t,e);return!1===s&&(s=r.apply(t,e)),s}}s.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new Wt;for(const s in e.hooks){if(!(s in t))throw new Error(`hook '${s}' does not exist`);if("options"===s)continue;const i=s,n=e.hooks[i],r=t[i];Wt.passThroughHooks.has(s)?t[i]=e=>{if(this.defaults.async)return Promise.resolve(n.call(t,e)).then((e=>r.call(t,e)));const s=n.call(t,e);return r.call(t,s)}:t[i]=(...e)=>{let s=n.apply(t,e);return!1===s&&(s=r.apply(t,e)),s}}s.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,i=e.walkTokens;s.walkTokens=function(e){let s=[];return s.push(i.call(this,e)),t&&(s=s.concat(t.call(this,e))),s}}this.defaults={...this.defaults,...s}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ft.lex(e,t??this.defaults)}parser(e,t){return Xt.parse(e,t??this.defaults)}#e(e,t){return(s,i)=>{const n={...i},r={...this.defaults,...n};!0===this.defaults.async&&!1===n.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 a=this.#t(!!r.silent,!!r.async);if(null==s)return a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof s)return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(s):s).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(a);try{r.hooks&&(s=r.hooks.preprocess(s));let i=e(s,r);r.hooks&&(i=r.hooks.processAllTokens(i)),r.walkTokens&&this.walkTokens(i,r.walkTokens);let n=t(i,r);return r.hooks&&(n=r.hooks.postprocess(n)),n}catch(e){return a(e)}}}#t(e,t){return s=>{if(s.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+Ze(s.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(s);throw s}}};function Yt(e,t){return Qt.parse(e,t)}Yt.options=Yt.setOptions=function(e){return Qt.setOptions(e),Yt.defaults=Qt.defaults,Fe(Yt.defaults),Yt},Yt.getDefaults=je,Yt.defaults=He,Yt.use=function(...e){return Qt.use(...e),Yt.defaults=Qt.defaults,Fe(Yt.defaults),Yt},Yt.walkTokens=function(e,t){return Qt.walkTokens(e,t)},Yt.parseInline=Qt.parseInline,Yt.Parser=Xt,Yt.parser=Xt.parse,Yt.Renderer=qt,Yt.TextRenderer=Bt,Yt.Lexer=Ft,Yt.lexer=Ft.lex,Yt.Tokenizer=rt,Yt.Hooks=Wt,Yt.parse=Yt,Yt.options,Yt.setOptions,Yt.use,Yt.walkTokens,Yt.parseInline,Xt.parse,Ft.lex;var Zt=function(e,t,s,i){var n,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,s,a):n(t,s))||a);return r>3&&a&&Object.defineProperty(t,s,a),a};const Vt=["image/jpeg","image/png","image/gif","image/webp"];e.Chatbot=class extends le{constructor(){super(...arguments),this._reader=null,this._decoder=new TextDecoder,this._buffer="",this._userHasScrolledUp=!1,this._isDragging=!1,this._isResizing=!1,this._overlay=null,this._resizeDir="",this._dragStartX=0,this._dragStartY=0,this._dragStartLeft=0,this._dragStartTop=0,this._resizeStartW=0,this._resizeStartH=0,this._dragDepth=0,this._pendingSeq=0,this.send=null,this.clear=null,this.load=null,this.messages=[],this.label="Kat",this.placeholder="Type a message...",this.opened=!1,this.hideToggle=!1,this.variant="floating",this._inputValue="",this._isStreaming=!1,this._error="",this._pendingInternalFiles=[],this._isDraggingFile=!1,this._handleMouseMove=e=>{if(this._isDragging){let t=this._dragStartLeft+(e.clientX-this._dragStartX),s=this._dragStartTop+(e.clientY-this._dragStartY);const i=this._panelEl.offsetWidth;t=Math.max(48-i,Math.min(t,window.innerWidth-48)),s=Math.max(0,Math.min(s,window.innerHeight-48)),this._panelEl.style.left=t+"px",this._panelEl.style.top=s+"px"}else if(this._isResizing){const t=e.clientX-this._dragStartX,s=e.clientY-this._dragStartY,i=340,n=380,r=.9*window.innerWidth,a=window.innerHeight-72;let o=this._resizeStartW,l=this._resizeStartH,c=this._dragStartLeft,h=this._dragStartTop;this._resizeDir.includes("e")&&(o=Math.max(i,Math.min(this._resizeStartW+t,r))),this._resizeDir.includes("w")&&(o=Math.max(i,Math.min(this._resizeStartW-t,r)),c=this._dragStartLeft+(this._resizeStartW-o)),this._resizeDir.includes("s")&&(l=Math.max(n,Math.min(this._resizeStartH+s,a))),this._resizeDir.includes("n")&&(l=Math.max(n,Math.min(this._resizeStartH-s,a)),h=this._dragStartTop+(this._resizeStartH-l)),c=Math.max(0,c),h=Math.max(0,h),this._panelEl.style.width=o+"px",this._panelEl.style.height=l+"px",this._panelEl.style.left=c+"px",this._panelEl.style.top=h+"px"}},this._handleMouseUp=()=>{this._isDragging&&(this._isDragging=!1,this._panelEl.classList.remove("panel--dragging")),this._isResizing&&(this._isResizing=!1,this._panelEl.classList.remove("panel--resizing")),this._hideOverlay(),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),this._saveState()}}connectedCallback(){super.connectedCallback(),this.load||(this.load=()=>s.Http.fetch({url:"/api/system/integration/aws/bedrock/getConversationMessages"}).then((e=>e.json())).then((e=>e.data||[]))),this.load().then((e=>{e&&e.length&&(this.messages=e)})).catch((()=>{})),"inline"!==this.variant?this._restoreState():this.opened=!0}disconnectedCallback(){super.disconnectedCallback(),this._reader&&(this._reader.cancel(),this._reader=null),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),this._pendingInternalFiles.forEach((e=>URL.revokeObjectURL(e.previewUrl)))}updated(e){e.has("messages")&&(this._userHasScrolledUp||this._isStreaming||!this._messagesEl||requestAnimationFrame((()=>{this._messagesEl&&(this._messagesEl.scrollTop=this._messagesEl.scrollHeight)}))),e.has("opened")&&this.opened&&this._inputEl&&setTimeout((()=>{this._inputEl&&this._inputEl.focus()}),200)}stop(){this._handleStop()}open(){this.opened||this._handleToggle()}close(){this.opened&&this._handleToggle()}toggle(){this._handleToggle()}_showOverlay(){this._overlay||(this._overlay=document.createElement("div"),this._overlay.style.cssText="position:fixed; inset:0; z-index:9999; display:none;",document.body.appendChild(this._overlay)),this._overlay.style.display="block"}_hideOverlay(){this._overlay&&(this._overlay.style.display="none")}_handleHeaderMouseDown(e){if("inline"===this.variant)return;if(e.target.closest("button"))return;if(!this._panelEl)return;this._isDragging=!0,this._panelEl.classList.add("panel--dragging"),this._showOverlay();const t=this._panelEl.getBoundingClientRect();this._panelEl.style.left=t.left+"px",this._panelEl.style.top=t.top+"px",this._panelEl.style.right="auto",this._panelEl.style.bottom="auto",this._panelEl.style.position="fixed",this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._dragStartLeft=t.left,this._dragStartTop=t.top,e.preventDefault(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)}_handleResizeMouseDown(e){if("inline"===this.variant)return;if(!this._panelEl)return;this._isResizing=!0,this._resizeDir=e.currentTarget.dataset.dir||"",this._panelEl.classList.add("panel--resizing"),this._showOverlay();const t=this._panelEl.getBoundingClientRect();this._panelEl.style.left=t.left+"px",this._panelEl.style.top=t.top+"px",this._panelEl.style.right="auto",this._panelEl.style.bottom="auto",this._panelEl.style.position="fixed",this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._dragStartLeft=t.left,this._dragStartTop=t.top,this._resizeStartW=t.width,this._resizeStartH=t.height,e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)}_handleToggle(){this.opened=!this.opened,this.opened&&this._panelEl&&this._applyStoredLayout(),this._saveState()}_saveState(){try{const e={opened:String(this.opened)};if(this._panelEl){const t=this._panelEl.style;t.left&&(e.left=t.left),t.top&&(e.top=t.top),t.width&&(e.width=t.width),t.height&&(e.height=t.height),t.position&&(e.position=t.position)}localStorage.setItem("kr-chatbot-state",JSON.stringify(e))}catch{}}_restoreState(){try{const e=localStorage.getItem("kr-chatbot-state");if(!e)return;"true"===JSON.parse(e).opened&&(this.opened=!0,this.updateComplete.then((()=>this._applyStoredLayout())))}catch{}}_applyStoredLayout(){try{const e=localStorage.getItem("kr-chatbot-state");if(!e||!this._panelEl)return;const t=JSON.parse(e);t.position&&(this._panelEl.style.position=t.position),t.left&&(this._panelEl.style.left=t.left),t.top&&(this._panelEl.style.top=t.top),t.width&&(this._panelEl.style.width=t.width),t.height&&(this._panelEl.style.height=t.height)}catch{}}_handleInputChange(e){this._inputValue=e.target.value;const t=e.target;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,120)+"px"}_handleKeyDown(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),this._handleSubmit())}_openFilePicker(){this._fileInputEl?.click()}_handleFileInputChange(e){const t=e.target;t.files&&this._addFiles(t.files),t.value=""}_handlePaste(e){const t=e.clipboardData?.items;if(!t)return;const s=[];for(let e=0;e<t.length;e++)if("file"===t[e].kind){const i=t[e].getAsFile();i&&s.push(i)}s.length&&(e.preventDefault(),this._addFiles(s))}_handleDragEnter(e){this._hasFiles(e)&&(e.preventDefault(),this._dragDepth++,this._isDraggingFile=!0)}_handleDragOver(e){this._hasFiles(e)&&e.preventDefault()}_handleDragLeave(e){this._hasFiles(e)&&(this._dragDepth--,this._dragDepth<=0&&(this._dragDepth=0,this._isDraggingFile=!1))}_handleDrop(e){this._hasFiles(e)&&(e.preventDefault(),this._dragDepth=0,this._isDraggingFile=!1,e.dataTransfer?.files&&this._addFiles(e.dataTransfer.files))}_hasFiles(e){return Array.from(e.dataTransfer?.types||[]).includes("Files")}_addFiles(e){const t=Array.from(e).filter((e=>Vt.includes(e.type)));t.length&&t.forEach((e=>{const t={localId:"att-"+this._pendingSeq++,file:e,name:e.name,previewUrl:URL.createObjectURL(e)};this._pendingInternalFiles=[...this._pendingInternalFiles,t]}))}_removePending(e){const t=this._pendingInternalFiles.find((t=>t.localId===e));t&&URL.revokeObjectURL(t.previewUrl),this._pendingInternalFiles=this._pendingInternalFiles.filter((t=>t.localId!==e))}_clearPending(){this._pendingInternalFiles.forEach((e=>URL.revokeObjectURL(e.previewUrl))),this._pendingInternalFiles=[]}_openImage(e){t.FilePreview.open({src:`/api/system/integration/aws/bedrock/conversationImage/${e.internalFileID}/view`,name:e.niceName||"image"})}_canSend(){return Boolean(this._inputValue.trim())||this._pendingInternalFiles.length>0}_handleSubmit(){if(this._isStreaming)return;const e=this._inputValue.trim(),t=this._pendingInternalFiles;if(!e&&!t.length)return;const i=t.map((e=>e.file)),n=new CustomEvent("message-submit",{detail:{message:e,internalFiles:i},bubbles:!0,composed:!0,cancelable:!0});if(this.dispatchEvent(n),n.defaultPrevented)return;const r={type:"user",content:e};this.messages=[...this.messages,r],this._inputValue="",this._error="",this._userHasScrolledUp=!1,this._pendingInternalFiles.forEach((e=>URL.revokeObjectURL(e.previewUrl))),this._pendingInternalFiles=[],this._inputEl&&(this._inputEl.style.height="auto"),this.messages=[...this.messages,{type:"assistant",content:""}],this._isStreaming=!0,this.updateComplete.then((()=>{if(!this._messagesEl)return;this._messagesEl.querySelectorAll(".message--assistant").forEach((e=>{e.style.minHeight=""}));const e=this._messagesEl.querySelectorAll(".message"),t=e[this.messages.length-2],s=e[this.messages.length-1];s&&(s.style.minHeight=this._messagesEl.clientHeight+"px"),t&&(this._messagesEl.scrollTop=t.offsetTop-this._messagesEl.offsetTop-24)})),this.send||(this.send=e=>{if(e.internalFiles.length){const t=new FormData;return t.append("userText",e.message),e.internalFiles.forEach((e=>t.append("images",e))),s.Http.fetch({url:"/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithImages",method:"POST",headers:{Accept:"text/event-stream"},body:t})}return s.Http.fetch({url:"/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithState",method:"POST",headers:{Accept:"text/event-stream"},body:{userText:e.message}})}),this.send({message:e,messages:this.messages.slice(0,-1),internalFiles:i}).then((e=>{e.ok?e.body?(this._reader=e.body.getReader(),this._decoder=new TextDecoder,this._buffer="",this._readStreamChunk()):this._handleStreamError("No response body"):this._handleStreamError("Request failed: "+e.status)})).catch((e=>{"AbortError"!==e.name&&this._handleStreamError(e.message)}))}_handleStop(){this._reader&&(this._reader.cancel(),this._reader=null),this._isStreaming=!1}_handleClear(){this.clear||(this.clear=()=>s.Http.fetch({url:"/api/system/integration/aws/bedrock/clearConversationWithState",method:"POST"})),this.clear().then((()=>{this._reader&&(this._reader.cancel(),this._reader=null),this.messages=[],this._isStreaming=!1,this._error="",this._inputValue="",this._userHasScrolledUp=!1}))}_handleMessagesScroll(e){const t=e.target,s=t.scrollHeight-t.scrollTop-t.clientHeight;this._userHasScrolledUp=s>50}_handleErrorDismiss(){this._error=""}_readStreamChunk(){this._reader&&this._reader.read().then((e=>{if(e.done)return this._isStreaming=!1,void(this._reader=null);this._buffer=this._buffer+this._decoder.decode(e.value,{stream:!0});const t=this._buffer.split("\n\n");this._buffer=t.pop()||"";for(let e=0;e<t.length;e++){if(!t[e].trim())continue;const s=t[e].split("\n");for(let e=0;e<s.length;e++){if(!s[e].startsWith("data:"))continue;const t=s[e].slice(5).trim();if(!t)continue;let i;try{i=JSON.parse(t)}catch{continue}if(this.dispatchEvent(new CustomEvent("stream-event",{detail:i,bubbles:!0,composed:!0})),"REASONING_PART"===i.type){if(i.message){const e=this.messages.length-1;e>=0&&"assistant"===this.messages[e].type&&(this.messages[e].reasoning||(this.messages[e].reasoning=""),this.messages[e].reasoning+=String(i.message),this.requestUpdate())}}else if("RESPONSE_PART"===i.type){if(i.message){const e=this.messages.length-1;e>=0&&"assistant"===this.messages[e].type&&(this.messages[e].content+=String(i.message),this.requestUpdate())}}else"ERROR"===i.type&&this._handleStreamError(String(i.message||"Unknown error"));i.finished&&(this._isStreaming=!1,this._reader=null)}}this._readStreamChunk()})).catch((e=>{"AbortError"!==e.name&&this._handleStreamError(e.message)}))}_handleStreamError(e){if(this._isStreaming=!1,this._error=e,this._reader&&(this._reader.cancel(),this._reader=null),this.messages.length>0){const e=this.messages[this.messages.length-1];"assistant"!==e.type||e.content||(this.messages=this.messages.slice(0,-1))}}render(){return B`
|
|
1385
|
-
|
|
1384
|
+
*/function He(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let je={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Fe(e){je=e}const Be=/[&<>"']/,qe=new RegExp(Be.source,"g"),Xe=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Qe=new RegExp(Xe.source,"g"),We={"&":"&","<":"<",">":">",'"':""","'":"'"},Ye=e=>We[e];function Ze(e,t){if(t){if(Be.test(e))return e.replace(qe,Ye)}else if(Xe.test(e))return e.replace(Qe,Ye);return e}const Ve=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Ke(e){return e.replace(Ve,((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 Ge=/(^|[^\[])\^/g;function Je(e,t){let i="string"==typeof e?e:e.source;t=t||"";const s={replace:(e,t)=>{let n="string"==typeof t?t:t.source;return n=n.replace(Ge,"$1"),i=i.replace(e,n),s},getRegex:()=>new RegExp(i,t)};return s}function et(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const tt={exec:()=>null};function it(e,t){const i=e.replace(/\|/g,((e,t,i)=>{let s=!1,n=t;for(;--n>=0&&"\\"===i[n];)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 st(e,t,i){const s=e.length;if(0===s)return"";let n=0;for(;n<s;){if(e.charAt(s-n-1)!==t)break;n++}return e.slice(0,s-n)}function nt(e,t,i,s){const n=t.href,r=t.title?Ze(t.title):null,a=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){s.state.inLink=!0;const e={type:"link",raw:i,href:n,title:r,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,e}return{type:"image",raw:i,href:n,title:r,text:Ze(a)}}class rt{options;rules;lexer;constructor(e){this.options=e||je}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:st(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=st(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=st(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,n={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 a="",o="",l=!1;for(;e;){let i=!1;if(!(t=r.exec(e)))break;if(this.rules.block.hr.test(e))break;a=t[0],e=e.substring(a.length);let s=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),h=e.split("\n",1)[0],c=0;this.options.pedantic?(c=2,o=s.trimStart()):(c=t[2].search(/[^ ]/),c=c>4?1:c,o=s.slice(c),c+=t[1].length);let d=!1;if(!s&&/^ *$/.test(h)&&(a+=h+"\n",e=e.substring(h.length+1),i=!0),!i){const t=new RegExp(`^ {0,${Math.min(3,c-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),i=new RegExp(`^ {0,${Math.min(3,c-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),n=new RegExp(`^ {0,${Math.min(3,c-1)}}(?:\`\`\`|~~~)`),r=new RegExp(`^ {0,${Math.min(3,c-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(h=l,this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),n.test(h))break;if(r.test(h))break;if(t.test(h))break;if(i.test(e))break;if(h.search(/[^ ]/)>=c||!h.trim())o+="\n"+h.slice(c);else{if(d)break;if(s.search(/[^ ]/)>=4)break;if(n.test(s))break;if(r.test(s))break;if(i.test(s))break;o+="\n"+h}d||h.trim()||(d=!0),a+=l+"\n",e=e.substring(l.length+1),s=h.slice(c)}}n.loose||(l?n.loose=!0:/\n *\n *$/.test(a)&&(l=!0));let p,u=null;this.options.gfm&&(u=/^\[[ xX]\] /.exec(o),u&&(p="[ ] "!==u[0],o=o.replace(/^\[[ xX]\] +/,""))),n.items.push({type:"list_item",raw:a,task:!!u,checked:p,loose:!1,text:o,tokens:[]}),n.raw+=a}n.items[n.items.length-1].raw=a.trimEnd(),n.items[n.items.length-1].text=o.trimEnd(),n.raw=n.raw.trimEnd();for(let e=0;e<n.items.length;e++)if(this.lexer.state.top=!1,n.items[e].tokens=this.lexer.blockTokens(n.items[e].text,[]),!n.loose){const t=n.items[e].tokens.filter((e=>"space"===e.type)),i=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));n.loose=i}if(n.loose)for(let e=0;e<n.items.length;e++)n.items[e].loose=!0;return n}}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=it(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),n=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 n)r.rows.push(it(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:Ze(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=st(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)),nt(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 nt(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 n,r,a=i,o=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(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(r=[...n].length,s[3]||s[4]){a+=r;continue}if((s[5]||s[6])&&i%3&&!((i+r)%3)){o+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+o);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 h=l.slice(2,-2);return{type:"strong",raw:l,text:h,tokens:this.lexer.inlineTokens(h)}}}}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=Ze(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=Ze(t[1]),i="mailto:"+e):(e=Ze(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=Ze(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=Ze(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]:Ze(t[0]),{type:"text",raw:t[0],text:e}}}}const at=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ot=/(?:[*+-]|\d{1,9}[.)])/,lt=Je(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,ot).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(),ht=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ct=/(?!\s*\])(?:\\.|[^\[\]\\])+/,dt=Je(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",ct).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),pt=Je(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ot).getRegex(),ut="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",gt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ft=Je("^ {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",gt).replace("tag",ut).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),mt=Je(ht).replace("hr",at).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",ut).getRegex(),vt={blockquote:Je(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",mt).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:dt,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:at,html:ft,lheading:lt,list:pt,newline:/^(?: *(?:\n|$))+/,paragraph:mt,table:tt,text:/^[^\n]+/},bt=Je("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",at).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",ut).getRegex(),xt={...vt,table:bt,paragraph:Je(ht).replace("hr",at).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",bt).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",ut).getRegex()},kt={...vt,html:Je("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",gt).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:tt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Je(ht).replace("hr",at).replace("heading"," *#{1,6} *[^\n]").replace("lheading",lt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},_t=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,yt=/^( {2,}|\\)\n(?!\s*$)/,wt="\\p{P}\\p{S}",$t=Je(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,wt).getRegex(),St=Je(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,wt).getRegex(),It=Je("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,wt).getRegex(),Et=Je("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,wt).getRegex(),Ct=Je(/\\([punct])/,"gu").replace(/punct/g,wt).getRegex(),At=Je(/^<(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(),zt=Je(gt).replace("(?:--\x3e|$)","--\x3e").getRegex(),Mt=Je("^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",zt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Dt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Tt=Je(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Dt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Rt=Je(/^!?\[(label)\]\[(ref)\]/).replace("label",Dt).replace("ref",ct).getRegex(),Nt=Je(/^!?\[(ref)\](?:\[\])?/).replace("ref",ct).getRegex(),Pt={_backpedal:tt,anyPunctuation:Ct,autolink:At,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:yt,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:tt,emStrongLDelim:St,emStrongRDelimAst:It,emStrongRDelimUnd:Et,escape:_t,link:Tt,nolink:Nt,punctuation:$t,reflink:Rt,reflinkSearch:Je("reflink|nolink(?!\\()","g").replace("reflink",Rt).replace("nolink",Nt).getRegex(),tag:Mt,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:tt},Ot={...Pt,link:Je(/^!?\[(label)\]\((.*?)\)/).replace("label",Dt).getRegex(),reflink:Je(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Dt).getRegex()},Ut={...Pt,escape:Je(_t).replace("])","~|])").getRegex(),url:Je(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Lt={...Ut,br:Je(yt).replace("{2,}","*").getRegex(),text:Je(Ut.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ht={normal:vt,gfm:xt,pedantic:kt},jt={normal:Pt,gfm:Ut,breaks:Lt,pedantic:Ot};class Ft{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||je,this.options.tokenizer=this.options.tokenizer||new rt,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:Ht.normal,inline:jt.normal};this.options.pedantic?(t.block=Ht.pedantic,t.inline=jt.pedantic):this.options.gfm&&(t.block=Ht.gfm,this.options.breaks?t.inline=jt.breaks:t.inline=jt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ht,inline:jt}}static lex(e,t){return new Ft(t).lex(e)}static lexInline(e,t){return new Ft(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,n,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(n=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&&(n=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(n)))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=n.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,n,r,a,o,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(a||(o=""),a=!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,o))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(n=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&&(n=e.substring(0,t+1))}if(i=this.tokenizer.inlineText(n))e=e.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(o=i.raw.slice(-1)),a=!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 Bt{options;constructor(e){this.options=e||je}code(e,t,i){const s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",s?'<pre><code class="language-'+Ze(s)+'">'+(i?e:Ze(e,!0))+"</code></pre>\n":"<pre><code>"+(i?e:Ze(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=et(e);if(null===s)return i;let n='<a href="'+(e=s)+'"';return t&&(n+=' title="'+t+'"'),n+=">"+i+"</a>",n}image(e,t,i){const s=et(e);if(null===s)return i;let n=`<img src="${e=s}" alt="${i}"`;return t&&(n+=` title="${t}"`),n+=">",n}text(e){return e}}class qt{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 Xt{options;renderer;textRenderer;constructor(e){this.options=e||je,this.options.renderer=this.options.renderer||new Bt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new qt}static parse(e,t){return new Xt(t).parse(e)}static parseInline(e,t){return new Xt(t).parseInline(e)}parse(e,t=!0){let i="";for(let s=0;s<e.length;s++){const n=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){const e=n,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(n.type){case"space":continue;case"hr":i+=this.renderer.hr();continue;case"heading":{const e=n;i+=this.renderer.heading(this.parseInline(e.tokens),e.depth,Ke(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=n;i+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=n;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=n,t=this.parse(e.tokens);i+=this.renderer.blockquote(t);continue}case"list":{const e=n,t=e.ordered,s=e.start,r=e.loose;let a="";for(let t=0;t<e.items.length;t++){const i=e.items[t],s=i.checked,n=i.task;let o="";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+" "}):o+=e+" "}o+=this.parse(i.tokens,r),a+=this.renderer.listitem(o,n,!!s)}i+=this.renderer.list(a,t,s);continue}case"html":{const e=n;i+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=n;i+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=n,a=r.tokens?this.parseInline(r.tokens):r.text;for(;s+1<e.length&&"text"===e[s+1].type;)r=e[++s],a+="\n"+(r.tokens?this.parseInline(r.tokens):r.text);i+=t?this.renderer.paragraph(a):a;continue}default:{const e='Token with "'+n.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 n=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){const e=this.options.extensions.renderers[n.type].call({parser:this},n);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){i+=e||"";continue}}switch(n.type){case"escape":{const e=n;i+=t.text(e.text);break}case"html":{const e=n;i+=t.html(e.text);break}case"link":{const e=n;i+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=n;i+=t.image(e.href,e.title,e.text);break}case"strong":{const e=n;i+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=n;i+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=n;i+=t.codespan(e.text);break}case"br":i+=t.br();break;case"del":{const e=n;i+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=n;i+=t.text(e.text);break}default:{const e='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return i}}class Qt{options;constructor(e){this.options=e||je}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const Wt=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(Ft.lex,Xt.parse);parseInline=this.#e(Ft.lexInline,Xt.parseInline);Parser=Xt;Renderer=Bt;TextRenderer=qt;Lexer=Ft;Tokenizer=rt;Hooks=Qt;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 n=e[s].flat(1/0);i=i.concat(this.walkTokens(n,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 Bt(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,n=e.renderer[s],r=t[s];t[s]=(...e)=>{let i=n.apply(t,e);return!1===i&&(i=r.apply(t,e)),i||""}}i.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new rt(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,n=e.tokenizer[s],r=t[s];t[s]=(...e)=>{let i=n.apply(t,e);return!1===i&&(i=r.apply(t,e)),i}}i.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new Qt;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,n=e.hooks[s],r=t[s];Qt.passThroughHooks.has(i)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(n.call(t,e)).then((e=>r.call(t,e)));const i=n.call(t,e);return r.call(t,i)}:t[s]=(...e)=>{let i=n.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 Ft.lex(e,t??this.defaults)}parser(e,t){return Xt.parse(e,t??this.defaults)}#e(e,t){return(i,s)=>{const n={...s},r={...this.defaults,...n};!0===this.defaults.async&&!1===n.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 a=this.#t(!!r.silent,!!r.async);if(null==i)return a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof i)return a(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(a);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 n=t(s,r);return r.hooks&&(n=r.hooks.postprocess(n)),n}catch(e){return a(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>"+Ze(i.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(i);throw i}}};function Yt(e,t){return Wt.parse(e,t)}Yt.options=Yt.setOptions=function(e){return Wt.setOptions(e),Yt.defaults=Wt.defaults,Fe(Yt.defaults),Yt},Yt.getDefaults=He,Yt.defaults=je,Yt.use=function(...e){return Wt.use(...e),Yt.defaults=Wt.defaults,Fe(Yt.defaults),Yt},Yt.walkTokens=function(e,t){return Wt.walkTokens(e,t)},Yt.parseInline=Wt.parseInline,Yt.Parser=Xt,Yt.parser=Xt.parse,Yt.Renderer=Bt,Yt.TextRenderer=qt,Yt.Lexer=Ft,Yt.lexer=Ft.lex,Yt.Tokenizer=rt,Yt.Hooks=Qt,Yt.parse=Yt,Yt.options,Yt.setOptions,Yt.use,Yt.walkTokens,Yt.parseInline,Xt.parse,Ft.lex;var Zt=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};const Vt=["image/jpeg","image/png","image/gif","image/webp"];e.Chatbot=class extends le{constructor(){super(...arguments),this._reader=null,this._decoder=new TextDecoder,this._buffer="",this._userHasScrolledUp=!1,this._isDragging=!1,this._isResizing=!1,this._overlay=null,this._resizeDir="",this._dragStartX=0,this._dragStartY=0,this._dragStartLeft=0,this._dragStartTop=0,this._resizeStartW=0,this._resizeStartH=0,this._dragDepth=0,this._pendingSeq=0,this.send=null,this.clear=null,this.load=null,this.messages=[],this.label="Kat",this.placeholder="Type a message...",this.skills=[],this.opened=!1,this.hideToggle=!1,this.variant="floating",this._inputValue="",this._isStreaming=!1,this._error="",this._pendingInternalFiles=[],this._isDraggingFile=!1,this._skillMenuOpened=!1,this._skillQuery="",this._skillHighlighted=0,this._copiedIndex=-1,this._skillBrowseOpened=!1,this._skillBrowseSource="org",this._skillBrowseQuery="",this._handleMouseMove=e=>{if(this._isDragging){let t=this._dragStartLeft+(e.clientX-this._dragStartX),i=this._dragStartTop+(e.clientY-this._dragStartY);const s=this._panelEl.offsetWidth;t=Math.max(48-s,Math.min(t,window.innerWidth-48)),i=Math.max(0,Math.min(i,window.innerHeight-48)),this._panelEl.style.left=t+"px",this._panelEl.style.top=i+"px"}else if(this._isResizing){const t=e.clientX-this._dragStartX,i=e.clientY-this._dragStartY,s=340,n=380,r=.9*window.innerWidth,a=window.innerHeight-72;let o=this._resizeStartW,l=this._resizeStartH,h=this._dragStartLeft,c=this._dragStartTop;this._resizeDir.includes("e")&&(o=Math.max(s,Math.min(this._resizeStartW+t,r))),this._resizeDir.includes("w")&&(o=Math.max(s,Math.min(this._resizeStartW-t,r)),h=this._dragStartLeft+(this._resizeStartW-o)),this._resizeDir.includes("s")&&(l=Math.max(n,Math.min(this._resizeStartH+i,a))),this._resizeDir.includes("n")&&(l=Math.max(n,Math.min(this._resizeStartH-i,a)),c=this._dragStartTop+(this._resizeStartH-l)),h=Math.max(0,h),c=Math.max(0,c),this._panelEl.style.width=o+"px",this._panelEl.style.height=l+"px",this._panelEl.style.left=h+"px",this._panelEl.style.top=c+"px"}},this._handleMouseUp=()=>{this._isDragging&&(this._isDragging=!1,this._panelEl.classList.remove("panel--dragging")),this._isResizing&&(this._isResizing=!1,this._panelEl.classList.remove("panel--resizing")),this._hideOverlay(),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),this._saveState()}}connectedCallback(){super.connectedCallback(),this.load||(this.load=()=>i.Http.fetch({url:"/api/system/integration/aws/bedrock/getConversationMessages"}).then((e=>e.json())).then((e=>e.data||[]))),this.load().then((e=>{e&&e.length&&(this.messages=e)})).catch((()=>{})),"inline"!==this.variant?this._restoreState():this.opened=!0}disconnectedCallback(){super.disconnectedCallback(),this._reader&&(this._reader.cancel(),this._reader=null),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),this._pendingInternalFiles.forEach((e=>URL.revokeObjectURL(e.previewUrl)))}updated(e){e.has("messages")&&(this._userHasScrolledUp||this._isStreaming||!this._messagesEl||requestAnimationFrame((()=>{this._messagesEl&&(this._messagesEl.scrollTop=this._messagesEl.scrollHeight)}))),e.has("opened")&&this.opened&&this._inputEl&&setTimeout((()=>{this._inputEl&&this._inputEl.focus()}),200),this._skillMenuOpened&&this._positionSkillMenu(),e.has("_skillHighlighted")&&this._skillMenuOpened&&this._skillMenuEl?.querySelector(".skill-menu__item--highlighted")?.scrollIntoView({block:"nearest"})}_positionSkillMenu(){requestAnimationFrame((()=>{if(!this._skillMenuEl||!this._inputWrapperEl)return;const e=this._inputWrapperEl.getBoundingClientRect();this._skillMenuEl.style.left=e.left+"px",this._skillMenuEl.style.width=e.width+"px";const t=this._panelEl.getBoundingClientRect().top+8,i=e.top-8-t;this._skillMenuEl.style.maxHeight=i+"px";const s=this._skillMenuEl.getBoundingClientRect(),n=Math.max(t,e.top-s.height-8);this._skillMenuEl.style.top=n+"px"}))}stop(){this._handleStop()}open(){this.opened||this._handleToggle()}close(){this.opened&&this._handleToggle()}toggle(){this._handleToggle()}_showOverlay(){this._overlay||(this._overlay=document.createElement("div"),this._overlay.style.cssText="position:fixed; inset:0; z-index:9999; display:none;",document.body.appendChild(this._overlay)),this._overlay.style.display="block"}_hideOverlay(){this._overlay&&(this._overlay.style.display="none")}_handleHeaderMouseDown(e){if("inline"===this.variant)return;if(e.target.closest("button"))return;if(!this._panelEl)return;this._isDragging=!0,this._panelEl.classList.add("panel--dragging"),this._showOverlay();const t=this._panelEl.getBoundingClientRect();this._panelEl.style.left=t.left+"px",this._panelEl.style.top=t.top+"px",this._panelEl.style.right="auto",this._panelEl.style.bottom="auto",this._panelEl.style.position="fixed",this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._dragStartLeft=t.left,this._dragStartTop=t.top,e.preventDefault(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)}_handleResizeMouseDown(e){if("inline"===this.variant)return;if(!this._panelEl)return;this._isResizing=!0,this._resizeDir=e.currentTarget.dataset.dir||"",this._panelEl.classList.add("panel--resizing"),this._showOverlay();const t=this._panelEl.getBoundingClientRect();this._panelEl.style.left=t.left+"px",this._panelEl.style.top=t.top+"px",this._panelEl.style.right="auto",this._panelEl.style.bottom="auto",this._panelEl.style.position="fixed",this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._dragStartLeft=t.left,this._dragStartTop=t.top,this._resizeStartW=t.width,this._resizeStartH=t.height,e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)}_handleToggle(){this.opened=!this.opened,this.opened&&this._panelEl&&this._applyStoredLayout(),this._saveState()}_saveState(){try{const e={opened:String(this.opened)};if(this._panelEl){const t=this._panelEl.style;t.left&&(e.left=t.left),t.top&&(e.top=t.top),t.width&&(e.width=t.width),t.height&&(e.height=t.height),t.position&&(e.position=t.position)}localStorage.setItem("kr-chatbot-state",JSON.stringify(e))}catch{}}_restoreState(){try{const e=localStorage.getItem("kr-chatbot-state");if(!e)return;"true"===JSON.parse(e).opened&&(this.opened=!0,this.updateComplete.then((()=>this._applyStoredLayout())))}catch{}}_applyStoredLayout(){try{const e=localStorage.getItem("kr-chatbot-state");if(!e||!this._panelEl)return;const t=JSON.parse(e);t.position&&(this._panelEl.style.position=t.position),t.left&&(this._panelEl.style.left=t.left),t.top&&(this._panelEl.style.top=t.top),t.width&&(this._panelEl.style.width=t.width),t.height&&(this._panelEl.style.height=t.height)}catch{}}_handleInputChange(e){this._inputValue=e.target.value;const t=e.target;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,120)+"px";const i=this._inputValue.match(/^\/(\S*)$/);i&&this.skills.length?(this._skillMenuOpened=!0,this._skillQuery=i[1],this._skillHighlighted=0):this._skillMenuOpened=!1}_handleKeyDown(e){if(this._skillMenuOpened){const t=2+this._filteredSkills().length;if("ArrowDown"===e.key)return e.preventDefault(),void(this._skillHighlighted=(this._skillHighlighted+1)%t);if("ArrowUp"===e.key)return e.preventDefault(),void(this._skillHighlighted=(this._skillHighlighted-1+t)%t);if("Enter"===e.key&&!e.shiftKey)return e.preventDefault(),void this._activateSkillMenuItem(this._skillHighlighted);if("Escape"===e.key)return e.preventDefault(),void(this._skillMenuOpened=!1)}"Enter"!==e.key||e.shiftKey||(e.preventDefault(),this._handleSubmit())}_activateSkillMenuItem(e){if(0===e)return void this._openFilePicker();if(1===e)return void this._handleSkillBrowseOpen();const t=this._filteredSkills()[e-2];t&&this._handleSkillSelect(t)}_filteredSkills(){const e=this._skillQuery.toLowerCase();return this.skills.filter((t=>t.name.toLowerCase().includes(e)||t.label.toLowerCase().includes(e))).slice(0,15)}_handlePlusClick(){this._skillMenuOpened?this._skillMenuOpened=!1:(this._skillQuery="",this._skillHighlighted=0,this._skillMenuOpened=!0)}_handleSkillSelect(e){this._inputValue=`/${e.name} `,this._skillMenuOpened=!1,this._skillBrowseOpened=!1,this._inputEl?.focus()}_handleCopyMessage(e,t){navigator.clipboard.writeText(e).then((()=>{this._copiedIndex=t,setTimeout((()=>{this._copiedIndex===t&&(this._copiedIndex=-1)}),2e3)})).catch((()=>{}))}_handleSkillBrowseOpen(){this._skillMenuOpened=!1,this._skillBrowseQuery="",this._skillBrowseOpened=!0}_handleSkillBrowseClose(){this._skillBrowseOpened=!1}_handleSkillBrowseSearch(e){this._skillBrowseQuery=e.target.value}_handleSkillBrowseTabChange(e){this._skillBrowseSource=e.detail.activeTabId}_browseSkills(){const e=this._skillBrowseQuery.toLowerCase();return this.skills.filter((t=>(t.source||"org")===this._skillBrowseSource&&(t.name.toLowerCase().includes(e)||t.label.toLowerCase().includes(e)||(t.description||"").toLowerCase().includes(e))))}_openFilePicker(){this._fileInputEl?.click()}_handleFileInputChange(e){const t=e.target;t.files&&this._addFiles(t.files),t.value=""}_handlePaste(e){const t=e.clipboardData?.items;if(!t)return;const i=[];for(let e=0;e<t.length;e++)if("file"===t[e].kind){const s=t[e].getAsFile();s&&i.push(s)}i.length&&(e.preventDefault(),this._addFiles(i))}_handleDragEnter(e){this._hasFiles(e)&&(e.preventDefault(),this._dragDepth++,this._isDraggingFile=!0)}_handleDragOver(e){this._hasFiles(e)&&e.preventDefault()}_handleDragLeave(e){this._hasFiles(e)&&(this._dragDepth--,this._dragDepth<=0&&(this._dragDepth=0,this._isDraggingFile=!1))}_handleDrop(e){this._hasFiles(e)&&(e.preventDefault(),this._dragDepth=0,this._isDraggingFile=!1,e.dataTransfer?.files&&this._addFiles(e.dataTransfer.files))}_hasFiles(e){return Array.from(e.dataTransfer?.types||[]).includes("Files")}_addFiles(e){const t=Array.from(e).filter((e=>Vt.includes(e.type)));t.length&&t.forEach((e=>{const t={localId:"att-"+this._pendingSeq++,file:e,name:e.name,previewUrl:URL.createObjectURL(e)};this._pendingInternalFiles=[...this._pendingInternalFiles,t]}))}_removePending(e){const t=this._pendingInternalFiles.find((t=>t.localId===e));t&&URL.revokeObjectURL(t.previewUrl),this._pendingInternalFiles=this._pendingInternalFiles.filter((t=>t.localId!==e))}_clearPending(){this._pendingInternalFiles.forEach((e=>URL.revokeObjectURL(e.previewUrl))),this._pendingInternalFiles=[]}_openImage(e){t.FilePreview.open({src:`/api/system/integration/aws/bedrock/conversationImage/${e.internalFileID}/view`,name:e.niceName||"image"})}_canSend(){return Boolean(this._inputValue.trim())||this._pendingInternalFiles.length>0}_handleSubmit(){if(this._isStreaming)return;const e=this._inputValue.trim(),t=this._pendingInternalFiles;if(!e&&!t.length)return;const s=t.map((e=>e.file)),n=new CustomEvent("message-submit",{detail:{message:e,internalFiles:s},bubbles:!0,composed:!0,cancelable:!0});if(this.dispatchEvent(n),n.defaultPrevented)return;const r={type:"user",content:e};this.messages=[...this.messages,r],this._inputValue="",this._error="",this._userHasScrolledUp=!1,this._pendingInternalFiles.forEach((e=>URL.revokeObjectURL(e.previewUrl))),this._pendingInternalFiles=[],this._inputEl&&(this._inputEl.style.height="auto"),this.messages=[...this.messages,{type:"assistant",content:""}],this._isStreaming=!0,this.updateComplete.then((()=>{if(!this._messagesEl)return;this._messagesEl.querySelectorAll(".message--assistant").forEach((e=>{e.style.minHeight=""}));const e=this._messagesEl.querySelectorAll(".message"),t=e[this.messages.length-2],i=e[this.messages.length-1];i&&(i.style.minHeight=this._messagesEl.clientHeight+"px"),t&&(this._messagesEl.scrollTop=t.offsetTop-this._messagesEl.offsetTop-24)})),this.send||(this.send=e=>{if(e.internalFiles.length){const t=new FormData;return t.append("userText",e.message),e.internalFiles.forEach((e=>t.append("images",e))),i.Http.fetch({url:"/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithImages",method:"POST",headers:{Accept:"text/event-stream"},body:t})}return i.Http.fetch({url:"/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithState",method:"POST",headers:{Accept:"text/event-stream"},body:{userText:e.message}})}),this.send({message:e,messages:this.messages.slice(0,-1),internalFiles:s}).then((e=>{e.ok?e.body?(this._reader=e.body.getReader(),this._decoder=new TextDecoder,this._buffer="",this._readStreamChunk()):this._handleStreamError("No response body"):this._handleStreamError("Request failed: "+e.status)})).catch((e=>{"AbortError"!==e.name&&this._handleStreamError(e.message)}))}_handleStop(){this._reader&&(this._reader.cancel(),this._reader=null),this._isStreaming=!1}_handleClear(){this.clear||(this.clear=()=>i.Http.fetch({url:"/api/system/integration/aws/bedrock/clearConversationWithState",method:"POST"})),this.clear().then((()=>{this._reader&&(this._reader.cancel(),this._reader=null),this.messages=[],this._isStreaming=!1,this._error="",this._inputValue="",this._userHasScrolledUp=!1}))}_handleMessagesScroll(e){const t=e.target,i=t.scrollHeight-t.scrollTop-t.clientHeight;this._userHasScrolledUp=i>50}_handleErrorDismiss(){this._error=""}_readStreamChunk(){this._reader&&this._reader.read().then((e=>{if(e.done)return this._isStreaming=!1,void(this._reader=null);this._buffer=this._buffer+this._decoder.decode(e.value,{stream:!0});const t=this._buffer.split("\n\n");this._buffer=t.pop()||"";for(let e=0;e<t.length;e++){if(!t[e].trim())continue;const i=t[e].split("\n");for(let e=0;e<i.length;e++){if(!i[e].startsWith("data:"))continue;const t=i[e].slice(5).trim();if(!t)continue;let s;try{s=JSON.parse(t)}catch{continue}if(this.dispatchEvent(new CustomEvent("stream-event",{detail:s,bubbles:!0,composed:!0})),"REASONING_PART"===s.type){if(s.message){const e=this.messages.length-1;e>=0&&"assistant"===this.messages[e].type&&(this.messages[e].reasoning||(this.messages[e].reasoning=""),this.messages[e].reasoning+=String(s.message),this.requestUpdate())}}else if("RESPONSE_PART"===s.type){if(s.message){const e=this.messages.length-1;e>=0&&"assistant"===this.messages[e].type&&(this.messages[e].content+=String(s.message),this.requestUpdate())}}else"ERROR"===s.type&&this._handleStreamError(String(s.message||"Unknown error"));s.finished&&(this._isStreaming=!1,this._reader=null)}}this._readStreamChunk()})).catch((e=>{"AbortError"!==e.name&&this._handleStreamError(e.message)}))}_handleStreamError(e){if(this._isStreaming=!1,this._error=e,this._reader&&(this._reader.cancel(),this._reader=null),this.messages.length>0){const e=this.messages[this.messages.length-1];"assistant"!==e.type||e.content||(this.messages=this.messages.slice(0,-1))}}_renderSkillMenu(){const e=this._filteredSkills();return q`
|
|
1385
|
+
<div class="skill-menu">
|
|
1386
|
+
<div class="skill-menu__actions">
|
|
1387
|
+
<button
|
|
1388
|
+
class=${ye({"skill-menu__action":!0,"skill-menu__item--highlighted":0===this._skillHighlighted})}
|
|
1389
|
+
@click=${this._openFilePicker}
|
|
1390
|
+
>
|
|
1391
|
+
Attach Files
|
|
1392
|
+
</button>
|
|
1393
|
+
<button
|
|
1394
|
+
class=${ye({"skill-menu__action":!0,"skill-menu__item--highlighted":1===this._skillHighlighted})}
|
|
1395
|
+
@click=${this._handleSkillBrowseOpen}
|
|
1396
|
+
>
|
|
1397
|
+
Browse All Skills
|
|
1398
|
+
</button>
|
|
1399
|
+
</div>
|
|
1400
|
+
${e.length?q`
|
|
1401
|
+
<ul class="skill-menu__list">
|
|
1402
|
+
${e.map(((e,t)=>q`
|
|
1403
|
+
<li>
|
|
1404
|
+
<button
|
|
1405
|
+
class=${ye({"skill-menu__item":!0,"skill-menu__item--highlighted":t+2===this._skillHighlighted})}
|
|
1406
|
+
@click=${()=>this._handleSkillSelect(e)}
|
|
1407
|
+
>
|
|
1408
|
+
<span class="skill-menu__name">${e.label}</span>
|
|
1409
|
+
${e.description?q`
|
|
1410
|
+
<span class="skill-menu__desc">${e.description}</span>
|
|
1411
|
+
`:Q}
|
|
1412
|
+
</button>
|
|
1413
|
+
</li>
|
|
1414
|
+
`))}
|
|
1415
|
+
</ul>
|
|
1416
|
+
`:q`
|
|
1417
|
+
<div class="skill-menu__empty">No matching skills</div>
|
|
1418
|
+
`}
|
|
1419
|
+
</div>
|
|
1420
|
+
`}_renderSkillBrowse(){return q`
|
|
1421
|
+
<kr-dialog
|
|
1422
|
+
opened
|
|
1423
|
+
label="Browse Skills"
|
|
1424
|
+
width="720px"
|
|
1425
|
+
@close=${this._handleSkillBrowseClose}
|
|
1426
|
+
>
|
|
1427
|
+
<div class="skill-browse">
|
|
1428
|
+
<kr-text-field
|
|
1429
|
+
placeholder="Search skills..."
|
|
1430
|
+
.value=${this._skillBrowseQuery}
|
|
1431
|
+
@input=${this._handleSkillBrowseSearch}
|
|
1432
|
+
></kr-text-field>
|
|
1433
|
+
<kr-tab-group
|
|
1434
|
+
active-tab-id=${this._skillBrowseSource}
|
|
1435
|
+
@tab-change=${this._handleSkillBrowseTabChange}
|
|
1436
|
+
>
|
|
1437
|
+
<kr-tab id="org" label="Your Org">
|
|
1438
|
+
${this._renderSkillGrid()}
|
|
1439
|
+
</kr-tab>
|
|
1440
|
+
<kr-tab id="kodaris" label="Kodaris">
|
|
1441
|
+
${this._renderSkillGrid()}
|
|
1442
|
+
</kr-tab>
|
|
1443
|
+
</kr-tab-group>
|
|
1444
|
+
</div>
|
|
1445
|
+
</kr-dialog>
|
|
1446
|
+
`}_renderSkillGrid(){const e=this._browseSkills();return e.length?q`
|
|
1447
|
+
<div class="skill-browse__grid">
|
|
1448
|
+
${e.map((e=>q`
|
|
1449
|
+
<button
|
|
1450
|
+
class="skill-card"
|
|
1451
|
+
@click=${()=>this._handleSkillSelect(e)}
|
|
1452
|
+
>
|
|
1453
|
+
<span class="skill-card__name">${e.label}</span>
|
|
1454
|
+
${e.description?q`
|
|
1455
|
+
<span class="skill-card__desc">${e.description}</span>
|
|
1456
|
+
`:Q}
|
|
1457
|
+
</button>
|
|
1458
|
+
`))}
|
|
1459
|
+
</div>
|
|
1460
|
+
`:q`<div class="skill-browse__empty">No matching skills</div>`}_renderUserContent(e){const t=e.match(/^\/(\S+)(\s[\s\S]*)?$/);return t&&this.skills.some((e=>e.name===t[1]))?q`<span class="message-skill">/${t[1]}</span>${t[2]||""}`:e}render(){return q`
|
|
1461
|
+
${this.hideToggle||"inline"===this.variant?Q:q`
|
|
1386
1462
|
<button
|
|
1387
|
-
class=${
|
|
1463
|
+
class=${ye({toggle:!0,"toggle--hidden":this.opened})}
|
|
1388
1464
|
@click=${this._handleToggle}
|
|
1389
1465
|
title="Open chat"
|
|
1390
1466
|
>
|
|
@@ -1403,13 +1479,13 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1403
1479
|
`}
|
|
1404
1480
|
|
|
1405
1481
|
<div
|
|
1406
|
-
class=${
|
|
1482
|
+
class=${ye({panel:!0,"panel--opened":this.opened})}
|
|
1407
1483
|
@dragenter=${this._handleDragEnter}
|
|
1408
1484
|
@dragover=${this._handleDragOver}
|
|
1409
1485
|
@dragleave=${this._handleDragLeave}
|
|
1410
1486
|
@drop=${this._handleDrop}
|
|
1411
1487
|
>
|
|
1412
|
-
${this._isDraggingFile?
|
|
1488
|
+
${this._isDraggingFile?q`
|
|
1413
1489
|
<div class="drop-overlay">
|
|
1414
1490
|
<svg
|
|
1415
1491
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -1426,8 +1502,8 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1426
1502
|
</svg>
|
|
1427
1503
|
<span>Drop images to attach</span>
|
|
1428
1504
|
</div>
|
|
1429
|
-
`:
|
|
1430
|
-
${"inline"===this.variant?
|
|
1505
|
+
`:Q}
|
|
1506
|
+
${"inline"===this.variant?Q:q`
|
|
1431
1507
|
<div
|
|
1432
1508
|
class="resize resize--n"
|
|
1433
1509
|
data-dir="n"
|
|
@@ -1476,7 +1552,7 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1476
1552
|
</div>
|
|
1477
1553
|
</div>
|
|
1478
1554
|
<div class="header-actions">
|
|
1479
|
-
${this.messages.length>0?
|
|
1555
|
+
${this.messages.length>0?q`
|
|
1480
1556
|
<button
|
|
1481
1557
|
class="header-action"
|
|
1482
1558
|
@click=${this._handleClear}
|
|
@@ -1497,8 +1573,8 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1497
1573
|
/>
|
|
1498
1574
|
</svg>
|
|
1499
1575
|
</button>
|
|
1500
|
-
`:
|
|
1501
|
-
${"inline"===this.variant?
|
|
1576
|
+
`:Q}
|
|
1577
|
+
${"inline"===this.variant?Q:q`
|
|
1502
1578
|
<button
|
|
1503
1579
|
class="header-action"
|
|
1504
1580
|
@click=${this._handleToggle}
|
|
@@ -1525,22 +1601,22 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1525
1601
|
|
|
1526
1602
|
<div class="messages" @scroll=${this._handleMessagesScroll}>
|
|
1527
1603
|
<div class="messages-inner">
|
|
1528
|
-
${0===this.messages.length?
|
|
1604
|
+
${0===this.messages.length?q`
|
|
1529
1605
|
<div class="empty">
|
|
1530
1606
|
<span class="empty-text">What can I help you with?</span>
|
|
1531
1607
|
</div>
|
|
1532
|
-
`:
|
|
1533
|
-
${this.messages.map((e=>
|
|
1534
|
-
<div class=${
|
|
1535
|
-
${e.reasoning?
|
|
1608
|
+
`:Q}
|
|
1609
|
+
${this.messages.map(((e,t)=>q`
|
|
1610
|
+
<div class=${ye({message:!0,"message--user":"user"===e.type,"message--assistant":"assistant"===e.type})}>
|
|
1611
|
+
${e.reasoning?q`
|
|
1536
1612
|
<details class="reasoning">
|
|
1537
1613
|
<summary>Thinking</summary>
|
|
1538
1614
|
<div class="reasoning-content">${e.reasoning}</div>
|
|
1539
1615
|
</details>
|
|
1540
|
-
`:
|
|
1541
|
-
${e.internalFiles&&e.internalFiles.length?
|
|
1616
|
+
`:Q}
|
|
1617
|
+
${e.internalFiles&&e.internalFiles.length?q`
|
|
1542
1618
|
<div class="attachments">
|
|
1543
|
-
${e.internalFiles.map((e=>
|
|
1619
|
+
${e.internalFiles.map((e=>q`
|
|
1544
1620
|
<button
|
|
1545
1621
|
class="attachment"
|
|
1546
1622
|
type="button"
|
|
@@ -1554,25 +1630,65 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1554
1630
|
</button>
|
|
1555
1631
|
`))}
|
|
1556
1632
|
</div>
|
|
1557
|
-
`:
|
|
1558
|
-
${e.content?
|
|
1633
|
+
`:Q}
|
|
1634
|
+
${e.content?q`
|
|
1559
1635
|
<div class="message-content">
|
|
1560
|
-
${"user"===e.type?e.content:
|
|
1636
|
+
${"user"===e.type?this._renderUserContent(e.content):_e(Yt.parse(e.content,{breaks:!0}))}
|
|
1561
1637
|
</div>
|
|
1562
|
-
`:
|
|
1563
|
-
${"assistant"===e.type&&this._isStreaming&&e===this.messages[this.messages.length-1]?
|
|
1638
|
+
`:Q}
|
|
1639
|
+
${"assistant"===e.type&&this._isStreaming&&e===this.messages[this.messages.length-1]?q`
|
|
1564
1640
|
<div class="typing">
|
|
1565
1641
|
<span></span>
|
|
1566
1642
|
<span></span>
|
|
1567
1643
|
<span></span>
|
|
1568
1644
|
</div>
|
|
1569
|
-
`:
|
|
1645
|
+
`:Q}
|
|
1646
|
+
${e.content?q`
|
|
1647
|
+
<button
|
|
1648
|
+
class="message-copy"
|
|
1649
|
+
title="Copy"
|
|
1650
|
+
@click=${()=>this._handleCopyMessage(e.content,t)}
|
|
1651
|
+
>
|
|
1652
|
+
${this._copiedIndex===t?q`
|
|
1653
|
+
<svg
|
|
1654
|
+
viewBox="0 0 24 24"
|
|
1655
|
+
fill="none"
|
|
1656
|
+
stroke="currentColor"
|
|
1657
|
+
stroke-width="1.5"
|
|
1658
|
+
stroke-linecap="round"
|
|
1659
|
+
stroke-linejoin="round"
|
|
1660
|
+
>
|
|
1661
|
+
<path d="M20 6 9 17l-5-5" />
|
|
1662
|
+
</svg>
|
|
1663
|
+
Copied
|
|
1664
|
+
`:q`
|
|
1665
|
+
<svg
|
|
1666
|
+
viewBox="0 0 24 24"
|
|
1667
|
+
fill="none"
|
|
1668
|
+
stroke="currentColor"
|
|
1669
|
+
stroke-width="1.5"
|
|
1670
|
+
stroke-linecap="round"
|
|
1671
|
+
stroke-linejoin="round"
|
|
1672
|
+
>
|
|
1673
|
+
<rect
|
|
1674
|
+
x="9"
|
|
1675
|
+
y="9"
|
|
1676
|
+
width="13"
|
|
1677
|
+
height="13"
|
|
1678
|
+
rx="2"
|
|
1679
|
+
/>
|
|
1680
|
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
|
|
1681
|
+
</svg>
|
|
1682
|
+
Copy
|
|
1683
|
+
`}
|
|
1684
|
+
</button>
|
|
1685
|
+
`:Q}
|
|
1570
1686
|
</div>
|
|
1571
1687
|
`))}
|
|
1572
1688
|
</div>
|
|
1573
1689
|
</div>
|
|
1574
1690
|
|
|
1575
|
-
${this._error?
|
|
1691
|
+
${this._error?q`
|
|
1576
1692
|
<div class="error">
|
|
1577
1693
|
<span>${this._error}</span>
|
|
1578
1694
|
<button class="error-dismiss" @click=${this._handleErrorDismiss}>
|
|
@@ -1592,12 +1708,12 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1592
1708
|
</svg>
|
|
1593
1709
|
</button>
|
|
1594
1710
|
</div>
|
|
1595
|
-
`:
|
|
1711
|
+
`:Q}
|
|
1596
1712
|
|
|
1597
1713
|
<div class="footer">
|
|
1598
|
-
${this._pendingInternalFiles.length?
|
|
1714
|
+
${this._pendingInternalFiles.length?q`
|
|
1599
1715
|
<div class="composer-attachments">
|
|
1600
|
-
${Le(this._pendingInternalFiles,(e=>e.localId),(e=>
|
|
1716
|
+
${Le(this._pendingInternalFiles,(e=>e.localId),(e=>q`
|
|
1601
1717
|
<div class="chip">
|
|
1602
1718
|
<img src=${e.previewUrl} alt=${e.name} />
|
|
1603
1719
|
<button
|
|
@@ -1622,7 +1738,7 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1622
1738
|
</div>
|
|
1623
1739
|
`))}
|
|
1624
1740
|
</div>
|
|
1625
|
-
`:
|
|
1741
|
+
`:Q}
|
|
1626
1742
|
<input
|
|
1627
1743
|
class="file-input"
|
|
1628
1744
|
type="file"
|
|
@@ -1631,11 +1747,11 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1631
1747
|
hidden
|
|
1632
1748
|
@change=${this._handleFileInputChange}
|
|
1633
1749
|
/>
|
|
1750
|
+
${this._skillMenuOpened?this._renderSkillMenu():Q}
|
|
1634
1751
|
<div class="input-wrapper">
|
|
1635
1752
|
<button
|
|
1636
1753
|
class="input-plus"
|
|
1637
|
-
|
|
1638
|
-
@click=${this._openFilePicker}
|
|
1754
|
+
@click=${this._handlePlusClick}
|
|
1639
1755
|
>+</button>
|
|
1640
1756
|
<textarea
|
|
1641
1757
|
class="input"
|
|
@@ -1646,7 +1762,7 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1646
1762
|
@keydown=${this._handleKeyDown}
|
|
1647
1763
|
@paste=${this._handlePaste}
|
|
1648
1764
|
></textarea>
|
|
1649
|
-
${this._isStreaming?
|
|
1765
|
+
${this._isStreaming?q`
|
|
1650
1766
|
<button
|
|
1651
1767
|
class="stop"
|
|
1652
1768
|
@click=${this._handleStop}
|
|
@@ -1667,9 +1783,9 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1667
1783
|
/>
|
|
1668
1784
|
</svg>
|
|
1669
1785
|
</button>
|
|
1670
|
-
`:
|
|
1786
|
+
`:q`
|
|
1671
1787
|
<button
|
|
1672
|
-
class=${
|
|
1788
|
+
class=${ye({send:!0,"send--disabled":!this._canSend()})}
|
|
1673
1789
|
@click=${this._handleSubmit}
|
|
1674
1790
|
title="Send message"
|
|
1675
1791
|
>
|
|
@@ -1689,6 +1805,7 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1689
1805
|
`}
|
|
1690
1806
|
</div>
|
|
1691
1807
|
</div>
|
|
1808
|
+
${this._skillBrowseOpened?this._renderSkillBrowse():Q}
|
|
1692
1809
|
</div>
|
|
1693
1810
|
`}},e.Chatbot.styles=l`
|
|
1694
1811
|
*,
|
|
@@ -1925,6 +2042,7 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1925
2042
|
}
|
|
1926
2043
|
|
|
1927
2044
|
.message {
|
|
2045
|
+
position: relative;
|
|
1928
2046
|
display: flex;
|
|
1929
2047
|
flex-direction: column;
|
|
1930
2048
|
max-width: 100%;
|
|
@@ -1969,6 +2087,58 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
1969
2087
|
font-size: 14px;
|
|
1970
2088
|
}
|
|
1971
2089
|
|
|
2090
|
+
/* Highlighted leading /skill token in a sent user message. Monospace + a
|
|
2091
|
+
stronger color makes it read as a distinct command without a pill. */
|
|
2092
|
+
.message-skill {
|
|
2093
|
+
font-family: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
|
|
2094
|
+
font-weight: 600;
|
|
2095
|
+
color: #b45309;
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
/* Per-message copy button. Kept in flow with a fixed height that is always
|
|
2099
|
+
reserved (via a negative bottom margin that cancels it) so message spacing
|
|
2100
|
+
is identical whether or not it's shown; only its opacity toggles on hover. */
|
|
2101
|
+
.message-copy {
|
|
2102
|
+
align-self: flex-start;
|
|
2103
|
+
margin-top: 4px;
|
|
2104
|
+
margin-bottom: -27px;
|
|
2105
|
+
display: inline-flex;
|
|
2106
|
+
align-items: center;
|
|
2107
|
+
gap: 4px;
|
|
2108
|
+
height: 23px;
|
|
2109
|
+
padding: 4px 8px;
|
|
2110
|
+
background: none;
|
|
2111
|
+
border: none;
|
|
2112
|
+
border-radius: 6px;
|
|
2113
|
+
font: inherit;
|
|
2114
|
+
font-size: 12px;
|
|
2115
|
+
color: #64668b;
|
|
2116
|
+
cursor: pointer;
|
|
2117
|
+
opacity: 0;
|
|
2118
|
+
pointer-events: none;
|
|
2119
|
+
transition: opacity 0.15s, background-color 0.15s, color 0.15s;
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
.message--user .message-copy {
|
|
2123
|
+
align-self: flex-end;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
.message:hover .message-copy,
|
|
2127
|
+
.message-copy:focus-visible {
|
|
2128
|
+
opacity: 1;
|
|
2129
|
+
pointer-events: auto;
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
.message-copy:hover {
|
|
2133
|
+
background: rgba(0, 0, 0, 0.06);
|
|
2134
|
+
color: #1a1a2e;
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
.message-copy svg {
|
|
2138
|
+
width: 14px;
|
|
2139
|
+
height: 14px;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
1972
2142
|
.message--assistant .message-content {
|
|
1973
2143
|
background: transparent;
|
|
1974
2144
|
color: #000000;
|
|
@@ -2304,6 +2474,176 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
2304
2474
|
display: block;
|
|
2305
2475
|
}
|
|
2306
2476
|
|
|
2477
|
+
/* Skill menu (opened by typing '/'). Fixed + JS-positioned above the
|
|
2478
|
+
composer, following the krubble select-field dropdown pattern. */
|
|
2479
|
+
.skill-menu {
|
|
2480
|
+
position: fixed;
|
|
2481
|
+
z-index: 10000;
|
|
2482
|
+
background: white;
|
|
2483
|
+
border: 1px solid #9ba7b6;
|
|
2484
|
+
border-radius: 8px;
|
|
2485
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
2486
|
+
overflow: hidden;
|
|
2487
|
+
display: flex;
|
|
2488
|
+
flex-direction: column;
|
|
2489
|
+
/* max-height is set dynamically to the space above the composer. */
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
/* Floating mode is a compact card — use a lighter shadow and softer border. */
|
|
2493
|
+
:host(:not([variant='inline'])) .skill-menu {
|
|
2494
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
2495
|
+
border-color: #b0b0b0;
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
.skill-menu__list {
|
|
2499
|
+
list-style: none;
|
|
2500
|
+
margin: 0;
|
|
2501
|
+
padding: 8px 0;
|
|
2502
|
+
overflow-y: auto;
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
.skill-menu__item {
|
|
2506
|
+
display: flex;
|
|
2507
|
+
flex-direction: column;
|
|
2508
|
+
gap: 2px;
|
|
2509
|
+
width: 100%;
|
|
2510
|
+
padding: 8px 16px;
|
|
2511
|
+
background: none;
|
|
2512
|
+
border: none;
|
|
2513
|
+
text-align: left;
|
|
2514
|
+
cursor: pointer;
|
|
2515
|
+
font: inherit;
|
|
2516
|
+
color: #000000;
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
|
|
2520
|
+
/* Floating mode is a compact card — tighten name/description spacing. */
|
|
2521
|
+
:host(:not([variant='inline'])) .skill-menu__item {
|
|
2522
|
+
gap: 1px;
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
.skill-menu__name {
|
|
2526
|
+
font-weight: 500;
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2529
|
+
/* Floating mode is a compact card — shrink the skill name a touch. */
|
|
2530
|
+
:host(:not([variant='inline'])) .skill-menu__name {
|
|
2531
|
+
font-size: 13px;
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
.skill-menu__desc {
|
|
2535
|
+
font-size: 12px;
|
|
2536
|
+
color: #000000;
|
|
2537
|
+
overflow: hidden;
|
|
2538
|
+
text-overflow: ellipsis;
|
|
2539
|
+
white-space: nowrap;
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
.skill-menu__empty {
|
|
2543
|
+
padding: 16px;
|
|
2544
|
+
text-align: center;
|
|
2545
|
+
color: #000000;
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
.skill-menu__actions {
|
|
2549
|
+
display: flex;
|
|
2550
|
+
flex-direction: column;
|
|
2551
|
+
padding: 8px 0;
|
|
2552
|
+
border-bottom: 1px solid #eee;
|
|
2553
|
+
flex-shrink: 0;
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
.skill-menu__action {
|
|
2557
|
+
width: 100%;
|
|
2558
|
+
padding: 6px 16px;
|
|
2559
|
+
background: transparent;
|
|
2560
|
+
border: none;
|
|
2561
|
+
text-align: left;
|
|
2562
|
+
cursor: pointer;
|
|
2563
|
+
font: inherit;
|
|
2564
|
+
font-size: 13px;
|
|
2565
|
+
color: var(--kr-chatbot-primary);
|
|
2566
|
+
font-weight: 500;
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
/* Highlight (keyboard) and hover (mouse) are independent — either shades the
|
|
2570
|
+
row. Declared after the base rules so it wins the cascade for both the
|
|
2571
|
+
action buttons and the skill items. */
|
|
2572
|
+
.skill-menu__action.skill-menu__item--highlighted,
|
|
2573
|
+
.skill-menu__item.skill-menu__item--highlighted,
|
|
2574
|
+
.skill-menu__action:hover,
|
|
2575
|
+
.skill-menu__item:hover {
|
|
2576
|
+
background: #f3f4f6;
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
/* Browse-all dialog body. Owns the height so the dialog is the same size on
|
|
2580
|
+
every tab; the search is fixed and the card grid flexes/scrolls to fill. */
|
|
2581
|
+
.skill-browse {
|
|
2582
|
+
display: flex;
|
|
2583
|
+
flex-direction: column;
|
|
2584
|
+
height: 70vh;
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
.skill-browse kr-text-field {
|
|
2588
|
+
display: block;
|
|
2589
|
+
margin: 20px 20px 16px;
|
|
2590
|
+
flex-shrink: 0;
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
.skill-browse kr-tab-group {
|
|
2594
|
+
flex: 1;
|
|
2595
|
+
min-height: 0;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
/* The grid is the scroller and spans the full width, so its scrollbar sits
|
|
2599
|
+
flush against the dialog edge; padding-right insets the cards from it. */
|
|
2600
|
+
.skill-browse__grid {
|
|
2601
|
+
height: 100%;
|
|
2602
|
+
overflow-y: auto;
|
|
2603
|
+
display: grid;
|
|
2604
|
+
grid-template-columns: repeat(3, 1fr);
|
|
2605
|
+
grid-auto-rows: min-content;
|
|
2606
|
+
align-content: start;
|
|
2607
|
+
gap: 12px;
|
|
2608
|
+
padding: 16px 20px 20px;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
.skill-card {
|
|
2612
|
+
display: flex;
|
|
2613
|
+
flex-direction: column;
|
|
2614
|
+
gap: 6px;
|
|
2615
|
+
padding: 14px;
|
|
2616
|
+
background: white;
|
|
2617
|
+
border: 1px solid #e5e7eb;
|
|
2618
|
+
border-radius: 10px;
|
|
2619
|
+
text-align: left;
|
|
2620
|
+
cursor: pointer;
|
|
2621
|
+
font: inherit;
|
|
2622
|
+
color: #000000;
|
|
2623
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
.skill-card:hover {
|
|
2627
|
+
border-color: var(--kr-chatbot-primary);
|
|
2628
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
.skill-card__name {
|
|
2632
|
+
font-weight: 600;
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2635
|
+
.skill-card__desc {
|
|
2636
|
+
font-size: 12px;
|
|
2637
|
+
color: #000000;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
.skill-browse__empty {
|
|
2641
|
+
height: 100%;
|
|
2642
|
+
padding: 32px;
|
|
2643
|
+
text-align: center;
|
|
2644
|
+
color: #000000;
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2307
2647
|
/* Composer attachment chips (pre-send) */
|
|
2308
2648
|
.composer-attachments {
|
|
2309
2649
|
display: flex;
|
|
@@ -2384,5 +2724,5 @@ const{I:De}=re,Te=()=>document.createComment(""),Re=(e,t,s)=>{const i=e._$AA.par
|
|
|
2384
2724
|
height: 32px;
|
|
2385
2725
|
}
|
|
2386
2726
|
|
|
2387
|
-
`,Zt([ue({attribute:!1})],e.Chatbot.prototype,"send",void 0),Zt([ue({attribute:!1})],e.Chatbot.prototype,"clear",void 0),Zt([ue({attribute:!1})],e.Chatbot.prototype,"load",void 0),Zt([ue({attribute:!1})],e.Chatbot.prototype,"messages",void 0),Zt([ue({type:String})],e.Chatbot.prototype,"label",void 0),Zt([ue({type:String})],e.Chatbot.prototype,"placeholder",void 0),Zt([ue({type:Boolean,reflect:!0})],e.Chatbot.prototype,"opened",void 0),Zt([ue({type:Boolean,attribute:"hide-toggle",reflect:!0})],e.Chatbot.prototype,"hideToggle",void 0),Zt([ue({type:String,reflect:!0})],e.Chatbot.prototype,"variant",void 0),Zt([ge()],e.Chatbot.prototype,"_inputValue",void 0),Zt([ge()],e.Chatbot.prototype,"_isStreaming",void 0),Zt([ge()],e.Chatbot.prototype,"_error",void 0),Zt([ge()],e.Chatbot.prototype,"_pendingInternalFiles",void 0),Zt([ge()],e.Chatbot.prototype,"_isDraggingFile",void 0),Zt([fe(".panel")],e.Chatbot.prototype,"_panelEl",void 0),Zt([fe(".messages")],e.Chatbot.prototype,"_messagesEl",void 0),Zt([fe(".input")],e.Chatbot.prototype,"_inputEl",void 0),Zt([fe(".file-input")],e.Chatbot.prototype,"_fileInputEl",void 0),e.Chatbot=Zt([
|
|
2727
|
+
`,Zt([ue({attribute:!1})],e.Chatbot.prototype,"send",void 0),Zt([ue({attribute:!1})],e.Chatbot.prototype,"clear",void 0),Zt([ue({attribute:!1})],e.Chatbot.prototype,"load",void 0),Zt([ue({attribute:!1})],e.Chatbot.prototype,"messages",void 0),Zt([ue({type:String})],e.Chatbot.prototype,"label",void 0),Zt([ue({type:String})],e.Chatbot.prototype,"placeholder",void 0),Zt([ue({attribute:!1})],e.Chatbot.prototype,"skills",void 0),Zt([ue({type:Boolean,reflect:!0})],e.Chatbot.prototype,"opened",void 0),Zt([ue({type:Boolean,attribute:"hide-toggle",reflect:!0})],e.Chatbot.prototype,"hideToggle",void 0),Zt([ue({type:String,reflect:!0})],e.Chatbot.prototype,"variant",void 0),Zt([ge()],e.Chatbot.prototype,"_inputValue",void 0),Zt([ge()],e.Chatbot.prototype,"_isStreaming",void 0),Zt([ge()],e.Chatbot.prototype,"_error",void 0),Zt([ge()],e.Chatbot.prototype,"_pendingInternalFiles",void 0),Zt([ge()],e.Chatbot.prototype,"_isDraggingFile",void 0),Zt([ge()],e.Chatbot.prototype,"_skillMenuOpened",void 0),Zt([ge()],e.Chatbot.prototype,"_skillQuery",void 0),Zt([ge()],e.Chatbot.prototype,"_skillHighlighted",void 0),Zt([ge()],e.Chatbot.prototype,"_copiedIndex",void 0),Zt([ge()],e.Chatbot.prototype,"_skillBrowseOpened",void 0),Zt([ge()],e.Chatbot.prototype,"_skillBrowseSource",void 0),Zt([ge()],e.Chatbot.prototype,"_skillBrowseQuery",void 0),Zt([fe(".panel")],e.Chatbot.prototype,"_panelEl",void 0),Zt([fe(".messages")],e.Chatbot.prototype,"_messagesEl",void 0),Zt([fe(".input")],e.Chatbot.prototype,"_inputEl",void 0),Zt([fe(".file-input")],e.Chatbot.prototype,"_fileInputEl",void 0),Zt([fe(".input-wrapper")],e.Chatbot.prototype,"_inputWrapperEl",void 0),Zt([fe(".skill-menu")],e.Chatbot.prototype,"_skillMenuEl",void 0),e.Chatbot=Zt([ce("kr-chatbot")],e.Chatbot),e.Router=ze})),function(e){Object.keys(e).forEach((function(t){t.startsWith("KR")&&"function"==typeof e[t]&&(e[t.slice(2)]=e[t],delete e[t])}))}(krApp);
|
|
2388
2728
|
//# sourceMappingURL=krubble-app.umd.min.js.map
|