@kodaris/krubble-app-components 1.0.151 → 1.0.153
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 +19 -4
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +113 -105
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +136 -121
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +5 -10
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +139 -123
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +5 -10
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/dist/router.d.ts +1 -0
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +22 -9
- package/dist/router.js.map +1 -1
- package/package.json +1 -1
package/dist/krubble-app.umd.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Copyright 2019 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
11
|
*/
|
|
12
|
-
const t$
|
|
12
|
+
const t$3=globalThis,e$7=t$3.ShadowRoot&&(void 0===t$3.ShadyCSS||t$3.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$3=Symbol(),o$6=new WeakMap;let n$4 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$7&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$6.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$6.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$4("string"==typeof t?t:t+"",void 0,s$3),i$6=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$4(o,t,s$3)},S$1=(s,o)=>{if(e$7)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t$3.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$3=e$7?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @license
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* Copyright 2017 Google LLC
|
|
23
23
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
24
24
|
*/
|
|
25
|
-
const t$
|
|
25
|
+
const t$2=globalThis,i$4=t=>t,s$2=t$2.trustedTypes,e$5=s$2?s$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,h$1="$lit$",o$4=`lit$${Math.random().toFixed(9).slice(2)}$`,n$2="?"+o$4,r$2=`<${n$2}>`,l=document,c$1=()=>l.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u$2=Array.isArray,d=t=>u$2(t)||"function"==typeof t?.[Symbol.iterator],f="[ \t\n\f\r]",v$1=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m$1=/>/g,p$1=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u$2(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e$5?e$5.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v$1;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v$1?"!--"===u[1]?c=_:void 0!==u[1]?c=m$1:void 0!==u[2]?(y.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p$1):void 0!==u[3]&&(c=p$1):c===p$1?">"===u[0]?(c=n??v$1,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p$1:'"'===u[3]?$:g):c===$||c===g?c=p$1:c===_||c===m$1?c=v$1:(c=p$1,n=void 0);const x=c===p$1&&t[i+1].startsWith("/>")?" ":"";l+=c===v$1?s+r$2:d>=0?(e.push(a),s.slice(0,d)+h$1+s.slice(d)+o$4+x):s+o$4+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h$1)){const i=v[a++],s=r.getAttribute(t).split(o$4),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z:H}),r.removeAttribute(t);}else t.startsWith(o$4)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o$4),i=t.length-1;if(i>0){r.textContent=s$2?s$2.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c$1()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c$1());}}}else if(8===r.nodeType)if(r.data===n$2)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$4,t+1));)d.push({type:7,index:l}),t+=o$4.length-1;}l++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function M$1(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M$1(t,h._$AS(t,i.values),h,e)),i}class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l).importNode(i,true);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=M$1(this,t,i),a(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u$2(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new k(this.O(c$1()),this.O(c$1()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(false,true,s);t!==this._$AB;){const s=i$4(t).nextSibling;i$4(t).remove(),t=s;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=M$1(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M$1(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class I extends H{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A);}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M$1(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){M$1(this,t);}}const j={I:k},B=t$2.litHtmlPolyfillSupport;B?.(S,k),(t$2.litHtmlVersions??=[]).push("3.3.2");const D=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new k(i.insertBefore(c$1(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* @license
|
|
@@ -30,13 +30,6 @@
|
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
31
|
*/const s$1=globalThis;let i$3 = class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}};i$3._$litElement$=true,i$3["finalized"]=true,s$1.litElementHydrateSupport?.({LitElement:i$3});const o$3=s$1.litElementPolyfillSupport;o$3?.({LitElement:i$3});(s$1.litElementVersions??=[]).push("4.2.2");
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* @license
|
|
35
|
-
* Copyright 2017 Google LLC
|
|
36
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
37
|
-
*/
|
|
38
|
-
const t$2=t=>(e,o)=>{ void 0!==o?o.addInitializer(()=>{customElements.define(t,e);}):customElements.define(t,e);};
|
|
39
|
-
|
|
40
33
|
/**
|
|
41
34
|
* @license
|
|
42
35
|
* Copyright 2017 Google LLC
|
|
@@ -3444,13 +3437,15 @@
|
|
|
3444
3437
|
};
|
|
3445
3438
|
}
|
|
3446
3439
|
// Tab-scoped resume (floating only): a reload should redisplay the exact
|
|
3447
|
-
// conversation this tab was on
|
|
3448
|
-
//
|
|
3449
|
-
//
|
|
3450
|
-
//
|
|
3451
|
-
//
|
|
3452
|
-
//
|
|
3453
|
-
//
|
|
3440
|
+
// conversation this tab was on. The pinned id lives in sessionStorage (per-tab —
|
|
3441
|
+
// unlike localStorage it isn't shared across tabs, so two tabs can sit on
|
|
3442
|
+
// different conversations). A brand-new tab has nothing pinned and starts blank:
|
|
3443
|
+
// the user is likely opening the chat to ask about something new, and the
|
|
3444
|
+
// history drawer gets them back to earlier conversations. We resolve the id
|
|
3445
|
+
// FIRST, then run the built-in load so it rebuilds the right transcript. Skipped
|
|
3446
|
+
// when the consumer owns targeting (an explicit `conversation-id`) or in inline
|
|
3447
|
+
// mode (embedded as a page — the host route, not the tab, decides the
|
|
3448
|
+
// conversation).
|
|
3454
3449
|
let resolveConversationId = Promise.resolve();
|
|
3455
3450
|
if (this.variant === 'floating' && this.conversationId == null) {
|
|
3456
3451
|
const stored = Number(sessionStorage.getItem('kr-chatbot-conversation-id'));
|
|
@@ -3466,25 +3461,6 @@
|
|
|
3466
3461
|
})
|
|
3467
3462
|
.catch(() => { });
|
|
3468
3463
|
}
|
|
3469
|
-
else {
|
|
3470
|
-
// Fresh tab, nothing pinned yet — resume the user's most recent conversation
|
|
3471
|
-
// (404 when they have none, which leaves us blank for a new one).
|
|
3472
|
-
resolveConversationId = krubbleHttp.Http.fetch({ url: '/api/system/conversation/last' })
|
|
3473
|
-
.then((r) => {
|
|
3474
|
-
if (!r.ok) {
|
|
3475
|
-
return;
|
|
3476
|
-
}
|
|
3477
|
-
return r.json().then((res) => {
|
|
3478
|
-
const id = res?.data?.conversationID;
|
|
3479
|
-
if (typeof id === 'number') {
|
|
3480
|
-
this.conversationId = id;
|
|
3481
|
-
this._conversationTitle = res?.data?.title || '';
|
|
3482
|
-
this._persistConversationId();
|
|
3483
|
-
}
|
|
3484
|
-
});
|
|
3485
|
-
})
|
|
3486
|
-
.catch(() => { });
|
|
3487
|
-
}
|
|
3488
3464
|
}
|
|
3489
3465
|
// `this.load` is always set by here (defaulted above when the consumer didn't
|
|
3490
3466
|
// supply one); the `!` is because TS can't narrow the nullable property across
|
|
@@ -3800,133 +3776,158 @@
|
|
|
3800
3776
|
catch { /* sessionStorage not available */ }
|
|
3801
3777
|
}
|
|
3802
3778
|
/**
|
|
3803
|
-
*
|
|
3804
|
-
*
|
|
3805
|
-
*
|
|
3806
|
-
*
|
|
3779
|
+
* Two stores, split by lifetime:
|
|
3780
|
+
*
|
|
3781
|
+
* - Preferences (composer draft, mode, tool toggles) go to localStorage so they
|
|
3782
|
+
* follow the user across tabs.
|
|
3783
|
+
* - Per-tab state goes to sessionStorage: the debug drawer (open flag, view,
|
|
3784
|
+
* width) and, for the floating widget only, the panel's open flag and its
|
|
3785
|
+
* dragged/resized layout. A reload brings the tab back exactly as it was, but a
|
|
3786
|
+
* brand-new tab starts with the panel closed in the default spot and the drawer
|
|
3787
|
+
* shut. Inline embeds are always open and fill their container, so they never
|
|
3788
|
+
* write the panel fields.
|
|
3789
|
+
*
|
|
3790
|
+
* Both stores use separate keys for the floating widget and inline embeds so
|
|
3791
|
+
* neither clobbers the other.
|
|
3807
3792
|
*/
|
|
3808
3793
|
_saveState() {
|
|
3794
|
+
let storageKey = 'kr-chatbot-state';
|
|
3795
|
+
let tabKey = 'kr-chatbot-tab';
|
|
3796
|
+
if (this.variant === 'inline') {
|
|
3797
|
+
storageKey = 'kr-chatbot-state-inline';
|
|
3798
|
+
tabKey = 'kr-chatbot-tab-inline';
|
|
3799
|
+
}
|
|
3809
3800
|
try {
|
|
3810
|
-
// `toolDetail` is a transient peek, not a saved view — persist only the two
|
|
3811
|
-
// real preference views so a reload never reopens a stale tool.
|
|
3812
|
-
let persistedDrawerView = this._drawerView;
|
|
3813
|
-
if (persistedDrawerView === 'toolDetail') {
|
|
3814
|
-
persistedDrawerView = 'settings';
|
|
3815
|
-
}
|
|
3816
3801
|
const state = {
|
|
3817
|
-
opened: String(this.opened),
|
|
3818
3802
|
message: this._inputValue,
|
|
3819
3803
|
mode: this._mode,
|
|
3820
3804
|
showTools: String(this._showTools),
|
|
3821
3805
|
showToolInputs: String(this._showToolInputs),
|
|
3822
3806
|
showConfirmationInput: String(this._showConfirmationInput),
|
|
3807
|
+
};
|
|
3808
|
+
localStorage.setItem(storageKey, JSON.stringify(state));
|
|
3809
|
+
}
|
|
3810
|
+
catch { /* localStorage not available */ }
|
|
3811
|
+
try {
|
|
3812
|
+
// `toolDetail` is a transient peek, not a saved view — persist only the two
|
|
3813
|
+
// real preference views so a reload never reopens a stale tool.
|
|
3814
|
+
let persistedDrawerView = this._drawerView;
|
|
3815
|
+
if (persistedDrawerView === 'toolDetail') {
|
|
3816
|
+
persistedDrawerView = 'settings';
|
|
3817
|
+
}
|
|
3818
|
+
const tab = {
|
|
3823
3819
|
drawerOpen: String(this._drawerOpen),
|
|
3824
3820
|
drawerView: persistedDrawerView,
|
|
3825
3821
|
drawerWidth: String(this._drawerWidth),
|
|
3826
3822
|
};
|
|
3827
|
-
if (this.
|
|
3828
|
-
|
|
3829
|
-
if (
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3823
|
+
if (this.variant === 'floating') {
|
|
3824
|
+
tab.opened = String(this.opened);
|
|
3825
|
+
if (this._panelEl) {
|
|
3826
|
+
const s = this._panelEl.style;
|
|
3827
|
+
if (s.left) {
|
|
3828
|
+
tab.left = s.left;
|
|
3829
|
+
}
|
|
3830
|
+
if (s.top) {
|
|
3831
|
+
tab.top = s.top;
|
|
3832
|
+
}
|
|
3833
|
+
if (s.width) {
|
|
3834
|
+
tab.width = s.width;
|
|
3835
|
+
}
|
|
3836
|
+
if (s.height) {
|
|
3837
|
+
tab.height = s.height;
|
|
3838
|
+
}
|
|
3839
|
+
if (s.position) {
|
|
3840
|
+
tab.position = s.position;
|
|
3841
|
+
}
|
|
3843
3842
|
}
|
|
3844
3843
|
}
|
|
3845
|
-
|
|
3846
|
-
if (this.variant === 'inline') {
|
|
3847
|
-
storageKey = 'kr-chatbot-state-inline';
|
|
3848
|
-
}
|
|
3849
|
-
localStorage.setItem(storageKey, JSON.stringify(state));
|
|
3844
|
+
sessionStorage.setItem(tabKey, JSON.stringify(tab));
|
|
3850
3845
|
}
|
|
3851
|
-
catch { /*
|
|
3846
|
+
catch { /* sessionStorage not available */ }
|
|
3852
3847
|
}
|
|
3853
3848
|
_restoreState() {
|
|
3849
|
+
let storageKey = 'kr-chatbot-state';
|
|
3850
|
+
let tabKey = 'kr-chatbot-tab';
|
|
3851
|
+
if (this.variant === 'inline') {
|
|
3852
|
+
storageKey = 'kr-chatbot-state-inline';
|
|
3853
|
+
tabKey = 'kr-chatbot-tab-inline';
|
|
3854
|
+
}
|
|
3854
3855
|
try {
|
|
3855
|
-
let storageKey = 'kr-chatbot-state';
|
|
3856
|
-
if (this.variant === 'inline') {
|
|
3857
|
-
storageKey = 'kr-chatbot-state-inline';
|
|
3858
|
-
}
|
|
3859
3856
|
const raw = localStorage.getItem(storageKey);
|
|
3857
|
+
if (raw) {
|
|
3858
|
+
const state = JSON.parse(raw);
|
|
3859
|
+
// A lone `/` is dropped — it's the in-progress half of a menu interaction,
|
|
3860
|
+
// not a draft, and restoring it would revive a stale menu the user never
|
|
3861
|
+
// used. Anything with an actual command after the slash (`/code`, `/code do
|
|
3862
|
+
// the thing`) is a real draft and restores normally. Trimmed before testing
|
|
3863
|
+
// so a stray space around the slash doesn't defeat the check.
|
|
3864
|
+
if (typeof state.message === 'string' && state.message.trim() !== '/') {
|
|
3865
|
+
this._inputValue = state.message;
|
|
3866
|
+
}
|
|
3867
|
+
if (state.mode === 'NORMAL' || state.mode === 'EDIT' || state.mode === 'PLAN') {
|
|
3868
|
+
this._mode = state.mode;
|
|
3869
|
+
}
|
|
3870
|
+
this._showTools = state.showTools === 'true';
|
|
3871
|
+
this._showToolInputs = state.showToolInputs === 'true';
|
|
3872
|
+
this._showConfirmationInput = state.showConfirmationInput === 'true';
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3875
|
+
catch { /* localStorage not available */ }
|
|
3876
|
+
try {
|
|
3877
|
+
const raw = sessionStorage.getItem(tabKey);
|
|
3860
3878
|
if (!raw) {
|
|
3861
3879
|
return;
|
|
3862
3880
|
}
|
|
3863
|
-
const
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
// used. Anything with an actual command after the slash (`/code`, `/code do
|
|
3868
|
-
// the thing`) is a real draft and restores normally. Trimmed before testing
|
|
3869
|
-
// so a stray space around the slash doesn't defeat the check.
|
|
3870
|
-
if (typeof state.message === 'string' && state.message.trim() !== '/') {
|
|
3871
|
-
this._inputValue = state.message;
|
|
3872
|
-
}
|
|
3873
|
-
if (state.mode === 'NORMAL' || state.mode === 'EDIT' || state.mode === 'PLAN') {
|
|
3874
|
-
this._mode = state.mode;
|
|
3875
|
-
}
|
|
3876
|
-
this._showTools = state.showTools === 'true';
|
|
3877
|
-
this._showToolInputs = state.showToolInputs === 'true';
|
|
3878
|
-
this._showConfirmationInput = state.showConfirmationInput === 'true';
|
|
3879
|
-
this._drawerOpen = state.drawerOpen === 'true';
|
|
3880
|
-
if (state.drawerView === 'settings' || state.drawerView === 'debug' || state.drawerView === 'history') {
|
|
3881
|
-
this._drawerView = state.drawerView;
|
|
3881
|
+
const tab = JSON.parse(raw);
|
|
3882
|
+
this._drawerOpen = tab.drawerOpen === 'true';
|
|
3883
|
+
if (tab.drawerView === 'settings' || tab.drawerView === 'debug' || tab.drawerView === 'history') {
|
|
3884
|
+
this._drawerView = tab.drawerView;
|
|
3882
3885
|
// History's list isn't persisted (it can go stale); refetch it so a reload
|
|
3883
3886
|
// that was on the conversations panel comes back to a populated list rather
|
|
3884
3887
|
// than an empty one.
|
|
3885
|
-
if (
|
|
3888
|
+
if (tab.drawerView === 'history') {
|
|
3886
3889
|
this._loadConversations();
|
|
3887
3890
|
}
|
|
3888
3891
|
}
|
|
3889
|
-
const w = Number(
|
|
3892
|
+
const w = Number(tab.drawerWidth);
|
|
3890
3893
|
if (w >= 300) {
|
|
3891
3894
|
this._drawerWidth = w;
|
|
3892
3895
|
}
|
|
3893
|
-
// The
|
|
3894
|
-
|
|
3896
|
+
// The panel's open flag and layout only apply to the floating widget — inline
|
|
3897
|
+
// mode is always open.
|
|
3898
|
+
if (this.variant === 'floating' && tab.opened === 'true') {
|
|
3895
3899
|
this.opened = true;
|
|
3896
3900
|
// Apply layout after first render
|
|
3897
3901
|
this.updateComplete.then(() => this._applyStoredLayout());
|
|
3898
3902
|
}
|
|
3899
3903
|
}
|
|
3900
|
-
catch { /*
|
|
3904
|
+
catch { /* sessionStorage not available */ }
|
|
3901
3905
|
}
|
|
3906
|
+
/** Floating only — inline embeds never store a layout and never reach this. */
|
|
3902
3907
|
_applyStoredLayout() {
|
|
3903
3908
|
try {
|
|
3904
|
-
|
|
3905
|
-
if (this.variant === 'inline') {
|
|
3906
|
-
storageKey = 'kr-chatbot-state-inline';
|
|
3907
|
-
}
|
|
3908
|
-
const raw = localStorage.getItem(storageKey);
|
|
3909
|
+
const raw = sessionStorage.getItem('kr-chatbot-tab');
|
|
3909
3910
|
if (!raw || !this._panelEl) {
|
|
3910
3911
|
return;
|
|
3911
3912
|
}
|
|
3912
|
-
const
|
|
3913
|
-
if (
|
|
3914
|
-
this._panelEl.style.position =
|
|
3913
|
+
const tab = JSON.parse(raw);
|
|
3914
|
+
if (tab.position) {
|
|
3915
|
+
this._panelEl.style.position = tab.position;
|
|
3915
3916
|
}
|
|
3916
|
-
if (
|
|
3917
|
-
this._panelEl.style.left =
|
|
3917
|
+
if (tab.left) {
|
|
3918
|
+
this._panelEl.style.left = tab.left;
|
|
3918
3919
|
}
|
|
3919
|
-
if (
|
|
3920
|
-
this._panelEl.style.top =
|
|
3920
|
+
if (tab.top) {
|
|
3921
|
+
this._panelEl.style.top = tab.top;
|
|
3921
3922
|
}
|
|
3922
|
-
if (
|
|
3923
|
-
this._panelEl.style.width =
|
|
3923
|
+
if (tab.width) {
|
|
3924
|
+
this._panelEl.style.width = tab.width;
|
|
3924
3925
|
}
|
|
3925
|
-
if (
|
|
3926
|
-
this._panelEl.style.height =
|
|
3926
|
+
if (tab.height) {
|
|
3927
|
+
this._panelEl.style.height = tab.height;
|
|
3927
3928
|
}
|
|
3928
3929
|
}
|
|
3929
|
-
catch { /*
|
|
3930
|
+
catch { /* sessionStorage not available */ }
|
|
3930
3931
|
}
|
|
3931
3932
|
_handleInputChange(e) {
|
|
3932
3933
|
this._inputValue = e.target.value;
|
|
@@ -6001,7 +6002,7 @@
|
|
|
6001
6002
|
` : A}
|
|
6002
6003
|
${global ? b `
|
|
6003
6004
|
<div class="skill-card__footer">
|
|
6004
|
-
<span class="skill-card__price"
|
|
6005
|
+
<span class="skill-card__price">${skill.priceLabel}</span>
|
|
6005
6006
|
<kr-button
|
|
6006
6007
|
class="skill-card__install-btn"
|
|
6007
6008
|
size="small"
|
|
@@ -12312,6 +12313,13 @@
|
|
|
12312
12313
|
static configure(config) {
|
|
12313
12314
|
KRRouter.base = config.base;
|
|
12314
12315
|
KRRouter.routes = config.routes;
|
|
12316
|
+
// Point the page's outlet class at this router. The Operations shell loads krubble globally while
|
|
12317
|
+
// an embedded app bundles its own copy, so the kr-router-outlet that won registration may belong
|
|
12318
|
+
// to the other copy; whichever it is, its outlets must register with the router that has routes.
|
|
12319
|
+
const outletClass = customElements.get('kr-router-outlet');
|
|
12320
|
+
if (outletClass) {
|
|
12321
|
+
outletClass.router = KRRouter;
|
|
12322
|
+
}
|
|
12315
12323
|
// Intercept <a> clicks for client-side navigation
|
|
12316
12324
|
window.addEventListener('click', (e) => {
|
|
12317
12325
|
const anchor = e.composedPath().find(el => el instanceof HTMLAnchorElement);
|
|
@@ -12716,7 +12724,7 @@
|
|
|
12716
12724
|
// Every matched route level's resolved data, merged into one object for the current navigation. This
|
|
12717
12725
|
// is set before anything mounts — see the merge in handleNavigation.
|
|
12718
12726
|
KRRouter.data = {};
|
|
12719
|
-
|
|
12727
|
+
class KRRouterOutlet extends i$3 {
|
|
12720
12728
|
constructor() {
|
|
12721
12729
|
super(...arguments);
|
|
12722
12730
|
this.level = -1;
|
|
@@ -12746,11 +12754,11 @@
|
|
|
12746
12754
|
}
|
|
12747
12755
|
}
|
|
12748
12756
|
this.level = level;
|
|
12749
|
-
|
|
12757
|
+
KRRouterOutlet.router.registerOutlet(this.level, this);
|
|
12750
12758
|
}
|
|
12751
12759
|
disconnectedCallback() {
|
|
12752
12760
|
super.disconnectedCallback();
|
|
12753
|
-
|
|
12761
|
+
KRRouterOutlet.router.unregisterOutlet(this.level, this);
|
|
12754
12762
|
}
|
|
12755
12763
|
activate(el) {
|
|
12756
12764
|
this.el = el;
|
|
@@ -12764,22 +12772,30 @@
|
|
|
12764
12772
|
}
|
|
12765
12773
|
return b `${this.el}`;
|
|
12766
12774
|
}
|
|
12767
|
-
}
|
|
12768
|
-
|
|
12775
|
+
}
|
|
12776
|
+
KRRouterOutlet.styles = i$6 `
|
|
12769
12777
|
:host {
|
|
12770
12778
|
display: block;
|
|
12771
12779
|
height: 100%;
|
|
12772
12780
|
}
|
|
12773
12781
|
`;
|
|
12782
|
+
// The router outlets register with. KRRouter.configure() sets this on whichever outlet class is
|
|
12783
|
+
// registered on the page, which may be another copy of krubble's; this copy's router is the default.
|
|
12784
|
+
KRRouterOutlet.router = KRRouter;
|
|
12774
12785
|
__decorate([
|
|
12775
12786
|
r()
|
|
12776
|
-
],
|
|
12777
|
-
|
|
12778
|
-
|
|
12779
|
-
|
|
12787
|
+
], KRRouterOutlet.prototype, "el", void 0);
|
|
12788
|
+
// Guarded registration: no-op if the tag is already defined, so a second copy of krubble on
|
|
12789
|
+
// the page (e.g. the Operations shell loads krubble globally while an embedded app bundled its
|
|
12790
|
+
// own copy) doesn't throw. First definition wins; KRRouter.configure() then points that class at
|
|
12791
|
+
// the configured router.
|
|
12792
|
+
if (!customElements.get('kr-router-outlet')) {
|
|
12793
|
+
customElements.define('kr-router-outlet', KRRouterOutlet);
|
|
12794
|
+
}
|
|
12780
12795
|
|
|
12781
12796
|
exports.Chatbot = KRChatbot;
|
|
12782
12797
|
exports.Router = KRRouter;
|
|
12798
|
+
exports.RouterOutlet = KRRouterOutlet;
|
|
12783
12799
|
exports.Scaffold = KRScaffold;
|
|
12784
12800
|
exports.ScreenDetail = KRScreenDetail;
|
|
12785
12801
|
exports.ScreenNav = KRScreenNav;
|