@liip/liipgpt 3.9.1 → 3.9.2

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.
Files changed (28) hide show
  1. package/chat/liipgpt-chat.iife.js +20 -20
  2. package/configurator/_app/env.js +1 -1
  3. package/configurator/_app/immutable/chunks/{Z70hfwyo.js → B7iNpEKB.js} +1 -1
  4. package/configurator/_app/immutable/chunks/B9Sj_kOF.js +2 -0
  5. package/configurator/_app/immutable/chunks/{DPni1rWl.js → Bo_I9OnC.js} +1 -1
  6. package/configurator/_app/immutable/chunks/C4jvtK34.js +1 -0
  7. package/configurator/_app/immutable/chunks/{DAn_q4l-.js → C5QUeOT4.js} +4 -4
  8. package/configurator/_app/immutable/chunks/{p7ChcveW.js → D1JxtiVt.js} +1 -1
  9. package/configurator/_app/immutable/chunks/{DfXcv-Ak.js → DY91rqbt.js} +3 -3
  10. package/configurator/_app/immutable/chunks/{BDbfujSm.js → Qr3QoTpa.js} +1 -1
  11. package/configurator/_app/immutable/chunks/{CKhT1xS_.js → ZVK8Dk3M.js} +1 -1
  12. package/configurator/_app/immutable/entry/{app.ft0cgG-t.js → app.CNOaE4a-.js} +2 -2
  13. package/configurator/_app/immutable/entry/start.Dt2jlaUG.js +1 -0
  14. package/configurator/_app/immutable/nodes/{0.CXGLTbqu.js → 0.5_GG2VVz.js} +1 -1
  15. package/configurator/_app/immutable/nodes/{1.DJw369ut.js → 1.CC4YG4vs.js} +1 -1
  16. package/configurator/_app/immutable/nodes/{2.Dx5eSBWM.js → 2.Bsn6JT-r.js} +3 -3
  17. package/configurator/_app/immutable/nodes/{3.CjC17y9u.js → 3.BGFB6L4G.js} +1 -1
  18. package/configurator/_app/version.json +1 -1
  19. package/configurator/index.html +6 -6
  20. package/configurator/sidebar.html +6 -6
  21. package/index.cjs +62 -0
  22. package/index.d.ts +34 -0
  23. package/index.js +62 -0
  24. package/package.json +1 -1
  25. package/search-summary/liipgpt-search-summary.iife.js +5 -5
  26. package/configurator/_app/immutable/chunks/BDHUTFW9.js +0 -2
  27. package/configurator/_app/immutable/chunks/C6m1Wdl1.js +0 -1
  28. package/configurator/_app/immutable/entry/start.BxzUuOt1.js +0 -1
