@liip/liipgpt 2.5.0 → 2.5.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.
- package/button/liipgpt-button.iife.js +1 -1
- package/chat/liipgpt-chat.iife.js +2 -2
- package/config/index.cjs +1 -1
- package/config/index.d.ts +5049 -3239
- package/config/index.js +1 -1
- package/configurator/_app/env.js +1 -1
- package/configurator/_app/immutable/chunks/{BomA0xkn.js → BZmjFxFg.js} +1 -1
- package/configurator/_app/immutable/chunks/{Dk65hsuc.js → DALBk6Bm.js} +3 -3
- package/configurator/_app/immutable/chunks/{DkjsutUp.js → DX0doXAz.js} +1 -1
- package/configurator/_app/immutable/chunks/{g33UHIPf.js → DkPBl_Gh.js} +1 -1
- package/configurator/_app/immutable/chunks/{BgEp-IXK.js → FNScWilK.js} +1 -1
- package/configurator/_app/immutable/chunks/{FW73PcT5.js → hR06g7Jk.js} +1 -1
- package/configurator/_app/immutable/chunks/luKwPOta.js +3 -0
- package/configurator/_app/immutable/chunks/{CXdK-dRV.js → n4x4MhaA.js} +1 -1
- package/configurator/_app/immutable/chunks/{CGt_7eBt.js → u7HOvwmD.js} +1 -1
- package/configurator/_app/immutable/entry/{app.EbRNj2Ex.js → app.C0dyfdgB.js} +2 -2
- package/configurator/_app/immutable/entry/start.YHMf4y74.js +1 -0
- package/configurator/_app/immutable/nodes/{0.DQoGmNN3.js → 0.ClfhFPXe.js} +1 -1
- package/configurator/_app/immutable/nodes/{1.DxaWpt7I.js → 1.QkGgSBCX.js} +1 -1
- package/configurator/_app/immutable/nodes/{2.CgyaBcKr.js → 2.GXBh08PQ.js} +3 -3
- package/configurator/_app/immutable/nodes/{3.BEwp3oml.js → 3.BQtMBo6-.js} +1 -1
- package/configurator/_app/version.json +1 -1
- package/configurator/index.html +6 -6
- package/configurator/sidebar.html +6 -6
- package/index.cjs +1 -1
- package/index.d.ts +19 -9
- package/index.js +1 -1
- package/package.json +1 -1
- package/configurator/_app/immutable/chunks/CVGFiFDF.js +0 -3
- package/configurator/_app/immutable/entry/start.DEh3tu3P.js +0 -1
|
@@ -55,7 +55,7 @@ ${t}</tr>
|
|
|
55
55
|
`}tablecell(t){const e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
|
|
56
56
|
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${nn(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){const n=this.parser.parseInline(r),o=xh(t);if(o===null)return n;t=o;let i='<a href="'+t+'"';return e&&(i+=' title="'+nn(e)+'"'),i+=">"+n+"</a>",i}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));const o=xh(t);if(o===null)return nn(r);t=o;let i=`<img src="${t}" alt="${r}"`;return e&&(i+=` title="${nn(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:nn(t.text)}},Il=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},_n=class Su{options;renderer;textRenderer;constructor(e){this.options=e||co,this.options.renderer=this.options.renderer||new Da,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Il}static parse(e,r){return new Su(r).parse(e)}static parseInline(e,r){return new Su(r).parseInline(e)}parse(e,r=!0){let n="";for(let o=0;o<e.length;o++){const i=e[o];if(this.options.extensions?.renderers?.[i.type]){const s=i,c=this.options.extensions.renderers[s.type].call({parser:this},s);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(s.type)){n+=c||"";continue}}const 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 s=a,c=this.renderer.text(s);for(;o+1<e.length&&e[o+1].type==="text";)s=e[++o],c+=`
|
|
57
57
|
`+this.renderer.text(s);r?n+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c,escaped:!0}]}):n+=c;continue}default:{const s='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}parseInline(e,r=this.renderer){let n="";for(let o=0;o<e.length;o++){const i=e[o];if(this.options.extensions?.renderers?.[i.type]){const s=this.options.extensions.renderers[i.type].call({parser:this},i);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=s||"";continue}}const a=i;switch(a.type){case"escape":{n+=r.text(a);break}case"html":{n+=r.html(a);break}case"link":{n+=r.link(a);break}case"image":{n+=r.image(a);break}case"strong":{n+=r.strong(a);break}case"em":{n+=r.em(a);break}case"codespan":{n+=r.codespan(a);break}case"br":{n+=r.br(a);break}case"del":{n+=r.del(a);break}case"text":{n+=r.text(a);break}default:{const s='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}},Ma=class{options;block;constructor(t){this.options=t||co}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?wn.lex:wn.lexInline}provideParser(){return this.block?_n.parse:_n.parseInline}},Ch=class{defaults=kl();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_n;Renderer=Da;TextRenderer=Il;Lexer=wn;Tokenizer=La;Hooks=Ma;constructor(...t){this.use(...t)}walkTokens(t,e){let r=[];for(const n of t)switch(r=r.concat(e.call(this,n)),n.type){case"table":{const o=n;for(const i of o.header)r=r.concat(this.walkTokens(i.tokens,e));for(const i of o.rows)for(const a of i)r=r.concat(this.walkTokens(a.tokens,e));break}case"list":{const o=n;r=r.concat(this.walkTokens(o.items,e));break}default:{const o=n;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(i=>{const a=o[i].flat(1/0);r=r.concat(this.walkTokens(a,e))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,e)))}}return r}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const i=e.renderers[o.name];i?e.renderers[o.name]=function(...a){let s=o.renderer.apply(this,a);return s===!1&&(s=i.apply(this,a)),s}:e.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=e[o.level];i?i.unshift(o.tokenizer):e[o.level]=[o.tokenizer],o.start&&(o.level==="block"?e.startBlock?e.startBlock.push(o.start):e.startBlock=[o.start]:o.level==="inline"&&(e.startInline?e.startInline.push(o.start):e.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(e.childTokens[o.name]=o.childTokens)}),n.extensions=e),r.renderer){const o=this.defaults.renderer||new Da(this.defaults);for(const i in r.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const a=i,s=r.renderer[a],c=o[a];o[a]=(...l)=>{let d=s.apply(o,l);return d===!1&&(d=c.apply(o,l)),d||""}}n.renderer=o}if(r.tokenizer){const o=this.defaults.tokenizer||new La(this.defaults);for(const i in r.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const a=i,s=r.tokenizer[a],c=o[a];o[a]=(...l)=>{let d=s.apply(o,l);return d===!1&&(d=c.apply(o,l)),d}}n.tokenizer=o}if(r.hooks){const o=this.defaults.hooks||new Ma;for(const i in r.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const a=i,s=r.hooks[a],c=o[a];Ma.passThroughHooks.has(i)?o[a]=l=>{if(this.defaults.async)return Promise.resolve(s.call(o,l)).then(h=>c.call(o,h));const d=s.call(o,l);return c.call(o,d)}:o[a]=(...l)=>{let d=s.apply(o,l);return d===!1&&(d=c.apply(o,l)),d}}n.hooks=o}if(r.walkTokens){const o=this.defaults.walkTokens,i=r.walkTokens;n.walkTokens=function(a){let s=[];return s.push(i.call(this,a)),o&&(s=s.concat(o.call(this,a))),s}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return wn.lex(t,e??this.defaults)}parser(t,e){return _n.parse(t,e??this.defaults)}parseMarkdown(t){return(r,n)=>{const o={...n},i={...this.defaults,...o},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&o.async===!1)return a(new 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(typeof r>"u"||r===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=t);const s=i.hooks?i.hooks.provideLexer():t?wn.lex:wn.lexInline,c=i.hooks?i.hooks.provideParser():t?_n.parse:_n.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(r):r).then(l=>s(l,i)).then(l=>i.hooks?i.hooks.processAllTokens(l):l).then(l=>i.walkTokens?Promise.all(this.walkTokens(l,i.walkTokens)).then(()=>l):l).then(l=>c(l,i)).then(l=>i.hooks?i.hooks.postprocess(l):l).catch(a);try{i.hooks&&(r=i.hooks.preprocess(r));let l=s(r,i);i.hooks&&(l=i.hooks.processAllTokens(l)),i.walkTokens&&this.walkTokens(l,i.walkTokens);let d=c(l,i);return i.hooks&&(d=i.hooks.postprocess(d)),d}catch(l){return a(l)}}}onError(t,e){return r=>{if(r.message+=`
|
|
58
|
-
Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An error occurred:</p><pre>"+nn(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},uo=new Ch;function ot(t,e){return uo.parse(t,e)}ot.options=ot.setOptions=function(t){return uo.setOptions(t),ot.defaults=uo.defaults,ch(ot.defaults),ot},ot.getDefaults=kl,ot.defaults=co,ot.use=function(...t){return uo.use(...t),ot.defaults=uo.defaults,ch(ot.defaults),ot},ot.walkTokens=function(t,e){return uo.walkTokens(t,e)},ot.parseInline=uo.parseInline,ot.Parser=_n,ot.parser=_n.parse,ot.Renderer=Da,ot.TextRenderer=Il,ot.Lexer=wn,ot.lexer=wn.lex,ot.Tokenizer=La,ot.Hooks=Ma,ot.parse=ot,ot.options,ot.setOptions,ot.use,ot.walkTokens,ot.parseInline,_n.parse,wn.lex;const Th=t=>(Object.getOwnPropertyNames(t).forEach(e=>{const r=t[e];r&&typeof r=="object"&&Th(r)}),Object.freeze(t)),Eh=Th({all:[],used:[],unused:[]}),$b=t=>{const e=ub(t);return e.addHook("uponSanitizeElement",function(r,n){const o=n.tagName||r.nodeName.toLowerCase();o.startsWith("liipgpt-")&&(n.allowedTags[o]=!0)}),e};class Ah{marked;currentReferences=Eh;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new Ch({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=$b(e.window)}createFootnoteExtension=()=>{const e=this;return{extensions:[{name:"footnote",level:"inline",start(r){return r.match(/\[\^(\d+)\]/)?.index},tokenizer(r){const o=/^\[\^(\d+)\]/.exec(r);if(o){const[i,a]=o;return{type:"footnote",raw:i,refNumber:a}}},renderer(r){if(r.type==="footnote"){const n=parseInt(r.refNumber)-1,o=e.currentReferences.all[n];if(!o)return console.error("Could not find ref with index:",n),"";let i;return o?.referenceIndex.used?i=o.referenceIndex.used:(e.currentReferences.used.push(o),e.lastUsedIndex++,i=e.lastUsedIndex,o.referenceIndex.used=i),` <liipgpt-reference-number data-all-index="${n}" data-used-index="${i}" data-source="${JSON.stringify(o).replace(/"/g,""")}"></liipgpt-reference-number>`}}}]}};parse(e){return this.DomPurity.sanitize(this.marked.parse(e),{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0,mathMl:!0},FORBID_TAGS:["hr"]})}toHTML(e,r){this.currentReferences=r;const n=this.parse(e);return this.currentReferences=Eh,n}}function Zb(){let t,e;return{promise:new Promise((n,o)=>{e=n,t=o}),reject:t,resolve:e}}class Oh{promise;resolve;reject;constructor(){const{promise:e,resolve:r,reject:n}=Zb();this.promise=e,this.resolve=r,this.reject=n}then(e,r){return this.promise.then(e,r)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}toPromise(){return this.promise}[Symbol.toStringTag]="Flag"}class Nl{hasValue=new Oh;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,r){return this.toPromise().then(e,r)}catch(e){return this.toPromise().catch(e)}finally(e){return this.toPromise().finally(e)}[Symbol.toStringTag]="FutureValue"}const Kb=t=>{try{return new URL(t).hostname}catch{return t}},Gb=({url:t,considered:e,title:r,description:n,summary:o})=>{const i=Kb(t);return{url:t,considered:e,referenceIndex:{},score:0,metadata:{},display:{card:{title:r,description:n||o,badge:t},listItem:{title:r,badge:i}}}};class Yb{constructor(e){this.options=e,this.store=$d({id:e.id,state:"loading",errors:[],type:"bot",time:new Date().toISOString(),message:{markdown:"",html:""},references:{all:[],used:[],unused:[]}})}store;content=new Nl;backendSendsMappedRefs=!1;pushError(e){this.options.onError?.(e),this.store.update(r=>({...r,errors:[...r.errors,e]}))}updateRequestId(e){this.store.update(r=>({...r,id:e}))}updateText(e){this.store.update(r=>{const n=r.message.markdown+e,o=this.options.markdownRenderer.toHTML(n,r.references);return{...r,state:"streaming",message:{markdown:n,html:o}}})}finishMessage(){this.store.update(e=>{const r={...e,state:"done"};return r.references.unused=r.references.all.filter(n=>n.referenceIndex.used===void 0),this.options?.onFinish?.(r),this.content.setValue(r),r})}addReference(e){this.store.update(r=>{const n=r.references.all,o=n.length,i=[...n,{...e,referenceIndex:{all:o}}];return{...r,references:{used:r.references.used,all:i}}})}addMappedReference(e){this.backendSendsMappedRefs=!0,this.addReference(e)}addOldReference(e){this.backendSendsMappedRefs||this.addReference(Gb(e))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}}var Ye;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{const i={};for(const a of o)i[a]=a;return i},t.getValidEnumValues=o=>{const i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(const s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(const a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ye||(Ye={}));var Ph;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Ph||(Ph={}));const me=Ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Hn=t=>{switch(typeof t){case"undefined":return me.undefined;case"string":return me.string;case"number":return Number.isNaN(t)?me.nan:me.number;case"boolean":return me.boolean;case"function":return me.function;case"bigint":return me.bigint;case"symbol":return me.symbol;case"object":return Array.isArray(t)?me.array:t===null?me.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?me.promise:typeof Map<"u"&&t instanceof Map?me.map:typeof Set<"u"&&t instanceof Set?me.set:typeof Date<"u"&&t instanceof Date?me.date:me.object;default:return me.unknown}},ie=Ye.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class xn extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){const l=a.path[c];c===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return o(this),n}static assert(e){if(!(e instanceof xn))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const o of this.issues)if(o.path.length>0){const i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}xn.create=t=>new xn(t);const Ll=(t,e)=>{let r;switch(t.code){case ie.invalid_type:t.received===me.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ye.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ye.joinValues(t.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ye.joinValues(t.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${Ye.joinValues(t.options)}, received '${t.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ye.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ie.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ie.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ye.assertNever(t)}return{message:r}};let Qb=Ll;function Xb(){return Qb}const Jb=t=>{const{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="";const c=n.filter(l=>!!l).slice().reverse();for(const l of c)s=l(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}};function ge(t,e){const r=Xb(),n=Jb({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ll?void 0:Ll].filter(o=>!!o)});t.common.issues.push(n)}class rr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const o of r){if(o.status==="aborted")return Ie;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const o of r){const i=await o.key,a=await o.value;n.push({key:i,value:a})}return rr.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const o of r){const{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return Ie;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}}const Ie=Object.freeze({status:"aborted"}),Ei=t=>({status:"dirty",value:t}),Nr=t=>({status:"valid",value:t}),Rh=t=>t.status==="aborted",Ih=t=>t.status==="dirty",No=t=>t.status==="valid",Fa=t=>typeof Promise<"u"&&t instanceof Promise;var ke;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ke||(ke={}));class on{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Nh=(t,e)=>{if(No(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new xn(t.common.issues);return this._error=r,this._error}}};function Fe(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{const{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}class Ve{get description(){return this._def.description}_getType(e){return Hn(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Hn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rr,ctx:{common:e.parent.common,data:e.data,parsedType:Hn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Fa(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hn(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Nh(n,o)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hn(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return No(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>No(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hn(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Fa(o)?o:Promise.resolve(o));return Nh(n,i)}refine(e,r){const n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{const a=e(o),s=()=>i.addIssue({code:ie.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new Fo({schema:this,typeName:Re.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Vn.create(this,this._def)}nullable(){return zo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return an.create(this)}promise(){return Ha.create(this,this._def)}or(e){return Ba.create([this,e],this._def)}and(e){return ja.create(this,e,this._def)}transform(e){return new Fo({...Fe(this._def),schema:this,typeName:Re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Bl({...Fe(this._def),innerType:this,defaultValue:r,typeName:Re.ZodDefault})}brand(){return new x0({typeName:Re.ZodBranded,type:this,...Fe(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new jl({...Fe(this._def),innerType:this,catchValue:r,typeName:Re.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ul.create(this,e)}readonly(){return Hl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const e0=/^c[^\s-]{8,}$/i,t0=/^[0-9a-z]+$/,r0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,n0=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,o0=/^[a-z0-9_-]{21}$/i,i0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,a0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,s0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,l0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Dl;const c0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,u0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,d0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,h0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,f0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,p0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Lh="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",g0=new RegExp(`^${Lh}$`);function Dh(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function v0(t){return new RegExp(`^${Dh(t)}$`)}function m0(t){let e=`${Lh}T${Dh(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function b0(t,e){return!!((e==="v4"||!e)&&c0.test(t)||(e==="v6"||!e)&&d0.test(t))}function y0(t,e){if(!i0.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function w0(t,e){return!!((e==="v4"||!e)&&u0.test(t)||(e==="v6"||!e)&&h0.test(t))}class kn extends Ve{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==me.string){const i=this._getOrReturnCtx(e);return ge(i,{code:ie.invalid_type,expected:me.string,received:i.parsedType}),Ie}const n=new rr;let o;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?ge(o,{code:ie.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ge(o,{code:ie.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")s0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"email",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Dl||(Dl=new RegExp(l0,"u")),Dl.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"emoji",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")n0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"uuid",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")o0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"nanoid",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")e0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"cuid",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")t0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"cuid2",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")r0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"ulid",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),ge(o,{validation:"url",code:ie.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"regex",code:ie.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?m0(i).test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?g0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?v0(i).test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?a0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"duration",code:ie.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?b0(e.data,i.version)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"ip",code:ie.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?y0(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"jwt",code:ie.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?w0(e.data,i.version)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"cidr",code:ie.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?f0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"base64",code:ie.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?p0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"base64url",code:ie.invalid_string,message:i.message}),n.dirty()):Ye.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:ie.invalid_string,...ke.errToObj(n)})}_addCheck(e){return new kn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ke.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ke.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ke.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ke.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ke.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ke.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ke.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ke.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ke.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ke.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ke.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ke.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ke.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ke.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ke.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ke.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ke.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ke.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ke.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ke.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ke.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ke.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ke.errToObj(r)})}nonempty(e){return this.min(1,ke.errToObj(e))}trim(){return new kn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new kn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new kn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}kn.create=t=>new kn({checks:[],typeName:Re.ZodString,coerce:t?.coerce??!1,...Fe(t)});function _0(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}class Lo extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==me.number){const i=this._getOrReturnCtx(e);return ge(i,{code:ie.invalid_type,expected:me.number,received:i.parsedType}),Ie}let n;const o=new rr;for(const i of this._def.checks)i.kind==="int"?Ye.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?_0(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.not_finite,message:i.message}),o.dirty()):Ye.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ke.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ke.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ke.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ke.toString(r))}setLimit(e,r,n,o){return new Lo({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ke.toString(o)}]})}_addCheck(e){return new Lo({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ke.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ke.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ke.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ke.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ke.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ke.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ye.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}Lo.create=t=>new Lo({checks:[],typeName:Re.ZodNumber,coerce:t?.coerce||!1,...Fe(t)});class Ai extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==me.bigint)return this._getInvalidInput(e);let n;const o=new rr;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ye.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return ge(r,{code:ie.invalid_type,expected:me.bigint,received:r.parsedType}),Ie}gte(e,r){return this.setLimit("min",e,!0,ke.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ke.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ke.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ke.toString(r))}setLimit(e,r,n,o){return new Ai({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ke.toString(o)}]})}_addCheck(e){return new Ai({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ke.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ke.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Ai.create=t=>new Ai({checks:[],typeName:Re.ZodBigInt,coerce:t?.coerce??!1,...Fe(t)});class Ml extends Ve{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==me.boolean){const n=this._getOrReturnCtx(e);return ge(n,{code:ie.invalid_type,expected:me.boolean,received:n.parsedType}),Ie}return Nr(e.data)}}Ml.create=t=>new Ml({typeName:Re.ZodBoolean,coerce:t?.coerce||!1,...Fe(t)});class za extends Ve{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==me.date){const i=this._getOrReturnCtx(e);return ge(i,{code:ie.invalid_type,expected:me.date,received:i.parsedType}),Ie}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return ge(i,{code:ie.invalid_date}),Ie}const n=new rr;let o;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ye.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new za({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ke.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ke.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}za.create=t=>new za({checks:[],coerce:t?.coerce||!1,typeName:Re.ZodDate,...Fe(t)});class Mh extends Ve{_parse(e){if(this._getType(e)!==me.symbol){const n=this._getOrReturnCtx(e);return ge(n,{code:ie.invalid_type,expected:me.symbol,received:n.parsedType}),Ie}return Nr(e.data)}}Mh.create=t=>new Mh({typeName:Re.ZodSymbol,...Fe(t)});class Fh extends Ve{_parse(e){if(this._getType(e)!==me.undefined){const n=this._getOrReturnCtx(e);return ge(n,{code:ie.invalid_type,expected:me.undefined,received:n.parsedType}),Ie}return Nr(e.data)}}Fh.create=t=>new Fh({typeName:Re.ZodUndefined,...Fe(t)});class zh extends Ve{_parse(e){if(this._getType(e)!==me.null){const n=this._getOrReturnCtx(e);return ge(n,{code:ie.invalid_type,expected:me.null,received:n.parsedType}),Ie}return Nr(e.data)}}zh.create=t=>new zh({typeName:Re.ZodNull,...Fe(t)});class Bh extends Ve{constructor(){super(...arguments),this._any=!0}_parse(e){return Nr(e.data)}}Bh.create=t=>new Bh({typeName:Re.ZodAny,...Fe(t)});class jh extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Nr(e.data)}}jh.create=t=>new jh({typeName:Re.ZodUnknown,...Fe(t)});class qn extends Ve{_parse(e){const r=this._getOrReturnCtx(e);return ge(r,{code:ie.invalid_type,expected:me.never,received:r.parsedType}),Ie}}qn.create=t=>new qn({typeName:Re.ZodNever,...Fe(t)});class Uh extends Ve{_parse(e){if(this._getType(e)!==me.undefined){const n=this._getOrReturnCtx(e);return ge(n,{code:ie.invalid_type,expected:me.void,received:n.parsedType}),Ie}return Nr(e.data)}}Uh.create=t=>new Uh({typeName:Re.ZodVoid,...Fe(t)});class an extends Ve{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==me.array)return ge(r,{code:ie.invalid_type,expected:me.array,received:r.parsedType}),Ie;if(o.exactLength!==null){const a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(ge(r,{code:a?ie.too_big:ie.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(ge(r,{code:ie.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(ge(r,{code:ie.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new on(r,a,r.path,s)))).then(a=>rr.mergeArray(n,a));const i=[...r.data].map((a,s)=>o.type._parseSync(new on(r,a,r.path,s)));return rr.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new an({...this._def,minLength:{value:e,message:ke.toString(r)}})}max(e,r){return new an({...this._def,maxLength:{value:e,message:ke.toString(r)}})}length(e,r){return new an({...this._def,exactLength:{value:e,message:ke.toString(r)}})}nonempty(e){return this.min(1,e)}}an.create=(t,e)=>new an({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Re.ZodArray,...Fe(e)});function Do(t){if(t instanceof Et){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=Vn.create(Do(n))}return new Et({...t._def,shape:()=>e})}else return t instanceof an?new an({...t._def,type:Do(t.element)}):t instanceof Vn?Vn.create(Do(t.unwrap())):t instanceof zo?zo.create(Do(t.unwrap())):t instanceof ho?ho.create(t.items.map(e=>Do(e))):t}class Et extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=Ye.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==me.object){const l=this._getOrReturnCtx(e);return ge(l,{code:ie.invalid_type,expected:me.object,received:l.parsedType}),Ie}const{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof qn&&this._def.unknownKeys==="strip"))for(const l in o.data)a.includes(l)||s.push(l);const c=[];for(const l of a){const d=i[l],h=o.data[l];c.push({key:{status:"valid",value:l},value:d._parse(new on(o,h,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof qn){const l=this._def.unknownKeys;if(l==="passthrough")for(const d of s)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(l==="strict")s.length>0&&(ge(o,{code:ie.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const d of s){const h=o.data[d];c.push({key:{status:"valid",value:d},value:l._parse(new on(o,h,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const l=[];for(const d of c){const h=await d.key,f=await d.value;l.push({key:h,value:f,alwaysSet:d.alwaysSet})}return l}).then(l=>rr.mergeObjectSync(n,l)):rr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return ke.errToObj,new Et({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ke.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new Et({...this._def,unknownKeys:"strip"})}passthrough(){return new Et({...this._def,unknownKeys:"passthrough"})}extend(e){return new Et({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Et({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Re.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Et({...this._def,catchall:e})}pick(e){const r={};for(const n of Ye.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Et({...this._def,shape:()=>r})}omit(e){const r={};for(const n of Ye.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new Et({...this._def,shape:()=>r})}deepPartial(){return Do(this)}partial(e){const r={};for(const n of Ye.objectKeys(this.shape)){const o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new Et({...this._def,shape:()=>r})}required(e){const r={};for(const n of Ye.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Vn;)i=i._def.innerType;r[n]=i}return new Et({...this._def,shape:()=>r})}keyof(){return Vh(Ye.objectKeys(this.shape))}}Et.create=(t,e)=>new Et({shape:()=>t,unknownKeys:"strip",catchall:qn.create(),typeName:Re.ZodObject,...Fe(e)}),Et.strictCreate=(t,e)=>new Et({shape:()=>t,unknownKeys:"strict",catchall:qn.create(),typeName:Re.ZodObject,...Fe(e)}),Et.lazycreate=(t,e)=>new Et({shape:t,unknownKeys:"strip",catchall:qn.create(),typeName:Re.ZodObject,...Fe(e)});class Ba extends Ve{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(const s of i)if(s.result.status==="valid")return s.result;for(const s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(s=>new xn(s.ctx.common.issues));return ge(r,{code:ie.invalid_union,unionErrors:a}),Ie}if(r.common.async)return Promise.all(n.map(async i=>{const a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i;const a=[];for(const c of n){const l={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const s=a.map(c=>new xn(c));return ge(r,{code:ie.invalid_union,unionErrors:s}),Ie}}get options(){return this._def.options}}Ba.create=(t,e)=>new Ba({options:t,typeName:Re.ZodUnion,...Fe(e)});function Fl(t,e){const r=Hn(t),n=Hn(e);if(t===e)return{valid:!0,data:t};if(r===me.object&&n===me.object){const o=Ye.objectKeys(e),i=Ye.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(const s of i){const c=Fl(t[s],e[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===me.array&&n===me.array){if(t.length!==e.length)return{valid:!1};const o=[];for(let i=0;i<t.length;i++){const a=t[i],s=e[i],c=Fl(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===me.date&&n===me.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class ja extends Ve{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(Rh(i)||Rh(a))return Ie;const s=Fl(i.value,a.value);return s.valid?((Ih(i)||Ih(a))&&r.dirty(),{status:r.value,value:s.data}):(ge(n,{code:ie.invalid_intersection_types}),Ie)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ja.create=(t,e,r)=>new ja({left:t,right:e,typeName:Re.ZodIntersection,...Fe(r)});class ho extends Ve{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==me.array)return ge(n,{code:ie.invalid_type,expected:me.array,received:n.parsedType}),Ie;if(n.data.length<this._def.items.length)return ge(n,{code:ie.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ie;!this._def.rest&&n.data.length>this._def.items.length&&(ge(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((a,s)=>{const c=this._def.items[s]||this._def.rest;return c?c._parse(new on(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>rr.mergeArray(r,a)):rr.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new ho({...this._def,rest:e})}}ho.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ho({items:t,typeName:Re.ZodTuple,rest:null,...Fe(e)})};class Ua extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==me.object)return ge(n,{code:ie.invalid_type,expected:me.object,received:n.parsedType}),Ie;const o=[],i=this._def.keyType,a=this._def.valueType;for(const s in n.data)o.push({key:i._parse(new on(n,s,n.path,s)),value:a._parse(new on(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?rr.mergeObjectAsync(r,o):rr.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ve?new Ua({keyType:e,valueType:r,typeName:Re.ZodRecord,...Fe(n)}):new Ua({keyType:kn.create(),valueType:e,typeName:Re.ZodRecord,...Fe(r)})}}class Hh extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==me.map)return ge(n,{code:ie.invalid_type,expected:me.map,received:n.parsedType}),Ie;const o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],l)=>({key:o._parse(new on(n,s,n.path,[l,"key"])),value:i._parse(new on(n,c,n.path,[l,"value"]))}));if(n.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const c of a){const l=await c.key,d=await c.value;if(l.status==="aborted"||d.status==="aborted")return Ie;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),s.set(l.value,d.value)}return{status:r.value,value:s}})}else{const s=new Map;for(const c of a){const l=c.key,d=c.value;if(l.status==="aborted"||d.status==="aborted")return Ie;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),s.set(l.value,d.value)}return{status:r.value,value:s}}}}Hh.create=(t,e,r)=>new Hh({valueType:e,keyType:t,typeName:Re.ZodMap,...Fe(r)});class Oi extends Ve{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==me.set)return ge(n,{code:ie.invalid_type,expected:me.set,received:n.parsedType}),Ie;const o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ge(n,{code:ie.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(ge(n,{code:ie.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());const i=this._def.valueType;function a(c){const l=new Set;for(const d of c){if(d.status==="aborted")return Ie;d.status==="dirty"&&r.dirty(),l.add(d.value)}return{status:r.value,value:l}}const s=[...n.data.values()].map((c,l)=>i._parse(new on(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(e,r){return new Oi({...this._def,minSize:{value:e,message:ke.toString(r)}})}max(e,r){return new Oi({...this._def,maxSize:{value:e,message:ke.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Oi.create=(t,e)=>new Oi({valueType:t,minSize:null,maxSize:null,typeName:Re.ZodSet,...Fe(e)});class qh extends Ve{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}qh.create=(t,e)=>new qh({getter:t,typeName:Re.ZodLazy,...Fe(e)});class zl extends Ve{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return ge(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),Ie}return{status:"valid",value:e.data}}get value(){return this._def.value}}zl.create=(t,e)=>new zl({value:t,typeName:Re.ZodLiteral,...Fe(e)});function Vh(t,e){return new Mo({values:t,typeName:Re.ZodEnum,...Fe(e)})}class Mo extends Ve{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return ge(r,{expected:Ye.joinValues(n),received:r.parsedType,code:ie.invalid_type}),Ie}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return ge(r,{received:r.data,code:ie.invalid_enum_value,options:n}),Ie}return Nr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Mo.create(e,{...this._def,...r})}exclude(e,r=this._def){return Mo.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Mo.create=Vh;class Wh extends Ve{_parse(e){const r=Ye.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==me.string&&n.parsedType!==me.number){const o=Ye.objectValues(r);return ge(n,{expected:Ye.joinValues(o),received:n.parsedType,code:ie.invalid_type}),Ie}if(this._cache||(this._cache=new Set(Ye.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const o=Ye.objectValues(r);return ge(n,{received:n.data,code:ie.invalid_enum_value,options:o}),Ie}return Nr(e.data)}get enum(){return this._def.values}}Wh.create=(t,e)=>new Wh({values:t,typeName:Re.ZodNativeEnum,...Fe(e)});class Ha extends Ve{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==me.promise&&r.common.async===!1)return ge(r,{code:ie.invalid_type,expected:me.promise,received:r.parsedType}),Ie;const n=r.parsedType===me.promise?r.data:Promise.resolve(r.data);return Nr(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Ha.create=(t,e)=>new Ha({type:t,typeName:Re.ZodPromise,...Fe(e)});class Fo extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{ge(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return Ie;const c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?Ie:c.status==="dirty"||r.value==="dirty"?Ei(c.value):c});{if(r.value==="aborted")return Ie;const s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Ie:s.status==="dirty"||r.value==="dirty"?Ei(s.value):s}}if(o.type==="refinement"){const a=s=>{const c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Ie:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Ie:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!No(a))return Ie;const s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>No(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):Ie);Ye.assertNever(o)}}Fo.create=(t,e,r)=>new Fo({schema:t,typeName:Re.ZodEffects,effect:e,...Fe(r)}),Fo.createWithPreprocess=(t,e,r)=>new Fo({schema:e,effect:{type:"preprocess",transform:t},typeName:Re.ZodEffects,...Fe(r)});class Vn extends Ve{_parse(e){return this._getType(e)===me.undefined?Nr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Vn.create=(t,e)=>new Vn({innerType:t,typeName:Re.ZodOptional,...Fe(e)});class zo extends Ve{_parse(e){return this._getType(e)===me.null?Nr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}zo.create=(t,e)=>new zo({innerType:t,typeName:Re.ZodNullable,...Fe(e)});class Bl extends Ve{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===me.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Bl.create=(t,e)=>new Bl({innerType:t,typeName:Re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Fe(e)});class jl extends Ve{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Fa(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new xn(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new xn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}jl.create=(t,e)=>new jl({innerType:t,typeName:Re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Fe(e)});class $h extends Ve{_parse(e){if(this._getType(e)!==me.nan){const n=this._getOrReturnCtx(e);return ge(n,{code:ie.invalid_type,expected:me.nan,received:n.parsedType}),Ie}return{status:"valid",value:e.data}}}$h.create=t=>new $h({typeName:Re.ZodNaN,...Fe(t)});class x0 extends Ve{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Ul extends Ve{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Ie:i.status==="dirty"?(r.dirty(),Ei(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Ie:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new Ul({in:e,out:r,typeName:Re.ZodPipeline})}}class Hl extends Ve{_parse(e){const r=this._def.innerType._parse(e),n=o=>(No(o)&&(o.value=Object.freeze(o.value)),o);return Fa(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}}Hl.create=(t,e)=>new Hl({innerType:t,typeName:Re.ZodReadonly,...Fe(e)});var Re;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Re||(Re={}));const D=kn.create,Lr=Lo.create,nr=Ml.create;qn.create;const Sr=an.create,Le=Et.create,Pi=Ba.create;ja.create,ho.create;const Sn=Ua.create,k0=zl.create,Bo=Mo.create;Ha.create,Vn.create,zo.create;var ql={inherit:"inherit",current:"currentcolor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(98.4% 0.003 247.858)",100:"oklch(96.8% 0.007 247.896)",200:"oklch(92.9% 0.013 255.508)",300:"oklch(86.9% 0.022 252.894)",400:"oklch(70.4% 0.04 256.788)",500:"oklch(55.4% 0.046 257.417)",600:"oklch(44.6% 0.043 257.281)",700:"oklch(37.2% 0.044 257.287)",800:"oklch(27.9% 0.041 260.031)",900:"oklch(20.8% 0.042 265.755)",950:"oklch(12.9% 0.042 264.695)"},gray:{50:"oklch(98.5% 0.002 247.839)",100:"oklch(96.7% 0.003 264.542)",200:"oklch(92.8% 0.006 264.531)",300:"oklch(87.2% 0.01 258.338)",400:"oklch(70.7% 0.022 261.325)",500:"oklch(55.1% 0.027 264.364)",600:"oklch(44.6% 0.03 256.802)",700:"oklch(37.3% 0.034 259.733)",800:"oklch(27.8% 0.033 256.848)",900:"oklch(21% 0.034 264.665)",950:"oklch(13% 0.028 261.692)"},zinc:{50:"oklch(98.5% 0 0)",100:"oklch(96.7% 0.001 286.375)",200:"oklch(92% 0.004 286.32)",300:"oklch(87.1% 0.006 286.286)",400:"oklch(70.5% 0.015 286.067)",500:"oklch(55.2% 0.016 285.938)",600:"oklch(44.2% 0.017 285.786)",700:"oklch(37% 0.013 285.805)",800:"oklch(27.4% 0.006 286.033)",900:"oklch(21% 0.006 285.885)",950:"oklch(14.1% 0.005 285.823)"},neutral:{50:"oklch(98.5% 0 0)",100:"oklch(97% 0 0)",200:"oklch(92.2% 0 0)",300:"oklch(87% 0 0)",400:"oklch(70.8% 0 0)",500:"oklch(55.6% 0 0)",600:"oklch(43.9% 0 0)",700:"oklch(37.1% 0 0)",800:"oklch(26.9% 0 0)",900:"oklch(20.5% 0 0)",950:"oklch(14.5% 0 0)"},stone:{50:"oklch(98.5% 0.001 106.423)",100:"oklch(97% 0.001 106.424)",200:"oklch(92.3% 0.003 48.717)",300:"oklch(86.9% 0.005 56.366)",400:"oklch(70.9% 0.01 56.259)",500:"oklch(55.3% 0.013 58.071)",600:"oklch(44.4% 0.011 73.639)",700:"oklch(37.4% 0.01 67.558)",800:"oklch(26.8% 0.007 34.298)",900:"oklch(21.6% 0.006 56.043)",950:"oklch(14.7% 0.004 49.25)"},red:{50:"oklch(97.1% 0.013 17.38)",100:"oklch(93.6% 0.032 17.717)",200:"oklch(88.5% 0.062 18.334)",300:"oklch(80.8% 0.114 19.571)",400:"oklch(70.4% 0.191 22.216)",500:"oklch(63.7% 0.237 25.331)",600:"oklch(57.7% 0.245 27.325)",700:"oklch(50.5% 0.213 27.518)",800:"oklch(44.4% 0.177 26.899)",900:"oklch(39.6% 0.141 25.723)",950:"oklch(25.8% 0.092 26.042)"},orange:{50:"oklch(98% 0.016 73.684)",100:"oklch(95.4% 0.038 75.164)",200:"oklch(90.1% 0.076 70.697)",300:"oklch(83.7% 0.128 66.29)",400:"oklch(75% 0.183 55.934)",500:"oklch(70.5% 0.213 47.604)",600:"oklch(64.6% 0.222 41.116)",700:"oklch(55.3% 0.195 38.402)",800:"oklch(47% 0.157 37.304)",900:"oklch(40.8% 0.123 38.172)",950:"oklch(26.6% 0.079 36.259)"},amber:{50:"oklch(98.7% 0.022 95.277)",100:"oklch(96.2% 0.059 95.617)",200:"oklch(92.4% 0.12 95.746)",300:"oklch(87.9% 0.169 91.605)",400:"oklch(82.8% 0.189 84.429)",500:"oklch(76.9% 0.188 70.08)",600:"oklch(66.6% 0.179 58.318)",700:"oklch(55.5% 0.163 48.998)",800:"oklch(47.3% 0.137 46.201)",900:"oklch(41.4% 0.112 45.904)",950:"oklch(27.9% 0.077 45.635)"},yellow:{50:"oklch(98.7% 0.026 102.212)",100:"oklch(97.3% 0.071 103.193)",200:"oklch(94.5% 0.129 101.54)",300:"oklch(90.5% 0.182 98.111)",400:"oklch(85.2% 0.199 91.936)",500:"oklch(79.5% 0.184 86.047)",600:"oklch(68.1% 0.162 75.834)",700:"oklch(55.4% 0.135 66.442)",800:"oklch(47.6% 0.114 61.907)",900:"oklch(42.1% 0.095 57.708)",950:"oklch(28.6% 0.066 53.813)"},lime:{50:"oklch(98.6% 0.031 120.757)",100:"oklch(96.7% 0.067 122.328)",200:"oklch(93.8% 0.127 124.321)",300:"oklch(89.7% 0.196 126.665)",400:"oklch(84.1% 0.238 128.85)",500:"oklch(76.8% 0.233 130.85)",600:"oklch(64.8% 0.2 131.684)",700:"oklch(53.2% 0.157 131.589)",800:"oklch(45.3% 0.124 130.933)",900:"oklch(40.5% 0.101 131.063)",950:"oklch(27.4% 0.072 132.109)"},green:{50:"oklch(98.2% 0.018 155.826)",100:"oklch(96.2% 0.044 156.743)",200:"oklch(92.5% 0.084 155.995)",300:"oklch(87.1% 0.15 154.449)",400:"oklch(79.2% 0.209 151.711)",500:"oklch(72.3% 0.219 149.579)",600:"oklch(62.7% 0.194 149.214)",700:"oklch(52.7% 0.154 150.069)",800:"oklch(44.8% 0.119 151.328)",900:"oklch(39.3% 0.095 152.535)",950:"oklch(26.6% 0.065 152.934)"},emerald:{50:"oklch(97.9% 0.021 166.113)",100:"oklch(95% 0.052 163.051)",200:"oklch(90.5% 0.093 164.15)",300:"oklch(84.5% 0.143 164.978)",400:"oklch(76.5% 0.177 163.223)",500:"oklch(69.6% 0.17 162.48)",600:"oklch(59.6% 0.145 163.225)",700:"oklch(50.8% 0.118 165.612)",800:"oklch(43.2% 0.095 166.913)",900:"oklch(37.8% 0.077 168.94)",950:"oklch(26.2% 0.051 172.552)"},teal:{50:"oklch(98.4% 0.014 180.72)",100:"oklch(95.3% 0.051 180.801)",200:"oklch(91% 0.096 180.426)",300:"oklch(85.5% 0.138 181.071)",400:"oklch(77.7% 0.152 181.912)",500:"oklch(70.4% 0.14 182.503)",600:"oklch(60% 0.118 184.704)",700:"oklch(51.1% 0.096 186.391)",800:"oklch(43.7% 0.078 188.216)",900:"oklch(38.6% 0.063 188.416)",950:"oklch(27.7% 0.046 192.524)"},cyan:{50:"oklch(98.4% 0.019 200.873)",100:"oklch(95.6% 0.045 203.388)",200:"oklch(91.7% 0.08 205.041)",300:"oklch(86.5% 0.127 207.078)",400:"oklch(78.9% 0.154 211.53)",500:"oklch(71.5% 0.143 215.221)",600:"oklch(60.9% 0.126 221.723)",700:"oklch(52% 0.105 223.128)",800:"oklch(45% 0.085 224.283)",900:"oklch(39.8% 0.07 227.392)",950:"oklch(30.2% 0.056 229.695)"},sky:{50:"oklch(97.7% 0.013 236.62)",100:"oklch(95.1% 0.026 236.824)",200:"oklch(90.1% 0.058 230.902)",300:"oklch(82.8% 0.111 230.318)",400:"oklch(74.6% 0.16 232.661)",500:"oklch(68.5% 0.169 237.323)",600:"oklch(58.8% 0.158 241.966)",700:"oklch(50% 0.134 242.749)",800:"oklch(44.3% 0.11 240.79)",900:"oklch(39.1% 0.09 240.876)",950:"oklch(29.3% 0.066 243.157)"},blue:{50:"oklch(97% 0.014 254.604)",100:"oklch(93.2% 0.032 255.585)",200:"oklch(88.2% 0.059 254.128)",300:"oklch(80.9% 0.105 251.813)",400:"oklch(70.7% 0.165 254.624)",500:"oklch(62.3% 0.214 259.815)",600:"oklch(54.6% 0.245 262.881)",700:"oklch(48.8% 0.243 264.376)",800:"oklch(42.4% 0.199 265.638)",900:"oklch(37.9% 0.146 265.522)",950:"oklch(28.2% 0.091 267.935)"},indigo:{50:"oklch(96.2% 0.018 272.314)",100:"oklch(93% 0.034 272.788)",200:"oklch(87% 0.065 274.039)",300:"oklch(78.5% 0.115 274.713)",400:"oklch(67.3% 0.182 276.935)",500:"oklch(58.5% 0.233 277.117)",600:"oklch(51.1% 0.262 276.966)",700:"oklch(45.7% 0.24 277.023)",800:"oklch(39.8% 0.195 277.366)",900:"oklch(35.9% 0.144 278.697)",950:"oklch(25.7% 0.09 281.288)"},violet:{50:"oklch(96.9% 0.016 293.756)",100:"oklch(94.3% 0.029 294.588)",200:"oklch(89.4% 0.057 293.283)",300:"oklch(81.1% 0.111 293.571)",400:"oklch(70.2% 0.183 293.541)",500:"oklch(60.6% 0.25 292.717)",600:"oklch(54.1% 0.281 293.009)",700:"oklch(49.1% 0.27 292.581)",800:"oklch(43.2% 0.232 292.759)",900:"oklch(38% 0.189 293.745)",950:"oklch(28.3% 0.141 291.089)"},purple:{50:"oklch(97.7% 0.014 308.299)",100:"oklch(94.6% 0.033 307.174)",200:"oklch(90.2% 0.063 306.703)",300:"oklch(82.7% 0.119 306.383)",400:"oklch(71.4% 0.203 305.504)",500:"oklch(62.7% 0.265 303.9)",600:"oklch(55.8% 0.288 302.321)",700:"oklch(49.6% 0.265 301.924)",800:"oklch(43.8% 0.218 303.724)",900:"oklch(38.1% 0.176 304.987)",950:"oklch(29.1% 0.149 302.717)"},fuchsia:{50:"oklch(97.7% 0.017 320.058)",100:"oklch(95.2% 0.037 318.852)",200:"oklch(90.3% 0.076 319.62)",300:"oklch(83.3% 0.145 321.434)",400:"oklch(74% 0.238 322.16)",500:"oklch(66.7% 0.295 322.15)",600:"oklch(59.1% 0.293 322.896)",700:"oklch(51.8% 0.253 323.949)",800:"oklch(45.2% 0.211 324.591)",900:"oklch(40.1% 0.17 325.612)",950:"oklch(29.3% 0.136 325.661)"},pink:{50:"oklch(97.1% 0.014 343.198)",100:"oklch(94.8% 0.028 342.258)",200:"oklch(89.9% 0.061 343.231)",300:"oklch(82.3% 0.12 346.018)",400:"oklch(71.8% 0.202 349.761)",500:"oklch(65.6% 0.241 354.308)",600:"oklch(59.2% 0.249 0.584)",700:"oklch(52.5% 0.223 3.958)",800:"oklch(45.9% 0.187 3.815)",900:"oklch(40.8% 0.153 2.432)",950:"oklch(28.4% 0.109 3.907)"},rose:{50:"oklch(96.9% 0.015 12.422)",100:"oklch(94.1% 0.03 12.58)",200:"oklch(89.2% 0.058 10.001)",300:"oklch(81% 0.117 11.638)",400:"oklch(71.2% 0.194 13.428)",500:"oklch(64.5% 0.246 16.439)",600:"oklch(58.6% 0.253 17.585)",700:"oklch(51.4% 0.222 16.935)",800:"oklch(45.5% 0.188 13.697)",900:"oklch(41% 0.159 10.272)",950:"oklch(27.1% 0.105 12.094)"}};const or=Le({minRem:Lr(),maxRem:Lr()}).or(D()),qa=Le({0:D().optional(),50:D(),100:D(),200:D(),300:D(),400:D(),500:D(),600:D(),700:D(),800:D(),900:D(),950:D(),1e3:D().optional()}),Vl=Le({color:D().optional(),background:D().optional(),borderWidth:D().optional(),borderColor:D().optional(),boxShadow:D().optional()}),S0=Le({borderRadius:or.optional(),custom:Sn(D(),Pi([D(),Lr()])).optional(),hover:Vl.optional(),focus:Vl.optional()}).and(Vl),C0=Le({family:D().optional()}),T0=Sn(Bo(["predefinedQuestion","edit","newConversation","voteUp","voteDown","retry","message","messageLoading","thread","submit","abort","expand","help","attach","record","reward","share","audio","copy","dismiss","menu","info","menuClose","chevronDown","chevronUp","chevronTopDown","internalLink","externalLink","liip","avatar","openChat","speechInput","listUnordered","lightMode","darkMode","avatarLarge"]),D()),E0=Le({font:C0.optional(),colors:Le({brand:qa,accent:qa.optional(),highlight:qa,grey:qa}),base:Le({fontSizeXs:or.optional(),fontSizeSm:or.optional(),fontSizeBody:or.optional(),fontSizeH3:or.optional(),fontSizeH2:or.optional(),fontSizeH1:or.optional(),fontWeightNormal:D().optional(),fontWeightBold:D().optional(),fontWeightTitle:D().optional(),lineHeightDefault:D().optional(),lineHeightSnug:D().optional(),lineHeightTight:D().optional(),borderRadius:or.optional(),lineColor:D().optional(),boxShadow:D().optional()}),components:Sn(D(),S0),svgs:T0}),Va=Le({customCSS:D().optional(),fontCSS:D().optional(),fontURLs:D().array().optional(),tokens:E0});Le({light:Va,dark:Va});const A0=Le({light:Va,dark:Va}).deepPartial(),Zh=Le({50:D(),100:D(),200:D(),300:D(),400:D(),500:D(),600:D(),700:D(),800:D(),900:D(),950:D()}),Kh=Bo(["slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]),Gh=Pi([Zh,Kh]),O0=Pi([Zh.and(Le({0:D(),1e3:D()})),Kh]),Yh=Le({avatarImageUrl:D().optional(),colors:Le({brand:Gh.optional(),highlight:Gh.optional(),grey:O0.optional(),background:D().optional(),text:D().optional(),anchor:Le({default:D().optional(),hover:D().optional()}).optional()}).optional(),font:Le({family:D().optional(),urls:Sr(D()).optional(),sizeXs:or.optional(),sizeSm:or.optional(),sizeBody:or.optional(),sizeH3:or.optional(),sizeH2:or.optional(),sizeH1:or.optional(),weightNormal:D().optional(),weightBold:D().optional(),weightTitle:D().optional()}).optional(),borderRadius:or.optional(),fineGrained:A0.optional()}),P0=Le({blocked:D(),maintenance:D(),"rate-limit":D(),"server-error":D(),"too-short":D(),"too-long":D(),"quota-reached":D(),aborted:D(),"sse-error":D(),"client-error":D(),"unexpected-call":D(),"incomplete-error":D(),"feedback-failed":D(),"speech-not-supported":D(),"speech-transcription-failed":D(),"speech-no-text-detected":D(),"speech-microphone-access-denied":D(),"pii-detected":D()}),R0=Le({email:D(),creditCard:D(),ahv:D(),phoneSwiss:D(),phoneInternational:D(),swissPassport:D(),longNumber:D()}),Qh=Le({predefinedQuestions:D(),introductionTitle:D(),introductionDisclaimer:D().optional(),chatInputPlaceholder:D(),chatInputPlaceholderListening:D().optional(),chatInputSubmit:D(),chatInputStartListening:D(),chatInputStopListening:D(),referenceLink:D(),referencesDisplay:D(),referencesHide:D(),referencesTitle:D(),referencesFurtherTitle:D(),newChat:D(),maintenanceModeError:D(),messageBotLoading:D(),messageBotError:D(),messageBotDefaultError:D(),noResultsFound:D(),chatFooterText:D().optional(),scrollToBottom:D(),openButtonTitle:D().optional(),openButtonDescription:D().optional(),openMenu:D(),openInfo:D(),aboutThisChat:D().optional(),closeMenu:D(),closeChat:D(),close:D(),send:D(),thankYouForFeedback:D(),giveFeedback:D(),sendFeedback:D(),feedbackFormTitle:D(),feedbackFormMessage:D(),feedbackFormMessagePlaceholder:D(),feedbackFormEmail:D(),feedbackFormEmailPlaceholder:D(),answerGood:D(),answerBad:D(),classificationSubmit:D(),classificationThankYou:D(),classificationTitle:D(),selectLanguage:D(),lightMode:D(),darkMode:D()}),jo=Bo(["en","de","fr","it"]),Xh=Sn(jo,Qh.partial());Sn(jo,P0),Sn(jo,R0);const Jh=Le({label:D(),options:Sr(Le({label:D(),value:Lr()}))}),I0=Le({label:D(),icon:D(),url:D(),target:Bo(["_blank","_self"]).optional()}),N0=Le({label:D().nullable(),question:D()}),ef=Le({impact:Jh.optional(),quality:Jh.optional()});Le({classification:ef.optional()});const L0=Le({predefinedQuestions:Sr(N0)}),tf=Pi([Le({maintenance:k0(!0)}),Le({id:D(),cID:D()})]);Sn(jo,Qh);const rf=Le({showPredefinedQuestions:nr(),showOverallFeedbackButton:nr(),showCloseChatButton:nr(),showContextMenu:nr(),showContextInfo:nr(),allowAudioInput:nr(),blockPII:nr(),questionPrefix:D(),menu:Sn(jo,Sr(I0)).optional(),supportedLanguages:Sr(jo),classification:ef.optional(),showTextFeedback:nr(),theme:Yh,translations:Xh,buttonHref:D().optional(),addQueryToUrlParams:nr().optional(),renderKatex:nr().optional(),reflectLanguageInPath:nr().optional(),sendReferrer:Bo(["all","own","none"]).optional()}).partial().and(Le({theme:Le({name:D().optional()}).optional()}));class D0{constructor(e){this.chatResponseData=e,this.id=this.chatResponseData.id}id;async isReadyForFeedback(){return await this.chatResponseData.readyForFeedback.toPromise(),!0}subscribe(e,r){return this.chatResponseData.readableStore.subscribe(e,r)}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)}}const Uo=new Map;class M0{get length(){return Uo.size}clear(){Uo.clear()}getItem(e){return Uo.get(e)||null}key(e){return Array.from(Uo.keys())[e]||null}removeItem(e){Uo.delete(e)}setItem(e,r){Uo.set(e,String(r))}}const nf=globalThis.localStorage??new M0,F0=async t=>{try{const e=nf.getItem("uID"),r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:e})},n=await t.fetchData("/login",tf,{},r).catch(o=>(console.log("Failed to /login use /log",o),t.fetchData("/log",tf,{},r)));if("maintenance"in n&&n.maintenance)return{mode:"maintenance"};if(!("id"in n))throw new Error("Invalid response format: missing user id");return nf.setItem("uID",n.id),{mode:"ready",userId:n.id}}catch(e){throw console.error("Failed to fetch user data:",e),e}};var Cr=function(t,e){if(!(this instanceof Cr))return new Cr(t,e);this.url=t,e=e||{},this.headers=e.headers||{},this.payload=e.payload!==void 0?e.payload:"",this.method=e.method||this.payload&&"POST"||"GET",this.withCredentials=!!e.withCredentials,this.debug=!!e.debug,this.autoReconnect=e.autoReconnect!==void 0?e.autoReconnect:!1,this.reconnectDelay=e.reconnectDelay!==void 0?e.reconnectDelay:3e3,this.maxRetries=e.maxRetries!==void 0?e.maxRetries:null,this.retryCount=0,this.reconnectTimer=null,this.useLastEventId=e.useLastEventId!==void 0?e.useLastEventId:!0,this.FIELD_SEPARATOR=":",this.listeners={},this.xhr=null,this.readyState=Cr.INITIALIZING,this.progress=0,this.chunk="",this.lastEventId="",this.addEventListener=function(r,n){this.listeners[r]===void 0&&(this.listeners[r]=[]),this.listeners[r].indexOf(n)===-1&&this.listeners[r].push(n)},this.removeEventListener=function(r,n){if(this.listeners[r]===void 0)return;const o=[];this.listeners[r].forEach(function(i){i!==n&&o.push(i)}),o.length===0?delete this.listeners[r]:this.listeners[r]=o},this.dispatchEvent=function(r){if(!r)return!0;this.debug&&console.debug(r),r.source=this;const n="on"+r.type;return this.hasOwnProperty(n)&&(this[n].call(this,r),r.defaultPrevented)?!1:this.listeners[r.type]?this.listeners[r.type].every(function(o){return o(r),!r.defaultPrevented}):!0},this._markClosed=function(){if(this.xhr=null,this.progress=0,this.chunk="",this._setReadyState(Cr.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(r){const n=new CustomEvent("readystatechange");n.readyState=r,this.readyState=r,this.dispatchEvent(n)},this._onStreamFailure=function(r){const n=new CustomEvent("error");n.responseCode=r.currentTarget.status,n.data=r.currentTarget.response,this.dispatchEvent(n),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent("abort")),this._markClosed()},this._onStreamProgress=function(r){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300){this._onStreamFailure(r);return}this.retryCount=0;const n=this.xhr.responseText.substring(this.progress);this.progress+=n.length;const o=(this.chunk+n).split(/(\r\n\r\n|\r\r|\n\n)/g),i=o.pop();o.forEach((function(a){a.trim().length>0&&this.dispatchEvent(this._parseEventChunk(a))}).bind(this)),this.chunk=i},this._onStreamLoaded=function(r){this._onStreamProgress(r),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk="",this._markClosed()},this._parseEventChunk=function(r){if(!r||r.length===0)return null;this.debug&&console.debug(r);const n={id:null,retry:null,data:null,event:null};if(r.split(/\n|\r\n|\r/).forEach((function(i){const a=i.indexOf(this.FIELD_SEPARATOR);let s,c;if(a>0){const l=i[a+1]===" "?2:1;s=i.substring(0,a),c=i.substring(a+l)}else if(a<0)s=i,c="";else return;s in n&&(s==="data"&&n[s]!==null?n.data+=`
|
|
58
|
+
Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An error occurred:</p><pre>"+nn(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},uo=new Ch;function ot(t,e){return uo.parse(t,e)}ot.options=ot.setOptions=function(t){return uo.setOptions(t),ot.defaults=uo.defaults,ch(ot.defaults),ot},ot.getDefaults=kl,ot.defaults=co,ot.use=function(...t){return uo.use(...t),ot.defaults=uo.defaults,ch(ot.defaults),ot},ot.walkTokens=function(t,e){return uo.walkTokens(t,e)},ot.parseInline=uo.parseInline,ot.Parser=_n,ot.parser=_n.parse,ot.Renderer=Da,ot.TextRenderer=Il,ot.Lexer=wn,ot.lexer=wn.lex,ot.Tokenizer=La,ot.Hooks=Ma,ot.parse=ot,ot.options,ot.setOptions,ot.use,ot.walkTokens,ot.parseInline,_n.parse,wn.lex;const Th=t=>(Object.getOwnPropertyNames(t).forEach(e=>{const r=t[e];r&&typeof r=="object"&&Th(r)}),Object.freeze(t)),Eh=Th({all:[],used:[],unused:[]}),$b=t=>{const e=ub(t);return e.addHook("uponSanitizeElement",function(r,n){const o=n.tagName||r.nodeName.toLowerCase();o.startsWith("liipgpt-")&&(n.allowedTags[o]=!0)}),e};class Ah{marked;currentReferences=Eh;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new Ch({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=$b(e.window)}createFootnoteExtension=()=>{const e=this;return{extensions:[{name:"footnote",level:"inline",start(r){return r.match(/\[\^(\d+)\]/)?.index},tokenizer(r){const o=/^\[\^(\d+)\]/.exec(r);if(o){const[i,a]=o;return{type:"footnote",raw:i,refNumber:a}}},renderer(r){if(r.type==="footnote"){const n=parseInt(r.refNumber)-1,o=e.currentReferences.all[n];if(!o)return console.error("Could not find ref with index:",n),"";let i;return o?.referenceIndex.used?i=o.referenceIndex.used:(e.currentReferences.used.push(o),e.lastUsedIndex++,i=e.lastUsedIndex,o.referenceIndex.used=i),` <liipgpt-reference-number data-all-index="${n}" data-used-index="${i}" data-source="${JSON.stringify(o).replace(/"/g,""")}"></liipgpt-reference-number>`}}}]}};parse(e){return this.DomPurity.sanitize(this.marked.parse(e),{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0,mathMl:!0},FORBID_TAGS:["hr"]})}toHTML(e,r){this.currentReferences=r;const n=this.parse(e);return this.currentReferences=Eh,n}}function Zb(){let t,e;return{promise:new Promise((n,o)=>{e=n,t=o}),reject:t,resolve:e}}class Oh{promise;resolve;reject;constructor(){const{promise:e,resolve:r,reject:n}=Zb();this.promise=e,this.resolve=r,this.reject=n}then(e,r){return this.promise.then(e,r)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}toPromise(){return this.promise}[Symbol.toStringTag]="Flag"}class Nl{hasValue=new Oh;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,r){return this.toPromise().then(e,r)}catch(e){return this.toPromise().catch(e)}finally(e){return this.toPromise().finally(e)}[Symbol.toStringTag]="FutureValue"}const Kb=t=>{try{return new URL(t).hostname}catch{return t}},Gb=({url:t,considered:e,title:r,description:n,summary:o})=>{const i=Kb(t);return{url:t,considered:e,referenceIndex:{},score:0,metadata:{},display:{card:{title:r,description:n||o,badge:t},listItem:{title:r,badge:i}}}};class Yb{constructor(e){this.options=e,this.store=$d({id:e.id,state:"loading",errors:[],type:"bot",time:new Date().toISOString(),message:{markdown:"",html:""},references:{all:[],used:[],unused:[]}})}store;content=new Nl;backendSendsMappedRefs=!1;pushError(e){this.options.onError?.(e),this.store.update(r=>({...r,errors:[...r.errors,e]}))}updateRequestId(e){this.store.update(r=>({...r,id:e}))}updateText(e){this.store.update(r=>{const n=r.message.markdown+e,o=this.options.markdownRenderer.toHTML(n,r.references);return{...r,state:"streaming",message:{markdown:n,html:o}}})}finishMessage(){this.store.update(e=>{const r={...e,state:"done"};return r.references.unused=r.references.all.filter(n=>n.referenceIndex.used===void 0),this.options?.onFinish?.(r),this.content.setValue(r),r})}addReference(e){this.store.update(r=>{const n=r.references.all,o=n.length,i=[...n,{...e,referenceIndex:{all:o}}];return{...r,references:{used:r.references.used,all:i}}})}addMappedReference(e){this.backendSendsMappedRefs=!0,this.addReference(e)}addOldReference(e){this.backendSendsMappedRefs||this.addReference(Gb(e))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}}var Ye;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{const i={};for(const a of o)i[a]=a;return i},t.getValidEnumValues=o=>{const i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(const s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(const a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ye||(Ye={}));var Ph;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Ph||(Ph={}));const me=Ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Hn=t=>{switch(typeof t){case"undefined":return me.undefined;case"string":return me.string;case"number":return Number.isNaN(t)?me.nan:me.number;case"boolean":return me.boolean;case"function":return me.function;case"bigint":return me.bigint;case"symbol":return me.symbol;case"object":return Array.isArray(t)?me.array:t===null?me.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?me.promise:typeof Map<"u"&&t instanceof Map?me.map:typeof Set<"u"&&t instanceof Set?me.set:typeof Date<"u"&&t instanceof Date?me.date:me.object;default:return me.unknown}},ie=Ye.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class xn extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){const l=a.path[c];c===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return o(this),n}static assert(e){if(!(e instanceof xn))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const o of this.issues)if(o.path.length>0){const i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}xn.create=t=>new xn(t);const Ll=(t,e)=>{let r;switch(t.code){case ie.invalid_type:t.received===me.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ye.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ye.joinValues(t.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ye.joinValues(t.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${Ye.joinValues(t.options)}, received '${t.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ye.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ie.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ie.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ye.assertNever(t)}return{message:r}};let Qb=Ll;function Xb(){return Qb}const Jb=t=>{const{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="";const c=n.filter(l=>!!l).slice().reverse();for(const l of c)s=l(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}};function ge(t,e){const r=Xb(),n=Jb({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ll?void 0:Ll].filter(o=>!!o)});t.common.issues.push(n)}class rr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const o of r){if(o.status==="aborted")return Ie;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const o of r){const i=await o.key,a=await o.value;n.push({key:i,value:a})}return rr.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const o of r){const{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return Ie;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}}const Ie=Object.freeze({status:"aborted"}),Ei=t=>({status:"dirty",value:t}),Nr=t=>({status:"valid",value:t}),Rh=t=>t.status==="aborted",Ih=t=>t.status==="dirty",No=t=>t.status==="valid",Fa=t=>typeof Promise<"u"&&t instanceof Promise;var ke;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ke||(ke={}));class on{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Nh=(t,e)=>{if(No(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new xn(t.common.issues);return this._error=r,this._error}}};function Fe(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{const{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}class Ve{get description(){return this._def.description}_getType(e){return Hn(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Hn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rr,ctx:{common:e.parent.common,data:e.data,parsedType:Hn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Fa(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hn(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Nh(n,o)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hn(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return No(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>No(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hn(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Fa(o)?o:Promise.resolve(o));return Nh(n,i)}refine(e,r){const n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{const a=e(o),s=()=>i.addIssue({code:ie.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new Fo({schema:this,typeName:Re.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Vn.create(this,this._def)}nullable(){return zo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return an.create(this)}promise(){return Ha.create(this,this._def)}or(e){return Ba.create([this,e],this._def)}and(e){return ja.create(this,e,this._def)}transform(e){return new Fo({...Fe(this._def),schema:this,typeName:Re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Bl({...Fe(this._def),innerType:this,defaultValue:r,typeName:Re.ZodDefault})}brand(){return new x0({typeName:Re.ZodBranded,type:this,...Fe(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new jl({...Fe(this._def),innerType:this,catchValue:r,typeName:Re.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ul.create(this,e)}readonly(){return Hl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const e0=/^c[^\s-]{8,}$/i,t0=/^[0-9a-z]+$/,r0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,n0=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,o0=/^[a-z0-9_-]{21}$/i,i0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,a0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,s0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,l0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Dl;const c0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,u0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,d0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,h0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,f0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,p0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Lh="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",g0=new RegExp(`^${Lh}$`);function Dh(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function v0(t){return new RegExp(`^${Dh(t)}$`)}function m0(t){let e=`${Lh}T${Dh(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function b0(t,e){return!!((e==="v4"||!e)&&c0.test(t)||(e==="v6"||!e)&&d0.test(t))}function y0(t,e){if(!i0.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function w0(t,e){return!!((e==="v4"||!e)&&u0.test(t)||(e==="v6"||!e)&&h0.test(t))}class kn extends Ve{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==me.string){const i=this._getOrReturnCtx(e);return ge(i,{code:ie.invalid_type,expected:me.string,received:i.parsedType}),Ie}const n=new rr;let o;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?ge(o,{code:ie.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ge(o,{code:ie.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")s0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"email",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Dl||(Dl=new RegExp(l0,"u")),Dl.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"emoji",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")n0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"uuid",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")o0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"nanoid",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")e0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"cuid",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")t0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"cuid2",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")r0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"ulid",code:ie.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),ge(o,{validation:"url",code:ie.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"regex",code:ie.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?m0(i).test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?g0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?v0(i).test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?a0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"duration",code:ie.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?b0(e.data,i.version)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"ip",code:ie.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?y0(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"jwt",code:ie.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?w0(e.data,i.version)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"cidr",code:ie.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?f0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"base64",code:ie.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?p0.test(e.data)||(o=this._getOrReturnCtx(e,o),ge(o,{validation:"base64url",code:ie.invalid_string,message:i.message}),n.dirty()):Ye.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:ie.invalid_string,...ke.errToObj(n)})}_addCheck(e){return new kn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ke.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ke.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ke.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ke.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ke.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ke.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ke.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ke.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ke.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ke.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ke.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ke.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ke.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ke.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ke.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ke.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ke.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ke.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ke.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ke.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ke.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ke.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ke.errToObj(r)})}nonempty(e){return this.min(1,ke.errToObj(e))}trim(){return new kn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new kn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new kn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}kn.create=t=>new kn({checks:[],typeName:Re.ZodString,coerce:t?.coerce??!1,...Fe(t)});function _0(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}class Lo extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==me.number){const i=this._getOrReturnCtx(e);return ge(i,{code:ie.invalid_type,expected:me.number,received:i.parsedType}),Ie}let n;const o=new rr;for(const i of this._def.checks)i.kind==="int"?Ye.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?_0(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.not_finite,message:i.message}),o.dirty()):Ye.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ke.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ke.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ke.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ke.toString(r))}setLimit(e,r,n,o){return new Lo({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ke.toString(o)}]})}_addCheck(e){return new Lo({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ke.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ke.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ke.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ke.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ke.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ke.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ye.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}Lo.create=t=>new Lo({checks:[],typeName:Re.ZodNumber,coerce:t?.coerce||!1,...Fe(t)});class Ai extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==me.bigint)return this._getInvalidInput(e);let n;const o=new rr;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),ge(n,{code:ie.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ye.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return ge(r,{code:ie.invalid_type,expected:me.bigint,received:r.parsedType}),Ie}gte(e,r){return this.setLimit("min",e,!0,ke.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ke.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ke.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ke.toString(r))}setLimit(e,r,n,o){return new Ai({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ke.toString(o)}]})}_addCheck(e){return new Ai({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ke.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ke.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Ai.create=t=>new Ai({checks:[],typeName:Re.ZodBigInt,coerce:t?.coerce??!1,...Fe(t)});class Ml extends Ve{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==me.boolean){const n=this._getOrReturnCtx(e);return ge(n,{code:ie.invalid_type,expected:me.boolean,received:n.parsedType}),Ie}return Nr(e.data)}}Ml.create=t=>new Ml({typeName:Re.ZodBoolean,coerce:t?.coerce||!1,...Fe(t)});class za extends Ve{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==me.date){const i=this._getOrReturnCtx(e);return ge(i,{code:ie.invalid_type,expected:me.date,received:i.parsedType}),Ie}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return ge(i,{code:ie.invalid_date}),Ie}const n=new rr;let o;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),ge(o,{code:ie.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ye.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new za({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ke.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ke.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}za.create=t=>new za({checks:[],coerce:t?.coerce||!1,typeName:Re.ZodDate,...Fe(t)});class Mh extends Ve{_parse(e){if(this._getType(e)!==me.symbol){const n=this._getOrReturnCtx(e);return ge(n,{code:ie.invalid_type,expected:me.symbol,received:n.parsedType}),Ie}return Nr(e.data)}}Mh.create=t=>new Mh({typeName:Re.ZodSymbol,...Fe(t)});class Fh extends Ve{_parse(e){if(this._getType(e)!==me.undefined){const n=this._getOrReturnCtx(e);return ge(n,{code:ie.invalid_type,expected:me.undefined,received:n.parsedType}),Ie}return Nr(e.data)}}Fh.create=t=>new Fh({typeName:Re.ZodUndefined,...Fe(t)});class zh extends Ve{_parse(e){if(this._getType(e)!==me.null){const n=this._getOrReturnCtx(e);return ge(n,{code:ie.invalid_type,expected:me.null,received:n.parsedType}),Ie}return Nr(e.data)}}zh.create=t=>new zh({typeName:Re.ZodNull,...Fe(t)});class Bh extends Ve{constructor(){super(...arguments),this._any=!0}_parse(e){return Nr(e.data)}}Bh.create=t=>new Bh({typeName:Re.ZodAny,...Fe(t)});class jh extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Nr(e.data)}}jh.create=t=>new jh({typeName:Re.ZodUnknown,...Fe(t)});class qn extends Ve{_parse(e){const r=this._getOrReturnCtx(e);return ge(r,{code:ie.invalid_type,expected:me.never,received:r.parsedType}),Ie}}qn.create=t=>new qn({typeName:Re.ZodNever,...Fe(t)});class Uh extends Ve{_parse(e){if(this._getType(e)!==me.undefined){const n=this._getOrReturnCtx(e);return ge(n,{code:ie.invalid_type,expected:me.void,received:n.parsedType}),Ie}return Nr(e.data)}}Uh.create=t=>new Uh({typeName:Re.ZodVoid,...Fe(t)});class an extends Ve{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==me.array)return ge(r,{code:ie.invalid_type,expected:me.array,received:r.parsedType}),Ie;if(o.exactLength!==null){const a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(ge(r,{code:a?ie.too_big:ie.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(ge(r,{code:ie.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(ge(r,{code:ie.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new on(r,a,r.path,s)))).then(a=>rr.mergeArray(n,a));const i=[...r.data].map((a,s)=>o.type._parseSync(new on(r,a,r.path,s)));return rr.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new an({...this._def,minLength:{value:e,message:ke.toString(r)}})}max(e,r){return new an({...this._def,maxLength:{value:e,message:ke.toString(r)}})}length(e,r){return new an({...this._def,exactLength:{value:e,message:ke.toString(r)}})}nonempty(e){return this.min(1,e)}}an.create=(t,e)=>new an({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Re.ZodArray,...Fe(e)});function Do(t){if(t instanceof Et){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=Vn.create(Do(n))}return new Et({...t._def,shape:()=>e})}else return t instanceof an?new an({...t._def,type:Do(t.element)}):t instanceof Vn?Vn.create(Do(t.unwrap())):t instanceof zo?zo.create(Do(t.unwrap())):t instanceof ho?ho.create(t.items.map(e=>Do(e))):t}class Et extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=Ye.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==me.object){const l=this._getOrReturnCtx(e);return ge(l,{code:ie.invalid_type,expected:me.object,received:l.parsedType}),Ie}const{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof qn&&this._def.unknownKeys==="strip"))for(const l in o.data)a.includes(l)||s.push(l);const c=[];for(const l of a){const d=i[l],h=o.data[l];c.push({key:{status:"valid",value:l},value:d._parse(new on(o,h,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof qn){const l=this._def.unknownKeys;if(l==="passthrough")for(const d of s)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(l==="strict")s.length>0&&(ge(o,{code:ie.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const d of s){const h=o.data[d];c.push({key:{status:"valid",value:d},value:l._parse(new on(o,h,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const l=[];for(const d of c){const h=await d.key,f=await d.value;l.push({key:h,value:f,alwaysSet:d.alwaysSet})}return l}).then(l=>rr.mergeObjectSync(n,l)):rr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return ke.errToObj,new Et({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ke.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new Et({...this._def,unknownKeys:"strip"})}passthrough(){return new Et({...this._def,unknownKeys:"passthrough"})}extend(e){return new Et({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Et({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Re.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Et({...this._def,catchall:e})}pick(e){const r={};for(const n of Ye.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Et({...this._def,shape:()=>r})}omit(e){const r={};for(const n of Ye.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new Et({...this._def,shape:()=>r})}deepPartial(){return Do(this)}partial(e){const r={};for(const n of Ye.objectKeys(this.shape)){const o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new Et({...this._def,shape:()=>r})}required(e){const r={};for(const n of Ye.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Vn;)i=i._def.innerType;r[n]=i}return new Et({...this._def,shape:()=>r})}keyof(){return Vh(Ye.objectKeys(this.shape))}}Et.create=(t,e)=>new Et({shape:()=>t,unknownKeys:"strip",catchall:qn.create(),typeName:Re.ZodObject,...Fe(e)}),Et.strictCreate=(t,e)=>new Et({shape:()=>t,unknownKeys:"strict",catchall:qn.create(),typeName:Re.ZodObject,...Fe(e)}),Et.lazycreate=(t,e)=>new Et({shape:t,unknownKeys:"strip",catchall:qn.create(),typeName:Re.ZodObject,...Fe(e)});class Ba extends Ve{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(const s of i)if(s.result.status==="valid")return s.result;for(const s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(s=>new xn(s.ctx.common.issues));return ge(r,{code:ie.invalid_union,unionErrors:a}),Ie}if(r.common.async)return Promise.all(n.map(async i=>{const a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i;const a=[];for(const c of n){const l={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const s=a.map(c=>new xn(c));return ge(r,{code:ie.invalid_union,unionErrors:s}),Ie}}get options(){return this._def.options}}Ba.create=(t,e)=>new Ba({options:t,typeName:Re.ZodUnion,...Fe(e)});function Fl(t,e){const r=Hn(t),n=Hn(e);if(t===e)return{valid:!0,data:t};if(r===me.object&&n===me.object){const o=Ye.objectKeys(e),i=Ye.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(const s of i){const c=Fl(t[s],e[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===me.array&&n===me.array){if(t.length!==e.length)return{valid:!1};const o=[];for(let i=0;i<t.length;i++){const a=t[i],s=e[i],c=Fl(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===me.date&&n===me.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class ja extends Ve{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(Rh(i)||Rh(a))return Ie;const s=Fl(i.value,a.value);return s.valid?((Ih(i)||Ih(a))&&r.dirty(),{status:r.value,value:s.data}):(ge(n,{code:ie.invalid_intersection_types}),Ie)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ja.create=(t,e,r)=>new ja({left:t,right:e,typeName:Re.ZodIntersection,...Fe(r)});class ho extends Ve{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==me.array)return ge(n,{code:ie.invalid_type,expected:me.array,received:n.parsedType}),Ie;if(n.data.length<this._def.items.length)return ge(n,{code:ie.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ie;!this._def.rest&&n.data.length>this._def.items.length&&(ge(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((a,s)=>{const c=this._def.items[s]||this._def.rest;return c?c._parse(new on(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>rr.mergeArray(r,a)):rr.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new ho({...this._def,rest:e})}}ho.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ho({items:t,typeName:Re.ZodTuple,rest:null,...Fe(e)})};class Ua extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==me.object)return ge(n,{code:ie.invalid_type,expected:me.object,received:n.parsedType}),Ie;const o=[],i=this._def.keyType,a=this._def.valueType;for(const s in n.data)o.push({key:i._parse(new on(n,s,n.path,s)),value:a._parse(new on(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?rr.mergeObjectAsync(r,o):rr.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ve?new Ua({keyType:e,valueType:r,typeName:Re.ZodRecord,...Fe(n)}):new Ua({keyType:kn.create(),valueType:e,typeName:Re.ZodRecord,...Fe(r)})}}class Hh extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==me.map)return ge(n,{code:ie.invalid_type,expected:me.map,received:n.parsedType}),Ie;const o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],l)=>({key:o._parse(new on(n,s,n.path,[l,"key"])),value:i._parse(new on(n,c,n.path,[l,"value"]))}));if(n.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const c of a){const l=await c.key,d=await c.value;if(l.status==="aborted"||d.status==="aborted")return Ie;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),s.set(l.value,d.value)}return{status:r.value,value:s}})}else{const s=new Map;for(const c of a){const l=c.key,d=c.value;if(l.status==="aborted"||d.status==="aborted")return Ie;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),s.set(l.value,d.value)}return{status:r.value,value:s}}}}Hh.create=(t,e,r)=>new Hh({valueType:e,keyType:t,typeName:Re.ZodMap,...Fe(r)});class Oi extends Ve{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==me.set)return ge(n,{code:ie.invalid_type,expected:me.set,received:n.parsedType}),Ie;const o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ge(n,{code:ie.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(ge(n,{code:ie.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());const i=this._def.valueType;function a(c){const l=new Set;for(const d of c){if(d.status==="aborted")return Ie;d.status==="dirty"&&r.dirty(),l.add(d.value)}return{status:r.value,value:l}}const s=[...n.data.values()].map((c,l)=>i._parse(new on(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(e,r){return new Oi({...this._def,minSize:{value:e,message:ke.toString(r)}})}max(e,r){return new Oi({...this._def,maxSize:{value:e,message:ke.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Oi.create=(t,e)=>new Oi({valueType:t,minSize:null,maxSize:null,typeName:Re.ZodSet,...Fe(e)});class qh extends Ve{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}qh.create=(t,e)=>new qh({getter:t,typeName:Re.ZodLazy,...Fe(e)});class zl extends Ve{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return ge(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),Ie}return{status:"valid",value:e.data}}get value(){return this._def.value}}zl.create=(t,e)=>new zl({value:t,typeName:Re.ZodLiteral,...Fe(e)});function Vh(t,e){return new Mo({values:t,typeName:Re.ZodEnum,...Fe(e)})}class Mo extends Ve{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return ge(r,{expected:Ye.joinValues(n),received:r.parsedType,code:ie.invalid_type}),Ie}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return ge(r,{received:r.data,code:ie.invalid_enum_value,options:n}),Ie}return Nr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Mo.create(e,{...this._def,...r})}exclude(e,r=this._def){return Mo.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Mo.create=Vh;class Wh extends Ve{_parse(e){const r=Ye.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==me.string&&n.parsedType!==me.number){const o=Ye.objectValues(r);return ge(n,{expected:Ye.joinValues(o),received:n.parsedType,code:ie.invalid_type}),Ie}if(this._cache||(this._cache=new Set(Ye.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const o=Ye.objectValues(r);return ge(n,{received:n.data,code:ie.invalid_enum_value,options:o}),Ie}return Nr(e.data)}get enum(){return this._def.values}}Wh.create=(t,e)=>new Wh({values:t,typeName:Re.ZodNativeEnum,...Fe(e)});class Ha extends Ve{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==me.promise&&r.common.async===!1)return ge(r,{code:ie.invalid_type,expected:me.promise,received:r.parsedType}),Ie;const n=r.parsedType===me.promise?r.data:Promise.resolve(r.data);return Nr(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Ha.create=(t,e)=>new Ha({type:t,typeName:Re.ZodPromise,...Fe(e)});class Fo extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{ge(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return Ie;const c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?Ie:c.status==="dirty"||r.value==="dirty"?Ei(c.value):c});{if(r.value==="aborted")return Ie;const s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Ie:s.status==="dirty"||r.value==="dirty"?Ei(s.value):s}}if(o.type==="refinement"){const a=s=>{const c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Ie:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Ie:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!No(a))return Ie;const s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>No(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):Ie);Ye.assertNever(o)}}Fo.create=(t,e,r)=>new Fo({schema:t,typeName:Re.ZodEffects,effect:e,...Fe(r)}),Fo.createWithPreprocess=(t,e,r)=>new Fo({schema:e,effect:{type:"preprocess",transform:t},typeName:Re.ZodEffects,...Fe(r)});class Vn extends Ve{_parse(e){return this._getType(e)===me.undefined?Nr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Vn.create=(t,e)=>new Vn({innerType:t,typeName:Re.ZodOptional,...Fe(e)});class zo extends Ve{_parse(e){return this._getType(e)===me.null?Nr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}zo.create=(t,e)=>new zo({innerType:t,typeName:Re.ZodNullable,...Fe(e)});class Bl extends Ve{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===me.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Bl.create=(t,e)=>new Bl({innerType:t,typeName:Re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Fe(e)});class jl extends Ve{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Fa(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new xn(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new xn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}jl.create=(t,e)=>new jl({innerType:t,typeName:Re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Fe(e)});class $h extends Ve{_parse(e){if(this._getType(e)!==me.nan){const n=this._getOrReturnCtx(e);return ge(n,{code:ie.invalid_type,expected:me.nan,received:n.parsedType}),Ie}return{status:"valid",value:e.data}}}$h.create=t=>new $h({typeName:Re.ZodNaN,...Fe(t)});class x0 extends Ve{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Ul extends Ve{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Ie:i.status==="dirty"?(r.dirty(),Ei(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Ie:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new Ul({in:e,out:r,typeName:Re.ZodPipeline})}}class Hl extends Ve{_parse(e){const r=this._def.innerType._parse(e),n=o=>(No(o)&&(o.value=Object.freeze(o.value)),o);return Fa(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}}Hl.create=(t,e)=>new Hl({innerType:t,typeName:Re.ZodReadonly,...Fe(e)});var Re;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Re||(Re={}));const D=kn.create,Lr=Lo.create,nr=Ml.create;qn.create;const Sr=an.create,Le=Et.create,Pi=Ba.create;ja.create,ho.create;const Sn=Ua.create,k0=zl.create,Bo=Mo.create;Ha.create,Vn.create,zo.create;var ql={inherit:"inherit",current:"currentcolor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(98.4% 0.003 247.858)",100:"oklch(96.8% 0.007 247.896)",200:"oklch(92.9% 0.013 255.508)",300:"oklch(86.9% 0.022 252.894)",400:"oklch(70.4% 0.04 256.788)",500:"oklch(55.4% 0.046 257.417)",600:"oklch(44.6% 0.043 257.281)",700:"oklch(37.2% 0.044 257.287)",800:"oklch(27.9% 0.041 260.031)",900:"oklch(20.8% 0.042 265.755)",950:"oklch(12.9% 0.042 264.695)"},gray:{50:"oklch(98.5% 0.002 247.839)",100:"oklch(96.7% 0.003 264.542)",200:"oklch(92.8% 0.006 264.531)",300:"oklch(87.2% 0.01 258.338)",400:"oklch(70.7% 0.022 261.325)",500:"oklch(55.1% 0.027 264.364)",600:"oklch(44.6% 0.03 256.802)",700:"oklch(37.3% 0.034 259.733)",800:"oklch(27.8% 0.033 256.848)",900:"oklch(21% 0.034 264.665)",950:"oklch(13% 0.028 261.692)"},zinc:{50:"oklch(98.5% 0 0)",100:"oklch(96.7% 0.001 286.375)",200:"oklch(92% 0.004 286.32)",300:"oklch(87.1% 0.006 286.286)",400:"oklch(70.5% 0.015 286.067)",500:"oklch(55.2% 0.016 285.938)",600:"oklch(44.2% 0.017 285.786)",700:"oklch(37% 0.013 285.805)",800:"oklch(27.4% 0.006 286.033)",900:"oklch(21% 0.006 285.885)",950:"oklch(14.1% 0.005 285.823)"},neutral:{50:"oklch(98.5% 0 0)",100:"oklch(97% 0 0)",200:"oklch(92.2% 0 0)",300:"oklch(87% 0 0)",400:"oklch(70.8% 0 0)",500:"oklch(55.6% 0 0)",600:"oklch(43.9% 0 0)",700:"oklch(37.1% 0 0)",800:"oklch(26.9% 0 0)",900:"oklch(20.5% 0 0)",950:"oklch(14.5% 0 0)"},stone:{50:"oklch(98.5% 0.001 106.423)",100:"oklch(97% 0.001 106.424)",200:"oklch(92.3% 0.003 48.717)",300:"oklch(86.9% 0.005 56.366)",400:"oklch(70.9% 0.01 56.259)",500:"oklch(55.3% 0.013 58.071)",600:"oklch(44.4% 0.011 73.639)",700:"oklch(37.4% 0.01 67.558)",800:"oklch(26.8% 0.007 34.298)",900:"oklch(21.6% 0.006 56.043)",950:"oklch(14.7% 0.004 49.25)"},red:{50:"oklch(97.1% 0.013 17.38)",100:"oklch(93.6% 0.032 17.717)",200:"oklch(88.5% 0.062 18.334)",300:"oklch(80.8% 0.114 19.571)",400:"oklch(70.4% 0.191 22.216)",500:"oklch(63.7% 0.237 25.331)",600:"oklch(57.7% 0.245 27.325)",700:"oklch(50.5% 0.213 27.518)",800:"oklch(44.4% 0.177 26.899)",900:"oklch(39.6% 0.141 25.723)",950:"oklch(25.8% 0.092 26.042)"},orange:{50:"oklch(98% 0.016 73.684)",100:"oklch(95.4% 0.038 75.164)",200:"oklch(90.1% 0.076 70.697)",300:"oklch(83.7% 0.128 66.29)",400:"oklch(75% 0.183 55.934)",500:"oklch(70.5% 0.213 47.604)",600:"oklch(64.6% 0.222 41.116)",700:"oklch(55.3% 0.195 38.402)",800:"oklch(47% 0.157 37.304)",900:"oklch(40.8% 0.123 38.172)",950:"oklch(26.6% 0.079 36.259)"},amber:{50:"oklch(98.7% 0.022 95.277)",100:"oklch(96.2% 0.059 95.617)",200:"oklch(92.4% 0.12 95.746)",300:"oklch(87.9% 0.169 91.605)",400:"oklch(82.8% 0.189 84.429)",500:"oklch(76.9% 0.188 70.08)",600:"oklch(66.6% 0.179 58.318)",700:"oklch(55.5% 0.163 48.998)",800:"oklch(47.3% 0.137 46.201)",900:"oklch(41.4% 0.112 45.904)",950:"oklch(27.9% 0.077 45.635)"},yellow:{50:"oklch(98.7% 0.026 102.212)",100:"oklch(97.3% 0.071 103.193)",200:"oklch(94.5% 0.129 101.54)",300:"oklch(90.5% 0.182 98.111)",400:"oklch(85.2% 0.199 91.936)",500:"oklch(79.5% 0.184 86.047)",600:"oklch(68.1% 0.162 75.834)",700:"oklch(55.4% 0.135 66.442)",800:"oklch(47.6% 0.114 61.907)",900:"oklch(42.1% 0.095 57.708)",950:"oklch(28.6% 0.066 53.813)"},lime:{50:"oklch(98.6% 0.031 120.757)",100:"oklch(96.7% 0.067 122.328)",200:"oklch(93.8% 0.127 124.321)",300:"oklch(89.7% 0.196 126.665)",400:"oklch(84.1% 0.238 128.85)",500:"oklch(76.8% 0.233 130.85)",600:"oklch(64.8% 0.2 131.684)",700:"oklch(53.2% 0.157 131.589)",800:"oklch(45.3% 0.124 130.933)",900:"oklch(40.5% 0.101 131.063)",950:"oklch(27.4% 0.072 132.109)"},green:{50:"oklch(98.2% 0.018 155.826)",100:"oklch(96.2% 0.044 156.743)",200:"oklch(92.5% 0.084 155.995)",300:"oklch(87.1% 0.15 154.449)",400:"oklch(79.2% 0.209 151.711)",500:"oklch(72.3% 0.219 149.579)",600:"oklch(62.7% 0.194 149.214)",700:"oklch(52.7% 0.154 150.069)",800:"oklch(44.8% 0.119 151.328)",900:"oklch(39.3% 0.095 152.535)",950:"oklch(26.6% 0.065 152.934)"},emerald:{50:"oklch(97.9% 0.021 166.113)",100:"oklch(95% 0.052 163.051)",200:"oklch(90.5% 0.093 164.15)",300:"oklch(84.5% 0.143 164.978)",400:"oklch(76.5% 0.177 163.223)",500:"oklch(69.6% 0.17 162.48)",600:"oklch(59.6% 0.145 163.225)",700:"oklch(50.8% 0.118 165.612)",800:"oklch(43.2% 0.095 166.913)",900:"oklch(37.8% 0.077 168.94)",950:"oklch(26.2% 0.051 172.552)"},teal:{50:"oklch(98.4% 0.014 180.72)",100:"oklch(95.3% 0.051 180.801)",200:"oklch(91% 0.096 180.426)",300:"oklch(85.5% 0.138 181.071)",400:"oklch(77.7% 0.152 181.912)",500:"oklch(70.4% 0.14 182.503)",600:"oklch(60% 0.118 184.704)",700:"oklch(51.1% 0.096 186.391)",800:"oklch(43.7% 0.078 188.216)",900:"oklch(38.6% 0.063 188.416)",950:"oklch(27.7% 0.046 192.524)"},cyan:{50:"oklch(98.4% 0.019 200.873)",100:"oklch(95.6% 0.045 203.388)",200:"oklch(91.7% 0.08 205.041)",300:"oklch(86.5% 0.127 207.078)",400:"oklch(78.9% 0.154 211.53)",500:"oklch(71.5% 0.143 215.221)",600:"oklch(60.9% 0.126 221.723)",700:"oklch(52% 0.105 223.128)",800:"oklch(45% 0.085 224.283)",900:"oklch(39.8% 0.07 227.392)",950:"oklch(30.2% 0.056 229.695)"},sky:{50:"oklch(97.7% 0.013 236.62)",100:"oklch(95.1% 0.026 236.824)",200:"oklch(90.1% 0.058 230.902)",300:"oklch(82.8% 0.111 230.318)",400:"oklch(74.6% 0.16 232.661)",500:"oklch(68.5% 0.169 237.323)",600:"oklch(58.8% 0.158 241.966)",700:"oklch(50% 0.134 242.749)",800:"oklch(44.3% 0.11 240.79)",900:"oklch(39.1% 0.09 240.876)",950:"oklch(29.3% 0.066 243.157)"},blue:{50:"oklch(97% 0.014 254.604)",100:"oklch(93.2% 0.032 255.585)",200:"oklch(88.2% 0.059 254.128)",300:"oklch(80.9% 0.105 251.813)",400:"oklch(70.7% 0.165 254.624)",500:"oklch(62.3% 0.214 259.815)",600:"oklch(54.6% 0.245 262.881)",700:"oklch(48.8% 0.243 264.376)",800:"oklch(42.4% 0.199 265.638)",900:"oklch(37.9% 0.146 265.522)",950:"oklch(28.2% 0.091 267.935)"},indigo:{50:"oklch(96.2% 0.018 272.314)",100:"oklch(93% 0.034 272.788)",200:"oklch(87% 0.065 274.039)",300:"oklch(78.5% 0.115 274.713)",400:"oklch(67.3% 0.182 276.935)",500:"oklch(58.5% 0.233 277.117)",600:"oklch(51.1% 0.262 276.966)",700:"oklch(45.7% 0.24 277.023)",800:"oklch(39.8% 0.195 277.366)",900:"oklch(35.9% 0.144 278.697)",950:"oklch(25.7% 0.09 281.288)"},violet:{50:"oklch(96.9% 0.016 293.756)",100:"oklch(94.3% 0.029 294.588)",200:"oklch(89.4% 0.057 293.283)",300:"oklch(81.1% 0.111 293.571)",400:"oklch(70.2% 0.183 293.541)",500:"oklch(60.6% 0.25 292.717)",600:"oklch(54.1% 0.281 293.009)",700:"oklch(49.1% 0.27 292.581)",800:"oklch(43.2% 0.232 292.759)",900:"oklch(38% 0.189 293.745)",950:"oklch(28.3% 0.141 291.089)"},purple:{50:"oklch(97.7% 0.014 308.299)",100:"oklch(94.6% 0.033 307.174)",200:"oklch(90.2% 0.063 306.703)",300:"oklch(82.7% 0.119 306.383)",400:"oklch(71.4% 0.203 305.504)",500:"oklch(62.7% 0.265 303.9)",600:"oklch(55.8% 0.288 302.321)",700:"oklch(49.6% 0.265 301.924)",800:"oklch(43.8% 0.218 303.724)",900:"oklch(38.1% 0.176 304.987)",950:"oklch(29.1% 0.149 302.717)"},fuchsia:{50:"oklch(97.7% 0.017 320.058)",100:"oklch(95.2% 0.037 318.852)",200:"oklch(90.3% 0.076 319.62)",300:"oklch(83.3% 0.145 321.434)",400:"oklch(74% 0.238 322.16)",500:"oklch(66.7% 0.295 322.15)",600:"oklch(59.1% 0.293 322.896)",700:"oklch(51.8% 0.253 323.949)",800:"oklch(45.2% 0.211 324.591)",900:"oklch(40.1% 0.17 325.612)",950:"oklch(29.3% 0.136 325.661)"},pink:{50:"oklch(97.1% 0.014 343.198)",100:"oklch(94.8% 0.028 342.258)",200:"oklch(89.9% 0.061 343.231)",300:"oklch(82.3% 0.12 346.018)",400:"oklch(71.8% 0.202 349.761)",500:"oklch(65.6% 0.241 354.308)",600:"oklch(59.2% 0.249 0.584)",700:"oklch(52.5% 0.223 3.958)",800:"oklch(45.9% 0.187 3.815)",900:"oklch(40.8% 0.153 2.432)",950:"oklch(28.4% 0.109 3.907)"},rose:{50:"oklch(96.9% 0.015 12.422)",100:"oklch(94.1% 0.03 12.58)",200:"oklch(89.2% 0.058 10.001)",300:"oklch(81% 0.117 11.638)",400:"oklch(71.2% 0.194 13.428)",500:"oklch(64.5% 0.246 16.439)",600:"oklch(58.6% 0.253 17.585)",700:"oklch(51.4% 0.222 16.935)",800:"oklch(45.5% 0.188 13.697)",900:"oklch(41% 0.159 10.272)",950:"oklch(27.1% 0.105 12.094)"}};const or=Le({minRem:Lr(),maxRem:Lr()}).or(D()),qa=Le({0:D().optional(),50:D(),100:D(),200:D(),300:D(),400:D(),500:D(),600:D(),700:D(),800:D(),900:D(),950:D(),1e3:D().optional()}),Vl=Le({color:D().optional(),background:D().optional(),borderWidth:D().optional(),borderColor:D().optional(),boxShadow:D().optional()}),S0=Le({borderRadius:or.optional(),custom:Sn(D(),Pi([D(),Lr()])).optional(),hover:Vl.optional(),focus:Vl.optional()}).and(Vl),C0=Le({family:D().optional()}),T0=Sn(Bo(["predefinedQuestion","edit","newConversation","voteUp","voteDown","retry","message","messageLoading","thread","submit","abort","expand","help","attach","record","reward","share","audio","copy","dismiss","menu","info","menuClose","chevronDown","chevronUp","chevronTopDown","internalLink","externalLink","liip","avatar","openChat","speechInput","listUnordered","lightMode","darkMode","avatarLarge"]),D()),E0=Le({font:C0.optional(),colors:Le({brand:qa,accent:qa.optional(),highlight:qa,grey:qa}),base:Le({fontSizeXs:or.optional(),fontSizeSm:or.optional(),fontSizeBody:or.optional(),fontSizeH3:or.optional(),fontSizeH2:or.optional(),fontSizeH1:or.optional(),fontWeightNormal:D().optional(),fontWeightBold:D().optional(),fontWeightTitle:D().optional(),lineHeightDefault:D().optional(),lineHeightSnug:D().optional(),lineHeightTight:D().optional(),borderRadius:or.optional(),lineColor:D().optional(),boxShadow:D().optional()}),components:Sn(D(),S0),svgs:T0}),Va=Le({customCSS:D().optional(),fontCSS:D().optional(),fontURLs:D().array().optional(),tokens:E0});Le({light:Va,dark:Va});const A0=Le({light:Va,dark:Va}).deepPartial(),Zh=Le({50:D(),100:D(),200:D(),300:D(),400:D(),500:D(),600:D(),700:D(),800:D(),900:D(),950:D()}),Kh=Bo(["slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]),Gh=Pi([Zh,Kh]),O0=Pi([Zh.and(Le({0:D(),1e3:D()})),Kh]),Yh=Le({avatarImageUrl:D().optional(),colors:Le({brand:Gh.optional(),highlight:Gh.optional(),grey:O0.optional(),background:D().optional(),text:D().optional(),anchor:Le({default:D().optional(),hover:D().optional()}).optional()}).optional(),font:Le({family:D().optional(),urls:Sr(D()).optional(),sizeXs:or.optional(),sizeSm:or.optional(),sizeBody:or.optional(),sizeH3:or.optional(),sizeH2:or.optional(),sizeH1:or.optional(),weightNormal:D().optional(),weightBold:D().optional(),weightTitle:D().optional()}).optional(),borderRadius:or.optional(),fineGrained:A0.optional()}),P0=Le({blocked:D(),maintenance:D(),"rate-limit":D(),"server-error":D(),"too-short":D(),"too-long":D(),"quota-reached":D(),aborted:D(),"sse-error":D(),"client-error":D(),"unexpected-call":D(),"incomplete-error":D(),"feedback-failed":D(),"speech-not-supported":D(),"speech-transcription-failed":D(),"speech-no-text-detected":D(),"speech-microphone-access-denied":D(),"pii-detected":D()}),R0=Le({email:D(),creditCard:D(),ahv:D(),phoneSwiss:D(),phoneInternational:D(),swissPassport:D(),longNumber:D()}),Qh=Le({predefinedQuestions:D(),introductionTitle:D(),introductionDisclaimer:D().optional(),chatInputPlaceholder:D(),chatInputPlaceholderListening:D().optional(),chatInputSubmit:D(),chatInputStartListening:D(),chatInputStopListening:D(),referenceLink:D(),referencesDisplay:D(),referencesHide:D(),referencesTitle:D(),referencesFurtherTitle:D(),newChat:D(),maintenanceModeError:D(),messageBotLoading:D(),messageBotError:D(),messageBotDefaultError:D(),noResultsFound:D(),chatFooterText:D().optional(),scrollToBottom:D(),openButtonTitle:D().optional(),openButtonDescription:D().optional(),openMenu:D(),openInfo:D(),aboutThisChat:D().optional(),closeMenu:D(),closeChat:D(),close:D(),send:D(),thankYouForFeedback:D(),giveFeedback:D(),sendFeedback:D(),feedbackFormTitle:D(),feedbackFormMessage:D(),feedbackFormMessagePlaceholder:D(),feedbackFormEmail:D(),feedbackFormEmailPlaceholder:D(),answerGood:D(),answerBad:D(),classificationSubmit:D(),classificationThankYou:D(),classificationTitle:D(),selectLanguage:D(),lightMode:D(),darkMode:D()}),jo=Bo(["en","de","fr","it"]),Xh=Sn(jo,Qh.partial());Sn(jo,P0),Sn(jo,R0);const Jh=Le({label:D(),options:Sr(Le({label:D(),value:Lr()}))}),I0=Le({label:D(),icon:D(),url:D(),target:Bo(["_blank","_self"]).optional()}),N0=Le({label:D().nullable(),question:D()}),ef=Le({impact:Jh.optional(),quality:Jh.optional()});Le({classification:ef.optional()});const L0=Le({predefinedQuestions:Sr(N0)}),tf=Pi([Le({maintenance:k0(!0)}),Le({id:D(),cID:D()})]);Sn(jo,Qh);const rf=Le({showPredefinedQuestions:nr(),showOverallFeedbackButton:nr(),showCloseChatButton:nr(),showContextMenu:nr(),showContextInfo:nr(),allowAudioInput:nr(),blockPII:nr(),questionPrefix:D(),menu:Sn(jo,Sr(I0)).optional(),supportedLanguages:Sr(jo),classification:ef.optional(),showTextFeedback:nr(),theme:Yh,translations:Xh,buttonHref:D().optional(),addQueryToUrlParams:nr().optional(),renderKatex:nr().optional(),reflectLanguageInPath:nr().optional(),sendReferrer:Bo(["all","own","none","location"]).optional()}).partial().and(Le({theme:Le({name:D().optional()}).optional()}));class D0{constructor(e){this.chatResponseData=e,this.id=this.chatResponseData.id}id;async isReadyForFeedback(){return await this.chatResponseData.readyForFeedback.toPromise(),!0}subscribe(e,r){return this.chatResponseData.readableStore.subscribe(e,r)}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)}}const Uo=new Map;class M0{get length(){return Uo.size}clear(){Uo.clear()}getItem(e){return Uo.get(e)||null}key(e){return Array.from(Uo.keys())[e]||null}removeItem(e){Uo.delete(e)}setItem(e,r){Uo.set(e,String(r))}}const nf=globalThis.localStorage??new M0,F0=async t=>{try{const e=nf.getItem("uID"),r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:e})},n=await t.fetchData("/login",tf,{},r).catch(o=>(console.log("Failed to /login use /log",o),t.fetchData("/log",tf,{},r)));if("maintenance"in n&&n.maintenance)return{mode:"maintenance"};if(!("id"in n))throw new Error("Invalid response format: missing user id");return nf.setItem("uID",n.id),{mode:"ready",userId:n.id}}catch(e){throw console.error("Failed to fetch user data:",e),e}};var Cr=function(t,e){if(!(this instanceof Cr))return new Cr(t,e);this.url=t,e=e||{},this.headers=e.headers||{},this.payload=e.payload!==void 0?e.payload:"",this.method=e.method||this.payload&&"POST"||"GET",this.withCredentials=!!e.withCredentials,this.debug=!!e.debug,this.autoReconnect=e.autoReconnect!==void 0?e.autoReconnect:!1,this.reconnectDelay=e.reconnectDelay!==void 0?e.reconnectDelay:3e3,this.maxRetries=e.maxRetries!==void 0?e.maxRetries:null,this.retryCount=0,this.reconnectTimer=null,this.useLastEventId=e.useLastEventId!==void 0?e.useLastEventId:!0,this.FIELD_SEPARATOR=":",this.listeners={},this.xhr=null,this.readyState=Cr.INITIALIZING,this.progress=0,this.chunk="",this.lastEventId="",this.addEventListener=function(r,n){this.listeners[r]===void 0&&(this.listeners[r]=[]),this.listeners[r].indexOf(n)===-1&&this.listeners[r].push(n)},this.removeEventListener=function(r,n){if(this.listeners[r]===void 0)return;const o=[];this.listeners[r].forEach(function(i){i!==n&&o.push(i)}),o.length===0?delete this.listeners[r]:this.listeners[r]=o},this.dispatchEvent=function(r){if(!r)return!0;this.debug&&console.debug(r),r.source=this;const n="on"+r.type;return this.hasOwnProperty(n)&&(this[n].call(this,r),r.defaultPrevented)?!1:this.listeners[r.type]?this.listeners[r.type].every(function(o){return o(r),!r.defaultPrevented}):!0},this._markClosed=function(){if(this.xhr=null,this.progress=0,this.chunk="",this._setReadyState(Cr.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(r){const n=new CustomEvent("readystatechange");n.readyState=r,this.readyState=r,this.dispatchEvent(n)},this._onStreamFailure=function(r){const n=new CustomEvent("error");n.responseCode=r.currentTarget.status,n.data=r.currentTarget.response,this.dispatchEvent(n),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent("abort")),this._markClosed()},this._onStreamProgress=function(r){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300){this._onStreamFailure(r);return}this.retryCount=0;const n=this.xhr.responseText.substring(this.progress);this.progress+=n.length;const o=(this.chunk+n).split(/(\r\n\r\n|\r\r|\n\n)/g),i=o.pop();o.forEach((function(a){a.trim().length>0&&this.dispatchEvent(this._parseEventChunk(a))}).bind(this)),this.chunk=i},this._onStreamLoaded=function(r){this._onStreamProgress(r),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk="",this._markClosed()},this._parseEventChunk=function(r){if(!r||r.length===0)return null;this.debug&&console.debug(r);const n={id:null,retry:null,data:null,event:null};if(r.split(/\n|\r\n|\r/).forEach((function(i){const a=i.indexOf(this.FIELD_SEPARATOR);let s,c;if(a>0){const l=i[a+1]===" "?2:1;s=i.substring(0,a),c=i.substring(a+l)}else if(a<0)s=i,c="";else return;s in n&&(s==="data"&&n[s]!==null?n.data+=`
|
|
59
59
|
`+c:n[s]=c)}).bind(this)),n.data===null)return null;n.id!==null&&(this.lastEventId=n.id);const o=new CustomEvent(n.event||"message");return o.id=n.id,o.data=n.data||"",o.lastEventId=this.lastEventId,o},this._onReadyStateChange=function(){if(this.xhr&&this.xhr.readyState===XMLHttpRequest.HEADERS_RECEIVED){const r={},n=this.xhr.getAllResponseHeaders().trim().split(`\r
|
|
60
60
|
`);for(const i of n){const[a,...s]=i.split(":"),c=s.join(":").trim();r[a.trim().toLowerCase()]=r[a.trim().toLowerCase()]||[],r[a.trim().toLowerCase()].push(c)}const o=new CustomEvent("open");o.responseCode=this.xhr.status,o.headers=r,this.dispatchEvent(o),this._setReadyState(Cr.OPEN)}},this.stream=function(){if(!this.xhr){this._setReadyState(Cr.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 r in this.headers)this.xhr.setRequestHeader(r,this.headers[r]);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.readyState!==Cr.CLOSED&&(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.autoReconnect=!1,this.xhr.abort())},(e.start===void 0||e.start)&&this.stream()};Cr.INITIALIZING=-1,Cr.CONNECTING=0,Cr.OPEN=1,Cr.CLOSED=2,typeof ii<"u"&&(ii.SSE=Cr);class z0{constructor(e,r,n){this.options=r,this.payload=n;const o={headers:{"content-type":"application/json"}};n&&(o.payload=JSON.stringify(n)),r.apiKey&&(o.headers["api-key"]=r.apiKey),this.eventSource=new(r.EventSource??Cr)(e,o),this.eventSource.onmessage=i=>{try{const a=JSON.parse(i.data);r.onMessage(a)}catch(a){r.onError(new CustomEvent("parse-error",{detail:a}))}},this.eventSource.onerror=i=>{r.onError(i),this.isClosed()&&this.close()}}eventSource;triggeredOnClose=!1;isClosed(){return this.eventSource.readyState===EventSource.CLOSED}close(){this.isClosed()||this.eventSource.close(),this.triggeredOnClose||(this.triggeredOnClose=!0,this.options.onClose())}}const of=t=>Object.fromEntries(Object.entries(t).filter(([e,r])=>r!=null));class B0{constructor(e){this.options=e}getDefaultHeaders(e={}){const r={"Content-Type":"application/json",...e};return this.options.apiKey&&(r["api-key"]=this.options.apiKey),r}get speechRecognitionApiKey(){return this.options.speechRecognitionApiKey}async subscribeSse(e,r={},n){const o=of(r);return this.options.apiKey&&(n.apiKey=this.options.apiKey),new z0(`${this.options.apiUrl}${e}`,n,o)}async fetchData(e,r,n={},o={}){const i=`${this.options.apiUrl}${e}?${new URLSearchParams(of(n)).toString()}`,a={...o,headers:this.getDefaultHeaders(o?.headers)},s=await fetch(i,a);if(!s.ok){const f=await s.text();throw new Error(`API request failed: ${s.status} - ${f}`)}const c=await s.json(),{success:l,data:d,error:h}=r.safeParse(c);if(this.options.strict){if(!l)throw console.error(`Server response has wrong type:
|
|
61
61
|
`,{error:h,url:i,opts:a,data:c}),new Error(`Server response has wrong type: ${h.message}`);return d}else return l||console.warn(`Server response has wrong type:
|
|
@@ -418,7 +418,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An err
|
|
|
418
418
|
.sonner-loading-bar {transition:none !important;
|
|
419
419
|
animation: none !important;}
|
|
420
420
|
}.sonner-loader {position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);transform-origin:center;transition:opacity 200ms,
|
|
421
|
-
transform 200ms;}.sonner-loader[data-visible='false'] {opacity:0;transform:scale(0.8) translate(-50%, -50%);}`};function _f(t,e){const r=gl(e,["children","$$slots","$$events","$$legacy","$$host"]),n=gl(r,["invert","theme","position","hotkey","containerAriaLabel","richColors","expand","duration","visibleToasts","closeButton","toastOptions","offset","dir"]);ce(e,!1),Oo(t,Iy);const[o,i]=Zd(),a=()=>mi(O,"$toasts",o),s=()=>mi(re,"$heights",o),c=$e(),l=$e(),d=3,h="32px",f=356,y=14,p="dark",v="light";function x(ae){return ae!=="system"?ae:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?p:v}function b(){if(typeof window>"u"||typeof document>"u")return"ltr";const ae=document.documentElement.getAttribute("dir");return ae==="auto"||!ae?window.getComputedStyle(document.documentElement).direction:ae}let w=m(e,"invert",12,!1),_=m(e,"theme",12,"light"),k=m(e,"position",12,"bottom-right"),T=m(e,"hotkey",28,()=>["altKey","KeyT"]),E=m(e,"containerAriaLabel",12,"Notifications"),C=m(e,"richColors",12,!1),L=m(e,"expand",12,!1),F=m(e,"duration",12,4e3),q=m(e,"visibleToasts",12,d),P=m(e,"closeButton",12,!1),B=m(e,"toastOptions",28,()=>({})),U=m(e,"offset",12,null),H=m(e,"dir",28,b);const{toasts:O,heights:re,reset:le}=Mr;let G=$e(!1),J=$e(!1),z=$e(x(_())),te=$e(),Z=null,W=!1;bm(()=>{u(te)&&Z&&(Z.focus({preventScroll:!0}),Z=null,W=!1)}),vi(()=>{le();const ae=Me=>{T().every(Be=>Me[Be]||Me.code===Be)&&(A(G,!0),u(te)?.focus()),Me.code==="Escape"&&(document.activeElement===u(te)||u(te)?.contains(document.activeElement))&&A(G,!1)};return document.addEventListener("keydown",ae),()=>{document.removeEventListener("keydown",ae)}});function Y(ae){W&&!ae.currentTarget.contains(ae.relatedTarget)&&(W=!1,Z&&(Z.focus({preventScroll:!0}),Z=null))}function ve(ae){W||(W=!0,Z=ae.relatedTarget)}dt(()=>(se(k()),a()),()=>{A(c,Array.from(new Set([k(),...a().filter(ae=>ae.position).map(ae=>ae.position)].filter(Boolean))))}),dt(()=>se(T()),()=>{A(l,T().join("+").replace(/Key/g,"").replace(/Digit/g,""))}),dt(()=>a(),()=>{a().length<=1&&A(G,!1)}),dt(()=>a(),()=>{const ae=a().filter(Me=>Me.dismiss&&!Me.delete);if(ae.length>0){const Me=a().map(Xe=>ae.find(We=>We.id===Xe.id)?{...Xe,delete:!0}:Xe);O.set(Me)}}),dt(()=>se(_()),()=>{if(_()!=="system"&&A(z,_()),typeof window<"u"){_()==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?A(z,p):A(z,v));const ae=window.matchMedia("(prefers-color-scheme: dark)"),Me=({matches:Xe})=>{A(z,Xe?p:v)};"addEventListener"in ae?ae.addEventListener("change",Me):ae.addListener(Me)}}),nd(),Sa();var Ee=K(),Ze=j(Ee);{var he=ae=>{var Me=Ry();xe(Me,"tabindex",-1),Ct(Me,5,()=>u(c),Ht,(Xe,Be,We,ft)=>{var ze=Py();Ge(ze,(Ke,mt,hr,Wt)=>({tabIndex:-1,class:(se(r),ye(()=>r.class)),"data-sonner-toaster":!0,"data-theme":u(z),"data-rich-colors":C(),dir:Ke,"data-y-position":mt,"data-x-position":hr,style:(se(r),ye(()=>r.style)),...n,[Po]:Wt}),[()=>(se(H()),ye(()=>H()==="auto"?b():H())),()=>(u(Be),ye(()=>u(Be).split("-")[0])),()=>(u(Be),ye(()=>u(Be).split("-")[1])),()=>({"--front-toast-height":(s(),ye(()=>`${s()[0]?.height}px`)),"--offset":typeof U()=="number"?`${U()}px`:U()||h,"--width":`${f}px`,"--gap":`${y}px`})],void 0,"svelte-1fo5d1m"),Ct(ze,7,()=>(a(),u(Be),ye(()=>a().filter(Ke=>!Ke.position&&We===0||Ke.position===u(Be)))),Ke=>Ke.id,(Ke,mt,hr,Wt)=>{{let An=Hr(()=>(se(B()),ye(()=>B()?.actionButtonStyle||""))),$t=Hr(()=>(se(B()),ye(()=>B()?.cancelButtonStyle||""))),Ar=Hr(()=>(se(B()),ye(()=>B()?.class||""))),fr=Hr(()=>(se(B()),ye(()=>B()?.descriptionClass||""))),Xr=Hr(()=>(se(B()),ye(()=>B().classes||{}))),pr=Hr(()=>(se(B()),se(F()),ye(()=>B()?.duration??F()))),On=Hr(()=>(se(B()),ye(()=>B().unstyled||!1)));wf(Ke,{get index(){return u(hr)},get toast(){return u(mt)},get invert(){return w()},get visibleToasts(){return q()},get closeButton(){return P()},get interacting(){return u(J)},get position(){return u(Be)},get expandByDefault(){return L()},get expanded(){return u(G)},get actionButtonStyle(){return u(An)},get cancelButtonStyle(){return u($t)},get class(){return u(Ar)},get descriptionClass(){return u(fr)},get classes(){return u(Xr)},get duration(){return u(pr)},get unstyled(){return u(On)},$$slots:{"loading-icon":(Zt,Pn)=>{var At=K(),je=j(At);Zr(je,e,"loading-icon",{},zt=>{{let Rn=Hr(()=>(u(mt),ye(()=>u(mt).type==="loading")));vf(zt,{get visible(){return u(Rn)}})}}),S(Zt,At)},"success-icon":(Zt,Pn)=>{var At=K(),je=j(At);Zr(je,e,"success-icon",{},zt=>{Ii(zt,{type:"success"})}),S(Zt,At)},"error-icon":(Zt,Pn)=>{var At=K(),je=j(At);Zr(je,e,"error-icon",{},zt=>{Ii(zt,{type:"error"})}),S(Zt,At)},"warning-icon":(Zt,Pn)=>{var At=K(),je=j(At);Zr(je,e,"warning-icon",{},zt=>{Ii(zt,{type:"warning"})}),S(Zt,At)},"info-icon":(Zt,Pn)=>{var At=K(),je=j(At);Zr(je,e,"info-icon",{},zt=>{Ii(zt,{type:"info"})}),S(Zt,At)}}})}}),I(ze),Lt(ze,Ke=>A(te,Ke),()=>u(te)),pe(()=>ze.dir=ze.dir),at("blur",ze,Y),at("focus",ze,ve),at("mouseenter",ze,()=>A(G,!0)),at("mousemove",ze,()=>A(G,!0)),at("mouseleave",ze,()=>{u(J)||A(G,!1)}),at("pointerdown",ze,()=>A(J,!0)),at("pointerup",ze,()=>A(J,!1)),S(Xe,ze)}),I(Me),pe(()=>xe(Me,"aria-label",`${E()} ${u(l)}`)),S(ae,Me)};X(Ze,ae=>{a(),ye(()=>a().length>0)&&ae(he)})}S(t,Ee);var Pe=ue({get invert(){return w()},set invert(ae){w(ae),g()},get theme(){return _()},set theme(ae){_(ae),g()},get position(){return k()},set position(ae){k(ae),g()},get hotkey(){return T()},set hotkey(ae){T(ae),g()},get containerAriaLabel(){return E()},set containerAriaLabel(ae){E(ae),g()},get richColors(){return C()},set richColors(ae){C(ae),g()},get expand(){return L()},set expand(ae){L(ae),g()},get duration(){return F()},set duration(ae){F(ae),g()},get visibleToasts(){return q()},set visibleToasts(ae){q(ae),g()},get closeButton(){return P()},set closeButton(ae){P(ae),g()},get toastOptions(){return B()},set toastOptions(ae){B(ae),g()},get offset(){return U()},set offset(ae){U(ae),g()},get dir(){return H()},set dir(ae){H(ae),g()}});return i(),Pe}de(_f,{invert:{},theme:{},position:{},hotkey:{},containerAriaLabel:{},richColors:{},expand:{},duration:{},visibleToasts:{},closeButton:{},toastOptions:{},offset:{},dir:{}},["loading-icon","success-icon","error-icon","warning-icon","info-icon"],[],!0);const Ny=console.warn,Ly=()=>{},ec=t=>{console.warn=Ly;const e=Iv(t);return console.warn=Ny,e},xf=Symbol("uninitialized"),Dy={[xf]:!0},My=t=>typeof t=="object"&&t!==null&&xf in t,Fy=t=>t&&Object.prototype.toString.call(t)==="[object Promise]",zy=t=>{let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);let r="#";for(let n=0;n<3;n++){let o=e>>n*8&255;o=Math.min(o,180),r+=o.toString(16).padStart(2,"0")}return r};function kf(t,e){const r={};for(const n of e){const o=Object.getOwnPropertyDescriptor(t,n)||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),n);try{(o?.get||typeof t[n]!="function")&&(r[n]=t[n])}catch(i){console.error(i)}}return r}const Ni=({start:t,args:e,prop:r,target:n,error:o,meta:i,allPropertyNames:a})=>{const s=t?"┏":"┗",c=o?console.error:console.log,l=o?console.group:console.groupCollapsed,d=String(r);l(`%c${s} ${d}`,`color: white; font-size: 0.9em; font-weight: 400; letter-spacing: 3px; background: ${zy(String(d))}; border-radius: 2px; padding: 1px 2px;`,...e),console.log("%cSTATE:","color: gray; font-size: 0.8em; letter-spacing: 3px;"),console.log(ec(kf(n,a))),i&&(console.log(`%c${i.label.toUpperCase()}:`,"color: gray; font-size: 0.8em; letter-spacing: 3px;"),c(i.data)),console.groupEnd()},By=t=>{const e=new Set;Object.getOwnPropertyNames(t).forEach(n=>e.add(n));let r=Object.getPrototypeOf(t);for(;r&&r!==Object.prototype;)Object.getOwnPropertyNames(r).forEach(n=>e.add(n)),r=Object.getPrototypeOf(r);return Array.from(e)},jy=Symbol("raw"),Sf=(t,e)=>{const r=By(t);let n=M(()=>ec(kf(t,r)));return new Proxy(t,{get(o,i,a){if(i===jy)return o;const s=Reflect.get(o,i);return typeof s=="function"?function(...c){let l;e.logging&&(l=ec(c),Ni({start:!0,args:l,target:o,prop:i,allPropertyNames:r}));let d;try{const h=e.enforceImmutableData?Sf(o,{...e,enforceImmutableData:!1}):a;d=s.apply(h,c)}catch(h){throw e.logging&&Ni({start:!1,args:l,target:o,allPropertyNames:r,prop:i,error:!0,meta:{label:"threw",data:h}}),h}return e.logging&&(Fy(d)?d.then(h=>{Ni({start:!1,args:l,target:o,allPropertyNames:r,prop:i,meta:{label:"resolved",data:h}})},h=>{Ni({start:!1,args:l,target:o,allPropertyNames:r,prop:i,error:!0,meta:{label:"rejected",data:h}})}):Ni({start:!1,args:l,target:o,allPropertyNames:r,prop:i,meta:{label:"returned",data:d}})),d}:(My(s)&&console.error(`Accessed "${String(i)}" before initializing it.`),e.enforceImmutableData?Reflect.get(u(n),i):s)},set(o,i,a){return e.enforceImmutableData?console.error(`Tried to set field "${String(i)}" from outside the ${e.className} class to:`,a):Reflect.set(o,i,a),!0}})},Uy=(t,e={})=>{const r=new t,n=t.name||"<unnamed class>",o={logging:!1,enforceImmutableData:!0,...e,className:n};return Sf(r,o)};async function Hy(){if(typeof navigator>"u"||!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return!1;try{return(await navigator.mediaDevices.enumerateDevices()).some(e=>e.kind==="audioinput")}catch(t){return console.error("Error checking for microphone:",t),!1}}function tc(){return typeof window>"u"||!window.MediaRecorder?null:MediaRecorder.isTypeSupported("audio/mp4")?"audio/mp4":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":MediaRecorder.isTypeSupported("audio/wav")?"audio/wav":null}function Cf(){return typeof window>"u"?!1:!!(window.MediaRecorder&&tc())}class rc{mediaRecorder=null;audioChunks=[];started=!1;starting=!1;stream=null;options;audioContext=null;analyser=null;dataArray=null;volumeUpdateInterval=null;constructor(e={}){this.options=e}async start(){if(this.started||this.starting){console.warn("AudioRecorder: Start already in progress or already started");return}if(!Cf()||!navigator.mediaDevices){const e=new Error("MediaRecorder not supported or no microphone access");throw this.options.onError?.(e),e}try{if(this.starting=!0,this.stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},video:!1}),!this.starting){this.stopStream(this.stream);return}this.mediaRecorder&&this.mediaRecorder.state!=="inactive"&&(console.warn("AudioRecorder: MediaRecorder already active, stopping previous recording"),this.mediaRecorder.stop(),this.cleanup()),this.started=!0,this.starting=!1;const e=tc();if(!e)throw new Error("No supported media type found");const r={mimeType:e};this.mediaRecorder=new MediaRecorder(this.stream,r),this.audioChunks=[],this.mediaRecorder.ondataavailable=n=>{n.data.size>0&&this.audioChunks.push(n.data)},this.mediaRecorder.onstop=async()=>{const n=this.audioChunks.length>0?new Blob(this.audioChunks,{type:e}):null;await this.options.onDataAvailable?.(n),this.options.onStop?.(),this.cleanup()},this.mediaRecorder.onerror=n=>{const o=new Error(`MediaRecorder error: ${n}`);this.options.onError?.(o),this.cleanup()},this.mediaRecorder.start(),this.setupVolumeAnalysis(this.stream),this.options.onStart?.()}catch(e){this.started=!1,this.starting=!1;const r=e instanceof Error?e:new Error(String(e));throw this.options.onError?.(r),r}}stop(){this.started=!1,this.starting=!1,this.volumeUpdateInterval&&(clearInterval(this.volumeUpdateInterval),this.volumeUpdateInterval=null),this.mediaRecorder&&this.mediaRecorder.state!=="inactive"?this.mediaRecorder.stop():(this.stream&&this.stopStream(this.stream),this.cleanup())}setupVolumeAnalysis(e){if(this.options.onVolumeChange)try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.8;const r=this.analyser.frequencyBinCount;this.dataArray=new Uint8Array(r),this.audioContext.createMediaStreamSource(e).connect(this.analyser),this.startVolumeMonitoring()}catch(r){console.warn("Failed to set up volume analysis:",r)}}startVolumeMonitoring(){!this.analyser||!this.dataArray||!this.options.onVolumeChange||(this.volumeUpdateInterval=window.setInterval(()=>{if(!this.analyser||!this.dataArray||!this.started)return;this.analyser.getByteFrequencyData(this.dataArray);let e=0;for(let i=0;i<this.dataArray.length;i++)e+=this.dataArray[i]*this.dataArray[i];let n=Math.sqrt(e/this.dataArray.length)/255;n=Math.pow(n*3,.7);const o=Math.min(100,Math.max(0,Math.round(n*100)));this.options.onVolumeChange?.(o)},100))}get recording(){return this.started&&this.mediaRecorder?.state==="recording"}get isStarting(){return this.starting}stopStream(e){e.getTracks().forEach(r=>r.stop())}cleanup(){this.volumeUpdateInterval&&(clearInterval(this.volumeUpdateInterval),this.volumeUpdateInterval=null),this.audioContext&&(this.audioContext.close().catch(console.warn),this.audioContext=null),this.analyser=null,this.dataArray=null,this.stream&&(this.stopStream(this.stream),this.stream=null),this.mediaRecorder=null,this.audioChunks=[],this.started=!1,this.starting=!1}static isSupported(){return Cf()}static getSupportedMediaType(){return tc()}}const qy=t=>(localStorage.setItem("liipgpt-color-scheme",t),nc(["light","dark"])),Tf=()=>{const t=localStorage.getItem("liipgpt-color-scheme");return t==="light"||t==="dark"?t:"system"},nc=t=>{let e=Tf();return e==="system"&&(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),t.includes(e)?e:t[0]??"light"},Vy=[{type:"email",check:t=>/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b/.test(t)},{type:"creditCard",check:t=>/\b(?:\d[ -]*?){13,16}\b/.test(t)},{type:"ahv",check:t=>/\b756\.\d{4}\.\d{4}\.\d{2}\b/.test(t)},{type:"phoneSwiss",check:t=>/\b0(?:\s*\d){2}(?:\s*\/\s*)?(?:\s*\d){7,}\b/.test(t)},{type:"phoneInternational",check:t=>/(?:\+|00)(?:\s*\d){10,}\b/.test(t)},{type:"swissPassport",check:t=>/\b[A-HJ-NP-Z](?=.*\d)[A-HJ-NP-Z0-9]{7}\b/.test(t)},{type:"longNumber",check:t=>/\b\d{9,}\b/.test(t)}],Ef=t=>{for(const e of Vy)if(e.check(t))return e.type};class Wy extends Error{constructor(e){super(e),this.name="UnreachableError"}}const $y=()=>{const e=new URLSearchParams(window.location.search).get("q");return e?{name:"chat-page",query:e}:{name:"start-page"}};class Zy{#e=ne(yr(Dy));get data(){return u(this.#e)}set data(e){A(this.#e,e,!0)}#t=ne(yr({}));get targets(){return u(this.#t)}set targets(e){A(this.#t,e,!0)}#r=ne(!1);get initialized(){return u(this.#r)}set initialized(e){A(this.#r,e,!0)}#n=ne(0);get currentAudioVolume(){return u(this.#n)}set currentAudioVolume(e){A(this.#n,e,!0)}client;props;#o=ne(null);get currentAudioRecorder(){return u(this.#o)}set currentAudioRecorder(e){A(this.#o,e,!0)}#i=ne(!1);get isTranscribing(){return u(this.#i)}set isTranscribing(e){A(this.#i,e,!0)}lastChatResponse;async init(e){this.props=e;const r=e.speechRecognitionApiKey||void 0;this.client=new Z0({apiUrl:e.apiUrl,apiKey:e.apiKey,speechRecognitionApiKey:r,strict:!0});try{const n=await this.client.getChatConfig();window.CHAT_CONFIG_OVERRIDE&&Object.assign(n,window.CHAT_CONFIG_OVERRIDE);const i=(await this.client.getMetadata()).mode==="maintenance";i&&this.showErrorToast("maintenance");const a=lf(n);let s;e.lang?s=$a(e.lang,a.supportedLanguages):s=pf(a.supportedLanguages);const c=await this.getPredefinedQuestions(s),l=[];if(a.renderKatex){const f=await import("https://esm.sh/marked-katex-extension@5.1.5").catch(y=>{console.error("Couldn't load marked-katex-extension:",y)});f&&(this.client.setMarkedExtensions(f.default({nonStandard:!0,output:"mathml"})),l.push("https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css"))}const d=Object.keys(a.fullTheme);this.data={currentConverstionState:"idle",chatConfig:a,language:s,predefinedQuestions:c,isInMaintenance:i,history:[],selectedColorScheme:Tf(),has2ColorSchemes:d.length===2,currentColorScheme:nc(d),feedbackOpenedId:void 0,feedbackOpenedConversation:!1,props:e,flyoutIsOpen:!1,questionHasPii:void 0,chatInputValue:"",currentReferencesAsideId:void 0,route:{name:"start-page"},additionalStylesheets:l},window.LIIPGPT_LISTENERS?.route?.(this.data.route),window.LIIPGPT_LISTENERS?.conversation?.(this.data.currentConverstionState),this.initialized=!0,this.goto($y())}catch(n){throw Jl.error(n instanceof Error?n.message:"Failed to load the chatbot. Please reload the page.",{duration:1e4,unstyled:!0,classes:{toast:"toast"}}),n}}setTarget(e,r){this.targets[e]=r}goto(e){if(!hy(this.data.route,e))switch(this.data.route=e,window.LIIPGPT_LISTENERS?.route?.(e),e.name){case"start-page":e.prefill&&(this.data.chatInputValue=e.prefill);break;case"chat-page":if(this.data.chatInputValue=e.query,this.onSubmit(),this.data.chatConfig.addQueryToUrlParams){const r=new URLSearchParams(window.location.search);r.set("q",e.query),history.pushState(null,"",`?${r.toString()}`)}break}}#a=M(()=>{if(!this.initialized)return[];const e=this.data.chatConfig.menu;return e?e[this.data.language]??[]:[]});get menu(){return u(this.#a)}set menu(e){A(this.#a,e)}#s=M(()=>this.initialized?this.data.chatConfig.translations[this.data.language]??{}:{});get t(){return u(this.#s)}set t(e){A(this.#s,e)}#c=M(()=>this.initialized?cf[this.data.language]??{}:cf.en??{});get errorTranslations(){return u(this.#c)}set errorTranslations(e){A(this.#c,e)}#l=M(()=>this.initialized?uf[this.data.language]??{}:uf.en??{});get piiTranslations(){return u(this.#l)}set piiTranslations(e){A(this.#l,e)}#u=M(()=>this.initialized?this.data.currentColorScheme:"light");get colorScheme(){return u(this.#u)}set colorScheme(e){A(this.#u,e)}#d=M(()=>this.initialized?this.data.chatConfig.fullTheme[this.data.currentColorScheme]:{});get themeBase(){return u(this.#d)}set themeBase(e){A(this.#d,e)}#h=M(()=>this.themeBase.tokens);get theme(){return u(this.#h)}set theme(e){A(this.#h,e)}async getPredefinedQuestions(e){try{return this.client.getPredefinedQuestions({url:window.location.href.replace(window.location.origin,""),language:e})}catch(r){return console.warn("Failed to load predefined questions:",r),[]}}setColorScheme(e){this.data.selectedColorScheme=e,this.data.currentColorScheme=qy(e)}async abort(){await this.lastChatResponse?.abort()}changeConversationState(e){this.data.currentConverstionState=e,window.LIIPGPT_LISTENERS?.conversation?.(e)}onInput(e){this.data.chatConfig.blockPII&&(this.data.questionHasPii=Ef(e)),this.data.chatInputValue=e}onSubmit(){if(this.data.questionHasPii){console.warn("Question contains PII, not submitting:",this.data.questionHasPii);return}const e=this.data.chatConfig.questionPrefix?`${this.data.chatConfig.questionPrefix} ${this.data.chatInputValue}`:this.data.chatInputValue,r=this.data.history.push({type:"user",time:new Date().toISOString(),message:this.data.chatInputValue});this.data.history.push({id:"UNRESOLVED",state:"loading",errors:[],type:"bot",time:new Date().toISOString(),message:{markdown:"",html:""},references:{all:[],used:[],unused:[]}});const n={features:this.props.features?this.props.features.trim().split(","):["formatting"],onError:s=>{this.showErrorToast(s),window.LIIPGPT_LISTENERS?.error?.(s),(s==="pii-detected"||s==="blocked")&&this.editLatestQuestion()},lang:this.data.language},o=this.data.chatConfig.sendReferrer??"all";(o==="all"||o==="own")&&(n.referrer=this.data.props.flyout?`${window.location.protocol}//${window.location.host}${window.location.pathname}`:document.referrer,(!n.referrer||!this.data.props.flyout&&o==="own"&&!n.referrer.startsWith(window.location.origin))&&(n.referrer=void 0)),this.data.currentConversationId||(this.data.currentConversationId=this.client.createConversationId());const i=this.client.chat(this.data.currentConversationId,e,n);this.lastChatResponse=i,this.data.lastChatResponseId=i.id,this.changeConversationState("searching");let a;i.subscribe(s=>{this.data.history[r]&&(this.data.history[r]={question:this.data.chatInputValue,...s}),s.state==="streaming"&&this.changeConversationState("answering"),s.state==="done"&&(this.changeConversationState("idle"),this.data.currentReferencesAsideId&&this.data.history[r].references.used.length>0?(clearTimeout(a),a=setTimeout(()=>{this.openReferencesAside(s.id)},100)):this.closeReferencesAside())}),this.data.chatInputValue=""}async onStartSpeechRecognition(){try{if(!await Hy()){this.showErrorToast("speech-not-supported");return}if(await navigator.mediaDevices.getUserMedia({audio:!0}),rc.isSupported())this.data.chatInputValue="",this.currentAudioRecorder=new rc({onDataAvailable:async r=>{this.isTranscribing=!0,await this.handleTranscription(r)},onError:()=>{this.showErrorToast("speech-microphone-access-denied"),this.currentAudioRecorder=null,this.isTranscribing=!1},onVolumeChange:r=>{this.currentAudioVolume=r}}),this.currentAudioRecorder.start();else{this.showErrorToast("speech-not-supported");return}}catch(e){throw this.showErrorToast("speech-microphone-access-denied"),this.currentAudioRecorder=null,this.isTranscribing=!1,e}}editLatestQuestion(){const e=this.data.history.findLastIndex(n=>n?.type==="user");if(e===-1){console.error("No last user question, available");return}const r=this.data.history.splice(e)[0];console.log(r),this.data.chatInputValue=r.message}onStopSpeechRecognition(){if(this.currentAudioRecorder){const e=this.currentAudioRecorder;this.currentAudioRecorder=null,e.stop()}this.currentAudioVolume=0}async handleTranscription(e){if(!e){console.warn("No audio data received");return}try{const r=await this.client.transcribeAudio(e,{lang:this.data.language});if(r.error){this.showErrorToast("speech-transcription-failed");return}if(r.transcript.trim()){if(this.data.chatConfig.blockPII&&(this.data.questionHasPii=Ef(r.transcript.trim()),this.data.questionHasPii))return;this.data.chatInputValue=r.transcript.trim()}else this.showErrorToast("speech-no-text-detected")}catch(r){console.error("Speech transcription error:",r),this.showErrorToast("speech-transcription-failed")}finally{this.currentAudioRecorder=null,this.isTranscribing=!1,this.currentAudioVolume=0}}async onStartConversation(e){await this.abort(),this.data.history=[],this.data.currentConversationId=this.client.createConversationId(),this.goto({name:"chat-page",query:e})}async onNewConversation(){await this.abort(),this.data.currentConversationId=void 0,this.data.currentReferencesAsideId=void 0,this.data.history=[],this.goto({name:"start-page"})}showSuccessToast(e){Jl.success(this.t[e],{unstyled:!0,duration:3e3,classes:{toast:"toast"}})}showErrorToast(e){Jl.error(this.errorTranslations[e],{unstyled:!0,duration:3e3,classes:{toast:"toast"}})}async submitFeedback(e){try{const r=this.data.feedbackOpenedId||this.data.lastChatResponseId;if(!r)throw new Wy("Tried to give feedback with no id.");const n=this.data.history.find(o=>o.type==="bot"&&o.id===r);await this.client.feedback(r,n?.question??"",e),this.showSuccessToast("thankYouForFeedback")}catch(r){console.error("Feedback failed:",r),this.showErrorToast("feedback-failed")}}toggleReferencesAside=e=>{this.data.currentReferencesAsideId=this.data.currentReferencesAsideId===e?void 0:e};openReferencesAside=e=>{this.data.currentReferencesAsideId=e};closeReferencesAside=()=>{this.data.currentReferencesAsideId=void 0};openFlyout(){this.data.flyoutIsOpen=!0}closeFlyout(){this.data.flyoutIsOpen=!1}openConverstionFeedback(){this.data.feedbackOpenedConversation=!0}openMessageFeedback(e){this.data.feedbackOpenedId=e}closeFeedback(){this.data.feedbackOpenedConversation=!1,this.data.feedbackOpenedId=void 0}async thumbs(e,r){try{const n=this.data.history.find(o=>o.type==="bot"&&o.id===e);r==="up"?await this.client.thumbsUp(e,n?.question??""):await this.client.thumbsDown(e,n?.question??""),this.showSuccessToast("thankYouForFeedback")}catch(n){console.error("Feedback failed:",n),this.showErrorToast("feedback-failed")}}async onLanguageChange(e){if(this.data.language=$a(e,this.data.chatConfig.supportedLanguages),cy(this.data.language),this.data.predefinedQuestions=await this.getPredefinedQuestions(this.data.language),this.data.chatConfig.reflectLanguageInPath){const r=new URL(window.location.href);r.pathname=`/${this.data.language}`,window.history.replaceState({},"",r.toString())}}}const ee=Uy(Zy),oc=(t,e)=>{const r=window.LIIPGPT_LISTENERS?.elements?.[e];if(!r)return;const n=Object.entries(r).filter(([o,i])=>typeof i=="function"&&!["init","destroy"].includes(o));De(()=>(r.init?.(t),n.forEach(([o,i])=>{t.addEventListener(o,i)}),()=>{n.forEach(([o,i])=>{t.addEventListener(o,i)}),r.destroy?.(t)}))},Li=(t,e)=>{e&&ee.setTarget(e,t)};var Ky=$('<div aria-hidden="true"><!></div>');function ct(t,e){ce(e,!0);let r=m(e,"name",7),n=m(e,"class",7);var o=Ky(),i=N(o);return Qt(i,()=>ee.theme.svgs[r()]),I(o),pe(()=>nt(o,1,`svg svg--${r()??""} ${n()??""}`)),S(t,o),ue({get name(){return r()},set name(a){r(a),g()},get class(){return n()},set class(a){n(a),g()}})}de(ct,{name:{},class:{}},[],[],!0);function Ho(t,e){let r=null,n;function o(){e.text&&(r||(r=document.createElement("span"),r.textContent=e.text,r.className=`tooltip tooltip-${e.position||"top"} tooltip-hidden`,t.appendChild(r),r.getBoundingClientRect()),r.classList.remove("tooltip-hidden"),i())}function i(){if(!r)return;const c=t.getBoundingClientRect(),l=r.getBoundingClientRect();let d,h;switch(e.position){case"bottom":d=c.height+5,h=c.width/2-l.width/2;break;case"bottom-right":d=c.height+5,h=c.width-l.width;break;case"bottom-left":d=c.height+5,h=0;break;case"left":d=c.height/2-l.height/2,h=-l.width-5;break;case"right":d=c.height/2-l.height/2,h=c.width+5;break;case"top":default:d=-l.height-5,h=c.width/2-l.width/2;break}r.style.top=`${d}px`,r.style.left=`${h}px`}function a(){n=window.setTimeout(()=>{o()},e.delay||200)}function s(){clearTimeout(n),r&&(r.classList.add("tooltip-hidden"),r.addEventListener("transitionend",()=>{r?.remove(),r=null},{once:!0}))}return t.classList.add("tooltip-container"),t.setAttribute("tabindex","0"),t.addEventListener("mouseenter",a),t.addEventListener("focus",a),t.addEventListener("mouseleave",s),t.addEventListener("blur",s),t.addEventListener("click",s),{update(c){e=c},destroy(){s(),t.classList.remove("tooltip-container"),t.removeEventListener("mouseenter",a),t.removeEventListener("focus",a),t.removeEventListener("mouseleave",s),t.removeEventListener("blur",s),t.removeEventListener("click",s)}}}const Af=t=>Array.from(t.querySelectorAll('a[href], button, input:not([type="hidden"]), textarea, select, details,[tabindex]:not([tabindex="-1"])')).filter(r=>!r.hasAttribute("disabled")&&!r.getAttribute("aria-hidden")),ic=t=>{const e=t.getRootNode();return"activeElement"in e?e.activeElement:document.activeElement};function Gy(t,e){const r=ic(t);let n=Af(t),o;const i=new MutationObserver(()=>{n=Af(t)}),a=s=>{n&&t.dataset.disabled!=="true"&&s.key==="Tab"&&(s.shiftKey?ic(t)===n[0]&&(s.preventDefault(),n[n.length-1].focus()):ic(t)===n[n.length-1]&&(s.preventDefault(),n[0].focus()))};return n&&n.length>0&&(o=n[0],requestAnimationFrame(()=>{o?.focus({preventScroll:!0})}),t.addEventListener("keydown",a),i.observe(t,{childList:!0,subtree:!0})),{destroy(){n&&n.length>0&&(n=null,o=null,t.removeEventListener("keydown",a),i.disconnect(),e?.resetFocusOnDestroy&&r&&requestAnimationFrame(()=>{r.focus({preventScroll:!0})}))}}}function Yy(t){return typeof t=="function"}function Di(t){return t!==null&&typeof t=="object"}const Qy=["string","number","bigint","boolean"];function ac(t){return t==null||Qy.includes(typeof t)?!0:Array.isArray(t)?t.every(e=>ac(e)):typeof t=="object"?Object.getPrototypeOf(t)===Object.prototype:!1}const Mi=Symbol("box"),sc=Symbol("is-writable");function Xy(t){return Di(t)&&Mi in t}function Jy(t){return V.isBox(t)&&sc in t}function V(t){let e=ne(yr(t));return{[Mi]:!0,[sc]:!0,get current(){return u(e)},set current(r){A(e,r,!0)}}}function ew(t,e){const r=M(t);return e?{[Mi]:!0,[sc]:!0,get current(){return u(r)},set current(n){e(n)}}:{[Mi]:!0,get current(){return t()}}}function tw(t){return V.isBox(t)?t:Yy(t)?V.with(t):V(t)}function rw(t){return Object.entries(t).reduce((e,[r,n])=>V.isBox(n)?(V.isWritableBox(n)?Object.defineProperty(e,r,{get(){return n.current},set(o){n.current=o}}):Object.defineProperty(e,r,{get(){return n.current}}),e):Object.assign(e,{[r]:n}),{})}function nw(t){return V.isWritableBox(t)?{[Mi]:!0,get current(){return t.current}}:t}V.from=tw,V.with=ew,V.flatten=rw,V.readonly=nw,V.isBox=Xy,V.isWritableBox=Jy;function Of(...t){return function(e){for(const r of t)if(r){if(e.defaultPrevented)return;typeof r=="function"?r.call(this,e):r.current?.call(this,e)}}}var qo={},lc,Pf;function ow(){if(Pf)return lc;Pf=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,c=`
|
|
421
|
+
transform 200ms;}.sonner-loader[data-visible='false'] {opacity:0;transform:scale(0.8) translate(-50%, -50%);}`};function _f(t,e){const r=gl(e,["children","$$slots","$$events","$$legacy","$$host"]),n=gl(r,["invert","theme","position","hotkey","containerAriaLabel","richColors","expand","duration","visibleToasts","closeButton","toastOptions","offset","dir"]);ce(e,!1),Oo(t,Iy);const[o,i]=Zd(),a=()=>mi(O,"$toasts",o),s=()=>mi(re,"$heights",o),c=$e(),l=$e(),d=3,h="32px",f=356,y=14,p="dark",v="light";function x(ae){return ae!=="system"?ae:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?p:v}function b(){if(typeof window>"u"||typeof document>"u")return"ltr";const ae=document.documentElement.getAttribute("dir");return ae==="auto"||!ae?window.getComputedStyle(document.documentElement).direction:ae}let w=m(e,"invert",12,!1),_=m(e,"theme",12,"light"),k=m(e,"position",12,"bottom-right"),T=m(e,"hotkey",28,()=>["altKey","KeyT"]),E=m(e,"containerAriaLabel",12,"Notifications"),C=m(e,"richColors",12,!1),L=m(e,"expand",12,!1),F=m(e,"duration",12,4e3),q=m(e,"visibleToasts",12,d),P=m(e,"closeButton",12,!1),B=m(e,"toastOptions",28,()=>({})),U=m(e,"offset",12,null),H=m(e,"dir",28,b);const{toasts:O,heights:re,reset:le}=Mr;let G=$e(!1),J=$e(!1),z=$e(x(_())),te=$e(),Z=null,W=!1;bm(()=>{u(te)&&Z&&(Z.focus({preventScroll:!0}),Z=null,W=!1)}),vi(()=>{le();const ae=Me=>{T().every(Be=>Me[Be]||Me.code===Be)&&(A(G,!0),u(te)?.focus()),Me.code==="Escape"&&(document.activeElement===u(te)||u(te)?.contains(document.activeElement))&&A(G,!1)};return document.addEventListener("keydown",ae),()=>{document.removeEventListener("keydown",ae)}});function Y(ae){W&&!ae.currentTarget.contains(ae.relatedTarget)&&(W=!1,Z&&(Z.focus({preventScroll:!0}),Z=null))}function ve(ae){W||(W=!0,Z=ae.relatedTarget)}dt(()=>(se(k()),a()),()=>{A(c,Array.from(new Set([k(),...a().filter(ae=>ae.position).map(ae=>ae.position)].filter(Boolean))))}),dt(()=>se(T()),()=>{A(l,T().join("+").replace(/Key/g,"").replace(/Digit/g,""))}),dt(()=>a(),()=>{a().length<=1&&A(G,!1)}),dt(()=>a(),()=>{const ae=a().filter(Me=>Me.dismiss&&!Me.delete);if(ae.length>0){const Me=a().map(Xe=>ae.find(We=>We.id===Xe.id)?{...Xe,delete:!0}:Xe);O.set(Me)}}),dt(()=>se(_()),()=>{if(_()!=="system"&&A(z,_()),typeof window<"u"){_()==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?A(z,p):A(z,v));const ae=window.matchMedia("(prefers-color-scheme: dark)"),Me=({matches:Xe})=>{A(z,Xe?p:v)};"addEventListener"in ae?ae.addEventListener("change",Me):ae.addListener(Me)}}),nd(),Sa();var Ee=K(),Ze=j(Ee);{var he=ae=>{var Me=Ry();xe(Me,"tabindex",-1),Ct(Me,5,()=>u(c),Ht,(Xe,Be,We,ft)=>{var ze=Py();Ge(ze,(Ke,mt,hr,Wt)=>({tabIndex:-1,class:(se(r),ye(()=>r.class)),"data-sonner-toaster":!0,"data-theme":u(z),"data-rich-colors":C(),dir:Ke,"data-y-position":mt,"data-x-position":hr,style:(se(r),ye(()=>r.style)),...n,[Po]:Wt}),[()=>(se(H()),ye(()=>H()==="auto"?b():H())),()=>(u(Be),ye(()=>u(Be).split("-")[0])),()=>(u(Be),ye(()=>u(Be).split("-")[1])),()=>({"--front-toast-height":(s(),ye(()=>`${s()[0]?.height}px`)),"--offset":typeof U()=="number"?`${U()}px`:U()||h,"--width":`${f}px`,"--gap":`${y}px`})],void 0,"svelte-1fo5d1m"),Ct(ze,7,()=>(a(),u(Be),ye(()=>a().filter(Ke=>!Ke.position&&We===0||Ke.position===u(Be)))),Ke=>Ke.id,(Ke,mt,hr,Wt)=>{{let An=Hr(()=>(se(B()),ye(()=>B()?.actionButtonStyle||""))),$t=Hr(()=>(se(B()),ye(()=>B()?.cancelButtonStyle||""))),Ar=Hr(()=>(se(B()),ye(()=>B()?.class||""))),fr=Hr(()=>(se(B()),ye(()=>B()?.descriptionClass||""))),Xr=Hr(()=>(se(B()),ye(()=>B().classes||{}))),pr=Hr(()=>(se(B()),se(F()),ye(()=>B()?.duration??F()))),On=Hr(()=>(se(B()),ye(()=>B().unstyled||!1)));wf(Ke,{get index(){return u(hr)},get toast(){return u(mt)},get invert(){return w()},get visibleToasts(){return q()},get closeButton(){return P()},get interacting(){return u(J)},get position(){return u(Be)},get expandByDefault(){return L()},get expanded(){return u(G)},get actionButtonStyle(){return u(An)},get cancelButtonStyle(){return u($t)},get class(){return u(Ar)},get descriptionClass(){return u(fr)},get classes(){return u(Xr)},get duration(){return u(pr)},get unstyled(){return u(On)},$$slots:{"loading-icon":(Zt,Pn)=>{var At=K(),je=j(At);Zr(je,e,"loading-icon",{},zt=>{{let Rn=Hr(()=>(u(mt),ye(()=>u(mt).type==="loading")));vf(zt,{get visible(){return u(Rn)}})}}),S(Zt,At)},"success-icon":(Zt,Pn)=>{var At=K(),je=j(At);Zr(je,e,"success-icon",{},zt=>{Ii(zt,{type:"success"})}),S(Zt,At)},"error-icon":(Zt,Pn)=>{var At=K(),je=j(At);Zr(je,e,"error-icon",{},zt=>{Ii(zt,{type:"error"})}),S(Zt,At)},"warning-icon":(Zt,Pn)=>{var At=K(),je=j(At);Zr(je,e,"warning-icon",{},zt=>{Ii(zt,{type:"warning"})}),S(Zt,At)},"info-icon":(Zt,Pn)=>{var At=K(),je=j(At);Zr(je,e,"info-icon",{},zt=>{Ii(zt,{type:"info"})}),S(Zt,At)}}})}}),I(ze),Lt(ze,Ke=>A(te,Ke),()=>u(te)),pe(()=>ze.dir=ze.dir),at("blur",ze,Y),at("focus",ze,ve),at("mouseenter",ze,()=>A(G,!0)),at("mousemove",ze,()=>A(G,!0)),at("mouseleave",ze,()=>{u(J)||A(G,!1)}),at("pointerdown",ze,()=>A(J,!0)),at("pointerup",ze,()=>A(J,!1)),S(Xe,ze)}),I(Me),pe(()=>xe(Me,"aria-label",`${E()} ${u(l)}`)),S(ae,Me)};X(Ze,ae=>{a(),ye(()=>a().length>0)&&ae(he)})}S(t,Ee);var Pe=ue({get invert(){return w()},set invert(ae){w(ae),g()},get theme(){return _()},set theme(ae){_(ae),g()},get position(){return k()},set position(ae){k(ae),g()},get hotkey(){return T()},set hotkey(ae){T(ae),g()},get containerAriaLabel(){return E()},set containerAriaLabel(ae){E(ae),g()},get richColors(){return C()},set richColors(ae){C(ae),g()},get expand(){return L()},set expand(ae){L(ae),g()},get duration(){return F()},set duration(ae){F(ae),g()},get visibleToasts(){return q()},set visibleToasts(ae){q(ae),g()},get closeButton(){return P()},set closeButton(ae){P(ae),g()},get toastOptions(){return B()},set toastOptions(ae){B(ae),g()},get offset(){return U()},set offset(ae){U(ae),g()},get dir(){return H()},set dir(ae){H(ae),g()}});return i(),Pe}de(_f,{invert:{},theme:{},position:{},hotkey:{},containerAriaLabel:{},richColors:{},expand:{},duration:{},visibleToasts:{},closeButton:{},toastOptions:{},offset:{},dir:{}},["loading-icon","success-icon","error-icon","warning-icon","info-icon"],[],!0);const Ny=console.warn,Ly=()=>{},ec=t=>{console.warn=Ly;const e=Iv(t);return console.warn=Ny,e},xf=Symbol("uninitialized"),Dy={[xf]:!0},My=t=>typeof t=="object"&&t!==null&&xf in t,Fy=t=>t&&Object.prototype.toString.call(t)==="[object Promise]",zy=t=>{let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);let r="#";for(let n=0;n<3;n++){let o=e>>n*8&255;o=Math.min(o,180),r+=o.toString(16).padStart(2,"0")}return r};function kf(t,e){const r={};for(const n of e){const o=Object.getOwnPropertyDescriptor(t,n)||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),n);try{(o?.get||typeof t[n]!="function")&&(r[n]=t[n])}catch(i){console.error(i)}}return r}const Ni=({start:t,args:e,prop:r,target:n,error:o,meta:i,allPropertyNames:a})=>{const s=t?"┏":"┗",c=o?console.error:console.log,l=o?console.group:console.groupCollapsed,d=String(r);l(`%c${s} ${d}`,`color: white; font-size: 0.9em; font-weight: 400; letter-spacing: 3px; background: ${zy(String(d))}; border-radius: 2px; padding: 1px 2px;`,...e),console.log("%cSTATE:","color: gray; font-size: 0.8em; letter-spacing: 3px;"),console.log(ec(kf(n,a))),i&&(console.log(`%c${i.label.toUpperCase()}:`,"color: gray; font-size: 0.8em; letter-spacing: 3px;"),c(i.data)),console.groupEnd()},By=t=>{const e=new Set;Object.getOwnPropertyNames(t).forEach(n=>e.add(n));let r=Object.getPrototypeOf(t);for(;r&&r!==Object.prototype;)Object.getOwnPropertyNames(r).forEach(n=>e.add(n)),r=Object.getPrototypeOf(r);return Array.from(e)},jy=Symbol("raw"),Sf=(t,e)=>{const r=By(t);let n=M(()=>ec(kf(t,r)));return new Proxy(t,{get(o,i,a){if(i===jy)return o;const s=Reflect.get(o,i);return typeof s=="function"?function(...c){let l;e.logging&&(l=ec(c),Ni({start:!0,args:l,target:o,prop:i,allPropertyNames:r}));let d;try{const h=e.enforceImmutableData?Sf(o,{...e,enforceImmutableData:!1}):a;d=s.apply(h,c)}catch(h){throw e.logging&&Ni({start:!1,args:l,target:o,allPropertyNames:r,prop:i,error:!0,meta:{label:"threw",data:h}}),h}return e.logging&&(Fy(d)?d.then(h=>{Ni({start:!1,args:l,target:o,allPropertyNames:r,prop:i,meta:{label:"resolved",data:h}})},h=>{Ni({start:!1,args:l,target:o,allPropertyNames:r,prop:i,error:!0,meta:{label:"rejected",data:h}})}):Ni({start:!1,args:l,target:o,allPropertyNames:r,prop:i,meta:{label:"returned",data:d}})),d}:(My(s)&&console.error(`Accessed "${String(i)}" before initializing it.`),e.enforceImmutableData?Reflect.get(u(n),i):s)},set(o,i,a){return e.enforceImmutableData?console.error(`Tried to set field "${String(i)}" from outside the ${e.className} class to:`,a):Reflect.set(o,i,a),!0}})},Uy=(t,e={})=>{const r=new t,n=t.name||"<unnamed class>",o={logging:!1,enforceImmutableData:!0,...e,className:n};return Sf(r,o)};async function Hy(){if(typeof navigator>"u"||!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return!1;try{return(await navigator.mediaDevices.enumerateDevices()).some(e=>e.kind==="audioinput")}catch(t){return console.error("Error checking for microphone:",t),!1}}function tc(){return typeof window>"u"||!window.MediaRecorder?null:MediaRecorder.isTypeSupported("audio/mp4")?"audio/mp4":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":MediaRecorder.isTypeSupported("audio/wav")?"audio/wav":null}function Cf(){return typeof window>"u"?!1:!!(window.MediaRecorder&&tc())}class rc{mediaRecorder=null;audioChunks=[];started=!1;starting=!1;stream=null;options;audioContext=null;analyser=null;dataArray=null;volumeUpdateInterval=null;constructor(e={}){this.options=e}async start(){if(this.started||this.starting){console.warn("AudioRecorder: Start already in progress or already started");return}if(!Cf()||!navigator.mediaDevices){const e=new Error("MediaRecorder not supported or no microphone access");throw this.options.onError?.(e),e}try{if(this.starting=!0,this.stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},video:!1}),!this.starting){this.stopStream(this.stream);return}this.mediaRecorder&&this.mediaRecorder.state!=="inactive"&&(console.warn("AudioRecorder: MediaRecorder already active, stopping previous recording"),this.mediaRecorder.stop(),this.cleanup()),this.started=!0,this.starting=!1;const e=tc();if(!e)throw new Error("No supported media type found");const r={mimeType:e};this.mediaRecorder=new MediaRecorder(this.stream,r),this.audioChunks=[],this.mediaRecorder.ondataavailable=n=>{n.data.size>0&&this.audioChunks.push(n.data)},this.mediaRecorder.onstop=async()=>{const n=this.audioChunks.length>0?new Blob(this.audioChunks,{type:e}):null;await this.options.onDataAvailable?.(n),this.options.onStop?.(),this.cleanup()},this.mediaRecorder.onerror=n=>{const o=new Error(`MediaRecorder error: ${n}`);this.options.onError?.(o),this.cleanup()},this.mediaRecorder.start(),this.setupVolumeAnalysis(this.stream),this.options.onStart?.()}catch(e){this.started=!1,this.starting=!1;const r=e instanceof Error?e:new Error(String(e));throw this.options.onError?.(r),r}}stop(){this.started=!1,this.starting=!1,this.volumeUpdateInterval&&(clearInterval(this.volumeUpdateInterval),this.volumeUpdateInterval=null),this.mediaRecorder&&this.mediaRecorder.state!=="inactive"?this.mediaRecorder.stop():(this.stream&&this.stopStream(this.stream),this.cleanup())}setupVolumeAnalysis(e){if(this.options.onVolumeChange)try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.8;const r=this.analyser.frequencyBinCount;this.dataArray=new Uint8Array(r),this.audioContext.createMediaStreamSource(e).connect(this.analyser),this.startVolumeMonitoring()}catch(r){console.warn("Failed to set up volume analysis:",r)}}startVolumeMonitoring(){!this.analyser||!this.dataArray||!this.options.onVolumeChange||(this.volumeUpdateInterval=window.setInterval(()=>{if(!this.analyser||!this.dataArray||!this.started)return;this.analyser.getByteFrequencyData(this.dataArray);let e=0;for(let i=0;i<this.dataArray.length;i++)e+=this.dataArray[i]*this.dataArray[i];let n=Math.sqrt(e/this.dataArray.length)/255;n=Math.pow(n*3,.7);const o=Math.min(100,Math.max(0,Math.round(n*100)));this.options.onVolumeChange?.(o)},100))}get recording(){return this.started&&this.mediaRecorder?.state==="recording"}get isStarting(){return this.starting}stopStream(e){e.getTracks().forEach(r=>r.stop())}cleanup(){this.volumeUpdateInterval&&(clearInterval(this.volumeUpdateInterval),this.volumeUpdateInterval=null),this.audioContext&&(this.audioContext.close().catch(console.warn),this.audioContext=null),this.analyser=null,this.dataArray=null,this.stream&&(this.stopStream(this.stream),this.stream=null),this.mediaRecorder=null,this.audioChunks=[],this.started=!1,this.starting=!1}static isSupported(){return Cf()}static getSupportedMediaType(){return tc()}}const qy=t=>(localStorage.setItem("liipgpt-color-scheme",t),nc(["light","dark"])),Tf=()=>{const t=localStorage.getItem("liipgpt-color-scheme");return t==="light"||t==="dark"?t:"system"},nc=t=>{let e=Tf();return e==="system"&&(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),t.includes(e)?e:t[0]??"light"},Vy=[{type:"email",check:t=>/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b/.test(t)},{type:"creditCard",check:t=>/\b(?:\d[ -]*?){13,16}\b/.test(t)},{type:"ahv",check:t=>/\b756\.\d{4}\.\d{4}\.\d{2}\b/.test(t)},{type:"phoneSwiss",check:t=>/\b0(?:\s*\d){2}(?:\s*\/\s*)?(?:\s*\d){7,}\b/.test(t)},{type:"phoneInternational",check:t=>/(?:\+|00)(?:\s*\d){10,}\b/.test(t)},{type:"swissPassport",check:t=>/\b[A-HJ-NP-Z](?=.*\d)[A-HJ-NP-Z0-9]{7}\b/.test(t)},{type:"longNumber",check:t=>/\b\d{9,}\b/.test(t)}],Ef=t=>{for(const e of Vy)if(e.check(t))return e.type};class Wy extends Error{constructor(e){super(e),this.name="UnreachableError"}}const $y=()=>{const e=new URLSearchParams(window.location.search).get("q");return e?{name:"chat-page",query:e}:{name:"start-page"}};class Zy{#e=ne(yr(Dy));get data(){return u(this.#e)}set data(e){A(this.#e,e,!0)}#t=ne(yr({}));get targets(){return u(this.#t)}set targets(e){A(this.#t,e,!0)}#r=ne(!1);get initialized(){return u(this.#r)}set initialized(e){A(this.#r,e,!0)}#n=ne(0);get currentAudioVolume(){return u(this.#n)}set currentAudioVolume(e){A(this.#n,e,!0)}client;props;#o=ne(null);get currentAudioRecorder(){return u(this.#o)}set currentAudioRecorder(e){A(this.#o,e,!0)}#i=ne(!1);get isTranscribing(){return u(this.#i)}set isTranscribing(e){A(this.#i,e,!0)}lastChatResponse;async init(e){this.props=e;const r=e.speechRecognitionApiKey||void 0;this.client=new Z0({apiUrl:e.apiUrl,apiKey:e.apiKey,speechRecognitionApiKey:r,strict:!0});try{const n=await this.client.getChatConfig();window.CHAT_CONFIG_OVERRIDE&&Object.assign(n,window.CHAT_CONFIG_OVERRIDE);const i=(await this.client.getMetadata()).mode==="maintenance";i&&this.showErrorToast("maintenance");const a=lf(n);let s;e.lang?s=$a(e.lang,a.supportedLanguages):s=pf(a.supportedLanguages);const c=await this.getPredefinedQuestions(s),l=[];if(a.renderKatex){const f=await import("https://esm.sh/marked-katex-extension@5.1.5").catch(y=>{console.error("Couldn't load marked-katex-extension:",y)});f&&(this.client.setMarkedExtensions(f.default({nonStandard:!0,output:"mathml"})),l.push("https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css"))}const d=Object.keys(a.fullTheme);this.data={currentConverstionState:"idle",chatConfig:a,language:s,predefinedQuestions:c,isInMaintenance:i,history:[],selectedColorScheme:Tf(),has2ColorSchemes:d.length===2,currentColorScheme:nc(d),feedbackOpenedId:void 0,feedbackOpenedConversation:!1,props:e,flyoutIsOpen:!1,questionHasPii:void 0,chatInputValue:"",currentReferencesAsideId:void 0,route:{name:"start-page"},additionalStylesheets:l},window.LIIPGPT_LISTENERS?.route?.(this.data.route),window.LIIPGPT_LISTENERS?.conversation?.(this.data.currentConverstionState),this.initialized=!0,this.goto($y())}catch(n){throw Jl.error(n instanceof Error?n.message:"Failed to load the chatbot. Please reload the page.",{duration:1e4,unstyled:!0,classes:{toast:"toast"}}),n}}setTarget(e,r){this.targets[e]=r}goto(e){if(!hy(this.data.route,e))switch(this.data.route=e,window.LIIPGPT_LISTENERS?.route?.(e),e.name){case"start-page":e.prefill&&(this.data.chatInputValue=e.prefill);break;case"chat-page":if(this.data.chatInputValue=e.query,this.onSubmit(),this.data.chatConfig.addQueryToUrlParams){const r=new URLSearchParams(window.location.search);r.set("q",e.query),history.pushState(null,"",`?${r.toString()}`)}break}}#a=M(()=>{if(!this.initialized)return[];const e=this.data.chatConfig.menu;return e?e[this.data.language]??[]:[]});get menu(){return u(this.#a)}set menu(e){A(this.#a,e)}#s=M(()=>this.initialized?this.data.chatConfig.translations[this.data.language]??{}:{});get t(){return u(this.#s)}set t(e){A(this.#s,e)}#c=M(()=>this.initialized?cf[this.data.language]??{}:cf.en??{});get errorTranslations(){return u(this.#c)}set errorTranslations(e){A(this.#c,e)}#l=M(()=>this.initialized?uf[this.data.language]??{}:uf.en??{});get piiTranslations(){return u(this.#l)}set piiTranslations(e){A(this.#l,e)}#u=M(()=>this.initialized?this.data.currentColorScheme:"light");get colorScheme(){return u(this.#u)}set colorScheme(e){A(this.#u,e)}#d=M(()=>this.initialized?this.data.chatConfig.fullTheme[this.data.currentColorScheme]:{});get themeBase(){return u(this.#d)}set themeBase(e){A(this.#d,e)}#h=M(()=>this.themeBase.tokens);get theme(){return u(this.#h)}set theme(e){A(this.#h,e)}async getPredefinedQuestions(e){try{return this.client.getPredefinedQuestions({url:window.location.href.replace(window.location.origin,""),language:e})}catch(r){return console.warn("Failed to load predefined questions:",r),[]}}setColorScheme(e){this.data.selectedColorScheme=e,this.data.currentColorScheme=qy(e)}async abort(){await this.lastChatResponse?.abort()}changeConversationState(e){this.data.currentConverstionState=e,window.LIIPGPT_LISTENERS?.conversation?.(e)}onInput(e){this.data.chatConfig.blockPII&&(this.data.questionHasPii=Ef(e)),this.data.chatInputValue=e}onSubmit(){if(this.data.questionHasPii){console.warn("Question contains PII, not submitting:",this.data.questionHasPii);return}const e=this.data.chatConfig.questionPrefix?`${this.data.chatConfig.questionPrefix} ${this.data.chatInputValue}`:this.data.chatInputValue,r=this.data.history.push({type:"user",time:new Date().toISOString(),message:this.data.chatInputValue});this.data.history.push({id:"UNRESOLVED",state:"loading",errors:[],type:"bot",time:new Date().toISOString(),message:{markdown:"",html:""},references:{all:[],used:[],unused:[]}});const n={features:this.props.features?this.props.features.trim().split(","):["formatting"],onError:s=>{this.showErrorToast(s),window.LIIPGPT_LISTENERS?.error?.(s),(s==="pii-detected"||s==="blocked")&&this.editLatestQuestion()},lang:this.data.language},o=this.data.chatConfig.sendReferrer??"all";(o==="all"||o==="own"||o==="location")&&(n.referrer=o==="location"||this.data.props.flyout?`${window.location.protocol}//${window.location.host}${window.location.pathname}`:document.referrer,(!n.referrer||!this.data.props.flyout&&o==="own"&&!n.referrer.startsWith(window.location.origin))&&(n.referrer=void 0)),this.data.currentConversationId||(this.data.currentConversationId=this.client.createConversationId());const i=this.client.chat(this.data.currentConversationId,e,n);this.lastChatResponse=i,this.data.lastChatResponseId=i.id,this.changeConversationState("searching");let a;i.subscribe(s=>{this.data.history[r]&&(this.data.history[r]={question:this.data.chatInputValue,...s}),s.state==="streaming"&&this.changeConversationState("answering"),s.state==="done"&&(this.changeConversationState("idle"),this.data.currentReferencesAsideId&&this.data.history[r].references.used.length>0?(clearTimeout(a),a=setTimeout(()=>{this.openReferencesAside(s.id)},100)):this.closeReferencesAside())}),this.data.chatInputValue=""}async onStartSpeechRecognition(){try{if(!await Hy()){this.showErrorToast("speech-not-supported");return}if(await navigator.mediaDevices.getUserMedia({audio:!0}),rc.isSupported())this.data.chatInputValue="",this.currentAudioRecorder=new rc({onDataAvailable:async r=>{this.isTranscribing=!0,await this.handleTranscription(r)},onError:()=>{this.showErrorToast("speech-microphone-access-denied"),this.currentAudioRecorder=null,this.isTranscribing=!1},onVolumeChange:r=>{this.currentAudioVolume=r}}),this.currentAudioRecorder.start();else{this.showErrorToast("speech-not-supported");return}}catch(e){throw this.showErrorToast("speech-microphone-access-denied"),this.currentAudioRecorder=null,this.isTranscribing=!1,e}}editLatestQuestion(){const e=this.data.history.findLastIndex(n=>n?.type==="user");if(e===-1){console.error("No last user question, available");return}const r=this.data.history.splice(e)[0];console.log(r),this.data.chatInputValue=r.message}onStopSpeechRecognition(){if(this.currentAudioRecorder){const e=this.currentAudioRecorder;this.currentAudioRecorder=null,e.stop()}this.currentAudioVolume=0}async handleTranscription(e){if(!e){console.warn("No audio data received");return}try{const r=await this.client.transcribeAudio(e,{lang:this.data.language});if(r.error){this.showErrorToast("speech-transcription-failed");return}if(r.transcript.trim()){if(this.data.chatConfig.blockPII&&(this.data.questionHasPii=Ef(r.transcript.trim()),this.data.questionHasPii))return;this.data.chatInputValue=r.transcript.trim()}else this.showErrorToast("speech-no-text-detected")}catch(r){console.error("Speech transcription error:",r),this.showErrorToast("speech-transcription-failed")}finally{this.currentAudioRecorder=null,this.isTranscribing=!1,this.currentAudioVolume=0}}async onStartConversation(e){await this.abort(),this.data.history=[],this.data.currentConversationId=this.client.createConversationId(),this.goto({name:"chat-page",query:e})}async onNewConversation(){await this.abort(),this.data.currentConversationId=void 0,this.data.currentReferencesAsideId=void 0,this.data.history=[],this.goto({name:"start-page"})}showSuccessToast(e){Jl.success(this.t[e],{unstyled:!0,duration:3e3,classes:{toast:"toast"}})}showErrorToast(e){Jl.error(this.errorTranslations[e],{unstyled:!0,duration:3e3,classes:{toast:"toast"}})}async submitFeedback(e){try{const r=this.data.feedbackOpenedId||this.data.lastChatResponseId;if(!r)throw new Wy("Tried to give feedback with no id.");const n=this.data.history.find(o=>o.type==="bot"&&o.id===r);await this.client.feedback(r,n?.question??"",e),this.showSuccessToast("thankYouForFeedback")}catch(r){console.error("Feedback failed:",r),this.showErrorToast("feedback-failed")}}toggleReferencesAside=e=>{this.data.currentReferencesAsideId=this.data.currentReferencesAsideId===e?void 0:e};openReferencesAside=e=>{this.data.currentReferencesAsideId=e};closeReferencesAside=()=>{this.data.currentReferencesAsideId=void 0};openFlyout(){this.data.flyoutIsOpen=!0}closeFlyout(){this.data.flyoutIsOpen=!1}openConverstionFeedback(){this.data.feedbackOpenedConversation=!0}openMessageFeedback(e){this.data.feedbackOpenedId=e}closeFeedback(){this.data.feedbackOpenedConversation=!1,this.data.feedbackOpenedId=void 0}async thumbs(e,r){try{const n=this.data.history.find(o=>o.type==="bot"&&o.id===e);r==="up"?await this.client.thumbsUp(e,n?.question??""):await this.client.thumbsDown(e,n?.question??""),this.showSuccessToast("thankYouForFeedback")}catch(n){console.error("Feedback failed:",n),this.showErrorToast("feedback-failed")}}async onLanguageChange(e){if(this.data.language=$a(e,this.data.chatConfig.supportedLanguages),cy(this.data.language),this.data.predefinedQuestions=await this.getPredefinedQuestions(this.data.language),this.data.chatConfig.reflectLanguageInPath){const r=new URL(window.location.href);r.pathname=`/${this.data.language}`,window.history.replaceState({},"",r.toString())}}}const ee=Uy(Zy),oc=(t,e)=>{const r=window.LIIPGPT_LISTENERS?.elements?.[e];if(!r)return;const n=Object.entries(r).filter(([o,i])=>typeof i=="function"&&!["init","destroy"].includes(o));De(()=>(r.init?.(t),n.forEach(([o,i])=>{t.addEventListener(o,i)}),()=>{n.forEach(([o,i])=>{t.addEventListener(o,i)}),r.destroy?.(t)}))},Li=(t,e)=>{e&&ee.setTarget(e,t)};var Ky=$('<div aria-hidden="true"><!></div>');function ct(t,e){ce(e,!0);let r=m(e,"name",7),n=m(e,"class",7);var o=Ky(),i=N(o);return Qt(i,()=>ee.theme.svgs[r()]),I(o),pe(()=>nt(o,1,`svg svg--${r()??""} ${n()??""}`)),S(t,o),ue({get name(){return r()},set name(a){r(a),g()},get class(){return n()},set class(a){n(a),g()}})}de(ct,{name:{},class:{}},[],[],!0);function Ho(t,e){let r=null,n;function o(){e.text&&(r||(r=document.createElement("span"),r.textContent=e.text,r.className=`tooltip tooltip-${e.position||"top"} tooltip-hidden`,t.appendChild(r),r.getBoundingClientRect()),r.classList.remove("tooltip-hidden"),i())}function i(){if(!r)return;const c=t.getBoundingClientRect(),l=r.getBoundingClientRect();let d,h;switch(e.position){case"bottom":d=c.height+5,h=c.width/2-l.width/2;break;case"bottom-right":d=c.height+5,h=c.width-l.width;break;case"bottom-left":d=c.height+5,h=0;break;case"left":d=c.height/2-l.height/2,h=-l.width-5;break;case"right":d=c.height/2-l.height/2,h=c.width+5;break;case"top":default:d=-l.height-5,h=c.width/2-l.width/2;break}r.style.top=`${d}px`,r.style.left=`${h}px`}function a(){n=window.setTimeout(()=>{o()},e.delay||200)}function s(){clearTimeout(n),r&&(r.classList.add("tooltip-hidden"),r.addEventListener("transitionend",()=>{r?.remove(),r=null},{once:!0}))}return t.classList.add("tooltip-container"),t.setAttribute("tabindex","0"),t.addEventListener("mouseenter",a),t.addEventListener("focus",a),t.addEventListener("mouseleave",s),t.addEventListener("blur",s),t.addEventListener("click",s),{update(c){e=c},destroy(){s(),t.classList.remove("tooltip-container"),t.removeEventListener("mouseenter",a),t.removeEventListener("focus",a),t.removeEventListener("mouseleave",s),t.removeEventListener("blur",s),t.removeEventListener("click",s)}}}const Af=t=>Array.from(t.querySelectorAll('a[href], button, input:not([type="hidden"]), textarea, select, details,[tabindex]:not([tabindex="-1"])')).filter(r=>!r.hasAttribute("disabled")&&!r.getAttribute("aria-hidden")),ic=t=>{const e=t.getRootNode();return"activeElement"in e?e.activeElement:document.activeElement};function Gy(t,e){const r=ic(t);let n=Af(t),o;const i=new MutationObserver(()=>{n=Af(t)}),a=s=>{n&&t.dataset.disabled!=="true"&&s.key==="Tab"&&(s.shiftKey?ic(t)===n[0]&&(s.preventDefault(),n[n.length-1].focus()):ic(t)===n[n.length-1]&&(s.preventDefault(),n[0].focus()))};return n&&n.length>0&&(o=n[0],requestAnimationFrame(()=>{o?.focus({preventScroll:!0})}),t.addEventListener("keydown",a),i.observe(t,{childList:!0,subtree:!0})),{destroy(){n&&n.length>0&&(n=null,o=null,t.removeEventListener("keydown",a),i.disconnect(),e?.resetFocusOnDestroy&&r&&requestAnimationFrame(()=>{r.focus({preventScroll:!0})}))}}}function Yy(t){return typeof t=="function"}function Di(t){return t!==null&&typeof t=="object"}const Qy=["string","number","bigint","boolean"];function ac(t){return t==null||Qy.includes(typeof t)?!0:Array.isArray(t)?t.every(e=>ac(e)):typeof t=="object"?Object.getPrototypeOf(t)===Object.prototype:!1}const Mi=Symbol("box"),sc=Symbol("is-writable");function Xy(t){return Di(t)&&Mi in t}function Jy(t){return V.isBox(t)&&sc in t}function V(t){let e=ne(yr(t));return{[Mi]:!0,[sc]:!0,get current(){return u(e)},set current(r){A(e,r,!0)}}}function ew(t,e){const r=M(t);return e?{[Mi]:!0,[sc]:!0,get current(){return u(r)},set current(n){e(n)}}:{[Mi]:!0,get current(){return t()}}}function tw(t){return V.isBox(t)?t:Yy(t)?V.with(t):V(t)}function rw(t){return Object.entries(t).reduce((e,[r,n])=>V.isBox(n)?(V.isWritableBox(n)?Object.defineProperty(e,r,{get(){return n.current},set(o){n.current=o}}):Object.defineProperty(e,r,{get(){return n.current}}),e):Object.assign(e,{[r]:n}),{})}function nw(t){return V.isWritableBox(t)?{[Mi]:!0,get current(){return t.current}}:t}V.from=tw,V.with=ew,V.flatten=rw,V.readonly=nw,V.isBox=Xy,V.isWritableBox=Jy;function Of(...t){return function(e){for(const r of t)if(r){if(e.defaultPrevented)return;typeof r=="function"?r.call(this,e):r.current?.call(this,e)}}}var qo={},lc,Pf;function ow(){if(Pf)return lc;Pf=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,c=`
|
|
422
422
|
`,l="/",d="*",h="",f="comment",y="declaration";lc=function(v,x){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];x=x||{};var b=1,w=1;function _(U){var H=U.match(e);H&&(b+=H.length);var O=U.lastIndexOf(c);w=~O?U.length-O:w+U.length}function k(){var U={line:b,column:w};return function(H){return H.position=new T(U),L(),H}}function T(U){this.start=U,this.end={line:b,column:w},this.source=x.source}T.prototype.content=v;function E(U){var H=new Error(x.source+":"+b+":"+w+": "+U);if(H.reason=U,H.filename=x.source,H.line=b,H.column=w,H.source=v,!x.silent)throw H}function C(U){var H=U.exec(v);if(H){var O=H[0];return _(O),v=v.slice(O.length),H}}function L(){C(r)}function F(U){var H;for(U=U||[];H=q();)H!==!1&&U.push(H);return U}function q(){var U=k();if(!(l!=v.charAt(0)||d!=v.charAt(1))){for(var H=2;h!=v.charAt(H)&&(d!=v.charAt(H)||l!=v.charAt(H+1));)++H;if(H+=2,h===v.charAt(H-1))return E("End of comment missing");var O=v.slice(2,H-2);return w+=2,_(O),v=v.slice(H),w+=2,U({type:f,comment:O})}}function P(){var U=k(),H=C(n);if(H){if(q(),!C(o))return E("property missing ':'");var O=C(i),re=U({type:y,property:p(H[0].replace(t,h)),value:O?p(O[0].replace(t,h)):h});return C(a),re}}function B(){var U=[];F(U);for(var H;H=P();)H!==!1&&(U.push(H),F(U));return U}return L(),B()};function p(v){return v?v.replace(s,h):h}return lc}var Rf;function iw(){if(Rf)return qo;Rf=1;var t=qo&&qo.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(qo,"__esModule",{value:!0}),qo.default=r;var e=t(ow());function r(n,o){var i=null;if(!n||typeof n!="string")return i;var a=(0,e.default)(n),s=typeof o=="function";return a.forEach(function(c){if(c.type==="declaration"){var l=c.property,d=c.value;s?o(l,d,c):d&&(i=i||{},i[l]=d)}}),i}return qo}var aw=iw();const If=Wl(aw),sw=If.default||If,lw=/\d/,cw=["-","_","/","."];function uw(t=""){if(!lw.test(t))return t!==t.toLowerCase()}function dw(t){const e=[];let r="",n,o;for(const i of t){const a=cw.includes(i);if(a===!0){e.push(r),r="",n=void 0;continue}const s=uw(i);if(o===!1){if(n===!1&&s===!0){e.push(r),r=i,n=s;continue}if(n===!0&&s===!1&&r.length>1){const c=r.at(-1);e.push(r.slice(0,Math.max(0,r.length-1))),r=c+i,n=s;continue}}r+=i,n=s,o=a}return e.push(r),e}function Nf(t){return t?dw(t).map(e=>fw(e)).join(""):""}function hw(t){return pw(Nf(t||""))}function fw(t){return t?t[0].toUpperCase()+t.slice(1):""}function pw(t){return t?t[0].toLowerCase()+t.slice(1):""}function Fi(t){if(!t)return{};const e={};function r(n,o){if(n.startsWith("-moz-")||n.startsWith("-webkit-")||n.startsWith("-ms-")||n.startsWith("-o-")){e[Nf(n)]=o;return}if(n.startsWith("--")){e[n]=o;return}e[hw(n)]=o}return sw(t,r),e}function Vo(...t){return(...e)=>{for(const r of t)typeof r=="function"&&r(...e)}}function gw(t,e){const r=RegExp(t,"g");return n=>{if(typeof n!="string")throw new TypeError(`expected an argument of type string, but got ${typeof n}`);return n.match(r)?n.replace(r,e):n}}const vw=gw(/[A-Z]/,t=>`-${t.toLowerCase()}`);function mw(t){if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError(`expected an argument of type object, but got ${typeof t}`);return Object.keys(t).map(e=>`${vw(e)}: ${t[e]};`).join(`
|
|
423
423
|
`)}function cc(t={}){return mw(t).replace(`
|
|
424
424
|
`," ")}const bw=cc({position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",transform:"translateX(-100%)"}),yw=["onabort","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onauxclick","onbeforeinput","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncompositionend","oncompositionstart","oncompositionupdate","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onfocusin","onfocusout","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectionchange","onselectstart","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onvolumechange","onwaiting","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel"],ww=new Set(yw);function _w(t){return ww.has(t)}function ht(...t){const e={...t[0]};for(let r=1;r<t.length;r++){const n=t[r];if(n){for(const o of Object.keys(n)){const i=e[o],a=n[o],s=typeof i=="function",c=typeof a=="function";if(s&&_w(o)){const l=i,d=a;e[o]=Of(l,d)}else if(s&&c)e[o]=Vo(i,a);else if(o==="class"){const l=ac(i),d=ac(a);l&&d?e[o]=xa(i,a):l?e[o]=xa(i):d&&(e[o]=xa(a))}else if(o==="style"){const l=typeof i=="object",d=typeof a=="object",h=typeof i=="string",f=typeof a=="string";if(l&&d)e[o]={...i,...a};else if(l&&f){const y=Fi(a);e[o]={...i,...y}}else if(h&&d){const y=Fi(i);e[o]={...y,...a}}else if(h&&f){const y=Fi(i),p=Fi(a);e[o]={...y,...p}}else l?e[o]=i:d?e[o]=a:h?e[o]=i:f&&(e[o]=a)}else e[o]=a!==void 0?a:i}for(const o of Object.getOwnPropertySymbols(n)){const i=e[o],a=n[o];e[o]=a!==void 0?a:i}}}return typeof e.style=="object"&&(e.style=cc(e.style).replaceAll(`
|