@hidemikimura/chit-ui 0.1.0
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/LICENSE +21 -0
- package/README.md +440 -0
- package/dist/chit-ui.iife.min.js +964 -0
- package/dist/chit-ui.iife.min.js.map +1 -0
- package/dist/chit-ui.min.js +964 -0
- package/dist/chit-ui.min.js.map +1 -0
- package/dist/types/bundle.d.ts +7 -0
- package/dist/types/chit-ui.d.ts +251 -0
- package/dist/types/controllers/breakpoint-controller.d.ts +29 -0
- package/dist/types/controllers/composer-controller.d.ts +54 -0
- package/dist/types/controllers/scroll-controller.d.ts +44 -0
- package/dist/types/controllers/state-controller.d.ts +61 -0
- package/dist/types/controllers/theme-controller.d.ts +47 -0
- package/dist/types/element.d.ts +1 -0
- package/dist/types/events.d.ts +28 -0
- package/dist/types/global.d.ts +25 -0
- package/dist/types/i18n/labels.d.ts +68 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/render/composer.d.ts +15 -0
- package/dist/types/render/content.d.ts +75 -0
- package/dist/types/render/launcher.d.ts +18 -0
- package/dist/types/render/message-list.d.ts +17 -0
- package/dist/types/render/message.d.ts +14 -0
- package/dist/types/render/panel.d.ts +10 -0
- package/dist/types/styles/adopted-sheet.d.ts +20 -0
- package/dist/types/styles/composer.css.d.ts +1 -0
- package/dist/types/styles/content.css.d.ts +9 -0
- package/dist/types/styles/host.css.d.ts +9 -0
- package/dist/types/styles/launcher.css.d.ts +1 -0
- package/dist/types/styles/message.css.d.ts +1 -0
- package/dist/types/styles/panel.css.d.ts +1 -0
- package/dist/types/theme/default-theme.d.ts +97 -0
- package/dist/types/theme/merge-theme.d.ts +33 -0
- package/dist/types/theme/theme-to-css.d.ts +24 -0
- package/dist/types/types.d.ts +268 -0
- package/package.json +71 -0
- package/src/bundle.js +11 -0
- package/src/chit-ui.js +548 -0
- package/src/controllers/breakpoint-controller.js +82 -0
- package/src/controllers/composer-controller.js +215 -0
- package/src/controllers/scroll-controller.js +252 -0
- package/src/controllers/state-controller.js +316 -0
- package/src/controllers/theme-controller.js +75 -0
- package/src/element.js +4 -0
- package/src/events.js +33 -0
- package/src/global.d.ts +25 -0
- package/src/i18n/labels.js +72 -0
- package/src/index.js +9 -0
- package/src/render/composer.js +72 -0
- package/src/render/content.js +211 -0
- package/src/render/launcher.js +64 -0
- package/src/render/message-list.js +67 -0
- package/src/render/message.js +82 -0
- package/src/render/panel.js +77 -0
- package/src/styles/adopted-sheet.js +72 -0
- package/src/styles/composer.css.js +108 -0
- package/src/styles/content.css.js +119 -0
- package/src/styles/host.css.js +160 -0
- package/src/styles/launcher.css.js +139 -0
- package/src/styles/message.css.js +192 -0
- package/src/styles/panel.css.js +126 -0
- package/src/theme/default-theme.js +111 -0
- package/src/theme/merge-theme.js +100 -0
- package/src/theme/theme-to-css.js +94 -0
- package/src/types.js +143 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chit-ui.min.js","sources":["../node_modules/@lit/reactive-element/css-tag.js","../node_modules/@lit/reactive-element/reactive-element.js","../node_modules/lit-html/lit-html.js","../node_modules/lit-element/lit-element.js","../node_modules/lit-html/directive.js","../node_modules/lit-html/directives/unsafe-html.js","../src/events.js","../src/controllers/state-controller.js","../src/controllers/breakpoint-controller.js","../src/theme/default-theme.js","../src/theme/merge-theme.js","../src/theme/theme-to-css.js","../src/styles/adopted-sheet.js","../src/controllers/theme-controller.js","../src/controllers/scroll-controller.js","../src/controllers/composer-controller.js","../src/render/content.js","../src/render/launcher.js","../node_modules/lit-html/directive-helpers.js","../node_modules/lit-html/directives/repeat.js","../src/render/message.js","../node_modules/lit-html/directives/live.js","../src/render/panel.js","../src/render/message-list.js","../src/render/composer.js","../src/i18n/labels.js","../src/styles/host.css.js","../src/styles/launcher.css.js","../src/styles/panel.css.js","../src/styles/message.css.js","../src/styles/content.css.js","../src/styles/composer.css.js","../src/chit-ui.js","../src/index.js","../node_modules/lit-html/directives/class-map.js","../node_modules/lit-html/directives/style-map.js"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap;class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s)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&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o.set(s,t))}return t}toString(){return this.cssText}}const r=t=>new n(\"string\"==typeof t?t:t+\"\",void 0,s),i=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(!0===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(o,t,s)},S=(s,o)=>{if(e)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement(\"style\"),n=t.litNonce;void 0!==n&&o.setAttribute(\"nonce\",n),o.textContent=e.cssText,s.appendChild(o)}},c=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e=\"\";for(const s of t.cssRules)e+=s.cssText;return r(e)})(t):t;export{n as CSSResult,S as adoptStyles,i as css,c as getCompatibleStyle,e as supportsAdoptingStyleSheets,r as unsafeCSS};\n//# sourceMappingURL=css-tag.js.map\n","import{getCompatibleStyle as t,adoptStyles as s}from\"./css-tag.js\";export{CSSResult,css,supportsAdoptingStyleSheets,unsafeCSS}from\"./css-tag.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const{is:i,defineProperty:e,getOwnPropertyDescriptor:h,getOwnPropertyNames:r,getOwnPropertySymbols:o,getPrototypeOf:n}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:\"\",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},f=(t,s)=>!i(t,s),b={attribute:!0,type:String,converter:u,reflect:!1,useDefault:!1,hasChanged:f};Symbol.metadata??=Symbol(\"metadata\"),a.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e(this.prototype,t,h)}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t}};return{get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d(\"elementProperties\")))return;const t=n(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(d(\"finalized\")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d(\"properties\"))){const t=this.properties,s=[...r(t),...o(t)];for(const i of s)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(t(s))}else void 0!==s&&i.push(t(s));return i}static _$Eu(t,s){const i=s.attribute;return!1===i?void 0:\"string\"==typeof i?i:\"string\"==typeof t?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return s(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h=\"function\"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null}}requestUpdate(t,s,i,e=!1,h){if(void 0!==t){const r=this.constructor;if(!1===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),!0!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),!0===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];!0!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e)}}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:\"open\"},y[d(\"elementProperties\")]=new Map,y[d(\"finalized\")]=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push(\"2.1.2\");export{y as ReactiveElement,s as adoptStyles,u as defaultConverter,t as getCompatibleStyle,f as notEqual};\n//# sourceMappingURL=reactive-element.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=globalThis,i=t=>t,s=t.trustedTypes,e=s?s.createPolicy(\"lit-html\",{createHTML:t=>t}):void 0,h=\"$lit$\",o=`lit$${Math.random().toFixed(9).slice(2)}$`,n=\"?\"+o,r=`<${n}>`,l=document,c=()=>l.createComment(\"\"),a=t=>null===t||\"object\"!=typeof t&&\"function\"!=typeof t,u=Array.isArray,d=t=>u(t)||\"function\"==typeof t?.[Symbol.iterator],f=\"[ \\t\\n\\f\\r]\",v=/<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g,_=/-->/g,m=/>/g,p=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),w=x(2),T=x(3),E=Symbol.for(\"lit-noChange\"),A=Symbol.for(\"lit-nothing\"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u(t)||!t.hasOwnProperty(\"raw\"))throw Error(\"invalid template strings array\");return void 0!==e?e.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?\"<svg>\":3===i?\"<math>\":\"\",c=v;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?\"!--\"===u[1]?c=_:void 0!==u[1]?c=m:void 0!==u[2]?(y.test(u[2])&&(n=RegExp(\"</\"+u[2],\"g\")),c=p):void 0!==u[3]&&(c=p):c===p?\">\"===u[0]?(c=n??v,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p:'\"'===u[3]?$:g):c===$||c===g?c=p:c===_||c===m?c=v:(c=p,n=void 0);const x=c===p&&t[i+1].startsWith(\"/>\")?\" \":\"\";l+=c===v?s+r:d>=0?(e.push(a),s.slice(0,d)+h+s.slice(d)+o+x):s+o+(-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)){const i=v[a++],s=r.getAttribute(t).split(o),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)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o),i=t.length-1;if(i>0){r.textContent=s?s.emptyScript:\"\";for(let s=0;s<i;s++)r.append(t[s],c()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c())}}}else if(8===r.nodeType)if(r.data===n)d.push({type:2,index:l});else{let t=-1;for(;-1!==(t=r.data.indexOf(o,t+1));)d.push({type:7,index:l}),t+=o.length-1}l++}}static createElement(t,i){const s=l.createElement(\"template\");return s.innerHTML=t,s}}function M(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?.(!1),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(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,!0);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??!0}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(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(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()),this.O(c()),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?.(!1,!0,s);t!==this._$AB;){const s=i(t).nextSibling;i(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=!1;if(void 0===h)t=M(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(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(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(this,t)}}const j={M:h,P:o,A:n,C:1,L:N,R,D:d,V:M,I:k,H,N:L,U:z,B:I,F:Z},B=t.litHtmlPolyfillSupport;B?.(S,k),(t.litHtmlVersions??=[]).push(\"3.3.3\");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(),t),t,void 0,s??{})}return h._$AI(t),h};export{j as _$LH,b as html,T as mathml,E as noChange,A as nothing,D as render,w as svg};\n//# sourceMappingURL=lit-html.js.map\n","import{ReactiveElement as t}from\"@lit/reactive-element\";export*from\"@lit/reactive-element\";import{render as e,noChange as r}from\"lit-html\";export*from\"lit-html\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const s=globalThis;class i extends t{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=e(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return r}}i._$litElement$=!0,i[\"finalized\"]=!0,s.litElementHydrateSupport?.({LitElement:i});const o=s.litElementPolyfillSupport;o?.({LitElement:i});const n={_$AK:(t,e,r)=>{t._$AK(e,r)},_$AL:t=>t._$AL};(s.litElementVersions??=[]).push(\"4.2.2\");export{i as LitElement,n as _$LE};\n//# sourceMappingURL=lit-element.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}export{i as Directive,t as PartType,e as directive};\n//# sourceMappingURL=directive.js.map\n","import{nothing as t,noChange as i}from\"../lit-html.js\";import{directive as r,Directive as s,PartType as n}from\"../directive.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */class e extends s{constructor(i){if(super(i),this.it=t,i.type!==n.CHILD)throw Error(this.constructor.directiveName+\"() can only be used in child bindings\")}render(r){if(r===t||null==r)return this._t=void 0,this.it=r;if(r===i)return r;if(\"string\"!=typeof r)throw Error(this.constructor.directiveName+\"() called with a non-string value\");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName=\"unsafeHTML\",e.resultType=1;const o=r(e);export{e as UnsafeHTMLDirective,o as unsafeHTML};\n//# sourceMappingURL=unsafe-html.js.map\n","// @ts-check\n\n/** Every event this library dispatches. Never write the string literals elsewhere. */\nexport const Events = Object.freeze({\n SUBMIT: 'chat-submit',\n BEFORE_OPEN: 'chat-before-open',\n OPEN: 'chat-open',\n BEFORE_CLOSE: 'chat-before-close',\n CLOSE: 'chat-close',\n HIDE: 'chat-hide',\n SHOW: 'chat-show',\n STATE_CHANGE: 'chat-state-change',\n INPUT: 'chat-input',\n MESSAGE_RENDER: 'chat-message-render',\n MESSAGE_CLICK: 'chat-message-click',\n SCROLL_TOP: 'chat-scroll-top',\n BREAKPOINT_CHANGE: 'chat-breakpoint-change',\n});\n\n/**\n * Dispatch a composed, bubbling CustomEvent from the host.\n *\n * @param {HTMLElement} host\n * @param {string} name\n * @param {unknown} detail\n * @param {{ cancelable?: boolean }} [options]\n * @returns {boolean} false when a listener called preventDefault().\n */\nexport function emit(host, name, detail, { cancelable = false } = {}) {\n return host.dispatchEvent(\n new CustomEvent(name, { detail, bubbles: true, composed: true, cancelable }),\n );\n}\n","// @ts-check\nimport { Events, emit } from '../events.js';\n\n/** @import { ReactiveController, LitElement } from 'lit' */\n/** @import { ChatState, Trigger, Effect } from '../types.js' */\n\n/**\n * @typedef {{ effect: Effect, duration: number }} AnimationSpec\n * @typedef {(from: ChatState, to: ChatState, phase: 'enter' | 'exit') => AnimationSpec} AnimationResolver\n *\n * @typedef {Object} StateControllerOptions\n * @property {AnimationResolver} animation Which effect and duration to play.\n * @property {() => boolean} keepsLauncher True when the launcher stays visible behind an open panel.\n * @property {() => void} onOpened Called once the panel is open and settled.\n */\n\n/** Which `part` carries the visible element of each state. */\nconst PART_FOR_STATE = /** @type {const} */ ({\n closed: 'launcher',\n open: 'panel',\n hidden: null,\n});\n\n/**\n * Owns everything about moving between closed / open / hidden.\n *\n * The host's `state` property changes the instant it is assigned; what the DOM\n * shows lags behind it for as long as the transition animation runs. That\n * lagging value is `renderedState`, and the render functions key off it — so a\n * panel animating out is still in the DOM while `state` already reads 'closed'.\n *\n * @implements {ReactiveController}\n */\nexport class StateController {\n /** @type {LitElement & { state: ChatState }} */\n #host;\n /** @type {AnimationResolver} */\n #resolveAnimation;\n /** @type {() => boolean} */\n #keepsLauncher;\n /** @type {() => void} */\n #onOpened;\n\n /** Logical state: the target of the most recent transition. */\n #current = /** @type {ChatState} */ ('closed');\n /** What the DOM is showing right now. */\n #rendered = /** @type {ChatState} */ ('closed');\n\n /** Guards the host's own `state` setter against re-entering us. */\n #applying = false;\n /** Bumped per transition so a superseded one can bail out after an await. */\n #generation = 0;\n /** @type {((settled: boolean) => void) | null} */\n #settle = null;\n /** @type {(() => void) | null} */\n #stopWaiting = null;\n /** @type {boolean} */\n #restoreFocusToLauncher = false;\n\n /**\n * @param {LitElement & { state: ChatState }} host\n * @param {StateControllerOptions} options\n */\n constructor(host, { animation, keepsLauncher, onOpened }) {\n this.#host = host;\n this.#resolveAnimation = animation;\n this.#keepsLauncher = keepsLauncher;\n this.#onOpened = onOpened;\n host.addController(this);\n }\n\n /** @returns {ChatState} What the DOM currently shows. */\n get renderedState() {\n return this.#rendered;\n }\n\n /** @returns {boolean} True while the host's own setter must not call us back. */\n get applying() {\n return this.#applying;\n }\n\n hostConnected() {\n this.#current = this.#host.state;\n this.#rendered = this.#host.state;\n this.#host.dataset.renderedState = this.#rendered;\n }\n\n hostDisconnected() {\n this.#stopWaiting?.();\n this.#stopWaiting = null;\n this.#settle?.(false);\n this.#settle = null;\n }\n\n hostUpdated() {\n this.#host.dataset.renderedState = this.#rendered;\n }\n\n /**\n * Move to `to`, running the before-event, the animations and the completion\n * events in order.\n *\n * @param {ChatState} to\n * @param {Trigger} trigger\n * @returns {Promise<boolean>} false when a listener cancelled it, or when a\n * later transition superseded this one.\n */\n request(to, trigger) {\n const from = this.#current;\n if (to === from) return Promise.resolve(true);\n\n if (!this.#announceIntent(from, to, trigger)) {\n this.#assign(from);\n return Promise.resolve(false);\n }\n\n // A transition already in flight loses: snap the DOM to where it was\n // heading, tell its caller it did not finish, and start over from there.\n this.#interrupt();\n\n this.#current = to;\n this.#assign(to);\n emit(this.#host, Events.STATE_CHANGE, { from, to, trigger });\n\n return this.#run(from, to, trigger);\n }\n\n /**\n * Fire the cancelable before-event for this transition, if it has one.\n *\n * @param {ChatState} from\n * @param {ChatState} to\n * @param {Trigger} trigger\n * @returns {boolean} false when a listener called preventDefault().\n */\n #announceIntent(from, to, trigger) {\n if (to === 'open') {\n return emit(this.#host, Events.BEFORE_OPEN, { from, trigger }, { cancelable: true });\n }\n if (to === 'closed' && from === 'open') {\n return emit(this.#host, Events.BEFORE_CLOSE, { from, trigger }, { cancelable: true });\n }\n return true;\n }\n\n #interrupt() {\n this.#generation += 1;\n this.#stopWaiting?.();\n this.#stopWaiting = null;\n this.#settle?.(false);\n this.#settle = null;\n if (this.#rendered !== this.#current) {\n this.#rendered = this.#current;\n this.#host.requestUpdate();\n }\n }\n\n /**\n * @param {ChatState} from\n * @param {ChatState} to\n * @param {Trigger} trigger\n * @returns {Promise<boolean>}\n */\n #run(from, to, trigger) {\n const generation = this.#generation;\n /** @type {Promise<boolean>} */\n const settled = new Promise((resolve) => {\n this.#settle = resolve;\n });\n\n void (async () => {\n this.#restoreFocusToLauncher = this.#focusIsInsidePanel();\n await this.#host.updateComplete;\n if (generation !== this.#generation) return;\n\n const leaving = this.#elementFor(from);\n if (leaving && !this.#launcherSurvives(from, to)) {\n await this.#animate(leaving, 'exit', this.#resolveAnimation(from, to, 'exit'));\n if (generation !== this.#generation) return;\n }\n\n this.#rendered = to;\n this.#host.requestUpdate();\n await this.#host.updateComplete;\n if (generation !== this.#generation) return;\n\n const arriving = this.#elementFor(to);\n if (arriving) {\n await this.#animate(arriving, 'enter', this.#resolveAnimation(from, to, 'enter'));\n if (generation !== this.#generation) return;\n }\n\n this.#announceArrival(from, to, trigger);\n this.#manageFocus(to);\n\n this.#settle?.(true);\n this.#settle = null;\n })();\n\n return settled;\n }\n\n /**\n * Whether the element of `from` survives the transition and so must not play\n * an exit animation. Only the launcher can, and only when the theme asks to\n * keep it visible behind an open panel.\n *\n * @param {ChatState} from\n * @param {ChatState} to\n * @returns {boolean}\n */\n #launcherSurvives(from, to) {\n return from === 'closed' && to === 'open' && this.#keepsLauncher();\n }\n\n /**\n * @param {ChatState} from\n * @param {ChatState} to\n * @param {Trigger} trigger\n */\n #announceArrival(from, to, trigger) {\n if (from === 'hidden') emit(this.#host, Events.SHOW, { from, to });\n if (to === 'hidden') {\n emit(this.#host, Events.HIDE, { from, to });\n return;\n }\n if (to === 'open') emit(this.#host, Events.OPEN, { from, trigger });\n else if (to === 'closed' && from === 'open') emit(this.#host, Events.CLOSE, { from, trigger });\n }\n\n /** @param {ChatState} to */\n #manageFocus(to) {\n if (to === 'open') {\n this.#onOpened();\n return;\n }\n if (to === 'closed' && this.#restoreFocusToLauncher) {\n this.#elementFor('closed')?.focus();\n }\n this.#restoreFocusToLauncher = false;\n }\n\n #focusIsInsidePanel() {\n const active = this.#host.renderRoot instanceof ShadowRoot\n ? this.#host.renderRoot.activeElement\n : null;\n const panel = this.#elementFor('open');\n return !!(active && panel && (active === panel || panel.contains(active)));\n }\n\n /**\n * @param {ChatState} state\n * @returns {HTMLElement | null}\n */\n #elementFor(state) {\n const part = PART_FOR_STATE[state];\n if (!part) return null;\n return /** @type {HTMLElement | null} */ (\n this.#host.renderRoot.querySelector(`[part~=\"${part}\"]`)\n );\n }\n\n /**\n * Assign the host's `state` without the setter calling us back.\n *\n * @param {ChatState} state\n */\n #assign(state) {\n if (this.#host.state === state) return;\n this.#applying = true;\n this.#host.state = state;\n this.#applying = false;\n }\n\n /**\n * Play one CSS animation and resolve when it ends. Resolves immediately when\n * there is nothing to play; falls back to a timer in case `animationend`\n * never arrives (a backgrounded tab, a display:none ancestor).\n *\n * @param {HTMLElement} element\n * @param {'enter' | 'exit'} phase\n * @param {AnimationSpec} spec\n * @returns {Promise<void>}\n */\n #animate(element, phase, spec) {\n const { effect, duration } = spec;\n const skip =\n effect === 'none' ||\n duration <= 0 ||\n window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n if (skip) return Promise.resolve();\n\n return new Promise((resolve) => {\n let finished = false;\n /** @param {Event} [event] */\n const finish = (event) => {\n if (event && event.target !== element) return;\n if (finished) return;\n finished = true;\n clearTimeout(timer);\n element.removeEventListener('animationend', finish);\n element.removeAttribute('data-anim');\n element.style.removeProperty('--_chit-anim-duration');\n if (this.#stopWaiting === finish) this.#stopWaiting = null;\n resolve();\n };\n\n element.dataset.effect = effect;\n element.dataset.anim = phase;\n element.style.setProperty('--_chit-anim-duration', `${duration}ms`);\n element.addEventListener('animationend', finish);\n const timer = setTimeout(finish, duration + 50);\n this.#stopWaiting = finish;\n });\n }\n}\n","// @ts-check\nimport { Events, emit } from '../events.js';\n\n/** @import { ReactiveController, LitElement } from 'lit' */\n/** @import { Device } from '../types.js' */\n\n/**\n * Tracks whether the viewport is narrow enough to count as a phone.\n *\n * Uses matchMedia rather than a resize listener: it only fires when the\n * boundary is actually crossed, so nothing runs while the user drags a window\n * around inside one bucket.\n *\n * @implements {ReactiveController}\n */\nexport class BreakpointController {\n /** @type {LitElement} */\n #host;\n /** @type {MediaQueryList | null} */\n #query = null;\n /** @type {number} */\n #breakpoint = 0;\n /** @type {Device} */\n #device = 'pc';\n /** Set once the first measurement is in, so start-up is not a \"change\". */\n #measured = false;\n\n /** @param {LitElement} host */\n constructor(host) {\n this.#host = host;\n host.addController(this);\n }\n\n /** @returns {Device} */\n get device() {\n return this.#device;\n }\n\n hostDisconnected() {\n this.#query?.removeEventListener('change', this.#onChange);\n this.#query = null;\n }\n\n /**\n * Point the controller at a breakpoint. Safe to call on every update; the\n * media query is only rebuilt when the value actually changes.\n *\n * @param {number} breakpoint\n */\n observe(breakpoint) {\n if (breakpoint === this.#breakpoint && this.#query) return;\n this.#breakpoint = breakpoint;\n this.#query?.removeEventListener('change', this.#onChange);\n this.#query = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);\n this.#query.addEventListener('change', this.#onChange);\n this.#apply(this.#query.matches ? 'mobile' : 'pc');\n }\n\n /** @param {MediaQueryListEvent} event */\n #onChange = (event) => {\n this.#apply(event.matches ? 'mobile' : 'pc');\n };\n\n /**\n * Record the device and announce it, unless this is the first measurement —\n * start-up is not a change. A later flip is announced whether it came from\n * the viewport resizing or from the theme moving the breakpoint, because\n * either way the answer a consumer asked for is now different.\n *\n * @param {Device} device\n */\n #apply(device) {\n if (device === this.#device && this.#host.dataset.device) return;\n\n this.#device = device;\n this.#host.dataset.device = device;\n this.#host.requestUpdate();\n\n if (this.#measured) emit(this.#host, Events.BREAKPOINT_CHANGE, { device });\n this.#measured = true;\n }\n}\n","// @ts-check\n\n/** @import { ResolvedClosed } from '../types.js' */\n\n/**\n * Neutral light palette. Every text/background pair here clears WCAG AA\n * (4.5:1); `test/theme.test.js` re-checks the ratios so a future tweak cannot\n * quietly drop below it.\n */\nconst PALETTE = {\n accent: '#2563eb',\n ink: '#1f2328',\n muted: '#5c6370',\n surface: '#ffffff',\n raised: '#f1f3f5',\n line: '#e4e4e7',\n onAccent: '#ffffff',\n};\n\n/** @type {ResolvedClosed} */\nconst CLOSED_PC = {\n size: 60,\n position: 'bottom-right',\n offset: { x: 24, y: 24 },\n radius: 30,\n image: null,\n label: null,\n component: null,\n props: {},\n colors: {\n background: PALETTE.accent,\n text: PALETTE.onAccent,\n shadow: '0 4px 12px rgba(0, 0, 0, 0.2)',\n },\n animation: { enter: 'scale', exit: 'scale', duration: 200, idle: 'none' },\n};\n\n/**\n * What a phone gets when the theme does not say. Only the measurements differ:\n * a thumb needs a slightly smaller target closer to the screen edge.\n *\n * @type {Partial<ResolvedClosed>}\n */\nconst CLOSED_MOBILE_DIFF = {\n size: 56,\n offset: { x: 16, y: 16 },\n radius: 28,\n};\n\n/**\n * The library's own theme. A user theme is merged over this, so everything\n * here is what you get when the user says nothing at all.\n *\n * `closed` carries both device buckets; `mergeTheme` narrows it to one.\n */\nexport const defaultTheme = {\n breakpoint: 768,\n zIndex: 2147483000,\n font: {\n family:\n \"system-ui, -apple-system, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif\",\n size: 14,\n },\n closed: {\n pc: CLOSED_PC,\n mobile: /** @type {ResolvedClosed} */ ({ ...CLOSED_PC, ...CLOSED_MOBILE_DIFF }),\n },\n open: {\n width: 380,\n height: 600,\n position: /** @type {const} */ ('bottom-right'),\n offset: { x: 24, y: 24 },\n radius: 16,\n launcher: /** @type {const} */ ('hidden'),\n header: { title: null, logo: null, avatar: null },\n background: { image: null },\n colors: {\n background: PALETTE.surface,\n text: PALETTE.ink,\n accent: PALETTE.accent,\n border: PALETTE.line,\n shadow: '0 8px 32px rgba(0, 0, 0, 0.24)',\n headerBackground: PALETTE.surface,\n headerText: PALETTE.ink,\n userBubble: PALETTE.accent,\n userText: PALETTE.onAccent,\n assistantBubble: PALETTE.raised,\n assistantText: PALETTE.ink,\n systemText: PALETTE.muted,\n inputBackground: PALETTE.surface,\n inputText: PALETTE.ink,\n inputPlaceholder: PALETTE.muted,\n },\n animation: {\n enter: /** @type {const} */ ('scale'),\n exit: /** @type {const} */ ('fade'),\n duration: 150,\n // How the conversation follows a new message. Growth within a message\n // (a streamed reply, an image loading) is always instant; see\n // ScrollController for why.\n scroll: /** @type {const} */ ('smooth'),\n },\n input: { maxRows: 5, placeholder: null },\n },\n hidden: {\n animation: { exit: /** @type {const} */ ('fade'), duration: 150 },\n },\n};\n\n/** The measurements a phone falls back to when only `closed.pc` was given. */\nexport const mobileClosedDefaults = CLOSED_MOBILE_DIFF;\n","// @ts-check\nimport { defaultTheme, mobileClosedDefaults } from './default-theme.js';\n\n/** @import { Theme, ClosedTheme, Device, ResolvedTheme } from '../types.js' */\n\n/**\n * @param {unknown} value\n * @returns {value is Record<string, unknown>}\n */\nfunction isPlainObject(value) {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Merge `override` onto `base`, recursing into plain objects.\n *\n * `undefined` means \"say nothing\" and leaves the base value alone; `null` means\n * \"clear it\", so `{ image: null }` removes a default icon rather than being\n * ignored. There are no arrays anywhere in a theme, so a plain recursive merge\n * is enough.\n *\n * @template {Record<string, any>} T\n * @param {T} base\n * @param {Record<string, any> | undefined} override\n * @returns {T}\n */\nexport function mergeTheme(base, override) {\n if (!isPlainObject(override)) return base;\n\n /** @type {Record<string, any>} */\n const out = { ...base };\n for (const [key, value] of Object.entries(override)) {\n if (value === undefined) continue;\n const current = out[key];\n out[key] = isPlainObject(value) && isPlainObject(current) ? mergeTheme(current, value) : value;\n }\n return /** @type {T} */ (out);\n}\n\n/**\n * Decide which `closed` settings this device gets.\n *\n * Three shapes are allowed, and this is where they collapse into one:\n * no pc/mobile keys at all (the same settings serve both), both given, or only\n * one given. When only `pc` is given the phone inherits it but keeps the\n * default phone measurements, so a custom icon carries over without a\n * desktop-sized button landing on a phone.\n *\n * @param {ClosedTheme | { pc?: ClosedTheme, mobile?: ClosedTheme } | undefined} closed\n * @param {Device} device\n * @returns {ClosedTheme}\n */\nfunction resolveClosed(closed, device) {\n const perDevice = /** @type {{ pc?: ClosedTheme, mobile?: ClosedTheme }} */ (closed ?? {});\n const split = 'pc' in perDevice || 'mobile' in perDevice;\n\n if (!split) {\n const shared = /** @type {ClosedTheme} */ (closed ?? {});\n return mergeTheme(defaultTheme.closed[device], shared);\n }\n\n const pc = mergeTheme(defaultTheme.closed.pc, perDevice.pc);\n if (device === 'pc') return pc;\n\n if (perDevice.mobile) return mergeTheme(defaultTheme.closed.mobile, perDevice.mobile);\n return mergeTheme(pc, mobileClosedDefaults);\n}\n\n/**\n * Fill every gap in a user theme and narrow it to one device.\n *\n * @param {Theme | undefined} theme\n * @param {Device} device\n * @returns {ResolvedTheme}\n */\nexport function resolveTheme(theme, device) {\n const user = theme ?? {};\n const closed = resolveClosed(user.closed, device);\n\n return /** @type {ResolvedTheme} */ ({\n breakpoint: user.breakpoint ?? defaultTheme.breakpoint,\n zIndex: user.zIndex ?? defaultTheme.zIndex,\n font: mergeTheme(defaultTheme.font, user.font),\n closed: mergeTheme(defaultTheme.closed[device], closed),\n open: mergeTheme(defaultTheme.open, user.open),\n hidden: mergeTheme(defaultTheme.hidden, user.hidden),\n device,\n });\n}\n\n/**\n * The breakpoint a theme asks for, readable before the full resolve (the\n * device is not known until the breakpoint is).\n *\n * @param {Theme | undefined} theme\n * @returns {number}\n */\nexport function breakpointOf(theme) {\n return theme?.breakpoint ?? defaultTheme.breakpoint;\n}\n","// @ts-check\n\n/** @import { ResolvedTheme } from '../types.js' */\n\n/**\n * @param {number} value\n * @returns {string}\n */\nconst px = (value) => `${value}px`;\n\n/**\n * A CSS `url()` for an image, or `none`. Quotes and backslashes are escaped so\n * a filename with an apostrophe cannot break out of the declaration.\n *\n * @param {string | null | undefined} value\n * @returns {string}\n */\nfunction url(value) {\n if (!value) return 'none';\n return `url(\"${value.replace(/[\\\\\"]/g, '\\\\$&')}\")`;\n}\n\n/**\n * Turn a resolved theme into the custom properties the stylesheets read.\n *\n * Only values CSS can act on are here. Positions, animation effects, text and\n * images that belong in markup are applied as attributes or drawn by the\n * render functions instead.\n *\n * Animation durations are deliberately absent: the transition code has to know\n * when an animation ends, so the theme is the single source of truth for them\n * and it writes the duration onto the element as it starts. A custom property\n * here would look like a knob that does nothing.\n *\n * @param {ResolvedTheme} theme\n * @returns {Record<string, string>}\n */\nexport function themeToVariables(theme) {\n const { closed, open } = theme;\n const c = open.colors;\n\n return {\n '--chit-z-index': String(theme.zIndex),\n '--chit-font-family': theme.font.family,\n '--chit-font-size': px(theme.font.size),\n\n '--chit-launcher-size': closed.size === 'auto' ? 'auto' : px(closed.size),\n '--chit-launcher-offset-x': px(closed.offset.x),\n '--chit-launcher-offset-y': px(closed.offset.y),\n '--chit-launcher-radius': px(closed.radius),\n '--chit-launcher-image': url(closed.image),\n '--chit-launcher-bg': closed.colors.background,\n '--chit-launcher-text': closed.colors.text,\n '--chit-launcher-shadow': closed.colors.shadow,\n\n '--chit-panel-width': px(open.width),\n '--chit-panel-height': px(open.height),\n '--chit-panel-offset-x': px(open.offset.x),\n '--chit-panel-offset-y': px(open.offset.y),\n '--chit-panel-radius': px(open.radius),\n '--chit-panel-bg-image': url(open.background.image),\n '--chit-panel-shadow': c.shadow,\n\n '--chit-color-bg': c.background,\n '--chit-color-text': c.text,\n '--chit-color-accent': c.accent,\n '--chit-color-border': c.border,\n '--chit-color-header-bg': c.headerBackground,\n '--chit-color-header-text': c.headerText,\n '--chit-color-user-bg': c.userBubble,\n '--chit-color-user-text': c.userText,\n '--chit-color-assistant-bg': c.assistantBubble,\n '--chit-color-assistant-text': c.assistantText,\n '--chit-color-system-text': c.systemText,\n '--chit-color-input-bg': c.inputBackground,\n '--chit-color-input-text': c.inputText,\n '--chit-color-input-placeholder': c.inputPlaceholder,\n\n '--_chit-input-max-rows': String(open.input.maxRows),\n };\n}\n\n/**\n * The stylesheet text for a resolved theme.\n *\n * @param {ResolvedTheme} theme\n * @returns {string}\n */\nexport function themeToCss(theme) {\n const declarations = Object.entries(themeToVariables(theme))\n .map(([name, value]) => ` ${name}: ${value};`)\n .join('\\n');\n return `:host {\\n${declarations}\\n}\\n`;\n}\n","// @ts-check\n\n/**\n * Constructable stylesheets landed in Safari 16.4 and we support 16, so the\n * same fallback Lit uses applies here: a <style> element in the shadow root.\n */\nconst SUPPORTS_ADOPTING =\n typeof ShadowRoot !== 'undefined' &&\n 'adoptedStyleSheets' in Document.prototype &&\n 'replaceSync' in CSSStyleSheet.prototype;\n\n/**\n * A stylesheet the component owns and rewrites at runtime, appended after the\n * component's static styles so its declarations win over them.\n */\nexport class AdoptedSheet {\n /** @type {CSSStyleSheet | null} */\n #sheet = null;\n /** @type {HTMLStyleElement | null} */\n #element = null;\n /** @type {string} */\n #written = '';\n /** @type {string} */\n #marker;\n\n /** @param {string} marker Identifies the sheet in the DOM when the fallback is used. */\n constructor(marker) {\n this.#marker = marker;\n }\n\n /** @param {ShadowRoot | HTMLElement | DocumentFragment} root */\n attach(root) {\n if (!(root instanceof ShadowRoot)) return;\n\n if (SUPPORTS_ADOPTING) {\n if (!this.#sheet) this.#sheet = new CSSStyleSheet();\n if (!root.adoptedStyleSheets.includes(this.#sheet)) {\n root.adoptedStyleSheets = [...root.adoptedStyleSheets, this.#sheet];\n }\n return;\n }\n\n if (!this.#element) {\n this.#element = document.createElement('style');\n this.#element.setAttribute(this.#marker, '');\n }\n if (this.#element.parentNode !== root) root.append(this.#element);\n }\n\n /**\n * Replace the sheet's contents. Cheap to call on every update: identical CSS\n * is ignored.\n *\n * @param {string} css\n * @param {ShadowRoot | HTMLElement | DocumentFragment} root\n */\n write(css, root) {\n if (css === this.#written) return;\n this.attach(root);\n\n if (this.#sheet) this.#sheet.replaceSync(css);\n else if (this.#element) this.#element.textContent = css;\n else return;\n\n this.#written = css;\n }\n\n detach() {\n this.#element?.remove();\n this.#element = null;\n }\n}\n","// @ts-check\nimport { resolveTheme, breakpointOf } from '../theme/merge-theme.js';\nimport { themeToCss } from '../theme/theme-to-css.js';\nimport { AdoptedSheet } from '../styles/adopted-sheet.js';\n\n/** @import { ReactiveController, LitElement } from 'lit' */\n/** @import { Theme, ResolvedTheme, Device } from '../types.js' */\n\n/**\n * Turns the `theme` property into the custom properties everything else reads.\n *\n * The generated sheet is adopted *after* the component's own stylesheets, so a\n * theme value beats the fallback declared alongside the rules that use it.\n * Page CSS still wins over both: a `chit-ui { --chit-color-accent: ... }` rule\n * lives in the outer tree, and the outer tree takes precedence over `:host`.\n *\n * @implements {ReactiveController}\n */\nexport class ThemeController {\n /** @type {LitElement} */\n #host;\n /** @type {AdoptedSheet} */\n #sheet = new AdoptedSheet('data-chit-theme');\n /** @type {ResolvedTheme} */\n #resolved;\n\n /**\n * @param {LitElement} host\n * @param {{ device: () => Device }} options\n */\n constructor(host, { device }) {\n this.#host = host;\n this.#resolved = resolveTheme(undefined, device());\n }\n\n /** @returns {ResolvedTheme} The theme in force, defaults filled in. */\n get current() {\n return this.#resolved;\n }\n\n hostConnected() {\n this.#write();\n }\n\n hostDisconnected() {\n this.#sheet.detach();\n }\n\n /**\n * The breakpoint a theme asks for. Needed before `apply`, because the device\n * cannot be decided until the breakpoint is known.\n *\n * @param {Theme | undefined} theme\n * @returns {number}\n */\n static breakpointOf(theme) {\n return breakpointOf(theme);\n }\n\n /**\n * Re-resolve for the current theme and device. Cheap to call on every update:\n * the stylesheet is only rewritten when the generated text actually changes.\n *\n * @param {Theme | undefined} theme\n * @param {Device} device\n */\n apply(theme, device) {\n this.#resolved = resolveTheme(theme, device);\n this.#write();\n }\n\n #write() {\n this.#sheet.write(themeToCss(this.#resolved), this.#host.renderRoot);\n }\n}\n","// @ts-check\nimport { Events, emit } from '../events.js';\n\n/** @import { ReactiveController, LitElement } from 'lit' */\n/** @import { Message } from '../types.js' */\n\n/** How close to the end still counts as \"at the bottom\", in pixels. */\nconst BOTTOM_SLACK = 24;\n\n/**\n * How long to keep treating the viewport as \"ours\" after starting a smooth\n * scroll, when the browser has no scrollend event to tell us it finished.\n */\nconst SMOOTH_GRACE_MS = 700;\n\n/**\n * Keeps the conversation pinned to the newest message while the reader is at\n * the bottom, and gets out of the way the moment they scroll up.\n *\n * Two things follow from that rule. A reply arriving while the reader is up in\n * the history must not yank them down — it raises the \"jump to latest\" button\n * instead. And their own message always scrolls into view, because they just\n * pressed send and expect to see it.\n *\n * @implements {ReactiveController}\n */\nexport class ScrollController {\n /** @type {LitElement & { messages: Message[] }} */\n #host;\n /** @type {() => 'smooth' | 'instant'} */\n #preferredBehavior;\n /** @type {HTMLElement | null} */\n #viewport = null;\n /** @type {ResizeObserver | null} */\n #resize = null;\n\n #atBottom = true;\n #hasUnseen = false;\n #atTop = false;\n #followAfterRender = true;\n\n /**\n * True while a scroll we started is still animating. Scroll events during\n * that window report positions we caused, not where the reader went.\n */\n #selfScrolling = false;\n /** @type {ReturnType<typeof setTimeout> | undefined} */\n #selfScrollTimer;\n /** The first jump after the panel opens has nothing to animate from. */\n #openingJump = true;\n\n /** @type {string | undefined} */\n #lastId;\n #lastCount = 0;\n\n /**\n * @param {LitElement & { messages: Message[] }} host\n * @param {{ behavior: () => 'smooth' | 'instant' }} options\n */\n constructor(host, { behavior }) {\n this.#host = host;\n this.#preferredBehavior = behavior;\n host.addController(this);\n }\n\n /** @returns {boolean} True when newer content arrived while scrolled up. */\n get hasUnseen() {\n return this.#hasUnseen;\n }\n\n /** @returns {boolean} */\n get atBottom() {\n return this.#atBottom;\n }\n\n hostDisconnected() {\n this.#unbind();\n clearTimeout(this.#selfScrollTimer);\n }\n\n /**\n * Runs before the render, so a decision made here lands in the same frame.\n * Whether the conversation grew is knowable from the array alone; only the\n * scrolling itself has to wait for the DOM.\n */\n hostUpdate() {\n const messages = this.#host.messages;\n const last = messages[messages.length - 1];\n const grew = messages.length > this.#lastCount;\n const newTail = last?.id !== this.#lastId;\n\n this.#lastId = last?.id;\n this.#lastCount = messages.length;\n\n if (!grew && !newTail) return;\n\n // Their own message always scrolls into view: they just pressed send.\n if (this.#atBottom || last?.role === 'user') this.#followAfterRender = true;\n else this.#hasUnseen = true;\n }\n\n hostUpdated() {\n const viewport = /** @type {HTMLElement | null} */ (\n this.#host.renderRoot.querySelector('[part~=\"messages\"]')\n );\n\n if (viewport !== this.#viewport) {\n this.#unbind();\n this.#viewport = viewport;\n this.#bind();\n // A freshly opened panel starts at the newest message, with no animation\n // to watch: there was nothing on screen to move away from.\n if (viewport) {\n this.#atBottom = true;\n this.#hasUnseen = false;\n this.#followAfterRender = true;\n this.#openingJump = true;\n }\n }\n\n if (this.#followAfterRender) {\n const behavior = this.#followBehavior;\n this.#followAfterRender = false;\n this.#scrollNow({ behavior });\n }\n }\n\n #bind() {\n if (!this.#viewport) return;\n this.#viewport.addEventListener('scroll', this.#onScroll, { passive: true });\n // Precise end-of-scroll where it exists (Chrome 114, Firefox 109,\n // Safari 17.4); the timer below covers the rest.\n this.#viewport.addEventListener('scrollend', this.#onScrollEnd);\n\n // Images finishing and streamed text growing both change the height\n // without a scroll event, so the follow has to react to size too.\n const inner = this.#viewport.firstElementChild;\n if (inner && typeof ResizeObserver !== 'undefined') {\n this.#resize = new ResizeObserver(() => {\n if (!this.#atBottom) return;\n // Content settling (an image loading, a tall block laying out) right\n // after a message arrived must not cut the follow short, so while our\n // own animation is running it is re-aimed rather than replaced. With\n // nothing in flight this is a streamed reply growing, and that is\n // followed instantly: an animation restarted every few tens of\n // milliseconds never lands.\n this.#scrollNow({ behavior: this.#selfScrolling ? 'smooth' : 'instant' });\n });\n this.#resize.observe(inner);\n }\n }\n\n #unbind() {\n this.#viewport?.removeEventListener('scroll', this.#onScroll);\n this.#viewport?.removeEventListener('scrollend', this.#onScrollEnd);\n this.#resize?.disconnect();\n this.#resize = null;\n this.#viewport = null;\n }\n\n #onScrollEnd = () => {\n this.#endSelfScroll();\n };\n\n #onScroll = () => {\n const viewport = this.#viewport;\n if (!viewport) return;\n\n const distance = viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight;\n const atBottom = distance <= BOTTOM_SLACK;\n\n // Our own animation passing through the middle of the list is not the\n // reader scrolling up.\n if (this.#selfScrolling) {\n if (atBottom) this.#endSelfScroll();\n return;\n }\n\n if (atBottom !== this.#atBottom) {\n this.#atBottom = atBottom;\n if (atBottom && this.#hasUnseen) {\n this.#hasUnseen = false;\n this.#host.requestUpdate();\n }\n }\n\n // One event per visit to the top, so a consumer loading older messages is\n // not asked again while the reader sits there.\n const atTop = viewport.scrollTop <= 0;\n if (atTop && !this.#atTop) emit(this.#host, Events.SCROLL_TOP, {});\n this.#atTop = atTop;\n };\n\n /**\n * @param {{ smooth?: boolean }} [options] Defaults to the theme's setting.\n */\n scrollToBottom({ smooth } = {}) {\n const behavior =\n smooth === undefined ? this.#followBehavior : smooth ? 'smooth' : 'instant';\n this.#scrollNow({ behavior });\n\n if (this.#hasUnseen) {\n this.#hasUnseen = false;\n this.#host.requestUpdate();\n }\n }\n\n /**\n * What the next follow should look like: the theme's choice, unless the\n * reader asked for less motion, or this is the jump that happens as the\n * panel opens.\n *\n * @returns {'smooth' | 'instant'}\n */\n get #followBehavior() {\n if (this.#openingJump) return 'instant';\n if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return 'instant';\n return this.#preferredBehavior();\n }\n\n /** @param {{ behavior?: 'smooth' | 'instant' }} [options] */\n #scrollNow({ behavior = 'instant' } = {}) {\n const viewport = this.#viewport;\n if (!viewport) return;\n\n this.#openingJump = false;\n if (behavior === 'smooth') this.#beginSelfScroll();\n\n viewport.scrollTo({ top: viewport.scrollHeight, behavior });\n this.#atBottom = true;\n this.#atTop = false;\n this.#hasUnseen = false;\n }\n\n #beginSelfScroll() {\n this.#selfScrolling = true;\n clearTimeout(this.#selfScrollTimer);\n this.#selfScrollTimer = setTimeout(() => this.#endSelfScroll(), SMOOTH_GRACE_MS);\n }\n\n #endSelfScroll() {\n if (!this.#selfScrolling) return;\n this.#selfScrolling = false;\n clearTimeout(this.#selfScrollTimer);\n\n // Take a reading now that the viewport has settled.\n const viewport = this.#viewport;\n if (!viewport) return;\n const distance = viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight;\n this.#atBottom = distance <= BOTTOM_SLACK;\n }\n}\n","// @ts-check\nimport { Events, emit } from '../events.js';\n\n/** @import { ReactiveController, LitElement } from 'lit' */\n\n/** Browsers that size a textarea to its content need no JS help. */\nconst SUPPORTS_FIELD_SIZING =\n typeof CSS !== 'undefined' && CSS.supports?.('field-sizing', 'content');\n\n/**\n * Owns the composer: what has been typed, whether an IME is mid-composition,\n * and when a keystroke counts as \"send\".\n *\n * The typed text is deliberately not a reactive property. A keystroke would\n * otherwise re-render the whole shadow tree, `repeat` over every message\n * included; instead the two things that depend on it — the send button's\n * enabled state and the character counter — are updated in place.\n *\n * @implements {ReactiveController}\n */\nexport class ComposerController {\n /** @type {LitElement & ComposerHost} */\n #host;\n\n #value = '';\n\n /** True between compositionstart and compositionend. */\n #composing = false;\n\n /**\n * True for one turn of the event loop after a composition ends.\n *\n * WebKit dispatches the Enter that confirmed an IME candidate as a plain\n * keydown *after* compositionend, with `isComposing` already false — so\n * without this flag, confirming a Japanese candidate would send the message.\n */\n #justComposed = false;\n\n /** @type {ReturnType<typeof setTimeout> | undefined} */\n #composedTimer;\n\n /** @param {LitElement & ComposerHost} host */\n constructor(host) {\n this.#host = host;\n host.addController(this);\n }\n\n /** @returns {string} */\n get value() {\n return this.#value;\n }\n\n set value(next) {\n this.#value = next ?? '';\n const input = this.#input;\n if (input && input.value !== this.#value) input.value = this.#value;\n this.#grow();\n this.#syncDerived();\n }\n\n /** @returns {boolean} True while an IME candidate window is open. */\n get composing() {\n return this.#composing;\n }\n\n /** @returns {number} Characters typed, counted by code point. */\n get length() {\n return Array.from(this.#value).length;\n }\n\n /** @returns {boolean} Whether the current text could be sent right now. */\n get canSend() {\n if (this.#host.busy || this.#host.inputDisabled) return false;\n if (this.#value.trim() === '') return false;\n const limit = this.#host.maxLength;\n return limit === undefined || this.length <= limit;\n }\n\n hostDisconnected() {\n clearTimeout(this.#composedTimer);\n }\n\n hostUpdated() {\n const input = this.#input;\n if (input && input.value !== this.#value) input.value = this.#value;\n this.#grow();\n this.#syncDerived();\n }\n\n /** @returns {HTMLTextAreaElement | null} */\n get #input() {\n return /** @type {HTMLTextAreaElement | null} */ (\n this.#host.renderRoot.querySelector('[part~=\"input\"]')\n );\n }\n\n /** @param {Event} event */\n onInput(event) {\n this.#value = /** @type {HTMLTextAreaElement} */ (event.target).value;\n this.#grow();\n this.#syncDerived();\n emit(this.#host, Events.INPUT, { value: this.#value });\n }\n\n onCompositionStart() {\n this.#composing = true;\n }\n\n onCompositionEnd() {\n this.#composing = false;\n this.#justComposed = true;\n clearTimeout(this.#composedTimer);\n this.#composedTimer = setTimeout(() => {\n this.#justComposed = false;\n }, 0);\n }\n\n /** @param {KeyboardEvent} event */\n onKeydown(event) {\n if (event.key !== 'Enter') return;\n if (!this.#host.sendOnEnter) return;\n // Shift+Enter is a newline; the others are the browser's or the page's.\n if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return;\n\n // Chrome, Edge and Firefox mark the confirming Enter on the event itself.\n // Older engines only set keyCode 229.\n if (event.isComposing || event.keyCode === 229) return;\n // Safari's post-compositionend Enter, and Android soft keyboards that send\n // Enter while a composition is still open.\n if (this.#composing || this.#justComposed) return;\n\n event.preventDefault();\n this.submit();\n }\n\n /**\n * Hand the text to the consumer and clear the box.\n *\n * The text is passed as typed: leading and trailing newlines are theirs to\n * keep or strip, since only they know whether the message is prose or code.\n *\n * @param {string} [text] Defaults to what is in the box.\n * @returns {boolean} False when there was nothing to send.\n */\n submit(text) {\n const value = text ?? this.#value;\n if (text === undefined && !this.canSend) return false;\n if (text !== undefined && (this.#host.busy || this.#host.inputDisabled)) return false;\n if (value.trim() === '') return false;\n\n const allowed = emit(this.#host, Events.SUBMIT, { text: value }, { cancelable: true });\n if (!allowed) return false;\n\n this.clear();\n return true;\n }\n\n clear() {\n this.value = '';\n this.focus();\n }\n\n focus() {\n this.#input?.focus();\n }\n\n /** Grow the box with its content, up to the theme's row limit. */\n #grow() {\n if (SUPPORTS_FIELD_SIZING) return;\n const input = this.#input;\n if (!input) return;\n input.style.height = 'auto';\n input.style.height = `${input.scrollHeight}px`;\n }\n\n /**\n * Update the parts that depend on the typed text without a re-render.\n */\n #syncDerived() {\n const root = this.#host.renderRoot;\n\n const send = /** @type {HTMLButtonElement | null} */ (\n root.querySelector('[part~=\"send-button\"]')\n );\n if (send) send.disabled = !this.canSend;\n\n const input = this.#input;\n const counter = /** @type {HTMLElement | null} */ (root.querySelector('[part~=\"counter\"]'));\n const limit = this.#host.maxLength;\n if (limit === undefined) return;\n\n const remaining = limit - this.length;\n const over = remaining < 0;\n input?.setAttribute('aria-invalid', over ? 'true' : 'false');\n\n if (!counter) return;\n counter.textContent = String(remaining);\n counter.toggleAttribute('data-over', over);\n // The digits alone (\"-14\") say nothing out loud, so the counter carries a\n // sentence for assistive tech while showing just the number.\n const labels = this.#host.currentLabels;\n const template = over ? labels.overLimit : labels.charactersLeft;\n counter.setAttribute('aria-label', template.replace('{n}', String(Math.abs(remaining))));\n counter.hidden = this.length <= limit * 0.8;\n }\n}\n\n/**\n * @typedef {Object} ComposerHost\n * @property {boolean} busy\n * @property {boolean} inputDisabled\n * @property {boolean} sendOnEnter\n * @property {number | undefined} maxLength\n * @property {import('../i18n/labels.js').Labels} currentLabels\n */\n","// @ts-check\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\n\n/** @import { ChitUI } from '../chit-ui.js' */\n/** @import { Message } from '../types.js' */\n\n/**\n * @typedef {Object} ComponentEntry\n * @property {(new () => HTMLElement) | string} source What `component` held when this was built.\n * @property {HTMLElement} element\n * @property {Record<string, unknown>} props Last props written to the element.\n */\n\n/**\n * Per-host component instances, keyed by a caller-chosen string.\n *\n * Messages key by `msg:<id>`; the launcher has its own key. Keeping one cache\n * means one place decides when an element is rebuilt and when its props are\n * merely re-assigned.\n */\nconst INSTANCES = new WeakMap();\n\n/**\n * The cache key for a message's component.\n *\n * @param {string} id\n * @returns {string}\n */\nconst messageKey = (id) => `msg:${id}`;\n\n/** The cache key for the closed-state component. */\nexport const LAUNCHER_KEY = 'launcher';\n\n/** The five ways a message can carry its content. Exactly one may be present. */\nconst CONTENT_FIELDS = /** @type {const} */ ([\n 'text',\n 'html',\n 'template',\n 'element',\n 'component',\n]);\n\n/**\n * Which form a message uses. Also drives the `data-content` attribute, because\n * plain text is the one form whose whitespace has to survive.\n *\n * @param {Message} message\n * @returns {'text' | 'html' | 'template' | 'element' | 'component'}\n */\nexport function contentField(message) {\n const present = CONTENT_FIELDS.filter((field) => field in message);\n if (present.length === 1) return present[0];\n if (present.length === 0) {\n throw new Error(\n `ChitUI: message \"${message.id}\" has no content. Give it one of html, template, element or component.`,\n );\n }\n throw new Error(\n `ChitUI: message \"${message.id}\" has ${present.join(' and ')}. Give it exactly one.`,\n );\n}\n\n/**\n * The value a message's content is built from. Used to decide whether a\n * message actually changed, so `chat-message-render` does not fire on every\n * unrelated update.\n *\n * @param {Message} message\n * @returns {unknown}\n */\nexport function contentKey(message) {\n return /** @type {Record<string, unknown>} */ (message)[contentField(message)];\n}\n\n/**\n * The registered tag name for a `component`.\n *\n * Registration stays the consumer's job: the library never invents a tag name\n * and calls `customElements.define` behind their back, because that name would\n * then be taken globally for the life of the page.\n *\n * @param {(new () => HTMLElement) | string} source\n * @returns {string}\n */\nfunction tagNameOf(source) {\n if (typeof source === 'string') return source;\n\n const registry = /** @type {CustomElementRegistry & { getName?: (c: unknown) => string | null }} */ (\n customElements\n );\n const registered = registry.getName?.(source);\n if (registered) return registered;\n\n const declared = /** @type {{ tagName?: string }} */ (/** @type {unknown} */ (source)).tagName;\n if (typeof declared === 'string' && declared) return declared;\n\n throw new Error(\n 'ChitUI: component is not registered in customElements. ' +\n 'Call customElements.define() for it, or pass its tag name as a string.',\n );\n}\n\n/**\n * Build (or reuse) an element for a component reference and write its props.\n *\n * The instance is kept across renders so the component keeps its own state; a\n * changed reference replaces it, and changed props are assigned one by one so\n * the component's own setters see each change.\n *\n * @param {ChitUI} host\n * @param {string} key Cache key.\n * @param {(new () => HTMLElement) | string} source\n * @param {Record<string, unknown>} [props]\n * @returns {HTMLElement}\n */\nexport function resolveComponent(host, key, source, props = {}) {\n let cache = INSTANCES.get(host);\n if (!cache) {\n cache = new Map();\n INSTANCES.set(host, cache);\n }\n\n const existing = /** @type {ComponentEntry | undefined} */ (cache.get(key));\n\n if (existing && existing.source === source) {\n for (const [name, value] of Object.entries(props)) {\n if (!Object.is(existing.props[name], value)) {\n /** @type {Record<string, unknown>} */ (/** @type {unknown} */ (existing.element))[name] = value;\n }\n }\n existing.props = { ...props };\n return existing.element;\n }\n\n const element = document.createElement(tagNameOf(source));\n for (const [name, value] of Object.entries(props)) {\n /** @type {Record<string, unknown>} */ (/** @type {unknown} */ (element))[name] = value;\n }\n cache.set(key, { source, element, props: { ...props } });\n return element;\n}\n\n/**\n * Drop cached instances for messages that are gone, so a long conversation\n * does not hold on to elements it will never show again. Non-message entries,\n * such as the launcher's, are left alone.\n *\n * @param {ChitUI} host\n * @param {Set<string>} liveIds\n */\nexport function pruneComponents(host, liveIds) {\n const cache = INSTANCES.get(host);\n if (!cache) return;\n for (const key of cache.keys()) {\n if (!key.startsWith('msg:')) continue;\n if (!liveIds.has(key.slice(4))) cache.delete(key);\n }\n}\n\n/**\n * The component instance backing a message, when it has one.\n *\n * @param {ChitUI} host\n * @param {string} id\n * @returns {HTMLElement | undefined}\n */\nexport function componentInstance(host, id) {\n return INSTANCES.get(host)?.get(messageKey(id))?.element;\n}\n\n/**\n * Turn a message's content into something Lit can render as a child value.\n *\n * All four shapes collapse here: an HTML string becomes an `unsafeHTML`\n * directive, a Lit template passes straight through, and an element or a\n * component becomes a Node, which Lit inserts as-is.\n *\n * @param {ChitUI} host\n * @param {Message} message\n * @returns {unknown}\n */\nexport function renderContent(host, message) {\n switch (contentField(message)) {\n case 'text':\n // A string child is rendered by Lit as a text node, so the escaping is\n // structural: there is no parse step for markup to sneak through. Line\n // breaks survive because the content box is pre-wrap for this form.\n return /** @type {{ text: string }} */ (/** @type {unknown} */ (message)).text;\n\n case 'template':\n return /** @type {{ template: unknown }} */ (/** @type {unknown} */ (message)).template;\n\n case 'element':\n return /** @type {{ element: HTMLElement }} */ (/** @type {unknown} */ (message)).element;\n\n case 'component': {\n const carrier = /** @type {{ component: (new () => HTMLElement) | string, props?: Record<string, unknown> }} */ (\n /** @type {unknown} */ (message)\n );\n return resolveComponent(host, messageKey(message.id), carrier.component, carrier.props);\n }\n\n default: {\n // Only the html form goes through `sanitize`: `text` is escaped by\n // construction, and the rest are structures the consumer built\n // themselves rather than markup we could meaningfully clean.\n const raw = /** @type {{ html: string }} */ (/** @type {unknown} */ (message)).html;\n return unsafeHTML(host.sanitize ? host.sanitize(raw) : raw);\n }\n }\n}\n","// @ts-check\nimport { html, nothing } from 'lit';\nimport { LAUNCHER_KEY, resolveComponent } from './content.js';\n\n/** @import { ChitUI } from '../chit-ui.js' */\n\n/**\n * The closed state: one button.\n *\n * What goes inside it has three routes, in order of how much the consumer\n * takes over:\n *\n * - the theme's image or label, drawn inside the themed circle;\n * - the `launcher` slot, their markup inside that same circle;\n * - `closed.component`, a component that draws the whole launcher — the button\n * then keeps only its role, and gives up its size, background, shadow and\n * radius, because two parties styling one box is how things end up clipped.\n *\n * @param {ChitUI} host\n * @returns {import('lit').TemplateResult}\n */\nexport function renderLauncher(host) {\n const closed = host.currentTheme.closed;\n const labels = host.currentLabels;\n const custom = closed.component\n ? resolveComponent(host, LAUNCHER_KEY, closed.component, closed.props)\n : null;\n\n return html`\n <button\n part=\"launcher\"\n type=\"button\"\n aria-label=${closed.label || labels.launcher}\n aria-expanded=${host.state === 'open'}\n ?data-has-image=${!custom && !!closed.image}\n ?data-custom=${!!custom}\n @click=${() => host.toggleFromUser()}\n >\n ${custom ?? html`<slot name=\"launcher\">${defaultContent(closed)}</slot>`}\n </button>\n `;\n}\n\n/**\n * @param {import('../types.js').ResolvedClosed} closed\n * @returns {unknown}\n */\nfunction defaultContent(closed) {\n if (closed.image) return nothing;\n if (closed.label) return html`<span part=\"launcher-label\">${closed.label}</span>`;\n return defaultIcon();\n}\n\n/** A plain speech bubble, so the widget looks like something before theming. */\nfunction defaultIcon() {\n return html`\n <svg part=\"launcher-icon\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"currentColor\"\n d=\"M12 3c-4.97 0-9 3.36-9 7.5 0 2.3 1.25 4.36 3.2 5.73-.13 1.2-.6 2.3-1.36 3.2a.5.5 0 0 0 .5.82 8.2 8.2 0 0 0 3.87-1.86c.88.26 1.82.41 2.79.41 4.97 0 9-3.36 9-7.5S16.97 3 12 3Z\"\n />\n </svg>\n `;\n}\n","import{_$LH as o}from\"./lit-html.js\";\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const{I:t}=o,i=o=>o,n=o=>null===o||\"object\"!=typeof o&&\"function\"!=typeof o,e={HTML:1,SVG:2,MATHML:3},l=(o,t)=>void 0===t?void 0!==o?._$litType$:o?._$litType$===t,d=o=>null!=o?._$litType$?.h,c=o=>void 0!==o?._$litDirective$,f=o=>o?._$litDirective$,r=o=>void 0===o.strings,s=()=>document.createComment(\"\"),v=(o,n,e)=>{const l=o._$AA.parentNode,d=void 0===n?o._$AB:n._$AA;if(void 0===e){const i=l.insertBefore(s(),d),n=l.insertBefore(s(),d);e=new t(i,n,o,o.options)}else{const t=e._$AB.nextSibling,n=e._$AM,c=n!==o;if(c){let t;e._$AQ?.(o),e._$AM=o,void 0!==e._$AP&&(t=o._$AU)!==n._$AU&&e._$AP(t)}if(t!==d||c){let o=e._$AA;for(;o!==t;){const t=i(o).nextSibling;i(l).insertBefore(o,d),o=t}}}return e},u=(o,t,i=o)=>(o._$AI(t,i),o),m={},p=(o,t=m)=>o._$AH=t,M=o=>o._$AH,h=o=>{o._$AR(),o._$AA.remove()},j=o=>{o._$AR()};export{e as TemplateResultType,j as clearPart,M as getCommittedValue,f as getDirectiveClass,v as insertPart,d as isCompiledTemplateResult,c as isDirectiveResult,n as isPrimitive,r as isSingleExpression,l as isTemplateResult,h as removePart,u as setChildPartValue,p as setCommittedValue};\n//# sourceMappingURL=directive-helpers.js.map\n","import{noChange as e}from\"../lit-html.js\";import{directive as s,Directive as t,PartType as r}from\"../directive.js\";import{getCommittedValue as l,setChildPartValue as o,insertPart as i,removePart as n,setCommittedValue as f}from\"../directive-helpers.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst u=(e,s,t)=>{const r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},c=s(class extends t{constructor(e){if(super(e),e.type!==r.CHILD)throw Error(\"repeat() can only be used in text expressions\")}dt(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);const l=[],o=[];let i=0;for(const s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return{values:o,keys:l}}render(e,s,t){return this.dt(e,s,t).values}update(s,[t,r,c]){const d=l(s),{values:p,keys:a}=this.dt(t,r,c);if(!Array.isArray(d))return this.ut=a,p;const h=this.ut??=[],v=[];let m,y,x=0,j=d.length-1,k=0,w=p.length-1;for(;x<=j&&k<=w;)if(null===d[x])x++;else if(null===d[j])j--;else if(h[x]===a[k])v[k]=o(d[x],p[k]),x++,k++;else if(h[j]===a[w])v[w]=o(d[j],p[w]),j--,w--;else if(h[x]===a[w])v[w]=o(d[x],p[w]),i(s,v[w+1],d[x]),x++,w--;else if(h[j]===a[k])v[k]=o(d[j],p[k]),i(s,d[x],d[j]),j--,k++;else if(void 0===m&&(m=u(a,k,w),y=u(h,x,j)),m.has(h[x]))if(m.has(h[j])){const e=y.get(a[k]),t=void 0!==e?d[e]:null;if(null===t){const e=i(s,d[x]);o(e,p[k]),v[k]=e}else v[k]=o(t,p[k]),i(s,d[x],t),d[e]=null;k++}else n(d[j]),j--;else n(d[x]),x++;for(;k<=w;){const e=i(s,v[w+1]);o(e,p[k]),v[k++]=e}for(;x<=j;){const e=d[x++];null!==e&&n(e)}return this.ut=a,f(s,v),e}});export{c as repeat};\n//# sourceMappingURL=repeat.js.map\n","// @ts-check\nimport { html, nothing } from 'lit';\nimport { contentField, renderContent } from './content.js';\n\n/** @import { ChitUI } from '../chit-ui.js' */\n/** @import { Message } from '../types.js' */\n\n/**\n * Format a timestamp. The consumer's `formatTime` wins; otherwise a plain\n * locale-aware hour:minute, which is what a chat bubble wants.\n *\n * @param {ChitUI} host\n * @param {string | Date} time\n * @returns {string}\n */\nfunction formatTime(host, time) {\n const date = time instanceof Date ? time : new Date(time);\n if (Number.isNaN(date.getTime())) return '';\n if (host.formatTime) return host.formatTime(date);\n return new Intl.DateTimeFormat(host.resolvedLocale, {\n hour: '2-digit',\n minute: '2-digit',\n }).format(date);\n}\n\n/**\n * One message.\n *\n * `system` messages are a centred line rather than a bubble: they are the\n * widget talking about the conversation (\"an operator joined\"), not a party to\n * it, so they get no avatar, no name and no timestamp.\n *\n * @param {ChitUI} host\n * @param {Message} message\n * @returns {import('lit').TemplateResult}\n */\nexport function renderMessage(host, message) {\n if (message.role === 'system') {\n return html`\n <article part=\"message message-system\" data-role=\"system\" data-id=${message.id}>\n <div part=\"message-content\" data-content=${contentField(message)}>${renderContent(host, message)}</div>\n </article>\n `;\n }\n\n const meta = message.time || message.status;\n\n return html`\n <article\n part=\"message message-${message.role}\"\n data-role=${message.role}\n data-id=${message.id}\n ?data-streaming=${!!message.streaming}\n aria-busy=${message.streaming ? 'true' : 'false'}\n >\n ${message.avatar\n ? html`<img part=\"avatar\" src=${message.avatar} alt=\"\" loading=\"lazy\" />`\n : nothing}\n <div class=\"body\">\n ${message.name ? html`<span part=\"name\">${message.name}</span>` : nothing}\n <div part=\"bubble\">\n <div part=\"message-content\" data-content=${contentField(message)}>${renderContent(host, message)}</div>\n ${message.streaming ? html`<span part=\"cursor\" aria-hidden=\"true\"></span>` : nothing}\n </div>\n ${meta\n ? html`\n <div part=\"meta\" class=\"meta\">\n ${message.time\n ? html`<time part=\"time\">${formatTime(host, message.time)}</time>`\n : nothing}\n ${message.status\n ? html`<span part=\"status\" data-status=${message.status}>\n ${host.currentLabels.status[message.status]}\n </span>`\n : nothing}\n </div>\n `\n : nothing}\n </div>\n </article>\n `;\n}\n","import{noChange as r,nothing as e}from\"../lit-html.js\";import{directive as i,Directive as t,PartType as n}from\"../directive.js\";import{isSingleExpression as o,setCommittedValue as s}from\"../directive-helpers.js\";\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const l=i(class extends t{constructor(r){if(super(r),r.type!==n.PROPERTY&&r.type!==n.ATTRIBUTE&&r.type!==n.BOOLEAN_ATTRIBUTE)throw Error(\"The `live` directive is not allowed on child or event bindings\");if(!o(r))throw Error(\"`live` bindings can only contain a single expression\")}render(r){return r}update(i,[t]){if(t===r||t===e)return t;const o=i.element,l=i.name;if(i.type===n.PROPERTY){if(t===o[l])return r}else if(i.type===n.BOOLEAN_ATTRIBUTE){if(!!t===o.hasAttribute(l))return r}else if(i.type===n.ATTRIBUTE&&o.getAttribute(l)===t+\"\")return r;return s(i),t}});export{l as live};\n//# sourceMappingURL=live.js.map\n","// @ts-check\nimport { html, nothing } from 'lit';\nimport { renderMessageList } from './message-list.js';\nimport { renderComposer } from './composer.js';\n\n/** @import { ChitUI } from '../chit-ui.js' */\n\n/**\n * The open state. Header and footer are slots; the message list and the\n * composer arrive in later milestones and are placeholders for now.\n *\n * @param {ChitUI} host\n * @returns {import('lit').TemplateResult}\n */\nexport function renderPanel(host) {\n const open = host.currentTheme.open;\n const labels = host.currentLabels;\n const title = open.header?.title ?? labels.panel;\n\n return html`\n <section\n part=\"panel\"\n role=\"dialog\"\n aria-modal=\"false\"\n aria-label=${title}\n tabindex=\"-1\"\n @keydown=${(/** @type {KeyboardEvent} */ event) => onKeydown(host, event)}\n >\n <header part=\"header\">\n <slot name=\"header\">\n <slot name=\"header-title\">\n ${open.header?.logo\n ? html`<img part=\"header-logo\" src=${open.header.logo} alt=\"\" />`\n : nothing}\n <span part=\"header-heading\">${title}</span>\n </slot>\n <span part=\"header-actions\">\n <slot name=\"header-actions\"></slot>\n <button\n part=\"close-button\"\n type=\"button\"\n aria-label=${labels.close}\n @click=${() => host.closeFromUser()}\n >\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n d=\"M6 6l12 12M18 6L6 18\"\n />\n </svg>\n </button>\n </span>\n </slot>\n </header>\n\n ${renderMessageList(host)} ${renderComposer(host)}\n\n <slot name=\"footer\"></slot>\n </section>\n `;\n}\n\n/**\n * Esc closes the panel. It is handled here rather than on the host so that it\n * only applies while the panel has focus inside it.\n *\n * @param {ChitUI} host\n * @param {KeyboardEvent} event\n */\nfunction onKeydown(host, event) {\n if (event.key !== 'Escape' || event.defaultPrevented) return;\n event.preventDefault();\n host.closeFromUser();\n}\n","// @ts-check\nimport { html, nothing } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { renderMessage } from './message.js';\n\n/** @import { ChitUI } from '../chit-ui.js' */\n\n/**\n * The scrolling conversation.\n *\n * `repeat` keys on the message id so an existing bubble's DOM is reused when\n * the consumer assigns a new array; without it Lit would reorder by position\n * and a component message would lose its state on every insert.\n *\n * Clicks are handled once here and re-published as `chat-message-click`, which\n * is how a consumer reaches a button inside a message without hunting through\n * the shadow root.\n *\n * @param {ChitUI} host\n * @returns {import('lit').TemplateResult}\n */\nexport function renderMessageList(host) {\n const labels = host.currentLabels;\n const typing = host.typing;\n const empty = host.messages.length === 0 && !typing;\n\n return html`\n <div\n part=\"messages\"\n role=\"log\"\n aria-live=\"polite\"\n aria-relevant=\"additions text\"\n aria-label=${labels.conversation}\n @click=${(/** @type {MouseEvent} */ event) => host.handleMessageClick(event)}\n >\n <div part=\"messages-inner\" class=\"inner\">\n ${empty ? html`<slot name=\"empty\"></slot>` : nothing}\n ${repeat(\n host.messages,\n (message) => message.id,\n (message) => renderMessage(host, message),\n )}\n ${typing\n ? html`\n <div part=\"typing\" role=\"status\" aria-label=${labels.typing}>\n ${typeof typing === 'object' && typing.html\n ? host.renderTypingHtml(typing.html)\n : html`<span class=\"dots\" aria-hidden=\"true\"><i></i><i></i><i></i></span>`}\n </div>\n `\n : nothing}\n </div>\n </div>\n\n ${host.hasUnseen\n ? html`\n <button\n part=\"to-latest\"\n type=\"button\"\n @click=${() => host.scrollToBottom({ smooth: true })}\n >\n ${labels.toLatest}\n </button>\n `\n : nothing}\n `;\n}\n","// @ts-check\nimport { html, nothing } from 'lit';\nimport { live } from 'lit/directives/live.js';\n\n/** @import { ChitUI } from '../chit-ui.js' */\n\n/**\n * The composer: a textarea that grows with its content, and a send button.\n *\n * The whole thing can be replaced through the `composer` slot; a consumer who\n * does that calls `host.submit(text)` themselves. `input-before` and\n * `input-after` are the lighter option, for an attach or emoji button beside\n * the box the library still owns.\n *\n * @param {ChitUI} host\n * @returns {import('lit').TemplateResult | typeof nothing}\n */\nexport function renderComposer(host) {\n if (host.inputHidden) return nothing;\n\n const labels = host.currentLabels;\n const theme = host.currentTheme.open;\n const disabled = host.busy || host.inputDisabled;\n const placeholder = host.placeholder ?? theme.input.placeholder ?? labels.input;\n\n return html`\n <form\n part=\"composer\"\n @submit=${(/** @type {SubmitEvent} */ event) => {\n event.preventDefault();\n host.submit();\n }}\n >\n <slot name=\"composer\">\n <slot name=\"input-before\"></slot>\n\n <textarea\n part=\"input\"\n rows=\"1\"\n .value=${live(host.value)}\n placeholder=${placeholder}\n aria-label=${labels.input}\n ?disabled=${disabled}\n aria-describedby=${host.maxLength === undefined ? nothing : 'chit-counter'}\n @input=${(/** @type {Event} */ event) => host.handleInput(event)}\n @keydown=${(/** @type {KeyboardEvent} */ event) => host.handleKeydown(event)}\n @compositionstart=${() => host.handleComposition(true)}\n @compositionend=${() => host.handleComposition(false)}\n ></textarea>\n\n <slot name=\"input-after\"></slot>\n\n ${host.maxLength === undefined\n ? nothing\n : html`<span part=\"counter\" id=\"chit-counter\" aria-live=\"polite\" hidden></span>`}\n\n <button\n part=\"send-button\"\n type=\"submit\"\n aria-label=${labels.send}\n ?disabled=${!host.canSend}\n >\n ${host.busy\n ? html`<span part=\"spinner\" aria-hidden=\"true\"></span>`\n : html`<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path fill=\"currentColor\" d=\"M3.4 20.4 21 12 3.4 3.6 3.39 10.2 15.6 12 3.39 13.8z\" />\n </svg>`}\n </button>\n </slot>\n </form>\n `;\n}\n","// @ts-check\n\n/**\n * @typedef {Object} Labels\n * @property {string} launcher Accessible name of the closed-state button.\n * @property {string} panel Accessible name of the dialog.\n * @property {string} conversation Accessible name of the message log.\n * @property {string} close Close button.\n * @property {string} send Send button.\n * @property {string} input Composer textarea.\n * @property {string} typing Announced while the other side is typing.\n * @property {string} toLatest \"Jump to newest\" button.\n * @property {{ sending: string, sent: string, error: string }} status Delivery state of one's own message.\n * @property {string} charactersLeft Counter, with {n} for the number remaining.\n * @property {string} overLimit Counter past the limit, with {n} for the excess.\n */\n\n/** @type {Record<string, Labels>} */\nconst BUILT_IN = {\n ja: {\n launcher: 'チャットを開く',\n panel: 'チャット',\n conversation: '会話',\n close: 'チャットを閉じる',\n send: '送信',\n input: 'メッセージを入力',\n typing: '入力中',\n toLatest: '最新へ',\n status: { sending: '送信中', sent: '送信済み', error: '送信できませんでした' },\n charactersLeft: '残り {n} 文字',\n overLimit: '{n} 文字超過しています',\n },\n en: {\n launcher: 'Open chat',\n panel: 'Chat',\n conversation: 'Conversation',\n close: 'Close chat',\n send: 'Send',\n input: 'Type a message',\n typing: 'Typing',\n toLatest: 'Jump to latest',\n status: { sending: 'Sending', sent: 'Sent', error: 'Not delivered' },\n charactersLeft: '{n} characters left',\n overLimit: '{n} characters over the limit',\n },\n};\n\n/**\n * The language the widget speaks: the `locale` property, else the document's,\n * else the browser's. Everything locale-dependent — labels and timestamps\n * alike — goes through this, so they cannot disagree.\n *\n * @param {string | undefined} locale\n * @returns {string | undefined} undefined means \"whatever the browser uses\".\n */\nexport function resolveLocale(locale) {\n return locale || document.documentElement.lang || undefined;\n}\n\n/**\n * Pick the label set for a locale, falling back to English for anything we do\n * not ship. `overrides` is the host's `labels` property.\n *\n * @param {string | undefined} locale\n * @param {Partial<Labels> | undefined} [overrides]\n * @returns {Labels}\n */\nexport function resolveLabels(locale, overrides) {\n const lang = (resolveLocale(locale) || 'en').toLowerCase();\n const base = BUILT_IN[lang] ?? BUILT_IN[lang.split('-')[0]] ?? BUILT_IN.en;\n return overrides ? { ...base, ...overrides } : base;\n}\n","// @ts-check\nimport { css } from 'lit';\n\n/**\n * Host-level concerns: the coordinate space the widget lives in, the theme\n * fallbacks, and the transition animations.\n *\n * Every custom property here is a fallback only. ThemeController writes the\n * real values into an adopted stylesheet that sits ahead of this one, and page\n * CSS (`chit-ui { --chit-color-accent: ... }`) beats both.\n */\nexport const hostStyles = css`\n :host {\n --chit-z-index: 2147483000;\n --chit-font-family: system-ui, -apple-system, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;\n --chit-font-size: 14px;\n\n --chit-launcher-size: 60px;\n --chit-launcher-offset-x: 24px;\n --chit-launcher-offset-y: 24px;\n --chit-launcher-radius: 30px;\n --chit-launcher-bg: #1a73e8;\n --chit-launcher-text: #ffffff;\n --chit-launcher-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);\n\n --chit-panel-width: 380px;\n --chit-panel-height: 600px;\n --chit-panel-offset-x: 24px;\n --chit-panel-offset-y: 24px;\n --chit-panel-radius: 16px;\n --chit-panel-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);\n\n --chit-color-bg: #ffffff;\n --chit-color-text: #1f1f1f;\n --chit-color-accent: #1a73e8;\n --chit-color-border: #e4e4e7;\n --chit-color-header-bg: #ffffff;\n --chit-color-header-text: #1f1f1f;\n\n position: fixed;\n inset: 0;\n z-index: var(--chit-z-index);\n /* The host is only a coordinate space; clicks land on the page behind it. */\n pointer-events: none;\n font-family: var(--chit-font-family);\n font-size: var(--chit-font-size);\n color: var(--chit-color-text);\n -webkit-font-smoothing: antialiased;\n }\n\n /*\n * Keyed off what the DOM is showing, not off the state property: that flips\n * to 'hidden' the moment it is assigned, while the exit animation still has\n * to play.\n */\n :host([data-rendered-state='hidden']) {\n display: none;\n }\n\n :host > *,\n [part] {\n pointer-events: auto;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n /* --- transitions ------------------------------------------------------ */\n\n [data-anim] {\n animation-duration: var(--_chit-anim-duration, 200ms);\n animation-fill-mode: both;\n animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);\n }\n\n [data-anim='enter'][data-effect='fade'] {\n animation-name: chit-fade-in;\n }\n [data-anim='exit'][data-effect='fade'] {\n animation-name: chit-fade-out;\n }\n [data-anim='enter'][data-effect='scale'] {\n animation-name: chit-scale-in;\n }\n [data-anim='exit'][data-effect='scale'] {\n animation-name: chit-scale-out;\n }\n [data-anim='enter'][data-effect='slide'] {\n animation-name: chit-slide-in;\n }\n [data-anim='exit'][data-effect='slide'] {\n animation-name: chit-slide-out;\n }\n\n @keyframes chit-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n @keyframes chit-fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n }\n @keyframes chit-scale-in {\n from {\n opacity: 0;\n transform: scale(0.85);\n }\n to {\n opacity: 1;\n transform: none;\n }\n }\n @keyframes chit-scale-out {\n from {\n opacity: 1;\n transform: none;\n }\n to {\n opacity: 0;\n transform: scale(0.85);\n }\n }\n @keyframes chit-slide-in {\n from {\n opacity: 0;\n transform: translateY(16px);\n }\n to {\n opacity: 1;\n transform: none;\n }\n }\n @keyframes chit-slide-out {\n from {\n opacity: 1;\n transform: none;\n }\n to {\n opacity: 0;\n transform: translateY(16px);\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n [data-anim] {\n animation: none !important;\n }\n }\n`;\n","// @ts-check\nimport { css } from 'lit';\n\nexport const launcherStyles = css`\n [part~='launcher'] {\n position: absolute;\n display: grid;\n place-items: center;\n width: var(--chit-launcher-size);\n height: var(--chit-launcher-size);\n padding: 0;\n border: 0;\n border-radius: var(--chit-launcher-radius);\n background-color: var(--chit-launcher-bg);\n background-position: center;\n background-size: cover;\n background-repeat: no-repeat;\n color: var(--chit-launcher-text);\n box-shadow: var(--chit-launcher-shadow);\n font: inherit;\n line-height: 1;\n cursor: pointer;\n transition: filter 120ms ease;\n }\n\n /* The image comes from the theme, so it is a background rather than an <img>. */\n [part~='launcher'][data-has-image] {\n background-image: var(--chit-launcher-image);\n }\n\n /*\n * A consumer component draws the whole launcher, so the button stops being a\n * visual of its own: no box to squeeze the component into, and none of the\n * widget's own paint behind it. It keeps being a button, which is the part\n * that matters for keyboards and screen readers.\n */\n [part~='launcher'][data-custom] {\n width: auto;\n height: auto;\n padding: 0;\n border-radius: 0;\n background: none;\n box-shadow: none;\n color: inherit;\n }\n\n [part~='launcher'][data-custom]:hover {\n filter: none;\n }\n\n [part~='launcher']:hover {\n filter: brightness(1.06);\n }\n\n [part~='launcher']:focus-visible {\n outline: 2px solid var(--chit-launcher-bg);\n outline-offset: 3px;\n }\n\n [part~='launcher-icon'] {\n width: 55%;\n height: 55%;\n }\n\n [part~='launcher-label'] {\n padding: 0 0.75em;\n font-size: 0.95em;\n white-space: nowrap;\n }\n\n /* --- placement -------------------------------------------------------- */\n\n :host([data-launcher-position='bottom-right']) [part~='launcher'] {\n right: var(--chit-launcher-offset-x);\n bottom: var(--chit-launcher-offset-y);\n transform-origin: bottom right;\n }\n :host([data-launcher-position='bottom-left']) [part~='launcher'] {\n left: var(--chit-launcher-offset-x);\n bottom: var(--chit-launcher-offset-y);\n transform-origin: bottom left;\n }\n :host([data-launcher-position='top-right']) [part~='launcher'] {\n right: var(--chit-launcher-offset-x);\n top: var(--chit-launcher-offset-y);\n transform-origin: top right;\n }\n :host([data-launcher-position='top-left']) [part~='launcher'] {\n left: var(--chit-launcher-offset-x);\n top: var(--chit-launcher-offset-y);\n transform-origin: top left;\n }\n\n /* --- idle motion ------------------------------------------------------ */\n\n /*\n * Only while nothing else is animating: a transition sets data-anim and owns\n * the animation property for as long as it runs.\n */\n :host([data-idle='pulse']) [part~='launcher']:not([data-anim]) {\n animation: chit-idle-pulse 2.4s ease-in-out infinite;\n }\n :host([data-idle='bounce']) [part~='launcher']:not([data-anim]) {\n animation: chit-idle-bounce 2.4s ease-in-out infinite;\n }\n\n @keyframes chit-idle-pulse {\n 0%,\n 70%,\n 100% {\n box-shadow: var(--chit-launcher-shadow);\n }\n 35% {\n box-shadow:\n var(--chit-launcher-shadow),\n 0 0 0 10px color-mix(in srgb, var(--chit-launcher-bg) 22%, transparent);\n }\n }\n\n @keyframes chit-idle-bounce {\n 0%,\n 62%,\n 100% {\n transform: translateY(0);\n }\n 72% {\n transform: translateY(-6px);\n }\n 86% {\n transform: translateY(-2px);\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n :host([data-idle]) [part~='launcher']:not([data-anim]) {\n animation: none;\n }\n }\n`;\n","// @ts-check\nimport { css } from 'lit';\n\nexport const panelStyles = css`\n [part~='panel'] {\n position: absolute;\n display: flex;\n flex-direction: column;\n width: var(--chit-panel-width);\n height: var(--chit-panel-height);\n max-width: calc(100vw - var(--chit-panel-offset-x) * 2);\n max-height: calc(100vh - var(--chit-panel-offset-y) * 2);\n overflow: hidden;\n border-radius: var(--chit-panel-radius);\n background-color: var(--chit-color-bg);\n background-image: var(--chit-panel-bg-image);\n background-size: cover;\n background-position: center;\n box-shadow: var(--chit-panel-shadow);\n }\n\n /* --- placement -------------------------------------------------------- */\n\n :host([data-panel-position='bottom-right']) [part~='panel'] {\n right: var(--chit-panel-offset-x);\n bottom: var(--chit-panel-offset-y);\n transform-origin: bottom right;\n }\n :host([data-panel-position='bottom-left']) [part~='panel'] {\n left: var(--chit-panel-offset-x);\n bottom: var(--chit-panel-offset-y);\n transform-origin: bottom left;\n }\n :host([data-panel-position='top-right']) [part~='panel'] {\n right: var(--chit-panel-offset-x);\n top: var(--chit-panel-offset-y);\n transform-origin: top right;\n }\n :host([data-panel-position='top-left']) [part~='panel'] {\n left: var(--chit-panel-offset-x);\n top: var(--chit-panel-offset-y);\n transform-origin: top left;\n }\n\n [part~='panel']:focus {\n outline: none;\n }\n\n /*\n * A phone gets the whole screen. dvh rather than vh so the browser chrome\n * collapsing does not leave a gap, and the safe-area insets keep the header\n * clear of the notch.\n */\n :host([data-device='mobile']) [part~='panel'],\n :host([data-device='mobile'][data-panel-position]) [part~='panel'] {\n inset: 0;\n width: 100vw;\n height: 100dvh;\n max-width: none;\n max-height: none;\n border-radius: 0;\n padding-top: env(safe-area-inset-top);\n padding-bottom: env(safe-area-inset-bottom);\n overscroll-behavior: contain;\n }\n\n [part~='header'] {\n display: flex;\n flex: none;\n align-items: center;\n justify-content: space-between;\n gap: 0.5em;\n padding: 0.875em 1em;\n border-bottom: 1px solid var(--chit-color-border);\n background: var(--chit-color-header-bg);\n color: var(--chit-color-header-text);\n }\n\n [part~='header-heading'] {\n font-size: 1.05em;\n font-weight: 600;\n }\n\n [part~='header-logo'] {\n width: 1.75em;\n height: 1.75em;\n margin-inline-end: 0.5em;\n border-radius: 50%;\n object-fit: cover;\n vertical-align: middle;\n }\n\n [part~='header-actions'] {\n display: inline-flex;\n align-items: center;\n gap: 0.25em;\n }\n\n [part~='close-button'] {\n display: grid;\n place-items: center;\n width: 2em;\n height: 2em;\n padding: 0;\n border: 0;\n border-radius: 50%;\n background: transparent;\n color: inherit;\n cursor: pointer;\n }\n\n [part~='close-button']:hover {\n background: color-mix(in srgb, currentColor 10%, transparent);\n }\n\n [part~='close-button']:focus-visible {\n outline: 2px solid var(--chit-color-accent);\n outline-offset: 1px;\n }\n\n [part~='close-button'] svg {\n width: 1.1em;\n height: 1.1em;\n }\n\n`;\n","// @ts-check\nimport { css } from 'lit';\n\nexport const messageStyles = css`\n [part~='messages'] {\n flex: 1 1 auto;\n min-height: 0;\n overflow-y: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n }\n\n [part~='messages-inner'] {\n display: flex;\n flex-direction: column;\n gap: 0.75em;\n padding: 1em;\n }\n\n /*\n * The row spans the full width and the bubble is capped inside it. Letting\n * the row shrink to fit instead would make the bubble's percentage cap\n * resolve against a shrink-to-fit parent, and because the content sets\n * overflow-wrap: anywhere its min-content width is one character — so the\n * bubble collapsed to a single column of letters.\n */\n [part~='message'] {\n display: flex;\n align-items: flex-end;\n gap: 0.5em;\n width: 100%;\n max-width: 100%;\n }\n\n [part~='message'] .body {\n display: flex;\n min-width: 0;\n max-width: 78%;\n flex-direction: column;\n gap: 0.25em;\n }\n\n /* Reversed row: the bubble sits at the right edge without shrinking the row. */\n [part~='message-user'] {\n flex-direction: row-reverse;\n }\n\n [part~='message-user'] .body {\n align-items: flex-end;\n }\n\n [part~='bubble'] {\n position: relative;\n padding: 0.6em 0.85em;\n border-radius: 14px;\n background: var(--chit-color-assistant-bg);\n color: var(--chit-color-assistant-text);\n }\n\n [part~='message-user'] [part~='bubble'] {\n background: var(--chit-color-user-bg);\n color: var(--chit-color-user-text);\n border-bottom-right-radius: 4px;\n }\n\n [part~='message-assistant'] [part~='bubble'] {\n border-bottom-left-radius: 4px;\n }\n\n [part~='avatar'] {\n flex: none;\n width: 2em;\n height: 2em;\n border-radius: 50%;\n object-fit: cover;\n }\n\n [part~='name'] {\n font-size: 0.8em;\n color: var(--chit-color-system-text);\n }\n\n [part~='meta'] {\n display: flex;\n gap: 0.5em;\n font-size: 0.75em;\n color: var(--chit-color-system-text);\n }\n\n [part~='status'][data-status='error'] {\n color: #d93025;\n }\n\n [part~='message-system'] {\n justify-content: center;\n font-size: 0.8em;\n color: var(--chit-color-system-text);\n text-align: center;\n }\n\n /* --- streaming and typing --------------------------------------------- */\n\n [part~='cursor'] {\n display: inline-block;\n width: 0.5em;\n height: 1em;\n margin-inline-start: 0.15em;\n background: currentColor;\n opacity: 0.6;\n vertical-align: text-bottom;\n animation: chit-caret 1s step-end infinite;\n }\n\n @keyframes chit-caret {\n 50% {\n opacity: 0;\n }\n }\n\n [part~='typing'] {\n align-self: flex-start;\n padding: 0.7em 0.9em;\n border-radius: 14px;\n border-bottom-left-radius: 4px;\n background: var(--chit-color-assistant-bg);\n color: var(--chit-color-assistant-text);\n }\n\n [part~='typing'] .dots {\n display: inline-flex;\n gap: 0.25em;\n }\n\n [part~='typing'] .dots i {\n width: 0.4em;\n height: 0.4em;\n border-radius: 50%;\n background: currentColor;\n opacity: 0.4;\n animation: chit-typing 1.2s ease-in-out infinite;\n }\n\n [part~='typing'] .dots i:nth-child(2) {\n animation-delay: 0.15s;\n }\n [part~='typing'] .dots i:nth-child(3) {\n animation-delay: 0.3s;\n }\n\n @keyframes chit-typing {\n 0%,\n 60%,\n 100% {\n opacity: 0.35;\n transform: translateY(0);\n }\n 30% {\n opacity: 1;\n transform: translateY(-3px);\n }\n }\n\n /* --- jump to latest ---------------------------------------------------- */\n\n [part~='to-latest'] {\n position: absolute;\n left: 50%;\n bottom: 5.5em;\n transform: translateX(-50%);\n padding: 0.35em 0.9em;\n border: 1px solid var(--chit-color-border);\n border-radius: 999px;\n background: var(--chit-color-bg);\n color: var(--chit-color-text);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);\n font: inherit;\n font-size: 0.8em;\n cursor: pointer;\n }\n\n [part~='to-latest']:focus-visible {\n outline: 2px solid var(--chit-color-accent);\n outline-offset: 2px;\n }\n\n @media (prefers-reduced-motion: reduce) {\n [part~='cursor'],\n [part~='typing'] .dots i {\n animation: none;\n }\n }\n`;\n","// @ts-check\nimport { css } from 'lit';\n\n/**\n * Everything that keeps arbitrary consumer HTML inside its bubble.\n *\n * The widget has no say over what goes in a message, so the containment is\n * structural rather than a list of rules per element: the content box declares\n * its own size, refuses to grow past the bubble, and contains its layout and\n * paint so a stray position or margin cannot escape.\n */\nexport const contentStyles = css`\n [part~='message-content'] {\n min-width: 0;\n max-width: 100%;\n /* Long URLs and unbroken words wrap instead of widening the bubble. */\n overflow-wrap: anywhere;\n word-break: normal;\n overflow-x: hidden;\n /* Keeps a fixed or hugely-margined child from painting outside. */\n contain: layout paint;\n line-height: 1.5;\n }\n\n /*\n * Plain text keeps its line breaks. Only this form: applying pre-wrap to\n * html content would turn the newlines and indentation of the markup itself\n * into visible blank lines.\n */\n [part~='message-content'][data-content='text'] {\n white-space: pre-wrap;\n }\n\n [part~='message-content'] > :first-child {\n margin-top: 0;\n }\n [part~='message-content'] > :last-child {\n margin-bottom: 0;\n }\n\n /* Only direct children: a tooltip nested deeper still positions normally. */\n [part~='message-content'] > * {\n position: static !important;\n }\n\n [part~='message-content'] img,\n [part~='message-content'] video,\n [part~='message-content'] iframe,\n [part~='message-content'] svg,\n [part~='message-content'] canvas,\n [part~='message-content'] picture,\n [part~='message-content'] embed,\n [part~='message-content'] object {\n max-width: 100%;\n height: auto;\n display: block;\n }\n\n /* Wide content scrolls inside itself rather than stretching the bubble. */\n [part~='message-content'] table {\n display: block;\n max-width: 100%;\n overflow-x: auto;\n border-collapse: collapse;\n }\n\n [part~='message-content'] pre {\n max-width: 100%;\n overflow-x: auto;\n white-space: pre;\n }\n\n [part~='message-content'] code {\n overflow-wrap: anywhere;\n }\n\n [part~='message-content'] a {\n color: var(--chit-color-accent);\n }\n\n [part~='message-content'] button,\n [part~='message-content'] input,\n [part~='message-content'] select,\n [part~='message-content'] textarea {\n font: inherit;\n max-width: 100%;\n }\n\n [part~='message-content'] h1,\n [part~='message-content'] h2,\n [part~='message-content'] h3,\n [part~='message-content'] h4,\n [part~='message-content'] h5,\n [part~='message-content'] h6 {\n font-size: 1.1em;\n margin: 0.5em 0;\n }\n\n [part~='message-content'] p {\n margin: 0.5em 0;\n }\n\n [part~='message-content'] ul,\n [part~='message-content'] ol {\n margin: 0.5em 0;\n padding-inline-start: 1.5em;\n }\n\n [part~='message-content'] blockquote {\n margin: 0.5em 0;\n padding-inline-start: 0.75em;\n border-inline-start: 3px solid var(--chit-color-border);\n }\n\n [part~='message-content'] hr {\n border: 0;\n border-top: 1px solid var(--chit-color-border);\n }\n`;\n","// @ts-check\nimport { css } from 'lit';\n\nexport const composerStyles = css`\n [part~='composer'] {\n display: flex;\n flex: none;\n align-items: flex-end;\n gap: 0.5em;\n padding: 0.6em 0.75em;\n border-top: 1px solid var(--chit-color-border);\n background: var(--chit-color-input-bg);\n }\n\n [part~='input'] {\n flex: 1 1 auto;\n min-width: 0;\n /* One row to start with, growing to the theme's limit. */\n field-sizing: content;\n max-height: calc(1.5em * var(--_chit-input-max-rows, 5) + 1em);\n padding: 0.45em 0.6em;\n border: 1px solid var(--chit-color-border);\n border-radius: 12px;\n background: var(--chit-color-input-bg);\n color: var(--chit-color-input-text);\n font: inherit;\n line-height: 1.5;\n resize: none;\n overflow-y: auto;\n }\n\n [part~='input']::placeholder {\n color: var(--chit-color-input-placeholder);\n }\n\n [part~='input']:focus-visible {\n outline: 2px solid var(--chit-color-accent);\n outline-offset: -1px;\n }\n\n [part~='input']:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n [part~='counter'] {\n align-self: center;\n font-size: 0.75em;\n color: var(--chit-color-system-text);\n font-variant-numeric: tabular-nums;\n }\n\n [part~='counter'][data-over] {\n color: #d93025;\n font-weight: 600;\n }\n\n [part~='send-button'] {\n display: grid;\n flex: none;\n place-items: center;\n width: 2.4em;\n height: 2.4em;\n padding: 0;\n border: 0;\n border-radius: 50%;\n background: var(--chit-color-accent);\n color: #fff;\n cursor: pointer;\n transition: opacity 120ms ease;\n }\n\n [part~='send-button'] svg {\n width: 1.1em;\n height: 1.1em;\n }\n\n [part~='send-button']:disabled {\n opacity: 0.4;\n cursor: default;\n }\n\n [part~='send-button']:focus-visible {\n outline: 2px solid var(--chit-color-accent);\n outline-offset: 2px;\n }\n\n [part~='spinner'] {\n width: 1.1em;\n height: 1.1em;\n border: 2px solid currentColor;\n border-top-color: transparent;\n border-radius: 50%;\n animation: chit-spin 0.7s linear infinite;\n }\n\n @keyframes chit-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n [part~='spinner'] {\n animation-duration: 2s;\n }\n }\n`;\n","// @ts-check\nimport { LitElement, html, nothing } from 'lit';\n\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\n\nimport { StateController } from './controllers/state-controller.js';\nimport { BreakpointController } from './controllers/breakpoint-controller.js';\nimport { ThemeController } from './controllers/theme-controller.js';\nimport { ScrollController } from './controllers/scroll-controller.js';\nimport { ComposerController } from './controllers/composer-controller.js';\nimport { renderLauncher } from './render/launcher.js';\nimport { renderPanel } from './render/panel.js';\nimport { resolveLabels, resolveLocale } from './i18n/labels.js';\nimport { Events, emit } from './events.js';\nimport { componentInstance, contentKey, pruneComponents } from './render/content.js';\nimport { AdoptedSheet } from './styles/adopted-sheet.js';\nimport { hostStyles } from './styles/host.css.js';\nimport { launcherStyles } from './styles/launcher.css.js';\nimport { panelStyles } from './styles/panel.css.js';\nimport { messageStyles } from './styles/message.css.js';\nimport { contentStyles } from './styles/content.css.js';\nimport { composerStyles } from './styles/composer.css.js';\n\n/** @import { Message, Theme, ChatState, Trigger, Effect, Device, ResolvedTheme } from './types.js' */\n/** @import { Labels } from './i18n/labels.js' */\n\n/**\n * The chat widget.\n *\n * One custom element, one shadow root. Everything inside is drawn by plain\n * functions in `render/` and driven by the reactive controllers in\n * `controllers/`; no nested custom elements, so `::part()` and the theme's\n * custom properties reach every corner without being forwarded.\n *\n * @element chit-ui\n *\n * @slot launcher - Replaces the whole closed-state button content.\n * @slot header - Replaces the panel header.\n * @slot header-title - Replaces only the title area of the header.\n * @slot header-actions - Extra buttons beside the close button.\n * @slot footer - Below the composer (disclaimers, attribution).\n */\nexport class ChitUI extends LitElement {\n /** @override */\n static styles = [\n hostStyles,\n launcherStyles,\n panelStyles,\n messageStyles,\n contentStyles,\n composerStyles,\n ];\n\n /** @override */\n static properties = {\n state: { type: String, reflect: true, noAccessor: true },\n theme: { type: Object },\n messages: { type: Array },\n typing: { type: Object },\n busy: { type: Boolean, reflect: true },\n inputDisabled: { type: Boolean, reflect: true, attribute: 'input-disabled' },\n inputHidden: { type: Boolean, reflect: true, attribute: 'input-hidden' },\n placeholder: { type: String, reflect: true },\n sendOnEnter: { type: Boolean, reflect: true, attribute: 'send-on-enter' },\n maxLength: { type: Number, reflect: true, attribute: 'max-length' },\n focusOnOpen: { type: String, reflect: true, attribute: 'focus-on-open' },\n locale: { type: String, reflect: true },\n labels: { type: Object },\n messageStyles: { type: String },\n };\n\n /** @type {ChatState} */\n #state = 'closed';\n\n /**\n * Set by the widget's own event handlers just before they move the state, so\n * the events can say the move came from a person rather than from code.\n *\n * @type {Trigger}\n */\n #trigger = 'api';\n\n /** @type {StateController} */\n #transitions;\n\n /** @type {BreakpointController} */\n #breakpoint;\n\n /** @type {ThemeController} */\n #themes;\n\n /** @type {ScrollController} */\n #scroll;\n\n /** @type {ComposerController} */\n #composer;\n\n /** Consumer CSS for the inside of message bubbles. */\n #messageSheet = new AdoptedSheet('data-chit-message-styles');\n\n /** What each message's content was built from last render, by id. */\n /** @type {Map<string, unknown>} */\n #renderedContent = new Map();\n\n /** The in-flight transition, so the methods can hand it back to the caller. */\n /** @type {Promise<boolean> | null} */\n #settled = null;\n\n constructor() {\n super();\n\n /** @type {Theme} Partial; unset keys fall back to the default theme. */\n this.theme = {};\n\n /** @type {Message[]} Rendered as given. The library never mutates this. */\n this.messages = [];\n\n /** @type {boolean | { html: string }} Show the \"typing\" bubble. */\n this.typing = false;\n\n /** @type {boolean} Lock the composer while a reply is in flight. */\n this.busy = false;\n\n /** @type {boolean} */\n this.inputDisabled = false;\n\n /** @type {boolean} */\n this.inputHidden = false;\n\n /** @type {string | undefined} */\n this.placeholder = undefined;\n\n /** @type {boolean} */\n this.sendOnEnter = true;\n\n /** @type {number | undefined} */\n this.maxLength = undefined;\n\n /**\n * Focus the composer once the open transition finishes. 'auto' focuses on\n * PC only, so a phone keyboard never pops up unasked.\n *\n * Named focusOnOpen rather than autofocus: HTMLElement.autofocus is a\n * standard boolean property and cannot carry a third value.\n *\n * @type {'auto' | 'always' | 'never'}\n */\n this.focusOnOpen = 'auto';\n\n /** @type {string | undefined} */\n this.locale = undefined;\n\n /** @type {Partial<Labels> | undefined} Overrides for the built-in UI strings. */\n this.labels = undefined;\n\n /** @type {string} Extra CSS applied inside message content. */\n this.messageStyles = '';\n\n /** @type {((html: string) => string) | undefined} Applied to `html` messages only. */\n this.sanitize = undefined;\n\n /** @type {((time: Date) => string) | undefined} */\n this.formatTime = undefined;\n\n this.#transitions = new StateController(this, {\n animation: (from, to, phase) => this.#animationFor(from, to, phase),\n keepsLauncher: () => this.currentTheme.open.launcher === 'visible',\n onOpened: () => this.#applyOpenFocus(),\n });\n\n this.#breakpoint = new BreakpointController(this);\n this.#themes = new ThemeController(this, { device: () => this.#breakpoint.device });\n this.addController(this.#themes);\n this.#scroll = new ScrollController(this, {\n behavior: () => this.currentTheme.open.animation.scroll,\n });\n this.#composer = new ComposerController(this);\n }\n\n /**\n * Current state. Assigning it starts the transition, exactly as calling the\n * matching method would.\n *\n * @type {ChatState}\n */\n get state() {\n return this.#state;\n }\n\n set state(value) {\n const previous = this.#state;\n if (value === previous) return;\n this.#state = value;\n this.requestUpdate('state', previous);\n\n // A transition the controller itself is applying (a revert, or the tail of\n // a method call) must not start another one.\n if (!this.#transitions || this.#transitions.applying) return;\n const trigger = this.#trigger;\n this.#trigger = 'api';\n\n const settled = this.#transitions.request(value, trigger);\n this.#settled = settled;\n void settled.then(() => {\n if (this.#settled === settled) this.#settled = null;\n });\n }\n\n /** @returns {Device} Which theme bucket the viewport currently falls in. */\n get device() {\n return this.#breakpoint.device;\n }\n\n /**\n * The theme in force for this device, every gap filled in.\n *\n * @returns {ResolvedTheme}\n */\n get currentTheme() {\n return this.#themes.current;\n }\n\n /** @returns {Labels} */\n get currentLabels() {\n return resolveLabels(this.locale, this.labels);\n }\n\n /**\n * The language in force: the `locale` property, else the document's.\n * Labels and timestamps both read it, so a page in Japanese does not end up\n * with Japanese buttons and American clock times.\n *\n * @returns {string | undefined}\n */\n get resolvedLocale() {\n return resolveLocale(this.locale);\n }\n\n /** @returns {ChatState} What the DOM is showing, which lags `state` while animating. */\n get renderedState() {\n return this.#transitions.renderedState;\n }\n\n /** @returns {boolean} True when messages arrived while the reader was scrolled up. */\n get hasUnseen() {\n return this.#scroll.hasUnseen;\n }\n\n /**\n * What is currently typed in the composer.\n *\n * Not a reactive property on purpose: a keystroke would otherwise re-render\n * the whole shadow tree, every message included.\n *\n * @type {string}\n */\n get value() {\n return this.#composer.value;\n }\n\n set value(next) {\n this.#composer.value = next;\n }\n\n /** @returns {boolean} Whether what is typed could be sent right now. */\n get canSend() {\n return this.#composer.canSend;\n }\n\n // --- public API -------------------------------------------------------\n\n /** @returns {Promise<boolean>} Resolves once the open animation has finished. */\n open() {\n return this.#go('open', 'api');\n }\n\n /** @returns {Promise<boolean>} */\n close() {\n return this.#go('closed', 'api');\n }\n\n /** @returns {Promise<boolean>} */\n hide() {\n return this.#go('hidden', 'api');\n }\n\n /** @returns {Promise<boolean>} From `hidden` back to the launcher. A no-op otherwise. */\n show() {\n return this.#state === 'hidden' ? this.#go('closed', 'api') : Promise.resolve(true);\n }\n\n /** @returns {Promise<boolean>} */\n toggle() {\n return this.#go(this.state === 'open' ? 'closed' : 'open', 'api');\n }\n\n /**\n * Send what is in the composer, or the given text, as `chat-submit`.\n *\n * Adding the message to `messages` stays the consumer's job; the widget only\n * reports that someone pressed send.\n *\n * @param {string} [text]\n * @returns {boolean} False when there was nothing to send.\n */\n submit(text) {\n return this.#composer.submit(text);\n }\n\n /** Empty the composer and put the caret back in it. */\n clearInput() {\n this.#composer.clear();\n }\n\n /**\n * Scroll the conversation to the newest message.\n *\n * @param {{ smooth?: boolean }} [options]\n */\n scrollToBottom(options) {\n this.#scroll.scrollToBottom(options);\n }\n\n /**\n * The content container of one message, once it has been drawn.\n *\n * @param {string} id\n * @returns {HTMLElement | null}\n */\n getMessageElement(id) {\n return /** @type {HTMLElement | null} */ (\n this.renderRoot.querySelector(`[part~=\"message\"][data-id=\"${CSS.escape(id)}\"] [part~=\"message-content\"]`)\n );\n }\n\n /**\n * Put the caret in the composer.\n *\n * This obeys the caller, not `focusOnOpen`: someone who calls it has asked\n * for focus. `focusOnOpen` only governs what happens by itself on open.\n *\n * @returns {boolean} False when there is no composer to focus.\n */\n focusInput() {\n const input = /** @type {HTMLElement | null} */ (\n this.renderRoot.querySelector('[part~=\"input\"]')\n );\n if (!input) return false;\n input.focus();\n return true;\n }\n\n /**\n * What the widget does with focus when the panel finishes opening.\n *\n * 'never' means exactly that: focus is left wherever the person had it, so a\n * widget that opens on its own does not steal the caret out of a form on the\n * page. Otherwise the composer takes it, or the panel does when there is no\n * composer, so that Esc and screen-reader navigation start inside the dialog.\n */\n #applyOpenFocus() {\n if (this.focusOnOpen === 'never') return;\n if (this.focusOnOpen === 'auto' && this.device === 'mobile') return;\n if (this.focusInput()) return;\n\n const panel = /** @type {HTMLElement | null} */ (\n this.renderRoot.querySelector('[part~=\"panel\"]')\n );\n panel?.focus();\n }\n\n // --- composer plumbing, called by the render functions ------------------\n\n /** @param {Event} event */\n handleInput(event) {\n this.#composer.onInput(event);\n }\n\n /** @param {KeyboardEvent} event */\n handleKeydown(event) {\n this.#composer.onKeydown(event);\n }\n\n /** @param {boolean} started */\n handleComposition(started) {\n if (started) this.#composer.onCompositionStart();\n else this.#composer.onCompositionEnd();\n }\n\n // --- internal ---------------------------------------------------------\n\n /**\n * Render a consumer-supplied typing bubble.\n *\n * @param {string} markup\n * @returns {unknown}\n */\n renderTypingHtml(markup) {\n return unsafeHTML(this.sanitize ? this.sanitize(markup) : markup);\n }\n\n /**\n * Re-publish a click inside a message as `chat-message-click`.\n *\n * `composedPath()[0]` rather than `event.target`: the target is retargeted to\n * the message container once the event leaves a component's shadow root, and\n * the consumer wants the element actually clicked.\n *\n * @param {MouseEvent} event\n */\n handleMessageClick(event) {\n const path = event.composedPath();\n const article = /** @type {HTMLElement | undefined} */ (\n path.find(\n (node) =>\n node instanceof HTMLElement && node.getAttribute('part')?.split(/\\s+/).includes('message'),\n )\n );\n if (!article) return;\n\n const id = article.dataset.id;\n const message = this.messages.find((candidate) => candidate.id === id);\n if (!message) return;\n\n const target = /** @type {Element} */ (path[0]);\n const allowed = emit(\n this,\n Events.MESSAGE_CLICK,\n { message, target, originalEvent: event },\n { cancelable: true },\n );\n if (!allowed) event.preventDefault();\n }\n\n /** Called by the launcher; the resulting events report `trigger: 'user'`. */\n toggleFromUser() {\n return this.#go(this.state === 'open' ? 'closed' : 'open', 'user');\n }\n\n /** Called by the close button and by Esc. */\n closeFromUser() {\n return this.#go('closed', 'user');\n }\n\n /**\n * @param {ChatState} to\n * @param {Trigger} trigger\n * @returns {Promise<boolean>}\n */\n #go(to, trigger) {\n if (to !== this.#state) {\n this.#trigger = trigger;\n this.state = to;\n }\n return this.#settled ?? Promise.resolve(true);\n }\n\n /**\n * Which effect and how long, for one leg of a transition.\n *\n * Leaving for `hidden` uses the hidden theme's exit; every other leg uses the\n * theme of the state being left or entered.\n *\n * @param {ChatState} from\n * @param {ChatState} to\n * @param {'enter' | 'exit'} phase\n * @returns {{ effect: Effect, duration: number }}\n */\n #animationFor(from, to, phase) {\n const theme = this.currentTheme;\n\n if (phase === 'exit' && to === 'hidden') {\n return { effect: theme.hidden.animation.exit, duration: theme.hidden.animation.duration };\n }\n\n const source = (phase === 'exit' ? from : to) === 'open' ? theme.open : theme.closed;\n return {\n effect: phase === 'exit' ? source.animation.exit : source.animation.enter,\n duration: source.animation.duration,\n };\n }\n\n /** @override */\n willUpdate() {\n // Order matters: the breakpoint decides the device, and the device decides\n // which `closed` settings the theme resolves to.\n this.#breakpoint.observe(ThemeController.breakpointOf(this.theme));\n this.#themes.apply(this.theme, this.#breakpoint.device);\n\n this.#messageSheet.write(this.messageStyles ?? '', this.renderRoot);\n\n const theme = this.currentTheme;\n this.dataset.launcherPosition = theme.closed.position;\n this.dataset.panelPosition = theme.open.position;\n this.dataset.idle = theme.closed.animation.idle;\n }\n\n /** @override */\n updated() {\n const live = new Set(this.messages.map((message) => message.id));\n pruneComponents(this, live);\n this.#announceRenders(live);\n }\n\n /**\n * Fire `chat-message-render` for messages that were drawn for the first time\n * or whose content changed.\n *\n * Only the content matters here: a status or streaming flag flipping redraws\n * the bubble but leaves the consumer's markup alone, and firing then would\n * make listeners re-bind on every token of a streamed reply.\n *\n * @param {Set<string>} live\n */\n #announceRenders(live) {\n for (const id of this.#renderedContent.keys()) {\n if (!live.has(id)) this.#renderedContent.delete(id);\n }\n\n for (const message of this.messages) {\n const key = contentKey(message);\n if (this.#renderedContent.has(message.id) && Object.is(this.#renderedContent.get(message.id), key)) {\n continue;\n }\n this.#renderedContent.set(message.id, key);\n\n const element = this.getMessageElement(message.id);\n if (!element) continue;\n emit(this, Events.MESSAGE_RENDER, {\n message,\n element,\n instance: componentInstance(this, message.id),\n });\n }\n }\n\n /** @override */\n render() {\n const shown = this.renderedState;\n const showLauncher =\n shown === 'closed' || (shown === 'open' && this.currentTheme.open.launcher === 'visible');\n const showPanel = shown === 'open';\n\n return html`\n ${showLauncher ? renderLauncher(this) : nothing} ${showPanel ? renderPanel(this) : nothing}\n `;\n }\n}\n","// @ts-check\nimport { ChitUI } from './chit-ui.js';\n\nif (!customElements.get('chit-ui')) {\n customElements.define('chit-ui', ChitUI);\n}\n\nexport { ChitUI };\nexport { Events } from './events.js';\n","import{noChange as t}from\"../lit-html.js\";import{directive as s,Directive as i,PartType as r}from\"../directive.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const e=s(class extends i{constructor(t){if(super(t),t.type!==r.ATTRIBUTE||\"class\"!==t.name||t.strings?.length>2)throw Error(\"`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.\")}render(t){return\" \"+Object.keys(t).filter(s=>t[s]).join(\" \")+\" \"}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(\" \").split(/\\s/).filter(t=>\"\"!==t)));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)))}return t}});export{e as classMap};\n//# sourceMappingURL=class-map.js.map\n","import{noChange as t}from\"../lit-html.js\";import{directive as e,Directive as r,PartType as s}from\"../directive.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const n=\"important\",i=\" !\"+n,o=e(class extends r{constructor(t){if(super(t),t.type!==s.ATTRIBUTE||\"style\"!==t.name||t.strings?.length>2)throw Error(\"The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.\")}render(t){return Object.keys(t).reduce((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.includes(\"-\")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,\"-$&\").toLowerCase()}:${s};`},\"\")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(r)),this.render(r);for(const t of this.ft)null==r[t]&&(this.ft.delete(t),t.includes(\"-\")?s.removeProperty(t):s[t]=null);for(const t in r){const e=r[t];if(null!=e){this.ft.add(t);const r=\"string\"==typeof e&&e.endsWith(i);t.includes(\"-\")||r?s.setProperty(t,r?e.slice(0,-11):e,r?n:\"\"):s[t]=e}}return t}});export{o as styleMap};\n//# sourceMappingURL=style-map.js.map\n"],"names":["t","globalThis","e","ShadowRoot","ShadyCSS","nativeShadow","Document","prototype","CSSStyleSheet","s","Symbol","o","WeakMap","n$3","constructor","this","_$cssResult$","Error","cssText","styleSheet","length","get","replaceSync","set","toString","i","reduce","n","c","cssRules","r","is","defineProperty","getOwnPropertyDescriptor","h","getOwnPropertyNames","getOwnPropertySymbols","getPrototypeOf","Object","a","trustedTypes","l","emptyScript","p","reactiveElementPolyfillSupport","d","u","toAttribute","Boolean","Array","JSON","stringify","fromAttribute","Number","parse","f","b","attribute","type","String","converter","reflect","useDefault","hasChanged","metadata","litPropertyMetadata","y$1","HTMLElement","addInitializer","_$Ei","push","observedAttributes","finalize","_$Eh","keys","createProperty","state","hasOwnProperty","create","wrapped","elementProperties","noAccessor","getPropertyDescriptor","call","requestUpdate","configurable","enumerable","getPropertyOptions","Map","finalized","properties","_$Eu","elementStyles","finalizeStyles","styles","isArray","Set","flat","reverse","unshift","toLowerCase","super","_$Ep","isUpdatePending","hasUpdated","_$Em","_$Ev","_$ES","Promise","enableUpdating","_$AL","_$E_","forEach","addController","_$EO","add","renderRoot","isConnected","hostConnected","removeController","delete","size","createRenderRoot","shadowRoot","attachShadow","shadowRootOptions","adoptedStyleSheets","map","document","createElement","litNonce","setAttribute","textContent","appendChild","connectedCallback","disconnectedCallback","hostDisconnected","attributeChangedCallback","_$AK","_$ET","removeAttribute","_$Ej","hasAttribute","C","_$EP","has","_$Eq","reject","scheduleUpdate","performUpdate","shouldUpdate","willUpdate","hostUpdate","update","_$EM","_$AE","hostUpdated","firstUpdated","updated","updateComplete","getUpdateComplete","y","mode","ReactiveElement","reactiveElementVersions","createPolicy","createHTML","Math","random","toFixed","slice","createComment","v","_","m","RegExp","g","$","x","_$litType$","strings","values","w","E","for","A","P","createTreeWalker","V","S","parts","lastIndex","exec","test","startsWith","N","el","currentNode","content","firstChild","replaceWith","childNodes","nextNode","nodeType","hasAttributes","getAttributeNames","endsWith","getAttribute","split","index","name","ctor","I","L","z","H","tagName","append","data","indexOf","innerHTML","M","_$Co","_$Cl","_$litDirective$","_$AO","_$AT","_$AS","R","_$AV","_$AN","_$AD","_$AM","parentNode","_$AU","creationScope","importNode","k","nextSibling","Z","_$AI","_$Cv","_$AH","_$AA","_$AB","options","startNode","endNode","_$AR","T","iterator","O","insertBefore","createTextNode","_$AC","_$AP","remove","setConnected","element","fill","j","arguments","toggleAttribute","capture","once","passive","removeEventListener","addEventListener","handleEvent","host","B","litHtmlPolyfillSupport","litHtmlVersions","D","renderBefore","_$litPart$","renderOptions","_$Do","render","_$litElement$","litElementHydrateSupport","LitElement","litElementPolyfillSupport","litElementVersions","i$2","_$Ct","_$Ci","e$1","it","directiveName","_t","raw","resultType","Events","freeze","SUBMIT","BEFORE_OPEN","OPEN","BEFORE_CLOSE","CLOSE","HIDE","SHOW","STATE_CHANGE","INPUT","MESSAGE_RENDER","MESSAGE_CLICK","SCROLL_TOP","BREAKPOINT_CHANGE","emit","detail","cancelable","dispatchEvent","CustomEvent","bubbles","composed","PART_FOR_STATE","closed","open","hidden","StateController","resolveAnimation","keepsLauncher","onOpened","current","rendered","applying","generation","settle","stopWaiting","restoreFocusToLauncher","animation","renderedState","dataset","request","to","trigger","from","resolve","announceIntent","interrupt","assign","run","settled","focusIsInsidePanel","leaving","elementFor","launcherSurvives","animate","arriving","announceArrival","manageFocus","focus","active","activeElement","panel","contains","part","querySelector","phase","spec","effect","duration","window","matchMedia","matches","finished","finish","event","target","clearTimeout","timer","style","removeProperty","anim","setProperty","setTimeout","BreakpointController","query","breakpoint","device","measured","onChange","observe","apply","PALETTE","CLOSED_PC","position","offset","radius","image","label","component","props","colors","background","text","shadow","enter","exit","idle","CLOSED_MOBILE_DIFF","defaultTheme","zIndex","font","family","pc","mobile","width","height","launcher","header","title","logo","avatar","accent","border","headerBackground","headerText","userBubble","userText","assistantBubble","assistantText","systemText","inputBackground","inputText","inputPlaceholder","scroll","input","maxRows","placeholder","mobileClosedDefaults","isPlainObject","value","mergeTheme","base","override","out","key","entries","undefined","resolveTheme","theme","user","perDevice","shared","resolveClosed","px","url","replace","themeToCss","declarations","themeToVariables","join","SUPPORTS_ADOPTING","AdoptedSheet","sheet","written","marker","attach","root","includes","write","css","detach","ThemeController","resolved","breakpointOf","ScrollController","preferredBehavior","viewport","resize","atBottom","hasUnseen","atTop","followAfterRender","selfScrolling","selfScrollTimer","openingJump","lastId","lastCount","behavior","unbind","messages","last","grew","newTail","id","role","bind","followBehavior","scrollNow","onScroll","onScrollEnd","inner","firstElementChild","ResizeObserver","disconnect","endSelfScroll","scrollHeight","scrollTop","clientHeight","scrollToBottom","smooth","beginSelfScroll","scrollTo","top","distance","SUPPORTS_FIELD_SIZING","CSS","supports","ComposerController","composing","justComposed","composedTimer","next","grow","syncDerived","canSend","busy","inputDisabled","trim","limit","maxLength","onInput","onCompositionStart","onCompositionEnd","onKeydown","sendOnEnter","shiftKey","altKey","ctrlKey","metaKey","isComposing","keyCode","preventDefault","submit","clear","send","disabled","counter","remaining","over","labels","currentLabels","template","overLimit","charactersLeft","abs","INSTANCES","messageKey","CONTENT_FIELDS","contentField","message","present","filter","field","contentKey","resolveComponent","source","cache","existing","registry","registered","getName","declared","tagNameOf","componentInstance","renderContent","carrier","html","unsafeHTML","sanitize","renderLauncher","currentTheme","custom","toggleFromUser","nothing","defaultIcon","defaultContent","_$AQ","dt","ut","renderMessage","meta","time","status","streaming","date","Date","isNaN","getTime","formatTime","Intl","DateTimeFormat","resolvedLocale","hour","minute","format","renderPanel","defaultPrevented","closeFromUser","close","typing","empty","conversation","handleMessageClick","repeat","renderTypingHtml","toLatest","renderMessageList","inputHidden","live","handleInput","handleKeydown","handleComposition","renderComposer","BUILT_IN","ja","sending","sent","error","en","resolveLocale","locale","documentElement","lang","hostStyles","launcherStyles","panelStyles","messageStyles","contentStyles","composerStyles","ChitUI","static","focusOnOpen","transitions","themes","composer","messageSheet","renderedContent","animationFor","applyOpenFocus","previous","then","overrides","resolveLabels","go","hide","show","toggle","clearInput","getMessageElement","escape","focusInput","started","markup","path","composedPath","article","find","node","candidate","originalEvent","launcherPosition","panelPosition","liveIds","pruneComponents","announceRenders","instance","shown","showLauncher","showPanel","customElements","define","st","nt","classList","ft"],"mappings":"AAKA,MAAMA,EAAEC,WAAWC,EAAEF,EAAEG,kBAAa,IAASH,EAAEI,UAAUJ,EAAEI,SAASC,eAAe,uBAAuBC,SAASC,WAAW,YAAYC,cAAcD,UAAUE,EAAEC,SAASC,EAAE,IAAIC,QAAO,IAAAC,EAAC,MAAQ,WAAAC,CAAYd,EAAEE,EAAES,GAAG,GAAGI,KAAKC,cAAa,EAAGL,IAAIF,EAAE,MAAMQ,MAAM,qEAAqEF,KAAKG,QAAQlB,EAAEe,KAAKf,EAAEE,CAAC,CAAC,cAAIiB,GAAa,IAAInB,EAAEe,KAAKJ,EAAE,MAAMF,EAAEM,KAAKf,EAAE,GAAGE,QAAG,IAASF,EAAE,CAAC,MAAME,OAAE,IAASO,GAAG,IAAIA,EAAEW,OAAOlB,IAAIF,EAAEW,EAAEU,IAAIZ,SAAI,IAAST,KAAKe,KAAKJ,EAAEX,EAAE,IAAIQ,eAAec,YAAYP,KAAKG,SAAShB,GAAGS,EAAEY,IAAId,EAAET,GAAG,CAAC,OAAOA,CAAC,CAAC,QAAAwB,GAAW,OAAOT,KAAKG,OAAO,GAAO,MAAgDO,EAAE,CAACzB,KAAKE,KAAK,MAAMS,EAAE,IAAIX,EAAEoB,OAAOpB,EAAE,GAAGE,EAAEwB,OAAO,CAACxB,EAAEO,EAAEE,IAAIT,EAAE,CAACF,IAAI,IAAG,IAAKA,EAAEgB,aAAa,OAAOhB,EAAEkB,QAAQ,GAAG,iBAAiBlB,EAAE,OAAOA,EAAE,MA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AAKspB,GAAG,OAAOtpB,KAAKspB,GAAG,IAAIrkB,IAAI1D,OAAOoC,KAAK5C,IAAIf,KAAKuQ,OAAOxP,GAAG,IAAI,MAAM9B,KAAKe,KAAKspB,GAAG,MAAMvoB,EAAE9B,KAAKe,KAAKspB,GAAG7iB,OAAOxH,GAAGA,EAAE4c,SAAS,KAAKnc,EAAE2W,eAAepX,GAAGS,EAAET,GAAG,MAAM,IAAI,MAAMA,KAAK8B,EAAE,CAAC,MAAM5B,EAAE4B,EAAE9B,GAAG,GAAG,MAAME,EAAE,CAACa,KAAKspB,GAAGljB,IAAInH,GAAG,MAAM8B,EAAE,iBAAiB5B,GAAGA,EAAE4M,SAASrL,IAAGzB,EAAE4c,SAAS,MAAM9a,EAAErB,EAAE6W,YAAYtX,EAAE8B,EAAE5B,EAAEwK,MAAM,GAAE,IAAKxK,EAAE4B,EAAEH,GAAE,IAAIlB,EAAET,GAAGE,CAAC,CAAC,CAAC,OAAOF,CAAC","x_google_ignoreList":[0,1,2,3,4,5,18,19,21,34,35]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./index.js";
|
|
2
|
+
export { repeat } from "lit/directives/repeat.js";
|
|
3
|
+
export { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
4
|
+
export { classMap } from "lit/directives/class-map.js";
|
|
5
|
+
export { styleMap } from "lit/directives/style-map.js";
|
|
6
|
+
export { live } from "lit/directives/live.js";
|
|
7
|
+
export { LitElement, html, css, svg, nothing, render } from "lit";
|