@liip/liipgpt 3.4.5 → 3.5.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/button/liipgpt-button.iife.js +28 -28
- package/chat/liipgpt-chat.iife.js +18 -18
- package/config/index.cjs +3 -0
- package/config/index.d.ts +3 -0
- package/config/index.js +3 -0
- package/configurator/_app/env.js +1 -1
- package/configurator/_app/immutable/chunks/BHN-XvbX.js +1 -0
- package/configurator/_app/immutable/chunks/{DFy-DHbb.js → Bl7Dshv1.js} +1 -1
- package/configurator/_app/immutable/chunks/{BUm3woLX.js → C3rp2svQ.js} +1 -1
- package/configurator/_app/immutable/chunks/{DpTUJVdo.js → C4ZlxhXX.js} +1 -1
- package/configurator/_app/immutable/chunks/CERjmziY.js +1 -0
- package/configurator/_app/immutable/chunks/{DevUxHro.js → CIVgedTF.js} +2 -2
- package/configurator/_app/immutable/chunks/{BSBRafHb.js → DeUo8Lf1.js} +1 -1
- package/configurator/_app/immutable/chunks/{CKlCoule.js → DmyuZaP9.js} +1 -1
- package/configurator/_app/immutable/chunks/{IT5xfoUt.js → DtLeqQ1v.js} +2 -2
- package/configurator/_app/immutable/chunks/{C9h8nQnw.js → uUsTAjtu.js} +1 -1
- package/configurator/_app/immutable/entry/{app.Do4fjbw-.js → app.BJg2yHRI.js} +2 -2
- package/configurator/_app/immutable/entry/start.Btv0U2yu.js +1 -0
- package/configurator/_app/immutable/nodes/{0.oIOrVwBZ.js → 0._SjuPXQw.js} +3 -2
- package/configurator/_app/immutable/nodes/{1.yPbTiS_g.js → 1.Cuv59azB.js} +1 -1
- package/configurator/_app/immutable/nodes/2.BEuUcbWs.js +46 -0
- package/configurator/_app/immutable/nodes/{3.DMRfokjC.js → 3.DvgD4bjq.js} +1 -1
- package/configurator/_app/version.json +1 -1
- package/configurator/index.html +6 -6
- package/configurator/sidebar.html +6 -6
- package/index.cjs +3 -0
- package/index.d.ts +9 -0
- package/index.js +3 -0
- package/package.json +1 -1
- package/configurator/_app/immutable/chunks/DpjyrDSa.js +0 -1
- package/configurator/_app/immutable/chunks/Dqpl7tve.js +0 -1
- package/configurator/_app/immutable/entry/start.BtlBa7Lv.js +0 -1
- package/configurator/_app/immutable/nodes/2.7uv1AOe3.js +0 -31
|
@@ -54,7 +54,7 @@ ${e}</tr>
|
|
|
54
54
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
55
55
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${En(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Dn(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+En(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Dn(e);if(i===null)return En(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${En(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:En(e.text)}},In=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},Ln=class e{options;renderer;textRenderer;constructor(e){this.options=e||bt,this.options.renderer=this.options.renderer||new Fn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new In}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
|
|
56
56
|
`+this.renderer.text(i);t?n+=this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):n+=o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Rn=class{options;block;constructor(e){this.options=e||bt}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Pn.lex:Pn.lexInline}provideParser(){return this.block?Ln.parse:Ln.parseInline}},zn=class{defaults=yt();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ln;Renderer=Fn;TextRenderer=In;Lexer=Pn;Tokenizer=Nn;Hooks=Rn;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Fn(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Nn(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Rn;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Rn.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>a.call(t,e));let n=i.call(t,e);return a.call(t,n)}:t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Pn.lex(e,t??this.defaults)}parser(e,t){return Ln.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(t==null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?Pn.lex:Pn.lexInline,s=i.hooks?i.hooks.provideParser():e?Ln.parse:Ln.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>o(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
57
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+En(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},Bn=new zn;function G(e,t){return Bn.parse(e,t)}G.options=G.setOptions=function(e){return Bn.setOptions(e),G.defaults=Bn.defaults,xt(G.defaults),G},G.getDefaults=yt,G.defaults=bt,G.use=function(...e){return Bn.use(...e),G.defaults=Bn.defaults,xt(G.defaults),G},G.walkTokens=function(e,t){return Bn.walkTokens(e,t)},G.parseInline=Bn.parseInline,G.Parser=Ln,G.parser=Ln.parse,G.Renderer=Fn,G.TextRenderer=In,G.Lexer=Pn,G.lexer=Pn.lex,G.Tokenizer=Nn,G.Hooks=Rn,G.parse=G,G.options,G.setOptions,G.use,G.walkTokens,G.parseInline,Ln.parse,Pn.lex;var Vn=e=>(Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t];n&&typeof n==`object`&&Vn(n)}),Object.freeze(e)),Hn=Vn({all:[],used:[],unused:[]}),Un=(e,t)=>{let n=vt(e);return n.addHook(`uponSanitizeElement`,function(e,t){let n=t.tagName||e.nodeName.toLowerCase();n.startsWith(`liipgpt-`)&&(t.allowedTags[n]=!0)}),n.addHook(`afterSanitizeAttributes`,function(e){if(e.tagName!==`A`||!e.getAttribute(`href`)?.startsWith(`http`)||(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`),!t||e.querySelector(`.sr-only`)))return;let n=e.ownerDocument.createElement(`span`);n.className=`sr-only`,n.textContent=` ${t}`,e.appendChild(n)}),n},Wn=class{marked;currentReferences=Hn;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new zn({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=Un(e.window,e.newTabSrText)}createFootnoteExtension=()=>{let e=this;return{extensions:[{name:`footnote`,level:`inline`,start(e){return e.match(/\[\^(\d+)\]/)?.index},tokenizer(e){let t=/^\[\^(\d+)\]/.exec(e);if(t){let[e,n]=t;return{type:`footnote`,raw:e,refNumber:n}}},renderer(t){if(t.type===`footnote`){let n=parseInt(t.refNumber)-1,r=e.currentReferences.all[n];if(!r)return console.error(`Could not find ref with index:`,n),``;let i;return r?.referenceIndex.used?i=r.referenceIndex.used:(e.currentReferences.used.push(r),e.lastUsedIndex++,i=e.lastUsedIndex,r.referenceIndex.used=i),` <liipgpt-reference-number data-all-index="${n}" data-used-index="${i}" data-source="${JSON.stringify(r).replace(/"/g,`"`)}"></liipgpt-reference-number>`}}}]}};parse(e){return this.DomPurity.sanitize(this.marked.parse(e),{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0,mathMl:!0},FORBID_TAGS:[`hr`],ADD_ATTR:[`target`]})}toHTML(e,t){this.currentReferences=t;let n=this.parse(e);return this.currentReferences=Hn,n}};function Gn(){let e,t;return{promise:new Promise((n,r)=>{t=n,e=r}),reject:e,resolve:t}}var Kn=class{promise;resolve;reject;constructor(){let{promise:e,resolve:t,reject:n}=Gn();this.promise=e,this.resolve=t,this.reject=n}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}toPromise(){return this.promise}[Symbol.toStringTag]=`Flag`},qn=class{hasValue=new Kn;currentValue;setValue(e){this.currentValue=e,this.hasValue.resolve()}cleanup(e){this.hasValue.reject(e)}getCurrentValue(){return this.currentValue}async toPromise(){return await this.hasValue,this.currentValue}then(e,t){return this.toPromise().then(e,t)}catch(e){return this.toPromise().catch(e)}finally(e){return this.toPromise().finally(e)}[Symbol.toStringTag]=`FutureValue`},Jn=e=>{try{return new URL(e).hostname}catch{return e}};function Yn(e){return e.replace(/<[^>]*>/g,``).replace(/ /g,` `).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var Xn=({url:e,considered:t,title:n,description:r,summary:i})=>{let a=Jn(e);return{url:e,considered:t,referenceIndex:{},score:0,metadata:{},display:{card:{title:n,description:r||i,badge:e},listItem:{title:n,badge:a}}}},Zn=class{store;content=new qn;backendSendsMappedRefs=!1;constructor(e){this.options=e,this.store=v({id:e.id,state:`loading`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:``,html:``,text:``},references:{all:[],used:[],unused:[]},retrievalQuestion:e.userQuestion})}pushError(e){this.options.onError?.(e),this.store.update(t=>({...t,errors:[...t.errors,e]}))}updateRequestId(e){this.store.update(t=>({...t,id:e}))}updateText(e){this.store.update(t=>{let n=t.message.markdown+e,r=this.options.markdownRenderer.toHTML(n,t.references);return{...t,state:`streaming`,message:{markdown:n,html:r,text:``}}})}finishMessage(){this.store.update(e=>{let t={...e,state:`done`};return t.references.unused=t.references.all.filter(e=>e.referenceIndex.used===void 0),t.message.text=Yn(t.message.html),this.options?.onFinish?.(t),this.content.setValue(t),t})}addReference(e){this.store.update(t=>{let n=t.references.all,r=n.length,i=[...n,{...e,referenceIndex:{all:r}}];return{...t,references:{used:t.references.used,all:i}}})}addMappedReference(e){this.backendSendsMappedRefs=!0,this.addReference(e)}addOldReference(e){this.backendSendsMappedRefs||this.addReference(Xn(e))}updateRetrievalQuestion(e){this.store.update(t=>({...t,retrievalQuestion:e}))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}},Qn=ve([A(),k(),w(),O(A()),O(k()),O(w())]),$n=M({title:A(),description:A().optional(),badge:A().optional(),breadcrumbs:O(A()).optional(),previewImage:A().optional(),date:A().datetime().optional()}),er=M({url:A().url(),score:k(),metadata:E(A(),Qn),language:A().optional()}).extend($n.shape),tr=M({componentName:T(`buttons`),data:M({caption:A().optional(),buttons:O(M({label:A(),href:A().url().optional(),value:A(),variant:j([`primary`,`secondary`,`tertiary`]).optional(),icon:A().optional(),target:A().optional()}))})}),nr=M({componentName:T(`combobox`),data:M({caption:A().optional(),placeholder:A(),values:O(M({label:A(),value:A()}))})}),rr=M({componentName:T(`alva-init`),data:M({})}),ir=M({componentName:T(`alva-score-survey`),data:M({})}),ar=M({type:T(`component`),id:A().optional(),time:A().optional(),hideAvatar:w().optional(),noSectionPadding:w().optional()}),or=xe(be(`componentName`,[tr,nr,rr,ir]),ar);j([`start`,`chat`]),be(`name`,[M({name:T(`start-page`),prefill:A().optional()}),M({name:T(`consent-page`)}),M({name:T(`chat-page`),query:A()})]);var sr=M({type:T(`user`),time:A(),message:A(),id:A().optional()});j([`idle`,`searching`,`answering`]);var cr=ve([A(),k(),w(),O(A()),O(k()),O(w())]),lr=M({url:A(),score:k(),metadata:E(A(),cr),considered:w(),display:M({card:$n,listItem:$n})}).extend({referenceIndex:M({all:k(),used:k().optional()})}),ur=M({all:O(lr),used:O(lr),unused:O(lr)}),dr=ve([j([`pii-detected`,`blocked`,`maintenance`,`rate-limit`,`server-error`,`too-short`,`too-long`,`quota-reached`,`aborted`]),T(`sse-error`),T(`client-error`),T(`unexpected-call`)]),fr=M({type:T(`bot`),time:A(),id:A(),message:M({markdown:A(),html:A(),text:A()}),references:ur,errors:O(dr),retrievalQuestion:A().optional()}),pr=fr.extend({state:j([`streaming`,`done`])}),mr=ve([ve([fr.extend({state:T(`loading`)}),pr]),sr,or]),hr=M({blocked:A(),maintenance:A(),"rate-limit":A(),"server-error":A(),"too-short":A(),"too-long":A(),"quota-reached":A(),aborted:A(),"sse-error":A(),"client-error":A(),"unexpected-call":A(),"incomplete-error":A(),"feedback-failed":A(),"speech-not-supported":A(),"speech-transcription-failed":A(),"speech-no-text-detected":A(),"speech-microphone-access-denied":A(),"pii-detected":A()}),gr=M({email:A(),creditCard:A(),ahv:A(),phoneSwiss:A(),phoneInternational:A(),swissPassport:A(),longNumber:A()}),_r=M({name:A(),namePlural:A().optional(),intro:A().optional(),placeholder:A(),values:E(A(),A())}),vr=M({action:A(),label:A(),type:j([`primary`,`secondary`]).optional()}),yr=M({hash:A(),title:A(),content:A(),actions:O(vr).optional()}),br=M({introductionTitle:A(),introductionDisclaimer:A().optional(),termsInvitationToConsent:A().optional(),chatInputPlaceholder:A(),chatInputPlaceholderListening:A().optional(),chatInputSubmit:A(),chatInputAbort:A(),chatInputStartListening:A(),chatInputStopListening:A(),referenceLink:A(),referencesDisplay:A(),referencesHide:A(),referencesTitle:A(),referencesFurtherTitle:A(),newChat:A(),maintenanceModeError:A(),messageBotLoading:A(),messageBotError:A(),messageBotDefaultError:A(),noResultsFound:A(),chatFooterText:A().optional(),scrollToBottom:A(),openButtonTitle:A().optional(),openButtonDescription:A().optional(),openMenu:A(),openInfo:A(),aboutThisChat:A().optional(),closeMenu:A(),closeChat:A(),close:A(),send:A(),thankYouForFeedback:A(),giveFeedback:A(),sendFeedback:A(),feedbackFormTitle:A(),feedbackFormMessage:A(),feedbackFormMessagePlaceholder:A(),feedbackFormEmail:A(),feedbackFormEmailPlaceholder:A(),askQuestionAgain:A(),answerGood:A(),answerBad:A(),classificationSubmit:A(),classificationThankYou:A(),classificationTitle:A(),selectLanguage:A(),languageChanged:A(),selectColorTheme:A(),lightMode:A(),darkMode:A(),ariaMainNavigation:A(),ariaMainNavigationRegion:A(),ariaGotoMainNavigation:A(),ariaAskQuestion:A(),ariaAskQuestionRegion:A(),ariaNotifications:A(),ariaPredefinedQuestions:A(),ariaPredefinedQuestionsRegion:A(),ariaChatHistory:A(),ariaOpenChat:A(),ariaQuestionFromYou:A(),ariaAnswerFromBot:A(),ariaLastAnswerNavigation:A(),ariaQuestionSent:A(),ariaAnswerReady:A(),ariaAnswerFinished:A(),ariaAskQuestionAgain:A(),ariaAnswerGood:A(),ariaAnswerBad:A(),ariaReferenceSource:A(),ariaGiveFeedback:A(),ariaLanguageChanged:A(),ariaLightSelected:A(),ariaDarkSelected:A(),ariaSettings:A(),ariaSettingsRegion:A(),ariaReferencesRegion:A(),ariaOpensInNewTab:A(),ariaPageTitle:A(),ariaCloseWithEsc:A(),ariaInfoTitle:A(),ariaFlyoutRegion:A(),ariaSelected:A(),ariaUnselected:A(),ariaAllSelected:A(),ariaAllUnselected:A(),ariaAllReseted:A(),popups:O(yr).optional(),termsAcceptButton:A().optional(),termsReadButton:A().optional(),selectors:E(A(),_r).optional(),hideSettings:A(),showSettings:A(),chooseAtLeastOneOption:A(),selectAll:A(),selectNone:A(),resetToDefaults:A(),messageTooLong:A()}),xr=j([`en`,`de`,`fr`,`it`]),Sr=ge(xr,br.partial().extend({selectors:E(A(),_r).optional()}));E(xr,hr),E(xr,gr);var Cr=M({label:A(),options:O(M({label:A(),value:k()}))}),wr=M({label:A(),icon:A(),url:A(),target:j([`_blank`,`_self`]).optional()}),Tr=M({label:A().nullable(),question:A()}),Er=M({impact:Cr.optional(),quality:Cr.optional()});M({classification:Er.optional()});var Dr=M({predefinedQuestions:O(Tr)}),Or=ve([M({maintenance:T(!0)}),M({id:A(),cID:A()})]);ge(xr,br);var kr=M({settingName:A(),iconName:A(),settingIntro:A().optional(),type:j([`single-select`,`multi-select`]),allowEmpty:w(),values:O(A()),defaultValues:O(A()).optional()}),Ar=M({before:O(mr).optional(),after:O(mr).optional()}),jr=M({init:O(mr).optional(),bot:Ar.optional(),user:Ar.optional()}),Mr=xe(M({showPredefinedQuestions:w(),showOverallFeedbackButton:w(),showOverallFeedbackEmail:w(),showCloseChatButton:w(),showContextMenu:w(),showContextInfo:w(),showReferencesByDefault:w(),showExpandedSelectors:w(),showTextFeedback:w(),inlineLayout:w(),allowAudioInput:w(),blockPII:w(),questionPrefix:A(),menu:ge(xr,O(wr)).optional(),supportedLanguages:O(xr),classification:Er.optional(),theme:ye,translations:Sr,buttonHref:A().optional(),addQueryToUrlParams:w().optional(),addRetrievalQuestionToUrlParams:w().optional(),renderKatex:w().optional(),reflectLanguageInPath:w().optional(),sendReferrer:j([`all`,`own`,`none`,`location`]).optional(),selectorsConfig:O(kr).default([]),questionLengthLimit:k().optional(),forceConsent:w().optional(),askQuestionAgain:w(),enableBackdrop:w().optional(),messageAdditions:jr.optional(),contextVersion:k().optional()}).partial(),M({theme:M({name:A().optional()}).optional()})),Nr=class{id;constructor(e){this.chatResponseData=e,this.id=this.chatResponseData.id}async isReadyForFeedback(){return await this.chatResponseData.readyForFeedback.toPromise(),!0}subscribe(e,t){return this.chatResponseData.readableStore.subscribe(e,t)}getContent(){return this.chatResponseData.content.toPromise()}abort(){return this.chatResponseData.abort()}async thumbsUp(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsUp(this.id,this.chatResponseData.question)}async thumbsDown(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsDown(this.id,this.chatResponseData.question)}async feedback(e){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.feedback(this.id,this.chatResponseData.question,e)}},K=[];for(let e=0;e<256;++e)K.push((e+256).toString(16).slice(1));function Pr(e,t=0){return(K[e[t+0]]+K[e[t+1]]+K[e[t+2]]+K[e[t+3]]+`-`+K[e[t+4]]+K[e[t+5]]+`-`+K[e[t+6]]+K[e[t+7]]+`-`+K[e[t+8]]+K[e[t+9]]+`-`+K[e[t+10]]+K[e[t+11]]+K[e[t+12]]+K[e[t+13]]+K[e[t+14]]+K[e[t+15]]).toLowerCase()}var Fr,Ir=new Uint8Array(16);function Lr(){if(!Fr){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);Fr=crypto.getRandomValues.bind(crypto)}return Fr(Ir)}var Rr={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function zr(e,t,n){e||={};let r=e.random??e.rng?.()??Lr();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Pr(r)}function Br(e,t,n){return Rr.randomUUID&&!t&&!e?Rr.randomUUID():zr(e,t,n)}var Vr={};function Hr(e,t,n){let r;if(e)r=Wr(e.random??e.rng?.()??Lr(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=Lr();Ur(Vr,e,i),r=Wr(i,Vr.msecs,Vr.seq,t,n)}return t??Pr(r)}function Ur(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function Wr(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}var Gr=new Map,Kr=class{get length(){return Gr.size}clear(){Gr.clear()}getItem(e){return Gr.get(e)||null}key(e){return Array.from(Gr.keys())[e]||null}removeItem(e){Gr.delete(e)}setItem(e,t){Gr.set(e,String(t))}},q=globalThis.localStorage??new Kr,qr=async e=>{try{let t=q.getItem(`liipgpt:uID`)||q.getItem(`uID`),n={method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:t})},r=await e.fetchData(`/login`,Or,{},n).catch(t=>(console.log(`Failed to /login use /log`,t),e.fetchData(`/log`,Or,{},n)));if(`maintenance`in r&&r.maintenance)return{mode:`maintenance`};if(!(`id`in r))throw Error(`Invalid response format: missing user id`);return q.setItem(`liipgpt:uID`,r.id),{mode:`ready`,userId:r.id}}catch(e){throw console.error(`Failed to fetch user data:`,e),e}},J=function(e,t){if(!(this instanceof J))return new J(e,t);this.url=e,t||={},this.headers=t.headers||{},this.payload=t.payload===void 0?``:t.payload,this.method=t.method||this.payload&&`POST`||`GET`,this.withCredentials=!!t.withCredentials,this.debug=!!t.debug,this.autoReconnect=t.autoReconnect===void 0?!1:t.autoReconnect,this.reconnectDelay=t.reconnectDelay===void 0?3e3:t.reconnectDelay,this.maxRetries=t.maxRetries===void 0?null:t.maxRetries,this.retryCount=0,this.reconnectTimer=null,this.useLastEventId=t.useLastEventId===void 0?!0:t.useLastEventId,this.FIELD_SEPARATOR=`:`,this.listeners={},this.xhr=null,this.readyState=J.INITIALIZING,this.progress=0,this.chunk=``,this.lastEventId=``,this._hasParsedBom=!1,this.addEventListener=function(e,t){this.listeners[e]===void 0&&(this.listeners[e]=[]),this.listeners[e].indexOf(t)===-1&&this.listeners[e].push(t)},this.removeEventListener=function(e,t){if(this.listeners[e]===void 0)return;let n=[];this.listeners[e].forEach(function(e){e!==t&&n.push(e)}),n.length===0?delete this.listeners[e]:this.listeners[e]=n},this.dispatchEvent=function(e){if(!e)return!0;this.debug&&console.debug(e),e.source=this;let t=`on`+e.type;return this.hasOwnProperty(t)&&(this[t].call(this,e),e.defaultPrevented)?!1:this.listeners[e.type]?this.listeners[e.type].every(function(t){return t(e),!e.defaultPrevented}):!0},this._markClosed=function(){if(this.xhr=null,this.progress=0,this.chunk=``,this._setReadyState(J.CLOSED),this.autoReconnect){if(this.maxRetries!==null&&this.retryCount>=this.maxRetries){this.debug&&console.debug(`SSE max retries (${this.maxRetries}) reached, stopping reconnection attempts`),this.autoReconnect=!1,this.close();return}this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.debug&&console.debug(`SSE will attempt to reconnect in ${this.reconnectDelay}ms (attempt ${this.retryCount+1}${this.maxRetries?`/`+this.maxRetries:``})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryCount++,this.stream()},this.reconnectDelay)}},this._setReadyState=function(e){let t=new CustomEvent(`readystatechange`);t.readyState=e,this.readyState=e,this.dispatchEvent(t)},this._onStreamFailure=function(e){let t=new CustomEvent(`error`);t.responseCode=e.currentTarget.status,t.data=e.currentTarget.response,this.dispatchEvent(t),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent(`abort`)),this._markClosed()},this._onStreamProgress=function(e){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300){this._onStreamFailure(e);return}this.retryCount=0;let t=this.xhr.responseText.substring(this.progress);this.progress+=t.length,!this._hasParsedBom&&this.chunk.length===0&&(t.charCodeAt(0)===65279&&(t=t.substring(1)),this._hasParsedBom=!0);let n=(this.chunk+t).split(/(\r\n\r\n|\r\r|\n\n)/g),r=n.pop();n.forEach(function(e){e.trim().length>0&&this.dispatchEvent(this._parseEventChunk(e))}.bind(this)),this.chunk=r},this._onStreamLoaded=function(e){this._onStreamProgress(e),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk=``,this._markClosed()},this._parseEventChunk=function(e){if(!e||e.length===0)return null;this.debug&&console.debug(e);let t={id:null,retry:null,data:null,event:null};if(e.split(/\n|\r\n|\r/).forEach(function(e){let n=e.indexOf(this.FIELD_SEPARATOR),r,i;if(n>0){let t=e[n+1]===` `?2:1;r=e.substring(0,n),i=e.substring(n+t)}else if(n<0)r=e,i=``;else return;r in t&&(r===`data`&&t[r]!==null?t.data+=`
|
|
57
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+En(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},Bn=new zn;function G(e,t){return Bn.parse(e,t)}G.options=G.setOptions=function(e){return Bn.setOptions(e),G.defaults=Bn.defaults,xt(G.defaults),G},G.getDefaults=yt,G.defaults=bt,G.use=function(...e){return Bn.use(...e),G.defaults=Bn.defaults,xt(G.defaults),G},G.walkTokens=function(e,t){return Bn.walkTokens(e,t)},G.parseInline=Bn.parseInline,G.Parser=Ln,G.parser=Ln.parse,G.Renderer=Fn,G.TextRenderer=In,G.Lexer=Pn,G.lexer=Pn.lex,G.Tokenizer=Nn,G.Hooks=Rn,G.parse=G,G.options,G.setOptions,G.use,G.walkTokens,G.parseInline,Ln.parse,Pn.lex;var Vn=e=>(Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t];n&&typeof n==`object`&&Vn(n)}),Object.freeze(e)),Hn=Vn({all:[],used:[],unused:[]}),Un=(e,t)=>{let n=vt(e);return n.addHook(`uponSanitizeElement`,function(e,t){let n=t.tagName||e.nodeName.toLowerCase();n.startsWith(`liipgpt-`)&&(t.allowedTags[n]=!0)}),n.addHook(`afterSanitizeAttributes`,function(e){if(e.tagName!==`A`||!e.getAttribute(`href`)?.startsWith(`http`)||(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`),!t||e.querySelector(`.sr-only`)))return;let n=e.ownerDocument.createElement(`span`);n.className=`sr-only`,n.textContent=` ${t}`,e.appendChild(n)}),n},Wn=class{marked;currentReferences=Hn;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new zn({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=Un(e.window,e.newTabSrText)}createFootnoteExtension=()=>{let e=this;return{extensions:[{name:`footnote`,level:`inline`,start(e){return e.match(/\[\^(\d+)\]/)?.index},tokenizer(e){let t=/^\[\^(\d+)\]/.exec(e);if(t){let[e,n]=t;return{type:`footnote`,raw:e,refNumber:n}}},renderer(t){if(t.type===`footnote`){let n=parseInt(t.refNumber)-1,r=e.currentReferences.all[n];if(!r)return console.error(`Could not find ref with index:`,n),``;let i;return r?.referenceIndex.used?i=r.referenceIndex.used:(e.currentReferences.used.push(r),e.lastUsedIndex++,i=e.lastUsedIndex,r.referenceIndex.used=i),` <liipgpt-reference-number data-all-index="${n}" data-used-index="${i}" data-source="${JSON.stringify(r).replace(/"/g,`"`)}"></liipgpt-reference-number>`}}}]}};parse(e){return this.DomPurity.sanitize(this.marked.parse(e),{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0,mathMl:!0},FORBID_TAGS:[`hr`],ADD_ATTR:[`target`]})}toHTML(e,t){this.currentReferences=t;let n=this.parse(e);return this.currentReferences=Hn,n}};function Gn(){let e,t;return{promise:new Promise((n,r)=>{t=n,e=r}),reject:e,resolve:t}}var Kn=class{promise;resolve;reject;constructor(){let{promise:e,resolve:t,reject:n}=Gn();this.promise=e,this.resolve=t,this.reject=n}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}toPromise(){return this.promise}[Symbol.toStringTag]=`Flag`},qn=class{hasValue=new Kn;currentValue;setValue(e){this.currentValue=e,this.hasValue.resolve()}cleanup(e){this.hasValue.reject(e)}getCurrentValue(){return this.currentValue}async toPromise(){return await this.hasValue,this.currentValue}then(e,t){return this.toPromise().then(e,t)}catch(e){return this.toPromise().catch(e)}finally(e){return this.toPromise().finally(e)}[Symbol.toStringTag]=`FutureValue`},Jn=e=>{try{return new URL(e).hostname}catch{return e}};function Yn(e){return e.replace(/<[^>]*>/g,``).replace(/ /g,` `).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var Xn=({url:e,considered:t,title:n,description:r,summary:i})=>{let a=Jn(e);return{url:e,considered:t,referenceIndex:{},score:0,metadata:{},display:{card:{title:n,description:r||i,badge:e},listItem:{title:n,badge:a}}}},Zn=class{store;content=new qn;backendSendsMappedRefs=!1;constructor(e){this.options=e,this.store=v({id:e.id,state:`loading`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:``,html:``,text:``},references:{all:[],used:[],unused:[]},retrievalQuestion:e.userQuestion})}pushError(e){this.options.onError?.(e),this.store.update(t=>({...t,errors:[...t.errors,e]}))}updateRequestId(e){this.store.update(t=>({...t,id:e}))}updateText(e){this.store.update(t=>{let n=t.message.markdown+e,r=this.options.markdownRenderer.toHTML(n,t.references);return{...t,state:`streaming`,message:{markdown:n,html:r,text:``}}})}finishMessage(){this.store.update(e=>{let t={...e,state:`done`};return t.references.unused=t.references.all.filter(e=>e.referenceIndex.used===void 0),t.message.text=Yn(t.message.html),this.options?.onFinish?.(t),this.content.setValue(t),t})}addReference(e){this.store.update(t=>{let n=t.references.all,r=n.length,i=[...n,{...e,referenceIndex:{all:r}}];return{...t,references:{used:t.references.used,all:i}}})}addMappedReference(e){this.backendSendsMappedRefs=!0,this.addReference(e)}addOldReference(e){this.backendSendsMappedRefs||this.addReference(Xn(e))}updateRetrievalQuestion(e){this.store.update(t=>({...t,retrievalQuestion:e}))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}},Qn=ve([A(),k(),w(),O(A()),O(k()),O(w())]),$n=M({title:A(),description:A().optional(),badge:A().optional(),breadcrumbs:O(A()).optional(),previewImage:A().optional(),date:A().datetime().optional()}),er=M({url:A().url(),score:k(),metadata:E(A(),Qn),language:A().optional()}).extend($n.shape),tr=M({componentName:T(`buttons`),data:M({caption:A().optional(),buttons:O(M({label:A(),href:A().url().optional(),value:A(),variant:j([`primary`,`secondary`,`tertiary`]).optional(),icon:A().optional(),target:A().optional()}))})}),nr=M({componentName:T(`combobox`),data:M({caption:A().optional(),placeholder:A(),values:O(M({label:A(),value:A()}))})}),rr=M({componentName:T(`alva-init`),data:M({})}),ir=M({componentName:T(`alva-score-survey`),data:M({})}),ar=M({type:T(`component`),id:A().optional(),time:A().optional(),hideAvatar:w().optional(),noSectionPadding:w().optional()}),or=xe(be(`componentName`,[tr,nr,rr,ir]),ar);j([`start`,`chat`]),be(`name`,[M({name:T(`start-page`),prefill:A().optional()}),M({name:T(`consent-page`)}),M({name:T(`chat-page`),query:A()})]);var sr=M({type:T(`user`),time:A(),message:A(),id:A().optional()});j([`idle`,`searching`,`answering`]);var cr=ve([A(),k(),w(),O(A()),O(k()),O(w())]),lr=M({url:A(),score:k(),metadata:E(A(),cr),considered:w(),display:M({card:$n,listItem:$n})}).extend({referenceIndex:M({all:k(),used:k().optional()})}),ur=M({all:O(lr),used:O(lr),unused:O(lr)}),dr=ve([j([`pii-detected`,`blocked`,`maintenance`,`rate-limit`,`server-error`,`too-short`,`too-long`,`quota-reached`,`aborted`]),T(`sse-error`),T(`client-error`),T(`unexpected-call`)]),fr=M({type:T(`bot`),time:A(),id:A(),message:M({markdown:A(),html:A(),text:A()}),references:ur,errors:O(dr),retrievalQuestion:A().optional()}),pr=fr.extend({state:j([`streaming`,`done`])}),mr=ve([ve([fr.extend({state:T(`loading`)}),pr]),sr,or]),hr=M({blocked:A(),maintenance:A(),"rate-limit":A(),"server-error":A(),"too-short":A(),"too-long":A(),"quota-reached":A(),aborted:A(),"sse-error":A(),"client-error":A(),"unexpected-call":A(),"incomplete-error":A(),"feedback-failed":A(),"speech-not-supported":A(),"speech-transcription-failed":A(),"speech-no-text-detected":A(),"speech-microphone-access-denied":A(),"pii-detected":A()}),gr=M({email:A(),creditCard:A(),ahv:A(),phoneSwiss:A(),phoneInternational:A(),swissPassport:A(),longNumber:A()}),_r=M({name:A(),namePlural:A().optional(),intro:A().optional(),placeholder:A(),values:E(A(),A())}),vr=M({action:A(),label:A(),type:j([`primary`,`secondary`]).optional()}),yr=M({hash:A(),title:A(),content:A(),actions:O(vr).optional()}),br=M({introductionTitle:A(),introductionDisclaimer:A().optional(),termsInvitationToConsent:A().optional(),chatInputPlaceholder:A(),chatInputPlaceholderListening:A().optional(),chatInputSubmit:A(),chatInputAbort:A(),chatInputStartListening:A(),chatInputStopListening:A(),referenceLink:A(),referencesDisplay:A(),referencesHide:A(),referencesTitle:A(),referencesFurtherTitle:A(),newChat:A(),maintenanceModeError:A(),messageBotLoading:A(),messageBotError:A(),messageBotDefaultError:A(),noResultsFound:A(),chatFooterText:A().optional(),scrollToBottom:A(),openButtonTitle:A().optional(),openButtonDescription:A().optional(),openMenu:A(),openInfo:A(),aboutThisChat:A().optional(),closeMenu:A(),closeChat:A(),close:A(),send:A(),thankYouForFeedback:A(),giveFeedback:A(),sendFeedback:A(),feedbackFormTitle:A(),feedbackFormMessage:A(),feedbackFormMessagePlaceholder:A(),feedbackFormEmail:A(),feedbackFormEmailPlaceholder:A(),askQuestionAgain:A(),answerGood:A(),answerBad:A(),classificationSubmit:A(),classificationThankYou:A(),classificationTitle:A(),selectLanguage:A(),languageChanged:A(),selectColorTheme:A(),lightMode:A(),darkMode:A(),ariaMainNavigation:A(),ariaMainNavigationRegion:A(),ariaGotoMainNavigation:A(),ariaAskQuestion:A(),ariaAskQuestionRegion:A(),ariaNotifications:A(),ariaPredefinedQuestions:A(),ariaPredefinedQuestionsRegion:A(),ariaChatHistory:A(),ariaOpenChat:A(),ariaQuestionFromYou:A(),ariaAnswerFromBot:A(),ariaLastAnswerNavigation:A(),ariaQuestionSent:A(),ariaAnswerReady:A(),ariaAnswerFinished:A(),ariaAskQuestionAgain:A(),ariaAnswerGood:A(),ariaAnswerBad:A(),ariaReferenceSource:A(),ariaGiveFeedback:A(),ariaLanguageChanged:A(),ariaLightSelected:A(),ariaDarkSelected:A(),ariaSettings:A(),ariaSettingsRegion:A(),ariaReferencesRegion:A(),ariaOpensInNewTab:A(),ariaPageTitle:A(),ariaCloseWithEsc:A(),ariaInfoTitle:A(),ariaFlyoutRegion:A(),ariaSelected:A(),ariaUnselected:A(),ariaAllSelected:A(),ariaAllUnselected:A(),ariaAllReseted:A(),popups:O(yr).optional(),termsAcceptButton:A().optional(),termsReadButton:A().optional(),selectors:E(A(),_r).optional(),hideSettings:A(),showSettings:A(),chooseAtLeastOneOption:A(),selectAll:A(),selectNone:A(),resetToDefaults:A(),messageTooLong:A()}),xr=j([`en`,`de`,`fr`,`it`]),Sr=ge(xr,br.partial().extend({selectors:E(A(),_r).optional()}));E(xr,hr),E(xr,gr);var Cr=M({label:A(),options:O(M({label:A(),value:k()}))}),wr=M({label:A(),icon:A(),url:A(),target:j([`_blank`,`_self`]).optional()}),Tr=M({label:A().nullable(),question:A()}),Er=M({impact:Cr.optional(),quality:Cr.optional()});M({classification:Er.optional()});var Dr=M({predefinedQuestions:O(Tr)}),Or=ve([M({maintenance:T(!0)}),M({id:A(),cID:A()})]);ge(xr,br);var kr=M({settingName:A(),iconName:A(),settingIntro:A().optional(),type:j([`single-select`,`multi-select`]),allowEmpty:w(),values:O(A()),defaultValues:O(A()).optional()}),Ar=M({before:O(mr).optional(),after:O(mr).optional()}),jr=M({init:O(mr).optional(),bot:Ar.optional(),user:Ar.optional()}),Mr=xe(M({showPredefinedQuestions:w(),showOverallFeedbackButton:w(),showOverallFeedbackEmail:w(),showCloseChatButton:w(),showContextMenu:w(),showContextInfo:w(),showReferencesByDefault:w(),showExpandedSelectors:w(),showTextFeedback:w(),inlineLayout:w(),allowAudioInput:w(),blockPII:w(),questionPrefix:A(),menu:ge(xr,O(wr)).optional(),supportedLanguages:O(xr),classification:Er.optional(),theme:ye,translations:Sr,buttonHref:A().optional(),addQueryToUrlParams:w().optional(),addRetrievalQuestionToUrlParams:w().optional(),renderKatex:w().optional(),reflectLanguageInPath:w().optional(),sendReferrer:j([`all`,`own`,`none`,`location`]).optional(),selectorsConfig:O(kr).default([]),questionLengthLimit:k().optional(),forceConsent:w().optional(),askQuestionAgain:w(),enableBackdrop:w().optional(),parentPageContext:M({extractSelectors:A().array().optional()}),messageAdditions:jr.optional(),contextVersion:k().optional()}).partial(),M({theme:M({name:A().optional()}).optional()})),Nr=class{id;constructor(e){this.chatResponseData=e,this.id=this.chatResponseData.id}async isReadyForFeedback(){return await this.chatResponseData.readyForFeedback.toPromise(),!0}subscribe(e,t){return this.chatResponseData.readableStore.subscribe(e,t)}getContent(){return this.chatResponseData.content.toPromise()}abort(){return this.chatResponseData.abort()}async thumbsUp(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsUp(this.id,this.chatResponseData.question)}async thumbsDown(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsDown(this.id,this.chatResponseData.question)}async feedback(e){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.feedback(this.id,this.chatResponseData.question,e)}},K=[];for(let e=0;e<256;++e)K.push((e+256).toString(16).slice(1));function Pr(e,t=0){return(K[e[t+0]]+K[e[t+1]]+K[e[t+2]]+K[e[t+3]]+`-`+K[e[t+4]]+K[e[t+5]]+`-`+K[e[t+6]]+K[e[t+7]]+`-`+K[e[t+8]]+K[e[t+9]]+`-`+K[e[t+10]]+K[e[t+11]]+K[e[t+12]]+K[e[t+13]]+K[e[t+14]]+K[e[t+15]]).toLowerCase()}var Fr,Ir=new Uint8Array(16);function Lr(){if(!Fr){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);Fr=crypto.getRandomValues.bind(crypto)}return Fr(Ir)}var Rr={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function zr(e,t,n){e||={};let r=e.random??e.rng?.()??Lr();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Pr(r)}function Br(e,t,n){return Rr.randomUUID&&!t&&!e?Rr.randomUUID():zr(e,t,n)}var Vr={};function Hr(e,t,n){let r;if(e)r=Wr(e.random??e.rng?.()??Lr(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=Lr();Ur(Vr,e,i),r=Wr(i,Vr.msecs,Vr.seq,t,n)}return t??Pr(r)}function Ur(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function Wr(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}var Gr=new Map,Kr=class{get length(){return Gr.size}clear(){Gr.clear()}getItem(e){return Gr.get(e)||null}key(e){return Array.from(Gr.keys())[e]||null}removeItem(e){Gr.delete(e)}setItem(e,t){Gr.set(e,String(t))}},q=globalThis.localStorage??new Kr,qr=async e=>{try{let t=q.getItem(`liipgpt:uID`)||q.getItem(`uID`),n={method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:t})},r=await e.fetchData(`/login`,Or,{},n).catch(t=>(console.log(`Failed to /login use /log`,t),e.fetchData(`/log`,Or,{},n)));if(`maintenance`in r&&r.maintenance)return{mode:`maintenance`};if(!(`id`in r))throw Error(`Invalid response format: missing user id`);return q.setItem(`liipgpt:uID`,r.id),{mode:`ready`,userId:r.id}}catch(e){throw console.error(`Failed to fetch user data:`,e),e}},J=function(e,t){if(!(this instanceof J))return new J(e,t);this.url=e,t||={},this.headers=t.headers||{},this.payload=t.payload===void 0?``:t.payload,this.method=t.method||this.payload&&`POST`||`GET`,this.withCredentials=!!t.withCredentials,this.debug=!!t.debug,this.autoReconnect=t.autoReconnect===void 0?!1:t.autoReconnect,this.reconnectDelay=t.reconnectDelay===void 0?3e3:t.reconnectDelay,this.maxRetries=t.maxRetries===void 0?null:t.maxRetries,this.retryCount=0,this.reconnectTimer=null,this.useLastEventId=t.useLastEventId===void 0?!0:t.useLastEventId,this.FIELD_SEPARATOR=`:`,this.listeners={},this.xhr=null,this.readyState=J.INITIALIZING,this.progress=0,this.chunk=``,this.lastEventId=``,this._hasParsedBom=!1,this.addEventListener=function(e,t){this.listeners[e]===void 0&&(this.listeners[e]=[]),this.listeners[e].indexOf(t)===-1&&this.listeners[e].push(t)},this.removeEventListener=function(e,t){if(this.listeners[e]===void 0)return;let n=[];this.listeners[e].forEach(function(e){e!==t&&n.push(e)}),n.length===0?delete this.listeners[e]:this.listeners[e]=n},this.dispatchEvent=function(e){if(!e)return!0;this.debug&&console.debug(e),e.source=this;let t=`on`+e.type;return this.hasOwnProperty(t)&&(this[t].call(this,e),e.defaultPrevented)?!1:this.listeners[e.type]?this.listeners[e.type].every(function(t){return t(e),!e.defaultPrevented}):!0},this._markClosed=function(){if(this.xhr=null,this.progress=0,this.chunk=``,this._setReadyState(J.CLOSED),this.autoReconnect){if(this.maxRetries!==null&&this.retryCount>=this.maxRetries){this.debug&&console.debug(`SSE max retries (${this.maxRetries}) reached, stopping reconnection attempts`),this.autoReconnect=!1,this.close();return}this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.debug&&console.debug(`SSE will attempt to reconnect in ${this.reconnectDelay}ms (attempt ${this.retryCount+1}${this.maxRetries?`/`+this.maxRetries:``})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryCount++,this.stream()},this.reconnectDelay)}},this._setReadyState=function(e){let t=new CustomEvent(`readystatechange`);t.readyState=e,this.readyState=e,this.dispatchEvent(t)},this._onStreamFailure=function(e){let t=new CustomEvent(`error`);t.responseCode=e.currentTarget.status,t.data=e.currentTarget.response,this.dispatchEvent(t),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent(`abort`)),this._markClosed()},this._onStreamProgress=function(e){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300){this._onStreamFailure(e);return}this.retryCount=0;let t=this.xhr.responseText.substring(this.progress);this.progress+=t.length,!this._hasParsedBom&&this.chunk.length===0&&(t.charCodeAt(0)===65279&&(t=t.substring(1)),this._hasParsedBom=!0);let n=(this.chunk+t).split(/(\r\n\r\n|\r\r|\n\n)/g),r=n.pop();n.forEach(function(e){e.trim().length>0&&this.dispatchEvent(this._parseEventChunk(e))}.bind(this)),this.chunk=r},this._onStreamLoaded=function(e){this._onStreamProgress(e),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk=``,this._markClosed()},this._parseEventChunk=function(e){if(!e||e.length===0)return null;this.debug&&console.debug(e);let t={id:null,retry:null,data:null,event:null};if(e.split(/\n|\r\n|\r/).forEach(function(e){let n=e.indexOf(this.FIELD_SEPARATOR),r,i;if(n>0){let t=e[n+1]===` `?2:1;r=e.substring(0,n),i=e.substring(n+t)}else if(n<0)r=e,i=``;else return;r in t&&(r===`data`&&t[r]!==null?t.data+=`
|
|
58
58
|
`+i:t[r]=i)}.bind(this)),t.id!==null&&t.id.indexOf(`\0`)===-1&&(this.lastEventId=t.id),t.retry!==null&&/^[0-9]+$/.test(t.retry)&&(this.reconnectDelay=parseInt(t.retry,10)),t.data===null)return null;let n=new CustomEvent(t.event||`message`);return n.id=t.id,n.data=t.data||``,n.lastEventId=this.lastEventId,n},this._onReadyStateChange=function(){if(this.xhr&&this.xhr.readyState===XMLHttpRequest.HEADERS_RECEIVED){let e={},t=this.xhr.getAllResponseHeaders().trim().split(`\r
|
|
59
59
|
`);for(let n of t){let[t,...r]=n.split(`:`),i=r.join(`:`).trim();e[t.trim().toLowerCase()]=e[t.trim().toLowerCase()]||[],e[t.trim().toLowerCase()].push(i)}let n=new CustomEvent(`open`);n.responseCode=this.xhr.status,n.headers=e,this.dispatchEvent(n),this._setReadyState(J.OPEN)}},this.stream=function(){if(!this.xhr){this._setReadyState(J.CONNECTING),this.xhr=new XMLHttpRequest,this.xhr.addEventListener(`progress`,this._onStreamProgress.bind(this)),this.xhr.addEventListener(`load`,this._onStreamLoaded.bind(this)),this.xhr.addEventListener(`readystatechange`,this._onReadyStateChange.bind(this)),this.xhr.addEventListener(`error`,this._onStreamFailure.bind(this)),this.xhr.addEventListener(`abort`,this._onStreamAbort.bind(this)),this.xhr.open(this.method,this.url);for(let e in this.headers)this.xhr.setRequestHeader(e,this.headers[e]);this.useLastEventId&&this.lastEventId.length>0&&this.xhr.setRequestHeader(`Last-Event-ID`,this.lastEventId),this.xhr.withCredentials=this.withCredentials,this.xhr.send(this.payload)}},this.close=function(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.autoReconnect=!1,this.xhr&&this.xhr.abort()},(t.start===void 0||t.start)&&this.stream()};J.INITIALIZING=-1,J.CONNECTING=0,J.OPEN=1,J.CLOSED=2;var Jr=class{eventSource;triggeredOnClose=!1;constructor(e,t,n){this.options=t,this.payload=n;let r={headers:{"content-type":`application/json`}};n&&(r.payload=JSON.stringify(n)),t.apiKey&&(r.headers[`api-key`]=t.apiKey),this.eventSource=new(t.EventSource??J)(e,r),this.eventSource.onmessage=e=>{try{let n=JSON.parse(e.data);t.onMessage(n)}catch(e){t.onError(new CustomEvent(`parse-error`,{detail:e}))}},this.eventSource.onerror=e=>{t.onError(e),this.isClosed()&&this.close()}}isClosed(){return this.eventSource.readyState===EventSource.CLOSED}close(){this.isClosed()||this.eventSource.close(),this.triggeredOnClose||(this.triggeredOnClose=!0,this.options.onClose())}},Yr=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!=null)),Xr=class{constructor(e){this.options=e}getDefaultHeaders(e={}){let t={"Content-Type":`application/json`,...e};return this.options.apiKey&&(t[`api-key`]=this.options.apiKey),t}get speechRecognitionApiKey(){return this.options.speechRecognitionApiKey}async subscribeSse(e,t={},n){let r=Yr(t);return this.options.apiKey&&(n.apiKey=this.options.apiKey),new Jr(`${this.options.apiUrl}${e}`,n,r)}async fetchData(e,t,n={},r={}){let i=`${this.options.apiUrl}${e}?${new URLSearchParams(Yr(n)).toString()}`,a={...r,headers:this.getDefaultHeaders(r?.headers)},o=await fetch(i,a);if(!o.ok){let e=await o.text();throw Error(`API request failed: ${o.status} - ${e}`)}let s=await o.json(),{success:c,data:l,error:u}=t.safeParse(s);if(this.options.strict){if(!c)throw console.error(`Server response has wrong type:
|
|
60
60
|
`,{error:u,url:i,opts:a,data:s}),Error(`Server response has wrong type: ${u.message}`);return l}else return c||console.warn(`Server response has wrong type:
|
|
@@ -86,4 +86,4 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
|
|
|
86
86
|
<p>
|
|
87
87
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mauris diam, vestibulum vitae cursus et, hendrerit sed dolor. Sed quis nisl quis ipsum tempus hendrerit. <a href="https://www.liipgpt.ch/" target="_blank">Plus d'informations <span class="sr-only">, (ouvre dans un nouvel onglet)</span></a>
|
|
88
88
|
</p>
|
|
89
|
-
`,ariaMainNavigation:`Navigation principale`,ariaMainNavigationRegion:`Navigation principale: liens, changement de langue, mode couleur`,ariaGotoMainNavigation:`Aller à la navigation principale`,ariaAskQuestion:`Saisie texte`,ariaAskQuestionRegion:`Poser une question`,ariaNotifications:`Notifications`,ariaPredefinedQuestions:`Questions prédéfinies`,ariaPredefinedQuestionsRegion:`Essayez nos questions d'exemple`,ariaChatHistory:`Historique du chat`,ariaOpenChat:`Ouvrir le chat`,ariaQuestionFromYou:`Votre question:`,ariaAnswerFromBot:`Réponse {n} de l'Assistant:`,ariaLastAnswerNavigation:`Navigation et options pour la dernière réponse`,ariaQuestionSent:`Question envoyée. Génération de la réponse en cours...`,ariaAnswerReady:`Réponse prête.`,ariaAnswerFinished:`Réponse terminée. Posez une autre question ou naviguez en arrière pour consulter l'historique du chat, donner un avis ou voir les références liées à la réponse.`,ariaAskQuestionAgain:`Copier la dernière question dans le champ de saisie pour la reposer`,ariaAnswerGood:`Évaluer cette réponse comme bonne`,ariaAnswerBad:`Évaluer cette réponse comme mauvaise`,ariaReferenceSource:`Source:`,ariaGiveFeedback:`Donner un feedback détaillé sur la réponse`,ariaLanguageChanged:`Langue française sélectionnée.`,ariaLightSelected:`Mode clair activé.`,ariaDarkSelected:`Mode sombre activé.`,ariaSettings:`Paramètres du chat`,ariaSettingsRegion:`Ajustez vos préférences de chat`,ariaReferencesRegion:`Références pour la question actuelle`,ariaOpensInNewTab:`(ouvre dans un nouvel onglet)`,ariaPageTitle:`Chatbot`,ariaCloseWithEsc:`Fermer ce contenu en appuyant sur la touche Échap`,ariaInfoTitle:`À propos de ce chatbot`,ariaFlyoutRegion:`Chatbot`,ariaSelected:`sélectionné`,ariaUnselected:`non sélectionné`,ariaAllSelected:`Tous les éléments sélectionnés`,ariaAllUnselected:`Tous les éléments non sélectionnés`,ariaAllReseted:`Éléments par défaut sélectionnés`,hideSettings:`Masquer les paramètres`,showSettings:`Paramètres`,chooseAtLeastOneOption:`Veuillez choisir au moins une option`,selectAll:`Tout sélectionner`,selectNone:`Tout désélectionner`,resetToDefaults:`Réinitialiser`,messageTooLong:`Votre message doit être plus court que {questionLengthLimit} caractères. Actuellement, il fait {questionLength} caractères`}},si=s(C(),1),ci=e=>{e??=oi;let t={};return e.de&&(t.de=(0,si.default)(oi.de,e.de)),e.en&&(t.en=(0,si.default)(oi.en,e.en)),e.fr&&(t.fr=(0,si.default)(oi.fr,e.fr)),e.it&&(t.it=(0,si.default)(oi.it,e.it)),t},li=e=>({init:e?.init??[],bot:{before:e?.bot?.before??[],after:e?.bot?.after??[]},user:{before:e?.user?.before??[],after:e?.user?.after??[]}}),ui=e=>{let t;t=e.theme?.fineGrained?ii(e.theme?.fineGrained):ri(e?.theme??{});let n=ci(e?.translations),r={...e,showPredefinedQuestions:e.showPredefinedQuestions??!0,showOverallFeedbackButton:e.showOverallFeedbackButton??!1,showOverallFeedbackEmail:e.showOverallFeedbackEmail??!0,showCloseChatButton:e.showCloseChatButton??!1,showContextInfo:e.showContextInfo??!1,showContextMenu:e.showContextMenu??!1,showReferencesByDefault:e.showReferencesByDefault??!1,showTextFeedback:e.showTextFeedback??!0,showExpandedSelectors:e.showExpandedSelectors??!1,inlineLayout:e.inlineLayout??!1,questionPrefix:e.questionPrefix??``,blockPII:e.blockPII??!1,allowAudioInput:e.allowAudioInput??!1,supportedLanguages:e.supportedLanguages??Object.keys(n),fullTheme:t,translations:n,buttonHref:e.buttonHref,addQueryToUrlParams:e.addQueryToUrlParams??!0,addRetrievalQuestionToUrlParams:e.addRetrievalQuestionToUrlParams??!1,renderKatex:e.renderKatex??!1,sendReferrer:e.sendReferrer??`all`,selectorsConfig:e.selectorsConfig??[],questionLengthLimit:e.questionLengthLimit??600,forceConsent:e.forceConsent??!1,askQuestionAgain:e.askQuestionAgain??!1,enableBackdrop:e.enableBackdrop??!1,messageAdditions:li(e.messageAdditions??{}),contextVersion:e.contextVersion??0};return e.classification&&(r.classification=e.classification),e.menu&&(r.menu=e.menu),r},di={de:{aborted:`Verbindung zum Server wurde unerwartet unterbrochen. Bitte versuchen Sie es erneut.`,"client-error":`Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es erneut.`,"server-error":`Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es erneut.`,"sse-error":`Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es erneut.`,blocked:`Ihre Anfrage wurde blockiert.`,"pii-detected":`Es wurden persönliche Daten erkannt. Bitte entfernen Sie diese und versuchen Sie es erneut.`,"incomplete-error":`Ein unbekannter Fehler ist aufgetreten. Die Antwort könnte unvollständig sein.`,"unexpected-call":`Ein unbekannter Fehler ist aufgetreten. Die Antwort könnte unvollständig sein.`,"quota-reached":`Kontingent überschritten. Bitte versuchen Sie es später erneut.`,"rate-limit":`Kontingent überschritten. Bitte versuchen Sie es später erneut.`,maintenance:`Der Chat ist derzeit nicht verfügbar. Bitte versuchen Sie es später erneut.`,"too-long":`Ihre Frage war zu lang, versuchen Sie es mit einer Kürzeren.`,"too-short":`Ihre Frage war zu kurz, versuchen Sie es mit einer Längeren.`,"feedback-failed":`Feedback senden fehlgeschlagen. Bitte versuchen Sie es erneut.`,"speech-not-supported":`Spracherkennung wird nicht unterstützt.`,"speech-transcription-failed":`Sprachtranskription fehlgeschlagen.`,"speech-no-text-detected":`Kein Text in der Spracheingabe erkannt.`,"speech-microphone-access-denied":`Mikrofonzugriff verweigert.`},en:{aborted:`Connection to the server was unexpectedly interrupted. Please try again.`,"client-error":`An unknown error has occurred. Please try again.`,"server-error":`An unknown error has occurred. Please try again.`,"sse-error":`An unknown error has occurred. Please try again.`,blocked:`Your request has been blocked.`,"pii-detected":`Personal data has been detected. Please remove it and try again.`,"incomplete-error":`An unknown error has occurred. The response might be incomplete.`,"unexpected-call":`An unknown error has occurred. The response might be incomplete.`,"quota-reached":`Quota exceeded. Please try again later.`,"rate-limit":`Quota exceeded. Please try again later.`,maintenance:`The chat is currently unavailable. Please try again later.`,"too-long":`Your question was too long, try a shorter one.`,"too-short":`Your question was too short, try a longer one.`,"feedback-failed":`Failed to send feedback. Please try again.`,"speech-not-supported":`Speech recognition is not supported.`,"speech-transcription-failed":`Speech transcription failed.`,"speech-no-text-detected":`No text detected in speech input.`,"speech-microphone-access-denied":`Microphone access denied.`},it:{aborted:`La connessione al server è stata interrotta inaspettatamente. Si prega di riprovare.`,"client-error":`Si è verificato un errore sconosciuto. Si prega di riprovare.`,"server-error":`Si è verificato un errore sconosciuto. Si prega di riprovare.`,"sse-error":`Si è verificato un errore sconosciuto. Si prega di riprovare.`,blocked:`La tua richiesta è stata bloccata.`,"pii-detected":`Sono stati rilevati dati personali. Si prega di rimuoverli e riprovare.`,"incomplete-error":`Si è verificato un errore sconosciuto. La risposta potrebbe essere incompleta.`,"unexpected-call":`Si è verificato un errore sconosciuto. La risposta potrebbe essere incompleta.`,"quota-reached":`Quota superata. Si prega di riprovare più tardi.`,"rate-limit":`Quota superata. Si prega di riprovare più tardi.`,maintenance:`La chat non è attualmente disponibile. Si prega di riprovare più tardi.`,"too-long":`La tua domanda era troppo lunga, prova con una più breve.`,"too-short":`La tua domanda era troppo breve, prova con una più lunga.`,"feedback-failed":`Invio del feedback non riuscito. Si prega di riprovare.`,"speech-not-supported":`Il riconoscimento vocale non è supportato.`,"speech-transcription-failed":`Trascrizione vocale fallita.`,"speech-no-text-detected":`Nessun testo rilevato nell'input vocale.`,"speech-microphone-access-denied":`Accesso al microfono negato.`},fr:{aborted:`La connexion au serveur a été interrompue de façon inattendue. Veuillez réessayer.`,"client-error":`Une erreur inconnue s'est produite. Veuillez réessayer.`,"server-error":`Une erreur inconnue s'est produite. Veuillez réessayer.`,"sse-error":`Une erreur inconnue s'est produite. Veuillez réessayer.`,"pii-detected":`Des données personnelles ont été détectées. Veuillez les supprimer et réessayer.`,blocked:`Votre demande a été bloquée.`,"incomplete-error":`Une erreur inconnue s'est produite. La réponse pourrait être incomplète.`,"unexpected-call":`Une erreur inconnue s'est produite. La réponse pourrait être incomplète.`,"quota-reached":`Quota dépassé. Veuillez réessayer plus tard.`,"rate-limit":`Quota dépassé. Veuillez réessayer plus tard.`,maintenance:`Le chat est actuellement indisponible. Veuillez réessayer plus tard.`,"too-long":`Votre question était trop longue, essayez d'en poser une plus courte.`,"too-short":`Votre question était trop courte, essayez d'en poser une plus longue.`,"feedback-failed":`Échec de l'envoi du feedback. Veuillez réessayer.`,"speech-not-supported":`La reconnaissance vocale n'est pas prise en charge.`,"speech-transcription-failed":`Échec de la transcription vocale.`,"speech-no-text-detected":`Aucun texte détecté dans l'entrée vocale.`,"speech-microphone-access-denied":`Accès au microphone refusé.`}},fi={de:{email:`Bitte keine E-Mail Adressen eingeben`,creditCard:`Bitte keine Kreditkarteninformationen eingeben`,ahv:`Bitte keine AHV-Nummern eingeben`,phoneSwiss:`Bitte keine Telefonnummern eingeben`,phoneInternational:`Bitte keine Telefonnummern eingeben`,swissPassport:`Bitte keine Passinformationen eingeben`,longNumber:`Bitte keine langen Nummern eingeben`},en:{email:`Please do not enter email addresses`,creditCard:`Please do not enter credit card information`,ahv:`Please do not enter AHV numbers`,phoneSwiss:`Please do not enter phone numbers`,phoneInternational:`Please do not enter phone numbers`,swissPassport:`Please do not enter passport information`,longNumber:`Please do not enter long numbers`},it:{email:`Si prega di non inserire indirizzi email`,creditCard:`Si prega di non inserire informazioni sulla carta di credito`,ahv:`Si prega di non inserire numeri AVS`,phoneSwiss:`Si prega di non inserire numeri di telefono`,phoneInternational:`Si prega di non inserire numeri di telefono`,swissPassport:`Si prega di non inserire informazioni sul passaporto`,longNumber:`Si prega di non inserire numeri lunghi`},fr:{email:`Veuillez ne pas saisir d'adresses e-mail`,creditCard:`Veuillez ne pas saisir d'informations de carte de crédit`,ahv:`Veuillez ne pas saisir de numéros AVS`,phoneSwiss:`Veuillez ne pas saisir de numéros de téléphone`,phoneInternational:`Veuillez ne pas saisir de numéros de téléphone`,swissPassport:`Veuillez ne pas saisir d'informations de passeport`,longNumber:`Veuillez ne pas saisir de longs numéros`}},pi=Object.assign({"./default/fallback.translations.ts":ai}),mi=new Map;Object.entries(pi).forEach(([e,t])=>{let{error:n,data:r}=Sr.safeParse(t?.translations);if(n){console.error(`Invalid translations in ${e}:`,n);return}mi.set(Se(e),r)}),Array.from(mi.keys());var hi=(e,t)=>t.includes(e),gi=(e,t)=>{if(hi(e,t))return e;let n=_i();return hi(n,t)?n:`en`},_i=()=>navigator.language.split(`-`)[0],vi=(e,t)=>{localStorage.setItem(`liipgpt:selectedLanguage`,e),t&&(t.lang=e)},yi=e=>gi(localStorage.getItem(`liipgpt:selectedLanguage`),e),bi=te(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}}));function xi(...e){return e.filter(Boolean).join(` `)}var Si=typeof document<`u`,Ci=typeof window<`u`?window:void 0;typeof window<`u`&&window.document,typeof window<`u`&&window.navigator,typeof window<`u`&&window.location;function wi(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}var Ti=class extends Map{#e=new Map;#t=t(0);#n=t(0);#r=pe||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return pe===this.#r?t(e):ee(e)}has(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else return b(this.#t),!1;return b(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else{b(this.#t);return}return b(n),super.get(e)}set(e,t){var n=this.#e,r=n.get(e),i=super.get(e),a=super.set(e,t),o=this.#t;if(r===void 0)r=this.#i(0),n.set(e,r),x(this.#n,super.size),_(o);else if(i!==t){_(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&_(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),x(n,-1)),r&&(x(this.#n,super.size),_(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;x(this.#n,0);for(var t of e.values())x(t,-1);_(this.#t),e.clear()}}#a(){b(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)b(n)}keys(){return b(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return b(this.#n),super.size}},Ei=class{#e;#t;constructor(e,t){this.#e=e,this.#t=n(t)}get current(){return this.#t(),this.#e()}},Di=/\(.+\)/,Oi=new Set([`all`,`print`,`screen`,`and`,`or`,`not`,`only`]),ki=class extends Ei{constructor(e,t){let n=Di.test(e)||e.split(/[\s,]+/).some(e=>Oi.has(e.trim()))?e:`(${e})`,r=window.matchMedia(n);super(()=>r.matches,e=>me(r,`change`,e))}};new class{#e;#t;constructor(e={}){let{window:t=Ci,document:r=t?.document}=e;t!==void 0&&(this.#e=r,this.#t=n(e=>{let n=me(t,`focusin`,e),r=me(t,`focusout`,e);return()=>{n(),r()}}))}get current(){return this.#t?.(),this.#e?wi(this.#e):null}};var Ai=class{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return c(this.#t)}get(){let e=ce(this.#t);if(e===void 0)throw Error(`Context "${this.#e}" not found`);return e}getOr(e){let t=ce(this.#t);return t===void 0?e:t}set(e){return r(this.#t,e)}};function ji(e,t){switch(e){case`post`:re(t);break;case`pre`:ie(t);break}}function Mi(e,t,n,r={}){let{lazy:i=!1}=r,a=!i,o=Array.isArray(e)?[]:void 0;ji(t,()=>{let t=Array.isArray(e)?e.map(e=>e()):e();if(!a){a=!0,o=t;return}let r=de(()=>n(t,o));return o=t,r})}function Ni(e,t,n){let r=le(()=>{let i=!1;Mi(e,t,(e,t)=>{if(i){r();return}let a=n(e,t);return i=!0,a},{lazy:!0})});re(()=>r)}function Pi(e,t,n){Mi(e,`post`,t,n)}function Fi(e,t,n){Mi(e,`pre`,t,n)}Pi.pre=Fi;function Ii(e,t){Ni(e,`post`,t)}function Li(e,t){Ni(e,`pre`,t)}Ii.pre=Li;function Ri(e,t){let n,r=null;return(...i)=>new Promise(a=>{r&&r(void 0),r=a,clearTimeout(n),n=setTimeout(async()=>{let t=await e(...i);r&&=(r(t),null)},t)})}function zi(e,t){let n=0,r=null;return(...i)=>{let a=Date.now();return n&&a-n<t?r??Promise.resolve(void 0):(n=a,r=e(...i),r)}}function Bi(e,n,r={},i){let{lazy:a=!1,once:o=!1,initialValue:s,debounce:c,throttle:l}=r,u=t(S(s)),d=t(!1),f=t(void 0),p=t(S([])),m=()=>{b(p).forEach(e=>e()),x(p,[],!0)},ee=e=>{x(p,[...b(p),e],!0)},h=async(e,t,r=!1)=>{try{x(d,!0),x(f,void 0),m();let i=new AbortController;ee(()=>i.abort());let a=await n(e,t,{data:b(u),refetching:r,onCleanup:ee,signal:i.signal});return x(u,a,!0),a}catch(e){e instanceof DOMException&&e.name===`AbortError`||x(f,e,!0);return}finally{x(d,!1)}},te=c?Ri(h,c):l?zi(h,l):h,ne=Array.isArray(e)?e:[e],g;return i((t,n)=>{o&&g||(g=t,te(Array.isArray(e)?t:t[0],Array.isArray(e)?n:n?.[0]))},{lazy:a}),{get current(){return b(u)},get loading(){return b(d)},get error(){return b(f)},mutate:e=>{x(u,e,!0)},refetch:t=>{let n=ne.map(e=>e());return te(Array.isArray(e)?n:n[0],Array.isArray(e)?n:n[0],t??!0)}}}function Vi(e,t,n){return Bi(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];Pi(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}function Hi(e,t,n){return Bi(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];Pi.pre(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}Vi.pre=Hi,new Ai(`richColorsContext`);var Ui=new Ai(`<Toaster/>`),Wi=0,Gi=class{#e=t(S([]));get toasts(){return b(this.#e)}set toasts(e){x(this.#e,e,!0)}#t=t(S([]));get heights(){return b(this.#t)}set heights(e){x(this.#t,e,!0)}#n=e=>{let t=this.toasts.findIndex(t=>t.id===e);return t===-1?null:t};addToast=e=>{Si&&this.toasts.unshift(e)};updateToast=({id:e,data:t,type:n,message:r})=>{let i=this.toasts.findIndex(t=>t.id===e),a=this.toasts[i];this.toasts[i]={...a,...t,id:e,title:r,type:n,updated:!0}};create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id&&e.id?.length>0?e.id:Wi++,i=e.dismissible===void 0?e.dismissable===void 0?!0:e.dismissable:e.dismissible,a=e.type===void 0?`default`:e.type;return de(()=>{this.toasts.find(e=>e.id===r)?this.updateToast({id:r,data:e,type:a,message:t,dismissible:i}):this.addToast({...n,id:r,title:t,dismissible:i,type:a})}),r};dismiss=e=>(de(()=>{if(e===void 0){this.toasts=this.toasts.map(e=>({...e,dismiss:!0}));return}let t=this.toasts.findIndex(t=>t.id===e);this.toasts[t]&&(this.toasts[t]={...this.toasts[t],dismiss:!0})}),e);remove=e=>{if(e===void 0){this.toasts=[];return}let t=this.#n(e);if(t!==null)return this.toasts.splice(t,1),e};message=(e,t)=>this.create({...t,type:`default`,message:e});error=(e,t)=>this.create({...t,type:`error`,message:e});success=(e,t)=>this.create({...t,type:`success`,message:e});info=(e,t)=>this.create({...t,type:`info`,message:e});warning=(e,t)=>this.create({...t,type:`warning`,message:e});loading=(e,t)=>this.create({...t,type:`loading`,message:e});promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:typeof t.loading==`string`?t.loading:t.loading()}));let r=e instanceof Promise?e:e(),i=n!==void 0;return r.then(e=>{if(typeof e==`object`&&e&&`ok`in e&&typeof e.ok==`boolean`&&!e.ok){i=!1;let t=Ki(e);this.create({id:n,type:`error`,message:t})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?t.success(e):t.success;this.create({id:n,type:`success`,message:r})}}).catch(e=>{if(t.error!==void 0){i=!1;let r=typeof t.error==`function`?t.error(e):t.error;this.create({id:n,type:`error`,message:r})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally?.()}),n};custom=(e,t)=>{let n=t?.id||Wi++;return this.create({component:e,id:n,...t}),n};removeHeight=e=>{this.heights=this.heights.filter(t=>t.toastId!==e)};setHeight=e=>{let t=this.#n(e.toastId);if(t===null){this.heights.push(e);return}this.heights[t]=e};reset=()=>{this.toasts=[],this.heights=[]}};function Ki(e){return e&&typeof e==`object`&&`status`in e?`HTTP error! Status: ${e.status}`:`Error! ${e}`}var Y=new Gi;function qi(e,t){return Y.create({message:e,...t})}var Ji=class{#e=h(()=>Y.toasts.filter(e=>!e.dismiss));get toasts(){return b(this.#e)}},Yi=Object.assign(qi,{success:Y.success,info:Y.info,warning:Y.warning,error:Y.error,custom:Y.custom,message:Y.message,promise:Y.promise,dismiss:Y.dismiss,loading:Y.loading,getActiveToasts:()=>Y.toasts.filter(e=>!e.dismiss)}),Xi=e=>{let t=new Set;Object.getOwnPropertyNames(e).forEach(e=>t.add(e));let n=Object.getPrototypeOf(e);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).forEach(e=>t.add(e)),n=Object.getPrototypeOf(n);return Array.from(t)},Zi=(e,t)=>{let n={};return t.forEach(t=>{n[t]=e[t]}),n},Qi=console.warn,$i=()=>{},ea=(e,t)=>de(()=>{console.warn=$i;let n=m(t?Zi(e,t):e);return console.warn=Qi,n}),ta=e=>e&&typeof e.then==`function`,na=class{config;self;devtools;stateKeys;constructor(e,t){this.config=e,this.self=t,typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&(this.stateKeys=Xi(this.config.state),this.devtools=window.__REDUX_DEVTOOLS_EXTENSION__.connect({name:this.config.name??`updatelogic`}),this.devtools.init(this.createStateSnapshot()),this.devtools.subscribe(e=>{e.type===`DISPATCH`&&e.state}))}createStateSnapshot(){return ea(this.config.state,this.stateKeys)}sendStart(e,t){this.devtools.send({type:`→ ${e}`,args:t},this.createStateSnapshot())}sendError(e,t,n){this.devtools.send({type:`❌ ${e}`,args:t,error:n},this.createStateSnapshot())}sendSuccess(e,t,n){this.devtools.send({type:`✓ ${e}`,args:t,return:n},this.createStateSnapshot())}isIncluded(e){return this.config.excludeInDevTools?!this.config.excludeInDevTools.includes(e):!0}createProxyFunction(e,t){let n=this.devtools&&this.isIncluded(e);return typeof t==`function`?(...r)=>{if(!n)return de(()=>t.call(this.self,...r));let i=ea(r);this.sendStart(e,i);try{let n=de(()=>t.call(this.self,...r));return ta(n)?n.then(t=>(this.sendSuccess(e,i,t),t),t=>{throw this.sendError(e,i,t),t}):(this.sendSuccess(e,i,n),n)}catch(t){throw this.sendError(e,i,t),t}}:t}},ra=(e,t)=>{let n={},r=new na(e,n);return Object.keys(t).forEach(e=>{if(e===`state`||e===`name`)return;let i=t[e];n[e]=r.createProxyFunction(e,i)}),n};async function ia(){if(typeof navigator>`u`||!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return!1;try{return(await navigator.mediaDevices.enumerateDevices()).some(e=>e.kind===`audioinput`)}catch(e){return console.error(`Error checking for microphone:`,e),!1}}function aa(){return typeof window>`u`||!window.MediaRecorder?null:MediaRecorder.isTypeSupported(`audio/mp4`)?`audio/mp4`:MediaRecorder.isTypeSupported(`audio/webm`)?`audio/webm`:MediaRecorder.isTypeSupported(`audio/wav`)?`audio/wav`:null}function oa(){return typeof window>`u`?!1:!!(window.MediaRecorder&&aa())}function sa(){if(typeof window>`u`)return!1;if(`ontouchstart`in window||navigator.maxTouchPoints>0)return!0;let e=navigator.msMaxTouchPoints;return!!(`msMaxTouchPoints`in navigator&&e&&e>0)}function ca(){return typeof window>`u`?!1:!!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||sa())}var la=class{mediaRecorder=null;audioChunks=[];started=!1;starting=!1;stream=null;options;audioContext=null;analyser=null;dataArray=null;volumeUpdateInterval=null;constructor(e={}){this.options=e}async start(){if(this.started||this.starting){console.warn(`AudioRecorder: Start already in progress or already started`);return}if(!oa()||!navigator.mediaDevices){let e=Error(`MediaRecorder not supported or no microphone access`);throw this.options.onError?.(e),e}try{if(this.starting=!0,this.stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},video:!1}),!this.starting){this.stopStream(this.stream);return}this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&(console.warn(`AudioRecorder: MediaRecorder already active, stopping previous recording`),this.mediaRecorder.stop(),this.cleanup()),this.started=!0,this.starting=!1;let e=aa();if(!e)throw Error(`No supported media type found`);let t={mimeType:e};this.mediaRecorder=new MediaRecorder(this.stream,t),this.audioChunks=[],this.mediaRecorder.ondataavailable=e=>{e.data.size>0&&this.audioChunks.push(e.data)},this.mediaRecorder.onstop=async()=>{let t=this.audioChunks.length>0?new Blob(this.audioChunks,{type:e}):null;await this.options.onDataAvailable?.(t),this.options.onStop?.(),this.cleanup()},this.mediaRecorder.onerror=e=>{let t=Error(`MediaRecorder error: ${e}`);this.options.onError?.(t),this.cleanup()},this.mediaRecorder.start(),this.setupVolumeAnalysis(this.stream),this.options.onStart?.()}catch(e){this.started=!1,this.starting=!1;let t=e instanceof Error?e:Error(String(e));throw this.options.onError?.(t),t}}stop(){this.started=!1,this.starting=!1,this.volumeUpdateInterval&&=(clearInterval(this.volumeUpdateInterval),null),this.mediaRecorder&&this.mediaRecorder.state!==`inactive`?this.mediaRecorder.stop():(this.stream&&this.stopStream(this.stream),this.cleanup())}setupVolumeAnalysis(e){if(this.options.onVolumeChange)try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.8;let t=this.analyser.frequencyBinCount;this.dataArray=new Uint8Array(t),this.audioContext.createMediaStreamSource(e).connect(this.analyser),this.startVolumeMonitoring()}catch(e){console.warn(`Failed to set up volume analysis:`,e)}}startVolumeMonitoring(){!this.analyser||!this.dataArray||!this.options.onVolumeChange||(this.volumeUpdateInterval=window.setInterval(()=>{if(!this.analyser||!this.dataArray||!this.started)return;this.analyser.getByteFrequencyData(this.dataArray);let e=0;for(let t=0;t<this.dataArray.length;t++)e+=this.dataArray[t]*this.dataArray[t];let t=Math.sqrt(e/this.dataArray.length)/255;t=(t*3)**.7;let n=Math.min(100,Math.max(0,Math.round(t*100)));this.options.onVolumeChange?.(n)},100))}get recording(){return this.started&&this.mediaRecorder?.state===`recording`}get isStarting(){return this.starting}stopStream(e){e.getTracks().forEach(e=>e.stop())}cleanup(){this.volumeUpdateInterval&&=(clearInterval(this.volumeUpdateInterval),null),this.audioContext&&=(this.audioContext.close().catch(console.warn),null),this.analyser=null,this.dataArray=null,this.stream&&=(this.stopStream(this.stream),null),this.mediaRecorder=null,this.audioChunks=[],this.started=!1,this.starting=!1}static isSupported(){return oa()}static getSupportedMediaType(){return aa()}},ua=e=>(localStorage.setItem(`liipgpt-color-scheme`,e),fa([`light`,`dark`])),da=()=>{let e=localStorage.getItem(`liipgpt-color-scheme`);return e===`light`||e===`dark`?e:`system`},fa=e=>{let t=da();return t===`system`&&(t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`),e.includes(t)?t:e[0]??`light`},pa=`liipgpt:context`,ma=class{contextVersion=0;#e=t();get currentContext(){return b(this.#e)}set currentContext(e){x(this.#e,e,!0)}getFromLocalStorage(){let e=localStorage.getItem(pa);if(e){let t;try{if(t=JSON.parse(e),t.version!==this.contextVersion){localStorage.removeItem(pa);return}else return t.context}catch(e){console.error(`Failed to parse liipgpt:context`,e);return}}}storeToLocalStorage(){localStorage.setItem(`liipgpt:context`,JSON.stringify({version:X.data.chatConfig.contextVersion,context:this.currentContext}))}constructor(e){this.init=e,this.currentContext=this.getFromLocalStorage()??e.initialValue}getContext(){return m(this.currentContext)}setContextVersion(e){this.contextVersion=e}setContext(e){this.currentContext=e,this.storeToLocalStorage()}resetContext(){this.currentContext=this.init.initialValue,this.storeToLocalStorage()}updateContext(e){this.setContext(e(this.currentContext))}},ha=()=>localStorage.getItem(pa),ga=[{type:`email`,check:e=>/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b/.test(e)},{type:`creditCard`,check:e=>/\b(?:\d[ -]*?){13,16}\b/.test(e)},{type:`ahv`,check:e=>/\b756\.\d{4}\.\d{4}\.\d{2}\b/.test(e)},{type:`phoneSwiss`,check:e=>/\b0(?:\s*\d){2}(?:\s*\/\s*)?(?:\s*\d){7,}\b/.test(e)},{type:`phoneInternational`,check:e=>/(?:\+|00)(?:\s*\d){10,}\b/.test(e)},{type:`swissPassport`,check:e=>/\b[A-HJ-NP-Z](?=.*\d)[A-HJ-NP-Z0-9]{7}\b/.test(e)},{type:`longNumber`,check:e=>/\b\d{9,}\b/.test(e)}],_a=e=>{for(let t of ga)if(t.check(e))return t.type},va=`liipgpt:selectorValues`,ya=`liipgpt:selectorKnownDefaults`,ba=()=>{try{let e=q.getItem(va),t=q.getItem(ya);return e?{values:JSON.parse(e),knownDefaults:t?JSON.parse(t):{}}:null}catch{return null}},xa=e=>{let t={};for(let n of e)t[n.settingName]=n.defaultValues??(n.allowEmpty?[]:[n.values[0]]).filter(Boolean);return t},Sa=(e,t)=>{try{let n=xa(t);q.setItem(va,JSON.stringify(e)),q.setItem(ya,JSON.stringify(n))}catch(e){console.error(`Failed to save selector values:`,e)}},Ca=e=>{try{let t=ba();if(!t)return;delete t.values[e],delete t.knownDefaults[e],q.setItem(va,JSON.stringify(t.values)),q.setItem(ya,JSON.stringify(t.knownDefaults))}catch(e){console.error(`Failed to clear selector saved state:`,e)}},wa=e=>{let t=ba(),n=e.map(e=>{let n=e.defaultValues??(e.allowEmpty?[]:[e.values[0]]).filter(Boolean);if(!t?.values[e.settingName])return[e.settingName,n];let r=t.values[e.settingName],i=t.knownDefaults[e.settingName]||[],a=r.filter(t=>e.values.includes(t)),o=i.filter(e=>!n.includes(e)),s=a.filter(e=>!o.includes(e)),c=n.filter(e=>!i.includes(e)&&!s.includes(e)),l=[...s,...c];return l.length===0&&!e.allowEmpty?[e.settingName,n]:[e.settingName,l]});return Object.fromEntries(n)},Ta=class extends Error{constructor(e){super(e),this.name=`UnreachableError`}},Ea=s(bi(),1),Da=(e,t)=>{let n=new URLSearchParams(window.location.search).get(`q`);return n?{name:`chat-page`,query:n}:e&&!t?{name:`consent-page`}:{name:`start-page`}},Oa=e=>e?e.map(e=>({id:Br(),...e})):[],X=new class{#e=t(S({}));get data(){return b(this.#e)}set data(e){x(this.#e,e,!0)}#t=t(S({}));get targets(){return b(this.#t)}set targets(e){x(this.#t,e,!0)}#n=t(!1);get initialized(){return b(this.#n)}set initialized(e){x(this.#n,e,!0)}#r=t(0);get currentAudioVolume(){return b(this.#r)}set currentAudioVolume(e){x(this.#r,e,!0)}ariaLiveMessagesClearingTimeoutDuration=350;#i=t(null);get currentAudioRecorder(){return b(this.#i)}set currentAudioRecorder(e){x(this.#i,e,!0)}#a=t(!1);get isTranscribing(){return b(this.#a)}set isTranscribing(e){x(this.#a,e,!0)}#o=h(()=>{if(!this.initialized)return[];let e=this.data.chatConfig.menu;return e?e[this.data.language]??[]:[]});get menu(){return b(this.#o)}set menu(e){x(this.#o,e)}#s=h(()=>this.initialized?this.data.chatConfig.translations[this.data.language]??{}:{});get t(){return b(this.#s)}set t(e){x(this.#s,e)}#c=h(()=>this.initialized?di[this.data.language]??{}:di.en??{});get errorTranslations(){return b(this.#c)}set errorTranslations(e){x(this.#c,e)}#l=h(()=>this.initialized?fi[this.data.language]??{}:fi.en??{});get piiTranslations(){return b(this.#l)}set piiTranslations(e){x(this.#l,e)}#u=h(()=>this.initialized?this.data.currentColorScheme:`light`);get colorScheme(){return b(this.#u)}set colorScheme(e){x(this.#u,e)}#d=h(()=>this.initialized?this.data.chatConfig.fullTheme[this.data.currentColorScheme]:{});get themeBase(){return b(this.#d)}set themeBase(e){x(this.#d,e)}#f=h(()=>this.themeBase.tokens);get theme(){return b(this.#f)}set theme(e){x(this.#f,e)}#p=h(()=>{if(!this.initialized)return[];let e=[];for(let t of this.data.chatConfig.selectorsConfig)t.allowEmpty||(this.data.selectorValues[t.settingName]||[]).length===0&&e.push(t.settingName);return e});get selectorsWithErrors(){return b(this.#p)}set selectorsWithErrors(e){x(this.#p,e)}},Z,Q,ka,Aa=ra({name:`chat-logic`,state:X,excludeInDevTools:[`onInput`]},{async init(e){Q=e;let t=Q.speechRecognitionApiKey||void 0;Z=new ei({apiUrl:Q.apiUrl,apiKey:Q.apiKey,speechRecognitionApiKey:t,strict:!0});try{let e=await Z.getChatConfig();window.CHAT_CONFIG_OVERRIDE&&Object.assign(e,window.CHAT_CONFIG_OVERRIDE);let t=(await Z.getMetadata()).mode===`maintenance`;t&&this.showErrorToast(`maintenance`);let n=ui(e);Q.inlineLayout!==void 0&&(n.inlineLayout=Q.inlineLayout);let r;r=Q.lang?gi(Q.lang,n.supportedLanguages):yi(n.supportedLanguages),vi(r,X.targets.mainElement);let i=await this.getPredefinedQuestions(r),a=n.translations[r]?.ariaOpensInNewTab;a&&Z.setNewTabSrText(a);let o=[];if(n.renderKatex){let e=await he(()=>import(`https://esm.sh/marked-katex-extension@5.1.5`),[],import.meta.url).catch(e=>{console.error(`Couldn't load marked-katex-extension:`,e)});e&&(Z.setMarkedExtensions(e.default({nonStandard:!0,output:`mathml`})),o.push(`https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css`))}let s=Object.keys(n.fullTheme),c=!1;if(n.forceConsent)try{c=q.getItem(`liipgpt:termsAccepted`)===`true`}catch(e){console.warn(`Failed to load terms acceptance from storage:`,e)}X.data={currentConversationState:`idle`,chatConfig:n,language:r,predefinedQuestions:i,isInMaintenance:t,history:Oa(n.messageAdditions.init),selectedColorScheme:da(),has2ColorSchemes:s.length===2,currentColorScheme:fa(s),conversationFeedbackId:void 0,conversationFeedbackIsOpen:!1,openedPopup:void 0,props:Q,flyoutIsOpen:!1,questionHasPii:void 0,chatInputValue:``,selectorValues:wa(n.selectorsConfig),selectorsIsOpen:!1,currentReferencesAsideId:void 0,ariaLiveStatusMessage:void 0,ariaLiveStatusMessageClearingTimeout:void 0,wasReferencesAsideClosed:!1,isAsideMobile:!0,route:Da(n.forceConsent??!1,c),additionalStylesheets:o,hasOpenedOverlays:!1,isInlineLayoutContained:!1,termsAccepted:c},window.LIIPGPT_LISTENERS?.route?.(X.data.route),window.LIIPGPT_LISTENERS?.conversation?.(X.data.currentConversationState),X.data.selectorsIsOpen=X.data.chatConfig.showExpandedSelectors??!1,X.initialized=!0,this.checkForOpenedPopup(),window.addEventListener(`hashchange`,()=>{this.checkForOpenedPopup()}),this.goto(Da(n.forceConsent??!1,c),!0)}catch(e){throw Yi.error(e instanceof Error?e.message:`Failed to load the chatbot. Please reload the page.`,{duration:1e4,unstyled:!0,classes:{toast:`toast`}}),e}},setTarget(e,t){X.targets[e]=t},goto(e,t=!1){if(!(!t&&(0,Ea.default)(X.data.route,e)))switch(X.data.route=e,window.LIIPGPT_LISTENERS?.route?.(e),e.name){case`consent-page`:break;case`start-page`:e.prefill&&(X.data.chatInputValue=e.prefill);break;case`chat-page`:if(X.data.chatInputValue=e.query,this.onSubmit(),X.data.chatConfig.addQueryToUrlParams){let t=new URLSearchParams(window.location.search);t.set(`q`,e.query),history.pushState(null,``,`?${t.toString()}`)}break}},getSelectorConfig(e){let t=X.data.chatConfig.selectorsConfig.find(t=>t.settingName===e);if(!t)throw Error(`Setting ${e} not found`);return t},getPrettifiedSelectorValues(){let e=Object.entries(X.data.selectorValues).map(([e,t])=>{let n;try{n=this.getSelectorConfig(e)}catch(t){console.error(`Error getting selector config for ${e}: ${t}`);return}return n.type===`single-select`?[e,t[0]]:[e,t]}).filter(e=>!!e);return Object.fromEntries(e)},setSelectorValue(e,t){let n=this.getSelectorConfig(e);if(!n){console.warn(`Trying to set setting ${e} but it is not defined in the chat config`);return}if(n.type===`single-select`&&t.length>1){console.warn(`Trying to set multiple values for single-select setting ${e}`);return}X.data.selectorValues[e]=t,Sa(X.data.selectorValues,X.data.chatConfig.selectorsConfig)},resetSelectorToDefaults(e){let t=this.getSelectorConfig(e);if(!t){console.warn(`Trying to reset setting ${e} but it is not defined in the chat config`);return}let n=t.defaultValues??(t.allowEmpty?[]:[t.values[0]]).filter(Boolean);return Ca(e),X.data.selectorValues[e]=n,Sa(X.data.selectorValues,X.data.chatConfig.selectorsConfig),n},async getPredefinedQuestions(e){try{return Z.getPredefinedQuestions({url:window.location.origin+window.location.pathname,language:e})}catch(e){return console.warn(`Failed to load predefined questions:`,e),[]}},setColorScheme(e){X.data.selectedColorScheme=e,X.data.currentColorScheme=ua(e),this.setAriaLiveStatusMessage(e===`dark`?X.t.ariaDarkSelected:X.t.ariaLightSelected)},async abort(){await ka?.abort()},changeConversationState(e){X.data.currentConversationState=e,window.LIIPGPT_LISTENERS?.conversation?.(e)},onInput(e){X.data.chatConfig.blockPII&&(X.data.questionHasPii=_a(e)),X.data.chatInputValue=e},onSubmit(e=!1){if(X.data.questionHasPii){console.warn(`Question contains PII, not submitting:`,X.data.questionHasPii);return}let t=X.data.chatConfig.questionPrefix?`${X.data.chatConfig.questionPrefix} ${X.data.chatInputValue}`:X.data.chatInputValue;X.data.history.push(...Oa(X.data.chatConfig.messageAdditions.user.before)),X.data.history.push({type:`user`,time:new Date().toISOString(),message:X.data.chatInputValue}),X.data.history.push(...Oa(X.data.chatConfig.messageAdditions.user.after));let n=X.data.history.push(...Oa(X.data.chatConfig.messageAdditions.bot.before));X.data.history.push({id:`UNRESOLVED`,state:`loading`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:``,html:``,text:``},references:{all:[],used:[],unused:[]}});let r={features:Q.features?Q.features.trim().split(`,`):[`formatting`],onError:e=>{this.showErrorToast(e),window.LIIPGPT_LISTENERS?.error?.(e),(e===`pii-detected`||e===`blocked`)&&this.editLatestQuestion()},lang:X.data.language,selectorValues:{...this.getPrettifiedSelectorValues(),context:ha()}},i=(e,t)=>{try{let n=new URL(e),r=new URL(t);return n.origin===r.origin&&n.pathname===r.pathname}catch{return!1}},a=X.data.chatConfig.sendReferrer??`all`;if([`all`,`own`,`location`].includes(a)){let e=a===`location`||X.data.props.flyout,t;t=e?`${window.location.protocol}//${window.location.host}${window.location.pathname}`:i(document.referrer,window.location.href)?null:document.referrer;let n=a===`own`&&!X.data.props.flyout&&t&&!t.startsWith(window.location.origin);r.referrer=t&&!n?t:void 0}X.data.currentConversationId||(X.data.currentConversationId=Z.createConversationId());let o=Z.chat(X.data.currentConversationId,t,r);ka=o,X.data.lastChatResponseId=o.id,X.data.currentConversationState!==`searching`&&this.changeConversationState(`searching`),this.setAriaLiveStatusMessage(X.t.ariaQuestionSent);let s=!1,c,l=!!X.data.currentReferencesAsideId;(e&&l||!e&&X.data.chatConfig.showReferencesByDefault)&&(X.data.isAsideMobile||this.openReferencesAside(o.id)),o.subscribe(e=>{if(X.data.history[n]&&(X.data.history[n]={question:X.data.chatInputValue,...e}),X.data.chatConfig.addRetrievalQuestionToUrlParams&&e.retrievalQuestion){let t=new URLSearchParams(window.location.search);t.get(`search`)!==e.retrievalQuestion&&(t.set(`search`,e.retrievalQuestion),history.replaceState(null,``,`?${t.toString()}`))}X.data.chatConfig.showReferencesByDefault&&!X.data.wasReferencesAsideClosed&&X.data.currentReferencesAsideId!==e.id&&!X.data.isAsideMobile&&this.openReferencesAside(e.id),e.state===`streaming`&&X.data.currentConversationState!==`answering`&&this.changeConversationState(`answering`),e.state===`done`&&(this.changeConversationState(`idle`),s||(s=!0,this.setAriaLiveStatusMessage(`${X.t.ariaAnswerReady} ... ${e.message.text} ... ${X.t.ariaAnswerFinished}`),X.data.history.push(...Oa(X.data.chatConfig.messageAdditions.bot.after))),X.data.currentReferencesAsideId&&X.data.history[n].references.used.length>0?(clearTimeout(c),c=setTimeout(()=>{this.openReferencesAside(e.id)},100)):this.closeReferencesAside())}),X.data.chatInputValue=``},async onStartSpeechRecognition(){try{if(!await ia()){this.showErrorToast(`speech-not-supported`);return}if(await navigator.mediaDevices.getUserMedia({audio:!0}),la.isSupported())X.data.chatInputValue=``,X.currentAudioRecorder=new la({onDataAvailable:async e=>{X.isTranscribing=!0,await this.handleTranscription(e)},onError:()=>{this.showErrorToast(`speech-microphone-access-denied`),X.currentAudioRecorder=null,X.isTranscribing=!1},onVolumeChange:e=>{X.currentAudioVolume=e}}),X.currentAudioRecorder.start();else{this.showErrorToast(`speech-not-supported`);return}}catch(e){throw this.showErrorToast(`speech-microphone-access-denied`),X.currentAudioRecorder=null,X.isTranscribing=!1,e}},editLatestQuestion(){let e=X.data.history.findLastIndex(e=>e?.type===`user`);if(e===-1){console.error(`No last user question, available`);return}let t=X.data.history.splice(e)[0];X.data.chatInputValue=t.message},onStopSpeechRecognition(){if(X.currentAudioRecorder){let e=X.currentAudioRecorder;X.currentAudioRecorder=null,e.stop()}X.currentAudioVolume=0},async handleTranscription(e){if(!e){console.warn(`No audio data received`);return}try{let t=await Z.transcribeAudio(e,{lang:X.data.language});if(t.error){this.showErrorToast(`speech-transcription-failed`);return}if(t.transcript.trim()){if(X.data.chatConfig.blockPII&&(X.data.questionHasPii=_a(t.transcript.trim()),X.data.questionHasPii))return;X.data.chatInputValue=t.transcript.trim()}else this.showErrorToast(`speech-no-text-detected`)}catch(e){console.error(`Speech transcription error:`,e),this.showErrorToast(`speech-transcription-failed`)}finally{X.currentAudioRecorder=null,X.isTranscribing=!1,X.currentAudioVolume=0}},async onStartConversation(e){await this.abort(),X.data.history=Oa(X.data.chatConfig.messageAdditions.init),X.data.currentConversationId=Z.createConversationId(),this.goto({name:`chat-page`,query:e})},async onNewConversation(){if(await this.abort(),X.data.currentConversationId=void 0,X.data.currentReferencesAsideId=void 0,X.data.history=Oa(X.data.chatConfig.messageAdditions.init),X.data.chatConfig.addQueryToUrlParams){let e=new URLSearchParams(window.location.search);e.delete(`q`),history.pushState(null,``,`?${e.toString()}`)}this.goto({name:`start-page`})},showSuccessToast(e){Yi.success(X.t[e],{unstyled:!0,duration:3e3,classes:{toast:`toast`}})},showErrorToast(e){Yi.error(X.errorTranslations[e],{unstyled:!0,duration:3e3,classes:{toast:`toast`}})},async submitFeedback(e){try{let t=X.data.conversationFeedbackId||X.data.lastChatResponseId;if(!t)throw new Ta(`Tried to give feedback with no id.`);let n=X.data.history.find(e=>e.type===`bot`&&e.id===t);await Z.feedback(t,n?.question??``,e),setTimeout(()=>{this.showSuccessToast(`thankYouForFeedback`)},500)}catch(e){console.error(`Feedback failed:`,e),this.showErrorToast(`feedback-failed`)}},toggleReferencesAside(e){X.data.currentReferencesAsideId===e?this.closeReferencesAside():this.openReferencesAside(e)},openReferencesAside(e){X.data.currentReferencesAsideId=e,this.setOpenOverlay(!0)},closeReferencesAside(){X.data.currentReferencesAsideId=void 0,X.data.wasReferencesAsideClosed=!0,this.setOpenOverlay(!1)},setAsideMobile(e){X.data.isAsideMobile=e},openFlyout(){X.data.flyoutIsOpen=!0},closeFlyout(){X.data.flyoutIsOpen=!1},openConversationFeedback(){X.data.conversationFeedbackIsOpen=!0,this.setOpenOverlay(!0)},openMessageFeedback(e){X.data.conversationFeedbackId=e},closeFeedback(){X.data.conversationFeedbackIsOpen=!1,X.data.conversationFeedbackId=void 0,this.setOpenOverlay(!1)},setOpenOverlay(e){X.data.hasOpenedOverlays=e},setAriaLiveStatusMessage(e){X.data.ariaLiveStatusMessage=e,clearTimeout(X.data.ariaLiveStatusMessageClearingTimeout),X.data.ariaLiveStatusMessageClearingTimeout=setTimeout(()=>{X.data.ariaLiveStatusMessage=``},X.ariaLiveMessagesClearingTimeoutDuration)},closePopup(){window.location.hash=``},checkForOpenedPopup(){let e=window.location.hash.slice(1),t=X.t.popups?.find(t=>t.hash===e);t?X.data.openedPopup=t:X.data.openedPopup=void 0},async thumbs(e,t){try{let n=X.data.history.find(t=>t.type===`bot`&&t.id===e);t===`up`?await Z.thumbsUp(e,n?.question??``):await Z.thumbsDown(e,n?.question??``),this.showSuccessToast(`thankYouForFeedback`)}catch(e){console.error(`Feedback failed:`,e),this.showErrorToast(`feedback-failed`)}},async onLanguageChange(e){if(X.data.language=gi(e,X.data.chatConfig.supportedLanguages),vi(X.data.language,X.targets.mainElement),X.data.predefinedQuestions=await this.getPredefinedQuestions(X.data.language),this.setAriaLiveStatusMessage(X.t.ariaLanguageChanged),X.data.chatConfig.reflectLanguageInPath){let e=new URL(window.location.href);e.pathname=`/${X.data.language}`,window.history.replaceState({},``,e.toString())}},async acceptTerms(){X.data.termsAccepted=!0;try{q.setItem(`liipgpt:termsAccepted`,`true`)}catch(e){console.warn(`Failed to save terms acceptance to storage:`,e)}this.closePopup(),await g(),this.goto({name:`start-page`})},updateChatInput(e){X.data.chatInputValue=e}});function ja(e,t){p(t,!0);let n=y(t,`href`,7),r=y(t,`target`,7),a=y(t,`onclick`,7),s=y(t,`className`,23,()=>[]),c=y(t,`isStandalone`,7,!1),m=y(t,`children`,7),ee=y(t,`type`,7,`button`),te=y(t,`use`,7),g=y(t,`class`,7),_=fe(t,[`$$slots`,`$$events`,`$$legacy`,`$$host`,`href`,`target`,`onclick`,`className`,`isStandalone`,`children`,`type`,`use`,`class`]),re=h(()=>n()?`a`:`button`),ie=h(()=>[...Array.isArray(s())?s():s()?[s()]:[],...g()?[g()]:[]]),oe=()=>({}),ce=h(()=>te()??oe);var v={get href(){return n()},set href(e){n(e),d()},get target(){return r()},set target(e){r(e),d()},get onclick(){return a()},set onclick(e){a(e),d()},get className(){return s()},set className(e=[]){s(e),d()},get isStandalone(){return c()},set isStandalone(e=!1){c(e),d()},get children(){return m()},set children(e){m(e),d()},get type(){return ee()},set type(e=`button`){ee(e),d()},get use(){return te()},set use(e){te(e),d()},get class(){return g()},set class(e){g(e),d()}},le=o();return se(ne(le),()=>b(re),!1,(e,t)=>{u(e,e=>b(ce)?.(e)),ae(e,()=>({..._,onclick:n()?void 0:a(),type:n()?void 0:ee(),href:n(),role:n()?`link`:`button`,target:n()?r():void 0,class:b(ie),[ue]:{"open-button--standalone":c()}}));var s=o();f(ne(s),m),i(t,s)}),i(e,le),l(v)}oe(ja,{href:{},target:{},onclick:{},className:{},isStandalone:{},children:{},type:{},use:{},class:{}},[],[],{mode:`open`});function Ma(t,n){p(n,!0);let r=y(n,`css`,7),a=fe(n,[`$$slots`,`$$events`,`$$legacy`,`$$host`,`css`]),s=e=>{re(()=>{r()&&(e.innerHTML=r())})};var c={get css(){return r()},set css(e){r(e),d()}},f=o(),m=ne(f),ee=e=>{var t=o();se(ne(t),()=>`style`,!1,(e,t)=>{u(e,e=>s?.(e)),ae(e,()=>({...a}))}),i(e,t)};return e(m,e=>{r()&&e(ee)}),i(t,f),l(c)}oe(Ma,{css:{}},[],[],{mode:`open`});var Na=RegExp(`([\\p{Ll}\\d])(\\p{Lu})`,`gu`),Pa=RegExp(`(\\p{Lu})([\\p{Lu}][\\p{Ll}])`,`gu`),Fa=RegExp(`(\\d)(\\p{Ll})`,`gu`),Ia=RegExp(`(\\p{L})(\\d)`,`gu`),La=/[^\p{L}\d]+/giu,Ra=`$1\0$2`,za=``;function Ba(e,t){let n=e.trim();n=n.replace(Na,Ra).replace(Pa,Ra),t?.separateNumbers&&(n=n.replace(Fa,Ra).replace(Ia,Ra)),n=n.replace(La,`\0`);let r=0,i=n.length;for(;n.charAt(r)===`\0`;)r++;if(r===i)return[];for(;n.charAt(i-1)===`\0`;)i--;return n.slice(r,i).split(/\0/g)}function Va(e,t){return no(e,t?.prefixCharacters)+Ba(e,t).map(Qa(t?.locale)).join(t?.delimiter??` `)}function Ha(e,t){let n=no(e,t?.prefixCharacters),r=Qa(t?.locale),i=$a(t?.locale),a=t?.mergeAmbiguousCharacters?eo(r,i):to(r,i);return n+Ba(e,t).map((e,t)=>t===0?r(e):a(e,t)).join(t?.delimiter??``)}function Ua(e,t){let n=no(e,t?.prefixCharacters),r=Qa(t?.locale),i=$a(t?.locale),a=t?.mergeAmbiguousCharacters?eo(r,i):to(r,i);return n+Ba(e,t).map(a).join(t?.delimiter??``)}function Wa(e,t){let n=no(e,t?.prefixCharacters),r=Qa(t?.locale),i=$a(t?.locale);return n+Ba(e,t).map(eo(r,i)).join(t?.delimiter??` `)}function Ga(e,t){return no(e,t?.prefixCharacters)+Ba(e,t).map($a(t?.locale)).join(t?.delimiter??`_`)}function Ka(e,t){return Va(e,{delimiter:`.`,...t})}function qa(e,t){return Va(e,{delimiter:`-`,...t})}function Ja(e,t){return Va(e,{delimiter:`/`,...t})}function Ya(e,t){let n=no(e,t?.prefixCharacters),r=Qa(t?.locale),i=eo(r,$a(t?.locale));return n+Ba(e,t).map((e,t)=>t===0?i(e):r(e)).join(t?.delimiter??` `)}function Xa(e,t){return Va(e,{delimiter:`_`,...t})}function Za(e,t){return Wa(e,{delimiter:`-`,...t})}function Qa(e){return e===!1?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function $a(e){return e===!1?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function eo(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function to(e,t){return(n,r)=>{let i=n[0];return(r>0&&i>=`0`&&i<=`9`?`_`+i:t(i))+e(n.slice(1))}}function no(e,t=za){let n=``;for(let r=0;r<e.length;r++){let i=e.charAt(r);if(t.includes(i))n+=i;else break}return n}function ro(e,t){let n=``;for(let r of e)n+=Math.random()>.5?r.toLocaleUpperCase(t):r.toLocaleLowerCase(t);return n}function io(e,t){let n=``;for(let r of e){let e=r.toLocaleLowerCase(t);n+=r===e?r.toLocaleUpperCase(t):e}return n}var ao=/\b(?:an?d?|a[st]|because|but|by|en|for|i[fn]|neither|nor|o[fnr]|only|over|per|so|some|tha[tn]|the|to|up|upon|vs?\.?|versus|via|when|with|without|yet)\b/i,oo=/[^\s:–—-]+|./g,so=/\s/,co=/.(?=[A-Z]|\..)/,lo=/[A-Za-z0-9\u00C0-\u00FF]/;function uo(e){for(var t=``,n;(n=oo.exec(e))!==null;){var r=n[0],i=n.index;if(!co.test(r)&&(!ao.test(r)||i===0||i+r.length===e.length)&&(e.charAt(i+r.length)!==`:`||so.test(e.charAt(i+r.length+1)))){t+=r.replace(lo,function(e){return e.toUpperCase()});continue}t+=r}return t}var fo=Ha,po=Wa,mo=Ga,ho=Ka,go=Va,_o=Ua,vo=Ja,yo=Ya,bo=Xa,xo=Za,So=qa,Co=ro,wo=io,To=uo,Eo=e=>e.toUpperCase(),Do=(e,t)=>e.toLocaleUpperCase(t),Oo=e=>e.toLowerCase(),ko=(e,t)=>e.toLocaleLowerCase(t),Ao=e=>e.charAt(0).toLowerCase()+e.slice(1),jo=e=>e.charAt(0).toUpperCase()+e.slice(1),Mo=e=>e===e.toUpperCase(),No=e=>e===e.toLowerCase(),$=class{};$.camel=fo,$.capital=po,$.constant=mo,$.dot=ho,$.kebab=So,$.lower=Oo,$.lowerFirst=Ao,$.localeLower=ko,$.localeUpper=Do,$.no=go,$.pascal=_o,$.path=vo,$.sentence=yo,$.snake=bo,$.sponge=Co,$.swap=wo,$.title=To,$.train=xo,$.upper=Eo,$.upperFirst=jo,$.isUpper=Mo,$.isLower=No;var Po=640,Fo=1024,Io=null,Lo=()=>{if(Io)return Io;if(!globalThis.document)return 16;let e=globalThis.document.querySelector(`:root`);return Io=Number(getComputedStyle(e).fontSize.slice(0,-2)),Io},Ro=({minRem:e,maxRem:t})=>{let n=Lo(),r=Po/n,i=Fo/n,a=(t-e)/(i-r);return`clamp( ${e}rem, ${-r*a+e}rem + ${a*100}cqw, ${t}rem )`},zo=e=>typeof e==`string`?e:typeof e==`number`?String(e):typeof e==`object`?e.minRem===e.maxRem?`${e.minRem}rem`:Ro(e):``,Bo=(e,t,n,r=!1)=>{let i=``;return n.forEach(n=>{let a=t[n];r&&!a&&n===`borderWidth`&&(a=`0px`),r&&!a&&n===`borderColor`&&(a=`transparent`),a&&(i+=`--${So(e)}-${So(n)}:${zo(a)}; `)}),i},Vo=(e,t)=>Object.entries(t).map(([t,n])=>`--${e}-${So(t)}:${zo(n)}`).join(`; `)+`; `,Ho=(e,t)=>{let n=``;return n+=Bo(e,t,[`background`,`borderWidth`,`borderColor`,`boxShadow`,`borderRadius`,`color`],!0),t.hover&&(n+=Bo(`${e}-hover`,t.hover,[`background`,`borderWidth`,`borderColor`,`boxShadow`,`color`])),t.focus&&(n+=Bo(`${e}-focus`,t.focus,[`background`,`borderWidth`,`borderColor`,`boxShadow`,`color`])),t.custom&&(n+=Vo(e,t.custom)),n},Uo=(e,t)=>Object.entries(t).map(([t,n])=>`--color-${e}-${t}:${n}`).join(`; `)+`; `,Wo=e=>`--font-family: ${e?.family||`inherit`};`,Go=e=>`.chat-app {${Wo(e.font)} ${Object.entries(e.colors).map(([e,t])=>Uo(e,t)).join(``)} ${Vo(`base`,e.base)} ${Object.entries(e.components).map(([e,t])=>Ho(So(e),t)).join(``)}};`;export{Yn as S,yi as _,Aa as a,Br as b,la as c,Yi as d,Y as f,xi as g,Ti as h,X as i,ca as l,ki as m,Ma as n,ma as o,Ui as p,ja as r,fa as s,Go as t,Ji as u,gi as v,Mr as x,ui as y};
|
|
89
|
+
`,ariaMainNavigation:`Navigation principale`,ariaMainNavigationRegion:`Navigation principale: liens, changement de langue, mode couleur`,ariaGotoMainNavigation:`Aller à la navigation principale`,ariaAskQuestion:`Saisie texte`,ariaAskQuestionRegion:`Poser une question`,ariaNotifications:`Notifications`,ariaPredefinedQuestions:`Questions prédéfinies`,ariaPredefinedQuestionsRegion:`Essayez nos questions d'exemple`,ariaChatHistory:`Historique du chat`,ariaOpenChat:`Ouvrir le chat`,ariaQuestionFromYou:`Votre question:`,ariaAnswerFromBot:`Réponse {n} de l'Assistant:`,ariaLastAnswerNavigation:`Navigation et options pour la dernière réponse`,ariaQuestionSent:`Question envoyée. Génération de la réponse en cours...`,ariaAnswerReady:`Réponse prête.`,ariaAnswerFinished:`Réponse terminée. Posez une autre question ou naviguez en arrière pour consulter l'historique du chat, donner un avis ou voir les références liées à la réponse.`,ariaAskQuestionAgain:`Copier la dernière question dans le champ de saisie pour la reposer`,ariaAnswerGood:`Évaluer cette réponse comme bonne`,ariaAnswerBad:`Évaluer cette réponse comme mauvaise`,ariaReferenceSource:`Source:`,ariaGiveFeedback:`Donner un feedback détaillé sur la réponse`,ariaLanguageChanged:`Langue française sélectionnée.`,ariaLightSelected:`Mode clair activé.`,ariaDarkSelected:`Mode sombre activé.`,ariaSettings:`Paramètres du chat`,ariaSettingsRegion:`Ajustez vos préférences de chat`,ariaReferencesRegion:`Références pour la question actuelle`,ariaOpensInNewTab:`(ouvre dans un nouvel onglet)`,ariaPageTitle:`Chatbot`,ariaCloseWithEsc:`Fermer ce contenu en appuyant sur la touche Échap`,ariaInfoTitle:`À propos de ce chatbot`,ariaFlyoutRegion:`Chatbot`,ariaSelected:`sélectionné`,ariaUnselected:`non sélectionné`,ariaAllSelected:`Tous les éléments sélectionnés`,ariaAllUnselected:`Tous les éléments non sélectionnés`,ariaAllReseted:`Éléments par défaut sélectionnés`,hideSettings:`Masquer les paramètres`,showSettings:`Paramètres`,chooseAtLeastOneOption:`Veuillez choisir au moins une option`,selectAll:`Tout sélectionner`,selectNone:`Tout désélectionner`,resetToDefaults:`Réinitialiser`,messageTooLong:`Votre message doit être plus court que {questionLengthLimit} caractères. Actuellement, il fait {questionLength} caractères`}},si=s(C(),1),ci=e=>{e??=oi;let t={};return e.de&&(t.de=(0,si.default)(oi.de,e.de)),e.en&&(t.en=(0,si.default)(oi.en,e.en)),e.fr&&(t.fr=(0,si.default)(oi.fr,e.fr)),e.it&&(t.it=(0,si.default)(oi.it,e.it)),t},li=e=>({init:e?.init??[],bot:{before:e?.bot?.before??[],after:e?.bot?.after??[]},user:{before:e?.user?.before??[],after:e?.user?.after??[]}}),ui=e=>{let t;t=e.theme?.fineGrained?ii(e.theme?.fineGrained):ri(e?.theme??{});let n=ci(e?.translations),r={...e,showPredefinedQuestions:e.showPredefinedQuestions??!0,showOverallFeedbackButton:e.showOverallFeedbackButton??!1,showOverallFeedbackEmail:e.showOverallFeedbackEmail??!0,showCloseChatButton:e.showCloseChatButton??!1,showContextInfo:e.showContextInfo??!1,showContextMenu:e.showContextMenu??!1,showReferencesByDefault:e.showReferencesByDefault??!1,showTextFeedback:e.showTextFeedback??!0,showExpandedSelectors:e.showExpandedSelectors??!1,inlineLayout:e.inlineLayout??!1,questionPrefix:e.questionPrefix??``,blockPII:e.blockPII??!1,allowAudioInput:e.allowAudioInput??!1,supportedLanguages:e.supportedLanguages??Object.keys(n),fullTheme:t,translations:n,buttonHref:e.buttonHref,addQueryToUrlParams:e.addQueryToUrlParams??!0,addRetrievalQuestionToUrlParams:e.addRetrievalQuestionToUrlParams??!1,renderKatex:e.renderKatex??!1,sendReferrer:e.sendReferrer??`all`,selectorsConfig:e.selectorsConfig??[],questionLengthLimit:e.questionLengthLimit??600,forceConsent:e.forceConsent??!1,askQuestionAgain:e.askQuestionAgain??!1,enableBackdrop:e.enableBackdrop??!1,parentPageContext:e.parentPageContext??{},messageAdditions:li(e.messageAdditions??{}),contextVersion:e.contextVersion??0};return e.classification&&(r.classification=e.classification),e.menu&&(r.menu=e.menu),r},di={de:{aborted:`Verbindung zum Server wurde unerwartet unterbrochen. Bitte versuchen Sie es erneut.`,"client-error":`Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es erneut.`,"server-error":`Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es erneut.`,"sse-error":`Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es erneut.`,blocked:`Ihre Anfrage wurde blockiert.`,"pii-detected":`Es wurden persönliche Daten erkannt. Bitte entfernen Sie diese und versuchen Sie es erneut.`,"incomplete-error":`Ein unbekannter Fehler ist aufgetreten. Die Antwort könnte unvollständig sein.`,"unexpected-call":`Ein unbekannter Fehler ist aufgetreten. Die Antwort könnte unvollständig sein.`,"quota-reached":`Kontingent überschritten. Bitte versuchen Sie es später erneut.`,"rate-limit":`Kontingent überschritten. Bitte versuchen Sie es später erneut.`,maintenance:`Der Chat ist derzeit nicht verfügbar. Bitte versuchen Sie es später erneut.`,"too-long":`Ihre Frage war zu lang, versuchen Sie es mit einer Kürzeren.`,"too-short":`Ihre Frage war zu kurz, versuchen Sie es mit einer Längeren.`,"feedback-failed":`Feedback senden fehlgeschlagen. Bitte versuchen Sie es erneut.`,"speech-not-supported":`Spracherkennung wird nicht unterstützt.`,"speech-transcription-failed":`Sprachtranskription fehlgeschlagen.`,"speech-no-text-detected":`Kein Text in der Spracheingabe erkannt.`,"speech-microphone-access-denied":`Mikrofonzugriff verweigert.`},en:{aborted:`Connection to the server was unexpectedly interrupted. Please try again.`,"client-error":`An unknown error has occurred. Please try again.`,"server-error":`An unknown error has occurred. Please try again.`,"sse-error":`An unknown error has occurred. Please try again.`,blocked:`Your request has been blocked.`,"pii-detected":`Personal data has been detected. Please remove it and try again.`,"incomplete-error":`An unknown error has occurred. The response might be incomplete.`,"unexpected-call":`An unknown error has occurred. The response might be incomplete.`,"quota-reached":`Quota exceeded. Please try again later.`,"rate-limit":`Quota exceeded. Please try again later.`,maintenance:`The chat is currently unavailable. Please try again later.`,"too-long":`Your question was too long, try a shorter one.`,"too-short":`Your question was too short, try a longer one.`,"feedback-failed":`Failed to send feedback. Please try again.`,"speech-not-supported":`Speech recognition is not supported.`,"speech-transcription-failed":`Speech transcription failed.`,"speech-no-text-detected":`No text detected in speech input.`,"speech-microphone-access-denied":`Microphone access denied.`},it:{aborted:`La connessione al server è stata interrotta inaspettatamente. Si prega di riprovare.`,"client-error":`Si è verificato un errore sconosciuto. Si prega di riprovare.`,"server-error":`Si è verificato un errore sconosciuto. Si prega di riprovare.`,"sse-error":`Si è verificato un errore sconosciuto. Si prega di riprovare.`,blocked:`La tua richiesta è stata bloccata.`,"pii-detected":`Sono stati rilevati dati personali. Si prega di rimuoverli e riprovare.`,"incomplete-error":`Si è verificato un errore sconosciuto. La risposta potrebbe essere incompleta.`,"unexpected-call":`Si è verificato un errore sconosciuto. La risposta potrebbe essere incompleta.`,"quota-reached":`Quota superata. Si prega di riprovare più tardi.`,"rate-limit":`Quota superata. Si prega di riprovare più tardi.`,maintenance:`La chat non è attualmente disponibile. Si prega di riprovare più tardi.`,"too-long":`La tua domanda era troppo lunga, prova con una più breve.`,"too-short":`La tua domanda era troppo breve, prova con una più lunga.`,"feedback-failed":`Invio del feedback non riuscito. Si prega di riprovare.`,"speech-not-supported":`Il riconoscimento vocale non è supportato.`,"speech-transcription-failed":`Trascrizione vocale fallita.`,"speech-no-text-detected":`Nessun testo rilevato nell'input vocale.`,"speech-microphone-access-denied":`Accesso al microfono negato.`},fr:{aborted:`La connexion au serveur a été interrompue de façon inattendue. Veuillez réessayer.`,"client-error":`Une erreur inconnue s'est produite. Veuillez réessayer.`,"server-error":`Une erreur inconnue s'est produite. Veuillez réessayer.`,"sse-error":`Une erreur inconnue s'est produite. Veuillez réessayer.`,"pii-detected":`Des données personnelles ont été détectées. Veuillez les supprimer et réessayer.`,blocked:`Votre demande a été bloquée.`,"incomplete-error":`Une erreur inconnue s'est produite. La réponse pourrait être incomplète.`,"unexpected-call":`Une erreur inconnue s'est produite. La réponse pourrait être incomplète.`,"quota-reached":`Quota dépassé. Veuillez réessayer plus tard.`,"rate-limit":`Quota dépassé. Veuillez réessayer plus tard.`,maintenance:`Le chat est actuellement indisponible. Veuillez réessayer plus tard.`,"too-long":`Votre question était trop longue, essayez d'en poser une plus courte.`,"too-short":`Votre question était trop courte, essayez d'en poser une plus longue.`,"feedback-failed":`Échec de l'envoi du feedback. Veuillez réessayer.`,"speech-not-supported":`La reconnaissance vocale n'est pas prise en charge.`,"speech-transcription-failed":`Échec de la transcription vocale.`,"speech-no-text-detected":`Aucun texte détecté dans l'entrée vocale.`,"speech-microphone-access-denied":`Accès au microphone refusé.`}},fi={de:{email:`Bitte keine E-Mail Adressen eingeben`,creditCard:`Bitte keine Kreditkarteninformationen eingeben`,ahv:`Bitte keine AHV-Nummern eingeben`,phoneSwiss:`Bitte keine Telefonnummern eingeben`,phoneInternational:`Bitte keine Telefonnummern eingeben`,swissPassport:`Bitte keine Passinformationen eingeben`,longNumber:`Bitte keine langen Nummern eingeben`},en:{email:`Please do not enter email addresses`,creditCard:`Please do not enter credit card information`,ahv:`Please do not enter AHV numbers`,phoneSwiss:`Please do not enter phone numbers`,phoneInternational:`Please do not enter phone numbers`,swissPassport:`Please do not enter passport information`,longNumber:`Please do not enter long numbers`},it:{email:`Si prega di non inserire indirizzi email`,creditCard:`Si prega di non inserire informazioni sulla carta di credito`,ahv:`Si prega di non inserire numeri AVS`,phoneSwiss:`Si prega di non inserire numeri di telefono`,phoneInternational:`Si prega di non inserire numeri di telefono`,swissPassport:`Si prega di non inserire informazioni sul passaporto`,longNumber:`Si prega di non inserire numeri lunghi`},fr:{email:`Veuillez ne pas saisir d'adresses e-mail`,creditCard:`Veuillez ne pas saisir d'informations de carte de crédit`,ahv:`Veuillez ne pas saisir de numéros AVS`,phoneSwiss:`Veuillez ne pas saisir de numéros de téléphone`,phoneInternational:`Veuillez ne pas saisir de numéros de téléphone`,swissPassport:`Veuillez ne pas saisir d'informations de passeport`,longNumber:`Veuillez ne pas saisir de longs numéros`}},pi=Object.assign({"./default/fallback.translations.ts":ai}),mi=new Map;Object.entries(pi).forEach(([e,t])=>{let{error:n,data:r}=Sr.safeParse(t?.translations);if(n){console.error(`Invalid translations in ${e}:`,n);return}mi.set(Se(e),r)}),Array.from(mi.keys());var hi=(e,t)=>t.includes(e),gi=(e,t)=>{if(hi(e,t))return e;let n=_i();return hi(n,t)?n:`en`},_i=()=>navigator.language.split(`-`)[0],vi=(e,t)=>{localStorage.setItem(`liipgpt:selectedLanguage`,e),t&&(t.lang=e)},yi=e=>gi(localStorage.getItem(`liipgpt:selectedLanguage`),e),bi=te(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}}));function xi(...e){return e.filter(Boolean).join(` `)}var Si=typeof document<`u`,Ci=typeof window<`u`?window:void 0;typeof window<`u`&&window.document,typeof window<`u`&&window.navigator,typeof window<`u`&&window.location;function wi(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}var Ti=class extends Map{#e=new Map;#t=t(0);#n=t(0);#r=pe||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return pe===this.#r?t(e):ee(e)}has(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else return b(this.#t),!1;return b(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else{b(this.#t);return}return b(n),super.get(e)}set(e,t){var n=this.#e,r=n.get(e),i=super.get(e),a=super.set(e,t),o=this.#t;if(r===void 0)r=this.#i(0),n.set(e,r),x(this.#n,super.size),_(o);else if(i!==t){_(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&_(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),x(n,-1)),r&&(x(this.#n,super.size),_(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;x(this.#n,0);for(var t of e.values())x(t,-1);_(this.#t),e.clear()}}#a(){b(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)b(n)}keys(){return b(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return b(this.#n),super.size}},Ei=class{#e;#t;constructor(e,t){this.#e=e,this.#t=n(t)}get current(){return this.#t(),this.#e()}},Di=/\(.+\)/,Oi=new Set([`all`,`print`,`screen`,`and`,`or`,`not`,`only`]),ki=class extends Ei{constructor(e,t){let n=Di.test(e)||e.split(/[\s,]+/).some(e=>Oi.has(e.trim()))?e:`(${e})`,r=window.matchMedia(n);super(()=>r.matches,e=>me(r,`change`,e))}};new class{#e;#t;constructor(e={}){let{window:t=Ci,document:r=t?.document}=e;t!==void 0&&(this.#e=r,this.#t=n(e=>{let n=me(t,`focusin`,e),r=me(t,`focusout`,e);return()=>{n(),r()}}))}get current(){return this.#t?.(),this.#e?wi(this.#e):null}};var Ai=class{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return c(this.#t)}get(){let e=ce(this.#t);if(e===void 0)throw Error(`Context "${this.#e}" not found`);return e}getOr(e){let t=ce(this.#t);return t===void 0?e:t}set(e){return r(this.#t,e)}};function ji(e,t){switch(e){case`post`:re(t);break;case`pre`:ie(t);break}}function Mi(e,t,n,r={}){let{lazy:i=!1}=r,a=!i,o=Array.isArray(e)?[]:void 0;ji(t,()=>{let t=Array.isArray(e)?e.map(e=>e()):e();if(!a){a=!0,o=t;return}let r=de(()=>n(t,o));return o=t,r})}function Ni(e,t,n){let r=le(()=>{let i=!1;Mi(e,t,(e,t)=>{if(i){r();return}let a=n(e,t);return i=!0,a},{lazy:!0})});re(()=>r)}function Pi(e,t,n){Mi(e,`post`,t,n)}function Fi(e,t,n){Mi(e,`pre`,t,n)}Pi.pre=Fi;function Ii(e,t){Ni(e,`post`,t)}function Li(e,t){Ni(e,`pre`,t)}Ii.pre=Li;function Ri(e,t){let n,r=null;return(...i)=>new Promise(a=>{r&&r(void 0),r=a,clearTimeout(n),n=setTimeout(async()=>{let t=await e(...i);r&&=(r(t),null)},t)})}function zi(e,t){let n=0,r=null;return(...i)=>{let a=Date.now();return n&&a-n<t?r??Promise.resolve(void 0):(n=a,r=e(...i),r)}}function Bi(e,n,r={},i){let{lazy:a=!1,once:o=!1,initialValue:s,debounce:c,throttle:l}=r,u=t(S(s)),d=t(!1),f=t(void 0),p=t(S([])),m=()=>{b(p).forEach(e=>e()),x(p,[],!0)},ee=e=>{x(p,[...b(p),e],!0)},h=async(e,t,r=!1)=>{try{x(d,!0),x(f,void 0),m();let i=new AbortController;ee(()=>i.abort());let a=await n(e,t,{data:b(u),refetching:r,onCleanup:ee,signal:i.signal});return x(u,a,!0),a}catch(e){e instanceof DOMException&&e.name===`AbortError`||x(f,e,!0);return}finally{x(d,!1)}},te=c?Ri(h,c):l?zi(h,l):h,ne=Array.isArray(e)?e:[e],g;return i((t,n)=>{o&&g||(g=t,te(Array.isArray(e)?t:t[0],Array.isArray(e)?n:n?.[0]))},{lazy:a}),{get current(){return b(u)},get loading(){return b(d)},get error(){return b(f)},mutate:e=>{x(u,e,!0)},refetch:t=>{let n=ne.map(e=>e());return te(Array.isArray(e)?n:n[0],Array.isArray(e)?n:n[0],t??!0)}}}function Vi(e,t,n){return Bi(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];Pi(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}function Hi(e,t,n){return Bi(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];Pi.pre(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}Vi.pre=Hi,new Ai(`richColorsContext`);var Ui=new Ai(`<Toaster/>`),Wi=0,Gi=class{#e=t(S([]));get toasts(){return b(this.#e)}set toasts(e){x(this.#e,e,!0)}#t=t(S([]));get heights(){return b(this.#t)}set heights(e){x(this.#t,e,!0)}#n=e=>{let t=this.toasts.findIndex(t=>t.id===e);return t===-1?null:t};addToast=e=>{Si&&this.toasts.unshift(e)};updateToast=({id:e,data:t,type:n,message:r})=>{let i=this.toasts.findIndex(t=>t.id===e),a=this.toasts[i];this.toasts[i]={...a,...t,id:e,title:r,type:n,updated:!0}};create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id&&e.id?.length>0?e.id:Wi++,i=e.dismissible===void 0?e.dismissable===void 0?!0:e.dismissable:e.dismissible,a=e.type===void 0?`default`:e.type;return de(()=>{this.toasts.find(e=>e.id===r)?this.updateToast({id:r,data:e,type:a,message:t,dismissible:i}):this.addToast({...n,id:r,title:t,dismissible:i,type:a})}),r};dismiss=e=>(de(()=>{if(e===void 0){this.toasts=this.toasts.map(e=>({...e,dismiss:!0}));return}let t=this.toasts.findIndex(t=>t.id===e);this.toasts[t]&&(this.toasts[t]={...this.toasts[t],dismiss:!0})}),e);remove=e=>{if(e===void 0){this.toasts=[];return}let t=this.#n(e);if(t!==null)return this.toasts.splice(t,1),e};message=(e,t)=>this.create({...t,type:`default`,message:e});error=(e,t)=>this.create({...t,type:`error`,message:e});success=(e,t)=>this.create({...t,type:`success`,message:e});info=(e,t)=>this.create({...t,type:`info`,message:e});warning=(e,t)=>this.create({...t,type:`warning`,message:e});loading=(e,t)=>this.create({...t,type:`loading`,message:e});promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:typeof t.loading==`string`?t.loading:t.loading()}));let r=e instanceof Promise?e:e(),i=n!==void 0;return r.then(e=>{if(typeof e==`object`&&e&&`ok`in e&&typeof e.ok==`boolean`&&!e.ok){i=!1;let t=Ki(e);this.create({id:n,type:`error`,message:t})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?t.success(e):t.success;this.create({id:n,type:`success`,message:r})}}).catch(e=>{if(t.error!==void 0){i=!1;let r=typeof t.error==`function`?t.error(e):t.error;this.create({id:n,type:`error`,message:r})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally?.()}),n};custom=(e,t)=>{let n=t?.id||Wi++;return this.create({component:e,id:n,...t}),n};removeHeight=e=>{this.heights=this.heights.filter(t=>t.toastId!==e)};setHeight=e=>{let t=this.#n(e.toastId);if(t===null){this.heights.push(e);return}this.heights[t]=e};reset=()=>{this.toasts=[],this.heights=[]}};function Ki(e){return e&&typeof e==`object`&&`status`in e?`HTTP error! Status: ${e.status}`:`Error! ${e}`}var Y=new Gi;function qi(e,t){return Y.create({message:e,...t})}var Ji=class{#e=h(()=>Y.toasts.filter(e=>!e.dismiss));get toasts(){return b(this.#e)}},Yi=Object.assign(qi,{success:Y.success,info:Y.info,warning:Y.warning,error:Y.error,custom:Y.custom,message:Y.message,promise:Y.promise,dismiss:Y.dismiss,loading:Y.loading,getActiveToasts:()=>Y.toasts.filter(e=>!e.dismiss)}),Xi=e=>{let t=new Set;Object.getOwnPropertyNames(e).forEach(e=>t.add(e));let n=Object.getPrototypeOf(e);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).forEach(e=>t.add(e)),n=Object.getPrototypeOf(n);return Array.from(t)},Zi=(e,t)=>{let n={};return t.forEach(t=>{n[t]=e[t]}),n},Qi=console.warn,$i=()=>{},ea=(e,t)=>de(()=>{console.warn=$i;let n=m(t?Zi(e,t):e);return console.warn=Qi,n}),ta=e=>e&&typeof e.then==`function`,na=class{config;self;devtools;stateKeys;constructor(e,t){this.config=e,this.self=t,typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&(this.stateKeys=Xi(this.config.state),this.devtools=window.__REDUX_DEVTOOLS_EXTENSION__.connect({name:this.config.name??`updatelogic`}),this.devtools.init(this.createStateSnapshot()),this.devtools.subscribe(e=>{e.type===`DISPATCH`&&e.state}))}createStateSnapshot(){return ea(this.config.state,this.stateKeys)}sendStart(e,t){this.devtools.send({type:`→ ${e}`,args:t},this.createStateSnapshot())}sendError(e,t,n){this.devtools.send({type:`❌ ${e}`,args:t,error:n},this.createStateSnapshot())}sendSuccess(e,t,n){this.devtools.send({type:`✓ ${e}`,args:t,return:n},this.createStateSnapshot())}isIncluded(e){return this.config.excludeInDevTools?!this.config.excludeInDevTools.includes(e):!0}createProxyFunction(e,t){let n=this.devtools&&this.isIncluded(e);return typeof t==`function`?(...r)=>{if(!n)return de(()=>t.call(this.self,...r));let i=ea(r);this.sendStart(e,i);try{let n=de(()=>t.call(this.self,...r));return ta(n)?n.then(t=>(this.sendSuccess(e,i,t),t),t=>{throw this.sendError(e,i,t),t}):(this.sendSuccess(e,i,n),n)}catch(t){throw this.sendError(e,i,t),t}}:t}},ra=(e,t)=>{let n={},r=new na(e,n);return Object.keys(t).forEach(e=>{if(e===`state`||e===`name`)return;let i=t[e];n[e]=r.createProxyFunction(e,i)}),n};async function ia(){if(typeof navigator>`u`||!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return!1;try{return(await navigator.mediaDevices.enumerateDevices()).some(e=>e.kind===`audioinput`)}catch(e){return console.error(`Error checking for microphone:`,e),!1}}function aa(){return typeof window>`u`||!window.MediaRecorder?null:MediaRecorder.isTypeSupported(`audio/mp4`)?`audio/mp4`:MediaRecorder.isTypeSupported(`audio/webm`)?`audio/webm`:MediaRecorder.isTypeSupported(`audio/wav`)?`audio/wav`:null}function oa(){return typeof window>`u`?!1:!!(window.MediaRecorder&&aa())}function sa(){if(typeof window>`u`)return!1;if(`ontouchstart`in window||navigator.maxTouchPoints>0)return!0;let e=navigator.msMaxTouchPoints;return!!(`msMaxTouchPoints`in navigator&&e&&e>0)}function ca(){return typeof window>`u`?!1:!!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||sa())}var la=class{mediaRecorder=null;audioChunks=[];started=!1;starting=!1;stream=null;options;audioContext=null;analyser=null;dataArray=null;volumeUpdateInterval=null;constructor(e={}){this.options=e}async start(){if(this.started||this.starting){console.warn(`AudioRecorder: Start already in progress or already started`);return}if(!oa()||!navigator.mediaDevices){let e=Error(`MediaRecorder not supported or no microphone access`);throw this.options.onError?.(e),e}try{if(this.starting=!0,this.stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},video:!1}),!this.starting){this.stopStream(this.stream);return}this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&(console.warn(`AudioRecorder: MediaRecorder already active, stopping previous recording`),this.mediaRecorder.stop(),this.cleanup()),this.started=!0,this.starting=!1;let e=aa();if(!e)throw Error(`No supported media type found`);let t={mimeType:e};this.mediaRecorder=new MediaRecorder(this.stream,t),this.audioChunks=[],this.mediaRecorder.ondataavailable=e=>{e.data.size>0&&this.audioChunks.push(e.data)},this.mediaRecorder.onstop=async()=>{let t=this.audioChunks.length>0?new Blob(this.audioChunks,{type:e}):null;await this.options.onDataAvailable?.(t),this.options.onStop?.(),this.cleanup()},this.mediaRecorder.onerror=e=>{let t=Error(`MediaRecorder error: ${e}`);this.options.onError?.(t),this.cleanup()},this.mediaRecorder.start(),this.setupVolumeAnalysis(this.stream),this.options.onStart?.()}catch(e){this.started=!1,this.starting=!1;let t=e instanceof Error?e:Error(String(e));throw this.options.onError?.(t),t}}stop(){this.started=!1,this.starting=!1,this.volumeUpdateInterval&&=(clearInterval(this.volumeUpdateInterval),null),this.mediaRecorder&&this.mediaRecorder.state!==`inactive`?this.mediaRecorder.stop():(this.stream&&this.stopStream(this.stream),this.cleanup())}setupVolumeAnalysis(e){if(this.options.onVolumeChange)try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.8;let t=this.analyser.frequencyBinCount;this.dataArray=new Uint8Array(t),this.audioContext.createMediaStreamSource(e).connect(this.analyser),this.startVolumeMonitoring()}catch(e){console.warn(`Failed to set up volume analysis:`,e)}}startVolumeMonitoring(){!this.analyser||!this.dataArray||!this.options.onVolumeChange||(this.volumeUpdateInterval=window.setInterval(()=>{if(!this.analyser||!this.dataArray||!this.started)return;this.analyser.getByteFrequencyData(this.dataArray);let e=0;for(let t=0;t<this.dataArray.length;t++)e+=this.dataArray[t]*this.dataArray[t];let t=Math.sqrt(e/this.dataArray.length)/255;t=(t*3)**.7;let n=Math.min(100,Math.max(0,Math.round(t*100)));this.options.onVolumeChange?.(n)},100))}get recording(){return this.started&&this.mediaRecorder?.state===`recording`}get isStarting(){return this.starting}stopStream(e){e.getTracks().forEach(e=>e.stop())}cleanup(){this.volumeUpdateInterval&&=(clearInterval(this.volumeUpdateInterval),null),this.audioContext&&=(this.audioContext.close().catch(console.warn),null),this.analyser=null,this.dataArray=null,this.stream&&=(this.stopStream(this.stream),null),this.mediaRecorder=null,this.audioChunks=[],this.started=!1,this.starting=!1}static isSupported(){return oa()}static getSupportedMediaType(){return aa()}},ua=e=>(localStorage.setItem(`liipgpt-color-scheme`,e),fa([`light`,`dark`])),da=()=>{let e=localStorage.getItem(`liipgpt-color-scheme`);return e===`light`||e===`dark`?e:`system`},fa=e=>{let t=da();return t===`system`&&(t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`),e.includes(t)?t:e[0]??`light`},pa=vt(),ma=(e,t)=>{if(e instanceof HTMLTextAreaElement&&t instanceof HTMLTextAreaElement){t.textContent=e.value;return}if(e instanceof HTMLSelectElement&&t instanceof HTMLSelectElement){Array.from(e.options).forEach((e,n)=>{t.options[n]&&(t.options[n].selected=e.selected)});return}e instanceof HTMLInputElement&&t instanceof HTMLInputElement&&(t.setAttribute(`value`,e.value),(e.type===`checkbox`||e.type===`radio`)&&(e.checked?t.setAttribute(`checked`,`checked`):t.removeAttribute(`checked`)))},ha=e=>{let t=e.cloneNode(!0);if(!(t instanceof Element))return``;let n=`input, textarea, select`,r=e.querySelectorAll(n),i=t.querySelectorAll(n);return r.forEach((e,t)=>{let n=i[t];n&&ma(e,n)}),pa.sanitize(t.outerHTML,{FORBID_TAGS:[`style`,`script`],FORBID_ATTR:[`style`,`class`]})},ga=e=>{if(!e?.length)return[];let t=e.join(`,`),n=document.querySelectorAll(t);return Array.from(n,ha)},_a=`liipgpt:context`,va=class{contextVersion=0;#e=t();get currentContext(){return b(this.#e)}set currentContext(e){x(this.#e,e,!0)}getFromLocalStorage(){let e=localStorage.getItem(_a);if(e){let t;try{if(t=JSON.parse(e),t.version!==this.contextVersion){localStorage.removeItem(_a);return}else return t.context}catch(e){console.error(`Failed to parse liipgpt:context`,e);return}}}storeToLocalStorage(){localStorage.setItem(`liipgpt:context`,JSON.stringify({version:X.data.chatConfig.contextVersion,context:this.currentContext}))}constructor(e){this.init=e,this.currentContext=this.getFromLocalStorage()??e.initialValue}getContext(){return m(this.currentContext)}setContextVersion(e){this.contextVersion=e}setContext(e){this.currentContext=e,this.storeToLocalStorage()}resetContext(){this.currentContext=this.init.initialValue,this.storeToLocalStorage()}updateContext(e){this.setContext(e(this.currentContext))}},ya=()=>localStorage.getItem(_a),ba=[{type:`email`,check:e=>/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b/.test(e)},{type:`creditCard`,check:e=>/\b(?:\d[ -]*?){13,16}\b/.test(e)},{type:`ahv`,check:e=>/\b756\.\d{4}\.\d{4}\.\d{2}\b/.test(e)},{type:`phoneSwiss`,check:e=>/\b0(?:\s*\d){2}(?:\s*\/\s*)?(?:\s*\d){7,}\b/.test(e)},{type:`phoneInternational`,check:e=>/(?:\+|00)(?:\s*\d){10,}\b/.test(e)},{type:`swissPassport`,check:e=>/\b[A-HJ-NP-Z](?=.*\d)[A-HJ-NP-Z0-9]{7}\b/.test(e)},{type:`longNumber`,check:e=>/\b\d{9,}\b/.test(e)}],xa=e=>{for(let t of ba)if(t.check(e))return t.type},Sa=`liipgpt:selectorValues`,Ca=`liipgpt:selectorKnownDefaults`,wa=()=>{try{let e=q.getItem(Sa),t=q.getItem(Ca);return e?{values:JSON.parse(e),knownDefaults:t?JSON.parse(t):{}}:null}catch{return null}},Ta=e=>{let t={};for(let n of e)t[n.settingName]=n.defaultValues??(n.allowEmpty?[]:[n.values[0]]).filter(Boolean);return t},Ea=(e,t)=>{try{let n=Ta(t);q.setItem(Sa,JSON.stringify(e)),q.setItem(Ca,JSON.stringify(n))}catch(e){console.error(`Failed to save selector values:`,e)}},Da=e=>{try{let t=wa();if(!t)return;delete t.values[e],delete t.knownDefaults[e],q.setItem(Sa,JSON.stringify(t.values)),q.setItem(Ca,JSON.stringify(t.knownDefaults))}catch(e){console.error(`Failed to clear selector saved state:`,e)}},Oa=e=>{let t=wa(),n=e.map(e=>{let n=e.defaultValues??(e.allowEmpty?[]:[e.values[0]]).filter(Boolean);if(!t?.values[e.settingName])return[e.settingName,n];let r=t.values[e.settingName],i=t.knownDefaults[e.settingName]||[],a=r.filter(t=>e.values.includes(t)),o=i.filter(e=>!n.includes(e)),s=a.filter(e=>!o.includes(e)),c=n.filter(e=>!i.includes(e)&&!s.includes(e)),l=[...s,...c];return l.length===0&&!e.allowEmpty?[e.settingName,n]:[e.settingName,l]});return Object.fromEntries(n)},ka=class extends Error{constructor(e){super(e),this.name=`UnreachableError`}},Aa=s(bi(),1),ja=(e,t)=>{if(e&&!t)return{name:`consent-page`};let n=new URLSearchParams(window.location.search).get(`q`);return n?{name:`chat-page`,query:n}:{name:`start-page`}},Ma=e=>e?e.map(e=>({id:Br(),...e})):[],X=new class{#e=t(S({}));get data(){return b(this.#e)}set data(e){x(this.#e,e,!0)}#t=t(S({}));get targets(){return b(this.#t)}set targets(e){x(this.#t,e,!0)}#n=t(!1);get initialized(){return b(this.#n)}set initialized(e){x(this.#n,e,!0)}#r=t(0);get currentAudioVolume(){return b(this.#r)}set currentAudioVolume(e){x(this.#r,e,!0)}ariaLiveMessagesClearingTimeoutDuration=350;#i=t(null);get currentAudioRecorder(){return b(this.#i)}set currentAudioRecorder(e){x(this.#i,e,!0)}#a=t(!1);get isTranscribing(){return b(this.#a)}set isTranscribing(e){x(this.#a,e,!0)}#o=h(()=>{if(!this.initialized)return[];let e=this.data.chatConfig.menu;return e?e[this.data.language]??[]:[]});get menu(){return b(this.#o)}set menu(e){x(this.#o,e)}#s=h(()=>this.initialized?this.data.chatConfig.translations[this.data.language]??{}:{});get t(){return b(this.#s)}set t(e){x(this.#s,e)}#c=h(()=>this.initialized?di[this.data.language]??{}:di.en??{});get errorTranslations(){return b(this.#c)}set errorTranslations(e){x(this.#c,e)}#l=h(()=>this.initialized?fi[this.data.language]??{}:fi.en??{});get piiTranslations(){return b(this.#l)}set piiTranslations(e){x(this.#l,e)}#u=h(()=>this.initialized?this.data.currentColorScheme:`light`);get colorScheme(){return b(this.#u)}set colorScheme(e){x(this.#u,e)}#d=h(()=>this.initialized?this.data.chatConfig.fullTheme[this.data.currentColorScheme]:{});get themeBase(){return b(this.#d)}set themeBase(e){x(this.#d,e)}#f=h(()=>this.themeBase.tokens);get theme(){return b(this.#f)}set theme(e){x(this.#f,e)}#p=h(()=>{if(!this.initialized)return[];let e=[];for(let t of this.data.chatConfig.selectorsConfig)t.allowEmpty||(this.data.selectorValues[t.settingName]||[]).length===0&&e.push(t.settingName);return e});get selectorsWithErrors(){return b(this.#p)}set selectorsWithErrors(e){x(this.#p,e)}},Z,Q,Na,Pa=ra({name:`chat-logic`,state:X,excludeInDevTools:[`onInput`]},{async init(e){Q=e;let t=Q.speechRecognitionApiKey||void 0;Z=new ei({apiUrl:Q.apiUrl,apiKey:Q.apiKey,speechRecognitionApiKey:t,strict:!0});try{let e=await Z.getChatConfig();window.CHAT_CONFIG_OVERRIDE&&Object.assign(e,window.CHAT_CONFIG_OVERRIDE);let t=(await Z.getMetadata()).mode===`maintenance`;t&&this.showErrorToast(`maintenance`);let n=ui(e);Q.inlineLayout!==void 0&&(n.inlineLayout=Q.inlineLayout);let r;r=Q.lang?gi(Q.lang,n.supportedLanguages):yi(n.supportedLanguages),vi(r,X.targets.mainElement);let i=await this.getPredefinedQuestions(r),a=n.translations[r]?.ariaOpensInNewTab;a&&Z.setNewTabSrText(a);let o=[];if(n.renderKatex){let e=await he(()=>import(`https://esm.sh/marked-katex-extension@5.1.5`),[],import.meta.url).catch(e=>{console.error(`Couldn't load marked-katex-extension:`,e)});e&&(Z.setMarkedExtensions(e.default({nonStandard:!0,output:`mathml`})),o.push(`https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css`))}let s=Object.keys(n.fullTheme),c=!1;if(n.forceConsent)try{c=q.getItem(`liipgpt:termsAccepted`)===`true`}catch(e){console.warn(`Failed to load terms acceptance from storage:`,e)}X.data={currentConversationState:`idle`,chatConfig:n,language:r,predefinedQuestions:i,isInMaintenance:t,history:Ma(n.messageAdditions.init),selectedColorScheme:da(),has2ColorSchemes:s.length===2,currentColorScheme:fa(s),conversationFeedbackId:void 0,conversationFeedbackIsOpen:!1,openedPopup:void 0,props:Q,flyoutIsOpen:!1,questionHasPii:void 0,chatInputValue:``,selectorValues:Oa(n.selectorsConfig),selectorsIsOpen:!1,currentReferencesAsideId:void 0,ariaLiveStatusMessage:void 0,ariaLiveStatusMessageClearingTimeout:void 0,wasReferencesAsideClosed:!1,isAsideMobile:!0,route:ja(n.forceConsent??!1,c),additionalStylesheets:o,hasOpenedOverlays:!1,isInlineLayoutContained:!1,termsAccepted:c},window.LIIPGPT_LISTENERS?.route?.(X.data.route),window.LIIPGPT_LISTENERS?.conversation?.(X.data.currentConversationState),X.data.selectorsIsOpen=X.data.chatConfig.showExpandedSelectors??!1,X.initialized=!0,this.checkForOpenedPopup(),window.addEventListener(`hashchange`,()=>{this.checkForOpenedPopup()}),this.goto(ja(n.forceConsent??!1,c),!0)}catch(e){throw Yi.error(e instanceof Error?e.message:`Failed to load the chatbot. Please reload the page.`,{duration:1e4,unstyled:!0,classes:{toast:`toast`}}),e}},setTarget(e,t){X.targets[e]=t},goto(e,t=!1){if(!(!t&&(0,Aa.default)(X.data.route,e)))switch(X.data.route=e,window.LIIPGPT_LISTENERS?.route?.(e),e.name){case`consent-page`:break;case`start-page`:e.prefill&&(X.data.chatInputValue=e.prefill);break;case`chat-page`:if(X.data.chatInputValue=e.query,this.onSubmit(),X.data.chatConfig.addQueryToUrlParams){let t=new URLSearchParams(window.location.search);t.set(`q`,e.query),history.pushState(null,``,`?${t.toString()}`)}break}},getSelectorConfig(e){let t=X.data.chatConfig.selectorsConfig.find(t=>t.settingName===e);if(!t)throw Error(`Setting ${e} not found`);return t},getPrettifiedSelectorValues(){let e=Object.entries(X.data.selectorValues).map(([e,t])=>{let n;try{n=this.getSelectorConfig(e)}catch(t){console.error(`Error getting selector config for ${e}: ${t}`);return}return n.type===`single-select`?[e,t[0]]:[e,t]}).filter(e=>!!e);return Object.fromEntries(e)},setSelectorValue(e,t){let n=this.getSelectorConfig(e);if(!n){console.warn(`Trying to set setting ${e} but it is not defined in the chat config`);return}if(n.type===`single-select`&&t.length>1){console.warn(`Trying to set multiple values for single-select setting ${e}`);return}X.data.selectorValues[e]=t,Ea(X.data.selectorValues,X.data.chatConfig.selectorsConfig)},resetSelectorToDefaults(e){let t=this.getSelectorConfig(e);if(!t){console.warn(`Trying to reset setting ${e} but it is not defined in the chat config`);return}let n=t.defaultValues??(t.allowEmpty?[]:[t.values[0]]).filter(Boolean);return Da(e),X.data.selectorValues[e]=n,Ea(X.data.selectorValues,X.data.chatConfig.selectorsConfig),n},async getPredefinedQuestions(e){try{return Z.getPredefinedQuestions({url:window.location.origin+window.location.pathname,language:e})}catch(e){return console.warn(`Failed to load predefined questions:`,e),[]}},setColorScheme(e){X.data.selectedColorScheme=e,X.data.currentColorScheme=ua(e),this.setAriaLiveStatusMessage(e===`dark`?X.t.ariaDarkSelected:X.t.ariaLightSelected)},async abort(){await Na?.abort()},changeConversationState(e){X.data.currentConversationState=e,window.LIIPGPT_LISTENERS?.conversation?.(e)},onInput(e){X.data.chatConfig.blockPII&&(X.data.questionHasPii=xa(e)),X.data.chatInputValue=e},onSubmit(e=!1){let t=ga(X.data.chatConfig.parentPageContext?.extractSelectors);if(X.data.questionHasPii){console.warn(`Question contains PII, not submitting:`,X.data.questionHasPii);return}let n=X.data.chatConfig.questionPrefix?`${X.data.chatConfig.questionPrefix} ${X.data.chatInputValue}`:X.data.chatInputValue;X.data.history.push(...Ma(X.data.chatConfig.messageAdditions.user.before)),X.data.history.push({type:`user`,time:new Date().toISOString(),message:X.data.chatInputValue}),X.data.history.push(...Ma(X.data.chatConfig.messageAdditions.user.after));let r=X.data.history.push(...Ma(X.data.chatConfig.messageAdditions.bot.before));X.data.history.push({id:`UNRESOLVED`,state:`loading`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:``,html:``,text:``},references:{all:[],used:[],unused:[]}});let i={features:Q.features?Q.features.trim().split(`,`):[`formatting`],onError:e=>{this.showErrorToast(e),window.LIIPGPT_LISTENERS?.error?.(e),(e===`pii-detected`||e===`blocked`)&&this.editLatestQuestion()},lang:X.data.language,selectorValues:{...this.getPrettifiedSelectorValues(),context:ya()}};t.length&&(i.selectorValues.parentPageContextHtml=t);let a=(e,t)=>{try{let n=new URL(e),r=new URL(t);return n.origin===r.origin&&n.pathname===r.pathname}catch{return!1}},o=X.data.chatConfig.sendReferrer??`all`;if([`all`,`own`,`location`].includes(o)){let e=o===`location`||X.data.props.flyout,t;t=e?`${window.location.protocol}//${window.location.host}${window.location.pathname}`:a(document.referrer,window.location.href)?null:document.referrer;let n=o===`own`&&!X.data.props.flyout&&t&&!t.startsWith(window.location.origin);i.referrer=t&&!n?t:void 0}X.data.currentConversationId||(X.data.currentConversationId=Z.createConversationId());let s=Z.chat(X.data.currentConversationId,n,i);Na=s,X.data.lastChatResponseId=s.id,X.data.currentConversationState!==`searching`&&this.changeConversationState(`searching`),this.setAriaLiveStatusMessage(X.t.ariaQuestionSent);let c=!1,l,u=!!X.data.currentReferencesAsideId;(e&&u||!e&&X.data.chatConfig.showReferencesByDefault)&&(X.data.isAsideMobile||this.openReferencesAside(s.id)),s.subscribe(e=>{if(X.data.history[r]&&(X.data.history[r]={question:X.data.chatInputValue,...e}),X.data.chatConfig.addRetrievalQuestionToUrlParams&&e.retrievalQuestion){let t=new URLSearchParams(window.location.search);t.get(`search`)!==e.retrievalQuestion&&(t.set(`search`,e.retrievalQuestion),history.replaceState(null,``,`?${t.toString()}`))}X.data.chatConfig.showReferencesByDefault&&!X.data.wasReferencesAsideClosed&&X.data.currentReferencesAsideId!==e.id&&!X.data.isAsideMobile&&this.openReferencesAside(e.id),e.state===`streaming`&&X.data.currentConversationState!==`answering`&&this.changeConversationState(`answering`),e.state===`done`&&(this.changeConversationState(`idle`),c||(c=!0,this.setAriaLiveStatusMessage(`${X.t.ariaAnswerReady} ... ${e.message.text} ... ${X.t.ariaAnswerFinished}`),X.data.history.push(...Ma(X.data.chatConfig.messageAdditions.bot.after))),X.data.currentReferencesAsideId&&X.data.history[r].references.used.length>0?(clearTimeout(l),l=setTimeout(()=>{this.openReferencesAside(e.id)},100)):this.closeReferencesAside())}),X.data.chatInputValue=``},async onStartSpeechRecognition(){try{if(!await ia()){this.showErrorToast(`speech-not-supported`);return}if(await navigator.mediaDevices.getUserMedia({audio:!0}),la.isSupported())X.data.chatInputValue=``,X.currentAudioRecorder=new la({onDataAvailable:async e=>{X.isTranscribing=!0,await this.handleTranscription(e)},onError:()=>{this.showErrorToast(`speech-microphone-access-denied`),X.currentAudioRecorder=null,X.isTranscribing=!1},onVolumeChange:e=>{X.currentAudioVolume=e}}),X.currentAudioRecorder.start();else{this.showErrorToast(`speech-not-supported`);return}}catch(e){throw this.showErrorToast(`speech-microphone-access-denied`),X.currentAudioRecorder=null,X.isTranscribing=!1,e}},editLatestQuestion(){let e=X.data.history.findLastIndex(e=>e?.type===`user`);if(e===-1){console.error(`No last user question, available`);return}let t=X.data.history.splice(e)[0];X.data.chatInputValue=t.message},onStopSpeechRecognition(){if(X.currentAudioRecorder){let e=X.currentAudioRecorder;X.currentAudioRecorder=null,e.stop()}X.currentAudioVolume=0},async handleTranscription(e){if(!e){console.warn(`No audio data received`);return}try{let t=await Z.transcribeAudio(e,{lang:X.data.language});if(t.error){this.showErrorToast(`speech-transcription-failed`);return}if(t.transcript.trim()){if(X.data.chatConfig.blockPII&&(X.data.questionHasPii=xa(t.transcript.trim()),X.data.questionHasPii))return;X.data.chatInputValue=t.transcript.trim()}else this.showErrorToast(`speech-no-text-detected`)}catch(e){console.error(`Speech transcription error:`,e),this.showErrorToast(`speech-transcription-failed`)}finally{X.currentAudioRecorder=null,X.isTranscribing=!1,X.currentAudioVolume=0}},async onStartConversation(e){await this.abort(),X.data.history=Ma(X.data.chatConfig.messageAdditions.init),X.data.currentConversationId=Z.createConversationId(),this.goto({name:`chat-page`,query:e})},async onNewConversation(){if(await this.abort(),X.data.currentConversationId=void 0,X.data.currentReferencesAsideId=void 0,X.data.history=Ma(X.data.chatConfig.messageAdditions.init),X.data.chatConfig.addQueryToUrlParams){let e=new URLSearchParams(window.location.search);e.delete(`q`),history.pushState(null,``,`?${e.toString()}`)}this.goto({name:`start-page`})},showSuccessToast(e){Yi.success(X.t[e],{unstyled:!0,duration:3e3,classes:{toast:`toast`}})},showErrorToast(e){Yi.error(X.errorTranslations[e],{unstyled:!0,duration:3e3,classes:{toast:`toast`}})},async submitFeedback(e){try{let t=X.data.conversationFeedbackId||X.data.lastChatResponseId;if(!t)throw new ka(`Tried to give feedback with no id.`);let n=X.data.history.find(e=>e.type===`bot`&&e.id===t);await Z.feedback(t,n?.question??``,e),setTimeout(()=>{this.showSuccessToast(`thankYouForFeedback`)},500)}catch(e){console.error(`Feedback failed:`,e),this.showErrorToast(`feedback-failed`)}},toggleReferencesAside(e){X.data.currentReferencesAsideId===e?this.closeReferencesAside():this.openReferencesAside(e)},openReferencesAside(e){X.data.currentReferencesAsideId=e,this.setOpenOverlay(!0)},closeReferencesAside(){X.data.currentReferencesAsideId=void 0,X.data.wasReferencesAsideClosed=!0,this.setOpenOverlay(!1)},setAsideMobile(e){X.data.isAsideMobile=e},openFlyout(){X.data.flyoutIsOpen=!0},closeFlyout(){X.data.flyoutIsOpen=!1},openConversationFeedback(){X.data.conversationFeedbackIsOpen=!0,this.setOpenOverlay(!0)},openMessageFeedback(e){X.data.conversationFeedbackId=e},closeFeedback(){X.data.conversationFeedbackIsOpen=!1,X.data.conversationFeedbackId=void 0,this.setOpenOverlay(!1)},setOpenOverlay(e){X.data.hasOpenedOverlays=e},setAriaLiveStatusMessage(e){X.data.ariaLiveStatusMessage=e,clearTimeout(X.data.ariaLiveStatusMessageClearingTimeout),X.data.ariaLiveStatusMessageClearingTimeout=setTimeout(()=>{X.data.ariaLiveStatusMessage=``},X.ariaLiveMessagesClearingTimeoutDuration)},closePopup(){window.location.hash=``},checkForOpenedPopup(){let e=window.location.hash.slice(1),t=X.t.popups?.find(t=>t.hash===e);t?X.data.openedPopup=t:X.data.openedPopup=void 0},async thumbs(e,t){try{let n=X.data.history.find(t=>t.type===`bot`&&t.id===e);t===`up`?await Z.thumbsUp(e,n?.question??``):await Z.thumbsDown(e,n?.question??``),this.showSuccessToast(`thankYouForFeedback`)}catch(e){console.error(`Feedback failed:`,e),this.showErrorToast(`feedback-failed`)}},async onLanguageChange(e){if(X.data.language=gi(e,X.data.chatConfig.supportedLanguages),vi(X.data.language,X.targets.mainElement),X.data.predefinedQuestions=await this.getPredefinedQuestions(X.data.language),this.setAriaLiveStatusMessage(X.t.ariaLanguageChanged),X.data.chatConfig.reflectLanguageInPath){let e=new URL(window.location.href);e.pathname=`/${X.data.language}`,window.history.replaceState({},``,e.toString())}},async acceptTerms(){X.data.termsAccepted=!0;try{q.setItem(`liipgpt:termsAccepted`,`true`)}catch(e){console.warn(`Failed to save terms acceptance to storage:`,e)}this.closePopup(),await g();let e=new URLSearchParams(window.location.search).get(`q`);this.goto(e?{name:`chat-page`,query:e}:{name:`start-page`})},updateChatInput(e){X.data.chatInputValue=e}});function Fa(e,t){p(t,!0);let n=y(t,`href`,7),r=y(t,`target`,7),a=y(t,`onclick`,7),s=y(t,`className`,23,()=>[]),c=y(t,`isStandalone`,7,!1),m=y(t,`children`,7),ee=y(t,`type`,7,`button`),te=y(t,`use`,7),g=y(t,`class`,7),_=fe(t,[`$$slots`,`$$events`,`$$legacy`,`$$host`,`href`,`target`,`onclick`,`className`,`isStandalone`,`children`,`type`,`use`,`class`]),re=h(()=>n()?`a`:`button`),ie=h(()=>[...Array.isArray(s())?s():s()?[s()]:[],...g()?[g()]:[]]),oe=()=>({}),ce=h(()=>te()??oe);var v={get href(){return n()},set href(e){n(e),d()},get target(){return r()},set target(e){r(e),d()},get onclick(){return a()},set onclick(e){a(e),d()},get className(){return s()},set className(e=[]){s(e),d()},get isStandalone(){return c()},set isStandalone(e=!1){c(e),d()},get children(){return m()},set children(e){m(e),d()},get type(){return ee()},set type(e=`button`){ee(e),d()},get use(){return te()},set use(e){te(e),d()},get class(){return g()},set class(e){g(e),d()}},le=o();return se(ne(le),()=>b(re),!1,(e,t)=>{u(e,e=>b(ce)?.(e)),ae(e,()=>({..._,onclick:n()?void 0:a(),type:n()?void 0:ee(),href:n(),role:n()?`link`:`button`,target:n()?r():void 0,class:b(ie),[ue]:{"open-button--standalone":c()}}));var s=o();f(ne(s),m),i(t,s)}),i(e,le),l(v)}oe(Fa,{href:{},target:{},onclick:{},className:{},isStandalone:{},children:{},type:{},use:{},class:{}},[],[],{mode:`open`});function Ia(t,n){p(n,!0);let r=y(n,`css`,7),a=fe(n,[`$$slots`,`$$events`,`$$legacy`,`$$host`,`css`]),s=e=>{re(()=>{r()&&(e.innerHTML=r())})};var c={get css(){return r()},set css(e){r(e),d()}},f=o(),m=ne(f),ee=e=>{var t=o();se(ne(t),()=>`style`,!1,(e,t)=>{u(e,e=>s?.(e)),ae(e,()=>({...a}))}),i(e,t)};return e(m,e=>{r()&&e(ee)}),i(t,f),l(c)}oe(Ia,{css:{}},[],[],{mode:`open`});var La=RegExp(`([\\p{Ll}\\d])(\\p{Lu})`,`gu`),Ra=RegExp(`(\\p{Lu})([\\p{Lu}][\\p{Ll}])`,`gu`),za=RegExp(`(\\d)(\\p{Ll})`,`gu`),Ba=RegExp(`(\\p{L})(\\d)`,`gu`),Va=/[^\p{L}\d]+/giu,Ha=`$1\0$2`,Ua=``;function Wa(e,t){let n=e.trim();n=n.replace(La,Ha).replace(Ra,Ha),t?.separateNumbers&&(n=n.replace(za,Ha).replace(Ba,Ha)),n=n.replace(Va,`\0`);let r=0,i=n.length;for(;n.charAt(r)===`\0`;)r++;if(r===i)return[];for(;n.charAt(i-1)===`\0`;)i--;return n.slice(r,i).split(/\0/g)}function Ga(e,t){return oo(e,t?.prefixCharacters)+Wa(e,t).map(no(t?.locale)).join(t?.delimiter??` `)}function Ka(e,t){let n=oo(e,t?.prefixCharacters),r=no(t?.locale),i=ro(t?.locale),a=t?.mergeAmbiguousCharacters?io(r,i):ao(r,i);return n+Wa(e,t).map((e,t)=>t===0?r(e):a(e,t)).join(t?.delimiter??``)}function qa(e,t){let n=oo(e,t?.prefixCharacters),r=no(t?.locale),i=ro(t?.locale),a=t?.mergeAmbiguousCharacters?io(r,i):ao(r,i);return n+Wa(e,t).map(a).join(t?.delimiter??``)}function Ja(e,t){let n=oo(e,t?.prefixCharacters),r=no(t?.locale),i=ro(t?.locale);return n+Wa(e,t).map(io(r,i)).join(t?.delimiter??` `)}function Ya(e,t){return oo(e,t?.prefixCharacters)+Wa(e,t).map(ro(t?.locale)).join(t?.delimiter??`_`)}function Xa(e,t){return Ga(e,{delimiter:`.`,...t})}function Za(e,t){return Ga(e,{delimiter:`-`,...t})}function Qa(e,t){return Ga(e,{delimiter:`/`,...t})}function $a(e,t){let n=oo(e,t?.prefixCharacters),r=no(t?.locale),i=io(r,ro(t?.locale));return n+Wa(e,t).map((e,t)=>t===0?i(e):r(e)).join(t?.delimiter??` `)}function eo(e,t){return Ga(e,{delimiter:`_`,...t})}function to(e,t){return Ja(e,{delimiter:`-`,...t})}function no(e){return e===!1?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function ro(e){return e===!1?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function io(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function ao(e,t){return(n,r)=>{let i=n[0];return(r>0&&i>=`0`&&i<=`9`?`_`+i:t(i))+e(n.slice(1))}}function oo(e,t=Ua){let n=``;for(let r=0;r<e.length;r++){let i=e.charAt(r);if(t.includes(i))n+=i;else break}return n}function so(e,t){let n=``;for(let r of e)n+=Math.random()>.5?r.toLocaleUpperCase(t):r.toLocaleLowerCase(t);return n}function co(e,t){let n=``;for(let r of e){let e=r.toLocaleLowerCase(t);n+=r===e?r.toLocaleUpperCase(t):e}return n}var lo=/\b(?:an?d?|a[st]|because|but|by|en|for|i[fn]|neither|nor|o[fnr]|only|over|per|so|some|tha[tn]|the|to|up|upon|vs?\.?|versus|via|when|with|without|yet)\b/i,uo=/[^\s:–—-]+|./g,fo=/\s/,po=/.(?=[A-Z]|\..)/,mo=/[A-Za-z0-9\u00C0-\u00FF]/;function ho(e){for(var t=``,n;(n=uo.exec(e))!==null;){var r=n[0],i=n.index;if(!po.test(r)&&(!lo.test(r)||i===0||i+r.length===e.length)&&(e.charAt(i+r.length)!==`:`||fo.test(e.charAt(i+r.length+1)))){t+=r.replace(mo,function(e){return e.toUpperCase()});continue}t+=r}return t}var go=Ka,_o=Ja,vo=Ya,yo=Xa,bo=Ga,xo=qa,So=Qa,Co=$a,wo=eo,To=to,Eo=Za,Do=so,Oo=co,ko=ho,Ao=e=>e.toUpperCase(),jo=(e,t)=>e.toLocaleUpperCase(t),Mo=e=>e.toLowerCase(),No=(e,t)=>e.toLocaleLowerCase(t),Po=e=>e.charAt(0).toLowerCase()+e.slice(1),Fo=e=>e.charAt(0).toUpperCase()+e.slice(1),Io=e=>e===e.toUpperCase(),Lo=e=>e===e.toLowerCase(),$=class{};$.camel=go,$.capital=_o,$.constant=vo,$.dot=yo,$.kebab=Eo,$.lower=Mo,$.lowerFirst=Po,$.localeLower=No,$.localeUpper=jo,$.no=bo,$.pascal=xo,$.path=So,$.sentence=Co,$.snake=wo,$.sponge=Do,$.swap=Oo,$.title=ko,$.train=To,$.upper=Ao,$.upperFirst=Fo,$.isUpper=Io,$.isLower=Lo;var Ro=640,zo=1024,Bo=null,Vo=()=>{if(Bo)return Bo;if(!globalThis.document)return 16;let e=globalThis.document.querySelector(`:root`);return Bo=Number(getComputedStyle(e).fontSize.slice(0,-2)),Bo},Ho=({minRem:e,maxRem:t})=>{let n=Vo(),r=Ro/n,i=zo/n,a=(t-e)/(i-r);return`clamp( ${e}rem, ${-r*a+e}rem + ${a*100}cqw, ${t}rem )`},Uo=e=>typeof e==`string`?e:typeof e==`number`?String(e):typeof e==`object`?e.minRem===e.maxRem?`${e.minRem}rem`:Ho(e):``,Wo=(e,t,n,r=!1)=>{let i=``;return n.forEach(n=>{let a=t[n];r&&!a&&n===`borderWidth`&&(a=`0px`),r&&!a&&n===`borderColor`&&(a=`transparent`),a&&(i+=`--${Eo(e)}-${Eo(n)}:${Uo(a)}; `)}),i},Go=(e,t)=>Object.entries(t).map(([t,n])=>`--${e}-${Eo(t)}:${Uo(n)}`).join(`; `)+`; `,Ko=(e,t)=>{let n=``;return n+=Wo(e,t,[`background`,`borderWidth`,`borderColor`,`boxShadow`,`borderRadius`,`color`],!0),t.hover&&(n+=Wo(`${e}-hover`,t.hover,[`background`,`borderWidth`,`borderColor`,`boxShadow`,`color`])),t.focus&&(n+=Wo(`${e}-focus`,t.focus,[`background`,`borderWidth`,`borderColor`,`boxShadow`,`color`])),t.custom&&(n+=Go(e,t.custom)),n},qo=(e,t)=>Object.entries(t).map(([t,n])=>`--color-${e}-${t}:${n}`).join(`; `)+`; `,Jo=e=>`--font-family: ${e?.family||`inherit`};`,Yo=e=>`.chat-app {${Jo(e.font)} ${Object.entries(e.colors).map(([e,t])=>qo(e,t)).join(``)} ${Go(`base`,e.base)} ${Object.entries(e.components).map(([e,t])=>Ko(Eo(e),t)).join(``)}};`;export{Yn as S,yi as _,Pa as a,Br as b,la as c,Yi as d,Y as f,xi as g,Ti as h,X as i,ca as l,ki as m,Ia as n,va as o,Ui as p,Fa as r,fa as s,Yo as t,Ji as u,gi as v,Mr as x,ui as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./
|
|
1
|
+
import{n as e}from"./CERjmziY.js";var t=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`'`).replace(/\n/g,` `),n=(e,n)=>{if(n!==void 0){if(typeof n==`string`)return`${e}="${t(n)}"`;if(typeof n==`boolean`)return n?e:void 0}},r=(t,n)=>t.cdn.value?`https://cdn.jsdelivr.net/npm/@liip/liipgpt@${e}/${n}/liipgpt-${n}.iife.min.js`:`${t[`api-url`].value}/cdn/npm/@liip/liipgpt/${n}/liipgpt-${n}.iife.min.js`,i=(e,t)=>{let i=`<liipgpt-button ${[n(`lang`,e.lang.value),n(`force-theme`,e?.[`force-theme`]?.value),n(`api-url`,e[`api-url`].value)].filter(Boolean).join(` `)}</liipgpt-button>`;if(t){let t=`<script async src="${r(e,`button`)}"><\/script>\n${i}`;return e.CHAT_CONFIG_OVERRIDE.value&&(t=`<script>\n${e.CHAT_CONFIG_OVERRIDE.value}<\/script>\n`+t),e.onclosechat.value&&(t+=`\n<script>${e.onclosechat.value}<\/script>`),t}return i},a=(e,t=!1)=>{if(e[`show-link-button`].value)return i(e,t);let a=`<liipgpt-chat ${[n(`lang`,e.lang.value),n(`force-theme`,e?.[`force-theme`]?.value),n(`api-url`,e[`api-url`].value),n(`loader-background`,e[`loader-background`].value),n(`loader-color`,e[`loader-color`].value),n(`flyout`,e.flyout.value),n(`flyout-style`,e[`flyout-style`].value),n(`flyout-class`,e[`flyout-class`].value),n(`chat-class`,e[`chat-class`].value)].filter(Boolean).join(` `)}>${e[`custom-loader`].value?`<div slot="loader">${e[`custom-loader`].value}</div>`:``}</liipgpt-chat>`;if(t){let t=`<script async src="${r(e,`chat`)}"><\/script>\n${a}`;return e.CHAT_CONFIG_OVERRIDE.value&&(t=`<script>\n${e.CHAT_CONFIG_OVERRIDE.value}<\/script>\n`+t),e.onclosechat.value&&(t+=`\n<script>${e.onclosechat.value}<\/script>`),t}return a};export{r as n,a as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,At as t,B as n,Bt as r,Ct as i,D as a,Dt as o,E as s,Ft as c,G as l,H as u,Ht as d,I as f,J as p,K as m,L as h,M as g,Mt as _,N as v,Nt as y,O as b,Ot as x,P as S,Pt as C,Q as w,R as T,Rt as E,T as D,Tt as O,U as k,Vt as A,W as j,X as M,Y as N,_ as ee,_t as P,at as te,c as ne,d as re,dt as F,et as ie,f as ae,ft as oe,g as I,gt as L,ht as se,i as R,j as ce,jt as le,k as ue,lt as de,nt as fe,o as z,ot as pe,p as me,pt as he,q as B,r as ge,rt as V,s as H,tt as _e,u as ve,ut as U,v as W,vt as G,w as ye,x as be,xt as K,yt as xe,z as Se}from"./BdP-K7KO.js";import{a as Ce,c as we,d as Te,h as Ee,i as q,l as De,m as Oe,o as ke,r as Ae}from"./
|
|
1
|
+
import{$ as e,At as t,B as n,Bt as r,Ct as i,D as a,Dt as o,E as s,Ft as c,G as l,H as u,Ht as d,I as f,J as p,K as m,L as h,M as g,Mt as _,N as v,Nt as y,O as b,Ot as x,P as S,Pt as C,Q as w,R as T,Rt as E,T as D,Tt as O,U as k,Vt as A,W as j,X as M,Y as N,_ as ee,_t as P,at as te,c as ne,d as re,dt as F,et as ie,f as ae,ft as oe,g as I,gt as L,ht as se,i as R,j as ce,jt as le,k as ue,lt as de,nt as fe,o as z,ot as pe,p as me,pt as he,q as B,r as ge,rt as V,s as H,tt as _e,u as ve,ut as U,v as W,vt as G,w as ye,x as be,xt as K,yt as xe,z as Se}from"./BdP-K7KO.js";import{a as Ce,c as we,d as Te,h as Ee,i as q,l as De,m as Oe,o as ke,r as Ae}from"./CIVgedTF.js";var je=(e,t)=>{let n=window.LIIPGPT_LISTENERS?.elements?.[t];if(!n)return;let r=Object.entries(n).filter(([e,t])=>typeof t==`function`&&![`init`,`destroy`].includes(e));F(()=>(n.init?.(e),r.forEach(([t,n])=>{e.addEventListener(t,n)}),()=>{r.forEach(([t,n])=>{e.removeEventListener(t,n)}),n.destroy?.(e)}))},Me=(e,t)=>{t&&Ce.setTarget(t,e)},Ne=B(`<div aria-hidden="true"></div>`);function J(e,t){C(t,!0);let n=z(t,`name`,7),r=z(t,`class`,7);var i={get name(){return n()},set name(e){n(e),x()},get class(){return r()},set class(e){r(e),x()}},a=Ne();return f(a,()=>q.theme.svgs[n()],!0),A(a),U(()=>D(a,1,`svg svg--${n()??``} ${r()??``}`)),l(e,a),y(i)}R(J,{name:{},class:{}},[],[],{mode:`open`});var Pe=`data-disable-tooltip-on-focus`;function Fe(e,t){let n=null,r;function i(){t.text&&(n||(n=document.createElement(`span`),n.ariaHidden=`true`,n.textContent=t.text,n.className=`tooltip tooltip-${t.position||`top`} tooltip-hidden`,e.appendChild(n),n.getBoundingClientRect()),n.classList.remove(`tooltip-hidden`),a())}function a(){if(!n)return;let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),a,o;switch(t.position){case`bottom`:a=r.height+5,o=r.width/2-i.width/2;break;case`bottom-right`:a=r.height+5,o=r.width-i.width;break;case`bottom-left`:a=r.height+5,o=0;break;case`left`:a=r.height/2-i.height/2,o=-i.width-5;break;case`right`:a=r.height/2-i.height/2,o=r.width+5;break;default:a=-i.height-5,o=r.width/2-i.width/2;break}let s=r.left+o,c=s+i.width,l=window.innerWidth;if(c>l){let e=c-l;if(o-=e+10,t.position===`top`||t.position===`bottom`){let t=e+10;n.style.setProperty(`--tooltip-arrow-offset`,`${t}px`)}}if(s<0&&(o-=s-10,t.position===`top`||t.position===`bottom`)){let e=s-10;n.style.setProperty(`--tooltip-arrow-offset`,`${e}px`)}n.style.top=`${a}px`,n.style.left=`${o}px`}function o(){r=window.setTimeout(()=>{i()},t.delay||200)}function s(e){let t=e.target;t&&!t.hasAttribute(`data-disable-tooltip-on-focus`)?o():t.removeAttribute(Pe)}function c(){clearTimeout(r),n&&(n.classList.add(`tooltip-hidden`),n.addEventListener(`transitionend`,()=>{n?.remove(),n=null},{once:!0}))}return e.classList.add(`tooltip-container`),e.setAttribute(`tabindex`,`0`),e.addEventListener(`mouseenter`,o),e.addEventListener(`focus`,s),e.addEventListener(`mouseleave`,c),e.addEventListener(`blur`,c),e.addEventListener(`click`,c),{update(e){t=e},destroy(){c(),e.classList.remove(`tooltip-container`),e.removeEventListener(`mouseenter`,o),e.removeEventListener(`focus`,s),e.removeEventListener(`mouseleave`,c),e.removeEventListener(`blur`,c),e.removeEventListener(`click`,c)}}}var Ie=B(`<button><span class="sr-only"> </span> <span><!></span></button>`);function Le(e,t){C(t,!0);let n=z(t,`class`,7),r=z(t,`tooltip`,7),i=z(t,`label`,7),a=z(t,`onclick`,7),o=z(t,`icon`,7),c=H(t,[`$$slots`,`$$events`,`$$legacy`,`$$host`,`class`,`tooltip`,`label`,`onclick`,`icon`]);var u={get class(){return n()},set class(e){n(e),x()},get tooltip(){return r()},set tooltip(e){r(e),x()},get label(){return i()},set label(e){i(e),x()},get onclick(){return a()},set onclick(e){a(e),x()},get icon(){return o()},set icon(e){o(e),x()}},d=Ie();I(d,()=>({onclick:a(),...c}));var f=L(d),p=L(f,!0);A(f);var m=G(f,2);return J(L(m),{get name(){return o()}}),A(m),A(d),b(d,(e,t)=>Fe?.(e,t),()=>({text:r(),position:`top`,delay:300})),U(()=>{k(p,i()),D(m,1,s(n()))}),l(e,d),y(u)}R(Le,{class:{},tooltip:{},label:{},onclick:{},icon:{}},[],[],{mode:`open`});var Re;function ze(e,t,n,r,i){Re&&cancelAnimationFrame(Re);let a=e instanceof Window?r===`scrollTop`?window.scrollY:window.scrollX:e[r],o=performance.now();function s(c){let l=c-o,u=Math.min(l/n,1),d=i(u),f=a+(t-a)*d;e instanceof Window?r===`scrollTop`?window.scrollTo({top:f,behavior:`instant`}):window.scrollTo({left:f,behavior:`instant`}):e[r]=f,u<1?Re=requestAnimationFrame(s):e.dispatchEvent(new CustomEvent(`scrollcomplete`))}Re=requestAnimationFrame(s)}function Be(e){return typeof e==`function`}function Ve(e){return typeof e==`object`&&!!e}var He=[`string`,`number`,`bigint`,`boolean`];function Ue(e){return e==null||He.includes(typeof e)?!0:Array.isArray(e)?e.every(e=>Ue(e)):typeof e==`object`?Object.getPrototypeOf(e)===Object.prototype:!1}var We=Symbol(`box`),Ge=Symbol(`is-writable`);function Y(e,t){let n=O(e);return t?{[We]:!0,[Ge]:!0,get current(){return V(n)},set current(e){t(e)}}:{[We]:!0,get current(){return e()}}}function Ke(e){return Ve(e)&&We in e}function qe(e){return Ke(e)&&Ge in e}function Je(e){return Ke(e)?e:Be(e)?Y(e):Ze(e)}function Ye(e){return Object.entries(e).reduce((e,[t,n])=>Ke(n)?(qe(n)?Object.defineProperty(e,t,{get(){return n.current},set(e){n.current=e}}):Object.defineProperty(e,t,{get(){return n.current}}),e):Object.assign(e,{[t]:n}),{})}function Xe(e){return qe(e)?{[We]:!0,get current(){return e.current}}:e}function Ze(e){let t=i(xe(e));return{[We]:!0,[Ge]:!0,get current(){return V(t)},set current(e){K(t,e,!0)}}}function Qe(e){let t=i(xe(e));return{[We]:!0,[Ge]:!0,get current(){return V(t)},set current(e){K(t,e,!0)}}}Qe.from=Je,Qe.with=Y,Qe.flatten=Ye,Qe.readonly=Xe,Qe.isBox=Ke,Qe.isWritableBox=qe;function $e(...e){return function(t){for(let n of e)if(n){if(t.defaultPrevented)return;typeof n==`function`?n.call(this,t):n.current?.call(this,t)}}}var et=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,tt=/\n/g,nt=/^\s*/,rt=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,it=/^:\s*/,at=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,ot=/^[;\s]*/,st=/^\s+|\s+$/g,ct=`
|
|
2
2
|
`,lt=`/`,ut=`*`,dt=``,ft=`comment`,pt=`declaration`;function mt(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var n=1,r=1;function i(e){var t=e.match(tt);t&&(n+=t.length);var i=e.lastIndexOf(ct);r=~i?e.length-i:r+e.length}function a(){var e={line:n,column:r};return function(t){return t.position=new o(e),l(),t}}function o(e){this.start=e,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(i){var a=Error(t.source+`:`+n+`:`+r+`: `+i);if(a.reason=i,a.filename=t.source,a.line=n,a.column=r,a.source=e,!t.silent)throw a}function c(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function l(){c(nt)}function u(e){var t;for(e||=[];t=d();)t!==!1&&e.push(t);return e}function d(){var t=a();if(!(lt!=e.charAt(0)||ut!=e.charAt(1))){for(var n=2;dt!=e.charAt(n)&&(ut!=e.charAt(n)||lt!=e.charAt(n+1));)++n;if(n+=2,dt===e.charAt(n-1))return s(`End of comment missing`);var o=e.slice(2,n-2);return r+=2,i(o),e=e.slice(n),r+=2,t({type:ft,comment:o})}}function f(){var e=a(),t=c(rt);if(t){if(d(),!c(it))return s(`property missing ':'`);var n=c(at),r=e({type:pt,property:ht(t[0].replace(et,dt)),value:n?ht(n[0].replace(et,dt)):dt});return c(ot),r}}function p(){var e=[];u(e);for(var t;t=f();)t!==!1&&(e.push(t),u(e));return e}return l(),p()}function ht(e){return e?e.replace(st,dt):dt}function gt(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=mt(e),i=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:a}=e;i?t(r,a,e):a&&(n||={},n[r]=a)}),n}var _t=/\d/,vt=[`-`,`_`,`/`,`.`];function yt(e=``){if(!_t.test(e))return e!==e.toLowerCase()}function bt(e){let t=[],n=``,r,i;for(let a of e){let e=vt.includes(a);if(e===!0){t.push(n),n=``,r=void 0;continue}let o=yt(a);if(i===!1){if(r===!1&&o===!0){t.push(n),n=a,r=o;continue}if(r===!0&&o===!1&&n.length>1){let e=n.at(-1);t.push(n.slice(0,Math.max(0,n.length-1))),n=e+a,r=o;continue}}n+=a,r=o,i=e}return t.push(n),t}function xt(e){return e?bt(e).map(e=>Ct(e)).join(``):``}function St(e){return wt(xt(e||``))}function Ct(e){return e?e[0].toUpperCase()+e.slice(1):``}function wt(e){return e?e[0].toLowerCase()+e.slice(1):``}function Tt(e){if(!e)return{};let t={};function n(e,n){if(e.startsWith(`-moz-`)||e.startsWith(`-webkit-`)||e.startsWith(`-ms-`)||e.startsWith(`-o-`)){t[xt(e)]=n;return}if(e.startsWith(`--`)){t[e]=n;return}t[St(e)]=n}return gt(e,n),t}function Et(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}function Dt(e,t){let n=RegExp(e,`g`);return e=>{if(typeof e!=`string`)throw TypeError(`expected an argument of type string, but got ${typeof e}`);return e.match(n)?e.replace(n,t):e}}var Ot=Dt(/[A-Z]/,e=>`-${e.toLowerCase()}`);function kt(e){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`expected an argument of type object, but got ${typeof e}`);return Object.keys(e).map(t=>`${Ot(t)}: ${e[t]};`).join(`
|
|
3
3
|
`)}function At(e={}){return kt(e).replace(`
|
|
4
4
|
`,` `)}var jt=new Set(`onabort.onanimationcancel.onanimationend.onanimationiteration.onanimationstart.onauxclick.onbeforeinput.onbeforetoggle.onblur.oncancel.oncanplay.oncanplaythrough.onchange.onclick.onclose.oncompositionend.oncompositionstart.oncompositionupdate.oncontextlost.oncontextmenu.oncontextrestored.oncopy.oncuechange.oncut.ondblclick.ondrag.ondragend.ondragenter.ondragleave.ondragover.ondragstart.ondrop.ondurationchange.onemptied.onended.onerror.onfocus.onfocusin.onfocusout.onformdata.ongotpointercapture.oninput.oninvalid.onkeydown.onkeypress.onkeyup.onload.onloadeddata.onloadedmetadata.onloadstart.onlostpointercapture.onmousedown.onmouseenter.onmouseleave.onmousemove.onmouseout.onmouseover.onmouseup.onpaste.onpause.onplay.onplaying.onpointercancel.onpointerdown.onpointerenter.onpointerleave.onpointermove.onpointerout.onpointerover.onpointerup.onprogress.onratechange.onreset.onresize.onscroll.onscrollend.onsecuritypolicyviolation.onseeked.onseeking.onselect.onselectionchange.onselectstart.onslotchange.onstalled.onsubmit.onsuspend.ontimeupdate.ontoggle.ontouchcancel.ontouchend.ontouchmove.ontouchstart.ontransitioncancel.ontransitionend.ontransitionrun.ontransitionstart.onvolumechange.onwaiting.onwebkitanimationend.onwebkitanimationiteration.onwebkitanimationstart.onwebkittransitionend.onwheel`.split(`.`));function Mt(e){return jt.has(e)}function X(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];if(r){for(let e of Object.keys(r)){let n=t[e],i=r[e],o=typeof n==`function`,s=typeof i==`function`;if(o&&typeof s&&Mt(e))t[e]=$e(n,i);else if(o&&s)t[e]=Et(n,i);else if(e===`class`){let r=Ue(n),o=Ue(i);r&&o?t[e]=a(n,i):r?t[e]=a(n):o&&(t[e]=a(i))}else if(e===`style`){let r=typeof n==`object`,a=typeof i==`object`,o=typeof n==`string`,s=typeof i==`string`;if(r&&a)t[e]={...n,...i};else if(r&&s){let r=Tt(i);t[e]={...n,...r}}else if(o&&a)t[e]={...Tt(n),...i};else if(o&&s){let r=Tt(n),a=Tt(i);t[e]={...r,...a}}else r?t[e]=n:a?t[e]=i:o?t[e]=n:s&&(t[e]=i)}else t[e]=i===void 0?n:i}for(let e of Object.getOwnPropertySymbols(r)){let n=t[e],i=r[e];t[e]=i===void 0?n:i}}}return typeof t.style==`object`&&(t.style=At(t.style).replaceAll(`
|