@@ -1,4 +1,4 @@
1
- var e=`https://liipgpt.dev.cluster.liipgpt.ch/liipgpt`,t=`3.9.1`,n=new Map;async function r(e){let t=n.get(e);if(t)return t;let r=await fetch(e),i=r.url,a=await r.arrayBuffer(),o=await crypto.subtle.digest(`SHA-384`,a),s={versionedUrl:i,integrity:`sha384-${btoa(String.fromCharCode(...new Uint8Array(o)))}`};return n.set(e,s),s}var i=/\/\*\s*@host-class:\s*([a-zA-Z_-][\w-]*)\s*\*\//;function a(e,t=`your-custom-class-wrapper`){let n=e.match(i);if(n)return n[1];let r=e.match(/\.([a-zA-Z_-][\w-]*)\s+\.search-summary\b/);if(r)return r[1];let a=e.match(/liipgpt-search-summary\.([a-zA-Z_-][\w-]*)/);return a?a[1]:t}var o=`/* Host tokens — set on the custom element, inherited by .search-summary and descendants */
1
+ var e=`https://liipgpt.dev.cluster.liipgpt.ch/liipgpt`,t=`3.9.2`,n=new Map;async function r(e){let t=n.get(e);if(t)return t;let r=await fetch(e),i=r.url,a=await r.arrayBuffer(),o=await crypto.subtle.digest(`SHA-384`,a),s={versionedUrl:i,integrity:`sha384-${btoa(String.fromCharCode(...new Uint8Array(o)))}`};return n.set(e,s),s}var i=/\/\*\s*@host-class:\s*([a-zA-Z_-][\w-]*)\s*\*\//;function a(e,t=`your-custom-class-wrapper`){let n=e.match(i);if(n)return n[1];let r=e.match(/\.([a-zA-Z_-][\w-]*)\s+\.search-summary\b/);if(r)return r[1];let a=e.match(/liipgpt-search-summary\.([a-zA-Z_-][\w-]*)/);return a?a[1]:t}var o=`/* Host tokens — set on the custom element, inherited by .search-summary and descendants */
2
2
  liipgpt-search-summary.your-custom-class-wrapper {
3
3
  --search-summary-padding: 1rem;
4
4
  --search-summary-background: #fff;
@@ -54,8 +54,8 @@ ${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>${q(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=zt(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+q(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=zt(e);if(i===null)return q(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${q(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:q(e.text)}},qt=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``}},Y=class e{options;renderer;textRenderer;constructor(e){this.options=e||E,this.options.renderer=this.options.renderer||new Kt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new qt}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}},Jt=class{options;block;constructor(e){this.options=e||E}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?J.lex:J.lexInline}provideParser(){return this.block?Y.parse:Y.parseInline}},Yt=class{defaults=Ze();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Y;Renderer=Kt;TextRenderer=qt;Lexer=J;Tokenizer=Gt;Hooks=Jt;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 Kt(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 Gt(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 Jt;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];Jt.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 J.lex(e,t??this.defaults)}parser(e,t){return Y.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?J.lex:J.lexInline,s=i.hooks?i.hooks.provideParser():e?Y.parse:Y.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>`+q(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},X=new Yt;function Z(e,t){return X.parse(e,t)}Z.options=Z.setOptions=function(e){return X.setOptions(e),Z.defaults=X.defaults,Qe(Z.defaults),Z},Z.getDefaults=Ze,Z.defaults=E,Z.use=function(...e){return X.use(...e),Z.defaults=X.defaults,Qe(Z.defaults),Z},Z.walkTokens=function(e,t){return X.walkTokens(e,t)},Z.parseInline=X.parseInline,Z.Parser=Y,Z.parser=Y.parse,Z.Renderer=Kt,Z.TextRenderer=qt,Z.Lexer=J,Z.lexer=J.lex,Z.Tokenizer=Gt,Z.Hooks=Jt,Z.parse=Z,Z.options,Z.setOptions,Z.use,Z.walkTokens,Z.parseInline,Y.parse,J.lex;var Xt=e=>(Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t];n&&typeof n==`object`&&Xt(n)}),Object.freeze(e)),Zt=Xt({all:[],used:[],unused:[]}),Qt=(e,t)=>{let n=T(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},$t=class{marked;currentReferences=Zt;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new Yt({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=Qt(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,`&quot;`)}"></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=Zt,n}};function en(){let e,t;return{promise:new Promise((n,r)=>{t=n,e=r}),reject:e,resolve:t}}var tn=class{promise;resolve;reject;constructor(){let{promise:e,resolve:t,reject:n}=en();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`},nn=class{hasValue=new tn;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`},rn=e=>{try{return new URL(e).hostname}catch{return e}};function an(e){return e.replace(/<[^>]*>/g,``).replace(/&nbsp;/g,` `).replace(/&amp;/g,`&`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`)}var on=({url:e,considered:t,title:n,description:r,summary:i})=>{let a=rn(e);return{url:e,considered:t,referenceIndex:{},score:0,metadata:{},display:{card:{title:n,description:r||i,badge:e},listItem:{title:n,badge:a}}}},sn=class{store;content=new nn;backendSendsMappedRefs=!1;constructor(e){this.options=e,this.store=n({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=an(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(on(e))}updateRetrievalQuestion(e){this.store.update(t=>({...t,retrievalQuestion:e}))}setNoFeedback(){this.store.update(e=>({...e,noFeedback:!0}))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}},cn=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)}},ln=class{latestRequest=new nn;state=n({state:`idle`});id;history=[];constructor(e){this.clientPrimitive=e,this.id=e.createConversationId()}subscribe(e){return this.state.subscribe(e)}chat(e,t={}){let n=this.clientPrimitive.chat(this.id,e,t);return this.history.push(n),this.latestRequest.setValue({question:e,response:n}),n}async abort(){let e=this.history.map(e=>e.abort());await Promise.all(e)}async thumbsUp(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsUp(t.id,e)}async thumbsDown(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsDown(t.id,e)}async feedback(e){let{question:t,response:n}=await this.latestRequest;await n.isReadyForFeedback(),await this.clientPrimitive.feedback(n.id,t,e)}},Q=[];for(let e=0;e<256;++e)Q.push((e+256).toString(16).slice(1));function un(e,t=0){return(Q[e[t+0]]+Q[e[t+1]]+Q[e[t+2]]+Q[e[t+3]]+`-`+Q[e[t+4]]+Q[e[t+5]]+`-`+Q[e[t+6]]+Q[e[t+7]]+`-`+Q[e[t+8]]+Q[e[t+9]]+`-`+Q[e[t+10]]+Q[e[t+11]]+Q[e[t+12]]+Q[e[t+13]]+Q[e[t+14]]+Q[e[t+15]]).toLowerCase()}var dn,fn=new Uint8Array(16);function pn(){if(!dn){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);dn=crypto.getRandomValues.bind(crypto)}return dn(fn)}var mn={};function hn(e,t,n){let r;if(e)r=_n(e.random??e.rng?.()??pn(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=pn();gn(mn,e,i),r=_n(i,mn.msecs,mn.seq,t,n)}return t??un(r)}function gn(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 _n(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 vn=new Map,yn=class{get length(){return vn.size}clear(){vn.clear()}getItem(e){return vn.get(e)||null}key(e){return Array.from(vn.keys())[e]||null}removeItem(e){vn.delete(e)}setItem(e,t){vn.set(e,String(t))}},bn=globalThis.localStorage??new yn,xn=async(e,t)=>{try{let n=bn.getItem(`liipgpt:uID`)||bn.getItem(`uID`),r={method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:n,...t?{startParameters:t}:{}})},i=await e.fetchData(`/login`,m,{},r).catch(t=>(console.log(`Failed to /login use /log`,t),e.fetchData(`/log`,m,{},r)));if(`maintenance`in i&&i.maintenance)return{mode:`maintenance`};if(!(`id`in i))throw Error(`Invalid response format: missing user id`);return bn.setItem(`liipgpt:uID`,i.id),{mode:`ready`,userId:i.id}}catch(e){throw console.error(`Failed to fetch user data:`,e),e}},$=function(e,t){if(!(this instanceof $))return new $(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=$.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($.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>`+q(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},X=new Yt;function Z(e,t){return X.parse(e,t)}Z.options=Z.setOptions=function(e){return X.setOptions(e),Z.defaults=X.defaults,Qe(Z.defaults),Z},Z.getDefaults=Ze,Z.defaults=E,Z.use=function(...e){return X.use(...e),Z.defaults=X.defaults,Qe(Z.defaults),Z},Z.walkTokens=function(e,t){return X.walkTokens(e,t)},Z.parseInline=X.parseInline,Z.Parser=Y,Z.parser=Y.parse,Z.Renderer=Kt,Z.TextRenderer=qt,Z.Lexer=J,Z.lexer=J.lex,Z.Tokenizer=Gt,Z.Hooks=Jt,Z.parse=Z,Z.options,Z.setOptions,Z.use,Z.walkTokens,Z.parseInline,Y.parse,J.lex;var Xt=e=>(Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t];n&&typeof n==`object`&&Xt(n)}),Object.freeze(e)),Zt=Xt({all:[],used:[],unused:[]}),Qt=(e,t)=>{let n=T(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},$t=class{marked;currentReferences=Zt;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new Yt({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=Qt(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,`&quot;`)}"></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=Zt,n}};function en(){let e,t;return{promise:new Promise((n,r)=>{t=n,e=r}),reject:e,resolve:t}}var tn=class{promise;resolve;reject;constructor(){let{promise:e,resolve:t,reject:n}=en();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`},nn=class{hasValue=new tn;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`},rn=e=>{try{return new URL(e).hostname}catch{return e}};function an(e){return e.replace(/<[^>]*>/g,``).replace(/&nbsp;/g,` `).replace(/&amp;/g,`&`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`)}var on=({url:e,considered:t,title:n,description:r,summary:i})=>{let a=rn(e);return{url:e,considered:t,referenceIndex:{},score:0,metadata:{},display:{card:{title:n,description:r||i,badge:e},listItem:{title:n,badge:a}}}},sn=class{store;content=new nn;backendSendsMappedRefs=!1;constructor(e){this.options=e,this.store=n({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=an(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(on(e))}updateRetrievalQuestion(e){this.store.update(t=>({...t,retrievalQuestion:e}))}setNoFeedback(){this.store.update(e=>({...e,noFeedback:!0}))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}},cn=[{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)}],ln=e=>{for(let t of cn)if(t.check(e))return t.type},un=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)}},dn=class{latestRequest=new nn;state=n({state:`idle`});id;history=[];constructor(e){this.clientPrimitive=e,this.id=e.createConversationId()}subscribe(e){return this.state.subscribe(e)}chat(e,t={}){let n=this.clientPrimitive.chat(this.id,e,t);return this.history.push(n),this.latestRequest.setValue({question:e,response:n}),n}async abort(){let e=this.history.map(e=>e.abort());await Promise.all(e)}async thumbsUp(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsUp(t.id,e)}async thumbsDown(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsDown(t.id,e)}async feedback(e){let{question:t,response:n}=await this.latestRequest;await n.isReadyForFeedback(),await this.clientPrimitive.feedback(n.id,t,e)}},Q=[];for(let e=0;e<256;++e)Q.push((e+256).toString(16).slice(1));function fn(e,t=0){return(Q[e[t+0]]+Q[e[t+1]]+Q[e[t+2]]+Q[e[t+3]]+`-`+Q[e[t+4]]+Q[e[t+5]]+`-`+Q[e[t+6]]+Q[e[t+7]]+`-`+Q[e[t+8]]+Q[e[t+9]]+`-`+Q[e[t+10]]+Q[e[t+11]]+Q[e[t+12]]+Q[e[t+13]]+Q[e[t+14]]+Q[e[t+15]]).toLowerCase()}var pn,mn=new Uint8Array(16);function hn(){if(!pn){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);pn=crypto.getRandomValues.bind(crypto)}return pn(mn)}var gn={};function _n(e,t,n){let r;if(e)r=yn(e.random??e.rng?.()??hn(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=hn();vn(gn,e,i),r=yn(i,gn.msecs,gn.seq,t,n)}return t??fn(r)}function vn(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 yn(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 bn=new Map,xn=class{get length(){return bn.size}clear(){bn.clear()}getItem(e){return bn.get(e)||null}key(e){return Array.from(bn.keys())[e]||null}removeItem(e){bn.delete(e)}setItem(e,t){bn.set(e,String(t))}},Sn=globalThis.localStorage??new xn,Cn=async(e,t)=>{try{let n=Sn.getItem(`liipgpt:uID`)||Sn.getItem(`uID`),r={method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:n,...t?{startParameters:t}:{}})},i=await e.fetchData(`/login`,m,{},r).catch(t=>(console.log(`Failed to /login use /log`,t),e.fetchData(`/log`,m,{},r)));if(`maintenance`in i&&i.maintenance)return{mode:`maintenance`};if(!(`id`in i))throw Error(`Invalid response format: missing user id`);return Sn.setItem(`liipgpt:uID`,i.id),{mode:`ready`,userId:i.id}}catch(e){throw console.error(`Failed to fetch user data:`,e),e}},$=function(e,t){if(!(this instanceof $))return new $(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=$.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($.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
- `);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($.OPEN)}},this.stream=function(){if(!this.xhr){this._setReadyState($.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()};$.INITIALIZING=-1,$.CONNECTING=0,$.OPEN=1,$.CLOSED=2;var Sn=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??$)(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())}},Cn=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!=null)),wn=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=Cn(t);return this.options.apiKey&&(n.apiKey=this.options.apiKey),new Sn(`${this.options.apiUrl}${e}`,n,r)}async fetchData(e,t,n={},r={}){let i=`${this.options.apiUrl}${e}?${new URLSearchParams(Cn(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:
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($.OPEN)}},this.stream=function(){if(!this.xhr){this._setReadyState($.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()};$.INITIALIZING=-1,$.CONNECTING=0,$.OPEN=1,$.CLOSED=2;var wn=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??$)(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())}},Tn=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!=null)),En=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=Tn(t);return this.options.apiKey&&(n.apiKey=this.options.apiKey),new wn(`${this.options.apiUrl}${e}`,n,r)}async fetchData(e,t,n={},r={}){let i=`${this.options.apiUrl}${e}?${new URLSearchParams(Tn(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:
61
- `,{error:u,url:i,opts:a,data:s}),s}async postData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,headers:this.getDefaultHeaders(),body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}async postFormData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,body:t});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}},Tn=f({links:p(f({url:u().url().optional(),title:u().optional(),considered:d().optional(),orgMetadata:f({authors:p(u()).optional()}).optional(),type:u().optional(),date:u().datetime().optional(),similarity:l().optional(),content:u().optional(),fromFullTextSearch:d().optional(),rerank:f({index:l().int().optional(),adjustment:l().optional(),score:l().optional(),similarityOld:l().optional()}).optional()}).or(re))}),En=e=>{if(`metadata`in e)return e;console.warn(`Please upgrade your backend you are currently using an old api feature.`);let t=e.orgMetadata??{};e?.fromFullTextSearch&&(t.fromFullTextSearch=e?.fromFullTextSearch),e?.rerank&&(t.rerank=e?.rerank);let n=[],r=e.title??``;if(e.title&&e.title.includes(` > `)){let t=e.title.split(` > `);r=t.pop()??``,n=t}return{url:e.url??``,title:r,score:e.similarity||0,breadcrumbs:n,metadata:t,description:e.content,date:e.date}},Dn=7,On=8,kn=160,An=e=>{let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`<`){let r=e.indexOf(`>`,n);if(r!==-1){t.push({type:`tag`,value:e.slice(n,r+1)}),n=r+1;continue}}if(/\s/.test(r)){let r=n;for(;r<e.length&&/\s/.test(e[r]);)r++;t.push({type:`space`,value:e.slice(n,r)}),n=r;continue}let i=n;for(;i<e.length&&!/\s/.test(e[i])&&e[i]!==`<`;)i++;t.push({type:`word`,value:e.slice(n,i)}),n=i}return t},jn=e=>{let t=An(e),n=[],r=``,i=!1;for(let e of t)e.type===`space`&&i?(n.push(r),r=e.value,i=!1):(r+=e.value,e.type===`word`&&(i=!0));return r&&n.push(r),n},Mn=e=>Math.max(On,Math.min(kn,e.length*Dn)),Nn=class{queue=[];timeoutId=null;isProcessing=!1;constructor(e){this.onText=e}ingestText(e){let t=jn(e);if(t.length>=5){for(let e of t)this.queue.push({kind:`text`,chunk:e,delayMs:Mn(e)});this.kickoff();return}this.runAfterTyping(()=>this.onText(e))}runAfterTyping(e){if(this.queue.length===0&&!this.isProcessing){e();return}this.queue.push({kind:`fn`,fn:e}),this.kickoff()}runWithWarmup(e){this.queue.push({kind:`fn`,fn:e}),this.kickoff()}clear(){this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.queue=[],this.isProcessing=!1}kickoff(){this.isProcessing||this.timeoutId!==null||(this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},750))}processNext(){let e=this.queue.shift();if(!e){this.isProcessing=!1;return}this.isProcessing=!0,e.kind===`text`?(this.onText(e.chunk),this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},e.delayMs)):(e.fn(),this.processNext())}},Pn=class{constructor(e){this.results=e}},Fn=class{internalData;renderers=new Map;markedExtensions=[];_newTabSrText;constructor(e){let t=new wn({apiUrl:e.apiUrl,apiKey:e.apiKey,speechRecognitionApiKey:e.speechRecognitionApiKey,strict:e.strict??!1,EventSource:e.EventSource??EventSource});this.internalData={restClient:t,metadata:xn(t,e.startParameters),searchResponseMap:new Map,chatResponseMap:new Map,conversationMap:new Map}}setMarkedExtensions(...e){this.markedExtensions=e}setNewTabSrText(e){this._newTabSrText=e}getMetadata(){return this.internalData.metadata}createConversationId(){let e=hn();return this.renderers.set(e,new $t({extensions:this.markedExtensions,newTabSrText:this._newTabSrText})),e}chat(e,t,n={}){let r=new nn,i=hn(),a=new tn,o=new sn({id:i,onError:e=>{n.onError?.(e)},onFinish:e=>{r.setValue(e)},markdownRenderer:this.renderers.get(e)??new $t({extensions:this.markedExtensions,newTabSrText:this._newTabSrText}),userQuestion:t}),s=async()=>{await a,(await c).close()},c=new nn,l=new Nn(e=>o.updateText(e));(async()=>{let s=await this.internalData.metadata;if(s.mode===`maintenance`)throw Error(`Can not chat in maintenance mode`);let u=await this.internalData.restClient.subscribeSse(`/assistant/sse`,{query:t,uID:s.userId,cID:e,rID:i,lang:n.lang,feature:n.features?.join(`,`),referrer:n.referrer,source:n.source,...n.selectorValues??{},...n.mode?{mode:n.mode}:{},...n.cache?{cache:!0}:{},...n.predefinedQuestionId?{predefinedQuestionId:n.predefinedQuestionId}:{},...n.switchQuestionId?{switchQuestionId:n.switchQuestionId}:{},chat:`true`,version:`2`},{onClose:()=>{l.clear(),o.finishMessage(),a.resolve(),r.cleanup()},onMessage:t=>{let r=t;switch(r.type){case`error`:l.runAfterTyping(()=>o.pushError(r.error));break;case`id`:r.for===`request`&&i!==r.id&&console.warn(`Unexpected request id "${r.id}" expected "${i}"`),r.for===`conversation`&&e!==r.id&&console.warn(`Unexpected conversation id "${r.id}" expected "${e}"`);break;case`state`:r.state===`history-entry-initialized`&&a.resolve();break;case`text`:l.ingestText(r.text);break;case`done`:case`answer-done`:l.runAfterTyping(()=>{o.finishMessage(),a.resolve(),c.then(e=>e.close())});break;case`unexpected-call`:l.runAfterTyping(()=>{console.error(`unexpected-call:`,r),o.pushError(`unexpected-call`)});break;case`jsonld-component`:case`mapped-reference`:l.runAfterTyping(()=>o.addMappedReference(r.reference));break;case`reference`:l.runAfterTyping(()=>o.addOldReference(r.reference));break;case`retrieval-question`:l.runAfterTyping(()=>o.updateRetrievalQuestion(r.question));break;case`no-feedback`:l.runAfterTyping(()=>o.setNoFeedback());break;case`component`:l.runWithWarmup(()=>n.onEmbed?.(r));break}l.runAfterTyping(()=>n.onMessage?.(r))},onError:e=>{console.error(` sse-error:`,e),!(`data`in e&&!e.data&&`responseCode`in e&&e.responseCode===0)&&o.pushError(`sse-error`)}});c.setValue(u)})();let u=new cn({question:t,id:i,content:r,readableStore:o.getReadableStore(),readyForFeedback:a,abort:s,liipgptClientPrimitive:this});return this.internalData.chatResponseMap.set(u.id,u),u}async thumbs(e,t,n){if((await this.internalData.metadata).mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);let r={feedback:n,rID:e,query:t};await this.internalData.restClient.postData(`/quickfeedback`,r)}thumbsUp(e,t){return this.thumbs(e,t,`positive`)}thumbsDown(e,t){return this.thumbs(e,t,`negative`)}async feedback(e,t,n){let r=await this.internalData.metadata;if(r.mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);if(n.message){let i={body:n.message,email:n.email,rID:e,uID:r.userId,query:t};await this.internalData.restClient.postData(`/feedback`,i)}n.classification&&await this.internalData.restClient.postData(`/classification`,{impact:n.classification.impact,quality:n.classification.quality,rID:e})}async submitAnswerForm(e){let t=await this.internalData.metadata;if(t.mode!==`ready`)throw Error(`Can not submit the answer form unless we are in ready mode`);let n={receiverEmail:e.receiverEmail,fields:e.fields,query:e.question,answer:e.answer,rID:e.requestId,uID:t.userId,lang:e.lang};await this.internalData.restClient.postData(`/customform`,n)}async userAction(e,t={}){let n=await this.internalData.metadata;if(n.mode!==`ready`)throw Error(`Can not post user action unless we are in ready mode`);let r={uID:n.userId,cID:t.conversationId,lang:t.lang,userAction:e};await this.internalData.restClient.postData(`/assistant/userAction`,r)}async search(e,t={}){let n=await this.internalData.metadata,r=n.mode===`ready`?n.userId:void 0,{links:i}=await this.internalData.restClient.fetchData(`/assistant/search`,Tn,{modelId:t.model,lang:t.language,query:e,mapResults:`true`,uID:r});return new Pn(i.map(En))}async getChatConfig(){return this.internalData.restClient.fetchData(`/chatconfig`,te)}async getChatHistory(e,t){try{let n=await this.internalData.restClient.postData(`/chathistory`,{cID:e,uID:t}),r=ee.safeParse(await n.json());return r.success?r.data:[]}catch(e){return console.error(`Failed to load chat history:`,e),[]}}async getPredefinedQuestions(e){return(await this.internalData.restClient.fetchData(`/topics/questions`,ne,e)).predefinedQuestions}async transcribeAudio(e,t={}){let n=await this.internalData.metadata,r=t.lang||`de-CH`;if(n.mode===`maintenance`)throw Error(`Can not transcribe audio in maintenance mode`);try{let t=(e=>e.includes(`mp4`)?`mp4`:e.includes(`webm`)?`webm`:(e.includes(`wav`),`wav`))(e.type),n=new FormData;return n.append(`file`,e,`audio.${t}`),n.append(`lang`,r),n.append(`type`,e.type),{transcript:await(await this.internalData.restClient.postFormData(`/speech?key=${this.internalData.restClient.speechRecognitionApiKey||``}&lang=${r}`,n)).text()||``,error:void 0}}catch(e){return console.error(`Error transcribing audio:`,e),{transcript:``,error:e instanceof Error?e.message:`Unknown error`}}}},In=class{clientPrimitive;constructor(e){this.clientPrimitive=new Fn(e)}getMetadata(){return this.clientPrimitive.getMetadata()}createConversation(){return new ln(this.clientPrimitive)}search(e,t={}){return this.clientPrimitive.search(e,t)}getChatConfig(){return this.clientPrimitive.getChatConfig()}getPredefinedQuestions(e){return this.clientPrimitive.getPredefinedQuestions(e)}},Ln=class extends Map{#e=new Map;#t=e(0);#n=e(0);#r=s||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(n){return s===this.#r?e(n):t(n)}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 o(this.#t),!1;return o(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{o(this.#t);return}return o(n),super.get(e)}set(e,t){var n=this.#e,i=n.get(e),a=super.get(e),o=super.set(e,t),s=this.#t;if(i===void 0)i=this.#i(0),n.set(e,i),r(this.#n,super.size),c(s);else if(a!==t){c(i);var l=s.reactions===null?null:new Set(s.reactions);(l===null||!i.reactions?.every(e=>l.has(e)))&&c(s)}return o}delete(e){var t=this.#e,n=t.get(e),i=super.delete(e);return n!==void 0&&(t.delete(e),r(n,-1)),i&&(r(this.#n,super.size),c(this.#t)),i}clear(){if(super.size!==0){super.clear();var e=this.#e;r(this.#n,0);for(var t of e.values())r(t,-1);c(this.#t),e.clear()}}#a(){o(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)o(n)}keys(){return o(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return o(this.#n),super.size}},Rn=class{#e;#t;constructor(e,t){this.#e=e,this.#t=a(t)}get current(){return this.#t(),this.#e()}},zn=/\(.+\)/,Bn=new Set([`all`,`print`,`screen`,`and`,`or`,`not`,`only`]),Vn=class extends Rn{constructor(e,t){let n=zn.test(e)||e.split(/[\s,]+/).some(e=>Bn.has(e.trim()))?e:`(${e})`,r=window.matchMedia(n);super(()=>r.matches,e=>i(r,`change`,e))}},Hn=[{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)}],Un=e=>{for(let t of Hn)if(t.check(e))return t.type};function Wn(e){return e}function Gn(e){return e<.5?4*e*e*e:.5*(2*e-2)**3+1}function Kn(e){return e<.5?8*e**4:-8*(e-1)**4+1}function qn(e){return e**4}function Jn(e){return(e-1)**3*(1-e)+1}function Yn(e){return--e*e*e*e*e+1}export{un as _,Jn as a,T as b,Un as c,In as d,Fn as f,pn as g,bn as h,Kn as i,Vn as l,jn as m,Wn as n,Yn as o,Mn as p,qn as r,Hn as s,Gn as t,Ln as u,an as v,$t as y};
61
+ `,{error:u,url:i,opts:a,data:s}),s}async postData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,headers:this.getDefaultHeaders(),body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}async postFormData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,body:t});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}},Dn=f({links:p(f({url:u().url().optional(),title:u().optional(),considered:d().optional(),orgMetadata:f({authors:p(u()).optional()}).optional(),type:u().optional(),date:u().datetime().optional(),similarity:l().optional(),content:u().optional(),fromFullTextSearch:d().optional(),rerank:f({index:l().int().optional(),adjustment:l().optional(),score:l().optional(),similarityOld:l().optional()}).optional()}).or(re))}),On=e=>{if(`metadata`in e)return e;console.warn(`Please upgrade your backend you are currently using an old api feature.`);let t=e.orgMetadata??{};e?.fromFullTextSearch&&(t.fromFullTextSearch=e?.fromFullTextSearch),e?.rerank&&(t.rerank=e?.rerank);let n=[],r=e.title??``;if(e.title&&e.title.includes(` > `)){let t=e.title.split(` > `);r=t.pop()??``,n=t}return{url:e.url??``,title:r,score:e.similarity||0,breadcrumbs:n,metadata:t,description:e.content,date:e.date}},kn=7,An=8,jn=160,Mn=e=>{let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`<`){let r=e.indexOf(`>`,n);if(r!==-1){t.push({type:`tag`,value:e.slice(n,r+1)}),n=r+1;continue}}if(/\s/.test(r)){let r=n;for(;r<e.length&&/\s/.test(e[r]);)r++;t.push({type:`space`,value:e.slice(n,r)}),n=r;continue}let i=n;for(;i<e.length&&!/\s/.test(e[i])&&e[i]!==`<`;)i++;t.push({type:`word`,value:e.slice(n,i)}),n=i}return t},Nn=e=>{let t=Mn(e),n=[],r=``,i=!1;for(let e of t)e.type===`space`&&i?(n.push(r),r=e.value,i=!1):(r+=e.value,e.type===`word`&&(i=!0));return r&&n.push(r),n},Pn=e=>Math.max(An,Math.min(jn,e.length*kn)),Fn=class{queue=[];timeoutId=null;isProcessing=!1;constructor(e){this.onText=e}ingestText(e){let t=Nn(e);if(t.length>=5){for(let e of t)this.queue.push({kind:`text`,chunk:e,delayMs:Pn(e)});this.kickoff();return}this.runAfterTyping(()=>this.onText(e))}runAfterTyping(e){if(this.queue.length===0&&!this.isProcessing){e();return}this.queue.push({kind:`fn`,fn:e}),this.kickoff()}runWithWarmup(e){this.queue.push({kind:`fn`,fn:e}),this.kickoff()}clear(){this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.queue=[],this.isProcessing=!1}kickoff(){this.isProcessing||this.timeoutId!==null||(this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},750))}processNext(){let e=this.queue.shift();if(!e){this.isProcessing=!1;return}this.isProcessing=!0,e.kind===`text`?(this.onText(e.chunk),this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},e.delayMs)):(e.fn(),this.processNext())}},In=class{constructor(e){this.results=e}},Ln=class{internalData;renderers=new Map;markedExtensions=[];_newTabSrText;constructor(e){let t=new En({apiUrl:e.apiUrl,apiKey:e.apiKey,speechRecognitionApiKey:e.speechRecognitionApiKey,strict:e.strict??!1,EventSource:e.EventSource??EventSource});this.internalData={restClient:t,metadata:Cn(t,e.startParameters),searchResponseMap:new Map,chatResponseMap:new Map,conversationMap:new Map}}setMarkedExtensions(...e){this.markedExtensions=e}setNewTabSrText(e){this._newTabSrText=e}getMetadata(){return this.internalData.metadata}createConversationId(){let e=_n();return this.renderers.set(e,new $t({extensions:this.markedExtensions,newTabSrText:this._newTabSrText})),e}chat(e,t,n={}){let r=new nn,i=_n(),a=new tn,o=new sn({id:i,onError:e=>{n.onError?.(e)},onFinish:e=>{r.setValue(e)},markdownRenderer:this.renderers.get(e)??new $t({extensions:this.markedExtensions,newTabSrText:this._newTabSrText}),userQuestion:t}),s=async()=>{await a,(await c).close()},c=new nn,l=new Fn(e=>o.updateText(e));(async()=>{let s=await this.internalData.metadata;if(s.mode===`maintenance`)throw Error(`Can not chat in maintenance mode`);let u=await this.internalData.restClient.subscribeSse(`/assistant/sse`,{query:t,uID:s.userId,cID:e,rID:i,lang:n.lang,feature:n.features?.join(`,`),referrer:n.referrer,source:n.source,...n.selectorValues??{},...n.mode?{mode:n.mode}:{},...n.cache?{cache:!0}:{},...n.predefinedQuestionId?{predefinedQuestionId:n.predefinedQuestionId}:{},...n.switchQuestionId?{switchQuestionId:n.switchQuestionId}:{},chat:`true`,version:`2`},{onClose:()=>{l.clear(),o.finishMessage(),a.resolve(),r.cleanup()},onMessage:t=>{let r=t;switch(r.type){case`error`:l.runAfterTyping(()=>o.pushError(r.error));break;case`id`:r.for===`request`&&i!==r.id&&console.warn(`Unexpected request id "${r.id}" expected "${i}"`),r.for===`conversation`&&e!==r.id&&console.warn(`Unexpected conversation id "${r.id}" expected "${e}"`);break;case`state`:r.state===`history-entry-initialized`&&a.resolve();break;case`text`:l.ingestText(r.text);break;case`done`:case`answer-done`:l.runAfterTyping(()=>{o.finishMessage(),a.resolve(),c.then(e=>e.close())});break;case`unexpected-call`:l.runAfterTyping(()=>{console.error(`unexpected-call:`,r),o.pushError(`unexpected-call`)});break;case`jsonld-component`:case`mapped-reference`:l.runAfterTyping(()=>o.addMappedReference(r.reference));break;case`reference`:l.runAfterTyping(()=>o.addOldReference(r.reference));break;case`retrieval-question`:l.runAfterTyping(()=>o.updateRetrievalQuestion(r.question));break;case`no-feedback`:l.runAfterTyping(()=>o.setNoFeedback());break;case`component`:l.runWithWarmup(()=>n.onEmbed?.(r));break}l.runAfterTyping(()=>n.onMessage?.(r))},onError:e=>{console.error(` sse-error:`,e),!(`data`in e&&!e.data&&`responseCode`in e&&e.responseCode===0)&&o.pushError(`sse-error`)}});c.setValue(u)})();let u=new un({question:t,id:i,content:r,readableStore:o.getReadableStore(),readyForFeedback:a,abort:s,liipgptClientPrimitive:this});return this.internalData.chatResponseMap.set(u.id,u),u}async thumbs(e,t,n){if((await this.internalData.metadata).mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);let r={feedback:n,rID:e,query:t};await this.internalData.restClient.postData(`/quickfeedback`,r)}thumbsUp(e,t){return this.thumbs(e,t,`positive`)}thumbsDown(e,t){return this.thumbs(e,t,`negative`)}async feedback(e,t,n){let r=await this.internalData.metadata;if(r.mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);if(n.message){let i={body:n.message,email:n.email,rID:e,uID:r.userId,query:t};await this.internalData.restClient.postData(`/feedback`,i)}n.classification&&await this.internalData.restClient.postData(`/classification`,{impact:n.classification.impact,quality:n.classification.quality,rID:e})}async submitAnswerForm(e){let t=await this.internalData.metadata;if(t.mode!==`ready`)throw Error(`Can not submit the answer form unless we are in ready mode`);let n={receiverEmail:e.receiverEmail,fields:e.fields,query:e.question,answer:e.answer,rID:e.requestId,uID:t.userId,lang:e.lang};await this.internalData.restClient.postData(`/customform`,n)}async userAction(e,t={}){let n=await this.internalData.metadata;if(n.mode!==`ready`)throw Error(`Can not post user action unless we are in ready mode`);let r={uID:n.userId,cID:t.conversationId,lang:t.lang,userAction:e};await this.internalData.restClient.postData(`/assistant/userAction`,r)}async search(e,t={}){let n=await this.internalData.metadata,r=n.mode===`ready`?n.userId:void 0,{links:i}=await this.internalData.restClient.fetchData(`/assistant/search`,Dn,{modelId:t.model,lang:t.language,query:e,mapResults:`true`,uID:r});return new In(i.map(On))}async getChatConfig(){return this.internalData.restClient.fetchData(`/chatconfig`,te)}async getChatHistory(e,t){try{let n=await this.internalData.restClient.postData(`/chathistory`,{cID:e,uID:t}),r=ee.safeParse(await n.json());return r.success?r.data:[]}catch(e){return console.error(`Failed to load chat history:`,e),[]}}async getPredefinedQuestions(e){return(await this.internalData.restClient.fetchData(`/topics/questions`,ne,e)).predefinedQuestions}async transcribeAudio(e,t={}){let n=await this.internalData.metadata,r=t.lang||`de-CH`;if(n.mode===`maintenance`)throw Error(`Can not transcribe audio in maintenance mode`);try{let t=(e=>e.includes(`mp4`)?`mp4`:e.includes(`webm`)?`webm`:(e.includes(`wav`),`wav`))(e.type),n=new FormData;return n.append(`file`,e,`audio.${t}`),n.append(`lang`,r),n.append(`type`,e.type),{transcript:await(await this.internalData.restClient.postFormData(`/speech?key=${this.internalData.restClient.speechRecognitionApiKey||``}&lang=${r}`,n)).text()||``,error:void 0}}catch(e){return console.error(`Error transcribing audio:`,e),{transcript:``,error:e instanceof Error?e.message:`Unknown error`}}}},Rn=class{clientPrimitive;constructor(e){this.clientPrimitive=new Ln(e)}getMetadata(){return this.clientPrimitive.getMetadata()}createConversation(){return new dn(this.clientPrimitive)}search(e,t={}){return this.clientPrimitive.search(e,t)}getChatConfig(){return this.clientPrimitive.getChatConfig()}getPredefinedQuestions(e){return this.clientPrimitive.getPredefinedQuestions(e)}},zn=class extends Map{#e=new Map;#t=e(0);#n=e(0);#r=s||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(n){return s===this.#r?e(n):t(n)}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 o(this.#t),!1;return o(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{o(this.#t);return}return o(n),super.get(e)}set(e,t){var n=this.#e,i=n.get(e),a=super.get(e),o=super.set(e,t),s=this.#t;if(i===void 0)i=this.#i(0),n.set(e,i),r(this.#n,super.size),c(s);else if(a!==t){c(i);var l=s.reactions===null?null:new Set(s.reactions);(l===null||!i.reactions?.every(e=>l.has(e)))&&c(s)}return o}delete(e){var t=this.#e,n=t.get(e),i=super.delete(e);return n!==void 0&&(t.delete(e),r(n,-1)),i&&(r(this.#n,super.size),c(this.#t)),i}clear(){if(super.size!==0){super.clear();var e=this.#e;r(this.#n,0);for(var t of e.values())r(t,-1);c(this.#t),e.clear()}}#a(){o(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)o(n)}keys(){return o(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return o(this.#n),super.size}},Bn=class{#e;#t;constructor(e,t){this.#e=e,this.#t=a(t)}get current(){return this.#t(),this.#e()}},Vn=/\(.+\)/,Hn=new Set([`all`,`print`,`screen`,`and`,`or`,`not`,`only`]),Un=class extends Bn{constructor(e,t){let n=Vn.test(e)||e.split(/[\s,]+/).some(e=>Hn.has(e.trim()))?e:`(${e})`,r=window.matchMedia(n);super(()=>r.matches,e=>i(r,`change`,e))}};function Wn(e){return e}function Gn(e){return e<.5?4*e*e*e:.5*(2*e-2)**3+1}function Kn(e){return e<.5?8*e**4:-8*(e-1)**4+1}function qn(e){return e**4}function Jn(e){return(e-1)**3*(1-e)+1}function Yn(e){return--e*e*e*e*e+1}export{ln as _,Jn as a,T as b,zn as c,Pn as d,Nn as f,cn as g,fn as h,Kn as i,Rn as l,hn as m,Wn as n,Yn as o,Sn as p,qn as r,Un as s,Gn as t,Ln as u,an as v,$t as y};
@@ -1,4 +1,4 @@
1
- import{A as e,J as t,Lt as n,Mt as r,Rt as i,U as a,X as o,Y as s,i as c,nt as l,o as u,tt as d,xt as f}from"./rEsbAd0y.js";import{t as p}from"./C6m1Wdl1.js";import{t as m}from"./CKhT1xS_.js";var h=(e,t)=>{let n=new URLSearchParams(m.url.searchParams);t===void 0?n.delete(e):n.set(e,String(t));let r=`?${n.toString()}`;window.top&&window.top.postMessage(`liipgpt-url:`+r,`*`),p(r,{replaceState:!0})},g=e=>{let t=new URLSearchParams(m.url.searchParams);for(let[n,r]of Object.entries(e))r===void 0?t.delete(n):t.set(n,String(r));let n=`?${t.toString()}`;window.top&&window.top.postMessage(`liipgpt-url:`+n,`*`),p(n,{replaceState:!0})},_=o(`<button type="button" class="sidebar-hide svelte-q6hwt7" aria-label="Hide sidebar">Hide sidebar</button>`),v=o(`<button type="button" class="sidebar-reopen svelte-q6hwt7" aria-label="Show sidebar"><span class="sidebar-reopen__label svelte-q6hwt7" aria-hidden="true">Show sidebar</span></button>`),y={hash:`svelte-q6hwt7`,code:`.sidebar-hide.svelte-q6hwt7 {display:block;padding:0.375rem 0.75rem;border:1px solid #e5e7eb;border-radius:0.375rem;background:#fff;color:#4b5563;font-weight:500;font-size:0.75rem;line-height:1.25;font-family:system-ui, sans-serif;cursor:pointer;}.sidebar-hide.svelte-q6hwt7:hover {background:#f3f4f6;color:#111827;}.sidebar-reopen.svelte-q6hwt7 {display:flex;z-index:50;position:fixed;bottom:5rem;left:0;align-items:center;justify-content:center;padding:0.5rem 0.25rem;border:1px solid #e5e7eb;border-left:none;border-radius:0 0.375rem 0.375rem 0;background:#fff;box-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1),
1
+ import{A as e,J as t,Lt as n,Mt as r,Rt as i,U as a,X as o,Y as s,i as c,nt as l,o as u,tt as d,xt as f}from"./rEsbAd0y.js";import{t as p}from"./C4jvtK34.js";import{t as m}from"./ZVK8Dk3M.js";var h=(e,t)=>{let n=new URLSearchParams(m.url.searchParams);t===void 0?n.delete(e):n.set(e,String(t));let r=`?${n.toString()}`;window.top&&window.top.postMessage(`liipgpt-url:`+r,`*`),p(r,{replaceState:!0})},g=e=>{let t=new URLSearchParams(m.url.searchParams);for(let[n,r]of Object.entries(e))r===void 0?t.delete(n):t.set(n,String(r));let n=`?${t.toString()}`;window.top&&window.top.postMessage(`liipgpt-url:`+n,`*`),p(n,{replaceState:!0})},_=o(`<button type="button" class="sidebar-hide svelte-q6hwt7" aria-label="Hide sidebar">Hide sidebar</button>`),v=o(`<button type="button" class="sidebar-reopen svelte-q6hwt7" aria-label="Show sidebar"><span class="sidebar-reopen__label svelte-q6hwt7" aria-hidden="true">Show sidebar</span></button>`),y={hash:`svelte-q6hwt7`,code:`.sidebar-hide.svelte-q6hwt7 {display:block;padding:0.375rem 0.75rem;border:1px solid #e5e7eb;border-radius:0.375rem;background:#fff;color:#4b5563;font-weight:500;font-size:0.75rem;line-height:1.25;font-family:system-ui, sans-serif;cursor:pointer;}.sidebar-hide.svelte-q6hwt7:hover {background:#f3f4f6;color:#111827;}.sidebar-reopen.svelte-q6hwt7 {display:flex;z-index:50;position:fixed;bottom:5rem;left:0;align-items:center;justify-content:center;padding:0.5rem 0.25rem;border:1px solid #e5e7eb;border-left:none;border-radius:0 0.375rem 0.375rem 0;background:#fff;box-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1),
2
2
  0 1px 2px -1px rgb(0 0 0 / 0.1);color:#4b5563;font-weight:500;font-size:0.6rem;font-family:system-ui, sans-serif;cursor:pointer;}.sidebar-reopen.svelte-q6hwt7:hover {background:#f3f4f6;color:#111827;}.sidebar-reopen__label.svelte-q6hwt7 {letter-spacing:0.04em;text-orientation:mixed;writing-mode:vertical-rl;}
3
3
 
4
4
  @media (prefers-color-scheme: dark) {.sidebar-hide.svelte-q6hwt7 {border-color:#4b5563;background:#1f2937;color:#d1d5db;}.sidebar-hide.svelte-q6hwt7:hover {background:#374151;color:#f3f4f6;}.sidebar-reopen.svelte-q6hwt7 {border-color:#4b5563;background:#1f2937;color:#d1d5db;}.sidebar-reopen.svelte-q6hwt7:hover {background:#374151;color:#f3f4f6;}
@@ -1 +1 @@
1
- import"./rEsbAd0y.js";import{a as e,i as t,r as n}from"./C6m1Wdl1.js";var r={get data(){return e.data},get error(){return e.error},get form(){return e.form},get params(){return e.params},get route(){return e.route},get state(){return e.state},get status(){return e.status},get url(){return e.url}};Object.defineProperty({get from(){return t.current?t.current.from:null},get to(){return t.current?t.current.to:null},get type(){return t.current?t.current.type:null},get willUnload(){return t.current?t.current.willUnload:null},get delta(){return t.current?t.current.delta:null},get complete(){return t.current?t.current.complete:null}},`current`,{get(){throw Error(`Replace navigating.current.<prop> with navigating.<prop>`)}}),n.updated.check;var i=r;export{i as t};
1
+ import"./rEsbAd0y.js";import{a as e,i as t,r as n}from"./C4jvtK34.js";var r={get data(){return e.data},get error(){return e.error},get form(){return e.form},get params(){return e.params},get route(){return e.route},get state(){return e.state},get status(){return e.status},get url(){return e.url}};Object.defineProperty({get from(){return t.current?t.current.from:null},get to(){return t.current?t.current.to:null},get type(){return t.current?t.current.type:null},get willUnload(){return t.current?t.current.willUnload:null},get delta(){return t.current?t.current.delta:null},get complete(){return t.current?t.current.complete:null}},`current`,{get(){throw Error(`Replace navigating.current.<prop> with navigating.<prop>`)}}),n.updated.check;var i=r;export{i as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.CXGLTbqu.js","../chunks/CibALFW0.js","../chunks/p7ChcveW.js","../chunks/rEsbAd0y.js","../chunks/CZzAbm1q.js","../chunks/DKyUMEyV.js","../chunks/CFKVnMbq.js","../chunks/CIPNu9Fk.js","../chunks/tFLMI64R.js","../nodes/1.DJw369ut.js","../chunks/C6m1Wdl1.js","../chunks/CKhT1xS_.js","../chunks/CPPDi2Fg.js","../chunks/Bo0U8J3e.js","../nodes/2.Dx5eSBWM.js","../chunks/DjVmpym-.js","../chunks/DAn_q4l-.js","../chunks/DfXcv-Ak.js","../chunks/BX7oppMQ.js","../chunks/CA38AHEC.js","../chunks/7mY4OJGU.js","../chunks/BDbfujSm.js","../chunks/hdHt6us6.js","../nodes/3.CjC17y9u.js","../chunks/Z70hfwyo.js","../chunks/DGQ954rx.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,Dt as t,Gt as n,I as r,J as i,K as a,Lt as o,Mt as s,Rt as c,St as l,Tt as u,U as d,X as f,Y as p,a as m,bt as h,ct as g,gt as _,ht as v,i as y,kt as b,mt as x,o as S,ot as C,r as w,u as T,xt as E}from"../chunks/rEsbAd0y.js";import{t as D}from"../chunks/DjVmpym-.js";import"../chunks/CFKVnMbq.js";var O={},k=f(`<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>`),A=f(`<!> <!>`,1);function j(f,m){c(m,!0);let y=S(m,`stores`,7),D=S(m,`page`,7),O=S(m,`constructors`,7),j=S(m,`components`,23,()=>[]),M=S(m,`form`,7),N=S(m,`data_0`,7,null),P=S(m,`data_1`,7,null);_(()=>y().page.set(D())),v(()=>{y(),D(),O(),j(),M(),N(),P(),y().page.notify()});let F=t(!1),I=t(!1),L=t(null);w(()=>{let e=y().page.subscribe(()=>{C(F)&&(u(I,!0),g().then(()=>{u(L,document.title||`untitled page`,!0)}))});return u(F,!0),e});let R=b(()=>O()[1]);var z={get stores(){return y()},set stores(e){y(e),s()},get page(){return D()},set page(e){D(e),s()},get constructors(){return O()},set constructors(e){O(e),s()},get components(){return j()},set components(e=[]){j(e),s()},get form(){return M()},set form(e){M(e),s()},get data_0(){return N()},set data_0(e=null){N(e),s()},get data_1(){return P()},set data_1(e=null){P(e),s()}},B=A(),V=E(B),H=e=>{let t=b(()=>O()[0]);var n=p();r(E(n),()=>C(t),(e,t)=>{T(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params},children:(e,t)=>{var n=p();r(E(n),()=>C(R),(e,t)=>{T(t(e,{get data(){return P()},get form(){return M()},get params(){return D().params}}),e=>j()[1]=e,()=>j()?.[1])}),i(e,n)},$$slots:{default:!0}}),e=>j()[0]=e,()=>j()?.[0])}),i(e,n)},U=e=>{let t=b(()=>O()[0]);var n=p();r(E(n),()=>C(t),(e,t)=>{T(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params}}),e=>j()[0]=e,()=>j()?.[0])}),i(e,n)};d(V,e=>{O()[1]?e(H):e(U,-1)});var W=l(V,2),G=t=>{var r=k(),o=h(r),s=t=>{var n=e();x(()=>a(n,C(L))),i(t,n)};d(o,e=>{C(I)&&e(s)}),n(r),i(t,r)};return d(W,e=>{C(F)&&e(G)}),i(f,B),o(z)}y(j,{stores:{},page:{},constructors:{},components:{},form:{},data_0:{},data_1:{}},[],[],{mode:`open`});var M=m(j),N=[()=>D(()=>import(`../nodes/0.CXGLTbqu.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),()=>D(()=>import(`../nodes/1.DJw369ut.js`),__vite__mapDeps([9,10,3,1,11,6,12,13]),import.meta.url),()=>D(()=>import(`../nodes/2.Dx5eSBWM.js`),__vite__mapDeps([14,10,3,1,2,15,16,17,5,18,19,4,20,21,11,22,6,12,13,8]),import.meta.url),()=>D(()=>import(`../nodes/3.CjC17y9u.js`),__vite__mapDeps([23,10,3,1,2,16,15,17,5,18,19,4,20,21,11,24,22,25,6,12,13,7,8]),import.meta.url)],P=[],F={"/":[2],"/sidebar":[3]},I={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},L=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.decode])),R=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.encode])),z=!1,B=(e,t)=>L[e](t);export{B as decode,L as decoders,F as dictionary,R as encoders,z as hash,I as hooks,O as matchers,N as nodes,M as root,P as server_loads};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.5_GG2VVz.js","../chunks/CibALFW0.js","../chunks/D1JxtiVt.js","../chunks/rEsbAd0y.js","../chunks/CZzAbm1q.js","../chunks/DKyUMEyV.js","../chunks/CFKVnMbq.js","../chunks/CIPNu9Fk.js","../chunks/tFLMI64R.js","../nodes/1.CC4YG4vs.js","../chunks/C4jvtK34.js","../chunks/ZVK8Dk3M.js","../chunks/CPPDi2Fg.js","../chunks/Bo0U8J3e.js","../nodes/2.Bsn6JT-r.js","../chunks/DjVmpym-.js","../chunks/C5QUeOT4.js","../chunks/DY91rqbt.js","../chunks/BX7oppMQ.js","../chunks/CA38AHEC.js","../chunks/7mY4OJGU.js","../chunks/Qr3QoTpa.js","../chunks/hdHt6us6.js","../nodes/3.BGFB6L4G.js","../chunks/B7iNpEKB.js","../chunks/DGQ954rx.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,Dt as t,Gt as n,I as r,J as i,K as a,Lt as o,Mt as s,Rt as c,St as l,Tt as u,U as d,X as f,Y as p,a as m,bt as h,ct as g,gt as _,ht as v,i as y,kt as b,mt as x,o as S,ot as C,r as w,u as T,xt as E}from"../chunks/rEsbAd0y.js";import{t as D}from"../chunks/DjVmpym-.js";import"../chunks/CFKVnMbq.js";var O={},k=f(`<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>`),A=f(`<!> <!>`,1);function j(f,m){c(m,!0);let y=S(m,`stores`,7),D=S(m,`page`,7),O=S(m,`constructors`,7),j=S(m,`components`,23,()=>[]),M=S(m,`form`,7),N=S(m,`data_0`,7,null),P=S(m,`data_1`,7,null);_(()=>y().page.set(D())),v(()=>{y(),D(),O(),j(),M(),N(),P(),y().page.notify()});let F=t(!1),I=t(!1),L=t(null);w(()=>{let e=y().page.subscribe(()=>{C(F)&&(u(I,!0),g().then(()=>{u(L,document.title||`untitled page`,!0)}))});return u(F,!0),e});let R=b(()=>O()[1]);var z={get stores(){return y()},set stores(e){y(e),s()},get page(){return D()},set page(e){D(e),s()},get constructors(){return O()},set constructors(e){O(e),s()},get components(){return j()},set components(e=[]){j(e),s()},get form(){return M()},set form(e){M(e),s()},get data_0(){return N()},set data_0(e=null){N(e),s()},get data_1(){return P()},set data_1(e=null){P(e),s()}},B=A(),V=E(B),H=e=>{let t=b(()=>O()[0]);var n=p();r(E(n),()=>C(t),(e,t)=>{T(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params},children:(e,t)=>{var n=p();r(E(n),()=>C(R),(e,t)=>{T(t(e,{get data(){return P()},get form(){return M()},get params(){return D().params}}),e=>j()[1]=e,()=>j()?.[1])}),i(e,n)},$$slots:{default:!0}}),e=>j()[0]=e,()=>j()?.[0])}),i(e,n)},U=e=>{let t=b(()=>O()[0]);var n=p();r(E(n),()=>C(t),(e,t)=>{T(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params}}),e=>j()[0]=e,()=>j()?.[0])}),i(e,n)};d(V,e=>{O()[1]?e(H):e(U,-1)});var W=l(V,2),G=t=>{var r=k(),o=h(r),s=t=>{var n=e();x(()=>a(n,C(L))),i(t,n)};d(o,e=>{C(I)&&e(s)}),n(r),i(t,r)};return d(W,e=>{C(F)&&e(G)}),i(f,B),o(z)}y(j,{stores:{},page:{},constructors:{},components:{},form:{},data_0:{},data_1:{}},[],[],{mode:`open`});var M=m(j),N=[()=>D(()=>import(`../nodes/0.5_GG2VVz.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),()=>D(()=>import(`../nodes/1.CC4YG4vs.js`),__vite__mapDeps([9,10,3,1,11,6,12,13]),import.meta.url),()=>D(()=>import(`../nodes/2.Bsn6JT-r.js`),__vite__mapDeps([14,10,3,1,2,15,16,17,5,18,19,4,20,21,11,22,6,12,13,8]),import.meta.url),()=>D(()=>import(`../nodes/3.BGFB6L4G.js`),__vite__mapDeps([23,10,3,1,2,16,15,17,5,18,19,4,20,21,11,24,22,25,6,12,13,7,8]),import.meta.url)],P=[],F={"/":[2],"/sidebar":[3]},I={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},L=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.decode])),R=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.encode])),z=!1,B=(e,t)=>L[e](t);export{B as decode,L as decoders,F as dictionary,R as encoders,z as hash,I as hooks,O as matchers,N as nodes,M as root,P as server_loads};
@@ -0,0 +1 @@
1
+ import"../chunks/rEsbAd0y.js";import{n as e,s as t}from"../chunks/C4jvtK34.js";import"../chunks/Bo0U8J3e.js";export{t as load_css,e as start};
@@ -1,4 +1,4 @@
1
- import{n as e}from"../chunks/CibALFW0.js";import{J as t,L as n,Lt as r,Mt as i,Rt as a,Y as o,i as s,o as c,xt as l}from"../chunks/rEsbAd0y.js";import"../chunks/CFKVnMbq.js";import{r as u}from"../chunks/CIPNu9Fk.js";import{n as d,r as f,s as p,t as m,u as h}from"../chunks/p7ChcveW.js";import"../chunks/CZzAbm1q.js";import"../chunks/DKyUMEyV.js";import"../chunks/tFLMI64R.js";var g=async e=>await(await e(`https://liipgpt.dev.cluster.liipgpt.ch/configurator/api/all-org-names`)).json(),_=[`baselcitygpt`],v=async e=>{let t=await g(e).catch(e=>(console.error(`Error fetching org names:`,e),[]));t.push(`liipgpt`);let n=t.map(e=>_.includes(e)?[e,{dev:`https://${e}-dev-api.gpt.liip.ch/${e}`,prod:`https://${e}-api.gpt.liip.ch/${e}`}]:[e,{dev:`https://${e}.dev.cluster.liipgpt.ch/${e}`,prod:`https://${e}.prod.cluster.liipgpt.ch/${e}`}]);return Object.fromEntries(n)},y=`/**
1
+ import{n as e}from"../chunks/CibALFW0.js";import{J as t,L as n,Lt as r,Mt as i,Rt as a,Y as o,i as s,o as c,xt as l}from"../chunks/rEsbAd0y.js";import"../chunks/CFKVnMbq.js";import{r as u}from"../chunks/CIPNu9Fk.js";import{n as d,r as f,s as p,t as m,u as h}from"../chunks/D1JxtiVt.js";import"../chunks/CZzAbm1q.js";import"../chunks/DKyUMEyV.js";import"../chunks/tFLMI64R.js";var g=async e=>await(await e(`https://liipgpt.dev.cluster.liipgpt.ch/configurator/api/all-org-names`)).json(),_=[`baselcitygpt`],v=async e=>{let t=await g(e).catch(e=>(console.error(`Error fetching org names:`,e),[]));t.push(`liipgpt`);let n=t.map(e=>_.includes(e)?[e,{dev:`https://${e}-dev-api.gpt.liip.ch/${e}`,prod:`https://${e}-api.gpt.liip.ch/${e}`}]:[e,{dev:`https://${e}.dev.cluster.liipgpt.ch/${e}`,prod:`https://${e}.prod.cluster.liipgpt.ch/${e}`}]);return Object.fromEntries(n)},y=`/**
2
2
  * @type {import('@liip/liipgpt/config').ChatConfig} ChatConfig
3
3
  */
4
4
  const CHAT_CONFIG_OVERRIDE = {
@@ -1 +1 @@
1
- import{Gt as e,J as t,K as n,Lt as r,Rt as i,St as a,X as o,bt as s,i as c,l,mt as u,xt as d}from"../chunks/rEsbAd0y.js";import"../chunks/C6m1Wdl1.js";import"../chunks/Bo0U8J3e.js";import"../chunks/CFKVnMbq.js";import"../chunks/CPPDi2Fg.js";import{t as f}from"../chunks/CKhT1xS_.js";var p=o(`<h1> </h1> <p> </p>`,1);function m(o,c){i(c,!1),l();var m=p(),h=d(m),g=s(h,!0);e(h);var _=a(h,2),v=s(_,!0);e(_),u(()=>{n(g,f.status),n(v,f.error?.message)}),t(o,m),r()}c(m,{},[],[],{mode:`open`});export{m as component};
1
+ import{Gt as e,J as t,K as n,Lt as r,Rt as i,St as a,X as o,bt as s,i as c,l,mt as u,xt as d}from"../chunks/rEsbAd0y.js";import"../chunks/C4jvtK34.js";import"../chunks/Bo0U8J3e.js";import"../chunks/CFKVnMbq.js";import"../chunks/CPPDi2Fg.js";import{t as f}from"../chunks/ZVK8Dk3M.js";var p=o(`<h1> </h1> <p> </p>`,1);function m(o,c){i(c,!1),l();var m=p(),h=d(m),g=s(h,!0);e(h);var _=a(h,2),v=s(_,!0);e(_),u(()=>{n(g,f.status),n(v,f.error?.message)}),t(o,m),r()}c(m,{},[],[],{mode:`open`});export{m as component};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/DPni1rWl.js","../chunks/DAn_q4l-.js","../chunks/CibALFW0.js","../chunks/DjVmpym-.js","../chunks/rEsbAd0y.js","../chunks/DfXcv-Ak.js","../chunks/DKyUMEyV.js","../chunks/BX7oppMQ.js","../chunks/CA38AHEC.js","../chunks/CZzAbm1q.js","../chunks/7mY4OJGU.js","../chunks/Z70hfwyo.js","../chunks/hdHt6us6.js","../chunks/DGQ954rx.js","../chunks/CFKVnMbq.js","../chunks/CPPDi2Fg.js","../chunks/Bo0U8J3e.js","../chunks/BiTRwaVm.js","../chunks/CFeIeoV1.js","../chunks/BDHUTFW9.js","../chunks/tFLMI64R.js"])))=>i.map(i=>d[i]);
2
- import{A as e,At as t,B as n,D as r,Dt as i,E as a,Gt as o,H as s,J as c,K as l,Lt as u,Mt as d,N as f,Rt as p,St as m,T as h,Tt as g,U as _,V as v,Wt as y,X as b,Y as x,b as ee,bt as S,c as te,dt as C,ht as w,i as T,j as E,k as D,kt as O,lt as k,mt as A,o as j,ot as M,qt as N,rt as ne,s as P,u as F,v as I,vt as L,xt as R,z as re}from"../chunks/rEsbAd0y.js";import{t as z}from"../chunks/C6m1Wdl1.js";import"../chunks/Bo0U8J3e.js";import{t as B}from"../chunks/DjVmpym-.js";import"../chunks/CFKVnMbq.js";import{c as ie,i as V,l as H,o as U}from"../chunks/p7ChcveW.js";import"../chunks/CZzAbm1q.js";import"../chunks/CA38AHEC.js";import"../chunks/DKyUMEyV.js";import"../chunks/tFLMI64R.js";import"../chunks/CPPDi2Fg.js";import{t as ae}from"../chunks/CKhT1xS_.js";import{t as W}from"../chunks/BDbfujSm.js";import"../chunks/DfXcv-Ak.js";import"../chunks/BX7oppMQ.js";import{B as oe,G,H as K,U as q,V as se,W as J,_ as ce,a as le,c as ue,f as de,i as fe,l as pe,n as me,o as he,p as ge,r as _e,s as ve,t as ye}from"../chunks/DAn_q4l-.js";import{n as Y}from"../chunks/7mY4OJGU.js";import{n as X,t as be}from"../chunks/hdHt6us6.js";var Z=b(`<div class="swatch svelte-1inuijp"><div class="swatch__color svelte-1inuijp"></div> <div class="swatch__label svelte-1inuijp"> </div></div>`),xe={hash:`svelte-1inuijp`,code:`.swatch {display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;width:100%;overflow:hidden;border:1px solid var(--base-line-color);border-radius:var(--card-border-radius);&:hover .swatch__label.svelte-1inuijp {opacity:1;}}.swatch__color.svelte-1inuijp {aspect-ratio:1;width:100%;}.swatch__label.svelte-1inuijp {display:none;width:100%;padding:6px;background:white;color:black;font-size:10px;transition:opacity 0.2s ease;
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/Bo_I9OnC.js","../chunks/C5QUeOT4.js","../chunks/CibALFW0.js","../chunks/DjVmpym-.js","../chunks/rEsbAd0y.js","../chunks/DY91rqbt.js","../chunks/DKyUMEyV.js","../chunks/BX7oppMQ.js","../chunks/CA38AHEC.js","../chunks/CZzAbm1q.js","../chunks/7mY4OJGU.js","../chunks/B7iNpEKB.js","../chunks/hdHt6us6.js","../chunks/DGQ954rx.js","../chunks/CFKVnMbq.js","../chunks/CPPDi2Fg.js","../chunks/Bo0U8J3e.js","../chunks/BiTRwaVm.js","../chunks/CFeIeoV1.js","../chunks/B9Sj_kOF.js","../chunks/tFLMI64R.js"])))=>i.map(i=>d[i]);
2
+ import{A as e,At as t,B as n,D as r,Dt as i,E as a,Gt as o,H as s,J as c,K as l,Lt as u,Mt as d,N as f,Rt as p,St as m,T as h,Tt as g,U as _,V as v,Wt as y,X as b,Y as x,b as ee,bt as S,c as te,dt as C,ht as w,i as T,j as E,k as D,kt as O,lt as k,mt as A,o as j,ot as M,qt as N,rt as ne,s as P,u as F,v as I,vt as L,xt as R,z as re}from"../chunks/rEsbAd0y.js";import{t as z}from"../chunks/C4jvtK34.js";import"../chunks/Bo0U8J3e.js";import{t as B}from"../chunks/DjVmpym-.js";import"../chunks/CFKVnMbq.js";import{c as ie,i as V,l as H,o as U}from"../chunks/D1JxtiVt.js";import"../chunks/CZzAbm1q.js";import"../chunks/CA38AHEC.js";import"../chunks/DKyUMEyV.js";import"../chunks/tFLMI64R.js";import"../chunks/CPPDi2Fg.js";import{t as ae}from"../chunks/ZVK8Dk3M.js";import{t as W}from"../chunks/Qr3QoTpa.js";import"../chunks/DY91rqbt.js";import"../chunks/BX7oppMQ.js";import{B as oe,G,H as K,U as q,V as se,W as J,_ as ce,a as le,c as ue,f as de,i as fe,l as pe,n as me,o as he,p as ge,r as _e,s as ve,t as ye}from"../chunks/C5QUeOT4.js";import{n as Y}from"../chunks/7mY4OJGU.js";import{n as X,t as be}from"../chunks/hdHt6us6.js";var Z=b(`<div class="swatch svelte-1inuijp"><div class="swatch__color svelte-1inuijp"></div> <div class="swatch__label svelte-1inuijp"> </div></div>`),xe={hash:`svelte-1inuijp`,code:`.swatch {display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;width:100%;overflow:hidden;border:1px solid var(--base-line-color);border-radius:var(--card-border-radius);&:hover .swatch__label.svelte-1inuijp {opacity:1;}}.swatch__color.svelte-1inuijp {aspect-ratio:1;width:100%;}.swatch__label.svelte-1inuijp {display:none;width:100%;padding:6px;background:white;color:black;font-size:10px;transition:opacity 0.2s ease;
3
3
 
4
4
  @media (min-width: 768px) {display:block;
5
5
  }}`};function Se(t,n){p(n,!1),e(t,xe);let r=j(n,`name`,12),i=j(n,`key`,12),a=j(n,`value`,12);var s={get name(){return r()},set name(e){r(e),d()},get key(){return i()},set key(e){i(e),d()},get value(){return a()},set value(e){a(e),d()}},f=Z(),g=S(f),_=m(g,2),v=S(_,!0);return o(_),o(f),A(()=>{I(f,`title`,`Color ${i()}: ${a()}`),h(g,`background-color: var(--color-${r()??``}-${i()??``});`),l(v,i())}),c(t,f),u(s)}T(Se,{name:{},key:{},value:{}},[],[],{mode:`open`});var Ce=b(`<ol><li class="toast" data-type="error"><div data-icon=""><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"></path></svg></div> <div data-content=""><div data-title="">Error notification</div></div></li> <li class="toast" data-type="warning"><div data-icon=""><svg viewBox="0 0 64 64" fill="currentColor" height="20" width="20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M32.427,7.987c2.183,0.124 4,1.165 5.096,3.281l17.936,36.208c1.739,3.66 -0.954,8.585 -5.373,8.656l-36.119,0c-4.022,-0.064 -7.322,-4.631 -5.352,-8.696l18.271,-36.207c0.342,-0.65 0.498,-0.838 0.793,-1.179c1.186,-1.375 2.483,-2.111 4.748,-2.063Zm-0.295,3.997c-0.687,0.034 -1.316,0.419 -1.659,1.017c-6.312,11.979 -12.397,24.081 -18.301,36.267c-0.546,1.225 0.391,2.797 1.762,2.863c12.06,0.195 24.125,0.195 36.185,0c1.325,-0.064 2.321,-1.584 1.769,-2.85c-5.793,-12.184 -11.765,-24.286 -17.966,-36.267c-0.366,-0.651 -0.903,-1.042 -1.79,-1.03Z"></path><path d="M33.631,40.581l-3.348,0l-0.368,-16.449l4.1,0l-0.384,16.449Zm-3.828,5.03c0,-0.609 0.197,-1.113 0.592,-1.514c0.396,-0.4 0.935,-0.601 1.618,-0.601c0.684,0 1.223,0.201 1.618,0.601c0.395,0.401 0.593,0.905 0.593,1.514c0,0.587 -0.193,1.078 -0.577,1.473c-0.385,0.395 -0.929,0.593 -1.634,0.593c-0.705,0 -1.249,-0.198 -1.634,-0.593c-0.384,-0.395 -0.576,-0.886 -0.576,-1.473Z"></path></svg></div> <div data-content=""><div data-title="">Warning notification</div></div></li> <li class="toast" data-type="success"><div data-icon=""><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20" data-sonner-error-icon="" aria-hidden="true"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg></div> <div data-content=""><div data-title="">Success notification</div></div></li> <li class="toast" data-type="info"><div data-icon=""><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20" aria-hidden="true"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"></path></svg></div> <div data-content=""><div data-title="">Info notification</div></div></li></ol>`);function we(e){c(e,Ce())}T(we,{},[],[],{mode:`open`});var Te=b(`<h1>Title h1</h1> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <em>Morbi sagittis suscipit nisl at varius. Fusce vitae pellentesque lacus.</em> <strong>Sed sed enim in elit vulputate finibus ac in arcu. Donec venenatis tempus facilisis.</strong></p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sagittis suscipit nisl at varius. Fusce vitae pellentesque lacus. <a href="https://www.google.com">Check it on google</a> . Sed sed enim in elit vulputate finibus ac in arcu. Donec venenatis tempus facilisis.</p> <p class="text-sm svelte-4x0tmq">Text-sm: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sagittis suscipit nisl at varius. Fusce vitae pellentesque
@@ -47,4 +47,4 @@ CH-4001 Basel`,phone:`+41 61 200 20 20`,email:`rathaus@bs.ch`,coords:{lat:47.559
47
47
 
48
48
  /* Keep widget hidden until the component marks itself ready (avoids barebone/unthemed flash) */liipgpt-search-summary .search-summary:not(.search-summary--ready) {opacity:0;}#chat-wrapper.has-bg-image.svelte-1uha8ag,
49
49
  #chat-wrapper.svelte-1uha8ag:has(#preview-form:where(.svelte-1uha8ag)) {
50
- /* stylelint-disable-next-line property-disallowed-list */container-type:inline-size;height:auto;min-height:100%;}.preview-bg-image.svelte-1uha8ag {display:block;width:100%;height:auto;pointer-events:none;user-select:none;}`};function $(n,l){p(l,!0),e(n,We);let d=P(l,[`$$slots`,`$$events`,`$$legacy`,`$$host`]),f=O(()=>l.data);w(()=>{window.onmessage=function(e){typeof e.data==`string`&&e.data.startsWith(`liipgpt-url:`)&&z(`?`+new URLSearchParams(e.data.replace(`liipgpt-url:`,``)).toString(),{replaceState:!0})}});let h=e=>`/build/${e}/liipgpt-${e}.iife.js`,v=e=>/\.(png|jpe?g|gif|webp|svg|bmp|ico)(\?.*)?$/i.test(e),b=async e=>{e===`build`&&(await B(()=>import(h(`chat`)),[],import.meta.url),await B(()=>import(h(`button`)),[],import.meta.url),await B(()=>import(h(`search-summary`)),[],import.meta.url)),e===`dev`&&(await B(()=>import(`../chunks/DPni1rWl.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url),await B(()=>import(`../chunks/CFeIeoV1.js`),__vite__mapDeps([18,12,4,2,9,6,13,8,7,10,14,17]),import.meta.url),await B(()=>import(`../chunks/BDHUTFW9.js`),__vite__mapDeps([19,3,12,4,2,5,6,7,14,16,20]),import.meta.url)),e===`server`&&(B(()=>import(U(l.data.options,`chat`)),[],import.meta.url),B(()=>import(U(l.data.options,`button`)),[],import.meta.url),B(()=>import(U(l.data.options,`search-summary`)),[],import.meta.url))},ee=O(()=>l.data.options?.[`preview-mode`]?.value??`server`);w(()=>{b(M(ee))});let T=`./sidebar${ae.url.search}`,D=i(void 0),k=i(void 0),j=(e,t)=>{let n=document.createElement(`script`),r=document.createTextNode(`{${t}}`);n.appendChild(r),e.replaceChildren(n)};w(()=>{M(D)&&j(M(D),M(f).options.CHAT_CONFIG_OVERRIDE.value||``)}),w(()=>{M(k)&&M(f).embedTab===`chat`?j(M(k),M(f).options.onclosechat.value||``):M(k)&&M(k).replaceChildren()});let N=O(()=>M(f)&&M(f).options[`preview-components`].value),ne=O(()=>M(f).embedTab===`chat`),oe=O(()=>M(f).embedTab===`search-summary`);w(()=>{if(!M(oe)){H();return}let e=M(f).options[`use-chat-config`]?.value?``:M(f).options[`host-css`]?.value??``;e?ie(e):H()});var G=Ue();E(`1uha8ag`,e=>{var t=x(),n=R(t),r=e=>{C(()=>{L.title=`LiipGPT Configurator | Components`})},i=e=>{C(()=>{L.title=`LiipGPT Configurator`})};_(n,e=>{M(f).options[`preview-components`].value?e(r,1):e(i,-1)}),c(e,t)});var K=S(G);let q;var se=S(K),J=e=>{var t=ze();A(()=>I(t,`src`,T)),c(e,t)};_(se,e=>{M(f).options[`hide-sidebar`].value||e(J)}),o(K);var ce=m(K,2),le=e=>{W(e,{mode:`show`})};_(ce,e=>{M(f).options[`hide-sidebar`].value&&e(le)}),s(m(ce,2),()=>M(f),e=>{var n=x(),r=R(n),i=e=>{var n=x();t(R(n),{onerror:e=>console.error(`Rendering error of components`,e)},e=>{Q(e,te(()=>d))}),c(e,n)},s=e=>{var t=He();let n;var r=S(t),i=e=>{var t=Be(),n=m(S(t),6),r=S(n),i=m(S(r),6),a=m(S(i),2),s=m(S(a),14),l=m(S(s),2),u=S(l);u.value=u.__value=``;var d=m(u);d.value=d.__value=`ch`;var f=m(d);f.value=f.__value=`de`;var p=m(f);p.value=p.__value=`at`,o(l),o(s);var h=m(s,12),g=m(S(h),2),_=S(g);_.value=_.__value=``;var v=m(_);v.value=v.__value=`a`;var b=m(v);b.value=b.__value=`b`;var x=m(b);x.value=x.__value=`c`,o(g),o(h),y(2),o(a),o(i),y(16),o(r),y(2),o(n),o(t),c(e,t)};_(r,e=>{M(ne)&&M(f).options.flyout.value&&M(f).options[`preview-form`].value&&e(i)});var s=m(r,2),l=e=>{var t=x(),n=R(t),r=e=>{var t=Ve();A(()=>I(t,`src`,M(f).options[`preview-background`].value)),c(e,t)},i=O(()=>v(M(f).options[`preview-background`].value));_(n,e=>{M(i)&&e(r)}),c(e,t)};_(s,e=>{M(ne)&&M(f).options.flyout.value&&M(f).options[`preview-background`].value&&e(l)});var u=m(s,2);F(u,e=>g(D,e),()=>M(D));var d=m(u,2);re(d,()=>V(M(f).options,M(f).embedTab,!1,!0)),F(m(d,2),e=>g(k,e),()=>M(k)),o(t),A(e=>n=a(t,1,`svelte-1uha8ag`,null,n,e),[()=>({"has-bg-image":M(f).options.flyout.value&&M(f).options[`preview-background`].value&&v(M(f).options[`preview-background`].value),"search-summary-preview":M(oe)})]),c(e,t)};_(r,e=>{M(N)?e(i):e(s,-1)}),c(e,n)}),o(G),A(()=>{a(G,1,r([{"components-preview":M(N)}]),`svelte-1uha8ag`),q=a(K,1,`sidebar-slot svelte-1uha8ag`,null,q,{"sidebar-slot--hidden":M(f).options[`hide-sidebar`].value})}),c(n,G),u()}T($,{},[],[],{mode:`open`});export{$ as component};
50
+ /* stylelint-disable-next-line property-disallowed-list */container-type:inline-size;height:auto;min-height:100%;}.preview-bg-image.svelte-1uha8ag {display:block;width:100%;height:auto;pointer-events:none;user-select:none;}`};function $(n,l){p(l,!0),e(n,We);let d=P(l,[`$$slots`,`$$events`,`$$legacy`,`$$host`]),f=O(()=>l.data);w(()=>{window.onmessage=function(e){typeof e.data==`string`&&e.data.startsWith(`liipgpt-url:`)&&z(`?`+new URLSearchParams(e.data.replace(`liipgpt-url:`,``)).toString(),{replaceState:!0})}});let h=e=>`/build/${e}/liipgpt-${e}.iife.js`,v=e=>/\.(png|jpe?g|gif|webp|svg|bmp|ico)(\?.*)?$/i.test(e),b=async e=>{e===`build`&&(await B(()=>import(h(`chat`)),[],import.meta.url),await B(()=>import(h(`button`)),[],import.meta.url),await B(()=>import(h(`search-summary`)),[],import.meta.url)),e===`dev`&&(await B(()=>import(`../chunks/Bo_I9OnC.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url),await B(()=>import(`../chunks/CFeIeoV1.js`),__vite__mapDeps([18,12,4,2,9,6,13,8,7,10,14,17]),import.meta.url),await B(()=>import(`../chunks/B9Sj_kOF.js`),__vite__mapDeps([19,3,12,4,2,5,6,7,14,16,20]),import.meta.url)),e===`server`&&(B(()=>import(U(l.data.options,`chat`)),[],import.meta.url),B(()=>import(U(l.data.options,`button`)),[],import.meta.url),B(()=>import(U(l.data.options,`search-summary`)),[],import.meta.url))},ee=O(()=>l.data.options?.[`preview-mode`]?.value??`server`);w(()=>{b(M(ee))});let T=`./sidebar${ae.url.search}`,D=i(void 0),k=i(void 0),j=(e,t)=>{let n=document.createElement(`script`),r=document.createTextNode(`{${t}}`);n.appendChild(r),e.replaceChildren(n)};w(()=>{M(D)&&j(M(D),M(f).options.CHAT_CONFIG_OVERRIDE.value||``)}),w(()=>{M(k)&&M(f).embedTab===`chat`?j(M(k),M(f).options.onclosechat.value||``):M(k)&&M(k).replaceChildren()});let N=O(()=>M(f)&&M(f).options[`preview-components`].value),ne=O(()=>M(f).embedTab===`chat`),oe=O(()=>M(f).embedTab===`search-summary`);w(()=>{if(!M(oe)){H();return}let e=M(f).options[`use-chat-config`]?.value?``:M(f).options[`host-css`]?.value??``;e?ie(e):H()});var G=Ue();E(`1uha8ag`,e=>{var t=x(),n=R(t),r=e=>{C(()=>{L.title=`LiipGPT Configurator | Components`})},i=e=>{C(()=>{L.title=`LiipGPT Configurator`})};_(n,e=>{M(f).options[`preview-components`].value?e(r,1):e(i,-1)}),c(e,t)});var K=S(G);let q;var se=S(K),J=e=>{var t=ze();A(()=>I(t,`src`,T)),c(e,t)};_(se,e=>{M(f).options[`hide-sidebar`].value||e(J)}),o(K);var ce=m(K,2),le=e=>{W(e,{mode:`show`})};_(ce,e=>{M(f).options[`hide-sidebar`].value&&e(le)}),s(m(ce,2),()=>M(f),e=>{var n=x(),r=R(n),i=e=>{var n=x();t(R(n),{onerror:e=>console.error(`Rendering error of components`,e)},e=>{Q(e,te(()=>d))}),c(e,n)},s=e=>{var t=He();let n;var r=S(t),i=e=>{var t=Be(),n=m(S(t),6),r=S(n),i=m(S(r),6),a=m(S(i),2),s=m(S(a),14),l=m(S(s),2),u=S(l);u.value=u.__value=``;var d=m(u);d.value=d.__value=`ch`;var f=m(d);f.value=f.__value=`de`;var p=m(f);p.value=p.__value=`at`,o(l),o(s);var h=m(s,12),g=m(S(h),2),_=S(g);_.value=_.__value=``;var v=m(_);v.value=v.__value=`a`;var b=m(v);b.value=b.__value=`b`;var x=m(b);x.value=x.__value=`c`,o(g),o(h),y(2),o(a),o(i),y(16),o(r),y(2),o(n),o(t),c(e,t)};_(r,e=>{M(ne)&&M(f).options.flyout.value&&M(f).options[`preview-form`].value&&e(i)});var s=m(r,2),l=e=>{var t=x(),n=R(t),r=e=>{var t=Ve();A(()=>I(t,`src`,M(f).options[`preview-background`].value)),c(e,t)},i=O(()=>v(M(f).options[`preview-background`].value));_(n,e=>{M(i)&&e(r)}),c(e,t)};_(s,e=>{M(ne)&&M(f).options.flyout.value&&M(f).options[`preview-background`].value&&e(l)});var u=m(s,2);F(u,e=>g(D,e),()=>M(D));var d=m(u,2);re(d,()=>V(M(f).options,M(f).embedTab,!1,!0)),F(m(d,2),e=>g(k,e),()=>M(k)),o(t),A(e=>n=a(t,1,`svelte-1uha8ag`,null,n,e),[()=>({"has-bg-image":M(f).options.flyout.value&&M(f).options[`preview-background`].value&&v(M(f).options[`preview-background`].value),"search-summary-preview":M(oe)})]),c(e,t)};_(r,e=>{M(N)?e(i):e(s,-1)}),c(e,n)}),o(G),A(()=>{a(G,1,r([{"components-preview":M(N)}]),`svelte-1uha8ag`),q=a(K,1,`sidebar-slot svelte-1uha8ag`,null,q,{"sidebar-slot--hidden":M(f).options[`hide-sidebar`].value})}),c(n,G),u()}T($,{},[],[],{mode:`open`});export{$ as component};
@@ -1,4 +1,4 @@
1
- import{A as e,B as t,C as n,Ct as r,Dt as i,E as a,Gt as o,J as s,K as c,Lt as l,Mt as u,Rt as d,St as f,Tt as p,U as m,V as h,Wt as g,X as _,Y as v,_ as y,_t as b,bt as x,c as S,et as C,ht as w,i as T,j as ee,k as E,kt as D,mt as O,nt as k,o as A,ot as j,rt as M,s as N,tt as P,u as F,v as I,w as te,x as ne,xt as re,y as ie}from"../chunks/rEsbAd0y.js";import"../chunks/C6m1Wdl1.js";import"../chunks/Bo0U8J3e.js";import"../chunks/CFKVnMbq.js";import{n as ae,t as oe}from"../chunks/CIPNu9Fk.js";import{a as se,i as ce}from"../chunks/p7ChcveW.js";import"../chunks/CZzAbm1q.js";import"../chunks/CA38AHEC.js";import"../chunks/DKyUMEyV.js";import"../chunks/tFLMI64R.js";import"../chunks/CPPDi2Fg.js";import"../chunks/CKhT1xS_.js";import{n as le,r as ue,t as de}from"../chunks/BDbfujSm.js";import"../chunks/DfXcv-Ak.js";import"../chunks/BX7oppMQ.js";import"../chunks/DAn_q4l-.js";import"../chunks/Z70hfwyo.js";import"../chunks/7mY4OJGU.js";import"../chunks/hdHt6us6.js";import"../chunks/DGQ954rx.js";(()=>{var e=`4.2.2`;function t(e){let t=[0];for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t.push(n+1);function n(e){let n=0,r=t.length;for(;r>0;){let i=(r|0)>>1,a=n+i;t[a]<=e?(n=a+1,r=r-i-1):r=i}--n;let i=e-t[n];return{line:n+1,column:i}}function r({line:e,column:n}){--e,e=Math.min(Math.max(e,0),t.length-1);let r=t[e],i=t[e+1]??r;return Math.min(Math.max(r+n,0),i)}return{find:n,findOffset:r}}var n=92,r=47,i=42,a=34,o=39,s=58,c=59,l=10,u=13,d=32,f=9,p=123,m=125,h=40,g=41,_=91,v=93,y=45,b=64,x=33,S=class e extends Error{loc;constructor(n,r){if(r){let e=r[0],i=t(e.code).find(r[1]);n=`${e.file}:${i.line}:${i.column+1}: ${n}`}super(n),this.name=`CssSyntaxError`,this.loc=r,Error.captureStackTrace&&Error.captureStackTrace(this,e)}};function C(e,t){let C=t?.from?{file:t.from,code:e}:null;e[0]===``&&(e=` `+e.slice(1));let E=[],D=[],O=[],k=null,A=null,j=``,M=``,N=0,P;for(let t=0;t<e.length;t++){let F=e.charCodeAt(t);if(!(F===u&&(P=e.charCodeAt(t+1),P===l)))if(F===n)j===``&&(N=t),j+=e.slice(t,t+2),t+=1;else if(F===r&&e.charCodeAt(t+1)===i){let a=t;for(let a=t+2;a<e.length;a++)if(P=e.charCodeAt(a),P===n)a+=1;else if(P===i&&e.charCodeAt(a+1)===r){t=a+1;break}let o=e.slice(a,t+1);if(o.charCodeAt(2)===x){let e=ve(o.slice(2,-2));D.push(e),C&&(e.src=[C,a,t+1],e.dst=[C,a,t+1])}}else if(F===o||F===a){let n=ee(e,t,F,C);j+=e.slice(t,n+1),t=n}else{if((F===d||F===l||F===f)&&(P=e.charCodeAt(t+1))&&(P===d||P===l||P===f||P===u&&(P=e.charCodeAt(t+2))&&P==l))continue;if(F===l){if(j.length===0)continue;P=j.charCodeAt(j.length-1),P!==d&&P!==l&&P!==f&&(j+=` `)}else if(F===y&&e.charCodeAt(t+1)===y&&j.length===0){let l=``,u=t,d=-1;for(let f=t+2;f<e.length;f++)if(P=e.charCodeAt(f),P===n)f+=1;else if(P===o||P===a)f=ee(e,f,P,C);else if(P===r&&e.charCodeAt(f+1)===i){for(let t=f+2;t<e.length;t++)if(P=e.charCodeAt(t),P===n)t+=1;else if(P===i&&e.charCodeAt(t+1)===r){f=t+1;break}}else if(d===-1&&P===s)d=j.length+f-u;else if(P===c&&l.length===0){j+=e.slice(u,f),t=f;break}else if(P===h)l+=`)`;else if(P===_)l+=`]`;else if(P===p)l+=`}`;else if((P===m||e.length-1===f)&&l.length===0){t=f-1,j+=e.slice(u,f);break}else (P===g||P===v||P===m)&&l.length>0&&e[f]===l[l.length-1]&&(l=l.slice(0,-1));let f=T(j,d);if(!f)throw new S(`Invalid custom property, expected a value`,C?[C,u,t]:null);C&&(f.src=[C,u,t],f.dst=[C,u,t]),k?k.nodes.push(f):E.push(f),j=``}else if(F===c&&j.charCodeAt(0)===b)A=w(j),C&&(A.src=[C,N,t],A.dst=[C,N,t]),k?k.nodes.push(A):E.push(A),j=``,A=null;else if(F===c&&M[M.length-1]!==`)`){let e=T(j);if(!e){if(j.length===0)continue;throw new S(`Invalid declaration: \`${j.trim()}\``,C?[C,N,t]:null)}C&&(e.src=[C,N,t],e.dst=[C,N,t]),k?k.nodes.push(e):E.push(e),j=``}else if(F===p&&M[M.length-1]!==`)`)M+=`}`,A=H(j.trim()),C&&(A.src=[C,N,t],A.dst=[C,N,t]),k&&k.nodes.push(A),O.push(k),k=A,j=``,A=null;else if(F===m&&M[M.length-1]!==`)`){if(M===``)throw new S(`Missing opening {`,C?[C,t,t]:null);if(M=M.slice(0,-1),j.length>0)if(j.charCodeAt(0)===b)A=w(j),C&&(A.src=[C,N,t],A.dst=[C,N,t]),k?k.nodes.push(A):E.push(A),j=``,A=null;else{let e=j.indexOf(`:`);if(k){let n=T(j,e);if(!n)throw new S(`Invalid declaration: \`${j.trim()}\``,C?[C,N,t]:null);C&&(n.src=[C,N,t],n.dst=[C,N,t]),k.nodes.push(n)}}let e=O.pop()??null;e===null&&k&&E.push(k),k=e,j=``,A=null}else if(F===h)M+=`)`,j+=`(`;else if(F===g){if(M[M.length-1]!==`)`)throw new S(`Missing opening (`,C?[C,t,t]:null);M=M.slice(0,-1),j+=`)`}else{if(j.length===0&&(F===d||F===l||F===f))continue;j===``&&(N=t),j+=String.fromCharCode(F)}}}if(j.charCodeAt(0)===b){let t=w(j);C&&(t.src=[C,N,e.length],t.dst=[C,N,e.length]),E.push(t)}if(M.length>0&&k){if(k.kind===`rule`)throw new S(`Missing closing } at ${k.selector}`,k.src?[k.src[0],k.src[1],k.src[1]]:null);if(k.kind===`at-rule`)throw new S(`Missing closing } at ${k.name} ${k.params}`,k.src?[k.src[0],k.src[1],k.src[1]]:null)}return D.length>0?D.concat(E):E}function w(e,t=[]){let n=e,r=``;for(let t=5;t<e.length;t++){let i=e.charCodeAt(t);if(i===d||i===f||i===h){n=e.slice(0,t),r=e.slice(t);break}}return V(n.trim(),r.trim(),t)}function T(e,t=e.indexOf(`:`)){if(t===-1)return null;let n=e.indexOf(`!important`,t+1);return U(e.slice(0,t).trim(),e.slice(t+1,n===-1?e.length:n).trim(),n!==-1)}function ee(e,t,r,i=null){let a;for(let o=t+1;o<e.length;o++)if(a=e.charCodeAt(o),a===n)o+=1;else{if(a===r)return o;if(a===c&&(e.charCodeAt(o+1)===l||e.charCodeAt(o+1)===u&&e.charCodeAt(o+2)===l))throw new S(`Unterminated string: ${e.slice(t,o+1)+String.fromCharCode(r)}`,i?[i,t,o+1]:null);if(a===l||a===u&&e.charCodeAt(o+1)===l)throw new S(`Unterminated string: ${e.slice(t,o)+String.fromCharCode(r)}`,i?[i,t,o+1]:null)}return t}function E(e){if(arguments.length===0)throw TypeError("`CSS.escape` requires an argument.");let t=String(e),n=t.length,r=-1,i,a=``,o=t.charCodeAt(0);if(n===1&&o===45)return`\\`+t;for(;++r<n;){if(i=t.charCodeAt(r),i===0){a+=`�`;continue}if(i>=1&&i<=31||i===127||r===0&&i>=48&&i<=57||r===1&&i>=48&&i<=57&&o===45){a+=`\\`+i.toString(16)+` `;continue}if(i>=128||i===45||i===95||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122){a+=t.charAt(r);continue}a+=`\\`+t.charAt(r)}return a}function D(e){return e.replace(/\\([\dA-Fa-f]{1,6}[\t\n\f\r ]?|[\S\s])/g,e=>e.length>2?String.fromCodePoint(Number.parseInt(e.slice(1).trim(),16)):e[1])}var O=new Map([[`--font`,[`--font-weight`,`--font-size`]],[`--inset`,[`--inset-shadow`,`--inset-ring`]],[`--text`,[`--text-color`,`--text-decoration-color`,`--text-decoration-thickness`,`--text-indent`,`--text-shadow`,`--text-underline-offset`]],[`--grid-column`,[`--grid-column-start`,`--grid-column-end`]],[`--grid-row`,[`--grid-row-start`,`--grid-row-end`]]]);function k(e,t){return(O.get(t)??[]).some(t=>e===t||e.startsWith(`${t}-`))}var A=class{constructor(e=new Map,t=new Set([])){this.values=e,this.keyframes=t}prefix=null;get size(){return this.values.size}add(e,t,n=0,r){if(e.endsWith(`-*`)){if(t!==`initial`)throw Error(`Invalid theme value \`${t}\` for namespace \`${e}\``);e===`--*`?this.values.clear():this.clearNamespace(e.slice(0,-2),0)}if(n&4){let t=this.values.get(e);if(t&&!(t.options&4))return}t===`initial`?this.values.delete(e):this.values.set(e,{value:t,options:n,src:r})}keysInNamespaces(e){let t=[];for(let n of e){let e=`${n}-`;for(let r of this.values.keys())r.startsWith(e)&&r.indexOf(`--`,2)===-1&&(k(r,n)||t.push(r.slice(e.length)))}return t}get(e){for(let t of e){let e=this.values.get(t);if(e)return e.value}return null}hasDefault(e){return(this.getOptions(e)&4)==4}getOptions(e){return e=D(this.#e(e)),this.values.get(e)?.options??0}entries(){return this.prefix?Array.from(this.values,e=>(e[0]=this.prefixKey(e[0]),e)):this.values.entries()}prefixKey(e){return this.prefix?`--${this.prefix}-${e.slice(2)}`:e}#e(e){return this.prefix?`--${e.slice(3+this.prefix.length)}`:e}clearNamespace(e,t){let n=O.get(e)??[];e:for(let r of this.values.keys())if(r.startsWith(e)){if(t!==0&&(this.getOptions(r)&t)!==t)continue;for(let e of n)if(r.startsWith(e))continue e;this.values.delete(r)}}#t(e,t){for(let n of t){let t=e===null?n:`${n}-${e}`;if(!this.values.has(t))if(e!==null&&e.includes(`.`)){if(t=`${n}-${e.replaceAll(`.`,`_`)}`,!this.values.has(t))continue}else continue;if(!k(t,n))return t}return null}#n(e){let t=this.values.get(e);if(!t)return null;let n=null;return t.options&2&&(n=t.value),`var(${E(this.prefixKey(e))}${n?`, ${n}`:``})`}markUsedVariable(e){let t=D(this.#e(e)),n=this.values.get(t);if(!n)return!1;let r=n.options&16;return n.options|=16,!r}resolve(e,t,n=0){let r=this.#t(e,t);if(!r)return null;let i=this.values.get(r);return(n|i.options)&1?i.value:this.#n(r)}resolveValue(e,t){let n=this.#t(e,t);return n?this.values.get(n).value:null}resolveWith(e,t,n=[]){let r=this.#t(e,t);if(!r)return null;let i={};for(let e of n){let t=`${r}${e}`,n=this.values.get(t);n&&(n.options&1?i[e]=n.value:i[e]=this.#n(t))}let a=this.values.get(r);return a.options&1?[a.value,i]:[this.#n(r),i]}namespace(e){let t=new Map,n=`${e}-`;for(let[r,i]of this.values)r===e?t.set(null,i.value):r.startsWith(`${n}-`)?t.set(r.slice(e.length),i.value):r.startsWith(n)&&t.set(r.slice(n.length),i.value);return t}addKeyframes(e){this.keyframes.add(e)}getKeyframes(){return Array.from(this.keyframes)}},j=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e,this),this.set(e,t)),t}};function M(e){return{kind:`word`,value:e}}function N(e,t){return{kind:`function`,value:e,nodes:t}}function P(e){return{kind:`separator`,value:e}}function F(e){let t=``;for(let n of e)switch(n.kind){case`word`:case`separator`:t+=n.value;break;case`function`:t+=n.value+`(`+F(n.nodes)+`)`}return t}var I=92,te=41,ne=58,re=44,ie=34,ae=61,oe=62,se=60,ce=10,le=40,ue=39,de=47,fe=32,pe=9;function L(e){e=e.replaceAll(`\r
1
+ import{A as e,B as t,C as n,Ct as r,Dt as i,E as a,Gt as o,J as s,K as c,Lt as l,Mt as u,Rt as d,St as f,Tt as p,U as m,V as h,Wt as g,X as _,Y as v,_ as y,_t as b,bt as x,c as S,et as C,ht as w,i as T,j as ee,k as E,kt as D,mt as O,nt as k,o as A,ot as j,rt as M,s as N,tt as P,u as F,v as I,w as te,x as ne,xt as re,y as ie}from"../chunks/rEsbAd0y.js";import"../chunks/C4jvtK34.js";import"../chunks/Bo0U8J3e.js";import"../chunks/CFKVnMbq.js";import{n as ae,t as oe}from"../chunks/CIPNu9Fk.js";import{a as se,i as ce}from"../chunks/D1JxtiVt.js";import"../chunks/CZzAbm1q.js";import"../chunks/CA38AHEC.js";import"../chunks/DKyUMEyV.js";import"../chunks/tFLMI64R.js";import"../chunks/CPPDi2Fg.js";import"../chunks/ZVK8Dk3M.js";import{n as le,r as ue,t as de}from"../chunks/Qr3QoTpa.js";import"../chunks/DY91rqbt.js";import"../chunks/BX7oppMQ.js";import"../chunks/C5QUeOT4.js";import"../chunks/B7iNpEKB.js";import"../chunks/7mY4OJGU.js";import"../chunks/hdHt6us6.js";import"../chunks/DGQ954rx.js";(()=>{var e=`4.2.2`;function t(e){let t=[0];for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t.push(n+1);function n(e){let n=0,r=t.length;for(;r>0;){let i=(r|0)>>1,a=n+i;t[a]<=e?(n=a+1,r=r-i-1):r=i}--n;let i=e-t[n];return{line:n+1,column:i}}function r({line:e,column:n}){--e,e=Math.min(Math.max(e,0),t.length-1);let r=t[e],i=t[e+1]??r;return Math.min(Math.max(r+n,0),i)}return{find:n,findOffset:r}}var n=92,r=47,i=42,a=34,o=39,s=58,c=59,l=10,u=13,d=32,f=9,p=123,m=125,h=40,g=41,_=91,v=93,y=45,b=64,x=33,S=class e extends Error{loc;constructor(n,r){if(r){let e=r[0],i=t(e.code).find(r[1]);n=`${e.file}:${i.line}:${i.column+1}: ${n}`}super(n),this.name=`CssSyntaxError`,this.loc=r,Error.captureStackTrace&&Error.captureStackTrace(this,e)}};function C(e,t){let C=t?.from?{file:t.from,code:e}:null;e[0]===``&&(e=` `+e.slice(1));let E=[],D=[],O=[],k=null,A=null,j=``,M=``,N=0,P;for(let t=0;t<e.length;t++){let F=e.charCodeAt(t);if(!(F===u&&(P=e.charCodeAt(t+1),P===l)))if(F===n)j===``&&(N=t),j+=e.slice(t,t+2),t+=1;else if(F===r&&e.charCodeAt(t+1)===i){let a=t;for(let a=t+2;a<e.length;a++)if(P=e.charCodeAt(a),P===n)a+=1;else if(P===i&&e.charCodeAt(a+1)===r){t=a+1;break}let o=e.slice(a,t+1);if(o.charCodeAt(2)===x){let e=ve(o.slice(2,-2));D.push(e),C&&(e.src=[C,a,t+1],e.dst=[C,a,t+1])}}else if(F===o||F===a){let n=ee(e,t,F,C);j+=e.slice(t,n+1),t=n}else{if((F===d||F===l||F===f)&&(P=e.charCodeAt(t+1))&&(P===d||P===l||P===f||P===u&&(P=e.charCodeAt(t+2))&&P==l))continue;if(F===l){if(j.length===0)continue;P=j.charCodeAt(j.length-1),P!==d&&P!==l&&P!==f&&(j+=` `)}else if(F===y&&e.charCodeAt(t+1)===y&&j.length===0){let l=``,u=t,d=-1;for(let f=t+2;f<e.length;f++)if(P=e.charCodeAt(f),P===n)f+=1;else if(P===o||P===a)f=ee(e,f,P,C);else if(P===r&&e.charCodeAt(f+1)===i){for(let t=f+2;t<e.length;t++)if(P=e.charCodeAt(t),P===n)t+=1;else if(P===i&&e.charCodeAt(t+1)===r){f=t+1;break}}else if(d===-1&&P===s)d=j.length+f-u;else if(P===c&&l.length===0){j+=e.slice(u,f),t=f;break}else if(P===h)l+=`)`;else if(P===_)l+=`]`;else if(P===p)l+=`}`;else if((P===m||e.length-1===f)&&l.length===0){t=f-1,j+=e.slice(u,f);break}else (P===g||P===v||P===m)&&l.length>0&&e[f]===l[l.length-1]&&(l=l.slice(0,-1));let f=T(j,d);if(!f)throw new S(`Invalid custom property, expected a value`,C?[C,u,t]:null);C&&(f.src=[C,u,t],f.dst=[C,u,t]),k?k.nodes.push(f):E.push(f),j=``}else if(F===c&&j.charCodeAt(0)===b)A=w(j),C&&(A.src=[C,N,t],A.dst=[C,N,t]),k?k.nodes.push(A):E.push(A),j=``,A=null;else if(F===c&&M[M.length-1]!==`)`){let e=T(j);if(!e){if(j.length===0)continue;throw new S(`Invalid declaration: \`${j.trim()}\``,C?[C,N,t]:null)}C&&(e.src=[C,N,t],e.dst=[C,N,t]),k?k.nodes.push(e):E.push(e),j=``}else if(F===p&&M[M.length-1]!==`)`)M+=`}`,A=H(j.trim()),C&&(A.src=[C,N,t],A.dst=[C,N,t]),k&&k.nodes.push(A),O.push(k),k=A,j=``,A=null;else if(F===m&&M[M.length-1]!==`)`){if(M===``)throw new S(`Missing opening {`,C?[C,t,t]:null);if(M=M.slice(0,-1),j.length>0)if(j.charCodeAt(0)===b)A=w(j),C&&(A.src=[C,N,t],A.dst=[C,N,t]),k?k.nodes.push(A):E.push(A),j=``,A=null;else{let e=j.indexOf(`:`);if(k){let n=T(j,e);if(!n)throw new S(`Invalid declaration: \`${j.trim()}\``,C?[C,N,t]:null);C&&(n.src=[C,N,t],n.dst=[C,N,t]),k.nodes.push(n)}}let e=O.pop()??null;e===null&&k&&E.push(k),k=e,j=``,A=null}else if(F===h)M+=`)`,j+=`(`;else if(F===g){if(M[M.length-1]!==`)`)throw new S(`Missing opening (`,C?[C,t,t]:null);M=M.slice(0,-1),j+=`)`}else{if(j.length===0&&(F===d||F===l||F===f))continue;j===``&&(N=t),j+=String.fromCharCode(F)}}}if(j.charCodeAt(0)===b){let t=w(j);C&&(t.src=[C,N,e.length],t.dst=[C,N,e.length]),E.push(t)}if(M.length>0&&k){if(k.kind===`rule`)throw new S(`Missing closing } at ${k.selector}`,k.src?[k.src[0],k.src[1],k.src[1]]:null);if(k.kind===`at-rule`)throw new S(`Missing closing } at ${k.name} ${k.params}`,k.src?[k.src[0],k.src[1],k.src[1]]:null)}return D.length>0?D.concat(E):E}function w(e,t=[]){let n=e,r=``;for(let t=5;t<e.length;t++){let i=e.charCodeAt(t);if(i===d||i===f||i===h){n=e.slice(0,t),r=e.slice(t);break}}return V(n.trim(),r.trim(),t)}function T(e,t=e.indexOf(`:`)){if(t===-1)return null;let n=e.indexOf(`!important`,t+1);return U(e.slice(0,t).trim(),e.slice(t+1,n===-1?e.length:n).trim(),n!==-1)}function ee(e,t,r,i=null){let a;for(let o=t+1;o<e.length;o++)if(a=e.charCodeAt(o),a===n)o+=1;else{if(a===r)return o;if(a===c&&(e.charCodeAt(o+1)===l||e.charCodeAt(o+1)===u&&e.charCodeAt(o+2)===l))throw new S(`Unterminated string: ${e.slice(t,o+1)+String.fromCharCode(r)}`,i?[i,t,o+1]:null);if(a===l||a===u&&e.charCodeAt(o+1)===l)throw new S(`Unterminated string: ${e.slice(t,o)+String.fromCharCode(r)}`,i?[i,t,o+1]:null)}return t}function E(e){if(arguments.length===0)throw TypeError("`CSS.escape` requires an argument.");let t=String(e),n=t.length,r=-1,i,a=``,o=t.charCodeAt(0);if(n===1&&o===45)return`\\`+t;for(;++r<n;){if(i=t.charCodeAt(r),i===0){a+=`�`;continue}if(i>=1&&i<=31||i===127||r===0&&i>=48&&i<=57||r===1&&i>=48&&i<=57&&o===45){a+=`\\`+i.toString(16)+` `;continue}if(i>=128||i===45||i===95||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122){a+=t.charAt(r);continue}a+=`\\`+t.charAt(r)}return a}function D(e){return e.replace(/\\([\dA-Fa-f]{1,6}[\t\n\f\r ]?|[\S\s])/g,e=>e.length>2?String.fromCodePoint(Number.parseInt(e.slice(1).trim(),16)):e[1])}var O=new Map([[`--font`,[`--font-weight`,`--font-size`]],[`--inset`,[`--inset-shadow`,`--inset-ring`]],[`--text`,[`--text-color`,`--text-decoration-color`,`--text-decoration-thickness`,`--text-indent`,`--text-shadow`,`--text-underline-offset`]],[`--grid-column`,[`--grid-column-start`,`--grid-column-end`]],[`--grid-row`,[`--grid-row-start`,`--grid-row-end`]]]);function k(e,t){return(O.get(t)??[]).some(t=>e===t||e.startsWith(`${t}-`))}var A=class{constructor(e=new Map,t=new Set([])){this.values=e,this.keyframes=t}prefix=null;get size(){return this.values.size}add(e,t,n=0,r){if(e.endsWith(`-*`)){if(t!==`initial`)throw Error(`Invalid theme value \`${t}\` for namespace \`${e}\``);e===`--*`?this.values.clear():this.clearNamespace(e.slice(0,-2),0)}if(n&4){let t=this.values.get(e);if(t&&!(t.options&4))return}t===`initial`?this.values.delete(e):this.values.set(e,{value:t,options:n,src:r})}keysInNamespaces(e){let t=[];for(let n of e){let e=`${n}-`;for(let r of this.values.keys())r.startsWith(e)&&r.indexOf(`--`,2)===-1&&(k(r,n)||t.push(r.slice(e.length)))}return t}get(e){for(let t of e){let e=this.values.get(t);if(e)return e.value}return null}hasDefault(e){return(this.getOptions(e)&4)==4}getOptions(e){return e=D(this.#e(e)),this.values.get(e)?.options??0}entries(){return this.prefix?Array.from(this.values,e=>(e[0]=this.prefixKey(e[0]),e)):this.values.entries()}prefixKey(e){return this.prefix?`--${this.prefix}-${e.slice(2)}`:e}#e(e){return this.prefix?`--${e.slice(3+this.prefix.length)}`:e}clearNamespace(e,t){let n=O.get(e)??[];e:for(let r of this.values.keys())if(r.startsWith(e)){if(t!==0&&(this.getOptions(r)&t)!==t)continue;for(let e of n)if(r.startsWith(e))continue e;this.values.delete(r)}}#t(e,t){for(let n of t){let t=e===null?n:`${n}-${e}`;if(!this.values.has(t))if(e!==null&&e.includes(`.`)){if(t=`${n}-${e.replaceAll(`.`,`_`)}`,!this.values.has(t))continue}else continue;if(!k(t,n))return t}return null}#n(e){let t=this.values.get(e);if(!t)return null;let n=null;return t.options&2&&(n=t.value),`var(${E(this.prefixKey(e))}${n?`, ${n}`:``})`}markUsedVariable(e){let t=D(this.#e(e)),n=this.values.get(t);if(!n)return!1;let r=n.options&16;return n.options|=16,!r}resolve(e,t,n=0){let r=this.#t(e,t);if(!r)return null;let i=this.values.get(r);return(n|i.options)&1?i.value:this.#n(r)}resolveValue(e,t){let n=this.#t(e,t);return n?this.values.get(n).value:null}resolveWith(e,t,n=[]){let r=this.#t(e,t);if(!r)return null;let i={};for(let e of n){let t=`${r}${e}`,n=this.values.get(t);n&&(n.options&1?i[e]=n.value:i[e]=this.#n(t))}let a=this.values.get(r);return a.options&1?[a.value,i]:[this.#n(r),i]}namespace(e){let t=new Map,n=`${e}-`;for(let[r,i]of this.values)r===e?t.set(null,i.value):r.startsWith(`${n}-`)?t.set(r.slice(e.length),i.value):r.startsWith(n)&&t.set(r.slice(n.length),i.value);return t}addKeyframes(e){this.keyframes.add(e)}getKeyframes(){return Array.from(this.keyframes)}},j=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e,this),this.set(e,t)),t}};function M(e){return{kind:`word`,value:e}}function N(e,t){return{kind:`function`,value:e,nodes:t}}function P(e){return{kind:`separator`,value:e}}function F(e){let t=``;for(let n of e)switch(n.kind){case`word`:case`separator`:t+=n.value;break;case`function`:t+=n.value+`(`+F(n.nodes)+`)`}return t}var I=92,te=41,ne=58,re=44,ie=34,ae=61,oe=62,se=60,ce=10,le=40,ue=39,de=47,fe=32,pe=9;function L(e){e=e.replaceAll(`\r
2
2
  `,`
3
3
  `);let t=[],n=[],r=null,i=``,a;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);switch(s){case I:i+=e[o]+e[o+1],o++;break;case de:{if(i.length>0){let e=M(i);r?r.nodes.push(e):t.push(e),i=``}let n=M(e[o]);r?r.nodes.push(n):t.push(n);break}case ne:case re:case ae:case oe:case se:case ce:case fe:case pe:{if(i.length>0){let e=M(i);r?r.nodes.push(e):t.push(e),i=``}let n=o,s=o+1;for(;s<e.length&&(a=e.charCodeAt(s),!(a!==ne&&a!==re&&a!==ae&&a!==oe&&a!==se&&a!==ce&&a!==fe&&a!==pe));s++);o=s-1;let c=P(e.slice(n,s));r?r.nodes.push(c):t.push(c);break}case ue:case ie:{let t=o;for(let t=o+1;t<e.length;t++)if(a=e.charCodeAt(t),a===I)t+=1;else if(a===s){o=t;break}i+=e.slice(t,o+1);break}case le:{let e=N(i,[]);i=``,r?r.nodes.push(e):t.push(e),n.push(e),r=e;break}case te:{let e=n.pop();if(i.length>0){let t=M(i);e?.nodes.push(t),i=``}r=n.length>0?n[n.length-1]:null;break}default:i+=String.fromCharCode(s)}}return i.length>0&&t.push(M(i)),t}var me=(e=>(e[e.Continue=0]=`Continue`,e[e.Skip=1]=`Skip`,e[e.Stop=2]=`Stop`,e[e.Replace=3]=`Replace`,e[e.ReplaceSkip=4]=`ReplaceSkip`,e[e.ReplaceStop=5]=`ReplaceStop`,e))(me||{}),R={Continue:{kind:0},Skip:{kind:1},Stop:{kind:2},Replace:e=>({kind:3,nodes:Array.isArray(e)?e:[e]}),ReplaceSkip:e=>({kind:4,nodes:Array.isArray(e)?e:[e]}),ReplaceStop:e=>({kind:5,nodes:Array.isArray(e)?e:[e]})};function z(e,t){typeof t==`function`?he(e,t):he(e,t.enter,t.exit)}function he(e,t=()=>R.Continue,n=()=>R.Continue){let r={value:[e,0,null],prev:null},i={parent:null,depth:0,path(){let e=[],t=r;for(;t;){let n=t.value[2];n&&e.push(n),t=t.prev}return e.reverse(),e}};for(;r!==null;){let e=r.value,a=e[0],o=e[1],s=e[2];if(o>=a.length){r=r.prev,--i.depth;continue}if(i.parent=s,o>=0){let n=a[o],s=t(n,i)??R.Continue;switch(s.kind){case 0:n.nodes&&n.nodes.length>0&&(i.depth+=1,r={value:[n.nodes,0,n],prev:r}),e[1]=~o;continue;case 2:return;case 1:e[1]=~o;continue;case 3:a.splice(o,1,...s.nodes);continue;case 5:a.splice(o,1,...s.nodes);return;case 4:a.splice(o,1,...s.nodes),e[1]+=s.nodes.length;continue;default:throw Error(`Invalid \`WalkAction.${me[s.kind]??`Unknown(${s.kind})`}\` in enter.`)}}let c=~o,l=a[c],u=n(l,i)??R.Continue;switch(u.kind){case 0:e[1]=c+1;continue;case 2:return;case 3:a.splice(c,1,...u.nodes),e[1]=c+u.nodes.length;continue;case 5:a.splice(c,1,...u.nodes);return;case 4:a.splice(c,1,...u.nodes),e[1]=c+u.nodes.length;continue;default:throw Error(`Invalid \`WalkAction.${me[u.kind]??`Unknown(${u.kind})`}\` in exit.`)}}}function ge(e){let t=[];return z(L(e),e=>{if(!(e.kind!==`function`||e.value!==`var`))return z(e.nodes,e=>{e.kind!==`word`||e.value[0]!==`-`||e.value[1]!==`-`||t.push(e.value)}),R.Skip}),t}var _e=64;function B(e,t=[]){return{kind:`rule`,selector:e,nodes:t}}function V(e,t=``,n=[]){return{kind:`at-rule`,name:e,params:t,nodes:n}}function H(e,t=[]){return e.charCodeAt(0)===_e?w(e,t):B(e,t)}function U(e,t,n=!1){return{kind:`declaration`,property:e,value:t,important:n}}function ve(e){return{kind:`comment`,value:e}}function ye(e,t){return{kind:`context`,context:e,nodes:t}}function W(e){return{kind:`at-root`,nodes:e}}function be(e){switch(e.kind){case`rule`:return{kind:e.kind,selector:e.selector,nodes:e.nodes.map(be),src:e.src,dst:e.dst};case`at-rule`:return{kind:e.kind,name:e.name,params:e.params,nodes:e.nodes.map(be),src:e.src,dst:e.dst};case`at-root`:return{kind:e.kind,nodes:e.nodes.map(be),src:e.src,dst:e.dst};case`context`:return{kind:e.kind,context:{...e.context},nodes:e.nodes.map(be),src:e.src,dst:e.dst};case`declaration`:return{kind:e.kind,property:e.property,value:e.value,important:e.important,src:e.src,dst:e.dst};case`comment`:return{kind:e.kind,value:e.value,src:e.src,dst:e.dst};default:throw Error(`Unknown node kind: ${e.kind}`)}}function xe(e){return{depth:e.depth,get context(){let t={};for(let n of e.path())n.kind===`context`&&Object.assign(t,n.context);return Object.defineProperty(this,`context`,{value:t}),t},get parent(){let e=this.path().pop()??null;return Object.defineProperty(this,`parent`,{value:e}),e},path(){return e.path().filter(e=>e.kind!==`context`)}}}function Se(e,t,n=3){let r=[],i=new Set,a=new j(()=>new Set),o=new j(()=>new Set),s=new Set,c=new Set,l=[],u=[],d=new j(()=>new Set);function f(e,p,m={},h=0){if(e.kind===`declaration`){if(e.property===`--tw-sort`||e.value===void 0||e.value===null)return;if(m.theme&&e.property[0]===`-`&&e.property[1]===`-`){if(e.value===`initial`){e.value=void 0;return}m.keyframes||a.get(p).add(e)}if(e.value.includes(`var(`))if(m.theme&&e.property[0]===`-`&&e.property[1]===`-`)for(let t of ge(e.value))d.get(t).add(e.property);else t.trackUsedVariables(e.value);if(e.property===`animation`)for(let t of Ee(e.value))c.add(t);n&2&&e.value.includes(`color-mix(`)&&!m.supportsColorMix&&!m.keyframes&&o.get(p).add(e),p.push(e)}else if(e.kind===`rule`){let t=[];for(let n of e.nodes)f(n,t,m,h+1);let n={},r=new Set;for(let e of t){if(e.kind!==`declaration`)continue;let t=`${e.property}:${e.value}:${e.important}`;n[t]??=[],n[t].push(e)}for(let e in n)for(let t=0;t<n[e].length-1;++t)r.add(n[e][t]);if(r.size>0&&(t=t.filter(e=>!r.has(e))),t.length===0)return;e.selector===`&`?p.push(...t):p.push({...e,nodes:t})}else if(e.kind===`at-rule`&&e.name===`@property`&&h===0){if(i.has(e.params))return;if(n&1){let t=e.params,n=null,r=!1;for(let t of e.nodes)t.kind===`declaration`&&(t.property===`initial-value`?n=t.value:t.property===`inherits`&&(r=t.value===`true`));let i=U(t,n??`initial`);i.src=e.src,r?l.push(i):u.push(i)}i.add(e.params);let t={...e,nodes:[]};for(let n of e.nodes)f(n,t.nodes,m,h+1);p.push(t)}else if(e.kind===`at-rule`){e.name===`@keyframes`?m={...m,keyframes:!0}:e.name===`@supports`&&e.params.includes(`color-mix(`)&&(m={...m,supportsColorMix:!0});let t={...e,nodes:[]};for(let n of e.nodes)f(n,t.nodes,m,h+1);e.name===`@keyframes`&&m.theme&&s.add(t),(t.nodes.length>0||t.name===`@layer`||t.name===`@charset`||t.name===`@custom-media`||t.name===`@namespace`||t.name===`@import`)&&p.push(t)}else if(e.kind===`at-root`)for(let t of e.nodes){let e=[];f(t,e,m,0);for(let t of e)r.push(t)}else if(e.kind===`context`){if(e.context.reference)return;for(let t of e.nodes)f(t,p,{...m,...e.context},h)}else e.kind===`comment`&&p.push(e)}let p=[];for(let t of e)f(t,p,{},0);e:for(let[e,n]of a)for(let r of n){if(Te(r.property,t.theme,d)){if(r.property.startsWith(t.theme.prefixKey(`--animate-`)))for(let e of Ee(r.value))c.add(e);continue}let n=e.indexOf(r);if(e.splice(n,1),e.length===0){let t=we(p,t=>t.kind===`rule`&&t.nodes===e);if(!t||t.length===0)continue e;t.unshift({kind:`at-root`,nodes:p});do{let e=t.pop();if(!e)break;let n=t[t.length-1];if(!n||n.kind!==`at-root`&&n.kind!==`at-rule`)break;let r=n.nodes.indexOf(e);if(r===-1)break;n.nodes.splice(r,1)}while(!0);continue e}}for(let e of s)if(!c.has(e.params)){let t=r.indexOf(e);r.splice(t,1)}if(p=p.concat(r),n&2)for(let[e,n]of o)for(let r of n){let n=e.indexOf(r);if(n===-1||r.value==null)continue;let i=L(r.value),a=!1;if(z(i,e=>{if(e.kind!==`function`||e.value!==`color-mix`)return;let n=!1,r=!1;if(z(e.nodes,e=>{if(e.kind==`word`&&e.value.toLowerCase()===`currentcolor`){r=!0,a=!0;return}let i=e,o=null,s=new Set;do{if(i.kind!==`function`||i.value!==`var`)return;let e=i.nodes[0];if(!e||e.kind!==`word`)return;let c=e.value;if(s.has(c)){n=!0;return}if(s.add(c),a=!0,o=t.theme.resolveValue(null,[e.value]),!o){n=!0;return}if(o.toLowerCase()===`currentcolor`){r=!0;return}i=o.startsWith(`var(`)?L(o)[0]:null}while(i);return R.Replace({kind:`word`,value:o})}),n||r){let t=e.nodes.findIndex(e=>e.kind===`separator`&&e.value.trim().includes(`,`));if(t===-1)return;let n=e.nodes.length>t?e.nodes[t+1]:null;return n?R.Replace(n):void 0}else if(a){let t=e.nodes[2];t.kind===`word`&&(t.value===`oklab`||t.value===`oklch`||t.value===`lab`||t.value===`lch`)&&(t.value=`srgb`)}}),!a)continue;let o={...r,value:F(i)},s=H(`@supports (color: color-mix(in lab, red, red))`,[r]);s.src=r.src,e.splice(n,1,o,s)}if(n&1){let e=[];if(l.length>0){let t=H(`:root, :host`,l);t.src=l[0].src,e.push(t)}if(u.length>0){let t=H(`*, ::before, ::after, ::backdrop`,u);t.src=u[0].src,e.push(t)}if(e.length>0){let t=p.findIndex(e=>!(e.kind===`comment`||e.kind===`at-rule`&&(e.name===`@charset`||e.name===`@import`))),n=V(`@layer`,`properties`,[]);n.src=e[0].src,p.splice(t<0?p.length:t,0,n);let r=H(`@layer properties`,[V(`@supports`,`((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b))))`,e)]);r.src=e[0].src,r.nodes[0].src=e[0].src,p.push(r)}}return p}function Ce(e,t){let n=0,r={file:null,code:``};function i(e,a=0){let o=``,s=` `.repeat(a);if(e.kind===`declaration`){if(o+=`${s}${e.property}: ${e.value}${e.important?` !important`:``};
4
4
  `,t){n+=s.length;let t=n;n+=e.property.length,n+=2,n+=e.value?.length??0,e.important&&(n+=11);let i=n;n+=2,e.dst=[r,t,i]}}else if(e.kind===`rule`){if(o+=`${s}${e.selector} {
@@ -1 +1 @@
1
- {"version":"1788165720240"}
1
+ {"version":"1788249216998"}
@@ -4,12 +4,12 @@
4
4
  <meta charset="utf-8" />
5
5
  <link rel="icon" href="./favicon.png" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <link href="./_app/immutable/entry/start.BxzUuOt1.js" rel="modulepreload">
8
- <link href="./_app/immutable/chunks/C6m1Wdl1.js" rel="modulepreload">
7
+ <link href="./_app/immutable/entry/start.Dt2jlaUG.js" rel="modulepreload">
8
+ <link href="./_app/immutable/chunks/C4jvtK34.js" rel="modulepreload">
9
9
  <link href="./_app/immutable/chunks/rEsbAd0y.js" rel="modulepreload">
10
10
  <link href="./_app/immutable/chunks/CibALFW0.js" rel="modulepreload">
11
11
  <link href="./_app/immutable/chunks/Bo0U8J3e.js" rel="modulepreload">
12
- <link href="./_app/immutable/entry/app.ft0cgG-t.js" rel="modulepreload">
12
+ <link href="./_app/immutable/entry/app.CNOaE4a-.js" rel="modulepreload">
13
13
  <link href="./_app/immutable/chunks/DjVmpym-.js" rel="modulepreload">
14
14
  <link href="./_app/immutable/chunks/CFKVnMbq.js" rel="modulepreload">
15
15
 
@@ -18,7 +18,7 @@
18
18
  <div style="display: contents">
19
19
  <script>
20
20
  {
21
- __sveltekit_lmr8sy = {
21
+ __sveltekit_1fpf7rl = {
22
22
  base: new URL(".", location).pathname.slice(0, -1),
23
23
  assets: "/configurator"
24
24
  };
@@ -26,8 +26,8 @@
26
26
  const element = document.currentScript.parentElement;
27
27
 
28
28
  Promise.all([
29
- import("./_app/immutable/entry/start.BxzUuOt1.js"),
30
- import("./_app/immutable/entry/app.ft0cgG-t.js")
29
+ import("./_app/immutable/entry/start.Dt2jlaUG.js"),
30
+ import("./_app/immutable/entry/app.CNOaE4a-.js")
31
31
  ]).then(([kit, app]) => {
32
32
  kit.start(app, element);
33
33
  });
@@ -4,12 +4,12 @@
4
4
  <meta charset="utf-8" />
5
5
  <link rel="icon" href="./favicon.png" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <link href="./_app/immutable/entry/start.BxzUuOt1.js" rel="modulepreload">
8
- <link href="./_app/immutable/chunks/C6m1Wdl1.js" rel="modulepreload">
7
+ <link href="./_app/immutable/entry/start.Dt2jlaUG.js" rel="modulepreload">
8
+ <link href="./_app/immutable/chunks/C4jvtK34.js" rel="modulepreload">
9
9
  <link href="./_app/immutable/chunks/rEsbAd0y.js" rel="modulepreload">
10
10
  <link href="./_app/immutable/chunks/CibALFW0.js" rel="modulepreload">
11
11
  <link href="./_app/immutable/chunks/Bo0U8J3e.js" rel="modulepreload">
12
- <link href="./_app/immutable/entry/app.ft0cgG-t.js" rel="modulepreload">
12
+ <link href="./_app/immutable/entry/app.CNOaE4a-.js" rel="modulepreload">
13
13
  <link href="./_app/immutable/chunks/DjVmpym-.js" rel="modulepreload">
14
14
  <link href="./_app/immutable/chunks/CFKVnMbq.js" rel="modulepreload">
15
15
 
@@ -18,7 +18,7 @@
18
18
  <div style="display: contents">
19
19
  <script>
20
20
  {
21
- __sveltekit_lmr8sy = {
21
+ __sveltekit_1fpf7rl = {
22
22
  base: new URL(".", location).pathname.slice(0, -1),
23
23
  assets: "/configurator"
24
24
  };
@@ -26,8 +26,8 @@
26
26
  const element = document.currentScript.parentElement;
27
27
 
28
28
  Promise.all([
29
- import("./_app/immutable/entry/start.BxzUuOt1.js"),
30
- import("./_app/immutable/entry/app.ft0cgG-t.js")
29
+ import("./_app/immutable/entry/start.Dt2jlaUG.js"),
30
+ import("./_app/immutable/entry/app.CNOaE4a-.js")
31
31
  ]).then(([kit, app]) => {
32
32
  kit.start(app, element);
33
33
  });
package/index.cjs CHANGED
@@ -68,6 +68,7 @@ __export(exports_client, {
68
68
  ChatResultBuilder: () => ChatResultBuilder,
69
69
  LiipGPTClient: () => LiipGPTClient,
70
70
  MarkdownRenderer: () => MarkdownRenderer,
71
+ PiiChecks: () => PiiChecks,
71
72
  answerFormFieldSchema: () => answerFormFieldSchema,
72
73
  answerFormSchema: () => answerFormSchema,
73
74
  chatConfigSchema: () => chatConfigSchema,
@@ -77,6 +78,7 @@ __export(exports_client, {
77
78
  chatMessageBotStreamingSchema: () => chatMessageBotStreamingSchema,
78
79
  chatMessageSchema: () => chatMessageSchema,
79
80
  chatMessageUserSchema: () => chatMessageUserSchema,
81
+ checkForPii: () => checkForPii,
80
82
  classificationConfigSchema: () => classificationConfigSchema,
81
83
  classificationResponseSchema: () => classificationResponseSchema,
82
84
  completeChatConfigSchema: () => completeChatConfigSchema,
@@ -3697,6 +3699,66 @@ class ChatResultBuilder {
3697
3699
  return this.content.toPromise();
3698
3700
  }
3699
3701
  }
3702
+ // src/chat/utils/pii-checks.ts
3703
+ var PiiChecks = [
3704
+ {
3705
+ type: "email",
3706
+ check: (input) => {
3707
+ const pattern = /\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b/;
3708
+ return pattern.test(input);
3709
+ }
3710
+ },
3711
+ {
3712
+ type: "creditCard",
3713
+ check: (input) => {
3714
+ const pattern = /\b(?:\d[ -]*?){13,16}\b/;
3715
+ return pattern.test(input);
3716
+ }
3717
+ },
3718
+ {
3719
+ type: "ahv",
3720
+ check: (input) => {
3721
+ const pattern = /\b756\.\d{4}\.\d{4}\.\d{2}\b/;
3722
+ return pattern.test(input);
3723
+ }
3724
+ },
3725
+ {
3726
+ type: "phoneSwiss",
3727
+ check: (input) => {
3728
+ const pattern = /\b0(?:\s*\d){2}(?:\s*\/\s*)?(?:\s*\d){7,}\b/;
3729
+ return pattern.test(input);
3730
+ }
3731
+ },
3732
+ {
3733
+ type: "phoneInternational",
3734
+ check: (input) => {
3735
+ const pattern = /(?:\+|00)(?:\s*\d){10,}\b/;
3736
+ return pattern.test(input);
3737
+ }
3738
+ },
3739
+ {
3740
+ type: "swissPassport",
3741
+ check: (input) => {
3742
+ const pattern = /\b[A-HJ-NP-Z](?=.*\d)[A-HJ-NP-Z0-9]{7}\b/;
3743
+ return pattern.test(input);
3744
+ }
3745
+ },
3746
+ {
3747
+ type: "longNumber",
3748
+ check: (input) => {
3749
+ const pattern = /\b\d{9,}\b/;
3750
+ return pattern.test(input);
3751
+ }
3752
+ }
3753
+ ];
3754
+ var checkForPii = (input) => {
3755
+ for (const check of PiiChecks) {
3756
+ if (check.check(input)) {
3757
+ return check.type;
3758
+ }
3759
+ }
3760
+ return;
3761
+ };
3700
3762
  // src/lib/client/conversation.ts
3701
3763
  class Conversation {
3702
3764
  clientPrimitive;
package/index.d.ts CHANGED
@@ -5077,6 +5077,40 @@ export declare class ChatResultBuilder {
5077
5077
  getReadableStore(): Readable<ChatContent>;
5078
5078
  getPromise(): Promise<ChatContent>;
5079
5079
  }
5080
+ declare const piiTranslationSchema: z.ZodObject<{
5081
+ email: z.ZodString;
5082
+ creditCard: z.ZodString;
5083
+ ahv: z.ZodString;
5084
+ phoneSwiss: z.ZodString;
5085
+ phoneInternational: z.ZodString;
5086
+ swissPassport: z.ZodString;
5087
+ longNumber: z.ZodString;
5088
+ }, z.core.$strip>;
5089
+ export type PiiTranslation = z.infer<typeof piiTranslationSchema>;
5090
+ export type PiiKeys = keyof PiiTranslation;
5091
+ export declare const PiiChecks: ({
5092
+ type: "email";
5093
+ check: (input: string) => boolean;
5094
+ } | {
5095
+ type: "creditCard";
5096
+ check: (input: string) => boolean;
5097
+ } | {
5098
+ type: "ahv";
5099
+ check: (input: string) => boolean;
5100
+ } | {
5101
+ type: "phoneSwiss";
5102
+ check: (input: string) => boolean;
5103
+ } | {
5104
+ type: "phoneInternational";
5105
+ check: (input: string) => boolean;
5106
+ } | {
5107
+ type: "swissPassport";
5108
+ check: (input: string) => boolean;
5109
+ } | {
5110
+ type: "longNumber";
5111
+ check: (input: string) => boolean;
5112
+ })[];
5113
+ export declare const checkForPii: (input: string) => PiiKeys | undefined;
5080
5114
  export declare const menuItemSchema: z.ZodObject<{
5081
5115
  label: z.ZodString;
5082
5116
  icon: z.ZodString;