@liip/liipgpt 3.5.7 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -3
- package/button/liipgpt-button.iife.js +28 -28
- package/chat/liipgpt-chat.iife.js +18 -18
- package/config/index.cjs +17 -6
- package/config/index.d.ts +20 -1
- package/config/index.js +17 -6
- package/configurator/_app/env.js +1 -1
- package/configurator/_app/immutable/chunks/B2vNY6lx.js +143 -0
- package/configurator/_app/immutable/chunks/BGwzfQ_H.js +1 -0
- package/configurator/_app/immutable/chunks/BTwygYhA.js +1 -0
- package/configurator/_app/immutable/chunks/BmUm-Ak4.js +15 -0
- package/configurator/_app/immutable/chunks/{D6zVGLUW.js → BwV52vQs.js} +1 -1
- package/configurator/_app/immutable/chunks/C00ruT0L.js +3 -0
- package/configurator/_app/immutable/chunks/CFfgUb3G.js +16 -0
- package/configurator/_app/immutable/chunks/{B4H9KbzH.js → CKDKLu5Y.js} +1 -1
- package/configurator/_app/immutable/chunks/CX0dfddQ.js +1 -0
- package/configurator/_app/immutable/chunks/CibALFW0.js +1 -0
- package/configurator/_app/immutable/chunks/CnzkQxWo.js +1 -0
- package/configurator/_app/immutable/chunks/CqCdl07t.js +1 -0
- package/configurator/_app/immutable/chunks/CqPRQdP7.js +2 -0
- package/configurator/_app/immutable/chunks/Ct405RO9.js +1 -0
- package/configurator/_app/immutable/chunks/DFBUyDYh.js +29 -0
- package/configurator/_app/immutable/chunks/DUr69vGU.js +1 -0
- package/configurator/_app/immutable/chunks/DV91TmsB.js +293 -0
- package/configurator/_app/immutable/chunks/DVeOoWpz.js +1 -0
- package/configurator/_app/immutable/chunks/Db3xJ3R_.js +1 -0
- package/configurator/_app/immutable/chunks/EDJuo58-.js +61 -0
- package/configurator/_app/immutable/chunks/MRyhzcyW.js +39 -0
- package/configurator/_app/immutable/chunks/qE7I_Q4N.js +5 -0
- package/configurator/_app/immutable/chunks/tFLMI64R.js +1 -0
- package/configurator/_app/immutable/chunks/zUel1ZW0.js +70 -0
- package/configurator/_app/immutable/entry/app.BS_BNglT.js +2 -0
- package/configurator/_app/immutable/entry/start.B8ApCMix.js +1 -0
- package/configurator/_app/immutable/nodes/0.D_2XXaJQ.js +157 -0
- package/configurator/_app/immutable/nodes/1.BnWVDJCZ.js +1 -0
- package/configurator/_app/immutable/nodes/{2.C49eq5Js.js → 2.SUtdjb5A.js} +12 -11
- package/configurator/_app/immutable/nodes/3.Bo3t-YCM.js +952 -0
- package/configurator/_app/version.json +1 -1
- package/configurator/index.html +11 -10
- package/configurator/sidebar.html +11 -10
- package/index.cjs +17 -6
- package/index.d.ts +42 -3
- package/index.js +17 -6
- package/package.json +6 -1
- package/search-summary/liipgpt-search-summary.iife.js +421 -0
- package/configurator/_app/immutable/chunks/B7xCvPKw.js +0 -143
- package/configurator/_app/immutable/chunks/BdP-K7KO.js +0 -3
- package/configurator/_app/immutable/chunks/BsVnBobk.js +0 -1
- package/configurator/_app/immutable/chunks/CRn_Qu4-.js +0 -1
- package/configurator/_app/immutable/chunks/CZca1tVB.js +0 -89
- package/configurator/_app/immutable/chunks/CaZV0epm.js +0 -1
- package/configurator/_app/immutable/chunks/CabPM0Ap.js +0 -331
- package/configurator/_app/immutable/chunks/CgMo4dFz.js +0 -1
- package/configurator/_app/immutable/chunks/DUJlwB59.js +0 -15
- package/configurator/_app/immutable/chunks/di8DjX5b.js +0 -1
- package/configurator/_app/immutable/chunks/h2Kch-uX.js +0 -1
- package/configurator/_app/immutable/chunks/hTLSLo2s.js +0 -16
- package/configurator/_app/immutable/entry/app.Ce62vasD.js +0 -2
- package/configurator/_app/immutable/entry/start.CdYStGvR.js +0 -1
- package/configurator/_app/immutable/nodes/0.DJJ_NjgH.js +0 -156
- package/configurator/_app/immutable/nodes/1.BmbCK-Nv.js +0 -1
- package/configurator/_app/immutable/nodes/3.DQg0gEvm.js +0 -954
- /package/configurator/_app/immutable/chunks/{CNhGYG1q.js → Bo0U8J3e.js} +0 -0
- /package/configurator/_app/immutable/chunks/{D1hYfEew.js → CFKVnMbq.js} +0 -0
- /package/configurator/_app/immutable/chunks/{C8mohMXa.js → DjVmpym-.js} +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import{At as e,Ct as t,Et as n,H as r,It as i,J as a,Lt as o,Mt as s,O as c,Tt as l,at as u,bt as d,g as f,i as p,j as ee,jt as te,lt as ne,mt as re,o as ie,q as ae,rt as m,s as oe,wt as h}from"./C00ruT0L.js";import{c as se,f as g,i as ce,l as le,r as _}from"./MRyhzcyW.js";import{a as ue,l as de,o as fe,s as pe}from"./CX0dfddQ.js";var{entries:me,setPrototypeOf:he,isFrozen:ge,getPrototypeOf:_e,getOwnPropertyDescriptor:ve}=Object,{freeze:v,seal:y,create:ye}=Object,{apply:b,construct:be}=typeof Reflect<`u`&&Reflect;v||=function(e){return e},y||=function(e){return e},b||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},be||=function(e){return new e(...[...arguments].slice(1))};var xe=C(Array.prototype.forEach),Se=C(Array.prototype.lastIndexOf),Ce=C(Array.prototype.pop),we=C(Array.prototype.push),Te=C(Array.prototype.splice),Ee=C(String.prototype.toLowerCase),De=C(String.prototype.toString),Oe=C(String.prototype.match),ke=C(String.prototype.replace),Ae=C(String.prototype.indexOf),je=C(String.prototype.trim),x=C(Object.prototype.hasOwnProperty),S=C(RegExp.prototype.test),Me=Ne(TypeError);function C(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return b(e,t,n)}}function Ne(e){return function(){return be(e,[...arguments])}}function w(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ee;he&&he(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(ge(t)||(t[r]=e),i=e)}e[i]=!0}return e}function T(e){for(let t=0;t<e.length;t++)x(e,t)||(e[t]=null);return e}function E(e){let t=ye(null);for(let[n,r]of me(e))x(e,n)&&(Array.isArray(r)?t[n]=T(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=E(r):t[n]=r);return t}function Pe(e,t){for(;e!==null;){let n=ve(e,t);if(n){if(n.get)return C(n.get);if(typeof n.value==`function`)return C(n.value)}e=_e(e)}function n(){return null}return n}var Fe=v(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Ie=v(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Le=v([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Re=v([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),ze=v(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Be=v([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ve=v([`#text`]),He=v(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),Ue=v(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),We=v(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Ge=v([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Ke=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),qe=y(/<%[\w\W]*|[\w\W]*%>/gm),D=y(/\$\{[\w\W]*/gm),Je=y(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ye=y(/^aria-[\-\w]+$/),Xe=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ze=y(/^(?:\w+script|data):/i),Qe=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$e=y(/^html$/i),O=y(/^[a-z][.\w]*(-[.\w]+)+$/i),et=Object.freeze({__proto__:null,ARIA_ATTR:Ye,ATTR_WHITESPACE:Qe,CUSTOM_ELEMENT:O,DATA_ATTR:Je,DOCTYPE_NAME:$e,ERB_EXPR:qe,IS_ALLOWED_URI:Xe,IS_SCRIPT_OR_DATA:Ze,MUSTACHE_EXPR:Ke,TMPLIT_EXPR:D}),tt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},nt=function(){return typeof window>`u`?null:window},rt=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},it=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function at(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nt(),t=e=>at(e);if(t.version=`3.3.3`,t.removed=[],!e||!e.document||e.document.nodeType!==tt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,ee=c.prototype,te=Pe(ee,`cloneNode`),ne=Pe(ee,`remove`),re=Pe(ee,`nextSibling`),ie=Pe(ee,`childNodes`),ae=Pe(ee,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let m,oe=``,{implementation:h,createNodeIterator:se,createDocumentFragment:g,getElementsByTagName:ce}=n,{importNode:le}=r,_=it();t.isSupported=typeof me==`function`&&typeof ae==`function`&&h&&h.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ue,ERB_EXPR:de,TMPLIT_EXPR:fe,DATA_ATTR:pe,ARIA_ATTR:he,IS_SCRIPT_OR_DATA:ge,ATTR_WHITESPACE:_e,CUSTOM_ELEMENT:ve}=et,{IS_ALLOWED_URI:y}=et,b=null,be=w({},[...Fe,...Ie,...Le,...ze,...Ve]),C=null,Ne=w({},[...He,...Ue,...We,...Ge]),T=Object.seal(ye(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ke=null,qe=null,D=Object.seal(ye(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Je=!0,Ye=!0,Ze=!1,Qe=!0,O=!1,ot=!0,k=!1,A=!1,st=!1,j=!1,M=!1,N=!1,ct=!0,lt=!1,ut=!0,P=!1,F={},I=null,dt=w({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),ft=null,pt=w({},[`audio`,`video`,`img`,`source`,`image`,`track`]),mt=null,ht=w({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),L=`http://www.w3.org/1998/Math/MathML`,gt=`http://www.w3.org/2000/svg`,R=`http://www.w3.org/1999/xhtml`,z=R,_t=!1,vt=null,yt=w({},[L,gt,R],De),B=w({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),bt=w({},[`annotation-xml`]),xt=w({},[`title`,`style`,`font`,`a`,`script`]),St=null,Ct=[`application/xhtml+xml`,`text/html`],V=null,H=null,wt=n.createElement(`form`),Tt=function(e){return e instanceof RegExp||e instanceof Function},Et=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(H&&H===e)){if((!e||typeof e!=`object`)&&(e={}),e=E(e),St=Ct.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,V=St===`application/xhtml+xml`?De:Ee,b=x(e,`ALLOWED_TAGS`)?w({},e.ALLOWED_TAGS,V):be,C=x(e,`ALLOWED_ATTR`)?w({},e.ALLOWED_ATTR,V):Ne,vt=x(e,`ALLOWED_NAMESPACES`)?w({},e.ALLOWED_NAMESPACES,De):yt,mt=x(e,`ADD_URI_SAFE_ATTR`)?w(E(ht),e.ADD_URI_SAFE_ATTR,V):ht,ft=x(e,`ADD_DATA_URI_TAGS`)?w(E(pt),e.ADD_DATA_URI_TAGS,V):pt,I=x(e,`FORBID_CONTENTS`)?w({},e.FORBID_CONTENTS,V):dt,Ke=x(e,`FORBID_TAGS`)?w({},e.FORBID_TAGS,V):E({}),qe=x(e,`FORBID_ATTR`)?w({},e.FORBID_ATTR,V):E({}),F=x(e,`USE_PROFILES`)?e.USE_PROFILES:!1,Je=e.ALLOW_ARIA_ATTR!==!1,Ye=e.ALLOW_DATA_ATTR!==!1,Ze=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Qe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,O=e.SAFE_FOR_TEMPLATES||!1,ot=e.SAFE_FOR_XML!==!1,k=e.WHOLE_DOCUMENT||!1,j=e.RETURN_DOM||!1,M=e.RETURN_DOM_FRAGMENT||!1,N=e.RETURN_TRUSTED_TYPE||!1,st=e.FORCE_BODY||!1,ct=e.SANITIZE_DOM!==!1,lt=e.SANITIZE_NAMED_PROPS||!1,ut=e.KEEP_CONTENT!==!1,P=e.IN_PLACE||!1,y=e.ALLOWED_URI_REGEXP||Xe,z=e.NAMESPACE||R,B=e.MATHML_TEXT_INTEGRATION_POINTS||B,bt=e.HTML_INTEGRATION_POINTS||bt,T=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Tt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(T.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Tt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(T.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(T.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),O&&(Ye=!1),M&&(j=!0),F&&(b=w({},Ve),C=ye(null),F.html===!0&&(w(b,Fe),w(C,He)),F.svg===!0&&(w(b,Ie),w(C,Ue),w(C,Ge)),F.svgFilters===!0&&(w(b,Le),w(C,Ue),w(C,Ge)),F.mathMl===!0&&(w(b,ze),w(C,We),w(C,Ge))),x(e,`ADD_TAGS`)||(D.tagCheck=null),x(e,`ADD_ATTR`)||(D.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?D.tagCheck=e.ADD_TAGS:(b===be&&(b=E(b)),w(b,e.ADD_TAGS,V))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?D.attributeCheck=e.ADD_ATTR:(C===Ne&&(C=E(C)),w(C,e.ADD_ATTR,V))),e.ADD_URI_SAFE_ATTR&&w(mt,e.ADD_URI_SAFE_ATTR,V),e.FORBID_CONTENTS&&(I===dt&&(I=E(I)),w(I,e.FORBID_CONTENTS,V)),e.ADD_FORBID_CONTENTS&&(I===dt&&(I=E(I)),w(I,e.ADD_FORBID_CONTENTS,V)),ut&&(b[`#text`]=!0),k&&w(b,[`html`,`head`,`body`]),b.table&&(w(b,[`tbody`]),delete Ke.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Me(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Me(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);m=e.TRUSTED_TYPES_POLICY,oe=m.createHTML(``)}else m===void 0&&(m=rt(p,i)),m!==null&&typeof oe==`string`&&(oe=m.createHTML(``));v&&v(e),H=e}},Dt=w({},[...Ie,...Le,...Re]),Ot=w({},[...ze,...Be]),kt=function(e){let t=ae(e);(!t||!t.tagName)&&(t={namespaceURI:z,tagName:`template`});let n=Ee(e.tagName),r=Ee(t.tagName);return vt[e.namespaceURI]?e.namespaceURI===gt?t.namespaceURI===R?n===`svg`:t.namespaceURI===L?n===`svg`&&(r===`annotation-xml`||B[r]):!!Dt[n]:e.namespaceURI===L?t.namespaceURI===R?n===`math`:t.namespaceURI===gt?n===`math`&&bt[r]:!!Ot[n]:e.namespaceURI===R?t.namespaceURI===gt&&!bt[r]||t.namespaceURI===L&&!B[r]?!1:!Ot[n]&&(xt[n]||!Dt[n]):!!(St===`application/xhtml+xml`&&vt[e.namespaceURI]):!1},U=function(e){we(t.removed,{element:e});try{ae(e).removeChild(e)}catch{ne(e)}},W=function(e,n){try{we(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{we(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(j||M)try{U(n)}catch{}else try{n.setAttribute(e,``)}catch{}},At=function(e){let t=null,r=null;if(st)e=`<remove></remove>`+e;else{let t=Oe(e,/^[\r\n\t ]+/);r=t&&t[0]}St===`application/xhtml+xml`&&z===R&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=m?m.createHTML(e):e;if(z===R)try{t=new f().parseFromString(i,St)}catch{}if(!t||!t.documentElement){t=h.createDocument(z,`template`,null);try{t.documentElement.innerHTML=_t?oe:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),z===R?ce.call(t,k?`html`:`body`)[0]:k?t.documentElement:a},jt=function(e){return se.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Mt=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},Nt=function(e){return typeof s==`function`&&e instanceof s};function G(e,n,r){xe(e,e=>{e.call(t,n,r,H)})}let Pt=function(e){let n=null;if(G(_.beforeSanitizeElements,e,null),Mt(e))return U(e),!0;let r=V(e.nodeName);if(G(_.uponSanitizeElement,e,{tagName:r,allowedTags:b}),ot&&e.hasChildNodes()&&!Nt(e.firstElementChild)&&S(/<[/\w!]/g,e.innerHTML)&&S(/<[/\w!]/g,e.textContent)||e.nodeType===tt.progressingInstruction||ot&&e.nodeType===tt.comment&&S(/<[/\w]/g,e.data))return U(e),!0;if(!(D.tagCheck instanceof Function&&D.tagCheck(r))&&(!b[r]||Ke[r])){if(!Ke[r]&&It(r)&&(T.tagNameCheck instanceof RegExp&&S(T.tagNameCheck,r)||T.tagNameCheck instanceof Function&&T.tagNameCheck(r)))return!1;if(ut&&!I[r]){let t=ae(e)||e.parentNode,n=ie(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=te(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,re(e))}}}return U(e),!0}return e instanceof c&&!kt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&S(/<\/no(script|embed|frames)/i,e.innerHTML)?(U(e),!0):(O&&e.nodeType===tt.text&&(n=e.textContent,xe([ue,de,fe],e=>{n=ke(n,e,` `)}),e.textContent!==n&&(we(t.removed,{element:e.cloneNode()}),e.textContent=n)),G(_.afterSanitizeElements,e,null),!1)},Ft=function(e,t,r){if(qe[t]||ct&&(t===`id`||t===`name`)&&(r in n||r in wt))return!1;if(!(Ye&&!qe[t]&&S(pe,t))&&!(Je&&S(he,t))&&!(D.attributeCheck instanceof Function&&D.attributeCheck(t,e))){if(!C[t]||qe[t]){if(!(It(e)&&(T.tagNameCheck instanceof RegExp&&S(T.tagNameCheck,e)||T.tagNameCheck instanceof Function&&T.tagNameCheck(e))&&(T.attributeNameCheck instanceof RegExp&&S(T.attributeNameCheck,t)||T.attributeNameCheck instanceof Function&&T.attributeNameCheck(t,e))||t===`is`&&T.allowCustomizedBuiltInElements&&(T.tagNameCheck instanceof RegExp&&S(T.tagNameCheck,r)||T.tagNameCheck instanceof Function&&T.tagNameCheck(r))))return!1}else if(!mt[t]&&!S(y,ke(r,_e,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Ae(r,`data:`)===0&&ft[e])&&!(Ze&&!S(ge,ke(r,_e,``)))&&r)return!1}return!0},It=function(e){return e!==`annotation-xml`&&Oe(e,ve)},Lt=function(e){G(_.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||Mt(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:C,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=V(a),l=s,u=a===`value`?l:je(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,G(_.uponSanitizeAttribute,e,r),u=r.attrValue,lt&&(c===`id`||c===`name`)&&(W(a,e),u=`user-content-`+u),ot&&S(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){W(a,e);continue}if(c===`attributename`&&Oe(u,`href`)){W(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){W(a,e);continue}if(!Qe&&S(/\/>/i,u)){W(a,e);continue}O&&xe([ue,de,fe],e=>{u=ke(u,e,` `)});let d=V(e.nodeName);if(!Ft(d,c,u)){W(a,e);continue}if(m&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=m.createHTML(u);break;case`TrustedScriptURL`:u=m.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),Mt(e)?U(e):Ce(t.removed)}catch{W(a,e)}}G(_.afterSanitizeAttributes,e,null)},Rt=function e(t){let n=null,r=jt(t);for(G(_.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)G(_.uponSanitizeShadowNode,n,null),Pt(n),Lt(n),n.content instanceof a&&e(n.content);G(_.afterSanitizeShadowDOM,t,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(_t=!e,_t&&(e=`<!-->`),typeof e!=`string`&&!Nt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw Me(`dirty is not a string, aborting`)}else throw Me(`toString is not a function`);if(!t.isSupported)return e;if(A||Et(n),t.removed=[],typeof e==`string`&&(P=!1),P){if(e.nodeName){let t=V(e.nodeName);if(!b[t]||Ke[t])throw Me(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=At(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===tt.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!j&&!O&&!k&&e.indexOf(`<`)===-1)return m&&N?m.createHTML(e):e;if(i=At(e),!i)return j?null:N?oe:``}i&&st&&U(i.firstChild);let u=jt(P?e:i);for(;c=u.nextNode();)Pt(c),Lt(c),c.content instanceof a&&Rt(c.content);if(P)return e;if(j){if(M)for(l=g.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(C.shadowroot||C.shadowrootmode)&&(l=le.call(r,l,!0)),l}let d=k?i.outerHTML:i.innerHTML;return k&&b[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&S($e,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
2
|
+
`+d),O&&xe([ue,de,fe],e=>{d=ke(d,e,` `)}),m&&N?m.createHTML(d):d},t.setConfig=function(){Et(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),A=!0},t.clearConfig=function(){H=null,A=!1},t.isValidAttribute=function(e,t,n){return H||Et({}),Ft(V(e),V(t),n)},t.addHook=function(e,t){typeof t==`function`&&we(_[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=Se(_[e],t);return n===-1?void 0:Te(_[e],n,1)[0]}return Ce(_[e])},t.removeHooks=function(e){_[e]=[]},t.removeAllHooks=function(){_=it()},t}var ot=at();function k(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var A=k();function st(e){A=e}var j={exec:()=>null};function M(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(N.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var N={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},ct=/^(?:[ \t]*(?:\n|$))+/,lt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ut=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,P=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,F=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,I=/(?:[*+-]|\d{1,9}[.)])/,dt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ft=M(dt).replace(/bull/g,I).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),pt=M(dt).replace(/bull/g,I).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),mt=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ht=/^[^\n]+/,L=/(?!\s*\])(?:\\.|[^\[\]\\])+/,gt=M(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,L).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),R=M(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,I).getRegex(),z=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,_t=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,vt=M(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,_t).replace(`tag`,z).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),yt=M(mt).replace(`hr`,P).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,z).getRegex(),B={blockquote:M(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,yt).getRegex(),code:lt,def:gt,fences:ut,heading:F,hr:P,html:vt,lheading:ft,list:R,newline:ct,paragraph:yt,table:j,text:ht},bt=M(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,P).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,z).getRegex(),xt={...B,lheading:pt,table:bt,paragraph:M(mt).replace(`hr`,P).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,bt).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,z).getRegex()},St={...B,html:M(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,_t).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:j,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:M(mt).replace(`hr`,P).replace(`heading`,` *#{1,6} *[^
|
|
3
|
+
]`).replace(`lheading`,ft).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Ct=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,V=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,H=/^( {2,}|\\)\n(?!\s*$)/,wt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Tt=/[\p{P}\p{S}]/u,Et=/[\s\p{P}\p{S}]/u,Dt=/[^\s\p{P}\p{S}]/u,Ot=M(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Et).getRegex(),kt=/(?!~)[\p{P}\p{S}]/u,U=/(?!~)[\s\p{P}\p{S}]/u,W=/(?:[^\s\p{P}\p{S}]|~)/u,At=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,jt=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Mt=M(jt,`u`).replace(/punct/g,Tt).getRegex(),Nt=M(jt,`u`).replace(/punct/g,kt).getRegex(),G=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Pt=M(G,`gu`).replace(/notPunctSpace/g,Dt).replace(/punctSpace/g,Et).replace(/punct/g,Tt).getRegex(),Ft=M(G,`gu`).replace(/notPunctSpace/g,W).replace(/punctSpace/g,U).replace(/punct/g,kt).getRegex(),It=M(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Dt).replace(/punctSpace/g,Et).replace(/punct/g,Tt).getRegex(),Lt=M(/\\(punct)/,`gu`).replace(/punct/g,Tt).getRegex(),Rt=M(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),zt=M(_t).replace(`(?:-->|$)`,`-->`).getRegex(),Bt=M(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,zt).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Vt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ht=M(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,Vt).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ut=M(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Vt).replace(`ref`,L).getRegex(),Wt=M(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,L).getRegex(),Gt={_backpedal:j,anyPunctuation:Lt,autolink:Rt,blockSkip:At,br:H,code:V,del:j,emStrongLDelim:Mt,emStrongRDelimAst:Pt,emStrongRDelimUnd:It,escape:Ct,link:Ht,nolink:Wt,punctuation:Ot,reflink:Ut,reflinkSearch:M(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Ut).replace(`nolink`,Wt).getRegex(),tag:Bt,text:wt,url:j},Kt={...Gt,link:M(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Vt).getRegex(),reflink:M(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Vt).getRegex()},qt={...Gt,emStrongRDelimAst:Ft,emStrongLDelim:Nt,url:M(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,`i`).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Jt={...qt,br:M(H).replace(`{2,}`,`*`).getRegex(),text:M(qt.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Yt={normal:B,gfm:xt,pedantic:St},Xt={normal:Gt,gfm:qt,breaks:Jt,pedantic:Kt},Zt={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Qt=e=>Zt[e];function K(e,t){if(t){if(N.escapeTest.test(e))return e.replace(N.escapeReplace,Qt)}else if(N.escapeTestNoEncode.test(e))return e.replace(N.escapeReplaceNoEncode,Qt);return e}function $t(e){try{e=encodeURI(e).replace(N.percentDecode,`%`)}catch{return null}return e}function en(e,t){let n=e.replace(N.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(N.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(N.slashPipe,`|`);return n}function tn(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function nn(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function rn(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function an(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
4
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
5
|
+
`)}var on=class{options;rules;lexer;constructor(e){this.options=e||A}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:tn(e,`
|
|
6
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=an(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=tn(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:tn(t[0],`
|
|
7
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=tn(t[0],`
|
|
8
|
+
`).split(`
|
|
9
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
10
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
11
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
12
|
+
${s}`:s,r=r?`${r}
|
|
13
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
14
|
+
`+e.join(`
|
|
15
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
16
|
+
`+e.join(`
|
|
17
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
18
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
|
|
19
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
|
|
20
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
21
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
|
|
22
|
+
`,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
23
|
+
`+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
24
|
+
`+l}!u&&!l.trim()&&(u=!0),r+=f+`
|
|
25
|
+
`,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=en(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
26
|
+
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(en(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
27
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=tn(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=nn(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),rn(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return rn(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(r&&!(r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},q=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||A,this.options.tokenizer=this.options.tokenizer||new on,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:N,block:Yt.normal,inline:Xt.normal};this.options.pedantic?(t.block=Yt.pedantic,t.inline=Xt.pedantic):this.options.gfm&&(t.block=Yt.gfm,this.options.breaks?t.inline=Xt.breaks:t.inline=Xt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Yt,inline:Xt}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(N.carriageReturn,`
|
|
28
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(N.tabCharGlobal,` `).replace(N.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
29
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
|
|
30
|
+
`+r.raw,n.text+=`
|
|
31
|
+
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
|
|
32
|
+
`+r.raw,n.text+=`
|
|
33
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=`
|
|
34
|
+
`+r.raw,a.text+=`
|
|
35
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=`
|
|
36
|
+
`+r.raw,n.text+=`
|
|
37
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,a=``;for(;e;){i||(a=``),i=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,a)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(a=r.raw.slice(-1)),i=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},sn=class{options;parser;constructor(e){this.options=e||A}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(N.notSpaceStart)?.[0],i=e.replace(N.endingNewline,``)+`
|
|
38
|
+
`;return r?`<pre><code class="language-`+K(r)+`">`+(n?i:K(i,!0))+`</code></pre>
|
|
39
|
+
`:`<pre><code>`+(n?i:K(i,!0))+`</code></pre>
|
|
40
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
41
|
+
${this.parser.parse(e)}</blockquote>
|
|
42
|
+
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
43
|
+
`}hr(e){return`<hr>
|
|
44
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
45
|
+
`+r+`</`+i+`>
|
|
46
|
+
`}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+K(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:n+` `,text:n+` `,escaped:!0}):t+=n+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
47
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
48
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
49
|
+
<thead>
|
|
50
|
+
`+t+`</thead>
|
|
51
|
+
`+r+`</table>
|
|
52
|
+
`}tablerow({text:e}){return`<tr>
|
|
53
|
+
${e}</tr>
|
|
54
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
55
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${K(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=$t(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+K(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=$t(e);if(i===null)return K(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${K(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:K(e.text)}},cn=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},J=class e{options;renderer;textRenderer;constructor(e){this.options=e||A,this.options.renderer=this.options.renderer||new sn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new cn}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
|
|
56
|
+
`+this.renderer.text(i);t?n+=this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):n+=o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},ln=class{options;block;constructor(e){this.options=e||A}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?q.lex:q.lexInline}provideParser(){return this.block?J.parse:J.parseInline}},un=class{defaults=k();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=J;Renderer=sn;TextRenderer=cn;Lexer=q;Tokenizer=on;Hooks=ln;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new sn(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new on(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new ln;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];ln.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>a.call(t,e));let n=i.call(t,e);return a.call(t,n)}:t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return q.lex(e,t??this.defaults)}parser(e,t){return J.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(t==null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?q.lex:q.lexInline,s=i.hooks?i.hooks.provideParser():e?J.parse:J.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>o(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
57
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+K(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},Y=new un;function X(e,t){return Y.parse(e,t)}X.options=X.setOptions=function(e){return Y.setOptions(e),X.defaults=Y.defaults,st(X.defaults),X},X.getDefaults=k,X.defaults=A,X.use=function(...e){return Y.use(...e),X.defaults=Y.defaults,st(X.defaults),X},X.walkTokens=function(e,t){return Y.walkTokens(e,t)},X.parseInline=Y.parseInline,X.Parser=J,X.parser=J.parse,X.Renderer=sn,X.TextRenderer=cn,X.Lexer=q,X.lexer=q.lex,X.Tokenizer=on,X.Hooks=ln,X.parse=X,X.options,X.setOptions,X.use,X.walkTokens,X.parseInline,J.parse,q.lex;var dn=e=>(Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t];n&&typeof n==`object`&&dn(n)}),Object.freeze(e)),fn=dn({all:[],used:[],unused:[]}),pn=(e,t)=>{let n=ot(e);return n.addHook(`uponSanitizeElement`,function(e,t){let n=t.tagName||e.nodeName.toLowerCase();n.startsWith(`liipgpt-`)&&(t.allowedTags[n]=!0)}),n.addHook(`afterSanitizeAttributes`,function(e){if(e.tagName!==`A`||!e.getAttribute(`href`)?.startsWith(`http`)||(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`),!t||e.querySelector(`.sr-only`)))return;let n=e.ownerDocument.createElement(`span`);n.className=`sr-only`,n.textContent=` ${t}`,e.appendChild(n)}),n},mn=class{marked;currentReferences=fn;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new un({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=pn(e.window,e.newTabSrText)}createFootnoteExtension=()=>{let e=this;return{extensions:[{name:`footnote`,level:`inline`,start(e){return e.match(/\[\^(\d+)\]/)?.index},tokenizer(e){let t=/^\[\^(\d+)\]/.exec(e);if(t){let[e,n]=t;return{type:`footnote`,raw:e,refNumber:n}}},renderer(t){if(t.type===`footnote`){let n=parseInt(t.refNumber)-1,r=e.currentReferences.all[n];if(!r)return console.error(`Could not find ref with index:`,n),``;let i;return r?.referenceIndex.used?i=r.referenceIndex.used:(e.currentReferences.used.push(r),e.lastUsedIndex++,i=e.lastUsedIndex,r.referenceIndex.used=i),` <liipgpt-reference-number data-all-index="${n}" data-used-index="${i}" data-source="${JSON.stringify(r).replace(/"/g,`"`)}"></liipgpt-reference-number>`}}}]}};parse(e){return this.DomPurity.sanitize(this.marked.parse(e),{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0,mathMl:!0},FORBID_TAGS:[`hr`],ADD_ATTR:[`target`]})}toHTML(e,t){this.currentReferences=t;let n=this.parse(e);return this.currentReferences=fn,n}};function hn(){let e,t;return{promise:new Promise((n,r)=>{t=n,e=r}),reject:e,resolve:t}}var gn=class{promise;resolve;reject;constructor(){let{promise:e,resolve:t,reject:n}=hn();this.promise=e,this.resolve=t,this.reject=n}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}toPromise(){return this.promise}[Symbol.toStringTag]=`Flag`},_n=class{hasValue=new gn;currentValue;setValue(e){this.currentValue=e,this.hasValue.resolve()}cleanup(e){this.hasValue.reject(e)}getCurrentValue(){return this.currentValue}async toPromise(){return await this.hasValue,this.currentValue}then(e,t){return this.toPromise().then(e,t)}catch(e){return this.toPromise().catch(e)}finally(e){return this.toPromise().finally(e)}[Symbol.toStringTag]=`FutureValue`},vn=e=>{try{return new URL(e).hostname}catch{return e}};function yn(e){return e.replace(/<[^>]*>/g,``).replace(/ /g,` `).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var bn=({url:e,considered:t,title:n,description:r,summary:i})=>{let a=vn(e);return{url:e,considered:t,referenceIndex:{},score:0,metadata:{},display:{card:{title:n,description:r||i,badge:e},listItem:{title:n,badge:a}}}},xn=class{store;content=new _n;backendSendsMappedRefs=!1;constructor(e){this.options=e,this.store=s({id:e.id,state:`loading`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:``,html:``,text:``},references:{all:[],used:[],unused:[]},retrievalQuestion:e.userQuestion})}pushError(e){this.options.onError?.(e),this.store.update(t=>({...t,errors:[...t.errors,e]}))}updateRequestId(e){this.store.update(t=>({...t,id:e}))}updateText(e){this.store.update(t=>{let n=t.message.markdown+e,r=this.options.markdownRenderer.toHTML(n,t.references);return{...t,state:`streaming`,message:{markdown:n,html:r,text:``}}})}finishMessage(){this.store.update(e=>{let t={...e,state:`done`};return t.references.unused=t.references.all.filter(e=>e.referenceIndex.used===void 0),t.message.text=yn(t.message.html),this.options?.onFinish?.(t),this.content.setValue(t),t})}addReference(e){this.store.update(t=>{let n=t.references.all,r=n.length,i=[...n,{...e,referenceIndex:{all:r}}];return{...t,references:{used:t.references.used,all:i}}})}addMappedReference(e){this.backendSendsMappedRefs=!0,this.addReference(e)}addOldReference(e){this.backendSendsMappedRefs||this.addReference(bn(e))}updateRetrievalQuestion(e){this.store.update(t=>({...t,retrievalQuestion:e}))}setNoFeedback(){this.store.update(e=>({...e,noFeedback:!0}))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}},Sn=class{id;constructor(e){this.chatResponseData=e,this.id=this.chatResponseData.id}async isReadyForFeedback(){return await this.chatResponseData.readyForFeedback.toPromise(),!0}subscribe(e,t){return this.chatResponseData.readableStore.subscribe(e,t)}getContent(){return this.chatResponseData.content.toPromise()}abort(){return this.chatResponseData.abort()}async thumbsUp(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsUp(this.id,this.chatResponseData.question)}async thumbsDown(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsDown(this.id,this.chatResponseData.question)}async feedback(e){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.feedback(this.id,this.chatResponseData.question,e)}},Cn=class{latestRequest=new _n;state=s({state:`idle`});id;history=[];constructor(e){this.clientPrimitive=e,this.id=e.createConversationId()}subscribe(e){return this.state.subscribe(e)}chat(e,t={}){let n=this.clientPrimitive.chat(this.id,e,t);return this.history.push(n),this.latestRequest.setValue({question:e,response:n}),n}async abort(){let e=this.history.map(e=>e.abort());await Promise.all(e)}async thumbsUp(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsUp(t.id,e)}async thumbsDown(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsDown(t.id,e)}async feedback(e){let{question:t,response:n}=await this.latestRequest;await n.isReadyForFeedback(),await this.clientPrimitive.feedback(n.id,t,e)}},Z=[];for(let e=0;e<256;++e)Z.push((e+256).toString(16).slice(1));function wn(e,t=0){return(Z[e[t+0]]+Z[e[t+1]]+Z[e[t+2]]+Z[e[t+3]]+`-`+Z[e[t+4]]+Z[e[t+5]]+`-`+Z[e[t+6]]+Z[e[t+7]]+`-`+Z[e[t+8]]+Z[e[t+9]]+`-`+Z[e[t+10]]+Z[e[t+11]]+Z[e[t+12]]+Z[e[t+13]]+Z[e[t+14]]+Z[e[t+15]]).toLowerCase()}var Tn,En=new Uint8Array(16);function Dn(){if(!Tn){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);Tn=crypto.getRandomValues.bind(crypto)}return Tn(En)}var On={};function kn(e,t,n){let r;if(e)r=jn(e.random??e.rng?.()??Dn(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=Dn();An(On,e,i),r=jn(i,On.msecs,On.seq,t,n)}return t??wn(r)}function An(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function jn(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}var Mn=new Map,Nn=class{get length(){return Mn.size}clear(){Mn.clear()}getItem(e){return Mn.get(e)||null}key(e){return Array.from(Mn.keys())[e]||null}removeItem(e){Mn.delete(e)}setItem(e,t){Mn.set(e,String(t))}},Pn=globalThis.localStorage??new Nn,Fn=async e=>{try{let t=Pn.getItem(`liipgpt:uID`)||Pn.getItem(`uID`),n={method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:t})},r=await e.fetchData(`/login`,pe,{},n).catch(t=>(console.log(`Failed to /login use /log`,t),e.fetchData(`/log`,pe,{},n)));if(`maintenance`in r&&r.maintenance)return{mode:`maintenance`};if(!(`id`in r))throw Error(`Invalid response format: missing user id`);return Pn.setItem(`liipgpt:uID`,r.id),{mode:`ready`,userId:r.id}}catch(e){throw console.error(`Failed to fetch user data:`,e),e}},Q=function(e,t){if(!(this instanceof Q))return new Q(e,t);this.url=e,t||={},this.headers=t.headers||{},this.payload=t.payload===void 0?``:t.payload,this.method=t.method||this.payload&&`POST`||`GET`,this.withCredentials=!!t.withCredentials,this.debug=!!t.debug,this.autoReconnect=t.autoReconnect===void 0?!1:t.autoReconnect,this.reconnectDelay=t.reconnectDelay===void 0?3e3:t.reconnectDelay,this.maxRetries=t.maxRetries===void 0?null:t.maxRetries,this.retryCount=0,this.reconnectTimer=null,this.useLastEventId=t.useLastEventId===void 0?!0:t.useLastEventId,this.FIELD_SEPARATOR=`:`,this.listeners={},this.xhr=null,this.readyState=Q.INITIALIZING,this.progress=0,this.chunk=``,this.lastEventId=``,this._hasParsedBom=!1,this.addEventListener=function(e,t){this.listeners[e]===void 0&&(this.listeners[e]=[]),this.listeners[e].indexOf(t)===-1&&this.listeners[e].push(t)},this.removeEventListener=function(e,t){if(this.listeners[e]===void 0)return;let n=[];this.listeners[e].forEach(function(e){e!==t&&n.push(e)}),n.length===0?delete this.listeners[e]:this.listeners[e]=n},this.dispatchEvent=function(e){if(!e)return!0;this.debug&&console.debug(e),e.source=this;let t=`on`+e.type;return this.hasOwnProperty(t)&&(this[t].call(this,e),e.defaultPrevented)?!1:this.listeners[e.type]?this.listeners[e.type].every(function(t){return t(e),!e.defaultPrevented}):!0},this._markClosed=function(){if(this.xhr=null,this.progress=0,this.chunk=``,this._setReadyState(Q.CLOSED),this.autoReconnect){if(this.maxRetries!==null&&this.retryCount>=this.maxRetries){this.debug&&console.debug(`SSE max retries (${this.maxRetries}) reached, stopping reconnection attempts`),this.autoReconnect=!1,this.close();return}this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.debug&&console.debug(`SSE will attempt to reconnect in ${this.reconnectDelay}ms (attempt ${this.retryCount+1}${this.maxRetries?`/`+this.maxRetries:``})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryCount++,this.stream()},this.reconnectDelay)}},this._setReadyState=function(e){let t=new CustomEvent(`readystatechange`);t.readyState=e,this.readyState=e,this.dispatchEvent(t)},this._onStreamFailure=function(e){let t=new CustomEvent(`error`);t.responseCode=e.currentTarget.status,t.data=e.currentTarget.response,this.dispatchEvent(t),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent(`abort`)),this._markClosed()},this._onStreamProgress=function(e){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300){this._onStreamFailure(e);return}this.retryCount=0;let t=this.xhr.responseText.substring(this.progress);this.progress+=t.length,!this._hasParsedBom&&this.chunk.length===0&&(t.charCodeAt(0)===65279&&(t=t.substring(1)),this._hasParsedBom=!0);let n=(this.chunk+t).split(/(\r\n\r\n|\r\r|\n\n)/g),r=n.pop();n.forEach(function(e){e.trim().length>0&&this.dispatchEvent(this._parseEventChunk(e))}.bind(this)),this.chunk=r},this._onStreamLoaded=function(e){this._onStreamProgress(e),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk=``,this._markClosed()},this._parseEventChunk=function(e){if(!e||e.length===0)return null;this.debug&&console.debug(e);let t={id:null,retry:null,data:null,event:null};if(e.split(/\n|\r\n|\r/).forEach(function(e){let n=e.indexOf(this.FIELD_SEPARATOR),r,i;if(n>0){let t=e[n+1]===` `?2:1;r=e.substring(0,n),i=e.substring(n+t)}else if(n<0)r=e,i=``;else return;r in t&&(r===`data`&&t[r]!==null?t.data+=`
|
|
58
|
+
`+i:t[r]=i)}.bind(this)),t.id!==null&&t.id.indexOf(`\0`)===-1&&(this.lastEventId=t.id),t.retry!==null&&/^[0-9]+$/.test(t.retry)&&(this.reconnectDelay=parseInt(t.retry,10)),t.data===null)return null;let n=new CustomEvent(t.event||`message`);return n.id=t.id,n.data=t.data||``,n.lastEventId=this.lastEventId,n},this._onReadyStateChange=function(){if(this.xhr&&this.xhr.readyState===XMLHttpRequest.HEADERS_RECEIVED){let e={},t=this.xhr.getAllResponseHeaders().trim().split(`\r
|
|
59
|
+
`);for(let n of t){let[t,...r]=n.split(`:`),i=r.join(`:`).trim();e[t.trim().toLowerCase()]=e[t.trim().toLowerCase()]||[],e[t.trim().toLowerCase()].push(i)}let n=new CustomEvent(`open`);n.responseCode=this.xhr.status,n.headers=e,this.dispatchEvent(n),this._setReadyState(Q.OPEN)}},this.stream=function(){if(!this.xhr){this._setReadyState(Q.CONNECTING),this.xhr=new XMLHttpRequest,this.xhr.addEventListener(`progress`,this._onStreamProgress.bind(this)),this.xhr.addEventListener(`load`,this._onStreamLoaded.bind(this)),this.xhr.addEventListener(`readystatechange`,this._onReadyStateChange.bind(this)),this.xhr.addEventListener(`error`,this._onStreamFailure.bind(this)),this.xhr.addEventListener(`abort`,this._onStreamAbort.bind(this)),this.xhr.open(this.method,this.url);for(let e in this.headers)this.xhr.setRequestHeader(e,this.headers[e]);this.useLastEventId&&this.lastEventId.length>0&&this.xhr.setRequestHeader(`Last-Event-ID`,this.lastEventId),this.xhr.withCredentials=this.withCredentials,this.xhr.send(this.payload)}},this.close=function(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.autoReconnect=!1,this.xhr&&this.xhr.abort()},(t.start===void 0||t.start)&&this.stream()};Q.INITIALIZING=-1,Q.CONNECTING=0,Q.OPEN=1,Q.CLOSED=2;var In=class{eventSource;triggeredOnClose=!1;constructor(e,t,n){this.options=t,this.payload=n;let r={headers:{"content-type":`application/json`}};n&&(r.payload=JSON.stringify(n)),t.apiKey&&(r.headers[`api-key`]=t.apiKey),this.eventSource=new(t.EventSource??Q)(e,r),this.eventSource.onmessage=e=>{try{let n=JSON.parse(e.data);t.onMessage(n)}catch(e){t.onError(new CustomEvent(`parse-error`,{detail:e}))}},this.eventSource.onerror=e=>{t.onError(e),this.isClosed()&&this.close()}}isClosed(){return this.eventSource.readyState===EventSource.CLOSED}close(){this.isClosed()||this.eventSource.close(),this.triggeredOnClose||(this.triggeredOnClose=!0,this.options.onClose())}},Ln=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!=null)),Rn=class{constructor(e){this.options=e}getDefaultHeaders(e={}){let t={"Content-Type":`application/json`,...e};return this.options.apiKey&&(t[`api-key`]=this.options.apiKey),t}get speechRecognitionApiKey(){return this.options.speechRecognitionApiKey}async subscribeSse(e,t={},n){let r=Ln(t);return this.options.apiKey&&(n.apiKey=this.options.apiKey),new In(`${this.options.apiUrl}${e}`,n,r)}async fetchData(e,t,n={},r={}){let i=`${this.options.apiUrl}${e}?${new URLSearchParams(Ln(n)).toString()}`,a={...r,headers:this.getDefaultHeaders(r?.headers)},o=await fetch(i,a);if(!o.ok){let e=await o.text();throw Error(`API request failed: ${o.status} - ${e}`)}let s=await o.json(),{success:c,data:l,error:u}=t.safeParse(s);if(this.options.strict){if(!c)throw console.error(`Server response has wrong type:
|
|
60
|
+
`,{error:u,url:i,opts:a,data:s}),Error(`Server response has wrong type: ${u.message}`);return l}else return c||console.warn(`Server response has wrong type:
|
|
61
|
+
`,{error:u,url:i,opts:a,data:s}),s}async postData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,headers:this.getDefaultHeaders(),body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}async postFormData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,body:t});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}},zn=le({links:_(le({url:g().url().optional(),title:g().optional(),considered:ce().optional(),orgMetadata:le({authors:_(g()).optional()}).optional(),type:g().optional(),date:g().datetime().optional(),similarity:se().optional(),content:g().optional(),fromFullTextSearch:ce().optional(),rerank:le({index:se().int().optional(),adjustment:se().optional(),score:se().optional(),similarityOld:se().optional()}).optional()}).or(de))}),Bn=e=>{if(`metadata`in e)return e;console.warn(`Please upgrade your backend you are currently using an old api feature.`);let t=e.orgMetadata??{};e?.fromFullTextSearch&&(t.fromFullTextSearch=e?.fromFullTextSearch),e?.rerank&&(t.rerank=e?.rerank);let n=[],r=e.title??``;if(e.title&&e.title.includes(` > `)){let t=e.title.split(` > `);r=t.pop()??``,n=t}return{url:e.url??``,title:r,score:e.similarity||0,breadcrumbs:n,metadata:t,description:e.content,date:e.date}},Vn=7,Hn=8,Un=160,Wn=e=>{let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`<`){let r=e.indexOf(`>`,n);if(r!==-1){t.push({type:`tag`,value:e.slice(n,r+1)}),n=r+1;continue}}if(/\s/.test(r)){let r=n;for(;r<e.length&&/\s/.test(e[r]);)r++;t.push({type:`space`,value:e.slice(n,r)}),n=r;continue}let i=n;for(;i<e.length&&!/\s/.test(e[i])&&e[i]!==`<`;)i++;t.push({type:`word`,value:e.slice(n,i)}),n=i}return t},Gn=e=>{let t=Wn(e),n=[],r=``,i=!1;for(let e of t)e.type===`space`&&i?(n.push(r),r=e.value,i=!1):(r+=e.value,e.type===`word`&&(i=!0));return r&&n.push(r),n},Kn=e=>Math.max(Hn,Math.min(Un,e.length*Vn)),qn=class{queue=[];timeoutId=null;isProcessing=!1;constructor(e){this.onText=e}ingestText(e){let t=Gn(e);if(t.length>=5){for(let e of t)this.queue.push({kind:`text`,chunk:e,delayMs:Kn(e)});this.kickoff();return}this.runAfterTyping(()=>this.onText(e))}runAfterTyping(e){if(this.queue.length===0&&!this.isProcessing){e();return}this.queue.push({kind:`fn`,fn:e}),this.kickoff()}runWithWarmup(e){this.queue.push({kind:`fn`,fn:e}),this.kickoff()}clear(){this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.queue=[],this.isProcessing=!1}kickoff(){this.isProcessing||this.timeoutId!==null||(this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},750))}processNext(){let e=this.queue.shift();if(!e){this.isProcessing=!1;return}this.isProcessing=!0,e.kind===`text`?(this.onText(e.chunk),this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},e.delayMs)):(e.fn(),this.processNext())}},Jn=class{constructor(e){this.results=e}},Yn=class{internalData;renderers=new Map;markedExtensions=[];_newTabSrText;constructor(e){let t=new Rn({apiUrl:e.apiUrl,apiKey:e.apiKey,speechRecognitionApiKey:e.speechRecognitionApiKey,strict:e.strict??!1,EventSource:e.EventSource??EventSource});this.internalData={restClient:t,metadata:Fn(t),searchResponseMap:new Map,chatResponseMap:new Map,conversationMap:new Map}}setMarkedExtensions(...e){this.markedExtensions=e}setNewTabSrText(e){this._newTabSrText=e}getMetadata(){return this.internalData.metadata}createConversationId(){let e=kn();return this.renderers.set(e,new mn({extensions:this.markedExtensions,newTabSrText:this._newTabSrText})),e}chat(e,t,n={}){let r=new _n,i=kn(),a=new gn,o=new xn({id:i,onError:e=>{n.onError?.(e)},onFinish:e=>{r.setValue(e)},markdownRenderer:this.renderers.get(e)??new mn({extensions:this.markedExtensions,newTabSrText:this._newTabSrText}),userQuestion:t}),s=async()=>{await a,(await c).close()},c=new _n,l=new qn(e=>o.updateText(e));(async()=>{let s=await this.internalData.metadata;if(s.mode===`maintenance`)throw Error(`Can not chat in maintenance mode`);let u=await this.internalData.restClient.subscribeSse(`/assistant/sse`,{query:t,uID:s.userId,cID:e,rID:i,lang:n.lang,feature:n.features?.join(`,`),referrer:n.referrer,...n.selectorValues??{},...n.predefinedQuestionId?{predefinedQuestionId:n.predefinedQuestionId}:{},...n.switchQuestionId?{switchQuestionId:n.switchQuestionId}:{},chat:`true`,version:`2`},{onClose:()=>{l.clear(),o.finishMessage(),a.resolve(),r.cleanup()},onMessage:t=>{let r=t;switch(r.type){case`error`:l.runAfterTyping(()=>o.pushError(r.error));break;case`id`:r.for===`request`&&i!==r.id&&console.warn(`Unexpected request id "${r.id}" expected "${i}"`),r.for===`conversation`&&e!==r.id&&console.warn(`Unexpected conversation id "${r.id}" expected "${e}"`);break;case`state`:r.state===`history-entry-initialized`&&a.resolve();break;case`text`:l.ingestText(r.text);break;case`done`:case`answer-done`:l.runAfterTyping(()=>{o.finishMessage(),a.resolve(),c.then(e=>e.close())});break;case`unexpected-call`:l.runAfterTyping(()=>{console.error(`unexpected-call:`,r),o.pushError(`unexpected-call`)});break;case`mapped-reference`:l.runAfterTyping(()=>o.addMappedReference(r.reference));break;case`reference`:l.runAfterTyping(()=>o.addOldReference(r.reference));break;case`retrieval-question`:l.runAfterTyping(()=>o.updateRetrievalQuestion(r.question));break;case`no-feedback`:l.runAfterTyping(()=>o.setNoFeedback());break;case`component`:l.runWithWarmup(()=>n.onEmbed?.(r));break}l.runAfterTyping(()=>n.onMessage?.(r))},onError:e=>{console.error(` sse-error:`,e),!(`data`in e&&!e.data&&`responseCode`in e&&e.responseCode===0)&&o.pushError(`sse-error`)}});c.setValue(u)})();let u=new Sn({question:t,id:i,content:r,readableStore:o.getReadableStore(),readyForFeedback:a,abort:s,liipgptClientPrimitive:this});return this.internalData.chatResponseMap.set(u.id,u),u}async thumbs(e,t,n){if((await this.internalData.metadata).mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);let r={feedback:n,rID:e,query:t};await this.internalData.restClient.postData(`/quickfeedback`,r)}thumbsUp(e,t){return this.thumbs(e,t,`positive`)}thumbsDown(e,t){return this.thumbs(e,t,`negative`)}async feedback(e,t,n){let r=await this.internalData.metadata;if(r.mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);if(n.message){let i={body:n.message,email:n.email,rID:e,uID:r.userId,query:t};await this.internalData.restClient.postData(`/feedback`,i)}n.classification&&await this.internalData.restClient.postData(`/classification`,{impact:n.classification.impact,quality:n.classification.quality,rID:e})}async userAction(e,t={}){let n=await this.internalData.metadata;if(n.mode!==`ready`)throw Error(`Can not post user action unless we are in ready mode`);let r={uID:n.userId,cID:t.conversationId,lang:t.lang,userAction:e};await this.internalData.restClient.postData(`/assistant/userAction`,r)}async search(e,t={}){let n=await this.internalData.metadata,r=n.mode===`ready`?n.userId:void 0,{links:i}=await this.internalData.restClient.fetchData(`/assistant/search`,zn,{modelId:t.model,lang:t.language,query:e,mapResults:`true`,uID:r});return new Jn(i.map(Bn))}async getChatConfig(){return this.internalData.restClient.fetchData(`/chatconfig`,ue)}async getPredefinedQuestions(e){return(await this.internalData.restClient.fetchData(`/topics/questions`,fe,e)).predefinedQuestions}async transcribeAudio(e,t={}){let n=await this.internalData.metadata,r=t.lang||`de-CH`;if(n.mode===`maintenance`)throw Error(`Can not transcribe audio in maintenance mode`);try{let t=(e=>e.includes(`mp4`)?`mp4`:e.includes(`webm`)?`webm`:(e.includes(`wav`),`wav`))(e.type),n=new FormData;return n.append(`file`,e,`audio.${t}`),n.append(`lang`,r),n.append(`type`,e.type),{transcript:await(await this.internalData.restClient.postFormData(`/speech?key=${this.internalData.restClient.speechRecognitionApiKey||``}&lang=${r}`,n)).text()||``,error:void 0}}catch(e){return console.error(`Error transcribing audio:`,e),{transcript:``,error:e instanceof Error?e.message:`Unknown error`}}}},Xn=class{clientPrimitive;constructor(e){this.clientPrimitive=new Yn(e)}getMetadata(){return this.clientPrimitive.getMetadata()}createConversation(){return new Cn(this.clientPrimitive)}search(e,t={}){return this.clientPrimitive.search(e,t)}getChatConfig(){return this.clientPrimitive.getChatConfig()}getPredefinedQuestions(e){return this.clientPrimitive.getPredefinedQuestions(e)}},Zn=class extends Map{#e=new Map;#t=n(0);#n=n(0);#r=ne||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return ne===this.#r?n(e):l(e)}has(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else return u(this.#t),!1;return u(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else{u(this.#t);return}return u(n),super.get(e)}set(e,n){var r=this.#e,i=r.get(e),a=super.get(e),o=super.set(e,n),s=this.#t;if(i===void 0)i=this.#i(0),r.set(e,i),h(this.#n,super.size),t(s);else if(a!==n){t(i);var c=s.reactions===null?null:new Set(s.reactions);(c===null||!i.reactions?.every(e=>c.has(e)))&&t(s)}return o}delete(e){var n=this.#e,r=n.get(e),i=super.delete(e);return r!==void 0&&(n.delete(e),h(r,-1)),i&&(h(this.#n,super.size),t(this.#t)),i}clear(){if(super.size!==0){super.clear();var e=this.#e;h(this.#n,0);for(var n of e.values())h(n,-1);t(this.#t),e.clear()}}#a(){u(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)u(n)}keys(){return u(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return u(this.#n),super.size}},Qn=class{#e;#t;constructor(t,n){this.#e=t,this.#t=e(n)}get current(){return this.#t(),this.#e()}},$n=/\(.+\)/,er=new Set([`all`,`print`,`screen`,`and`,`or`,`not`,`only`]),tr=class extends Qn{constructor(e,t){let n=$n.test(e)||e.split(/[\s,]+/).some(e=>er.has(e.trim()))?e:`(${e})`,r=window.matchMedia(n);super(()=>r.matches,e=>m(r,`change`,e))}};function nr(e,t){o(t,!0);let n=ie(t,`css`,7),s=oe(t,[`$$slots`,`$$events`,`$$legacy`,`$$host`,`css`]),l=e=>{re(()=>{n()&&(e.innerHTML=n())})};var u={get css(){return n()},set css(e){n(e),te()}},p=a(),ne=d(p),m=e=>{var t=a();ee(d(t),()=>`style`,!1,(e,t)=>{c(e,e=>l?.(e)),f(e,()=>({...s}))}),ae(e,t)};return r(ne,e=>{n()&&e(m)}),ae(e,p),i(u)}p(nr,{css:{}},[],[],{mode:`open`});var rr=RegExp(`([\\p{Ll}\\d])(\\p{Lu})`,`gu`),ir=RegExp(`(\\p{Lu})([\\p{Lu}][\\p{Ll}])`,`gu`),ar=RegExp(`(\\d)(\\p{Ll})`,`gu`),or=RegExp(`(\\p{L})(\\d)`,`gu`),sr=/[^\p{L}\d]+/giu,cr=`$1\0$2`,lr=``;function ur(e,t){let n=e.trim();n=n.replace(rr,cr).replace(ir,cr),t?.separateNumbers&&(n=n.replace(ar,cr).replace(or,cr)),n=n.replace(sr,`\0`);let r=0,i=n.length;for(;n.charAt(r)===`\0`;)r++;if(r===i)return[];for(;n.charAt(i-1)===`\0`;)i--;return n.slice(r,i).split(/\0/g)}function dr(e,t){return Er(e,t?.prefixCharacters)+ur(e,t).map(Sr(t?.locale)).join(t?.delimiter??` `)}function fr(e,t){let n=Er(e,t?.prefixCharacters),r=Sr(t?.locale),i=Cr(t?.locale),a=t?.mergeAmbiguousCharacters?wr(r,i):Tr(r,i);return n+ur(e,t).map((e,t)=>t===0?r(e):a(e,t)).join(t?.delimiter??``)}function pr(e,t){let n=Er(e,t?.prefixCharacters),r=Sr(t?.locale),i=Cr(t?.locale),a=t?.mergeAmbiguousCharacters?wr(r,i):Tr(r,i);return n+ur(e,t).map(a).join(t?.delimiter??``)}function mr(e,t){let n=Er(e,t?.prefixCharacters),r=Sr(t?.locale),i=Cr(t?.locale);return n+ur(e,t).map(wr(r,i)).join(t?.delimiter??` `)}function hr(e,t){return Er(e,t?.prefixCharacters)+ur(e,t).map(Cr(t?.locale)).join(t?.delimiter??`_`)}function gr(e,t){return dr(e,{delimiter:`.`,...t})}function _r(e,t){return dr(e,{delimiter:`-`,...t})}function vr(e,t){return dr(e,{delimiter:`/`,...t})}function yr(e,t){let n=Er(e,t?.prefixCharacters),r=Sr(t?.locale),i=wr(r,Cr(t?.locale));return n+ur(e,t).map((e,t)=>t===0?i(e):r(e)).join(t?.delimiter??` `)}function br(e,t){return dr(e,{delimiter:`_`,...t})}function xr(e,t){return mr(e,{delimiter:`-`,...t})}function Sr(e){return e===!1?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function Cr(e){return e===!1?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function wr(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function Tr(e,t){return(n,r)=>{let i=n[0];return(r>0&&i>=`0`&&i<=`9`?`_`+i:t(i))+e(n.slice(1))}}function Er(e,t=lr){let n=``;for(let r=0;r<e.length;r++){let i=e.charAt(r);if(t.includes(i))n+=i;else break}return n}function Dr(e,t){let n=``;for(let r of e)n+=Math.random()>.5?r.toLocaleUpperCase(t):r.toLocaleLowerCase(t);return n}function Or(e,t){let n=``;for(let r of e){let e=r.toLocaleLowerCase(t);n+=r===e?r.toLocaleUpperCase(t):e}return n}var kr=/\b(?:an?d?|a[st]|because|but|by|en|for|i[fn]|neither|nor|o[fnr]|only|over|per|so|some|tha[tn]|the|to|up|upon|vs?\.?|versus|via|when|with|without|yet)\b/i,Ar=/[^\s:–—-]+|./g,jr=/\s/,Mr=/.(?=[A-Z]|\..)/,Nr=/[A-Za-z0-9\u00C0-\u00FF]/;function Pr(e){for(var t=``,n;(n=Ar.exec(e))!==null;){var r=n[0],i=n.index;if(!Mr.test(r)&&(!kr.test(r)||i===0||i+r.length===e.length)&&(e.charAt(i+r.length)!==`:`||jr.test(e.charAt(i+r.length+1)))){t+=r.replace(Nr,function(e){return e.toUpperCase()});continue}t+=r}return t}var Fr=fr,Ir=mr,Lr=hr,Rr=gr,zr=dr,Br=pr,Vr=vr,Hr=yr,Ur=br,Wr=xr,Gr=_r,Kr=Dr,qr=Or,Jr=Pr,Yr=e=>e.toUpperCase(),Xr=(e,t)=>e.toLocaleUpperCase(t),Zr=e=>e.toLowerCase(),Qr=(e,t)=>e.toLocaleLowerCase(t),$r=e=>e.charAt(0).toLowerCase()+e.slice(1),ei=e=>e.charAt(0).toUpperCase()+e.slice(1),ti=e=>e===e.toUpperCase(),ni=e=>e===e.toLowerCase(),$=class{};$.camel=Fr,$.capital=Ir,$.constant=Lr,$.dot=Rr,$.kebab=Gr,$.lower=Zr,$.lowerFirst=$r,$.localeLower=Qr,$.localeUpper=Xr,$.no=zr,$.pascal=Br,$.path=Vr,$.sentence=Hr,$.snake=Ur,$.sponge=Kr,$.swap=qr,$.title=Jr,$.train=Wr,$.upper=Yr,$.upperFirst=ei,$.isUpper=ti,$.isLower=ni;var ri=640,ii=1024,ai=null,oi=()=>{if(ai)return ai;if(!globalThis.document)return 16;let e=globalThis.document.querySelector(`:root`);return ai=Number(getComputedStyle(e).fontSize.slice(0,-2)),ai},si=({minRem:e,maxRem:t})=>{let n=oi(),r=ri/n,i=ii/n,a=(t-e)/(i-r);return`clamp( ${e}rem, ${-r*a+e}rem + ${a*100}cqw, ${t}rem )`},ci=e=>typeof e==`string`?e:typeof e==`number`?String(e):typeof e==`object`?e.minRem===e.maxRem?`${e.minRem}rem`:si(e):``,li=(e,t,n,r=!1)=>{let i=``;return n.forEach(n=>{let a=t[n];r&&!a&&n===`borderWidth`&&(a=`0px`),r&&!a&&n===`borderColor`&&(a=`transparent`),a&&(i+=`--${Gr(e)}-${Gr(n)}:${ci(a)}; `)}),i},ui=(e,t)=>Object.entries(t).map(([t,n])=>`--${e}-${Gr(t)}:${ci(n)}`).join(`; `)+`; `,di=(e,t)=>{let n=``;return n+=li(e,t,[`background`,`borderWidth`,`borderColor`,`boxShadow`,`borderRadius`,`color`],!0),t.hover&&(n+=li(`${e}-hover`,t.hover,[`background`,`borderWidth`,`borderColor`,`boxShadow`,`color`])),t.focus&&(n+=li(`${e}-focus`,t.focus,[`background`,`borderWidth`,`borderColor`,`boxShadow`,`color`])),t.custom&&(n+=ui(e,t.custom)),n},fi=(e,t)=>Object.entries(t).map(([t,n])=>`--color-${e}-${t}:${n}`).join(`; `)+`; `,pi=e=>`--font-family: ${e?.family||`inherit`};`,mi=(e,t={})=>`${t.root??`.chat-app`} {${pi(e.font)} ${Object.entries(e.colors).map(([e,t])=>fi(e,t)).join(``)} ${ui(`base`,e.base)} ${Object.entries(e.components).map(([e,t])=>di(Gr(e),t)).join(``)}};`;export{Xn as a,Gn as c,wn as d,yn as f,Zn as i,Pn as l,nr as n,Yn as o,ot as p,tr as r,Kn as s,mi as t,Dn as u};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Object.freeze({status:`aborted`});function e(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var t=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},n=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},r={};function i(e){return e&&Object.assign(r,e),r}function a(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function o(e,t){return typeof t==`bigint`?t.toString():t}function s(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function c(e){return e==null}function l(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function u(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var ee=Symbol(`evaluating`);function d(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ee)return r===void 0&&(r=ee,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function f(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function p(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function te(e){return JSON.stringify(e)}function ne(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var re=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ie=s(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function h(e){if(m(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(m(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ae(e){return h(e)?{...e}:Array.isArray(e)?[...e]:e}var oe=new Set([`string`,`number`,`symbol`]);function g(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function _(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function v(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function se(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ce={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function le(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return _(e,p(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return f(this,`shape`,e),e},checks:[]}))}function ue(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return _(e,p(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return f(this,`shape`,r),r},checks:[]}))}function de(e,t){if(!h(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return _(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return f(this,`shape`,n),n}}))}function fe(e,t){if(!h(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return _(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return f(this,`shape`,n),n}}))}function pe(e,t){return _(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return f(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function me(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return _(t,p(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return f(this,`shape`,i),i},checks:[]}))}function he(e,t,n){return _(t,p(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return f(this,`shape`,i),i}}))}function y(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function b(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function x(e){return typeof e==`string`?e:e?.message}function S(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=x(e.inst?._zod.def?.error?.(e))??x(t?.error?.(e))??x(n.customError?.(e))??x(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function ge(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function C(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var _e=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,o,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},ve=e(`$ZodError`,_e),ye=e(`$ZodError`,_e,{Parent:Error});function be(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function xe(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var Se=e=>(n,r,a,o)=>{let s=a?Object.assign(a,{async:!1}):{async:!1},c=n._zod.run({value:r,issues:[]},s);if(c instanceof Promise)throw new t;if(c.issues.length){let t=new(o?.Err??e)(c.issues.map(e=>S(e,s,i())));throw re(t,o?.callee),t}return c.value},Ce=e=>async(t,n,r,a)=>{let o=r?Object.assign(r,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let t=new(a?.Err??e)(s.issues.map(e=>S(e,o,i())));throw re(t,a?.callee),t}return s.value},w=e=>(n,r,a)=>{let o=a?{...a,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new t;return s.issues.length?{success:!1,error:new(e??ve)(s.issues.map(e=>S(e,o,i())))}:{success:!0,data:s.value}},we=w(ye),T=e=>async(t,n,r)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>S(e,a,i())))}:{success:!0,data:o.value}},Te=T(ye),Ee=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Se(e)(t,n,i)},De=e=>(t,n,r)=>Se(e)(t,n,r),Oe=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ce(e)(t,n,i)},ke=e=>async(t,n,r)=>Ce(e)(t,n,r),Ae=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return w(e)(t,n,i)},je=e=>(t,n,r)=>w(e)(t,n,r),Me=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return T(e)(t,n,i)},Ne=e=>async(t,n,r)=>T(e)(t,n,r),Pe=/^[cC][^\s-]{8,}$/,Fe=/^[0-9a-z]+$/,Ie=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Le=/^[0-9a-vA-V]{20}$/,Re=/^[A-Za-z0-9]{27}$/,ze=/^[a-zA-Z0-9_-]{21}$/,Be=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ve=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,He=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ue=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,We=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Ge(){return new RegExp(We,`u`)}var Ke=/^(?:(?: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])$/,qe=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,Je=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ye=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ze=/^[A-Za-z0-9_-]*$/,Qe=/^\+[1-9]\d{6,14}$/,$e=`(?:(?:\\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])))`,et=RegExp(`^${$e}$`);function tt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function nt(e){return RegExp(`^${tt(e)}$`)}function rt(e){let t=tt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${$e}T(?:${r})$`)}var it=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},at=/^-?\d+$/,ot=/^-?\d+(?:\.\d+)?$/,st=/^(?:true|false)$/i,ct=/^[^A-Z]*$/,lt=/^[^a-z]*$/,E=e(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ut={number:`number`,bigint:`bigint`,object:`date`},dt=e(`$ZodCheckLessThan`,(e,t)=>{E.init(e,t);let n=ut[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ft=e(`$ZodCheckGreaterThan`,(e,t)=>{E.init(e,t);let n=ut[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pt=e(`$ZodCheckMultipleOf`,(e,t)=>{E.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):u(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),mt=e(`$ZodCheckNumberFormat`,(e,t)=>{E.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ce[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=at)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),ht=e(`$ZodCheckMaxLength`,(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!c(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=ge(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gt=e(`$ZodCheckMinLength`,(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!c(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ge(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),_t=e(`$ZodCheckLengthEquals`,(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!c(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ge(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),D=e(`$ZodCheckStringFormat`,(e,t)=>{var n,r;E.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),vt=e(`$ZodCheckRegex`,(e,t)=>{D.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),yt=e(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ct,D.init(e,t)}),bt=e(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=lt,D.init(e,t)}),xt=e(`$ZodCheckIncludes`,(e,t)=>{E.init(e,t);let n=g(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),St=e(`$ZodCheckStartsWith`,(e,t)=>{E.init(e,t);let n=RegExp(`^${g(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ct=e(`$ZodCheckEndsWith`,(e,t)=>{E.init(e,t);let n=RegExp(`.*${g(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),wt=e(`$ZodCheckOverwrite`,(e,t)=>{E.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Tt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
2
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
3
|
+
`))}},Et={major:4,minor:3,patch:6},O=e(`$ZodType`,(e,n)=>{var r;e??={},e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=Et;let i=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(e,n,r)=>{let i=y(e),a;for(let o of n){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(i)continue;let n=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&r?.async===!1)throw new t;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,e.issues.length!==n&&(i||=y(e,n))});else{if(e.issues.length===n)continue;i||=y(e,n)}}return a?a.then(()=>e):e},r=(r,a,o)=>{if(y(r))return r.aborted=!0,r;let s=n(a,i,o);if(s instanceof Promise){if(o.async===!1)throw new t;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if(o.direction===`backward`){let t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,o)):r(t,a,o)}let s=e._zod.parse(a,o);if(s instanceof Promise){if(o.async===!1)throw new t;return s.then(e=>n(e,i,o))}return n(s,i,o)}}d(e,`~standard`,()=>({validate:t=>{try{let n=we(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Te(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Dt=e(`$ZodString`,(e,t)=>{O.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??it(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),k=e(`$ZodStringFormat`,(e,t)=>{D.init(e,t),Dt.init(e,t)}),Ot=e(`$ZodGUID`,(e,t)=>{t.pattern??=Ve,k.init(e,t)}),kt=e(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=He(e)}else t.pattern??=He();k.init(e,t)}),At=e(`$ZodEmail`,(e,t)=>{t.pattern??=Ue,k.init(e,t)}),jt=e(`$ZodURL`,(e,t)=>{k.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Mt=e(`$ZodEmoji`,(e,t)=>{t.pattern??=Ge(),k.init(e,t)}),Nt=e(`$ZodNanoID`,(e,t)=>{t.pattern??=ze,k.init(e,t)}),Pt=e(`$ZodCUID`,(e,t)=>{t.pattern??=Pe,k.init(e,t)}),Ft=e(`$ZodCUID2`,(e,t)=>{t.pattern??=Fe,k.init(e,t)}),It=e(`$ZodULID`,(e,t)=>{t.pattern??=Ie,k.init(e,t)}),Lt=e(`$ZodXID`,(e,t)=>{t.pattern??=Le,k.init(e,t)}),Rt=e(`$ZodKSUID`,(e,t)=>{t.pattern??=Re,k.init(e,t)}),zt=e(`$ZodISODateTime`,(e,t)=>{t.pattern??=rt(t),k.init(e,t)}),Bt=e(`$ZodISODate`,(e,t)=>{t.pattern??=et,k.init(e,t)}),Vt=e(`$ZodISOTime`,(e,t)=>{t.pattern??=nt(t),k.init(e,t)}),Ht=e(`$ZodISODuration`,(e,t)=>{t.pattern??=Be,k.init(e,t)}),Ut=e(`$ZodIPv4`,(e,t)=>{t.pattern??=Ke,k.init(e,t),e._zod.bag.format=`ipv4`}),Wt=e(`$ZodIPv6`,(e,t)=>{t.pattern??=qe,k.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Gt=e(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Je,k.init(e,t)}),Kt=e(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ye,k.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function qt(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Jt=e(`$ZodBase64`,(e,t)=>{t.pattern??=Xe,k.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{qt(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Yt(e){if(!Ze.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return qt(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Xt=e(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ze,k.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Yt(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Zt=e(`$ZodE164`,(e,t)=>{t.pattern??=Qe,k.init(e,t)});function Qt(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var $t=e(`$ZodJWT`,(e,t)=>{k.init(e,t),e._zod.check=n=>{Qt(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),en=e(`$ZodNumber`,(e,t)=>{O.init(e,t),e._zod.pattern=e._zod.bag.pattern??ot,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),tn=e(`$ZodNumberFormat`,(e,t)=>{mt.init(e,t),en.init(e,t)}),nn=e(`$ZodBoolean`,(e,t)=>{O.init(e,t),e._zod.pattern=st,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),rn=e(`$ZodUnknown`,(e,t)=>{O.init(e,t),e._zod.parse=e=>e}),an=e(`$ZodNever`,(e,t)=>{O.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function on(e,t,n){e.issues.length&&t.issues.push(...b(n,e.issues)),t.value[n]=e.value}var sn=e(`$ZodArray`,(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>on(t,n,e))):on(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function A(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...b(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function cn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=se(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ln(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>A(e,n,i,t,u))):A(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var un=e(`$ZodObject`,(e,t)=>{if(O.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=s(()=>cn(t));d(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=m,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>A(n,t,e,s,r))):A(i,t,e,s,r)}return i?ln(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),dn=e(`$ZodObjectJIT`,(e,t)=>{un.init(e,t);let n=e._zod.parse,i=s(()=>cn(t)),a=e=>{let t=new Tt([`shape`,`payload`,`ctx`]),n=i.value,r=e=>{let t=te(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let i of n.keys){let n=a[i],o=te(i),s=e[i]?._zod?.optout===`optional`;t.write(`const ${n} = ${r(i)};`),s?t.write(`
|
|
4
|
+
if (${n}.issues.length) {
|
|
5
|
+
if (${o} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
7
|
+
...iss,
|
|
8
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (${n}.value === undefined) {
|
|
14
|
+
if (${o} in input) {
|
|
15
|
+
newResult[${o}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
newResult[${o}] = ${n}.value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
`):t.write(`
|
|
22
|
+
if (${n}.issues.length) {
|
|
23
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
24
|
+
...iss,
|
|
25
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (${n}.value === undefined) {
|
|
30
|
+
if (${o} in input) {
|
|
31
|
+
newResult[${o}] = undefined;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
newResult[${o}] = ${n}.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},o,c=m,l=!r.jitless,u=l&&ie.value,ee=t.catchall,d;e._zod.parse=(r,s)=>{d??=i.value;let f=r.value;return c(f)?l&&u&&s?.async===!1&&s.jitless!==!0?(o||=a(t.shape),r=o(r,s),ee?ln([],f,r,s,d,e):r):n(r,s):(r.issues.push({expected:`object`,code:`invalid_type`,input:f,inst:e}),r)}});function fn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let a=e.filter(e=>!y(e));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>S(e,r,i())))}),t)}var pn=e(`$ZodUnion`,(e,t)=>{O.init(e,t),d(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),d(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),d(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),d(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>l(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>fn(t,i,e,a)):fn(s,i,e,a)}}),mn=e(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,pn.init(e,t);let n=e._zod.parse;d(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=s(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!m(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),hn=e(`$ZodIntersection`,(e,t)=>{O.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>gn(e,t,n)):gn(e,i,a)}});function j(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(h(e)&&h(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=j(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=j(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function gn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),y(e))return e;let o=j(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var _n=e(`$ZodRecord`,(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let a=n.value;if(!h(a))return n.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),n;let o=[],s=t.keyType._zod.values;if(s){n.value={};let i=new Set;for(let e of s)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){i.add(typeof e==`number`?e.toString():e);let s=t.valueType._zod.run({value:a[e],issues:[]},r);s instanceof Promise?o.push(s.then(t=>{t.issues.length&&n.issues.push(...b(e,t.issues)),n.value[e]=t.value})):(s.issues.length&&n.issues.push(...b(e,s.issues)),n.value[e]=s.value)}let c;for(let e in a)i.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c})}else{n.value={};for(let s of Reflect.ownKeys(a)){if(s===`__proto__`)continue;let c=t.keyType._zod.run({value:s,issues:[]},r);if(c instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof s==`string`&&ot.test(s)&&c.issues.length){let e=t.keyType._zod.run({value:Number(s),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(c=e)}if(c.issues.length){t.mode===`loose`?n.value[s]=a[s]:n.issues.push({code:`invalid_key`,origin:`record`,issues:c.issues.map(e=>S(e,r,i())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:a[s],issues:[]},r);l instanceof Promise?o.push(l.then(e=>{e.issues.length&&n.issues.push(...b(s,e.issues)),n.value[c.value]=e.value})):(l.issues.length&&n.issues.push(...b(s,l.issues)),n.value[c.value]=l.value)}}return o.length?Promise.all(o).then(()=>n):n}}),vn=e(`$ZodEnum`,(e,t)=>{O.init(e,t);let n=a(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>oe.has(typeof e)).map(e=>typeof e==`string`?g(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),yn=e(`$ZodLiteral`,(e,t)=>{if(O.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?g(e):e?g(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),bn=e(`$ZodTransform`,(e,r)=>{O.init(e,r),e._zod.parse=(i,a)=>{if(a.direction===`backward`)throw new n(e.constructor.name);let o=r.transform(i.value,i);if(a.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(i.value=e,i));if(o instanceof Promise)throw new t;return i.value=o,i}});function xn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Sn=e(`$ZodOptional`,(e,t)=>{O.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),d(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${l(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>xn(t,e.value)):xn(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Cn=e(`$ZodExactOptional`,(e,t)=>{Sn.init(e,t),d(e._zod,`values`,()=>t.innerType._zod.values),d(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),wn=e(`$ZodNullable`,(e,t)=>{O.init(e,t),d(e._zod,`optin`,()=>t.innerType._zod.optin),d(e._zod,`optout`,()=>t.innerType._zod.optout),d(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${l(e.source)}|null)$`):void 0}),d(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Tn=e(`$ZodDefault`,(e,t)=>{O.init(e,t),e._zod.optin=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>En(e,t)):En(r,t)}});function En(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Dn=e(`$ZodPrefault`,(e,t)=>{O.init(e,t),e._zod.optin=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),On=e(`$ZodNonOptional`,(e,t)=>{O.init(e,t),d(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>kn(t,e)):kn(i,e)}});function kn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var An=e(`$ZodCatch`,(e,t)=>{O.init(e,t),d(e._zod,`optin`,()=>t.innerType._zod.optin),d(e._zod,`optout`,()=>t.innerType._zod.optout),d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>S(e,n,i()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>S(e,n,i()))},input:e.value}),e.issues=[]),e)}}),jn=e(`$ZodPipe`,(e,t)=>{O.init(e,t),d(e._zod,`values`,()=>t.in._zod.values),d(e._zod,`optin`,()=>t.in._zod.optin),d(e._zod,`optout`,()=>t.out._zod.optout),d(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>M(e,t.in,n)):M(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>M(e,t.out,n)):M(r,t.out,n)}});function M(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Mn=e(`$ZodReadonly`,(e,t)=>{O.init(e,t),d(e._zod,`propValues`,()=>t.innerType._zod.propValues),d(e._zod,`values`,()=>t.innerType._zod.values),d(e._zod,`optin`,()=>t.innerType?._zod?.optin),d(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Nn):Nn(r)}});function Nn(e){return e.value=Object.freeze(e.value),e}var Pn=e(`$ZodCustom`,(e,t)=>{E.init(e,t),O.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Fn(t,n,r,e));Fn(i,n,r,e)}});function Fn(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(C(e))}}var In,Ln=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Rn(){return new Ln}(In=globalThis).__zod_globalRegistry??(In.__zod_globalRegistry=Rn());var N=globalThis.__zod_globalRegistry;function zn(e,t){return new e({type:`string`,...v(t)})}function Bn(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...v(t)})}function Vn(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...v(t)})}function Hn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...v(t)})}function Un(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...v(t)})}function Wn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...v(t)})}function Gn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...v(t)})}function Kn(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...v(t)})}function qn(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...v(t)})}function Jn(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...v(t)})}function Yn(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...v(t)})}function Xn(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...v(t)})}function Zn(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...v(t)})}function Qn(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...v(t)})}function $n(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...v(t)})}function er(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...v(t)})}function tr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...v(t)})}function nr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...v(t)})}function rr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...v(t)})}function ir(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...v(t)})}function ar(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...v(t)})}function or(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...v(t)})}function sr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...v(t)})}function cr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...v(t)})}function lr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...v(t)})}function ur(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...v(t)})}function dr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...v(t)})}function fr(e,t){return new e({type:`number`,checks:[],...v(t)})}function pr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...v(t)})}function mr(e,t){return new e({type:`boolean`,...v(t)})}function hr(e){return new e({type:`unknown`})}function gr(e,t){return new e({type:`never`,...v(t)})}function _r(e,t){return new dt({check:`less_than`,...v(t),value:e,inclusive:!1})}function P(e,t){return new dt({check:`less_than`,...v(t),value:e,inclusive:!0})}function vr(e,t){return new ft({check:`greater_than`,...v(t),value:e,inclusive:!1})}function yr(e,t){return new ft({check:`greater_than`,...v(t),value:e,inclusive:!0})}function br(e,t){return new pt({check:`multiple_of`,...v(t),value:e})}function xr(e,t){return new ht({check:`max_length`,...v(t),maximum:e})}function F(e,t){return new gt({check:`min_length`,...v(t),minimum:e})}function Sr(e,t){return new _t({check:`length_equals`,...v(t),length:e})}function Cr(e,t){return new vt({check:`string_format`,format:`regex`,...v(t),pattern:e})}function wr(e){return new yt({check:`string_format`,format:`lowercase`,...v(e)})}function Tr(e){return new bt({check:`string_format`,format:`uppercase`,...v(e)})}function Er(e,t){return new xt({check:`string_format`,format:`includes`,...v(t),includes:e})}function Dr(e,t){return new St({check:`string_format`,format:`starts_with`,...v(t),prefix:e})}function Or(e,t){return new Ct({check:`string_format`,format:`ends_with`,...v(t),suffix:e})}function I(e){return new wt({check:`overwrite`,tx:e})}function kr(e){return I(t=>t.normalize(e))}function Ar(){return I(e=>e.trim())}function jr(){return I(e=>e.toLowerCase())}function Mr(){return I(e=>e.toUpperCase())}function Nr(){return I(e=>ne(e))}function Pr(e,t,n){return new e({type:`array`,element:t,...v(n)})}function Fr(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...v(n)})}function Ir(e){let t=Lr(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(C(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(C(r))}},e(n.value,n)));return t}function Lr(e,t){let n=new E({check:`custom`,...v(t)});return n._zod.check=e,n}function Rr(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??N,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function L(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,L(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&R(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function zr(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
38
|
+
|
|
39
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Br(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:z(t,`input`,e.processors),output:z(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function R(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return R(r.element,n);if(r.type===`set`)return R(r.valueType,n);if(r.type===`lazy`)return R(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return R(r.innerType,n);if(r.type===`intersection`)return R(r.left,n)||R(r.right,n);if(r.type===`record`||r.type===`map`)return R(r.keyType,n)||R(r.valueType,n);if(r.type===`pipe`)return R(r.in,n)||R(r.out,n);if(r.type===`object`){for(let e in r.shape)if(R(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(R(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(R(e,n))return!0;return!!(r.rest&&R(r.rest,n))}return!1}var Vr=(e,t={})=>n=>{let r=Rr({...n,processors:t});return L(e,r),zr(r,e),Br(r,e)},z=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Rr({...i??{},target:a,io:t,processors:n});return L(e,o),zr(o,e),Br(o,e)},Hr={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ur=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Hr[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Wr=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Gr=(e,t,n,r)=>{n.type=`boolean`},Kr=(e,t,n,r)=>{n.not={}},qr=(e,t,n,r)=>{let i=e._zod.def,o=a(i.entries);o.every(e=>typeof e==`number`)&&(n.type=`number`),o.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=o},Jr=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Yr=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Xr=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Zr=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=L(a.element,t,{...r,path:[...r.path,`items`]})},Qr=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=L(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=L(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},$r=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>L(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ei=(e,t,n,r)=>{let i=e._zod.def,a=L(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=L(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ti=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=L(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=L(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=L(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},ni=(e,t,n,r)=>{let i=e._zod.def,a=L(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ri=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ii=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ai=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},oi=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},si=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;L(a,t,r);let o=t.seen.get(e);o.ref=a},ci=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},li=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ui=e(`ZodISODateTime`,(e,t)=>{zt.init(e,t),U.init(e,t)});function di(e){return cr(ui,e)}var fi=e(`ZodISODate`,(e,t)=>{Bt.init(e,t),U.init(e,t)});function pi(e){return lr(fi,e)}var mi=e(`ZodISOTime`,(e,t)=>{Vt.init(e,t),U.init(e,t)});function hi(e){return ur(mi,e)}var gi=e(`ZodISODuration`,(e,t)=>{Ht.init(e,t),U.init(e,t)});function _i(e){return dr(gi,e)}var vi=(e,t)=>{ve.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>xe(e,t)},flatten:{value:t=>be(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,o,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,o,2)}},isEmpty:{get(){return e.issues.length===0}}})};e(`ZodError`,vi);var B=e(`ZodError`,vi,{Parent:Error}),yi=Se(B),bi=Ce(B),xi=w(B),Si=T(B),Ci=Ee(B),wi=De(B),Ti=Oe(B),Ei=ke(B),Di=Ae(B),Oi=je(B),ki=Me(B),Ai=Ne(B),V=e(`ZodType`,(e,t)=>(O.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:z(e,`input`),output:z(e,`output`)}}),e.toJSONSchema=Vr(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(p(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>_(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>yi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>xi(e,t,n),e.parseAsync=async(t,n)=>bi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Si(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ci(e,t,n),e.decode=(t,n)=>wi(e,t,n),e.encodeAsync=async(t,n)=>Ti(e,t,n),e.decodeAsync=async(t,n)=>Ei(e,t,n),e.safeEncode=(t,n)=>Di(e,t,n),e.safeDecode=(t,n)=>Oi(e,t,n),e.safeEncodeAsync=async(t,n)=>ki(e,t,n),e.safeDecodeAsync=async(t,n)=>Ai(e,t,n),e.refine=(t,n)=>e.check(za(t,n)),e.superRefine=t=>e.check(Ba(t)),e.overwrite=t=>e.check(I(t)),e.optional=()=>xa(e),e.exactOptional=()=>Ca(e),e.nullable=()=>Ta(e),e.nullish=()=>xa(Ta(e)),e.nonoptional=t=>ja(e,t),e.array=()=>sa(e),e.or=t=>q([e,t]),e.and=t=>J(e,t),e.transform=t=>Fa(e,ya(t)),e.default=t=>Da(e,t),e.prefault=t=>ka(e,t),e.catch=t=>Na(e,t),e.pipe=t=>Fa(e,t),e.readonly=()=>La(e),e.describe=t=>{let n=e.clone();return N.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return N.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return N.get(e);let n=e.clone();return N.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),ji=e(`_ZodString`,(e,t)=>{Dt.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ur(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Cr(...t)),e.includes=(...t)=>e.check(Er(...t)),e.startsWith=(...t)=>e.check(Dr(...t)),e.endsWith=(...t)=>e.check(Or(...t)),e.min=(...t)=>e.check(F(...t)),e.max=(...t)=>e.check(xr(...t)),e.length=(...t)=>e.check(Sr(...t)),e.nonempty=(...t)=>e.check(F(1,...t)),e.lowercase=t=>e.check(wr(t)),e.uppercase=t=>e.check(Tr(t)),e.trim=()=>e.check(Ar()),e.normalize=(...t)=>e.check(kr(...t)),e.toLowerCase=()=>e.check(jr()),e.toUpperCase=()=>e.check(Mr()),e.slugify=()=>e.check(Nr())}),Mi=e(`ZodString`,(e,t)=>{Dt.init(e,t),ji.init(e,t),e.email=t=>e.check(Bn(Ni,t)),e.url=t=>e.check(Kn(Fi,t)),e.jwt=t=>e.check(sr(Xi,t)),e.emoji=t=>e.check(qn(Ii,t)),e.guid=t=>e.check(Vn(Pi,t)),e.uuid=t=>e.check(Hn(W,t)),e.uuidv4=t=>e.check(Un(W,t)),e.uuidv6=t=>e.check(Wn(W,t)),e.uuidv7=t=>e.check(Gn(W,t)),e.nanoid=t=>e.check(Jn(Li,t)),e.guid=t=>e.check(Vn(Pi,t)),e.cuid=t=>e.check(Yn(Ri,t)),e.cuid2=t=>e.check(Xn(zi,t)),e.ulid=t=>e.check(Zn(Bi,t)),e.base64=t=>e.check(ir(qi,t)),e.base64url=t=>e.check(ar(Ji,t)),e.xid=t=>e.check(Qn(Vi,t)),e.ksuid=t=>e.check($n(Hi,t)),e.ipv4=t=>e.check(er(Ui,t)),e.ipv6=t=>e.check(tr(Wi,t)),e.cidrv4=t=>e.check(nr(Gi,t)),e.cidrv6=t=>e.check(rr(Ki,t)),e.e164=t=>e.check(or(Yi,t)),e.datetime=t=>e.check(di(t)),e.date=t=>e.check(pi(t)),e.time=t=>e.check(hi(t)),e.duration=t=>e.check(_i(t))});function H(e){return zn(Mi,e)}var U=e(`ZodStringFormat`,(e,t)=>{k.init(e,t),ji.init(e,t)}),Ni=e(`ZodEmail`,(e,t)=>{At.init(e,t),U.init(e,t)}),Pi=e(`ZodGUID`,(e,t)=>{Ot.init(e,t),U.init(e,t)}),W=e(`ZodUUID`,(e,t)=>{kt.init(e,t),U.init(e,t)}),Fi=e(`ZodURL`,(e,t)=>{jt.init(e,t),U.init(e,t)}),Ii=e(`ZodEmoji`,(e,t)=>{Mt.init(e,t),U.init(e,t)}),Li=e(`ZodNanoID`,(e,t)=>{Nt.init(e,t),U.init(e,t)}),Ri=e(`ZodCUID`,(e,t)=>{Pt.init(e,t),U.init(e,t)}),zi=e(`ZodCUID2`,(e,t)=>{Ft.init(e,t),U.init(e,t)}),Bi=e(`ZodULID`,(e,t)=>{It.init(e,t),U.init(e,t)}),Vi=e(`ZodXID`,(e,t)=>{Lt.init(e,t),U.init(e,t)}),Hi=e(`ZodKSUID`,(e,t)=>{Rt.init(e,t),U.init(e,t)}),Ui=e(`ZodIPv4`,(e,t)=>{Ut.init(e,t),U.init(e,t)}),Wi=e(`ZodIPv6`,(e,t)=>{Wt.init(e,t),U.init(e,t)}),Gi=e(`ZodCIDRv4`,(e,t)=>{Gt.init(e,t),U.init(e,t)}),Ki=e(`ZodCIDRv6`,(e,t)=>{Kt.init(e,t),U.init(e,t)}),qi=e(`ZodBase64`,(e,t)=>{Jt.init(e,t),U.init(e,t)}),Ji=e(`ZodBase64URL`,(e,t)=>{Xt.init(e,t),U.init(e,t)}),Yi=e(`ZodE164`,(e,t)=>{Zt.init(e,t),U.init(e,t)}),Xi=e(`ZodJWT`,(e,t)=>{$t.init(e,t),U.init(e,t)}),Zi=e(`ZodNumber`,(e,t)=>{en.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wr(e,t,n,r),e.gt=(t,n)=>e.check(vr(t,n)),e.gte=(t,n)=>e.check(yr(t,n)),e.min=(t,n)=>e.check(yr(t,n)),e.lt=(t,n)=>e.check(_r(t,n)),e.lte=(t,n)=>e.check(P(t,n)),e.max=(t,n)=>e.check(P(t,n)),e.int=t=>e.check($i(t)),e.safe=t=>e.check($i(t)),e.positive=t=>e.check(vr(0,t)),e.nonnegative=t=>e.check(yr(0,t)),e.negative=t=>e.check(_r(0,t)),e.nonpositive=t=>e.check(P(0,t)),e.multipleOf=(t,n)=>e.check(br(t,n)),e.step=(t,n)=>e.check(br(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function G(e){return fr(Zi,e)}var Qi=e(`ZodNumberFormat`,(e,t)=>{tn.init(e,t),Zi.init(e,t)});function $i(e){return pr(Qi,e)}var ea=e(`ZodBoolean`,(e,t)=>{nn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gr(e,t,n,r)});function ta(e){return mr(ea,e)}var na=e(`ZodUnknown`,(e,t)=>{rn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ra(){return hr(na)}var ia=e(`ZodNever`,(e,t)=>{an.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kr(e,t,n,r)});function aa(e){return gr(ia,e)}var oa=e(`ZodArray`,(e,t)=>{sn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zr(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(F(t,n)),e.nonempty=t=>e.check(F(1,t)),e.max=(t,n)=>e.check(xr(t,n)),e.length=(t,n)=>e.check(Sr(t,n)),e.unwrap=()=>e.element});function sa(e,t){return Pr(oa,e,t)}var ca=e(`ZodObject`,(e,t)=>{dn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qr(e,t,n,r),d(e,`shape`,()=>t.shape),e.keyof=()=>X(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ra()}),e.loose=()=>e.clone({...e._zod.def,catchall:ra()}),e.strict=()=>e.clone({...e._zod.def,catchall:aa()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>de(e,t),e.safeExtend=t=>fe(e,t),e.merge=t=>pe(e,t),e.pick=t=>le(e,t),e.omit=t=>ue(e,t),e.partial=(...t)=>me(ba,e,t[0]),e.required=(...t)=>he(Aa,e,t[0])});function K(e,t){return new ca({type:`object`,shape:e??{},...v(t)})}var la=e(`ZodUnion`,(e,t)=>{pn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$r(e,t,n,r),e.options=t.options});function q(e,t){return new la({type:`union`,options:e,...v(t)})}var ua=e(`ZodDiscriminatedUnion`,(e,t)=>{la.init(e,t),mn.init(e,t)});function da(e,t,n){return new ua({type:`union`,options:t,discriminator:e,...v(n)})}var fa=e(`ZodIntersection`,(e,t)=>{hn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ei(e,t,n,r)});function J(e,t){return new fa({type:`intersection`,left:e,right:t})}var pa=e(`ZodRecord`,(e,t)=>{_n.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ti(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Y(e,t,n){return new pa({type:`record`,keyType:e,valueType:t,...v(n)})}function ma(e,t,n){let r=_(e);return r._zod.values=void 0,new pa({type:`record`,keyType:r,valueType:t,...v(n)})}var ha=e(`ZodEnum`,(e,t)=>{vn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qr(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ha({...t,checks:[],...v(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ha({...t,checks:[],...v(r),entries:i})}});function X(e,t){return new ha({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...v(t)})}var ga=e(`ZodLiteral`,(e,t)=>{yn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jr(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function _a(e,t){return new ga({type:`literal`,values:Array.isArray(e)?e:[e],...v(t)})}var va=e(`ZodTransform`,(e,t)=>{bn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xr(e,t,n,r),e._zod.parse=(r,i)=>{if(i.direction===`backward`)throw new n(e.constructor.name);r.addIssue=n=>{if(typeof n==`string`)r.issues.push(C(n,r.value,t));else{let t=n;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=r.value,t.inst??=e,r.issues.push(C(t))}};let a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});function ya(e){return new va({type:`transform`,transform:e})}var ba=e(`ZodOptional`,(e,t)=>{Sn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>li(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xa(e){return new ba({type:`optional`,innerType:e})}var Sa=e(`ZodExactOptional`,(e,t)=>{Cn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>li(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ca(e){return new Sa({type:`optional`,innerType:e})}var wa=e(`ZodNullable`,(e,t)=>{wn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ni(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ta(e){return new wa({type:`nullable`,innerType:e})}var Ea=e(`ZodDefault`,(e,t)=>{Tn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ii(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Da(e,t){return new Ea({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ae(t)}})}var Oa=e(`ZodPrefault`,(e,t)=>{Dn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ka(e,t){return new Oa({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ae(t)}})}var Aa=e(`ZodNonOptional`,(e,t)=>{On.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ri(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ja(e,t){return new Aa({type:`nonoptional`,innerType:e,...v(t)})}var Ma=e(`ZodCatch`,(e,t)=>{An.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Na(e,t){return new Ma({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Pa=e(`ZodPipe`,(e,t)=>{jn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>si(e,t,n,r),e.in=t.in,e.out=t.out});function Fa(e,t){return new Pa({type:`pipe`,in:e,out:t})}var Ia=e(`ZodReadonly`,(e,t)=>{Mn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ci(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function La(e){return new Ia({type:`readonly`,innerType:e})}var Ra=e(`ZodCustom`,(e,t)=>{Pn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yr(e,t,n,r)});function za(e,t={}){return Fr(Ra,e,t)}function Ba(e){return Ir(e)}var Z=K({minRem:G(),maxRem:G()}).or(H()),Q=K({0:H().optional(),50:H(),100:H(),200:H(),300:H(),400:H(),500:H(),600:H(),700:H(),800:H(),900:H(),950:H(),1e3:H().optional()}),$=K({color:H().optional(),background:H().optional(),borderWidth:H().optional(),borderColor:H().optional(),boxShadow:H().optional()}),Va=J(K({borderRadius:Z.optional(),custom:Y(H(),q([H(),G()])).optional(),hover:$.optional(),focus:$.optional()}),$),Ha=K({family:H().optional()}),Ua=ma(X(`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.chevronDownSmall.internalLink.externalLink.liip.avatar.avatarLarge.openChat.speechInput.listUnordered.lightMode.darkMode.avatarLarge.settings.settingsClose.sources.model.checkbox.warning.topic.headerLogo.embedAvatar`.split(`.`)),H()),Wa=K({font:Ha.optional(),colors:K({brand:Q,accent:Q.optional(),highlight:Q,grey:Q}),base:K({fontSizeXs:Z.optional(),fontSizeSm:Z.optional(),fontSizeBody:Z.optional(),fontSizeH3:Z.optional(),fontSizeH2:Z.optional(),fontSizeH1:Z.optional(),fontWeightNormal:H().optional(),fontWeightBold:H().optional(),fontWeightTitle:H().optional(),lineHeightDefault:H().optional(),lineHeightSnug:H().optional(),lineHeightTight:H().optional(),borderRadius:Z.optional(),lineColor:H().optional(),boxShadow:H().optional()}),components:Y(H(),Va),svgs:Ua}),Ga=K({customCSS:H().optional(),fontCSS:H().optional(),fontURLs:H().array().optional(),tokens:Wa});K({light:Ga,dark:Ga});var Ka=K({font:Ha.optional(),colors:K({brand:Q.partial().optional(),accent:Q.partial().optional(),highlight:Q.partial().optional(),grey:Q.partial().optional()}).optional(),base:K({fontSizeXs:Z.optional(),fontSizeSm:Z.optional(),fontSizeBody:Z.optional(),fontSizeH3:Z.optional(),fontSizeH2:Z.optional(),fontSizeH1:Z.optional(),fontWeightNormal:H().optional(),fontWeightBold:H().optional(),fontWeightTitle:H().optional(),lineHeightDefault:H().optional(),lineHeightSnug:H().optional(),lineHeightTight:H().optional(),borderRadius:Z.optional(),lineColor:H().optional(),boxShadow:H().optional()}).optional(),components:Y(H(),Va).optional(),svgs:Ua.optional()}),qa=K({customCSS:H().optional(),fontCSS:H().optional(),fontURLs:H().array().optional(),tokens:Ka.optional()}),Ja=K({light:qa.optional(),dark:qa.optional()}),Ya=K({50:H(),100:H(),200:H(),300:H(),400:H(),500:H(),600:H(),700:H(),800:H(),900:H(),950:H()}),Xa=X([`slate`,`gray`,`zinc`,`neutral`,`stone`,`red`,`orange`,`amber`,`yellow`,`lime`,`green`,`emerald`,`teal`,`cyan`,`sky`,`blue`,`indigo`,`violet`,`purple`,`fuchsia`,`pink`,`rose`]),Za=q([Ya,Xa]),Qa=q([J(Ya,K({0:H(),1e3:H()})),Xa]),$a=K({avatarImageUrl:H().optional(),colors:K({brand:Za.optional(),highlight:Za.optional(),grey:Qa.optional(),background:H().optional(),text:H().optional(),anchor:K({default:H().optional(),hover:H().optional()}).optional()}).optional(),font:K({family:H().optional(),urls:sa(H()).optional(),sizeXs:Z.optional(),sizeSm:Z.optional(),sizeBody:Z.optional(),sizeH3:Z.optional(),sizeH2:Z.optional(),sizeH1:Z.optional(),weightNormal:H().optional(),weightBold:H().optional(),weightTitle:H().optional()}).optional(),borderRadius:Z.optional(),fineGrained:Ja.optional()});export{da as a,G as c,Y as d,H as f,ta as i,K as l,ra as m,X as n,J as o,q as p,sa as r,_a as s,$a as t,ma as u};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{H as e,It as t,J as n,Lt as r,Y as i,bt as a,et as o,i as s,jt as c,k as l,o as u,q as d,tt as f}from"./C00ruT0L.js";import{t as p}from"./CKDKLu5Y.js";import{t as m}from"./BwV52vQs.js";var h=(e,t)=>{let n=new URLSearchParams(m.url.searchParams);t===void 0?n.delete(e):n.set(e,String(t));let r=`?${n.toString()}`;window.top&&window.top.postMessage(`liipgpt-url:`+r,`*`),p(r,{replaceState:!0})},g=e=>{let t=new URLSearchParams(m.url.searchParams);for(let[n,r]of Object.entries(e))r===void 0?t.delete(n):t.set(n,String(r));let n=`?${t.toString()}`;window.top&&window.top.postMessage(`liipgpt-url:`+n,`*`),p(n,{replaceState:!0})},_=i(`<button type="button" class="sidebar-hide svelte-q6hwt7" aria-label="Hide sidebar">Hide sidebar</button>`),v=i(`<button type="button" class="sidebar-reopen svelte-q6hwt7" aria-label="Show sidebar"><span class="sidebar-reopen__label svelte-q6hwt7" aria-hidden="true">Show sidebar</span></button>`),y={hash:`svelte-q6hwt7`,code:`.sidebar-hide.svelte-q6hwt7 {display:block;padding:0.375rem 0.75rem;border:1px solid #e5e7eb;border-radius:0.375rem;background:#fff;color:#4b5563;font-weight:500;font-size:0.75rem;line-height:1.25;font-family:system-ui, sans-serif;cursor:pointer;}.sidebar-hide.svelte-q6hwt7:hover {background:#f3f4f6;color:#111827;}.sidebar-reopen.svelte-q6hwt7 {display:flex;z-index:50;position:fixed;bottom:5rem;left:0;align-items:center;justify-content:center;padding:0.5rem 0.25rem;border:1px solid #e5e7eb;border-left:none;border-radius:0 0.375rem 0.375rem 0;background:#fff;box-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1),
|
|
2
|
+
0 1px 2px -1px rgb(0 0 0 / 0.1);color:#4b5563;font-weight:500;font-size:0.6rem;font-family:system-ui, sans-serif;cursor:pointer;}.sidebar-reopen.svelte-q6hwt7:hover {background:#f3f4f6;color:#111827;}.sidebar-reopen__label.svelte-q6hwt7 {letter-spacing:0.04em;text-orientation:mixed;writing-mode:vertical-rl;}
|
|
3
|
+
|
|
4
|
+
@media (prefers-color-scheme: dark) {.sidebar-hide.svelte-q6hwt7 {border-color:#4b5563;background:#1f2937;color:#d1d5db;}.sidebar-hide.svelte-q6hwt7:hover {background:#374151;color:#f3f4f6;}.sidebar-reopen.svelte-q6hwt7 {border-color:#4b5563;background:#1f2937;color:#d1d5db;}.sidebar-reopen.svelte-q6hwt7:hover {background:#374151;color:#f3f4f6;}
|
|
5
|
+
}`};function b(i,o){r(o,!0),l(i,y);let s=u(o,`mode`,7),g=e=>{if(typeof window<`u`&&window.top!==window.self){h(`hide-sidebar`,e?!0:void 0);return}let t=new URLSearchParams(m.url.searchParams);e?t.set(`hide-sidebar`,`true`):t.delete(`hide-sidebar`),p(`?${t.toString()}`,{replaceState:!0})};var b={get mode(){return s()},set mode(e){s(e),c()}},x=n(),S=a(x),C=e=>{var t=_();f(`click`,t,()=>g(!0)),d(e,t)},w=e=>{var t=v();f(`click`,t,()=>g(!1)),d(e,t)};return e(S,e=>{s()===`hide`?e(C):e(w,-1)}),d(i,x),t(b)}o([`click`]),s(b,{mode:{}},[],[],{mode:`open`});export{h as n,g as r,b as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){let t=String(e).trim();return/^\d+(\.\d+)?$/.test(t)?`${t}px`:t}function t(e){let t=e.match(/^(\d+(?:\.\d+)?)px$/);return t?Number.parseFloat(t[1]):null}function n(e,t){let n=e.style.height;e.style.height=t;let r=e.offsetHeight;return e.style.height=n,r}var r=t(e(`280`));export{t as i,n,e as r,r as t};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var e=`https://liipgpt.api.dev.genai.liip.ch/liipgpt`,t=`3.6.0`,n=new Map;async function r(e){let t=n.get(e);if(t)return t;let r=await fetch(e),i=r.url,a=await r.arrayBuffer(),o=await crypto.subtle.digest(`SHA-384`,a),s={versionedUrl:i,integrity:`sha384-${btoa(String.fromCharCode(...new Uint8Array(o)))}`};return n.set(e,s),s}var i=/\/\*\s*@host-class:\s*([a-zA-Z_-][\w-]*)\s*\*\//;function a(e,t=`your-custom-class-wrapper`){let n=e.match(i);if(n)return n[1];let r=e.match(/\.([a-zA-Z_-][\w-]*)\s+\.search-summary\b/);if(r)return r[1];let a=e.match(/liipgpt-search-summary\.([a-zA-Z_-][\w-]*)/);return a?a[1]:t}var o=`/* Host tokens — set on the custom element, inherited by .search-summary and descendants */
|
|
2
|
+
liipgpt-search-summary.your-custom-class-wrapper {
|
|
3
|
+
--search-summary-padding: 1rem;
|
|
4
|
+
--search-summary-background: #fff;
|
|
5
|
+
--search-summary-footer-background: #fff;
|
|
6
|
+
}
|
|
7
|
+
.your-custom-class-wrapper .search-summary {
|
|
8
|
+
--search-summary-background: #fff;
|
|
9
|
+
--search-summary-footer-background: #fff;
|
|
10
|
+
padding: var(--search-summary-padding);
|
|
11
|
+
padding-bottom: 0;
|
|
12
|
+
border: 1px solid #e2e8f0;
|
|
13
|
+
border-radius: 0.5rem;
|
|
14
|
+
background: var(--search-summary-background);
|
|
15
|
+
color: #1a202c;
|
|
16
|
+
font-family: system-ui, sans-serif;
|
|
17
|
+
}
|
|
18
|
+
.your-custom-class-wrapper .search-summary__link,
|
|
19
|
+
.your-custom-class-wrapper .search-summary__disclaimer a {
|
|
20
|
+
color: #c44b00;
|
|
21
|
+
}
|
|
22
|
+
/* Slot button styles */
|
|
23
|
+
.your-custom-class-btn {
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
padding: 0.5rem 1rem;
|
|
27
|
+
border: 1px solid #c44b00;
|
|
28
|
+
border-radius: 0.25rem;
|
|
29
|
+
background: transparent;
|
|
30
|
+
color: #c44b00;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
font-size: inherit;
|
|
33
|
+
}
|
|
34
|
+
.your-custom-class-btn--primary {
|
|
35
|
+
background: #c44b00;
|
|
36
|
+
border-color: #c44b00;
|
|
37
|
+
color: #fff;
|
|
38
|
+
}
|
|
39
|
+
.your-custom-class-btn--secondary {
|
|
40
|
+
border-color: transparent;
|
|
41
|
+
background: transparent;
|
|
42
|
+
color: #c44b00;
|
|
43
|
+
}`,s=null;function c(e){s||(s=document.createElement(`style`),s.id=`preview-css-injection`,document.head.appendChild(s)),s.textContent=e}function l(){s?.remove(),s=null}var u=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`'`).replace(/\n/g,` `),d=(e,t)=>{if(t!==void 0){if(typeof t==`string`)return`${e}="${u(t)}"`;if(typeof t==`boolean`)return t?e:void 0}},f=(e,n)=>n===`search-summary`?e.cdn.value?`https://cdn.jsdelivr.net/npm/@liip/liipgpt@${t}/search-summary/liipgpt-search-summary.iife.min.js`:`${e[`api-url`].value}/cdn/npm/@liip/liipgpt/search-summary/liipgpt-search-summary.iife.min.js`:e.cdn.value?`https://cdn.jsdelivr.net/npm/@liip/liipgpt@${t}/${n}/liipgpt-${n}.iife.min.js`:`${e[`api-url`].value}/cdn/npm/@liip/liipgpt/${n}/liipgpt-${n}.iife.min.js`,p=(e,t)=>t?`<script async src="${t.versionedUrl}" integrity="${t.integrity}" crossorigin="anonymous"><\/script>`:`<script async src="${e}"><\/script>`,m=(e,t,n)=>{let r=`<liipgpt-button ${[d(`lang`,e.lang.value),d(`force-theme`,e?.[`force-theme`]?.value),d(`api-url`,e[`api-url`].value),d(`button-class`,e[`button-class`]?.value),d(`button-style`,e[`button-style`]?.value)].filter(Boolean).join(` `)}</liipgpt-button>`;if(t){let t=`${p(f(e,`button`),n)}\n${r}`;return e.CHAT_CONFIG_OVERRIDE.value&&(t=`<script>\n${e.CHAT_CONFIG_OVERRIDE.value}<\/script>\n`+t),e.onclosechat.value&&(t+=`\n<script>${e.onclosechat.value}<\/script>`),t}return r},h=(e,t,n)=>{let r=`<liipgpt-chat ${[d(`lang`,e.lang.value),d(`force-theme`,e?.[`force-theme`]?.value),d(`api-url`,e[`api-url`].value),d(`loader-background`,e[`loader-background`].value),d(`loader-color`,e[`loader-color`].value),d(`flyout`,e.flyout.value),d(`flyout-style`,e[`flyout-style`].value),d(`flyout-class`,e[`flyout-class`].value),d(`chat-class`,e[`chat-class`].value),d(`inline-layout`,e[`inline-layout`].value),d(`force-chat-page`,e[`force-chat-page`].value),d(`autofire-predefined-question-id`,e[`autofire-predefined-question-id`].value)].filter(Boolean).join(` `)}>${e[`custom-loader`].value?`<div slot="loader">${e[`custom-loader`].value}</div>`:``}</liipgpt-chat>`;if(t){let t=`${p(f(e,`chat`),n)}\n${r}`;return e.CHAT_CONFIG_OVERRIDE.value&&(t=`<script>\n${e.CHAT_CONFIG_OVERRIDE.value}<\/script>\n`+t),e.onclosechat.value&&(t+=`\n<script>${e.onclosechat.value}<\/script>`),t}return r},g=`ai-overview`,_={de:`KI-Übersicht`,en:`AI overview`,fr:`Aperçu IA`,it:`Panoramica IA`},v=`<p><strong>Get an AI-generated summary above your search results.</strong></p>
|
|
44
|
+
<p>When enabled, an AI overview will appear at the top of every search results page, synthesising the most relevant information for your query. Classical search results remain accessible below.</p>
|
|
45
|
+
<p>AI-generated answers may not always be accurate. <a href="https://example.com/privacy">Privacy policy</a></p>`,y=`<button
|
|
46
|
+
type="button"
|
|
47
|
+
slot="activate-ai-button"
|
|
48
|
+
class="your-custom-class-btn your-custom-class-btn--primary"
|
|
49
|
+
>
|
|
50
|
+
Enable AI
|
|
51
|
+
</button>
|
|
52
|
+
<button
|
|
53
|
+
type="button"
|
|
54
|
+
slot="expand-answer-button"
|
|
55
|
+
class="your-custom-class-btn your-custom-class-btn--primary"
|
|
56
|
+
>
|
|
57
|
+
Full answer
|
|
58
|
+
</button>
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
slot="deactivate-ai-button"
|
|
62
|
+
class="your-custom-class-btn your-custom-class-btn--secondary"
|
|
63
|
+
>
|
|
64
|
+
Disable AI
|
|
65
|
+
</button>`,b=(e,t,n)=>{let r=typeof window<`u`&&new URLSearchParams(window.location.search).get(`q`)||`What is liip?`,i=typeof e.lang.value==`string`?e.lang.value:`en`,s=_[i]??_.en,c=e[`use-chat-config`]?.value,l=e[`host-css`]?.value,m=a((!c&&typeof l==`string`?l:``)||o),h=[d(`lang`,i),d(`api-url`,e[`api-url`].value),d(`question`,r),d(`labelled-by`,g),d(`height`,e.height?.value??`280`),d(`opt-in`,e[`opt-in`]?.value),d(`use-chat-config`,c),c?d(`force-theme`,e?.[`force-theme`]?.value):void 0,c?void 0:d(`class`,m)].filter(Boolean),y=e[`disclaimer-slot`]?.value,b=typeof y==`string`?y:v,x=!c&&e[`opt-in`]?.value?`\n <div slot="disclaimer">\n ${b.trim().replace(/\n/g,`
|
|
66
|
+
`)}\n </div>`:``,S=e[`buttons-slots`]?.value,C=typeof S==`string`?S.trim():``,w=!c&&C?`\n ${C.replace(/\n/g,`
|
|
67
|
+
`)}`:``,T=`<liipgpt-search-summary\n ${h.join(`
|
|
68
|
+
`)}\n>${x}${w}\n</liipgpt-search-summary>`,E=`${`<h2 id="${g}">${u(s)}</h2>`}\n${T}`;if(t){let t=f(e,`search-summary`),r=e[`host-css`]?.value,i=!c&&typeof r==`string`?r:``,a=i.split(`
|
|
69
|
+
`).map(e=>e.trim()?` `+e:``).join(`
|
|
70
|
+
`),o=i?`<style>\n${a}\n</style>\n`:``;return`${p(t,n)}\n${o}${E}`}return E},x=(e,t,n=!1)=>t===`link-button`?m(e,n):t===`search-summary`?b(e,n):h(e,n),S=async(e,t,n=!1)=>{if(!e[`use-sri`]?.value||!n)return x(e,t,n);let i=await r(f(e,t===`link-button`?`button`:t===`search-summary`?`search-summary`:`chat`));return t===`link-button`?m(e,n,i):t===`search-summary`?b(e,n,i):h(e,n,i)};export{f as a,l as c,S as i,e as l,v as n,o,x as r,c as s,y as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.D_2XXaJQ.js","../chunks/CibALFW0.js","../chunks/zUel1ZW0.js","../chunks/C00ruT0L.js","../chunks/DV91TmsB.js","../chunks/MRyhzcyW.js","../chunks/CFKVnMbq.js","../chunks/Ct405RO9.js","../chunks/tFLMI64R.js","../nodes/1.BnWVDJCZ.js","../chunks/CKDKLu5Y.js","../chunks/BwV52vQs.js","../chunks/DVeOoWpz.js","../chunks/Bo0U8J3e.js","../nodes/2.SUtdjb5A.js","../chunks/DjVmpym-.js","../chunks/CFfgUb3G.js","../chunks/EDJuo58-.js","../chunks/CX0dfddQ.js","../chunks/DUr69vGU.js","../chunks/DFBUyDYh.js","../chunks/CqCdl07t.js","../chunks/qE7I_Q4N.js","../nodes/3.Bo3t-YCM.js","../chunks/B2vNY6lx.js","../chunks/Db3xJ3R_.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{Et as e,F as t,G as n,H as r,It as i,J as a,Lt as o,Ot as s,Q as c,Wt as l,Y as u,a as d,at as f,bt as p,ht as m,i as h,jt as g,mt as _,o as v,pt as y,q as b,r as x,st as S,u as C,wt as w,xt as T,yt as E}from"../chunks/C00ruT0L.js";import{t as D}from"../chunks/DjVmpym-.js";import"../chunks/CFKVnMbq.js";var O={},k=u(`<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>`),A=u(`<!> <!>`,1);function j(u,d){o(d,!0);let h=v(d,`stores`,7),D=v(d,`page`,7),O=v(d,`constructors`,7),j=v(d,`components`,23,()=>[]),M=v(d,`form`,7),N=v(d,`data_0`,7,null),P=v(d,`data_1`,7,null);m(()=>h().page.set(D())),_(()=>{h(),D(),O(),j(),M(),N(),P(),h().page.notify()});let F=e(!1),I=e(!1),L=e(null);x(()=>{let e=h().page.subscribe(()=>{f(F)&&(w(I,!0),S().then(()=>{w(L,document.title||`untitled page`,!0)}))});return w(F,!0),e});let R=s(()=>O()[1]);var z={get stores(){return h()},set stores(e){h(e),g()},get page(){return D()},set page(e){D(e),g()},get constructors(){return O()},set constructors(e){O(e),g()},get components(){return j()},set components(e=[]){j(e),g()},get form(){return M()},set form(e){M(e),g()},get data_0(){return N()},set data_0(e=null){N(e),g()},get data_1(){return P()},set data_1(e=null){P(e),g()}},B=A(),V=p(B),H=e=>{let n=s(()=>O()[0]);var r=a();t(p(r),()=>f(n),(e,n)=>{C(n(e,{get data(){return N()},get form(){return M()},get params(){return D().params},children:(e,n)=>{var r=a();t(p(r),()=>f(R),(e,t)=>{C(t(e,{get data(){return P()},get form(){return M()},get params(){return D().params}}),e=>j()[1]=e,()=>j()?.[1])}),b(e,r)},$$slots:{default:!0}}),e=>j()[0]=e,()=>j()?.[0])}),b(e,r)},U=e=>{let n=s(()=>O()[0]);var r=a();t(p(r),()=>f(n),(e,t)=>{C(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params}}),e=>j()[0]=e,()=>j()?.[0])}),b(e,r)};r(V,e=>{O()[1]?e(H):e(U,-1)});var W=T(V,2),G=e=>{var t=k(),i=E(t),a=e=>{var t=c();y(()=>n(t,f(L))),b(e,t)};r(i,e=>{f(I)&&e(a)}),l(t),b(e,t)};return r(W,e=>{f(F)&&e(G)}),b(u,B),i(z)}h(j,{stores:{},page:{},constructors:{},components:{},form:{},data_0:{},data_1:{}},[],[],{mode:`open`});var M=d(j),N=[()=>D(()=>import(`../nodes/0.D_2XXaJQ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),()=>D(()=>import(`../nodes/1.BnWVDJCZ.js`),__vite__mapDeps([9,10,3,1,11,6,12,13]),import.meta.url),()=>D(()=>import(`../nodes/2.SUtdjb5A.js`),__vite__mapDeps([14,10,3,1,2,15,16,17,5,18,19,20,4,21,22,11,6,12,13,8]),import.meta.url),()=>D(()=>import(`../nodes/3.Bo3t-YCM.js`),__vite__mapDeps([23,10,3,1,2,16,17,5,18,19,15,20,4,21,22,11,24,25,6,12,13,7,8]),import.meta.url)],P=[],F={"/":[2],"/sidebar":[3]},I={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},L=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.decode])),R=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.encode])),z=!1,B=(e,t)=>L[e](t);export{B as decode,L as decoders,F as dictionary,R as encoders,z as hash,I as hooks,O as matchers,N as nodes,M as root,P as server_loads};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../chunks/C00ruT0L.js";import{n as e,s as t}from"../chunks/CKDKLu5Y.js";import"../chunks/Bo0U8J3e.js";export{t as load_css,e as start};
|