@ziteh/yangchun-comment-client 0.1.0 → 0.2.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +6 -0
  2. package/dist/src/api/apiService.d.ts +22 -0
  3. package/dist/src/api/globalApiService.d.ts +10 -0
  4. package/dist/src/components/comment-admin.d.ts +25 -0
  5. package/dist/src/components/comment-dialog.d.ts +18 -0
  6. package/dist/src/components/comment-info.d.ts +14 -0
  7. package/dist/src/components/comment-input.d.ts +31 -0
  8. package/dist/src/components/list/comment-list-item.d.ts +19 -0
  9. package/dist/src/components/list/comment-list.d.ts +9 -0
  10. package/dist/src/components/yangchun-comment.d.ts +58 -0
  11. package/dist/src/components/yangchun-comment.styles.d.ts +2 -0
  12. package/dist/src/index.d.ts +1 -0
  13. package/dist/src/utils/comment.d.ts +6 -0
  14. package/dist/src/utils/format.d.ts +2 -0
  15. package/dist/src/utils/i18n.d.ts +46 -0
  16. package/dist/src/utils/pow.d.ts +9 -0
  17. package/dist/{utils → src/utils}/pseudonym.d.ts +0 -1
  18. package/dist/src/utils/sanitize.d.ts +1 -0
  19. package/dist/test/sanitize.test.d.ts +1 -0
  20. package/dist/yangchun-comment.js +962 -0
  21. package/dist/yangchun-comment.js.map +1 -0
  22. package/dist/yangchun-comment.umd.cjs +962 -0
  23. package/dist/yangchun-comment.umd.cjs.map +1 -0
  24. package/package.json +17 -13
  25. package/dist/element.d.ts +0 -97
  26. package/dist/element.js +0 -680
  27. package/dist/index.d.ts +0 -9
  28. package/dist/index.js +0 -23
  29. package/dist/types.d.ts +0 -3
  30. package/dist/utils/apiService.d.ts +0 -15
  31. package/dist/utils/apiService.js +0 -118
  32. package/dist/utils/format.d.ts +0 -1
  33. package/dist/utils/format.js +0 -14
  34. package/dist/utils/i18n.d.ts +0 -51
  35. package/dist/utils/i18n.js +0 -98
  36. package/dist/utils/pseudonym.js +0 -34
  37. package/dist/utils/sanitize.d.ts +0 -4
  38. package/dist/utils/sanitize.js +0 -59
  39. package/dist/utils/wordBank.js +0 -692
  40. package/dist/views/comments.d.ts +0 -3
  41. package/dist/views/comments.js +0 -119
  42. package/dist/views/preview.d.ts +0 -3
  43. package/dist/views/preview.js +0 -53
  44. package/dist/yangchun-comment.css +0 -1
  45. package/dist/yangchun-comment.es.js +0 -317
  46. package/dist/yangchun-comment.es.js.map +0 -1
  47. package/dist/yangchun-comment.umd.js +0 -317
  48. package/dist/yangchun-comment.umd.js.map +0 -1
  49. /package/dist/{types.js → src/utils/pow.worker.d.ts} +0 -0
  50. /package/dist/{utils → src/utils}/wordBank.d.ts +0 -0
@@ -0,0 +1,962 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).YangchunComment={})}(this,function(e){"use strict";const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),i=new WeakMap;let s=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=(e,...t)=>{const n=1===e.length?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[r+1],e[0]);return new s(n,e,r)},a=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new s("string"==typeof e?e:e+"",void 0,r))(t)})(e):e,{is:c,defineProperty:l,getOwnPropertyDescriptor:u,getOwnPropertyNames:h,getOwnPropertySymbols:d,getPrototypeOf:p}=Object,m=globalThis,f=m.trustedTypes,g=f?f.emptyScript:"",y=m.reactiveElementPolyfillSupport,b=(e,t)=>e,v={toAttribute(e,t){switch(t){case Boolean:e=e?g:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(r){n=null}}return n}},k=(e,t)=>!c(e,t),w={attribute:!0,type:String,converter:v,reflect:!1,useDefault:!1,hasChanged:k};Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let _=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=w){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(e,n,t);void 0!==r&&l(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){const{get:r,set:i}=u(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){const s=r?.call(this);i?.call(this,t),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??w}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=p(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...h(e),...d(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const e=this._$Eu(t,n);void 0!==e&&this._$Eh.set(e,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(a(e))}else void 0!==e&&t.push(a(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,r)=>{if(n)e.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const n of r){const r=document.createElement("style"),i=t.litNonce;void 0!==i&&r.setAttribute("nonce",i),r.textContent=n.cssText,e.appendChild(r)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(void 0!==r&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:v).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,r=n._$Eh.get(e);if(void 0!==r&&this._$Em!==r){const e=n.getPropertyOptions(r),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:v;this._$Em=r;const s=i.fromAttribute(t,e.type);this[r]=s??this._$Ej?.get(r)??s,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const r=this.constructor,i=this[e];if(n??=r.getPropertyOptions(e),!((n.hasChanged??k)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},s){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),!0!==i||void 0!==s)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||void 0===r||this.C(t,void 0,n,r)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[b("elementProperties")]=new Map,_[b("finalized")]=new Map,y?.({ReactiveElement:_}),(m.reactiveElementVersions??=[]).push("2.1.1");const x=globalThis,$=x.trustedTypes,S=$?$.createPolicy("lit-html",{createHTML:e=>e}):void 0,A="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,C="?"+E,T=`<${C}>`,z=document,P=()=>z.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,M=Array.isArray,I="[ \t\n\f\r]",N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,L=/>/g,D=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,U=/"/g,F=/^(?:script|style|textarea|title)$/i,Z=(q=1,(e,...t)=>({_$litType$:q,strings:e,values:t})),B=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),H=new WeakMap,G=z.createTreeWalker(z,129);var q;function J(e,t){if(!M(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(t):t}let V=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let s=0,o=0;const a=t.length-1,c=this.parts,[l,u]=((e,t)=>{const n=e.length-1,r=[];let i,s=2===t?"<svg>":3===t?"<math>":"",o=N;for(let a=0;a<n;a++){const t=e[a];let n,c,l=-1,u=0;for(;u<t.length&&(o.lastIndex=u,c=o.exec(t),null!==c);)u=o.lastIndex,o===N?"!--"===c[1]?o=R:void 0!==c[1]?o=L:void 0!==c[2]?(F.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=D):void 0!==c[3]&&(o=D):o===D?">"===c[0]?(o=i??N,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,n=c[1],o=void 0===c[3]?D:'"'===c[3]?U:j):o===U||o===j?o=D:o===R||o===L?o=N:(o=D,i=void 0);const h=o===D&&e[a+1].startsWith("/>")?" ":"";s+=o===N?t+T:l>=0?(r.push(n),t.slice(0,l)+A+t.slice(l)+E+h):t+E+(-2===l?a:h)}return[J(e,s+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),r]})(t,n);if(this.el=e.createElement(l,r),G.currentNode=this.el.content,2===n||3===n){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=G.nextNode())&&c.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(A)){const t=u[o++],n=i.getAttribute(e).split(E),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:s,name:r[2],strings:n,ctor:"."===r[1]?ee:"?"===r[1]?te:"@"===r[1]?ne:Q}),i.removeAttribute(e)}else e.startsWith(E)&&(c.push({type:6,index:s}),i.removeAttribute(e));if(F.test(i.tagName)){const e=i.textContent.split(E),t=e.length-1;if(t>0){i.textContent=$?$.emptyScript:"";for(let n=0;n<t;n++)i.append(e[n],P()),G.nextNode(),c.push({type:2,index:++s});i.append(e[t],P())}}}else if(8===i.nodeType)if(i.data===C)c.push({type:2,index:s});else{let e=-1;for(;-1!==(e=i.data.indexOf(E,e+1));)c.push({type:7,index:s}),e+=E.length-1}s++}}static createElement(e,t){const n=z.createElement("template");return n.innerHTML=e,n}};function Y(e,t,n=e,r){if(t===B)return t;let i=void 0!==r?n._$Co?.[r]:n._$Cl;const s=O(t)?void 0:t._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),void 0===s?i=void 0:(i=new s(e),i._$AT(e,n,r)),void 0!==r?(n._$Co??=[])[r]=i:n._$Cl=i),void 0!==i&&(t=Y(e,i._$AS(e,t.values),i,r)),t}let X=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??z).importNode(t,!0);G.currentNode=r;let i=G.nextNode(),s=0,o=0,a=n[0];for(;void 0!==a;){if(s===a.index){let t;2===a.type?t=new K(i,i.nextSibling,this,e):1===a.type?t=new a.ctor(i,a.name,a.strings,this,e):6===a.type&&(t=new re(i,this,e)),this._$AV.push(t),a=n[++o]}s!==a?.index&&(i=G.nextNode(),s++)}return G.currentNode=z,r}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}};class K{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=W,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Y(this,e,t),O(e)?e===W||null==e||""===e?(this._$AH!==W&&this._$AR(),this._$AH=W):e!==this._$AH&&e!==B&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>M(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(z.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,r="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=V.createElement(J(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{const e=new X(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=H.get(e.strings);return void 0===t&&H.set(e.strings,t=new V(e)),t}k(e){M(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,r=0;for(const i of e)r===t.length?t.push(n=new K(this.O(P()),this.O(P()),this,this.options)):n=t[r],n._$AI(i),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}let Q=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=W,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,r){const i=this.strings;let s=!1;if(void 0===i)e=Y(this,e,t,0),s=!O(e)||e!==this._$AH&&e!==B,s&&(this._$AH=e);else{const r=e;let o,a;for(e=i[0],o=0;o<i.length-1;o++)a=Y(this,r[n+o],t,o),a===B&&(a=this._$AH[o]),s||=!O(a)||a!==this._$AH[o],a===W?e=W:e!==W&&(e+=(a??"")+i[o+1]),this._$AH[o]=a}s&&!r&&this.j(e)}j(e){e===W?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}};class ee extends Q{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===W?void 0:e}}let te=class extends Q{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==W)}},ne=class extends Q{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=Y(this,e,t,0)??W)===B)return;const n=this._$AH,r=e===W&&n!==W||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==W&&(n===W||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},re=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Y(this,e)}};const ie=x.litHtmlPolyfillSupport;ie?.(V,K),(x.litHtmlVersions??=[]).push("3.3.1");const se=globalThis;let oe=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const r=n?.renderBefore??t;let i=r._$litPart$;if(void 0===i){const e=n?.renderBefore??null;r._$litPart$=i=new K(t.insertBefore(P(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return B}};oe._$litElement$=!0,oe.finalized=!0,se.litElementHydrateSupport?.({LitElement:oe});const ae=se.litElementPolyfillSupport;ae?.({LitElement:oe}),(se.litElementVersions??=[]).push("4.2.1");const ce=e=>(t,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},le={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:k},ue=(e=le,t,n)=>{const{kind:r,metadata:i}=n;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===r&&((e=Object.create(e)).wrapped=!0),s.set(n.name,e),"accessor"===r){const{name:r}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e)},init(t){return void 0!==t&&this.C(r,void 0,e,t),t}}}if("setter"===r){const{name:r}=n;return function(n){const i=this[r];t.call(this,n),this.requestUpdate(r,i,e)}}throw Error("Unsupported decorator location: "+r)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function de(e){return he({...e,state:!0,attribute:!1})}function pe(e,t){return(t,n,r)=>((e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,n),n))(t,n,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}const me=o`
2
+ :host {
3
+ --ycc-primary-color: #2563eb;
4
+ --ycc-primary-hover: #1d4ed8;
5
+ --ycc-text-color: #1f2937;
6
+ --ycc-text-secondary: #6b7280;
7
+ --ycc-placeholder-color: #9ca3af;
8
+ --ycc-bg-color: #ffffff;
9
+ --ycc-bg-secondary: #f3f4f6;
10
+ --ycc-border-color: #e5e7eb;
11
+ --ycc-error-color: #ef4444;
12
+
13
+ --ycc-spacing-xs: 4px;
14
+ --ycc-spacing-s: 8px;
15
+ --ycc-spacing-m: 16px;
16
+ --ycc-spacing-l: 24px;
17
+
18
+ --ycc-font-family: sans-serif;
19
+ --ycc-font-monospace: ui-monospace, monospace;
20
+ --ycc-font-size: 14px;
21
+ --ycc-line-height: 1.5;
22
+ --ycc-radius: 6px;
23
+ }
24
+ `,fe=o`
25
+ :host {
26
+ display: block;
27
+ }
28
+
29
+ .root {
30
+ font-family: var(--ycc-font-family);
31
+ color: var(--ycc-text-color);
32
+ line-height: var(--ycc-line-height);
33
+ font-size: var(--ycc-font-size);
34
+ }
35
+
36
+ button {
37
+ background-color: var(--ycc-primary-color);
38
+ color: white;
39
+ border: none;
40
+ padding: var(--ycc-spacing-s) var(--ycc-spacing-m);
41
+ border-radius: var(--ycc-radius);
42
+ cursor: pointer;
43
+ font-size: var(--ycc-font-size);
44
+ transition: background-color 0.2s;
45
+ }
46
+ button:hover {
47
+ background-color: var(--ycc-primary-hover);
48
+ }
49
+ button:disabled {
50
+ opacity: 0.5;
51
+ cursor: not-allowed;
52
+ }
53
+ button.secondary {
54
+ background-color: var(--ycc-border-color);
55
+ color: var(--ycc-text-color);
56
+ }
57
+ button.secondary:hover {
58
+ background-color: var(--ycc-bg-secondary);
59
+ color: var(--ycc-text-secondary);
60
+ }
61
+ button.outline {
62
+ background-color: transparent;
63
+ color: var(--ycc-text-secondary);
64
+ border: 1px solid var(--ycc-border-color);
65
+ }
66
+ button.outline:hover {
67
+ background-color: var(--ycc-bg-secondary);
68
+ color: var(--ycc-text-color);
69
+ }
70
+ button.text-btn {
71
+ background: none;
72
+ border: none;
73
+ color: var(--ycc-text-secondary);
74
+ padding: 0;
75
+ font-size: 0.9em;
76
+ }
77
+ button.text-btn:hover {
78
+ color: var(--ycc-primary-color);
79
+ background: none;
80
+ text-decoration: underline;
81
+ }
82
+
83
+ input[type='text'],
84
+ textarea {
85
+ width: 100%;
86
+ padding: var(--ycc-spacing-s);
87
+ border-radius: var(--ycc-radius);
88
+ font-family: inherit;
89
+ font-size: inherit;
90
+ box-sizing: border-box; /* Important for width: 100% */
91
+ }
92
+ input[type='text']:focus,
93
+ textarea:focus {
94
+ outline: none;
95
+ border-color: var(--ycc-primary-color);
96
+ }
97
+ `;const ge=new class{constructor(){this.instance=null}setInstance(e){this.instance=e}getInstance(){if(!this.instance)throw new Error("ApiService instance is not set");return this.instance}isInitialized(){return null!==this.instance}clear(){this.instance=null}},ye=2,be=e=>(...t)=>({_$litDirective$:e,values:t});let ve=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};class ke extends ve{constructor(e){if(super(e),this.it=W,e.type!==ye)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===W||null==e)return this._t=void 0,this.it=e;if(e===B)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}ke.directiveName="unsafeHTML",ke.resultType=1;const we=be(ke),_e=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const r of n)r._$AO?.(t,!1),_e(r,t);return!0},xe=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},$e=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),Ee(t)}};function Se(e){void 0!==this._$AN?(xe(this),this._$AM=e,$e(this)):this._$AM=e}function Ae(e,t=!1,n=0){const r=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(r))for(let s=n;s<r.length;s++)_e(r[s],!1),xe(r[s]);else null!=r&&(_e(r,!1),xe(r));else _e(this,e)}const Ee=e=>{e.type==ye&&(e._$AP??=Ae,e._$AQ??=Se)};class Ce extends ve{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),$e(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(_e(this,e),xe(this))}setValue(e){if(void 0===this._$Ct.strings)this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}class Te{constructor(e){this.G=e}disconnect(){this.G=void 0}reconnect(e){this.G=e}deref(){return this.G}}class ze{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(e=>this.Z=e)}resume(){this.Z?.(),this.Y=this.Z=void 0}}const Pe=e=>{return!(t=e,null===t||"object"!=typeof t&&"function"!=typeof t||"function"!=typeof e.then);var t},Oe=1073741823;const Me=be(class extends Ce{constructor(){super(...arguments),this._$Cwt=Oe,this._$Cbt=[],this._$CK=new Te(this),this._$CX=new ze}render(...e){return e.find(e=>!Pe(e))??B}update(e,t){const n=this._$Cbt;let r=n.length;this._$Cbt=t;const i=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let o=0;o<t.length&&!(o>this._$Cwt);o++){const e=t[o];if(!Pe(e))return this._$Cwt=o,e;o<r&&e===n[o]||(this._$Cwt=Oe,r=0,Promise.resolve(e).then(async t=>{for(;s.get();)await s.get();const n=i.deref();if(void 0!==n){const r=n._$Cbt.indexOf(e);r>-1&&r<n._$Cwt&&(n._$Cwt=r,n.setValue(t))}}))}return B}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}),{entries:Ie,setPrototypeOf:Ne,isFrozen:Re,getPrototypeOf:Le,getOwnPropertyDescriptor:De}=Object;let{freeze:je,seal:Ue,create:Fe}=Object,{apply:Ze,construct:Be}="undefined"!=typeof Reflect&&Reflect;je||(je=function(e){return e}),Ue||(Ue=function(e){return e}),Ze||(Ze=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}),Be||(Be=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const We=st(Array.prototype.forEach),He=st(Array.prototype.lastIndexOf),Ge=st(Array.prototype.pop),qe=st(Array.prototype.push),Je=st(Array.prototype.splice),Ve=st(String.prototype.toLowerCase),Ye=st(String.prototype.toString),Xe=st(String.prototype.match),Ke=st(String.prototype.replace),Qe=st(String.prototype.indexOf),et=st(String.prototype.trim),tt=st(Object.prototype.hasOwnProperty),nt=st(RegExp.prototype.test),rt=(it=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Be(it,t)});var it;function st(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Ze(e,t,r)}}function ot(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ve;Ne&&Ne(e,null);let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(Re(t)||(t[r]=e),i=e)}e[i]=!0}return e}function at(e){for(let t=0;t<e.length;t++){tt(e,t)||(e[t]=null)}return e}function ct(e){const t=Fe(null);for(const[n,r]of Ie(e)){tt(e,n)&&(Array.isArray(r)?t[n]=at(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=ct(r):t[n]=r)}return t}function lt(e,t){for(;null!==e;){const n=De(e,t);if(n){if(n.get)return st(n.get);if("function"==typeof n.value)return st(n.value)}e=Le(e)}return function(){return null}}const ut=je(["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"]),ht=je(["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"]),dt=je(["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"]),pt=je(["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"]),mt=je(["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"]),ft=je(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),gt=je(["#text"]),yt=je(["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"]),bt=je(["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"]),vt=je(["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"]),kt=je(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),wt=Ue(/\{\{[\w\W]*|[\w\W]*\}\}/gm),_t=Ue(/<%[\w\W]*|[\w\W]*%>/gm),xt=Ue(/\$\{[\w\W]*/gm),$t=Ue(/^data-[\-\w.\u00B7-\uFFFF]+$/),St=Ue(/^aria-[\-\w]+$/),At=Ue(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Et=Ue(/^(?:\w+script|data):/i),Ct=Ue(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Tt=Ue(/^html$/i),zt=Ue(/^[a-z][.\w]*(-[.\w]+)+$/i);var Pt=Object.freeze({__proto__:null,ARIA_ATTR:St,ATTR_WHITESPACE:Ct,CUSTOM_ELEMENT:zt,DATA_ATTR:$t,DOCTYPE_NAME:Tt,ERB_EXPR:_t,IS_ALLOWED_URI:At,IS_SCRIPT_OR_DATA:Et,MUSTACHE_EXPR:wt,TMPLIT_EXPR:xt});const Ot=1,Mt=3,It=7,Nt=8,Rt=9;var Lt=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window;const n=t=>e(t);if(n.version="3.3.1",n.removed=[],!t||!t.document||t.document.nodeType!==Rt||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const i=r,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:c,Element:l,NodeFilter:u,NamedNodeMap:h=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:p,trustedTypes:m}=t,f=l.prototype,g=lt(f,"cloneNode"),y=lt(f,"remove"),b=lt(f,"nextSibling"),v=lt(f,"childNodes"),k=lt(f,"parentNode");if("function"==typeof a){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let w,_="";const{implementation:x,createNodeIterator:$,createDocumentFragment:S,getElementsByTagName:A}=r,{importNode:E}=i;let C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Ie&&"function"==typeof k&&x&&void 0!==x.createHTMLDocument;const{MUSTACHE_EXPR:T,ERB_EXPR:z,TMPLIT_EXPR:P,DATA_ATTR:O,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:N,CUSTOM_ELEMENT:R}=Pt;let{IS_ALLOWED_URI:L}=Pt,D=null;const j=ot({},[...ut,...ht,...dt,...mt,...gt]);let U=null;const F=ot({},[...yt,...bt,...vt,...kt]);let Z=Object.seal(Fe(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}})),B=null,W=null;const H=Object.seal(Fe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let G=!0,q=!0,J=!1,V=!0,Y=!1,X=!0,K=!1,Q=!1,ee=!1,te=!1,ne=!1,re=!1,ie=!0,se=!1,oe=!0,ae=!1,ce={},le=null;const ue=ot({},["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"]);let he=null;const de=ot({},["audio","video","img","source","image","track"]);let pe=null;const me=ot({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",ye="http://www.w3.org/1999/xhtml";let be=ye,ve=!1,ke=null;const we=ot({},[fe,ge,ye],Ye);let _e=ot({},["mi","mo","mn","ms","mtext"]),xe=ot({},["annotation-xml"]);const $e=ot({},["title","style","font","a","script"]);let Se=null;const Ae=["application/xhtml+xml","text/html"];let Ee=null,Ce=null;const Te=r.createElement("form"),ze=function(e){return e instanceof RegExp||e instanceof Function},Pe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ce||Ce!==e){if(e&&"object"==typeof e||(e={}),e=ct(e),Se=-1===Ae.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ee="application/xhtml+xml"===Se?Ye:Ve,D=tt(e,"ALLOWED_TAGS")?ot({},e.ALLOWED_TAGS,Ee):j,U=tt(e,"ALLOWED_ATTR")?ot({},e.ALLOWED_ATTR,Ee):F,ke=tt(e,"ALLOWED_NAMESPACES")?ot({},e.ALLOWED_NAMESPACES,Ye):we,pe=tt(e,"ADD_URI_SAFE_ATTR")?ot(ct(me),e.ADD_URI_SAFE_ATTR,Ee):me,he=tt(e,"ADD_DATA_URI_TAGS")?ot(ct(de),e.ADD_DATA_URI_TAGS,Ee):de,le=tt(e,"FORBID_CONTENTS")?ot({},e.FORBID_CONTENTS,Ee):ue,B=tt(e,"FORBID_TAGS")?ot({},e.FORBID_TAGS,Ee):ct({}),W=tt(e,"FORBID_ATTR")?ot({},e.FORBID_ATTR,Ee):ct({}),ce=!!tt(e,"USE_PROFILES")&&e.USE_PROFILES,G=!1!==e.ALLOW_ARIA_ATTR,q=!1!==e.ALLOW_DATA_ATTR,J=e.ALLOW_UNKNOWN_PROTOCOLS||!1,V=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,X=!1!==e.SAFE_FOR_XML,K=e.WHOLE_DOCUMENT||!1,te=e.RETURN_DOM||!1,ne=e.RETURN_DOM_FRAGMENT||!1,re=e.RETURN_TRUSTED_TYPE||!1,ee=e.FORCE_BODY||!1,ie=!1!==e.SANITIZE_DOM,se=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ae=e.IN_PLACE||!1,L=e.ALLOWED_URI_REGEXP||At,be=e.NAMESPACE||ye,_e=e.MATHML_TEXT_INTEGRATION_POINTS||_e,xe=e.HTML_INTEGRATION_POINTS||xe,Z=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ze(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Z.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ze(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Z.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Z.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(q=!1),ne&&(te=!0),ce&&(D=ot({},gt),U=[],!0===ce.html&&(ot(D,ut),ot(U,yt)),!0===ce.svg&&(ot(D,ht),ot(U,bt),ot(U,kt)),!0===ce.svgFilters&&(ot(D,dt),ot(U,bt),ot(U,kt)),!0===ce.mathMl&&(ot(D,mt),ot(U,vt),ot(U,kt))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?H.tagCheck=e.ADD_TAGS:(D===j&&(D=ct(D)),ot(D,e.ADD_TAGS,Ee))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?H.attributeCheck=e.ADD_ATTR:(U===F&&(U=ct(U)),ot(U,e.ADD_ATTR,Ee))),e.ADD_URI_SAFE_ATTR&&ot(pe,e.ADD_URI_SAFE_ATTR,Ee),e.FORBID_CONTENTS&&(le===ue&&(le=ct(le)),ot(le,e.FORBID_CONTENTS,Ee)),e.ADD_FORBID_CONTENTS&&(le===ue&&(le=ct(le)),ot(le,e.ADD_FORBID_CONTENTS,Ee)),oe&&(D["#text"]=!0),K&&ot(D,["html","head","body"]),D.table&&(ot(D,["tbody"]),delete B.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw rt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw rt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,_=w.createHTML("")}else void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(s){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(m,s)),null!==w&&"string"==typeof _&&(_=w.createHTML(""));je&&je(e),Ce=e}},Oe=ot({},[...ht,...dt,...pt]),Me=ot({},[...mt,...ft]),Ne=function(e){qe(n.removed,{element:e});try{k(e).removeChild(e)}catch(t){y(e)}},Re=function(e,t){try{qe(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(r){qe(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(te||ne)try{Ne(t)}catch(r){}else try{t.setAttribute(e,"")}catch(r){}},Le=function(e){let t=null,n=null;if(ee)e="<remove></remove>"+e;else{const t=Xe(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Se&&be===ye&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=w?w.createHTML(e):e;if(be===ye)try{t=(new p).parseFromString(i,Se)}catch(o){}if(!t||!t.documentElement){t=x.createDocument(be,"template",null);try{t.documentElement.innerHTML=ve?_:i}catch(o){}}const s=t.body||t.documentElement;return e&&n&&s.insertBefore(r.createTextNode(n),s.childNodes[0]||null),be===ye?A.call(t,K?"html":"body")[0]:K?t.documentElement:s},De=function(e){return $.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Ue=function(e){return e instanceof d&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Ze=function(e){return"function"==typeof c&&e instanceof c};function Be(e,t,r){We(e,e=>{e.call(n,t,r,Ce)})}const it=function(e){let t=null;if(Be(C.beforeSanitizeElements,e,null),Ue(e))return Ne(e),!0;const r=Ee(e.nodeName);if(Be(C.uponSanitizeElement,e,{tagName:r,allowedTags:D}),X&&e.hasChildNodes()&&!Ze(e.firstElementChild)&&nt(/<[/\w!]/g,e.innerHTML)&&nt(/<[/\w!]/g,e.textContent))return Ne(e),!0;if(e.nodeType===It)return Ne(e),!0;if(X&&e.nodeType===Nt&&nt(/<[/\w]/g,e.data))return Ne(e),!0;if(!(H.tagCheck instanceof Function&&H.tagCheck(r))&&(!D[r]||B[r])){if(!B[r]&&at(r)){if(Z.tagNameCheck instanceof RegExp&&nt(Z.tagNameCheck,r))return!1;if(Z.tagNameCheck instanceof Function&&Z.tagNameCheck(r))return!1}if(oe&&!le[r]){const t=k(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=g(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,b(e))}}}return Ne(e),!0}return e instanceof l&&!function(e){let t=k(e);t&&t.tagName||(t={namespaceURI:be,tagName:"template"});const n=Ve(e.tagName),r=Ve(t.tagName);return!!ke[e.namespaceURI]&&(e.namespaceURI===ge?t.namespaceURI===ye?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===r||_e[r]):Boolean(Oe[n]):e.namespaceURI===fe?t.namespaceURI===ye?"math"===n:t.namespaceURI===ge?"math"===n&&xe[r]:Boolean(Me[n]):e.namespaceURI===ye?!(t.namespaceURI===ge&&!xe[r])&&!(t.namespaceURI===fe&&!_e[r])&&!Me[n]&&($e[n]||!Oe[n]):!("application/xhtml+xml"!==Se||!ke[e.namespaceURI]))}(e)?(Ne(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!nt(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&e.nodeType===Mt&&(t=e.textContent,We([T,z,P],e=>{t=Ke(t,e," ")}),e.textContent!==t&&(qe(n.removed,{element:e.cloneNode()}),e.textContent=t)),Be(C.afterSanitizeElements,e,null),!1):(Ne(e),!0)},st=function(e,t,n){if(ie&&("id"===t||"name"===t)&&(n in r||n in Te))return!1;if(q&&!W[t]&&nt(O,t));else if(G&&nt(M,t));else if(H.attributeCheck instanceof Function&&H.attributeCheck(t,e));else if(!U[t]||W[t]){if(!(at(e)&&(Z.tagNameCheck instanceof RegExp&&nt(Z.tagNameCheck,e)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(e))&&(Z.attributeNameCheck instanceof RegExp&&nt(Z.attributeNameCheck,t)||Z.attributeNameCheck instanceof Function&&Z.attributeNameCheck(t,e))||"is"===t&&Z.allowCustomizedBuiltInElements&&(Z.tagNameCheck instanceof RegExp&&nt(Z.tagNameCheck,n)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(n))))return!1}else if(pe[t]);else if(nt(L,Ke(n,N,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Qe(n,"data:")||!he[e]){if(J&&!nt(I,Ke(n,N,"")));else if(n)return!1}else;return!0},at=function(e){return"annotation-xml"!==e&&Xe(e,R)},wt=function(e){Be(C.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Ue(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:U,forceKeepAttr:void 0};let i=t.length;for(;i--;){const o=t[i],{name:a,namespaceURI:c,value:l}=o,u=Ee(a),h=l;let d="value"===a?h:et(h);if(r.attrName=u,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,Be(C.uponSanitizeAttribute,e,r),d=r.attrValue,!se||"id"!==u&&"name"!==u||(Re(a,e),d="user-content-"+d),X&&nt(/((--!?|])>)|<\/(style|title|textarea)/i,d)){Re(a,e);continue}if("attributename"===u&&Xe(d,"href")){Re(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Re(a,e);continue}if(!V&&nt(/\/>/i,d)){Re(a,e);continue}Y&&We([T,z,P],e=>{d=Ke(d,e," ")});const p=Ee(e.nodeName);if(st(p,u,d)){if(w&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(c);else switch(m.getAttributeType(p,u)){case"TrustedHTML":d=w.createHTML(d);break;case"TrustedScriptURL":d=w.createScriptURL(d)}if(d!==h)try{c?e.setAttributeNS(c,a,d):e.setAttribute(a,d),Ue(e)?Ne(e):Ge(n.removed)}catch(s){Re(a,e)}}else Re(a,e)}Be(C.afterSanitizeAttributes,e,null)},_t=function e(t){let n=null;const r=De(t);for(Be(C.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Be(C.uponSanitizeShadowNode,n,null),it(n),wt(n),n.content instanceof o&&e(n.content);Be(C.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,s=null,a=null,l=null;if(ve=!e,ve&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ze(e)){if("function"!=typeof e.toString)throw rt("toString is not a function");if("string"!=typeof(e=e.toString()))throw rt("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Q||Pe(t),n.removed=[],"string"==typeof e&&(ae=!1),ae){if(e.nodeName){const t=Ee(e.nodeName);if(!D[t]||B[t])throw rt("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)r=Le("\x3c!----\x3e"),s=r.ownerDocument.importNode(e,!0),s.nodeType===Ot&&"BODY"===s.nodeName||"HTML"===s.nodeName?r=s:r.appendChild(s);else{if(!te&&!Y&&!K&&-1===e.indexOf("<"))return w&&re?w.createHTML(e):e;if(r=Le(e),!r)return te?null:re?_:""}r&&ee&&Ne(r.firstChild);const u=De(ae?e:r);for(;a=u.nextNode();)it(a),wt(a),a.content instanceof o&&_t(a.content);if(ae)return e;if(te){if(ne)for(l=S.call(r.ownerDocument);r.firstChild;)l.appendChild(r.firstChild);else l=r;return(U.shadowroot||U.shadowrootmode)&&(l=E.call(i,l,!0)),l}let h=K?r.outerHTML:r.innerHTML;return K&&D["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&nt(Tt,r.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+h),Y&&We([T,z,P],e=>{h=Ke(h,e," ")}),w&&re?w.createHTML(h):h},n.setConfig=function(){Pe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Q=!0},n.clearConfig=function(){Ce=null,Q=!1},n.isValidAttribute=function(e,t,n){Ce||Pe({});const r=Ee(e),i=Ee(t);return st(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&qe(C[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=He(C[e],t);return-1===n?void 0:Je(C[e],n,1)[0]}return Ge(C[e])},n.removeHooks=function(e){C[e]=[]},n.removeAllHooks=function(){C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const Dt={ALLOWED_TAGS:["a","b","i","em","strong","s","p","ul","ol","li","code","pre","blockquote","h6","hr","br","img"],ALLOWED_ATTR:["href","src","alt"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1};let jt=!1;function Ut(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}jt||(Lt.addHook("afterSanitizeAttributes",e=>{if(e instanceof HTMLAnchorElement){e.setAttribute("rel","noopener noreferrer"),e.setAttribute("data-external-link","true");const t=e.getAttribute("href");t&&(e.setAttribute("data-href",t),e.removeAttribute("href")),e.style.cursor="pointer"}e instanceof HTMLImageElement&&e.setAttribute("loading","lazy")}),Lt.addHook("uponSanitizeAttribute",(e,t)=>{if("href"===t.attrName||"src"===t.attrName)try{const e=new URL(t.attrValue||"");"http:"!==e.protocol&&"https:"!==e.protocol&&(t.keepAttr=!1)}catch{t.keepAttr=!1}}),jt=!0);var Ft={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Zt(e){Ft=e}var Bt={exec:()=>null};function Wt(e,t=""){let n="string"==typeof e?e:e.source,r={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(Gt.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Ht=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Gt={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]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ 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=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},qt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Jt=/(?:[*+-]|\d{1,9}[.)])/,Vt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Yt=Wt(Vt).replace(/bull/g,Jt).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(),Xt=Wt(Vt).replace(/bull/g,Jt).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(),Kt=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Qt=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,en=Wt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Qt).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),tn=Wt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Jt).getRegex(),nn="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",rn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sn=Wt("^ {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[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",rn).replace("tag",nn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),on=Wt(Kt).replace("hr",qt).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",nn).getRegex(),an={blockquote:Wt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",on).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:en,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:qt,html:sn,lheading:Yt,list:tn,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:on,table:Bt,text:/^[^\n]+/},cn=Wt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",qt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\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",nn).getRegex(),ln={...an,lheading:Xt,table:cn,paragraph:Wt(Kt).replace("hr",qt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",cn).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",nn).getRegex()},un={...an,html:Wt("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",rn).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:Bt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Wt(Kt).replace("hr",qt).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Yt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},hn=/^( {2,}|\\)\n(?!\s*$)/,dn=/[\p{P}\p{S}]/u,pn=/[\s\p{P}\p{S}]/u,mn=/[^\s\p{P}\p{S}]/u,fn=Wt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,pn).getRegex(),gn=/(?!~)[\p{P}\p{S}]/u,yn=Wt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ht?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),bn=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,vn=Wt(bn,"u").replace(/punct/g,dn).getRegex(),kn=Wt(bn,"u").replace(/punct/g,gn).getRegex(),wn="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",_n=Wt(wn,"gu").replace(/notPunctSpace/g,mn).replace(/punctSpace/g,pn).replace(/punct/g,dn).getRegex(),xn=Wt(wn,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,gn).getRegex(),$n=Wt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,mn).replace(/punctSpace/g,pn).replace(/punct/g,dn).getRegex(),Sn=Wt(/\\(punct)/,"gu").replace(/punct/g,dn).getRegex(),An=Wt(/^<(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(),En=Wt(rn).replace("(?:--\x3e|$)","--\x3e").getRegex(),Cn=Wt("^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",En).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Tn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,zn=Wt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Tn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pn=Wt(/^!?\[(label)\]\[(ref)\]/).replace("label",Tn).replace("ref",Qt).getRegex(),On=Wt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Qt).getRegex(),Mn=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,In={_backpedal:Bt,anyPunctuation:Sn,autolink:An,blockSkip:yn,br:hn,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Bt,emStrongLDelim:vn,emStrongRDelimAst:_n,emStrongRDelimUnd:$n,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:zn,nolink:On,punctuation:fn,reflink:Pn,reflinkSearch:Wt("reflink|nolink(?!\\()","g").replace("reflink",Pn).replace("nolink",On).getRegex(),tag:Cn,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Bt},Nn={...In,link:Wt(/^!?\[(label)\]\((.*?)\)/).replace("label",Tn).getRegex(),reflink:Wt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Tn).getRegex()},Rn={...In,emStrongRDelimAst:xn,emStrongLDelim:kn,url:Wt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Mn).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\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Wt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Mn).getRegex()},Ln={...Rn,br:Wt(hn).replace("{2,}","*").getRegex(),text:Wt(Rn.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Dn={normal:an,gfm:ln,pedantic:un},jn={normal:In,gfm:Rn,breaks:Ln,pedantic:Nn},Un={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Fn=e=>Un[e];function Zn(e,t){if(t){if(Gt.escapeTest.test(e))return e.replace(Gt.escapeReplace,Fn)}else if(Gt.escapeTestNoEncode.test(e))return e.replace(Gt.escapeReplaceNoEncode,Fn);return e}function Bn(e){try{e=encodeURI(e).replace(Gt.percentDecode,"%")}catch{return null}return e}function Wn(e,t){let n=e.replace(Gt.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(Gt.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(Gt.slashPipe,"|");return n}function Hn(e,t,n){let r=e.length;if(0===r)return"";let i=0;for(;i<r;){if(e.charAt(r-i-1)!==t)break;i++}return e.slice(0,r-i)}function Gn(e,t,n,r,i){let s=t.href,o=t.title||null,a=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}var qn=class{options;rules;lexer;constructor(e){this.options=e||Ft}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:Hn(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(null===r)return t;let i=r[1];return t.split("\n").map(e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join("\n")}(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=Hn(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:Hn(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Hn(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,s=!1,o=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))o.push(e[t]),s=!0;else{if(s)break;o.push(e[t])}e=e.slice(t);let a=o.join("\n"),c=a.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${a}`:a,r=r?`${r}\n${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,0===e.length)break;let u=i.at(-1);if("code"===u?.type)break;if("blockquote"===u?.type){let t=u,s=t.raw+"\n"+e.join("\n"),o=this.blockquote(s);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}if("list"===u?.type){let t=u,s=t.raw+"\n"+e.join("\n"),o=this.list(s);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=s.substring(i.at(-1).raw.length).split("\n");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 s=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r="",a="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,e=>" ".repeat(3*e.length)),l=e.split("\n",1)[0],u=!c.trim(),h=0;if(this.options.pedantic?(h=2,a=c.trimStart()):u?h=t[1].length+1:(h=t[2].search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=c.slice(h),h+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+"\n",e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),i=this.rules.other.fencesBeginRegex(h),s=this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h);for(;e;){let d,p=e.split("\n",1)[0];if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting," "),d=l):d=l.replace(this.rules.other.tabCharGlobal," "),i.test(l)||s.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(d.search(this.rules.other.nonSpaceChar)>=h||!l.trim())a+="\n"+d.slice(h);else{if(u||c.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(c)||s.test(c)||n.test(c))break;a+="\n"+l}!u&&!l.trim()&&(u=!0),r+=p+"\n",e=e.substring(p.length+1),c=d.slice(h)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:"list_item",raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]}),i.raw+=r}let a=i.items.at(-1);if(!a)return;a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,""),"text"===e.tokens[0]?.type||"paragraph"===e.tokens[0]?.type){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,"");break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:"checkbox",raw:t[0]+" ",checked:"[ ]"!==t[0]};e.checked=n.checked,i.loose?e.tokens[0]&&["paragraph","text"].includes(e.tokens[0].type)&&"tokens"in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:"paragraph",raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=e.tokens.filter(e=>"space"===e.type),n=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw));i.loose=n}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)"text"===t.type&&(t.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],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=Wn(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?s.align.push("right"):this.rules.other.tableAlignCenter.test(e)?s.align.push("center"):this.rules.other.tableAlignLeft.test(e)?s.align.push("left"):s.align.push(null);for(let e=0;e<n.length;e++)s.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:s.align[e]});for(let e of i)s.rows.push(Wn(e,s.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:s.align[t]})));return s}}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="\n"===t[1].charAt(t[1].length-1)?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=Hn(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(t[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}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?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)),Gn(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 Gn(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,i,s=[...r[0]].length-1,o=s,a=0,c="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+s);null!=(r=c.exec(t));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(i=[...n].length,r[3]||r[4]){o+=i;continue}if((r[5]||r[6])&&s%3&&!((s+i)%3)){a+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+a);let t=[...r[0]][0].length,c=e.slice(0,s+r.index+t+i);if(Math.min(s,i)%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="www."===t[1]?"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}}}},Jn=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ft,this.options.tokenizer=this.options.tokenizer||new qn,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:Gt,block:Dn.normal,inline:jn.normal};this.options.pedantic?(t.block=Dn.pedantic,t.inline=jn.pedantic):this.options.gfm&&(t.block=Dn.gfm,this.options.breaks?t.inline=jn.breaks:t.inline=jn.gfm),this.tokenizer.rules=t}static get rules(){return{block:Dn,inline:jn}}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(Gt.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let e=this.inlineQueue[t];this.inlineTokens(e.src,e.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Gt.tabCharGlobal," ").replace(Gt.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)))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);1===r.raw.length&&void 0!==n?n.raw+="\n":t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+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);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+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},t.push(r));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,n=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach(e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(i=e.substring(0,n+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let s=t.at(-1);n&&"paragraph"===s?.type?(s.raw+=(s.raw.endsWith("\n")?"":"\n")+r.raw,s.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.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);"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+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}throw new 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,r=e,i=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(r));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(r));)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(r));)n=i[2]?i[2].length:0,r=r.slice(0,i.index+n)+"["+"a".repeat(i[0].length-n-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let s=!1,o="";for(;e;){let n;if(s||(o=""),s=!1,this.options.extensions?.inline?.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))continue;if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length);let r=t.at(-1);"text"===n.type&&"text"===r?.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,r,o)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}let i=e;if(this.options.extensions?.startInline){let t,n=1/0,r=e.slice(1);this.options.extensions.startInline.forEach(e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(i=e.substring(0,n+1))}if(n=this.tokenizer.inlineText(i)){e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),s=!0;let r=t.at(-1);"text"===r?.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}},Vn=class{options;parser;constructor(e){this.options=e||Ft}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(Gt.notSpaceStart)?.[0],i=e.replace(Gt.endingNewline,"")+"\n";return r?'<pre><code class="language-'+Zn(r)+'">'+(n?i:Zn(i,!0))+"</code></pre>\n":"<pre><code>"+(n?i:Zn(i,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,r="";for(let s=0;s<e.items.length;s++){let t=e.items[s];r+=this.listitem(t)}let i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+i+">\n"}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let r="";for(let i=0;i<e.rows.length;i++){let t=e.rows[i];n="";for(let e=0;e<t.length;e++)n+=this.tablecell(t[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}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>${Zn(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=Bn(e);if(null===i)return r;let s='<a href="'+(e=i)+'"';return t&&(s+=' title="'+Zn(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Bn(e);if(null===i)return Zn(n);let s=`<img src="${e=i}" alt="${n}"`;return t&&(s+=` title="${Zn(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Zn(e.text)}},Yn=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""}checkbox({raw:e}){return e}},Xn=class e{options;renderer;textRenderer;constructor(e){this.options=e||Ft,this.options.renderer=this.options.renderer||new Vn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Yn}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==n||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){t+=n||"";continue}}let i=r;switch(i.type){case"space":t+=this.renderer.space(i);break;case"hr":t+=this.renderer.hr(i);break;case"heading":t+=this.renderer.heading(i);break;case"code":t+=this.renderer.code(i);break;case"table":t+=this.renderer.table(i);break;case"blockquote":t+=this.renderer.blockquote(i);break;case"list":t+=this.renderer.list(i);break;case"checkbox":t+=this.renderer.checkbox(i);break;case"html":t+=this.renderer.html(i);break;case"def":t+=this.renderer.def(i);break;case"paragraph":t+=this.renderer.paragraph(i);break;case"text":t+=this.renderer.text(i);break;default:{let e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return t}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(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=e||"";continue}}let s=i;switch(s.type){case"escape":case"text":n+=t.text(s);break;case"html":n+=t.html(s);break;case"link":n+=t.link(s);break;case"image":n+=t.image(s);break;case"checkbox":n+=t.checkbox(s);break;case"strong":n+=t.strong(s);break;case"em":n+=t.em(s);break;case"codespan":n+=t.codespan(s);break;case"br":n+=t.br(s);break;case"del":n+=t.del(s);break;default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}},Kn=class{options;block;constructor(e){this.options=e||Ft}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Jn.lex:Jn.lexInline}provideParser(){return this.block?Xn.parse:Xn.parseInline}},Qn=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Xn;Renderer=Vn;TextRenderer=Yn;Lexer=Jn;Tokenizer=qn;Hooks=Kn;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 new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new 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&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(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 Vn(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let r=n,i=e.renderer[r],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new qn(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=n,i=e.tokenizer[r],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Kn;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let r=n,i=e.hooks[r],s=t[r];Kn.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Kn.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return s.call(t,n)})();let r=i.call(t,e);return s.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return!1===n&&(n=await s.apply(t,e)),n})();let n=i.apply(t,e);return!1===n&&(n=s.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 Jn.lex(e,t??this.defaults)}parser(e,t){return Xn.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return s(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?Jn.lex:Jn.lexInline)(n,i),s=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(s,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser():e?Xn.parse:Xn.parseInline)(s,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?Jn.lex:Jn.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?Xn.parse:Xn.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(o){return s(o)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+Zn(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function er(e,t){return Qn.parse(e,t)}function tr(e){const t=new Date(e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");let s=t.getHours();const o=String(t.getMinutes()).padStart(2,"0"),a=s>=12?"PM":"AM";s%=12,0===s&&(s=12);return`${n}/${r}/${i} ${String(s).padStart(2,"0")}:${o} ${a}`}function nr(e,t="en-US"){const n=new Date(e),r=Date.now(),i=n.getTime()-r,s=Math.round(i/1e3),o=new Intl.RelativeTimeFormat(t,{numeric:"auto"}),a=[{amount:60,unit:"second"},{amount:60,unit:"minute"},{amount:24,unit:"hour"},{amount:7,unit:"day"},{amount:4.34524,unit:"week"},{amount:12,unit:"month"},{amount:1/0,unit:"year"}];let c=s;for(const l of a){if(Math.abs(c)<l.amount)return o.format(Math.round(c),l.unit);c/=l.amount}return""}er.options=er.setOptions=function(e){return Qn.setOptions(e),er.defaults=Qn.defaults,Zt(er.defaults),er},er.getDefaults=Ut,er.defaults=Ft,er.use=function(...e){return Qn.use(...e),er.defaults=Qn.defaults,Zt(er.defaults),er},er.walkTokens=function(e,t){return Qn.walkTokens(e,t)},er.parseInline=Qn.parseInline,er.Parser=Xn,er.parser=Xn.parse,er.Renderer=Vn,er.TextRenderer=Yn,er.Lexer=Jn,er.lexer=Jn.lex,er.Tokenizer=qn,er.Hooks=Kn,er.parse=er,er.options,er.setOptions,er.use,er.walkTokens,er.parseInline,Xn.parse,Jn.lex;const rr={bcp47:"en-US",anonymous:"Anonymous",submit:"Submit",preview:"Preview",edit:"Edit",edited:"Edited",editing:"Editing: ",delete:"Delete",reply:"Reply",replyTo:"Reply to",replyingTo:"Replying to: ",notify:"Notify",help:"Help",cancel:"Cancel",close:"Close",author:"Author",me:"Me",messagePlaceholder:"Write a comment...\nSupports Markdown",nicknamePlaceholder:"Nickname (optional), it will be converted to a pseudonym",confirmDelete:"Confirm delete",confirmDeleteDesc1:"Are you sure you want to delete this comment? Comment ID: ",confirmDeleteDesc2:"This action cannot be undone!",helpDesc:"This is a simple comment system — you can post comments and reply to others. You may preview your content before posting.\n You can fill in a nickname which will be converted to a pseudonym for privacy, or leave it blank to remain anonymous.\n After posting, you can edit or delete your own comment within two minutes without leaving or refreshing the page.\n Comment content supports basic Markdown and does not support HTML.",helpMdLink:"Link",helpMdImage:"Image",helpMdItalic:"Italic",helpMdBold:"Bold",helpMdList:"List item",helpMdOrderedList:"Ordered list item",helpMdInlineCode:"Inline code",helpMdCodeBlock:"Code block",helpMdNoHtml:"No HTML",notifyDesc:"You can subscribe to the comments RSS feed for this post: ",noComments:"No comments yet",showMore:"Show more",showLess:"Show less",externalLinkWarning:"External Link Warning",externalLinkDesc:"You are about to leave this site and visit:",openLink:"Open Link",copyLink:"Copy Link"},ir={bcp47:"zh-TW",anonymous:"匿名",submit:"發送",preview:"預覽",edit:"編輯",edited:"已編輯",editing:"正在編輯:",delete:"刪除",reply:"回覆",replyTo:"回覆給",replyingTo:"正在回覆:",notify:"通知",cancel:"取消",close:"關閉",help:"幫助",author:"作者",me:"我",messagePlaceholder:"請輸入留言...\n支援 Markdown",nicknamePlaceholder:"暱稱(選填)將會被轉換為假名",confirmDelete:"確認刪除",confirmDeleteDesc1:"確定要刪除此留言嗎?留言 ID: ",confirmDeleteDesc2:"此操作無法復原!",helpDesc:"這是一個簡單的留言板,你可以發表留言、回覆他人的留言,發表前可以先預覽內容。\n留言時可以填寫暱稱,系統會將其轉換為假名以保護你的隱私,或留空保持匿名。\n發表留言後,在不離開或重新整理頁面的情況下,可以編輯或刪除自己兩分鐘內的留言。\n留言內容支援基本 Markdown 語法,不支援 HTML。",helpMdLink:"連結",helpMdImage:"圖片",helpMdItalic:"斜體",helpMdBold:"粗體",helpMdList:"清單項目",helpMdOrderedList:"有序清單項目",helpMdInlineCode:"行內程式碼",helpMdCodeBlock:"程式碼區塊",helpMdNoHtml:"不支援 HTML",notifyDesc:"你可以訂閱此文章的留言 RSS Feed:",noComments:"目前還沒有留言",showMore:"顯示全部",showLess:"折疊",externalLinkWarning:"外部連結警告",externalLinkDesc:"你即將離開本站並訪問:",openLink:"開啟連結",copyLink:"複製連結"};let sr=rr;function or(e){return sr[e]||e}function ar(e){sr=e}var cr,lr,ur,hr,dr,pr,mr,fr,gr,yr=Object.create,br=Object.defineProperty,vr=Object.getOwnPropertyDescriptor,kr=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),wr=e=>{throw TypeError(e)},_r=(e,t)=>br(e,"name",{value:t,configurable:!0}),xr=["class","method","getter","setter","accessor","field","value","get","set"],$r=e=>void 0!==e&&"function"!=typeof e?wr("Function expected"):e,Sr=(e,t,n,r,i)=>({kind:xr[e],name:t,metadata:r,addInitializer:e=>n._?wr("Already initialized"):i.push($r(e||null))}),Ar=(e,t)=>{return n=t,r=kr("metadata"),i=e[3],r in n?br(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i;var n,r,i},Er=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)1&t?s[i].call(n):r=s[i].call(n,r);return r},Cr=(e,t,n,r,i,s)=>{var o,a,c,l,u,h=7&t,d=!!(8&t),p=!!(16&t),m=h>3?e.length+1:h?d?1:2:0,f=xr[h+5],g=h>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),b=h&&(!p&&!d&&(i=i.prototype),h<5&&(h>3||!p)&&vr(h<4?i:{get[n](){return Pr(this,s)},set[n](e){return Mr(this,s,e)}},n));h?p&&h<4&&_r(s,(h>2?"set ":h>1?"get ":"")+n):_r(i,n);for(var v=r.length-1;v>=0;v--)l=Sr(h,n,c={},e[3],y),h&&(l.static=d,l.private=p,u=l.access={has:p?e=>zr(i,e):e=>n in e},3^h&&(u.get=p?e=>(1^h?Pr:Ir)(e,i,4^h?s:b.get):e=>e[n]),h>2&&(u.set=p?(e,t)=>Mr(e,i,t,4^h?s:b.set):(e,t)=>e[n]=t)),a=(0,r[v])(h?h<4?p?s:b[f]:h>4?void 0:{get:b.get,set:b.set}:i,l),c._=1,4^h||void 0===a?$r(a)&&(h>4?g.unshift(a):h?p?s=a:b[f]=a:i=a):"object"!=typeof a||null===a?wr("Object expected"):($r(o=a.get)&&(b.get=o),$r(o=a.set)&&(b.set=o),$r(o=a.init)&&g.unshift(o));return h||Ar(e,i),b&&br(i,n,b),p?4^h?s:b:i},Tr=(e,t,n)=>t.has(e)||wr("Cannot "+n),zr=(e,t)=>Object(t)!==t?wr('Cannot use the "in" operator on this value'):e.has(t),Pr=(e,t,n)=>(Tr(e,t,"read from private field"),n?n.call(e):t.get(e)),Or=(e,t,n)=>t.has(e)?wr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Mr=(e,t,n,r)=>(Tr(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ir=(e,t,n)=>(Tr(e,t,"access private method"),n);const Nr="deleted";dr=[ce("comment-list-item")];class Rr extends(hr=oe,ur=[he({type:Object})],lr=[he({type:Array})],cr=[he({type:String})],hr){constructor(){super(...arguments),Or(this,mr,Er(pr,8,this,{id:"",msg:"",pubDate:0})),Er(pr,11,this),Or(this,fr,Er(pr,12,this,[])),Er(pr,15,this),Or(this,gr,Er(pr,16,this,"")),Er(pr,19,this),this.isContentExpanded=!1,this.MAX_LINES=10}render(){const e=Z`
98
+ <!-- prettier-ignore -->
99
+ <div
100
+ part="content"
101
+ class="content ${!this.isContentExpanded&&this.shouldShowExpandBtn()?"collapsed":""}"
102
+ @click=${this.handleContentClick}
103
+ >${Me(this.renderMarkdown(this.comment.msg),Z`<span></span>`)}</div>
104
+ `;return Z`
105
+ <div class=${this.comment.replyTo?"reply-comment":"root-comment"}>
106
+ <div
107
+ part="comment-box"
108
+ class="comment-box"
109
+ id=${this.comment.id}
110
+ role="article"
111
+ aria-labelledby="author-${this.comment.id}"
112
+ >
113
+ <div class="header" part="header">
114
+ <span class="author" part="author" id="author-${this.comment.id}"
115
+ >${this.comment.isAdmin&&this.author?this.author:this.comment.pseudonym||or("anonymous")}</span
116
+ >
117
+ ${(()=>this.comment.isAdmin?Z`<span class="badge" part="badge">${or("author")}</span>`:ge.isInitialized()&&ge.getInstance().isMyComment(this.comment.id)?Z`<span class="badge" part="badge">${or("me")}</span>`:null)()}
118
+ ${this.comment.modDate&&this.comment.modDate>this.comment.pubDate?Z`
119
+ <time
120
+ part="date"
121
+ class="date-relative"
122
+ datetime=${new Date(this.comment.modDate).toISOString()}
123
+ aria-label="${or("edited")} ${nr(this.comment.modDate,or("bcp47"))} (${tr(this.comment.modDate)})"
124
+ >
125
+ ${or("edited")+" "+nr(this.comment.modDate,or("bcp47"))}
126
+ </time>
127
+ <span class="date-absolute" aria-hidden="true"
128
+ >${tr(this.comment.modDate)}</span
129
+ >
130
+ `:Z`
131
+ <time
132
+ part="date"
133
+ class="date-relative"
134
+ datetime=${new Date(this.comment.pubDate).toISOString()}
135
+ aria-label="${nr(this.comment.pubDate,or("bcp47"))} (${tr(this.comment.pubDate)})"
136
+ >
137
+ ${nr(this.comment.pubDate,or("bcp47"))}
138
+ </time>
139
+ <span class="date-absolute" aria-hidden="true"
140
+ >${tr(this.comment.pubDate)}</span
141
+ >
142
+ `}
143
+ <span class="comment-id" aria-hidden="true">#${this.comment.id}</span>
144
+ ${this.comment.replyTo?Z`<span class="comment-reply-to"
145
+ >${or("replyTo")+" #"+this.comment.replyTo}</span
146
+ >`:null}
147
+ </div>
148
+ ${e}
149
+ ${this.shouldShowExpandBtn()?Z`<button
150
+ part="show-more-btn"
151
+ class="show-more-btn"
152
+ @click=${this.handleToggleExpand}
153
+ >
154
+ ${this.isContentExpanded?or("showLess"):or("showMore")}
155
+ </button>`:null}
156
+ ${this.isPreviewComment()||this.comment.pseudonym===Nr&&this.comment.msg===Nr?null:Z`
157
+ <div class="actions" part="actions">
158
+ <button
159
+ class="text-btn"
160
+ @click=${this.handleReply}
161
+ title=${or("replyTo")+" #"+this.comment.id}
162
+ aria-label=${or("replyTo")+" "+(this.comment.pseudonym||or("anonymous"))}
163
+ >
164
+ ${or("reply")}
165
+ </button>
166
+ ${ge.isInitialized()&&ge.getInstance().canEditComment(this.comment.id)?Z`
167
+ <button class="text-btn" @click=${this.handleEdit}>${or("edit")}</button>
168
+ <button class="text-btn" @click=${this.handleDelete}>${or("delete")}</button>
169
+ `:null}
170
+ </div>
171
+ `}
172
+ </div>
173
+
174
+ <div class="reply-comments" part="reply-comments" role="list">
175
+ ${this.replyComments.map(e=>Z`
176
+ <comment-list-item
177
+ role="listitem"
178
+ .comment=${e}
179
+ .author=${this.author}
180
+ ></comment-list-item>
181
+ `)}
182
+ </div>
183
+ </div>
184
+ `}isPreviewComment(){return"preview_"===this.comment.id}handleDelete(){this.comment.id&&this.dispatchEvent(new CustomEvent("comment-delete",{detail:this.comment.id,bubbles:!0,composed:!0}))}handleEdit(){this.comment.id&&this.dispatchEvent(new CustomEvent("comment-edit",{detail:this.comment.id,bubbles:!0,composed:!0}))}handleReply(){this.comment.id&&this.dispatchEvent(new CustomEvent("comment-reply",{detail:this.comment.id,bubbles:!0,composed:!0}))}handleContentClick(e){const t=e.target.closest('[data-external-link="true"]');if(t){e.preventDefault(),e.stopPropagation();const n=t.getAttribute("data-href");n&&this.dispatchEvent(new CustomEvent("external-link-click",{detail:n,bubbles:!0,composed:!0}))}}async renderMarkdown(e){if(!e)return we("");const t=function(e){return Lt.sanitize(e,Dt)}(await er.parse(e));return we(t)}shouldShowExpandBtn(){return(this.comment.msg||"").split("\n").length>this.MAX_LINES}handleToggleExpand(){this.isContentExpanded=!this.isContentExpanded,this.requestUpdate()}}var Lr;Lr=hr,pr=[,,,yr(Lr?.[kr("metadata")]??null)],mr=new WeakMap,fr=new WeakMap,gr=new WeakMap,Cr(pr,4,"comment",ur,Rr,mr),Cr(pr,4,"replyComments",lr,Rr,fr),Cr(pr,4,"author",cr,Rr,gr),(Rr=Cr(pr,0,"CommentListItem",dr,Rr)).styles=[fe,o`
185
+ :host {
186
+ display: block;
187
+ margin-bottom: var(--ycc-spacing-s);
188
+ }
189
+ .comment-box {
190
+ padding: var(--ycc-spacing-s);
191
+ // border: 1px solid var(--ycc-border-color);
192
+ // border-radius: var(--ycc-radius);
193
+ border: none;
194
+ background-color: var(--ycc-bg-color);
195
+ }
196
+ .reply-comment .comment-box {
197
+ // background-color: var(--ycc-bg-secondary);
198
+ }
199
+ .header {
200
+ display: flex;
201
+ align-items: baseline;
202
+ gap: var(--ycc-spacing-s);
203
+ margin-bottom: var(--ycc-spacing-s);
204
+ font-size: 0.9em;
205
+ color: var(--ycc-text-secondary);
206
+ flex-wrap: wrap;
207
+ }
208
+ .author {
209
+ font-weight: bold;
210
+ color: var(--ycc-text-color);
211
+ font-size: 1.1em;
212
+ }
213
+ .badge {
214
+ background-color: var(--ycc-primary-color);
215
+ color: var(--ycc-bg-color);
216
+ border-radius: var(--ycc-radius);
217
+ padding: 2px var(--ycc-spacing-xs);
218
+ font-size: 0.8em;
219
+ }
220
+ .date-relative {
221
+ font-size: 0.9em;
222
+ }
223
+ .date-absolute {
224
+ display: none;
225
+ font-size: 0.9em;
226
+ }
227
+ .comment-id {
228
+ display: none;
229
+ font-size: 0.9em;
230
+ }
231
+ .header:hover .comment-id {
232
+ display: block;
233
+ opacity: 0.6;
234
+ }
235
+ .header:hover .date-absolute {
236
+ display: block;
237
+ opacity: 0.6;
238
+ }
239
+ .comment-reply-to {
240
+ display: none;
241
+ font-size: 0.9em;
242
+ }
243
+ .header:hover .comment-reply-to {
244
+ display: block;
245
+ opacity: 0.6;
246
+ }
247
+ .content {
248
+ margin: 0;
249
+ line-height: 1.6;
250
+ white-space: pre-wrap;
251
+ word-break: break-word;
252
+ overflow: hidden;
253
+ transition: max-height 0.3s ease-out;
254
+ }
255
+ .content.collapsed {
256
+ max-height: 10em;
257
+ position: relative;
258
+ }
259
+ .content.collapsed::after {
260
+ content: '';
261
+ position: absolute;
262
+ bottom: 0;
263
+ left: 0;
264
+ width: 100%;
265
+ height: 3em;
266
+ background: linear-gradient(transparent, var(--ycc-bg-color));
267
+ pointer-events: none;
268
+ }
269
+ .show-more-btn {
270
+ margin-top: var(--ycc-spacing-xs);
271
+ color: var(--ycc-primary-color);
272
+ font-weight: 500;
273
+ cursor: pointer;
274
+ padding: 2px 0;
275
+ font-size: 0.9em;
276
+ background: none;
277
+ border: none;
278
+ }
279
+ .show-more-btn:hover {
280
+ color: var(--ycc-primary-hover);
281
+ text-decoration: underline;
282
+ background: none;
283
+ }
284
+ .content p {
285
+ margin: 0.5em 0;
286
+ }
287
+ .content a {
288
+ color: var(--ycc-primary-color);
289
+ text-decoration: underline;
290
+ }
291
+ .content a:hover {
292
+ color: var(--ycc-primary-hover);
293
+ }
294
+ .content img {
295
+ max-width: 80%;
296
+ height: auto;
297
+ border-radius: var(--ycc-radius);
298
+ display: block;
299
+ margin: var(--ycc-spacing-s) 0;
300
+ }
301
+ .content code {
302
+ background-color: var(--ycc-bg-secondary);
303
+ padding: 2px 4px;
304
+ border-radius: 4px;
305
+ font-family: var(--ycc-font-monospace);
306
+ font-size: 0.9em;
307
+ }
308
+ .content pre {
309
+ background-color: var(--ycc-bg-secondary);
310
+ padding: var(--ycc-spacing-s);
311
+ border-radius: var(--ycc-radius);
312
+ overflow-x: auto;
313
+ margin: var(--ycc-spacing-s) 0;
314
+ }
315
+ .content pre code {
316
+ padding: 0;
317
+ background-color: transparent;
318
+ display: block;
319
+ }
320
+ .content ul,
321
+ .content ol {
322
+ padding-left: var(--ycc-spacing-l);
323
+ margin: var(--ycc-spacing-s) 0;
324
+ }
325
+ .content li {
326
+ margin: 0.2em 0;
327
+ }
328
+ .content hr {
329
+ border: none;
330
+ border-top: 1px solid var(--ycc-border-color);
331
+ margin: var(--ycc-spacing-m) 0;
332
+ }
333
+ .content blockquote {
334
+ border-left: 4px solid var(--ycc-border-color);
335
+ margin: var(--ycc-spacing-s) 0;
336
+ padding-left: var(--ycc-spacing-m);
337
+ color: var(--ycc-text-secondary);
338
+ }
339
+ .content strong {
340
+ font-weight: bold;
341
+ }
342
+ .content em {
343
+ font-style: italic;
344
+ }
345
+ .content h6 {
346
+ font-size: 1em;
347
+ margin: var(--ycc-spacing-s) 0;
348
+ font-weight: bold;
349
+ }
350
+ .actions {
351
+ gap: var(--ycc-spacing-s);
352
+ display: flex;
353
+ margin-top: var(--ycc-spacing-s);
354
+ // justify-content: flex-end;
355
+ opacity: 0.7;
356
+ }
357
+ .reply-comments {
358
+ margin-left: var(--ycc-spacing-l);
359
+ // margin-top: var(--ycc-spacing-s);
360
+ padding-left: var(--ycc-spacing-s);
361
+ border-left: 4px solid var(--ycc-border-color);
362
+ }
363
+ `],Er(pr,1,Rr);const Dr=["Brilliant","Elegant","Majestic","Serene","Vibrant","Graceful","Radiant","Mystical","Noble","Charming","Delicate","Gentle","Luminous","Peaceful","Quick","Resilient","Sparkling","Tranquil","Vivid","Wise","Brave","Creative","Dynamic","Enigmatic","Fantastic","Golden","Harmonious","Inspiring","Joyful","Keen","Lively","Magnificent","Natural","Optimistic","Precious","Quiet","Remarkable","Stunning","Thoughtful","Uplifting","Wonderful","Adventurous","Balanced","Confident","Determined","Energetic","Fearless","Gracious","Innovative","Jubilant","Kind","Loyal","Marvelous","Amazing","Bright","Cheerful","Curious","Excited","Fresh","Happy","Intelligent","Jovial","Lovely","Merry","Nimble","Pleasant","Resourceful","Spirited","Talented","Versatile","Warm","Youthful","Active","Agile","Alert","Artistic","Athletic","Authentic","Blissful","Buoyant","Calm","Capable","Caring","Clever","Compassionate","Cool","Courageous","Dazzling","Dedicated","Diligent","Earnest","Efficient","Enthusiastic","Exceptional","Expressive","Fabulous","Faithful","Focused","Friendly","Generous","Gifted","Glorious","Helpful","Honest","Hopeful","Humorous","Independent","Inventive","Lighthearted","Lucky","Mindful","Modest","Motivating","Nurturing","Original","Outgoing","Patient","Playful","Polite","Positive","Proud","Pure","Reliable","Responsible","Sincere","Smart","Smooth","Sociable","Spontaneous","Successful","Sweet","Tender","Trusting","Understanding","Unique","Valuable","Virtuous","Wholesome","Witty"],jr=["Falcon","Phoenix","Dragon","Eagle","Tiger","Lion","Wolf","Bear","Deer","Fox","Hawk","Raven","Swan","Dove","Owl","Butterfly","Rose","Lily","Orchid","Jasmine","Cedar","Oak","Pine","Willow","Maple","Mountain","River","Ocean","Moon","Sun","Cloud","Thunder","Rainbow","Diamond","Ruby","Emerald","Sapphire","Pearl","Crystal","Gold","Silver","Amber","Flame","Breeze","Storm","Mist","Dawn","Dusk","Aurora","Comet","Galaxy","Nebula","Shield","Crown","Gem","Prism","Panda","Koala","Giraffe","Zebra","Leopard","Cheetah","Otter","Dolphin","Whale","Penguin","Rabbit","Squirrel","Hedgehog","Badger","Moose","Camel","Horse","Donkey","Sheep","Goat","Cow","Chicken","Duck","Goose","Turkey","Peacock","Parrot","Canary","Finch","Sparrow","Crane","Stork","Flamingo","Pelican","Shrimp","Crab","Lobster","Octopus","Squid","Walrus","Mole","Ferret","Hamster","Chinchilla","GuineaPig","Lemur","Tapir","Buffalo","Bison","Yak","Ibex","Gazelle","Porcupine","Armadillo","Sloth","Opossum","Platypus","Wombat","Kangaroo","Wallaby","Emu","Cassowary","Orangutan","Gibbon","Chimpanzee","Baboon","Macaque","Lynx","Puma","Jaguar","Cougar","Bobcat","Ocelot","RedPanda","Raccoon","Weasel","Stoat","Ermine","Wolverine","Marten","Jay","Magpie","Rook","Swallow","Swift","Cuckoo","Coot","Grebe","Heron","Egret","Ibis","Gull","Tern","Salmon","Trout","Bass","Cod","Tuna","Ray","Carp","Perch","Catfish","Eel","Pike","Snapper","Bream","Tilapia","Goby","Mullet","Loach","Bamboo","Cactus","Fern","Moss","Palm","Birch","Aspen","Beech","Hazel","Elm","Poplar","Magnolia","Azalea","Gardenia","Hibiscus","Wisteria","Dahlia","Peony","Marigold","Sunflower","Daisy","Violet","Pansy","Begonia","Petunia","Zinnia","Cosmos","Aster","Bluebell","Foxglove","Primrose","Buttercup","Clover","Heather","Lavender","Basil","Rosemary","Thyme","Sage","Parsley","Dill","Fennel","Chive","Oregano","Lotus","Taro","Mushroom","Truffle","Morel","Shiitake","Moth","Dragonfly","Bee","Ant","Termite","Beetle","Ladybug","Firefly","Cicada","Grasshopper","Cricket","Katydid","Locust","Mantis","Earwig","Silverfish","Mayfly","Stonefly","Aphid","Whitefly","Apple","Banana","Orange","Lemon","Lime","Grape","Cherry","Peach","Plum","Pear","Mango","Papaya","Pineapple","Guava","Lychee","Longan","Rambutan","Coconut","Date","Fig","Gooseberry","Blackberry","Blueberry","Raspberry","Strawberry","Cranberry","Currant","Melon","Pumpkin","Squash","Zucchini","Bread","Bagel","Baguette","Croissant","Pretzel","Bun","Roll","Muffin","Cake","Pie","Tart","Cookie","Biscuit","Doughnut","Pancake","Waffle","Crepe","Sandwich","Burger","Pizza","Pasta","Spaghetti","Macaroni","Lasagna","Ravioli","Noodle","Ramen","Udon","Soba","Pho","Dumpling","Wonton","Bao","Sushi","Tempura","Rice","Soup","Stew","Curry","Grill","Roast","Fry","Steam","Boil","Jam","Honey","Butter","Cheese","Cream","Custard","Pudding","IceCream","Sorbet","Milk","Juice","Tea","Coffee","Cocoa","Candy","Mint","Gum","Book","Pen","Pencil","Eraser","Ruler","Scissors","Glue","Paper","Notebook","Bag","Wallet","Key","Lock","Watch","Lamp","Mirror","Brush","Comb","Towel","Soap","Cup","Mug","Bottle","Glass","Plate","Bowl","Spoon","Fork","Tray","Box","Can","Jar","Bin","Pan","Pot","Kettle","Oven","Fan","Phone","Tablet","Laptop","Keyboard","Camera","Radio","TV","Charger","Cable","Plug","Adapter","Battery","Umbrella","Hat","Cap","Scarf","Glove","Sock","Shoe","Boot","Belt","Coat","Jacket","Shirt","Pants","Shorts","Skirt","Dress","Suit","Tie","Mask","Apron","Blanket","Pillow","Chair","Table","Desk","Shelf","Drawer","Cabinet","Door","Window","Wall","Floor","Roof","Stair","Road","Park","Garden","Fence","Gate","Mailbox","Sign","Poster","Flag","Balloon","Kite","Toy","Puzzle","Game","Dice","Card","Coin","Medal","Trophy","Badge","Sticker","Patch","Pin","Ring","Necklace","Bracelet","Earring","Charm","Pendant","Chain","Clip","Hook","Button","Zip","String","Rope","Wire","Band","Tape","Ribbon","Thread","Needle","Thimble","Wrench","Pliers","Level","Map","Globe","Chart","Graph","List","Note","Memo","Label","Tag","Ticket","Pass","Receipt","Bill","Form","Report","File","Folder","Envelope","Stamp","Seal","Circle","Oval","Square","Star","Heart","Arrow","Dot","Line","Wave","Curve","Point","Edge","Corner","Block","Brick","Tile","Panel","Board","Beam","Pole","Rod","Bar","Tube","Pipe","Valve","Tap","Pump","Motor","Gear","Wheel","Axle","Spring","Lever","Handle","Knob","Switch","Dial","Latch","Bolt","Hinge","Frame","Base","Stand","Holder","Mount","Elastic","Rubber","Plastic","Metal","Wood","Stone","Clay","Sand","Soil","Mud","Dust","Salt","Sugar","Oil","Vinegar","Sauce","Paste","Syrup","Fudge","Toffee","Marshmallow","Nougat","Lollipop","Popsicle","Slush","Jellybean"];async function Ur(e){const t=(e||"").trim();if(0===t.length)return{pseudonym:"",hash:""};const n=await async function(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")}(t),{adjective:r,noun:i}=function(e){const t=parseInt(e.substring(0,8),16)%Dr.length,n=parseInt(e.substring(8,16),16)%jr.length;return{adjective:Dr[t],noun:jr[n]}}(n);return{pseudonym:`${r} ${i}`,hash:n}}var Fr,Zr,Br,Wr,Hr,Gr,qr,Jr,Vr,Yr,Xr,Kr,Qr,ei,ti,ni,ri,ii,si,oi=Object.create,ai=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,li=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),ui=e=>{throw TypeError(e)},hi=(e,t)=>ai(e,"name",{value:t,configurable:!0}),di=["class","method","getter","setter","accessor","field","value","get","set"],pi=e=>void 0!==e&&"function"!=typeof e?ui("Function expected"):e,mi=(e,t,n,r,i)=>({kind:di[e],name:t,metadata:r,addInitializer:e=>n._?ui("Already initialized"):i.push(pi(e||null))}),fi=(e,t)=>{return n=t,r=li("metadata"),i=e[3],r in n?ai(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i;var n,r,i},gi=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)1&t?s[i].call(n):r=s[i].call(n,r);return r},yi=(e,t,n,r,i,s)=>{var o,a,c,l,u,h=7&t,d=!!(8&t),p=!!(16&t),m=h>3?e.length+1:h?d?1:2:0,f=di[h+5],g=h>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),b=h&&(!p&&!d&&(i=i.prototype),h<5&&(h>3||!p)&&ci(h<4?i:{get[n](){return ki(this,s)},set[n](e){return _i(this,s,e)}},n));h?p&&h<4&&hi(s,(h>2?"set ":h>1?"get ":"")+n):hi(i,n);for(var v=r.length-1;v>=0;v--)l=mi(h,n,c={},e[3],y),h&&(l.static=d,l.private=p,u=l.access={has:p?e=>vi(i,e):e=>n in e},3^h&&(u.get=p?e=>(1^h?ki:xi)(e,i,4^h?s:b.get):e=>e[n]),h>2&&(u.set=p?(e,t)=>_i(e,i,t,4^h?s:b.set):(e,t)=>e[n]=t)),a=(0,r[v])(h?h<4?p?s:b[f]:h>4?void 0:{get:b.get,set:b.set}:i,l),c._=1,4^h||void 0===a?pi(a)&&(h>4?g.unshift(a):h?p?s=a:b[f]=a:i=a):"object"!=typeof a||null===a?ui("Object expected"):(pi(o=a.get)&&(b.get=o),pi(o=a.set)&&(b.set=o),pi(o=a.init)&&g.unshift(o));return h||fi(e,i),b&&ai(i,n,b),p?4^h?s:b:i},bi=(e,t,n)=>t.has(e)||ui("Cannot "+n),vi=(e,t)=>Object(t)!==t?ui('Cannot use the "in" operator on this value'):e.has(t),ki=(e,t,n)=>(bi(e,t,"read from private field"),n?n.call(e):t.get(e)),wi=(e,t,n)=>t.has(e)?ui("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),_i=(e,t,n,r)=>(bi(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),xi=(e,t,n)=>(bi(e,t,"access private method"),n);Yr=[ce("comment-input")];let $i=class e extends(Vr=oe,Jr=[he({type:String})],qr=[he({type:String})],Gr=[he({type:String})],Hr=[he({type:String})],Wr=[he({type:Boolean})],Br=[de()],Zr=[de()],Fr=[de()],Vr){constructor(){super(...arguments),wi(this,Kr,gi(Xr,8,this,"")),gi(Xr,11,this),wi(this,Qr,gi(Xr,12,this,"")),gi(Xr,15,this),wi(this,ei,gi(Xr,16,this,"")),gi(Xr,19,this),wi(this,ti,gi(Xr,20,this,"")),gi(Xr,23,this),wi(this,ni,gi(Xr,24,this,!1)),gi(Xr,27,this),wi(this,ri,gi(Xr,28,this,!1)),gi(Xr,31,this),wi(this,ii,gi(Xr,32,this,null)),gi(Xr,35,this),wi(this,si,gi(Xr,36,this,"")),gi(Xr,39,this)}render(){return Z`
364
+ <div class="comment-input-container">
365
+ <div class="message-row">
366
+ ${this.isPreview&&this.previewComment?Z`<div class="preview-container">
367
+ <comment-list-item
368
+ .comment=${this.previewComment}
369
+ .author=${this.adminName}
370
+ ></comment-list-item>
371
+ </div>`:Z`<div class="draft-container">
372
+ <textarea
373
+ part="textarea"
374
+ .value=${this.draft}
375
+ @input=${this.handleDraftInput}
376
+ placeholder=${or("messagePlaceholder")}
377
+ aria-label=${or("messagePlaceholder")}
378
+ aria-describedby="message-counter"
379
+ maxlength=${e.MAX_MESSAGE_LENGTH}
380
+ ></textarea>
381
+ <div class="char-counter message-counter" id="message-counter" aria-live="polite">
382
+ ${this.draft.length}/${e.MAX_MESSAGE_LENGTH}
383
+ </div>
384
+ <input
385
+ type="email"
386
+ name="email"
387
+ class="input-email"
388
+ .value=${this.honeypot}
389
+ @input=${this.handleHoneypotInput}
390
+ tabindex="-1"
391
+ aria-hidden="true"
392
+ autocomplete="off"
393
+ />
394
+ </div>`}
395
+ </div>
396
+
397
+ <div class="controls-row">
398
+ <div class="nickname-wrapper">
399
+ <input
400
+ part="nickname"
401
+ class="nickname-input"
402
+ .value=${this.isAdmin?"Admin":this.nickname}
403
+ @input=${this.handleNicknameInput}
404
+ type="text"
405
+ placeholder=${or("nicknamePlaceholder")}
406
+ aria-label=${or("nicknamePlaceholder")}
407
+ aria-describedby="nickname-counter"
408
+ ?disabled=${this.isPreview||this.isAdmin}
409
+ maxlength=${e.MAX_NICKNAME_LENGTH}
410
+ />
411
+ <span class="char-counter" id="nickname-counter" aria-live="polite">
412
+ ${this.nickname.length}/${e.MAX_NICKNAME_LENGTH}
413
+ </span>
414
+ </div>
415
+ <div class="actions">
416
+ <button
417
+ part="btn-preview"
418
+ class="secondary"
419
+ @click=${this.handleTogglePreview}
420
+ ?disabled=${!this.isValidComment()}
421
+ >
422
+ ${this.isPreview?or("edit"):or("preview")}
423
+ </button>
424
+ <button
425
+ part="btn-submit"
426
+ @click=${this.handleSubmit}
427
+ ?disabled=${!this.isValidComment()}
428
+ >
429
+ ${or("submit")}
430
+ </button>
431
+ </div>
432
+ </div>
433
+ </div>
434
+ `}async createPreviewComment(){let e;if(this.editPseudonym)e=this.editPseudonym;else if(this.nickname.trim()){e=(await Ur(this.nickname)).pseudonym}else e=or("anonymous");return{msg:this.draft,pseudonym:e,pubDate:Date.now(),id:"preview_",isAdmin:this.isAdmin}}isValidComment(){const t=this.draft.trim().length,n=this.nickname.trim().length,r=t>0&&t<=e.MAX_MESSAGE_LENGTH,i=n<=e.MAX_NICKNAME_LENGTH;return r&&i}async handleTogglePreview(){this.isPreview=!this.isPreview,this.isPreview&&(this.previewComment=await this.createPreviewComment())}handleDraftInput(t){const n=t.target;this.draft=n.value.slice(0,e.MAX_MESSAGE_LENGTH),this.dispatchEvent(new CustomEvent("draft-change",{detail:this.draft,bubbles:!0,composed:!0}))}handleNicknameInput(t){const n=t.target;this.nickname=n.value.slice(0,e.MAX_NICKNAME_LENGTH),this.dispatchEvent(new CustomEvent("nickname-change",{detail:this.nickname,bubbles:!0,composed:!0}))}handleHoneypotInput(e){const t=e.target;this.honeypot=t.value}handleSubmit(){""===this.honeypot&&(this.isPreview=!1,this.previewComment=null,this.dispatchEvent(new CustomEvent("comment-submit",{bubbles:!0,composed:!0})))}};Xr=(e=>[,,,oi(e?.[li("metadata")]??null)])(Vr),Kr=new WeakMap,Qr=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap,ri=new WeakMap,ii=new WeakMap,si=new WeakMap,yi(Xr,4,"draft",Jr,$i,Kr),yi(Xr,4,"nickname",qr,$i,Qr),yi(Xr,4,"editPseudonym",Gr,$i,ei),yi(Xr,4,"adminName",Hr,$i,ti),yi(Xr,4,"isAdmin",Wr,$i,ni),yi(Xr,4,"isPreview",Br,$i,ri),yi(Xr,4,"previewComment",Zr,$i,ii),yi(Xr,4,"honeypot",Fr,$i,si),$i=yi(Xr,0,"CommentInput",Yr,$i),$i.shadowRootOptions={...oe.shadowRootOptions,delegatesFocus:!0},$i.styles=[fe,o`
435
+ :host {
436
+ display: block;
437
+ // margin-bottom: var(--ycc-spacing-m);
438
+ }
439
+ .comment-input-container {
440
+ // border: 1px solid var(--ycc-border-color);
441
+ // border-radius: var(--ycc-radius);
442
+ // padding: var(--ycc-spacing-s);
443
+ // background-color: var(--ycc-bg-color);
444
+ }
445
+ .draft-container {
446
+ display: flex;
447
+ flex-direction: column;
448
+ gap: var(--ycc-spacing-s);
449
+ padding: var(--ycc-spacing-s);
450
+ }
451
+ textarea {
452
+ // margin: var(--ycc-spacing-s);
453
+ min-height: 100px;
454
+ resize: vertical;
455
+ border: none;
456
+ resize: none;
457
+ background-color: var(--ycc-bg-color);
458
+ scrollbar-width: thin;
459
+ scrollbar-color: var(--ycc-border-color) transparent;
460
+ }
461
+ textarea::-webkit-scrollbar {
462
+ width: 6px;
463
+ }
464
+ textarea::-webkit-scrollbar-track {
465
+ background: transparent;
466
+ }
467
+ textarea::-webkit-scrollbar-thumb {
468
+ background-color: var(--ycc-border-color);
469
+ border-radius: 3px;
470
+ }
471
+ textarea::-webkit-scrollbar-thumb:hover {
472
+ background-color: var(--ycc-text-secondary);
473
+ }
474
+ textarea::placeholder,
475
+ input::placeholder {
476
+ color: var(--ycc-placeholder-color);
477
+ opacity: 1;
478
+ }
479
+ .actions {
480
+ display: flex;
481
+ justify-content: flex-end;
482
+ gap: var(--ycc-spacing-s);
483
+ }
484
+ .message-row {
485
+ border: 1px solid var(--ycc-border-color);
486
+ border-bottom: none;
487
+ border-radius: var(--ycc-radius) var(--ycc-radius) 0 0;
488
+ min-height: calc(100px + 2 * var(--ycc-spacing-s));
489
+ }
490
+ .controls-row {
491
+ border: 1px solid var(--ycc-border-color);
492
+ border-radius: 0 0 var(--ycc-radius) var(--ycc-radius);
493
+ display: flex;
494
+ justify-content: space-between;
495
+ gap: var(--ycc-spacing-s);
496
+ padding: var(--ycc-spacing-s);
497
+ }
498
+ .nickname-input {
499
+ flex: 1;
500
+ border: none;
501
+ outline: none;
502
+ background-color: var(--ycc-bg-color);
503
+ // max-width: 250px;
504
+ }
505
+ .preview-container {
506
+ padding: var(--ycc-spacing-s);
507
+ comment-list-item {
508
+ // margin: 0;
509
+ }
510
+ }
511
+ .nickname-wrapper {
512
+ flex: 1;
513
+ display: flex;
514
+ align-items: center;
515
+ gap: var(--ycc-spacing-s);
516
+ }
517
+ .char-counter {
518
+ font-size: 0.75rem;
519
+ color: var(--ycc-text-secondary);
520
+ white-space: nowrap;
521
+ }
522
+ .message-counter {
523
+ text-align: right;
524
+ }
525
+ .input-email {
526
+ position: absolute;
527
+ left: -9999px;
528
+ width: 1px;
529
+ height: 1px;
530
+ opacity: 0;
531
+ pointer-events: none;
532
+ tab-index: -1;
533
+ }
534
+ `],$i.MAX_NICKNAME_LENGTH=25,$i.MAX_MESSAGE_LENGTH=1e3,gi(Xr,1,$i);var Si,Ai,Ei,Ci,Ti,zi,Pi,Oi,Mi,Ii=Object.create,Ni=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,Li=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Di=e=>{throw TypeError(e)},ji=(e,t)=>Ni(e,"name",{value:t,configurable:!0}),Ui=["class","method","getter","setter","accessor","field","value","get","set"],Fi=e=>void 0!==e&&"function"!=typeof e?Di("Function expected"):e,Zi=(e,t,n,r,i)=>({kind:Ui[e],name:t,metadata:r,addInitializer:e=>n._?Di("Already initialized"):i.push(Fi(e||null))}),Bi=(e,t)=>{return n=t,r=Li("metadata"),i=e[3],r in n?Ni(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i;var n,r,i},Wi=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)1&t?s[i].call(n):r=s[i].call(n,r);return r},Hi=(e,t,n,r,i,s)=>{var o,a,c,l,u,h=7&t,d=!!(8&t),p=!!(16&t),m=h>3?e.length+1:h?d?1:2:0,f=Ui[h+5],g=h>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),b=h&&(!p&&!d&&(i=i.prototype),h<5&&(h>3||!p)&&Ri(h<4?i:{get[n](){return Ji(this,s)},set[n](e){return Yi(this,s,e)}},n));h?p&&h<4&&ji(s,(h>2?"set ":h>1?"get ":"")+n):ji(i,n);for(var v=r.length-1;v>=0;v--)l=Zi(h,n,c={},e[3],y),h&&(l.static=d,l.private=p,u=l.access={has:p?e=>qi(i,e):e=>n in e},3^h&&(u.get=p?e=>(1^h?Ji:Xi)(e,i,4^h?s:b.get):e=>e[n]),h>2&&(u.set=p?(e,t)=>Yi(e,i,t,4^h?s:b.set):(e,t)=>e[n]=t)),a=(0,r[v])(h?h<4?p?s:b[f]:h>4?void 0:{get:b.get,set:b.set}:i,l),c._=1,4^h||void 0===a?Fi(a)&&(h>4?g.unshift(a):h?p?s=a:b[f]=a:i=a):"object"!=typeof a||null===a?Di("Object expected"):(Fi(o=a.get)&&(b.get=o),Fi(o=a.set)&&(b.set=o),Fi(o=a.init)&&g.unshift(o));return h||Bi(e,i),b&&Ni(i,n,b),p?4^h?s:b:i},Gi=(e,t,n)=>t.has(e)||Di("Cannot "+n),qi=(e,t)=>Object(t)!==t?Di('Cannot use the "in" operator on this value'):e.has(t),Ji=(e,t,n)=>(Gi(e,t,"read from private field"),n?n.call(e):t.get(e)),Vi=(e,t,n)=>t.has(e)?Di("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Yi=(e,t,n,r)=>(Gi(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Xi=(e,t,n)=>(Gi(e,t,"access private method"),n);Ti=[ce("comment-info")];class Ki extends(Ci=oe,Ei=[he({type:Object})],Ai=[he({type:Boolean})],Si=[he({type:String})],Ci){constructor(){super(...arguments),Vi(this,Pi,Wi(zi,8,this,null)),Wi(zi,11,this),Vi(this,Oi,Wi(zi,12,this,!0)),Wi(zi,15,this),Vi(this,Mi,Wi(zi,16,this,"")),Wi(zi,19,this)}render(){return this.errorMessage?Z`
535
+ <div class="info-bar error" part="info-bar info-bar-error">
536
+ <span class="error-msg">${this.errorMessage}</span>
537
+ <button class="text-btn" @click=${this.handleErrorClear}>${or("close")}</button>
538
+ </div>
539
+ `:Z`
540
+ <div class="info-bar" part="info-bar">
541
+ ${this.comment?Z`
542
+ <div class="reference-comment-info">
543
+ ${this.isReply?Z`<span
544
+ >${or("replyingTo")}<strong
545
+ >${this.comment.pseudonym||or("anonymous")}${" #"+this.comment.id}</strong
546
+ ></span
547
+ >`:Z`<span>${or("editing")}<strong>${this.comment.id}</strong></span>`}
548
+ <button class="text-btn" @click=${this.handleCancel}>${or("cancel")}</button>
549
+ </div>
550
+ `:Z`<div></div>`}
551
+ <div class="actions" part="actions">
552
+ <button class="text-btn admin-btn" @click=${this.handleAdmin}>Admin</button>
553
+ <button class="text-btn" @click=${this.handleNotify}>${or("notify")}</button>
554
+ <button class="text-btn" @click=${this.handleHelp}>${or("help")}</button>
555
+ </div>
556
+ </div>
557
+ `}handleAdmin(){this.dispatchEvent(new CustomEvent("admin-open",{bubbles:!0,composed:!0}))}handleHelp(){this.dispatchEvent(new CustomEvent("help-open",{bubbles:!0,composed:!0}))}handleNotify(){this.dispatchEvent(new CustomEvent("notify-open",{bubbles:!0,composed:!0}))}handleErrorClear(){this.dispatchEvent(new CustomEvent("error-clear",{bubbles:!0,composed:!0}))}handleCancel(){this.comment?.id&&this.dispatchEvent(new CustomEvent("reference-comment-cancel",{detail:this.comment.id,bubbles:!0,composed:!0}))}}zi=(e=>[,,,Ii(e?.[Li("metadata")]??null)])(Ci),Pi=new WeakMap,Oi=new WeakMap,Mi=new WeakMap,Hi(zi,4,"comment",Ei,Ki,Pi),Hi(zi,4,"isReply",Ai,Ki,Oi),Hi(zi,4,"errorMessage",Si,Ki,Mi),(Ki=Hi(zi,0,"CommentInfo",Ti,Ki)).styles=[fe,o`
558
+ :host {
559
+ display: block;
560
+ }
561
+ .info-bar {
562
+ display: flex;
563
+ justify-content: space-between;
564
+ align-items: center;
565
+ padding: var(--ycc-spacing-s);
566
+ // background-color: var(--ycc-bg-secondary);
567
+ // border-radius: var(--ycc-radius);
568
+ // margin-bottom: var(--ycc-spacing-s);
569
+ font-size: 0.9em;
570
+ }
571
+ .reference-comment-info {
572
+ display: flex;
573
+ align-items: center;
574
+ gap: var(--ycc-spacing-s);
575
+ }
576
+ .actions {
577
+ display: flex;
578
+ gap: var(--ycc-spacing-s);
579
+ }
580
+ .admin-btn {
581
+ opacity: 0;
582
+ transition: opacity 0.2s;
583
+ }
584
+ .admin-btn:hover {
585
+ opacity: 1;
586
+ }
587
+ .info-bar.error {
588
+ justify-content: flex-start;
589
+ gap: var(--ycc-spacing-s);
590
+ }
591
+ .error-msg {
592
+ color: var(--ycc-error-color);
593
+ }
594
+ `],Wi(zi,1,Ki);var Qi,es,ts,ns,rs,is,ss,os,as,cs,ls,us=Object.create,hs=Object.defineProperty,ds=Object.getOwnPropertyDescriptor,ps=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),ms=e=>{throw TypeError(e)},fs=(e,t)=>hs(e,"name",{value:t,configurable:!0}),gs=["class","method","getter","setter","accessor","field","value","get","set"],ys=e=>void 0!==e&&"function"!=typeof e?ms("Function expected"):e,bs=(e,t,n,r,i)=>({kind:gs[e],name:t,metadata:r,addInitializer:e=>n._?ms("Already initialized"):i.push(ys(e||null))}),vs=(e,t)=>{return n=t,r=ps("metadata"),i=e[3],r in n?hs(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i;var n,r,i},ks=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)1&t?s[i].call(n):r=s[i].call(n,r);return r},ws=(e,t,n,r,i,s)=>{var o,a,c,l,u,h=7&t,d=!!(8&t),p=!!(16&t),m=h>3?e.length+1:h?d?1:2:0,f=gs[h+5],g=h>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),b=h&&(!p&&!d&&(i=i.prototype),h<5&&(h>3||!p)&&ds(h<4?i:{get[n](){return $s(this,s)},set[n](e){return As(this,s,e)}},n));h?p&&h<4&&fs(s,(h>2?"set ":h>1?"get ":"")+n):fs(i,n);for(var v=r.length-1;v>=0;v--)l=bs(h,n,c={},e[3],y),h&&(l.static=d,l.private=p,u=l.access={has:p?e=>xs(i,e):e=>n in e},3^h&&(u.get=p?e=>(1^h?$s:Es)(e,i,4^h?s:b.get):e=>e[n]),h>2&&(u.set=p?(e,t)=>As(e,i,t,4^h?s:b.set):(e,t)=>e[n]=t)),a=(0,r[v])(h?h<4?p?s:b[f]:h>4?void 0:{get:b.get,set:b.set}:i,l),c._=1,4^h||void 0===a?ys(a)&&(h>4?g.unshift(a):h?p?s=a:b[f]=a:i=a):"object"!=typeof a||null===a?ms("Object expected"):(ys(o=a.get)&&(b.get=o),ys(o=a.set)&&(b.set=o),ys(o=a.init)&&g.unshift(o));return h||vs(e,i),b&&hs(i,n,b),p?4^h?s:b:i},_s=(e,t,n)=>t.has(e)||ms("Cannot "+n),xs=(e,t)=>Object(t)!==t?ms('Cannot use the "in" operator on this value'):e.has(t),$s=(e,t,n)=>(_s(e,t,"read from private field"),n?n.call(e):t.get(e)),Ss=(e,t,n)=>t.has(e)?ms("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),As=(e,t,n,r)=>(_s(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Es=(e,t,n)=>(_s(e,t,"access private method"),n);is=[ce("comment-dialog")];class Cs extends(rs=oe,ns=[he({type:Boolean})],ts=[he({type:String})],es=[pe(".dialog")],Qi=[pe(".close-btn")],rs){constructor(){super(...arguments),Ss(this,os,ks(ss,8,this,!1)),ks(ss,11,this),Ss(this,as,ks(ss,12,this,"")),ks(ss,15,this),Ss(this,cs,ks(ss,16,this)),ks(ss,19,this),Ss(this,ls,ks(ss,20,this)),ks(ss,23,this),this.previousFocus=null,this.handleKeyDown=e=>{this.open&&("Escape"!==e.key?"Tab"===e.key&&this.trapFocus(e):this.handleClose())}}render(){return this.open?Z`
595
+ <div class="overlay" part="overlay" @click=${this.handleOverlayClick}>
596
+ <div
597
+ class="dialog"
598
+ part="dialog"
599
+ role="dialog"
600
+ aria-modal="true"
601
+ aria-labelledby="dialog-title"
602
+ >
603
+ <button
604
+ part="close-btn"
605
+ class="close-btn"
606
+ @click=${this.handleClose}
607
+ aria-label=${or("close")}
608
+ >
609
+ &times;
610
+ </button>
611
+ <h2 id="dialog-title" part="header">${this.header}</h2>
612
+ <slot></slot>
613
+ </div>
614
+ </div>
615
+ `:null}updated(e){e.has("open")&&(this.open?(this.previousFocus=document.activeElement||null,this.addEventListeners(),setTimeout(()=>{this.closeButton?.focus()},0)):(this.removeEventListeners(),this.previousFocus&&this.previousFocus.isConnected&&this.previousFocus.focus()))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListeners()}addEventListeners(){window.addEventListener("keydown",this.handleKeyDown)}removeEventListeners(){window.removeEventListener("keydown",this.handleKeyDown)}trapFocus(e){if(!this.dialogElement)return;const t=this.dialogElement.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=t[0],r=t[t.length-1];e.shiftKey?document.activeElement===n&&(e.preventDefault(),r.focus()):document.activeElement===r&&(e.preventDefault(),n.focus())}handleClose(){this.dispatchEvent(new CustomEvent("close"))}handleOverlayClick(e){e.target===e.currentTarget&&this.handleClose()}}function Ts(e,t){return e.slice().sort((e,n)=>t?n.pubDate-e.pubDate:e.pubDate-n.pubDate)}ss=(e=>[,,,us(e?.[ps("metadata")]??null)])(rs),os=new WeakMap,as=new WeakMap,cs=new WeakMap,ls=new WeakMap,ws(ss,4,"open",ns,Cs,os),ws(ss,4,"header",ts,Cs,as),ws(ss,4,"dialogElement",es,Cs,cs),ws(ss,4,"closeButton",Qi,Cs,ls),(Cs=ws(ss,0,"CommentDialog",is,Cs)).styles=[fe,o`
616
+ :host {
617
+ display: contents;
618
+ }
619
+ .overlay {
620
+ position: fixed;
621
+ top: 0;
622
+ left: 0;
623
+ width: 100%;
624
+ height: 100%;
625
+ background: rgba(0, 0, 0, 0.5);
626
+ display: flex;
627
+ justify-content: center;
628
+ align-items: center;
629
+ z-index: 1000;
630
+ }
631
+ .dialog {
632
+ color: var(--ycc-text-color);
633
+ background: var(--ycc-bg-color);
634
+ padding: var(--ycc-spacing-m);
635
+ border-radius: var(--ycc-radius);
636
+ max-width: 500px;
637
+ width: 90%;
638
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
639
+ position: relative;
640
+ overflow-y: auto;
641
+ max-height: 90vh;
642
+ }
643
+ .close-btn {
644
+ position: absolute;
645
+ top: var(--ycc-spacing-s);
646
+ right: var(--ycc-spacing-s);
647
+ background: none;
648
+ color: var(--ycc-text-secondary);
649
+ border: none;
650
+ cursor: pointer;
651
+ font-size: 1.2em;
652
+ }
653
+ .close-btn:hover {
654
+ color: var(--ycc-text-color);
655
+ background: var(--ycc-bg-secondary);
656
+ }
657
+ h2 {
658
+ margin-top: 0;
659
+ margin-bottom: var(--ycc-spacing-m);
660
+ }
661
+ `],ks(ss,1,Cs);var zs,Ps,Os,Ms,Is,Ns,Rs,Ls=Object.create,Ds=Object.defineProperty,js=Object.getOwnPropertyDescriptor,Us=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Fs=e=>{throw TypeError(e)},Zs=(e,t)=>Ds(e,"name",{value:t,configurable:!0}),Bs=["class","method","getter","setter","accessor","field","value","get","set"],Ws=e=>void 0!==e&&"function"!=typeof e?Fs("Function expected"):e,Hs=(e,t,n,r,i)=>({kind:Bs[e],name:t,metadata:r,addInitializer:e=>n._?Fs("Already initialized"):i.push(Ws(e||null))}),Gs=(e,t)=>{return n=t,r=Us("metadata"),i=e[3],r in n?Ds(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i;var n,r,i},qs=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)1&t?s[i].call(n):r=s[i].call(n,r);return r},Js=(e,t,n,r,i,s)=>{var o,a,c,l,u,h=7&t,d=!!(8&t),p=!!(16&t),m=h>3?e.length+1:h?d?1:2:0,f=Bs[h+5],g=h>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),b=h&&(!p&&!d&&(i=i.prototype),h<5&&(h>3||!p)&&js(h<4?i:{get[n](){return Xs(this,s)},set[n](e){return Qs(this,s,e)}},n));h?p&&h<4&&Zs(s,(h>2?"set ":h>1?"get ":"")+n):Zs(i,n);for(var v=r.length-1;v>=0;v--)l=Hs(h,n,c={},e[3],y),h&&(l.static=d,l.private=p,u=l.access={has:p?e=>Ys(i,e):e=>n in e},3^h&&(u.get=p?e=>(1^h?Xs:eo)(e,i,4^h?s:b.get):e=>e[n]),h>2&&(u.set=p?(e,t)=>Qs(e,i,t,4^h?s:b.set):(e,t)=>e[n]=t)),a=(0,r[v])(h?h<4?p?s:b[f]:h>4?void 0:{get:b.get,set:b.set}:i,l),c._=1,4^h||void 0===a?Ws(a)&&(h>4?g.unshift(a):h?p?s=a:b[f]=a:i=a):"object"!=typeof a||null===a?Fs("Object expected"):(Ws(o=a.get)&&(b.get=o),Ws(o=a.set)&&(b.set=o),Ws(o=a.init)&&g.unshift(o));return h||Gs(e,i),b&&Ds(i,n,b),p?4^h?s:b:i},Vs=(e,t,n)=>t.has(e)||Fs("Cannot "+n),Ys=(e,t)=>Object(t)!==t?Fs('Cannot use the "in" operator on this value'):e.has(t),Xs=(e,t,n)=>(Vs(e,t,"read from private field"),n?n.call(e):t.get(e)),Ks=(e,t,n)=>t.has(e)?Fs("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Qs=(e,t,n,r)=>(Vs(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),eo=(e,t,n)=>(Vs(e,t,"access private method"),n);Ms=[ce("comment-list")];class to extends(Os=oe,Ps=[he({type:Array})],zs=[he({type:String})],Os){constructor(){super(...arguments),Ks(this,Ns,qs(Is,8,this,[])),qs(Is,11,this),Ks(this,Rs,qs(Is,12,this,"")),qs(Is,15,this)}render(){return 0===this.comments.length?Z`<p class="no-comments">${or("noComments")}</p>`:Z`
662
+ <div class="reply-comments-container" role="list">
663
+ ${Ts((e=this.comments,e.filter(e=>!e.replyTo)),!0).map(e=>Z`
664
+ <comment-list-item
665
+ role="listitem"
666
+ .comment=${e}
667
+ .author=${this.author}
668
+ .replyComments=${Ts(function(e,t){if(!e)return[];if(!t)return[];if(!e.find(e=>e.id===t))return[];const n=[];return function t(r){const i=e.filter(e=>e.replyTo===r);for(const e of i)n.push(e),t(e.id)}(t),n}(this.comments,e.id),!1)}
669
+ ></comment-list-item>
670
+ `)}
671
+ </div>
672
+ `;var e}}Is=(e=>[,,,Ls(e?.[Us("metadata")]??null)])(Os),Ns=new WeakMap,Rs=new WeakMap,Js(Is,4,"comments",Ps,to,Ns),Js(Is,4,"author",zs,to,Rs),(to=Js(Is,0,"CommentList",Ms,to)).styles=[fe,o`
673
+ :host {
674
+ display: block;
675
+ }
676
+ .reply-comments-container {
677
+ margin-bottom: var(--ycc-spacing-m);
678
+ }
679
+ .no-comments {
680
+ text-align: center;
681
+ color: var(--ycc-text-secondary);
682
+ font-style: italic;
683
+ font-size: 0.9em;
684
+ }
685
+ `],qs(Is,1,to);var no,ro,io,so,oo,ao,co,lo,uo,ho,po,mo,fo,go,yo,bo,vo,ko,wo,_o=Object.create,xo=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,So=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Ao=e=>{throw TypeError(e)},Eo=(e,t)=>xo(e,"name",{value:t,configurable:!0}),Co=["class","method","getter","setter","accessor","field","value","get","set"],To=e=>void 0!==e&&"function"!=typeof e?Ao("Function expected"):e,zo=(e,t,n,r,i)=>({kind:Co[e],name:t,metadata:r,addInitializer:e=>n._?Ao("Already initialized"):i.push(To(e||null))}),Po=(e,t)=>{return n=t,r=So("metadata"),i=e[3],r in n?xo(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i;var n,r,i},Oo=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)1&t?s[i].call(n):r=s[i].call(n,r);return r},Mo=(e,t,n,r,i,s)=>{var o,a,c,l,u,h=7&t,d=!!(8&t),p=!!(16&t),m=h>3?e.length+1:h?d?1:2:0,f=Co[h+5],g=h>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),b=h&&(!p&&!d&&(i=i.prototype),h<5&&(h>3||!p)&&$o(h<4?i:{get[n](){return Ro(this,s)},set[n](e){return Do(this,s,e)}},n));h?p&&h<4&&Eo(s,(h>2?"set ":h>1?"get ":"")+n):Eo(i,n);for(var v=r.length-1;v>=0;v--)l=zo(h,n,c={},e[3],y),h&&(l.static=d,l.private=p,u=l.access={has:p?e=>No(i,e):e=>n in e},3^h&&(u.get=p?e=>(1^h?Ro:jo)(e,i,4^h?s:b.get):e=>e[n]),h>2&&(u.set=p?(e,t)=>Do(e,i,t,4^h?s:b.set):(e,t)=>e[n]=t)),a=(0,r[v])(h?h<4?p?s:b[f]:h>4?void 0:{get:b.get,set:b.set}:i,l),c._=1,4^h||void 0===a?To(a)&&(h>4?g.unshift(a):h?p?s=a:b[f]=a:i=a):"object"!=typeof a||null===a?Ao("Object expected"):(To(o=a.get)&&(b.get=o),To(o=a.set)&&(b.set=o),To(o=a.init)&&g.unshift(o));return h||Po(e,i),b&&xo(i,n,b),p?4^h?s:b:i},Io=(e,t,n)=>t.has(e)||Ao("Cannot "+n),No=(e,t)=>Object(t)!==t?Ao('Cannot use the "in" operator on this value'):e.has(t),Ro=(e,t,n)=>(Io(e,t,"read from private field"),n?n.call(e):t.get(e)),Lo=(e,t,n)=>t.has(e)?Ao("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Do=(e,t,n,r)=>(Io(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),jo=(e,t,n)=>(Io(e,t,"access private method"),n);ho=[ce("comment-admin")];class Uo extends(uo=oe,lo=[de()],co=[de()],ao=[de()],oo=[de()],so=[de()],io=[de()],ro=[de()],no=[de()],uo){constructor(){super(...arguments),Lo(this,mo,Oo(po,8,this,"")),Oo(po,11,this),Lo(this,fo,Oo(po,12,this,"")),Oo(po,15,this),Lo(this,go,Oo(po,16,this,"")),Oo(po,19,this),Lo(this,yo,Oo(po,20,this,"")),Oo(po,23,this),Lo(this,bo,Oo(po,24,this,!1)),Oo(po,27,this),Lo(this,vo,Oo(po,28,this,!1)),Oo(po,31,this),Lo(this,ko,Oo(po,32,this,!0)),Oo(po,35,this),Lo(this,wo,Oo(po,36,this,!1)),Oo(po,39,this),this.handleAdminStatusUpdated=e=>{const t=e;this.hasCheckedAuthFromComments||(this.hasCheckedAuthFromComments=!0,this.isLoggedIn=t.detail,this.isCheckingAuth=!1,this.isLoggedIn&&this.handleAuthStatusChange())},this.handleSubmit=async e=>{if(e.preventDefault(),!this.username||!this.password)return this.errorMessage="Please enter username and password",void(this.successMessage="");if(this.isLoading=!0,this.errorMessage="",this.successMessage="",!ge.isInitialized())return this.errorMessage="API service not available",void(this.isLoading=!1);try{const e=await ge.getInstance().adminLogin(this.username,this.password);e?(this.successMessage=e.message||"Login successful",this.username="",this.password="",this.isLoggedIn=!0,this.handleAuthStatusChange()):this.errorMessage="Login failed"}catch(t){this.errorMessage=`Error (${t}). Please try again.`}finally{this.isLoading=!1}},this.handleLogout=async()=>{if(ge.isInitialized()){this.isLoading=!0,this.errorMessage="",this.successMessage="";try{await ge.getInstance().adminLogout()?(this.successMessage="Logged out successfully",this.isLoggedIn=!1,this.handleAuthStatusChange()):this.errorMessage="Logout failed"}catch(e){this.errorMessage=`Error (${e}). Please try again.`}finally{this.isLoading=!1}}else this.errorMessage="API service not available"},this.handleUsernameChange=e=>{const t=e.target;this.username=t.value},this.handlePasswordChange=e=>{const t=e.target;this.password=t.value},this.handleAuthStatusChange=()=>{this.dispatchEvent(new CustomEvent("auth-status-change",{detail:this.isLoggedIn,bubbles:!0,composed:!0}))}}render(){return this.isCheckingAuth?Z`<div>Checking authentication status...</div>`:this.isLoggedIn?this.renderAdminPanel():this.renderLoginForm()}async connectedCallback(){super.connectedCallback(),this.addEventListener("admin-status-updated",this.handleAdminStatusUpdated),setTimeout(()=>{this.hasCheckedAuthFromComments||this.checkAuthStatus()},2e3)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("admin-status-updated",this.handleAdminStatusUpdated)}updateAuthStatus(e){this.hasCheckedAuthFromComments||(this.hasCheckedAuthFromComments=!0,this.isLoggedIn=e,this.isCheckingAuth=!1,this.isLoggedIn&&this.handleAuthStatusChange())}renderLoginForm(){return Z`
686
+ <form @submit=${this.handleSubmit}>
687
+ <div class="form-group">
688
+ <label for="username">Username</label>
689
+ <input
690
+ type="text"
691
+ id="username"
692
+ .value=${this.username}
693
+ @change=${this.handleUsernameChange}
694
+ ?disabled=${this.isLoading}
695
+ required
696
+ />
697
+ </div>
698
+ <div class="form-group">
699
+ <label for="password">Password</label>
700
+ <input
701
+ type="password"
702
+ id="password"
703
+ .value=${this.password}
704
+ @change=${this.handlePasswordChange}
705
+ ?disabled=${this.isLoading}
706
+ required
707
+ />
708
+ </div>
709
+ <button type="submit" ?disabled=${this.isLoading}>
710
+ ${this.isLoading?"Logging in...":"Login"}
711
+ </button>
712
+ </form>
713
+
714
+ <div class="message error ${this.errorMessage?"show":""}">${this.errorMessage}</div>
715
+
716
+ <div class="message success ${this.successMessage?"show":""}">${this.successMessage}</div>
717
+ `}renderAdminPanel(){return Z`
718
+ <div>
719
+ <p>You are logged in as admin</p>
720
+ <button @click=${this.handleLogout} ?disabled=${this.isLoading}>
721
+ ${this.isLoading?"Logging out...":"Logout"}
722
+ </button>
723
+
724
+ <div class="message error ${this.errorMessage?"show":""}">${this.errorMessage}</div>
725
+ <div class="message success ${this.successMessage?"show":""}">
726
+ ${this.successMessage}
727
+ </div>
728
+ </div>
729
+ `}async checkAuthStatus(){if(ge.isInitialized())try{this.isLoggedIn=await ge.getInstance().checkAdminAuth(),this.isLoggedIn&&this.handleAuthStatusChange()}catch(e){console.error("Failed to check auth status:",e),this.isLoggedIn=!1}finally{this.isCheckingAuth=!1}else this.isCheckingAuth=!1}}function Fo(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);const i=o.prototype,s=Object.keys(i);for(let e=0;e<s.length;e++){const t=s[e];t in n||(n[t]=i[t].bind(n))}}const i=n?.Parent??Object;class s extends i{}function o(e){var t;const i=n?.Parent?new s:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const n of i._zod.deferred)n();return i}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}po=(e=>[,,,_o(e?.[So("metadata")]??null)])(uo),mo=new WeakMap,fo=new WeakMap,go=new WeakMap,yo=new WeakMap,bo=new WeakMap,vo=new WeakMap,ko=new WeakMap,wo=new WeakMap,Mo(po,4,"username",lo,Uo,mo),Mo(po,4,"password",co,Uo,fo),Mo(po,4,"errorMessage",ao,Uo,go),Mo(po,4,"successMessage",oo,Uo,yo),Mo(po,4,"isLoading",so,Uo,bo),Mo(po,4,"isLoggedIn",io,Uo,vo),Mo(po,4,"isCheckingAuth",ro,Uo,ko),Mo(po,4,"hasCheckedAuthFromComments",no,Uo,wo),(Uo=Mo(po,0,"CommentAdmin",ho,Uo)).styles=[fe,o`
730
+ :host {
731
+ display: block;
732
+ }
733
+
734
+ .form-group {
735
+ margin-bottom: var(--ycc-spacing-m);
736
+ }
737
+
738
+ label {
739
+ display: block;
740
+ margin-bottom: var(--ycc-spacing-s);
741
+ font-weight: 500;
742
+ color: var(--ycc-text-color);
743
+ }
744
+
745
+ input[type='text'],
746
+ input[type='password'] {
747
+ width: 100%;
748
+ padding: var(--ycc-spacing-s);
749
+ border: 1px solid var(--ycc-border-color);
750
+ border-radius: var(--ycc-radius);
751
+ font-family: inherit;
752
+ font-size: var(--ycc-font-size);
753
+ box-sizing: border-box;
754
+ transition: border-color 0.2s;
755
+ }
756
+
757
+ input[type='text']:focus,
758
+ input[type='password']:focus {
759
+ outline: none;
760
+ border-color: var(--ycc-primary-color);
761
+ }
762
+
763
+ button[type='submit'] {
764
+ width: 100%;
765
+ padding: var(--ycc-spacing-s) var(--ycc-spacing-m);
766
+ margin-top: var(--ycc-spacing-s);
767
+ }
768
+
769
+ .message {
770
+ margin-top: var(--ycc-spacing-m);
771
+ padding: var(--ycc-spacing-s);
772
+ border-radius: var(--ycc-radius);
773
+ text-align: center;
774
+ display: none;
775
+ }
776
+
777
+ .message.show {
778
+ display: block;
779
+ }
780
+
781
+ .message.error {
782
+ background-color: #fee;
783
+ border: 1px solid #fcc;
784
+ color: var(--ycc-error-color);
785
+ }
786
+
787
+ .message.success {
788
+ background-color: #efe;
789
+ border: 1px solid #cfc;
790
+ color: #22c55e;
791
+ }
792
+ `],Oo(po,1,Uo);class Zo extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Bo extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Wo={};function Ho(e){return Wo}function Go(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function qo(e,t){return"bigint"==typeof t?t.toString():t}function Jo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Vo(e){return null==e}function Yo(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const Xo=Symbol("evaluating");function Ko(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Xo)return void 0===r&&(r=Xo,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Qo(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ea(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ta(e){return JSON.stringify(e)}const na="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ra(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const ia=Jo(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function sa(e){if(!1===ra(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==ra(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function oa(e){return sa(e)?{...e}:Array.isArray(e)?[...e]:e}const aa=new Set(["string","number","symbol"]);function ca(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function la(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function ua(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const ha={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function da(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function pa(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ma(e){return"string"==typeof e?e:e?.message}function fa(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const i=ma(e.inst?._zod.def?.error?.(e))??ma(t?.error?.(e))??ma(n.customError?.(e))??ma(n.localeError?.(e))??"Invalid input";r.message=i}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function ga(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function ya(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const ba=(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,qo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},va=Fo("$ZodError",ba),ka=Fo("$ZodError",ba,{Parent:Error});const wa=e=>(t,n,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new Zo;if(o.issues.length){const t=new(i?.Err??e)(o.issues.map(e=>fa(e,s,Ho())));throw na(t,i?.callee),t}return o.value},_a=e=>async(t,n,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(i?.Err??e)(o.issues.map(e=>fa(e,s,Ho())));throw na(t,i?.callee),t}return o.value},xa=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Zo;return s.issues.length?{success:!1,error:new(e??va)(s.issues.map(e=>fa(e,i,Ho())))}:{success:!0,data:s.value}},$a=xa(ka),Sa=e=>async(t,n,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>fa(e,i,Ho())))}:{success:!0,data:s.value}},Aa=Sa(ka),Ea=e=>(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return wa(e)(t,n,i)},Ca=e=>(t,n,r)=>wa(e)(t,n,r),Ta=e=>async(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return _a(e)(t,n,i)},za=e=>async(t,n,r)=>_a(e)(t,n,r),Pa=e=>(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return xa(e)(t,n,i)},Oa=e=>(t,n,r)=>xa(e)(t,n,r),Ma=e=>async(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Sa(e)(t,n,i)},Ia=e=>async(t,n,r)=>Sa(e)(t,n,r),Na=/^[cC][^\s-]{8,}$/,Ra=/^[0-9a-z]+$/,La=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Da=/^[0-9a-vA-V]{20}$/,ja=/^[A-Za-z0-9]{27}$/,Ua=/^[a-zA-Z0-9_-]{21}$/,Fa=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Za=/^([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})$/,Ba=e=>e?new 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)$/,Wa=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Ha=/^(?:(?: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])$/,Ga=/^(([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}|:))$/,qa=/^((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])$/,Ja=/^(([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])$/,Va=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ya=/^[A-Za-z0-9_-]*$/,Xa=/^\+[1-9]\d{6,14}$/,Ka="(?:(?:\\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])))",Qa=new RegExp(`^${Ka}$`);function ec(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const tc=/^-?\d+$/,nc=/^-?\d+(?:\.\d+)?$/,rc=/^(?:true|false)$/i,ic=/^[^A-Z]*$/,sc=/^[^a-z]*$/,oc=Fo("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ac={number:"number",bigint:"bigint",object:"date"},cc=Fo("$ZodCheckLessThan",(e,t)=>{oc.init(e,t);const n=ac[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;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:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lc=Fo("$ZodCheckGreaterThan",(e,t)=>{oc.init(e,t);const n=ac[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;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:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),uc=Fo("$ZodCheckMultipleOf",(e,t)=>{oc.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 new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let i=(r.split(".")[1]||"").length;if(0===i&&/\d?e-\d?/.test(r)){const e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}const s=n>i?n:i;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),hc=Fo("$ZodCheckNumberFormat",(e,t)=>{oc.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,s]=ha[t.format];e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=s,n&&(r.pattern=tc)}),e._zod.check=o=>{const a=o.value;if(n){if(!Number.isInteger(a))return void o.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?o.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}a<i&&o.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>s&&o.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),dc=Fo("$ZodCheckMaxLength",(e,t)=>{var n;oc.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Vo(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=ga(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pc=Fo("$ZodCheckMinLength",(e,t)=>{var n;oc.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Vo(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=ga(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mc=Fo("$ZodCheckLengthEquals",(e,t)=>{var n;oc.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Vo(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,i=r.length;if(i===t.length)return;const s=ga(r),o=i>t.length;n.issues.push({origin:s,...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})}}),fc=Fo("$ZodCheckStringFormat",(e,t)=>{var n,r;oc.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(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=()=>{})}),gc=Fo("$ZodCheckRegex",(e,t)=>{fc.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})}}),yc=Fo("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ic),fc.init(e,t)}),bc=Fo("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=sc),fc.init(e,t)}),vc=Fo("$ZodCheckIncludes",(e,t)=>{oc.init(e,t);const n=ca(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(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})}}),kc=Fo("$ZodCheckStartsWith",(e,t)=>{oc.init(e,t);const n=new RegExp(`^${ca(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(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})}}),wc=Fo("$ZodCheckEndsWith",(e,t)=>{oc.init(e,t);const n=new RegExp(`.*${ca(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(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})}}),_c=Fo("$ZodCheckOverwrite",(e,t)=>{oc.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class xc{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const i of r)this.content.push(i)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const $c={major:4,minor:3,patch:5},Sc=Fo("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$c;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const t of i._zod.onattach)t(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,i=da(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,o=s._zod.check(e);if(o instanceof Promise&&!1===n?.async)throw new Zo;if(r||o instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await o;e.issues.length!==t&&(i||(i=da(e,t)))});else{if(e.issues.length===t)continue;i||(i=da(e,t))}}return r?r.then(()=>e):e},n=(n,i,s)=>{if(da(n))return n.aborted=!0,n;const o=t(i,r,s);if(o instanceof Promise){if(!1===s.async)throw new Zo;return o.then(t=>e._zod.parse(t,s))}return e._zod.parse(o,s)};e._zod.run=(i,s)=>{if(s.skipChecks)return e._zod.parse(i,s);if("backward"===s.direction){const t=e._zod.parse({value:i.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,s)):n(t,i,s)}const o=e._zod.parse(i,s);if(o instanceof Promise){if(!1===s.async)throw new Zo;return o.then(e=>t(e,r,s))}return t(o,r,s)}}Ko(e,"~standard",()=>({validate:t=>{try{const n=$a(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Aa(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Ac=Fo("$ZodString",(e,t)=>{var n;Sc.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ec=Fo("$ZodStringFormat",(e,t)=>{fc.init(e,t),Ac.init(e,t)}),Cc=Fo("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Za),Ec.init(e,t)}),Tc=Fo("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ba(e))}else t.pattern??(t.pattern=Ba());Ec.init(e,t)}),zc=Fo("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Wa),Ec.init(e,t)}),Pc=Fo("$ZodURL",(e,t)=>{Ec.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=new URL(r);return 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})),void(t.normalize?n.value=i.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Oc=Fo("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ec.init(e,t)}),Mc=Fo("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ua),Ec.init(e,t)}),Ic=Fo("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Na),Ec.init(e,t)}),Nc=Fo("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ra),Ec.init(e,t)}),Rc=Fo("$ZodULID",(e,t)=>{t.pattern??(t.pattern=La),Ec.init(e,t)}),Lc=Fo("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Da),Ec.init(e,t)}),Dc=Fo("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ja),Ec.init(e,t)}),jc=Fo("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ec({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Ka}T(?:${r})$`)}(t)),Ec.init(e,t)}),Uc=Fo("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Qa),Ec.init(e,t)}),Fc=Fo("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ec(t)}$`)),Ec.init(e,t)}),Zc=Fo("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Fa),Ec.init(e,t)}),Bc=Fo("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ha),Ec.init(e,t),e._zod.bag.format="ipv4"}),Wc=Fo("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ga),Ec.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})}}}),Hc=Fo("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=qa),Ec.init(e,t)}),Gc=Fo("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ja),Ec.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function qc(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Jc=Fo("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Va),Ec.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{qc(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});const Vc=Fo("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ya),Ec.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!Ya.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return qc(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Yc=Fo("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Xa),Ec.init(e,t)});const Xc=Fo("$ZodJWT",(e,t)=>{Ec.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Kc=Fo("$ZodNumber",(e,t)=>{Sc.init(e,t),e._zod.pattern=e._zod.bag.pattern??nc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(o){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const s="number"==typeof i?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,...s?{received:s}:{}}),n}}),Qc=Fo("$ZodNumberFormat",(e,t)=>{hc.init(e,t),Kc.init(e,t)}),el=Fo("$ZodBoolean",(e,t)=>{Sc.init(e,t),e._zod.pattern=rc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(s){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),tl=Fo("$ZodUnknown",(e,t)=>{Sc.init(e,t),e._zod.parse=e=>e}),nl=Fo("$ZodNever",(e,t)=>{Sc.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function rl(e,t,n){e.issues.length&&t.issues.push(...pa(n,e.issues)),t.value[n]=e.value}const il=Fo("$ZodArray",(e,t)=>{Sc.init(e,t),e._zod.parse=(n,r)=>{const 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);const s=[];for(let e=0;e<i.length;e++){const o=i[e],a=t.element._zod.run({value:o,issues:[]},r);a instanceof Promise?s.push(a.then(t=>rl(t,n,e))):rl(a,n,e)}return s.length?Promise.all(s).then(()=>n):n}});function sl(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...pa(n,e.issues))}void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ol(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function al(e,t,n,r,i,s){const o=[],a=i.keySet,c=i.catchall._zod,l=c.def.type,u="optional"===c.optout;for(const h in t){if(a.has(h))continue;if("never"===l){o.push(h);continue}const i=c.run({value:t[h],issues:[]},r);i instanceof Promise?e.push(i.then(e=>sl(e,n,h,t,u))):sl(i,n,h,t,u)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const cl=Fo("$ZodObject",(e,t)=>{Sc.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=Jo(()=>ol(t));Ko(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n});const i=ra,s=t.catchall;let o;e._zod.parse=(t,n)=>{o??(o=r.value);const a=t.value;if(!i(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],l=o.shape;for(const e of o.keys){const r=l[e],i="optional"===r._zod.optout,s=r._zod.run({value:a[e],issues:[]},n);s instanceof Promise?c.push(s.then(n=>sl(n,t,e,a,i))):sl(s,t,e,a,i)}return s?al(c,a,t,n,r.value,e):c.length?Promise.all(c).then(()=>t):t}}),ll=Fo("$ZodObjectJIT",(e,t)=>{cl.init(e,t);const n=e._zod.parse,r=Jo(()=>ol(t));let i;const s=ra,o=!Wo.jitless,a=o&&ia.value,c=t.catchall;let l;e._zod.parse=(u,h)=>{l??(l=r.value);const d=u.value;return s(d)?o&&a&&!1===h?.async&&!0!==h.jitless?(i||(i=(e=>{const t=new xc(["shape","payload","ctx"]),n=r.value,i=e=>{const t=ta(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);let o=0;for(const r of n.keys)s[r]="key_"+o++;t.write("const newResult = {};");for(const r of n.keys){const n=s[r],o=ta(r),a=e[r],c="optional"===a?._zod?.optout;t.write(`const ${n} = ${i(r)};`),c?t.write(`\n if (${n}.issues.length) {\n if (${o} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n \n `):t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),u=i(u,h),c?al([],d,u,h,l,e):u):n(u,h):(u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u)}});function ul(e,t,n,r){for(const s of e)if(0===s.issues.length)return t.value=s.value,t;const i=e.filter(e=>!da(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>fa(e,r,Ho())))}),t)}const hl=Fo("$ZodUnion",(e,t)=>{Sc.init(e,t),Ko(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Ko(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Ko(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Ko(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>Yo(e.source)).join("|")})$`)}});const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(i,s)=>{if(n)return r(i,s);let o=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:i.value,issues:[]},s);if(t instanceof Promise)a.push(t),o=!0;else{if(0===t.issues.length)return t;a.push(t)}}return o?Promise.all(a).then(t=>ul(t,i,e,s)):ul(a,i,e,s)}}),dl=Fo("$ZodIntersection",(e,t)=>{Sc.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),s=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([t,n])=>ml(e,t,n)):ml(e,i,s)}});function pl(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(sa(e)&&sa(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const s of r){const n=pl(e[s],t[s]);if(!n.valid)return{valid:!1,mergeErrorPath:[s,...n.mergeErrorPath]};i[s]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=pl(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ml(e,t,n){const r=new Map;let i;for(const a of t.issues)if("unrecognized_keys"===a.code){i??(i=a);for(const e of a.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(a);for(const a of n.issues)if("unrecognized_keys"===a.code)for(const e of a.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(a);const s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length&&i&&e.issues.push({...i,keys:s}),da(e))return e;const o=pl(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const fl=Fo("$ZodEnum",(e,t)=>{Sc.init(e,t);const n=Go(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>aa.has(typeof e)).map(e=>"string"==typeof e?ca(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const s=t.value;return r.has(s)||t.issues.push({code:"invalid_value",values:n,input:s,inst:e}),t}}),gl=Fo("$ZodTransform",(e,t)=>{Sc.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new Bo(e.constructor.name);const i=t.transform(n.value,n);if(r.async){return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n))}if(i instanceof Promise)throw new Zo;return n.value=i,n}});function yl(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const bl=Fo("$ZodOptional",(e,t)=>{Sc.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ko(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ko(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Yo(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>yl(t,e.value)):yl(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),vl=Fo("$ZodExactOptional",(e,t)=>{bl.init(e,t),Ko(e._zod,"values",()=>t.innerType._zod.values),Ko(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),kl=Fo("$ZodNullable",(e,t)=>{Sc.init(e,t),Ko(e._zod,"optin",()=>t.innerType._zod.optin),Ko(e._zod,"optout",()=>t.innerType._zod.optout),Ko(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Yo(e.source)}|null)$`):void 0}),Ko(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),wl=Fo("$ZodDefault",(e,t)=>{Sc.init(e,t),e._zod.optin="optional",Ko(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>_l(e,t)):_l(r,t)}});function _l(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const xl=Fo("$ZodPrefault",(e,t)=>{Sc.init(e,t),e._zod.optin="optional",Ko(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),$l=Fo("$ZodNonOptional",(e,t)=>{Sc.init(e,t),Ko(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Sl(t,e)):Sl(i,e)}});function Sl(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Al=Fo("$ZodCatch",(e,t)=>{Sc.init(e,t),Ko(e._zod,"optin",()=>t.innerType._zod.optin),Ko(e._zod,"optout",()=>t.innerType._zod.optout),Ko(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const 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=>fa(e,n,Ho()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>fa(e,n,Ho()))},input:e.value}),e.issues=[]),e)}}),El=Fo("$ZodPipe",(e,t)=>{Sc.init(e,t),Ko(e._zod,"values",()=>t.in._zod.values),Ko(e._zod,"optin",()=>t.in._zod.optin),Ko(e._zod,"optout",()=>t.out._zod.optout),Ko(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Cl(e,t.in,n)):Cl(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Cl(e,t.out,n)):Cl(r,t.out,n)}});function Cl(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Tl=Fo("$ZodReadonly",(e,t)=>{Sc.init(e,t),Ko(e._zod,"propValues",()=>t.innerType._zod.propValues),Ko(e._zod,"values",()=>t.innerType._zod.values),Ko(e._zod,"optin",()=>t.innerType?._zod?.optin),Ko(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(zl):zl(r)}});function zl(e){return e.value=Object.freeze(e.value),e}const Pl=Fo("$ZodCustom",(e,t)=>{oc.init(e,t),Sc.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ol(t,n,r,e));Ol(i,n,r,e)}});function Ol(e,t,n,r){if(!e){const 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(ya(e))}}var Ml;class Il{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const 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)}}(Ml=globalThis).__zod_globalRegistry??(Ml.__zod_globalRegistry=new Il);const Nl=globalThis.__zod_globalRegistry;function Rl(e,t){return new e({type:"string",...ua(t)})}function Ll(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ua(t)})}function Dl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ua(t)})}function jl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ua(t)})}function Ul(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ua(t)})}function Fl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ua(t)})}function Zl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ua(t)})}function Bl(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ua(t)})}function Wl(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ua(t)})}function Hl(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ua(t)})}function Gl(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ua(t)})}function ql(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ua(t)})}function Jl(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ua(t)})}function Vl(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ua(t)})}function Yl(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ua(t)})}function Xl(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ua(t)})}function Kl(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ua(t)})}function Ql(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ua(t)})}function eu(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ua(t)})}function tu(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ua(t)})}function nu(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ua(t)})}function ru(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ua(t)})}function iu(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ua(t)})}function su(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ua(t)})}function ou(e,t){return new e({type:"string",format:"date",check:"string_format",...ua(t)})}function au(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ua(t)})}function cu(e,t){return new e({type:"string",format:"duration",check:"string_format",...ua(t)})}function lu(e,t){return new e({type:"number",checks:[],...ua(t)})}function uu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ua(t)})}function hu(e,t){return new e({type:"boolean",...ua(t)})}function du(e){return new e({type:"unknown"})}function pu(e,t){return new e({type:"never",...ua(t)})}function mu(e,t){return new cc({check:"less_than",...ua(t),value:e,inclusive:!1})}function fu(e,t){return new cc({check:"less_than",...ua(t),value:e,inclusive:!0})}function gu(e,t){return new lc({check:"greater_than",...ua(t),value:e,inclusive:!1})}function yu(e,t){return new lc({check:"greater_than",...ua(t),value:e,inclusive:!0})}function bu(e,t){return new uc({check:"multiple_of",...ua(t),value:e})}function vu(e,t){return new dc({check:"max_length",...ua(t),maximum:e})}function ku(e,t){return new pc({check:"min_length",...ua(t),minimum:e})}function wu(e,t){return new mc({check:"length_equals",...ua(t),length:e})}function _u(e,t){return new gc({check:"string_format",format:"regex",...ua(t),pattern:e})}function xu(e){return new yc({check:"string_format",format:"lowercase",...ua(e)})}function $u(e){return new bc({check:"string_format",format:"uppercase",...ua(e)})}function Su(e,t){return new vc({check:"string_format",format:"includes",...ua(t),includes:e})}function Au(e,t){return new kc({check:"string_format",format:"starts_with",...ua(t),prefix:e})}function Eu(e,t){return new wc({check:"string_format",format:"ends_with",...ua(t),suffix:e})}function Cu(e){return new _c({check:"overwrite",tx:e})}function Tu(e){return Cu(t=>t.normalize(e))}function zu(){return Cu(e=>e.trim())}function Pu(){return Cu(e=>e.toLowerCase())}function Ou(){return Cu(e=>e.toUpperCase())}function Mu(){return Cu(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e))}function Iu(e,t,n){return new e({type:"array",element:t,...ua(n)})}function Nu(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ua(n)})}function Ru(e){const t=Lu(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(ya(e,n.value,t._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(ya(r))}},e(n.value,n)));return t}function Lu(e,t){const n=new oc({check:"custom",...ua(t)});return n._zod.check=e,n}function Du(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Nl,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 ju(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,s=t.seen.get(e);if(s){s.count++;return n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema}const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);const a=e._zod.toJSONSchema?.();if(a)o.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{const n=o.schema,s=t.processors[i.type];if(!s)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);s(e,t,n,r)}const s=e._zod.parent;s&&(o.ref||(o.ref=s),ju(s,t,r),t.seen.get(s).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(o.schema,c),"input"===t.io&&Zu(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault;return t.seen.get(e).schema}function Uu(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const s of e.seen.entries()){const t=e.metadataRegistry.get(s[0])?.id;if(t){const e=r.get(t);if(e&&e!==s[0])throw new Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(t,s[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:s}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const s=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=s,{defId:s,ref:`${i("__shared")}#/${r}/${s}`}}if(t[1]===n)return{ref:"#"};const i=`#/${r}/`,s=t[1].schema.id??"__schema"+e.counter++;return{defId:s,ref:i+s}})(t);r.def={...r.schema},s&&(r.defId=s);const o=r.schema;for(const e in o)delete o[e];o.$ref=i};if("throw"===e.cycles)for(const s of e.seen.entries()){const e=s[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const n=s[1];if(t===s[0]){i(s);continue}if(e.external){const n=e.external.registry.get(s[0])?.id;if(t!==s[0]&&n){i(s);continue}}const r=e.metadataRegistry.get(s[0])?.id;r?i(s):(n.cycle||n.count>1&&"ref"===e.reused)&&i(s)}}function Fu(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,s={...i},o=n.ref;if(n.ref=null,o){r(o);const n=e.seen.get(o),a=n.schema;!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),Object.assign(i,s);if(t._zod.parent===o)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in s||delete i[e]);if(a.$ref)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==o){r(a);const t=e.seen.get(a);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&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(const a of[...e.seen.entries()].reverse())r(a[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);const s=e.external?.defs??{};for(const a of e.seen.entries()){const e=a[1];e.def&&e.defId&&(s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?i.$defs=s:i.definitions=s);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:Bu(t,"input",e.processors),output:Bu(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(o){throw new Error("Error converting schema to JSON.")}}function Zu(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return Zu(r.element,n);if("set"===r.type)return Zu(r.valueType,n);if("lazy"===r.type)return Zu(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return Zu(r.innerType,n);if("intersection"===r.type)return Zu(r.left,n)||Zu(r.right,n);if("record"===r.type||"map"===r.type)return Zu(r.keyType,n)||Zu(r.valueType,n);if("pipe"===r.type)return Zu(r.in,n)||Zu(r.out,n);if("object"===r.type){for(const e in r.shape)if(Zu(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(Zu(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(Zu(e,n))return!0;return!(!r.rest||!Zu(r.rest,n))}return!1}const Bu=(e,t,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Du({...i??{},target:s,io:t,processors:n});return ju(e,o),Uu(o,e),Fu(o,e)},Wu={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Hu=(e,t,n,r)=>{const i=e._zod.def;ju(i.innerType,t,r);t.seen.get(e).ref=i.innerType},Gu=Fo("ZodISODateTime",(e,t)=>{jc.init(e,t),ph.init(e,t)});const qu=Fo("ZodISODate",(e,t)=>{Uc.init(e,t),ph.init(e,t)});const Ju=Fo("ZodISOTime",(e,t)=>{Fc.init(e,t),ph.init(e,t)});const Vu=Fo("ZodISODuration",(e,t)=>{Zc.init(e,t),ph.init(e,t)});const Yu=Fo("ZodError",(e,t)=>{va.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>r({issues:e}));else if("invalid_key"===i.code)r({issues:i.issues});else if("invalid_element"===i.code)r({issues:i.issues});else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){const 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}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const 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}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,qo,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,qo,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),Xu=wa(Yu),Ku=_a(Yu),Qu=xa(Yu),eh=Sa(Yu),th=Ea(Yu),nh=Ca(Yu),rh=Ta(Yu),ih=za(Yu),sh=Pa(Yu),oh=Oa(Yu),ah=Ma(Yu),ch=Ia(Yu),lh=Fo("ZodType",(e,t)=>(Sc.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Bu(e,"input"),output:Bu(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=Du({...n,processors:t});return ju(e,r),Uu(r,e),Fu(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(ea(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>la(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>Xu(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Qu(e,t,n),e.parseAsync=async(t,n)=>Ku(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>eh(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>th(e,t,n),e.decode=(t,n)=>nh(e,t,n),e.encodeAsync=async(t,n)=>rh(e,t,n),e.decodeAsync=async(t,n)=>ih(e,t,n),e.safeEncode=(t,n)=>sh(e,t,n),e.safeDecode=(t,n)=>oh(e,t,n),e.safeEncodeAsync=async(t,n)=>ah(e,t,n),e.safeDecodeAsync=async(t,n)=>ch(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return Nu(ld,e,t)}(t,n)),e.superRefine=t=>e.check(Ru(t)),e.overwrite=t=>e.check(Cu(t)),e.optional=()=>Kh(e),e.exactOptional=()=>new Qh({type:"optional",innerType:e}),e.nullable=()=>td(e),e.nullish=()=>Kh(td(e)),e.nonoptional=t=>function(e,t){return new id({type:"nonoptional",innerType:e,...ua(t)})}(e,t),e.array=()=>Bh(e),e.or=t=>{return new Gh({type:"union",options:[e,t],...ua(n)});var n},e.and=t=>new qh({type:"intersection",left:e,right:t}),e.transform=t=>ad(e,Yh(t)),e.default=t=>{return n=t,new nd({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():oa(n)}});var n},e.prefault=t=>{return n=t,new rd({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():oa(n)}});var n},e.catch=t=>{return new sd({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>ad(e,t),e.readonly=()=>new cd({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Nl.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Nl.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Nl.get(e);const n=e.clone();return Nl.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),uh=Fo("_ZodString",(e,t)=>{Ac.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:i,maximum:s,format:o,patterns:a,contentEncoding:c}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof s&&(r.maxLength=s),o&&(r.format=Wu[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),c&&(r.contentEncoding=c),a&&a.size>0){const e=[...a];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(_u(...t)),e.includes=(...t)=>e.check(Su(...t)),e.startsWith=(...t)=>e.check(Au(...t)),e.endsWith=(...t)=>e.check(Eu(...t)),e.min=(...t)=>e.check(ku(...t)),e.max=(...t)=>e.check(vu(...t)),e.length=(...t)=>e.check(wu(...t)),e.nonempty=(...t)=>e.check(ku(1,...t)),e.lowercase=t=>e.check(xu(t)),e.uppercase=t=>e.check($u(t)),e.trim=()=>e.check(zu()),e.normalize=(...t)=>e.check(Tu(...t)),e.toLowerCase=()=>e.check(Pu()),e.toUpperCase=()=>e.check(Ou()),e.slugify=()=>e.check(Mu())}),hh=Fo("ZodString",(e,t)=>{Ac.init(e,t),uh.init(e,t),e.email=t=>e.check(Ll(mh,t)),e.url=t=>e.check(Bl(yh,t)),e.jwt=t=>e.check(iu(Oh,t)),e.emoji=t=>e.check(Wl(bh,t)),e.guid=t=>e.check(Dl(fh,t)),e.uuid=t=>e.check(jl(gh,t)),e.uuidv4=t=>e.check(Ul(gh,t)),e.uuidv6=t=>e.check(Fl(gh,t)),e.uuidv7=t=>e.check(Zl(gh,t)),e.nanoid=t=>e.check(Hl(vh,t)),e.guid=t=>e.check(Dl(fh,t)),e.cuid=t=>e.check(Gl(kh,t)),e.cuid2=t=>e.check(ql(wh,t)),e.ulid=t=>e.check(Jl(_h,t)),e.base64=t=>e.check(tu(Th,t)),e.base64url=t=>e.check(nu(zh,t)),e.xid=t=>e.check(Vl(xh,t)),e.ksuid=t=>e.check(Yl($h,t)),e.ipv4=t=>e.check(Xl(Sh,t)),e.ipv6=t=>e.check(Kl(Ah,t)),e.cidrv4=t=>e.check(Ql(Eh,t)),e.cidrv6=t=>e.check(eu(Ch,t)),e.e164=t=>e.check(ru(Ph,t)),e.datetime=t=>e.check(function(e){return su(Gu,e)}(t)),e.date=t=>e.check(function(e){return ou(qu,e)}(t)),e.time=t=>e.check(function(e){return au(Ju,e)}(t)),e.duration=t=>e.check(function(e){return cu(Vu,e)}(t))});function dh(e){return Rl(hh,e)}const ph=Fo("ZodStringFormat",(e,t)=>{Ec.init(e,t),uh.init(e,t)}),mh=Fo("ZodEmail",(e,t)=>{zc.init(e,t),ph.init(e,t)}),fh=Fo("ZodGUID",(e,t)=>{Cc.init(e,t),ph.init(e,t)}),gh=Fo("ZodUUID",(e,t)=>{Tc.init(e,t),ph.init(e,t)}),yh=Fo("ZodURL",(e,t)=>{Pc.init(e,t),ph.init(e,t)}),bh=Fo("ZodEmoji",(e,t)=>{Oc.init(e,t),ph.init(e,t)}),vh=Fo("ZodNanoID",(e,t)=>{Mc.init(e,t),ph.init(e,t)}),kh=Fo("ZodCUID",(e,t)=>{Ic.init(e,t),ph.init(e,t)}),wh=Fo("ZodCUID2",(e,t)=>{Nc.init(e,t),ph.init(e,t)}),_h=Fo("ZodULID",(e,t)=>{Rc.init(e,t),ph.init(e,t)}),xh=Fo("ZodXID",(e,t)=>{Lc.init(e,t),ph.init(e,t)}),$h=Fo("ZodKSUID",(e,t)=>{Dc.init(e,t),ph.init(e,t)}),Sh=Fo("ZodIPv4",(e,t)=>{Bc.init(e,t),ph.init(e,t)}),Ah=Fo("ZodIPv6",(e,t)=>{Wc.init(e,t),ph.init(e,t)}),Eh=Fo("ZodCIDRv4",(e,t)=>{Hc.init(e,t),ph.init(e,t)}),Ch=Fo("ZodCIDRv6",(e,t)=>{Gc.init(e,t),ph.init(e,t)}),Th=Fo("ZodBase64",(e,t)=>{Jc.init(e,t),ph.init(e,t)}),zh=Fo("ZodBase64URL",(e,t)=>{Vc.init(e,t),ph.init(e,t)}),Ph=Fo("ZodE164",(e,t)=>{Yc.init(e,t),ph.init(e,t)}),Oh=Fo("ZodJWT",(e,t)=>{Xc.init(e,t),ph.init(e,t)}),Mh=Fo("ZodNumber",(e,t)=>{Kc.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,{minimum:i,maximum:s,format:o,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number","number"==typeof l&&("draft-04"===t.target||"openapi-3.0"===t.target?(r.minimum=l,r.exclusiveMinimum=!0):r.exclusiveMinimum=l),"number"==typeof i&&(r.minimum=i,"number"==typeof l&&"draft-04"!==t.target&&(l>=i?delete r.minimum:delete r.exclusiveMinimum)),"number"==typeof c&&("draft-04"===t.target||"openapi-3.0"===t.target?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c),"number"==typeof s&&(r.maximum=s,"number"==typeof c&&"draft-04"!==t.target&&(c<=s?delete r.maximum:delete r.exclusiveMaximum)),"number"==typeof a&&(r.multipleOf=a)})(e,t,n),e.gt=(t,n)=>e.check(gu(t,n)),e.gte=(t,n)=>e.check(yu(t,n)),e.min=(t,n)=>e.check(yu(t,n)),e.lt=(t,n)=>e.check(mu(t,n)),e.lte=(t,n)=>e.check(fu(t,n)),e.max=(t,n)=>e.check(fu(t,n)),e.int=t=>e.check(Rh(t)),e.safe=t=>e.check(Rh(t)),e.positive=t=>e.check(gu(0,t)),e.nonnegative=t=>e.check(yu(0,t)),e.negative=t=>e.check(mu(0,t)),e.nonpositive=t=>e.check(fu(0,t)),e.multipleOf=(t,n)=>e.check(bu(t,n)),e.step=(t,n)=>e.check(bu(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Ih(e){return lu(Mh,e)}const Nh=Fo("ZodNumberFormat",(e,t)=>{Qc.init(e,t),Mh.init(e,t)});function Rh(e){return uu(Nh,e)}const Lh=Fo("ZodBoolean",(e,t)=>{el.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function Dh(e){return hu(Lh,e)}const jh=Fo("ZodUnknown",(e,t)=>{tl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function Uh(){return du(jh)}const Fh=Fo("ZodNever",(e,t)=>{nl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});const Zh=Fo("ZodArray",(e,t)=>{il.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,s=e._zod.def,{minimum:o,maximum:a}=e._zod.bag;"number"==typeof o&&(i.minItems=o),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=ju(s.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(ku(t,n)),e.nonempty=t=>e.check(ku(1,t)),e.max=(t,n)=>e.check(vu(t,n)),e.length=(t,n)=>e.check(wu(t,n)),e.unwrap=()=>e.element});function Bh(e,t){return Iu(Zh,e,t)}const Wh=Fo("ZodObject",(e,t)=>{ll.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,s=e._zod.def;i.type="object",i.properties={};const o=s.shape;for(const l in o)i.properties[l]=ju(o[l],t,{...r,path:[...r.path,"properties",l]});const a=new Set(Object.keys(o)),c=new Set([...a].filter(e=>{const n=s.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));c.size>0&&(i.required=Array.from(c)),"never"===s.catchall?._zod.def.type?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=ju(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),Ko(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Jh({type:"enum",entries:n,...ua(t)})}(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Uh()}),e.loose=()=>e.clone({...e._zod.def,catchall:Uh()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:pu(Fh,t)});var t},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!sa(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=ea(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Qo(this,"shape",n),n}});return la(e,r)}(e,t),e.safeExtend=t=>function(e,t){if(!sa(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ea(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Qo(this,"shape",n),n}});return la(e,n)}(e,t),e.merge=t=>function(e,t){const n=ea(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Qo(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return la(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return la(e,ea(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Qo(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=ea(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Qo(this,"shape",r),r},checks:[]});return la(e,i)}(e,t),e.partial=(...t)=>function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=ea(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)i[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return Qo(this,"shape",i),i},checks:[]});return la(t,i)}(Xh,e,t[0]),e.required=(...t)=>function(e,t,n){const r=ea(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)i[t]=new e({type:"nonoptional",innerType:r[t]});return Qo(this,"shape",i),i}});return la(t,r)}(id,e,t[0])});function Hh(e,t){const n={type:"object",shape:e??{},...ua(t)};return new Wh(n)}const Gh=Fo("ZodUnion",(e,t)=>{hl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,s=!1===i.inclusive,o=i.options.map((e,n)=>ju(e,t,{...r,path:[...r.path,s?"oneOf":"anyOf",n]}));s?n.oneOf=o:n.anyOf=o})(e,t,n,r),e.options=t.options});const qh=Fo("ZodIntersection",(e,t)=>{dl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,s=ju(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=ju(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];n.allOf=c})(e,t,n,r)});const Jh=Fo("ZodEnum",(e,t)=>{fl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=Go(e._zod.def.entries);r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const s of e){if(!n.has(s))throw new Error(`Key ${s} not found in enum`);i[s]=t.entries[s]}return new Jh({...t,checks:[],...ua(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new Jh({...t,checks:[],...ua(r),entries:i})}});const Vh=Fo("ZodTransform",(e,t)=>{gl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new Bo(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(ya(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(ya(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Yh(e){return new Vh({type:"transform",transform:e})}const Xh=Fo("ZodOptional",(e,t)=>{bl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hu(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function Kh(e){return new Xh({type:"optional",innerType:e})}const Qh=Fo("ZodExactOptional",(e,t)=>{vl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hu(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});const ed=Fo("ZodNullable",(e,t)=>{kl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,s=ju(i.innerType,t,r),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function td(e){return new ed({type:"nullable",innerType:e})}const nd=Fo("ZodDefault",(e,t)=>{wl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ju(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const rd=Fo("ZodPrefault",(e,t)=>{xl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ju(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});const id=Fo("ZodNonOptional",(e,t)=>{$l.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ju(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});const sd=Fo("ZodCatch",(e,t)=>{Al.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let s;ju(i.innerType,t,r),t.seen.get(e).ref=i.innerType;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const od=Fo("ZodPipe",(e,t)=>{El.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,s="input"===t.io?"transform"===i.in._zod.def.type?i.out:i.in:i.out;ju(s,t,r),t.seen.get(e).ref=s})(e,t,0,r),e.in=t.in,e.out=t.out});function ad(e,t){return new od({type:"pipe",in:e,out:t})}const cd=Fo("ZodReadonly",(e,t)=>{Tl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ju(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});const ld=Fo("ZodCustom",(e,t)=>{Pl.init(e,t),lh.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});function ud(e,t){return ad(Yh(e),t)}const hd=/^[A-Z][a-z]+\s[A-Z][a-z]+$/,dd=e=>e.normalize("NFC").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\u202A-\u202E\u2066-\u2069]/g,"").trim(),pd=Hh({id:dh(),pseudonym:dh().optional(),msg:dh(),pubDate:Ih(),modDate:Ih().optional(),replyTo:dh().optional(),isAdmin:Dh().optional()}),md=Hh({comments:Bh(pd),isAdmin:Dh()}),fd=Hh({pseudonym:ud(e=>"string"==typeof e&&""===e.trim()?void 0:e,dh().max(80).regex(hd).optional()),msg:dh().min(1).max(1e3).transform(dd),replyTo:dh().regex(/^[0-9A-Z]{12}$/).optional(),email:dh().optional()}),gd=Hh({id:dh(),timestamp:Ih(),token:dh()}),yd=Hh({pseudonym:ud(e=>"string"==typeof e&&""===e.trim()?void 0:e,dh().max(80).regex(hd).optional()),msg:dh().min(1).max(1e3).transform(dd)});Hh({post:dh()}),Hh({post:dh(),challenge:dh(),nonce:dh().regex(/^\d+$/)}),Hh({"x-comment-id":dh(),"x-comment-token":dh(),"x-comment-timestamp":dh()});const bd=Hh({username:dh(),password:dh()}),vd=Hh({success:Dh(),message:dh()}),kd=Hh({success:Dh(),message:dh()}),wd=Hh({authenticated:Dh()});Hh({challenge:dh(),nonce:Ih().int().positive()});const _d=Hh({challenge:dh()});let xd=null,$d=0;const Sd=new Map;async function Ad(e,t){return new Promise(n=>{const r=function(){if(!xd){const e=new Blob(["\nasync function sha256(input) {\n const encoder = new TextEncoder();\n const data = encoder.encode(input);\n const hashBuffer = await crypto.subtle.digest('SHA-256', data);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');\n return hashHex;\n}\n\nasync function solvePow(difficulty, challenge, maxRetries) {\n let nonce = 0;\n const targetPrefix = '0'.repeat(difficulty);\n let retries = 0;\n\n while (retries++ < maxRetries) {\n const hash = await sha256(challenge + ':' + nonce);\n if (hash.startsWith(targetPrefix)) {\n return nonce;\n }\n nonce++;\n }\n return -1;\n}\n\nself.onmessage = async (e) => {\n const { requestId, type, difficulty, challenge, maxRetries } = e.data;\n if (type === 'solve') {\n try {\n const nonce = await solvePow(difficulty, challenge, maxRetries);\n self.postMessage({\n requestId,\n success: nonce >= 0,\n nonce,\n });\n } catch (error) {\n self.postMessage({\n requestId,\n success: false,\n nonce: -1,\n error: error instanceof Error ? error.message : 'Unknown error',\n });\n }\n }\n};\n"],{type:"application/javascript"}),t=URL.createObjectURL(e);xd=new Worker(t),xd.addEventListener("message",e=>{const{requestId:t,success:n,nonce:r,error:i}=e.data,s=Sd.get(t);s&&(Sd.delete(t),i?(console.error("PoW Worker error:",i),s(-1)):n?s(r):(console.warn("Failed to solve PoW within max retries"),s(-1)))}),xd.addEventListener("error",e=>{console.error("PoW Worker error:",e.message),Sd.forEach(e=>e(-1)),Sd.clear()})}return xd}(),i=$d++;Sd.set(i,n),r.postMessage({requestId:i,type:"solve",difficulty:e,challenge:t,maxRetries:1e6})})}const Ed=(e,t,n)=>{const r="my_comment_ids",i=new Map,s=(e,t,n)=>{i.set(e,{timestamp:t,token:n})},o=e=>{i.delete(e)},a=e=>{const t=i.get(e);return t?{id:e,...t}:null},c=e=>{try{const t=new Set(JSON.parse(localStorage.getItem(r)||"[]"));t.add(e),localStorage.setItem(r,JSON.stringify(Array.from(t)))}catch(t){console.warn("Failed to save my comment ID:",t)}};return{getComments:async t=>{try{const n=new URL("/api/comments",e);n.searchParams.append("post",t);const r=await fetch(n,{credentials:"include"}),i=await r.json();return md.parse(i)}catch(n){return console.error("Error getting comments:",n),{comments:[],isAdmin:!1}}},addComment:async(r,i,o,a)=>{try{const l=await async function(e,t){const n=`${Math.floor(Date.now()/1e3)}:${t}`;return{challenge:n,nonce:await Ad(e,n)}}(t,n);if(l.nonce<0)return console.error("Failed to solve pre-PoW"),null;console.debug("Pre-PoW solved:",l);const u=await(async(t,n)=>{try{const r=new URL("/api/pow/formal-challenge",e),i=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({challenge:t,nonce:n})});if(i.ok){const e=await i.json();return _d.parse(e).challenge}return console.error("Failed to get formal challenge:",i.status,i.statusText),null}catch(r){return console.error("Error getting formal challenge:",r),null}})(l.challenge,l.nonce);if(!u)return console.error("Failed to get formal challenge"),null;console.debug("Using formal challenge:",u);const h=parseInt(u.split(":")[2],10);console.debug("Solving formal PoW with difficulty:",h);const d=await async function(e,t,n){return Ad(e,`${t}:${n}`)}(h,u,r);if(d<0)throw console.error("Failed to solve formal PoW"),new Error("Failed to solve proof-of-work. Please try again.");console.debug("Formal PoW solved, nonce:",d);const p=document.querySelector('input[name="email"]'),m=p?p.value:"",f=fd.parse({pseudonym:i,msg:o,replyTo:a,email:m}),g=new URL("/api/comments",e);g.searchParams.append("post",r),g.searchParams.append("challenge",u),g.searchParams.append("nonce",d.toString());const y=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(f)});if(y.ok){const e=await y.json(),t=gd.parse(e);return s(t.id,t.timestamp,t.token),c(t.id),t.id}return console.error("Failed to add comment:",y.status,y.statusText),null}catch(l){throw console.error("Error adding comment:",l),l}},updateComment:async(t,n,r,i)=>{const s=a(n);if(!s)return!1;try{const n=new URL("/api/comments",e);n.searchParams.append("post",t);const o=yd.parse({pseudonym:r,msg:i});return(await fetch(n,{method:"PUT",headers:{"Content-Type":"application/json","X-Comment-ID":s.id,"X-Comment-Token":s.token,"X-Comment-Timestamp":s.timestamp.toString()},body:JSON.stringify(o)})).ok}catch{return!1}},deleteComment:async(t,n)=>{const r=a(n);if(!r)return!1;try{const i=new URL("/api/comments",e);i.searchParams.append("post",t);return!!(await fetch(i,{method:"DELETE",headers:{"Content-Type":"application/json","X-Comment-ID":r.id,"X-Comment-Token":r.token,"X-Comment-Timestamp":r.timestamp.toString()}})).ok&&(o(n),!0)}catch{return!1}},canEditComment:e=>!!a(e),isMyComment:e=>{try{return JSON.parse(localStorage.getItem(r)||"[]").includes(e)}catch(t){return console.warn("Failed to check if my comment:",t),!1}},adminLogin:async(t,n)=>{try{const r=bd.parse({username:t,password:n}),i=new URL("/admin/login",e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r),credentials:"include"});if(s.ok){const e=await s.json();return vd.parse(e)}return console.error("Admin login failed:",s.status,s.statusText),null}catch(r){return console.error("Error during admin login:",r),null}},adminLogout:async()=>{try{const t=new URL("/admin/logout",e),n=await fetch(t,{method:"POST",credentials:"include"});if(n.ok){const e=await n.json();return kd.parse(e).success}return!1}catch(t){return console.error("Error during admin logout:",t),!1}},checkAdminAuth:async()=>{try{const t=new URL("/admin/check",e),n=await fetch(t,{method:"GET",credentials:"include"});if(n.ok){const e=await n.json();return wd.parse(e).authenticated}return!1}catch(t){return console.error("Error checking admin auth:",t),!1}}}};var Cd,Td,zd,Pd,Od,Md,Id,Nd,Rd,Ld,Dd,jd,Ud,Fd,Zd,Bd,Wd,Hd,Gd,qd,Jd,Vd,Yd,Xd,Kd,Qd,ep,tp,np,rp,ip,sp,op,ap,cp,lp,up,hp,dp,pp,mp,fp,gp,yp,bp,vp,kp,wp,_p,xp,$p,Sp=Object.create,Ap=Object.defineProperty,Ep=Object.getOwnPropertyDescriptor,Cp=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Tp=e=>{throw TypeError(e)},zp=(e,t)=>Ap(e,"name",{value:t,configurable:!0}),Pp=["class","method","getter","setter","accessor","field","value","get","set"],Op=e=>void 0!==e&&"function"!=typeof e?Tp("Function expected"):e,Mp=(e,t,n,r,i)=>({kind:Pp[e],name:t,metadata:r,addInitializer:e=>n._?Tp("Already initialized"):i.push(Op(e||null))}),Ip=(e,t)=>{return n=t,r=Cp("metadata"),i=e[3],r in n?Ap(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i;var n,r,i},Np=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)1&t?s[i].call(n):r=s[i].call(n,r);return r},Rp=(e,t,n,r,i,s)=>{var o,a,c,l,u,h=7&t,d=!!(8&t),p=!!(16&t),m=h>3?e.length+1:h?d?1:2:0,f=Pp[h+5],g=h>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),b=h&&(!p&&!d&&(i=i.prototype),h<5&&(h>3||!p)&&Ep(h<4?i:{get[n](){return jp(this,s)},set[n](e){return Fp(this,s,e)}},n));h?p&&h<4&&zp(s,(h>2?"set ":h>1?"get ":"")+n):zp(i,n);for(var v=r.length-1;v>=0;v--)l=Mp(h,n,c={},e[3],y),h&&(l.static=d,l.private=p,u=l.access={has:p?e=>Dp(i,e):e=>n in e},3^h&&(u.get=p?e=>(1^h?jp:Zp)(e,i,4^h?s:b.get):e=>e[n]),h>2&&(u.set=p?(e,t)=>Fp(e,i,t,4^h?s:b.set):(e,t)=>e[n]=t)),a=(0,r[v])(h?h<4?p?s:b[f]:h>4?void 0:{get:b.get,set:b.set}:i,l),c._=1,4^h||void 0===a?Op(a)&&(h>4?g.unshift(a):h?p?s=a:b[f]=a:i=a):"object"!=typeof a||null===a?Tp("Object expected"):(Op(o=a.get)&&(b.get=o),Op(o=a.set)&&(b.set=o),Op(o=a.init)&&g.unshift(o));return h||Ip(e,i),b&&Ap(i,n,b),p?4^h?s:b:i},Lp=(e,t,n)=>t.has(e)||Tp("Cannot "+n),Dp=(e,t)=>Object(t)!==t?Tp('Cannot use the "in" operator on this value'):e.has(t),jp=(e,t,n)=>(Lp(e,t,"read from private field"),n?n.call(e):t.get(e)),Up=(e,t,n)=>t.has(e)?Tp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Fp=(e,t,n,r)=>(Lp(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Zp=(e,t,n)=>(Lp(e,t,"access private method"),n);Qd=[ce("yangchun-comment")];class Bp extends(Kd=oe,Xd=[he({type:String})],Yd=[he({type:String})],Vd=[he({type:String})],Jd=[he({type:String})],qd=[he({type:String})],Gd=[he({type:Number})],Hd=[he({type:Object,attribute:!1})],Wd=[de()],Bd=[de()],Zd=[de()],Fd=[de()],Ud=[de()],jd=[de()],Dd=[de()],Ld=[de()],Rd=[de()],Nd=[de()],Id=[de()],Md=[de()],Od=[de()],Pd=[de()],zd=[de()],Td=[pe("comment-input")],Cd=[pe("comment-admin")],Kd){constructor(){super(...arguments),Up(this,tp,Np(ep,8,this,"my-post")),Np(ep,11,this),Up(this,np,Np(ep,12,this,"http://localhost:8787")),Np(ep,15,this),Up(this,rp,Np(ep,16,this,"Admin")),Np(ep,19,this),Up(this,ip,Np(ep,20,this,"en-US")),Np(ep,23,this),Up(this,sp,Np(ep,24,this,"MAGIC")),Np(ep,27,this),Up(this,op,Np(ep,28,this,2)),Np(ep,31,this),Up(this,ap,Np(ep,32,this)),Np(ep,35,this),Up(this,cp,Np(ep,36,this,"")),Np(ep,39,this),Up(this,lp,Np(ep,40,this,"")),Np(ep,43,this),Up(this,up,Np(ep,44,this,[])),Np(ep,47,this),Up(this,hp,Np(ep,48,this,"")),Np(ep,51,this),Up(this,dp,Np(ep,52,this,"")),Np(ep,55,this),Up(this,pp,Np(ep,56,this,null)),Np(ep,59,this),Up(this,mp,Np(ep,60,this,!0)),Np(ep,63,this),Up(this,fp,Np(ep,64,this,!1)),Np(ep,67,this),Up(this,gp,Np(ep,68,this,!1)),Np(ep,71,this),Up(this,yp,Np(ep,72,this,!1)),Np(ep,75,this),Up(this,bp,Np(ep,76,this,!1)),Np(ep,79,this),Up(this,vp,Np(ep,80,this,"")),Np(ep,83,this),Up(this,kp,Np(ep,84,this,!1)),Np(ep,87,this),Up(this,wp,Np(ep,88,this,"")),Np(ep,91,this),Up(this,_p,Np(ep,92,this,"")),Np(ep,95,this),Up(this,xp,Np(ep,96,this)),Np(ep,99,this),Up(this,$p,Np(ep,100,this)),Np(ep,103,this),this.handleAuthStatusChange=e=>{this.isAdmin=e.detail},this.handleExternalLinkClick=e=>{const t=e.detail;t&&(this.externalLinkUrl=t,this.showExternalLink=!0)},this.handleOpenLink=()=>{this.externalLinkUrl&&(window.open(this.externalLinkUrl,"_blank","noopener,noreferrer"),this.showExternalLink=!1,this.externalLinkUrl="")},this.handleCopyLink=async()=>{if(this.externalLinkUrl){try{await navigator.clipboard.writeText(this.externalLinkUrl),console.log("Link copied to clipboard")}catch(e){console.error("Failed to copy link:",e)}this.showExternalLink=!1,this.externalLinkUrl=""}}}render(){const e=Z`
793
+ <div class="help-content">
794
+ <div class="help-desc">
795
+ ${or("helpDesc").split("\n").map(e=>Z`<p>${e}</p>`)}
796
+ </div>
797
+ <pre class="help-md-sample">
798
+ [${or("helpMdLink")}](https://example.com)
799
+
800
+ ![${or("helpMdImage")}](https://example.com/img.jpg)
801
+
802
+ *${or("helpMdItalic")}*
803
+
804
+ **${or("helpMdBold")}**
805
+
806
+ - ${or("helpMdList")}
807
+
808
+ 1. ${or("helpMdOrderedList")}
809
+
810
+ \`${or("helpMdInlineCode")}\`
811
+
812
+ \`\`\`
813
+ ${or("helpMdCodeBlock")}
814
+ \`\`\`
815
+
816
+ &lt;img src=&quot;${or("helpMdNoHtml")}&quot;&gt;
817
+ </pre
818
+ >
819
+ <div class="help-footer">
820
+ Powered by${" "}
821
+ <a href="https://ycc.ziteh.dev/" rel="noopener noreferrer" target="_blank">
822
+ Yang Chun Comment
823
+ </a>
824
+ (<a
825
+ href="https://github.com/ziteh/yangchun-comment"
826
+ rel="noopener noreferrer"
827
+ target="_blank"
828
+ >GitHub</a
829
+ >)
830
+ </div>
831
+ </div>
832
+ `;return Z`
833
+ <div class="root" part="root">
834
+ <!-- <slot></slot> -->
835
+ <comment-input
836
+ .draft=${this.draft}
837
+ .nickname=${this.nickname}
838
+ .editPseudonym=${this.editPseudonym}
839
+ .adminName=${this.adminName}
840
+ .isAdmin=${this.isAdmin}
841
+ @draft-change=${this.handleDraftChange}
842
+ @nickname-change=${this.handleNicknameChange}
843
+ @comment-submit=${this.handleCommentSubmit}
844
+ ></comment-input>
845
+ <comment-info
846
+ .comment=${this.referenceComment}
847
+ .isReply=${this.isReply}
848
+ .errorMessage=${this.errorMessage}
849
+ @error-clear=${()=>this.errorMessage=""}
850
+ @reference-comment-cancel=${this.handleRefCommentCancel}
851
+ @notify-open=${()=>this.showNotify=!0}
852
+ @help-open=${()=>this.showHelp=!0}
853
+ @admin-open=${()=>this.showAdmin=!0}
854
+ ></comment-info>
855
+ <comment-list
856
+ .comments=${this.comments}
857
+ .author=${this.adminName}
858
+ @comment-reply=${this.handleCommentReply}
859
+ @comment-edit=${this.handleCommentEdit}
860
+ @comment-delete=${this.handleCommentDelete}
861
+ ></comment-list>
862
+
863
+ <comment-dialog
864
+ header=${or("confirmDelete")}
865
+ .open=${""!==this.deleteCommentId}
866
+ @close=${()=>this.deleteCommentId=""}
867
+ >
868
+ <p>${or("confirmDeleteDesc1")+this.deleteCommentId}</p>
869
+ <strong>${or("confirmDeleteDesc2")}</strong>
870
+ <div class="dialog-actions">
871
+ <button class="secondary" @click=${this.handleDeleteComment}>${or("delete")}</button>
872
+ <button @click=${()=>this.deleteCommentId=""}>${or("cancel")}</button>
873
+ </div>
874
+ </comment-dialog>
875
+ <comment-dialog
876
+ header="Admin"
877
+ .open=${this.showAdmin}
878
+ @close=${()=>this.showAdmin=!1}
879
+ >
880
+ <comment-admin @auth-status-change=${this.handleAuthStatusChange}></comment-admin>
881
+ </comment-dialog>
882
+ <comment-dialog
883
+ header=${or("notify")}
884
+ .open=${this.showNotify}
885
+ @close=${()=>this.showNotify=!1}
886
+ >
887
+ <p>${or("notifyDesc")}</p>
888
+ <a href="${this.rssFeedUrl}" target="_blank" rel="noopener noreferrer">RSS feed</a>
889
+ </comment-dialog>
890
+ <comment-dialog
891
+ header=${or("help")}
892
+ .open=${this.showHelp}
893
+ @close=${()=>this.showHelp=!1}
894
+ >
895
+ ${e}
896
+ </comment-dialog>
897
+ <comment-dialog
898
+ header=${or("externalLinkWarning")}
899
+ .open=${this.showExternalLink}
900
+ @close=${()=>this.showExternalLink=!1}
901
+ >
902
+ <p>${or("externalLinkDesc")}</p>
903
+ <p class="external-link-url">${this.externalLinkUrl}</p>
904
+ <div class="dialog-actions">
905
+ <button class="secondary" @click=${this.handleCopyLink}>${or("copyLink")}</button>
906
+ <button @click=${this.handleOpenLink}>${or("openLink")}</button>
907
+ </div>
908
+ </comment-dialog>
909
+ </div>
910
+ `}willUpdate(e){if(e.has("customMessages")||e.has("lang"))if(this.customMessages)ar(this.customMessages);else{ar([rr,ir].find(e=>e.bcp47===this.lang)||rr)}if((e.has("apiUrl")||e.has("prePowDifficulty")||e.has("prePowSalt"))&&this.apiUrl){console.debug("Initializing API service with URL:",this.apiUrl);const e=Ed(this.apiUrl,this.prePowDifficulty,this.prePowSalt);ge.setInstance(e);const t=new URL("/rss/thread",this.apiUrl);t.searchParams.append("post",this.post),this.rssFeedUrl=t.href}super.willUpdate(e)}updated(e){super.updated(e),e.has("post")&&this.updatedComments()}async firstUpdated(){console.debug("firstUpdated","apiUrl:",this.apiUrl),this.addEventListener("external-link-click",this.handleExternalLinkClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("external-link-click",this.handleExternalLinkClick),xd&&(Sd.forEach(e=>e(-1)),Sd.clear(),xd.terminate(),xd=null)}async updatedComments(){try{const e=await ge.getInstance().getComments(this.post);this.comments=e.comments,void 0!==e.isAdmin&&this.commentAdmin&&this.commentAdmin.updateAuthStatus(e.isAdmin)}catch(e){console.error("Error updating comments:",e)}}async handleRefCommentCancel(e){const t=e.detail;console.debug("Cancel reply to comment ID:",t),this.referenceComment?.id===t&&(this.referenceComment=null,this.isReply=!0,await this.updateComplete,this.commentInput?.focus())}handleDraftChange(e){this.draft=e.detail}handleNicknameChange(e){this.nickname=e.detail}async editedSubmit(){if(!this.referenceComment)return;if(this.isReply)return;const e=this.draft.trim();if(e)try{const t=await ge.getInstance().updateComment(this.post,this.referenceComment.id,this.referenceComment.pseudonym||"",e);console.debug("Edit comment ID:",this.referenceComment.id,t),this.draft="",this.editPseudonym="",this.referenceComment=null,this.isReply=!0,await this.updatedComments()}catch(t){console.error("Failed to add comment:",t)}}async handleCommentSubmit(){if(this.referenceComment&&!this.isReply)return await this.editedSubmit(),void(await this.updatedComments());const e=this.draft.trim();if(!e)return;const{pseudonym:t}=await Ur(this.nickname),n=this.referenceComment&&this.referenceComment.id&&this.isReply?this.referenceComment.id:void 0;try{const r=await ge.getInstance().addComment(this.post,t,e,n);console.debug("Added comment ID:",r),this.draft="",this.editPseudonym="",this.referenceComment=null,await this.updatedComments()}catch(r){return console.error("Failed to add comment:",r),void(this.errorMessage=r.message||"Failed to add comment. Please try again.")}}async handleCommentReply(e){const t=e.detail;console.debug("Reply to comment ID:",t);const n=this.comments.find(e=>e.id===t);n?(this.isReply||(this.draft=""),this.referenceComment=n,this.isReply=!0,await this.updateComplete,this.commentInput?.focus()):this.referenceComment=null}async handleCommentDelete(e){const t=e.detail;console.debug("Delete comment ID:",t),this.deleteCommentId=t}async handleCommentEdit(e){const t=e.detail;console.debug("Edit comment ID:",t);const n=this.comments.find(e=>e.id===t);n?(this.referenceComment=n,this.isReply=!1,this.draft=n.msg||"",this.editPseudonym=n.pseudonym||"",await this.updateComplete,this.commentInput?.focus()):this.referenceComment=null}async handleDeleteComment(){if(!this.deleteCommentId)return;const e=this.deleteCommentId;console.debug("Delete comment ID:",e);try{await ge.getInstance().deleteComment(this.post,e)&&(console.debug("Deleted comment ID:",e),this.deleteCommentId="",await this.updatedComments())}catch(t){console.error("Failed to delete comment:",t),this.deleteCommentId=""}}}ep=(e=>[,,,Sp(e?.[Cp("metadata")]??null)])(Kd),tp=new WeakMap,np=new WeakMap,rp=new WeakMap,ip=new WeakMap,sp=new WeakMap,op=new WeakMap,ap=new WeakMap,cp=new WeakMap,lp=new WeakMap,up=new WeakMap,hp=new WeakMap,dp=new WeakMap,pp=new WeakMap,mp=new WeakMap,fp=new WeakMap,gp=new WeakMap,yp=new WeakMap,bp=new WeakMap,vp=new WeakMap,kp=new WeakMap,wp=new WeakMap,_p=new WeakMap,xp=new WeakMap,$p=new WeakMap,Rp(ep,4,"post",Xd,Bp,tp),Rp(ep,4,"apiUrl",Yd,Bp,np),Rp(ep,4,"adminName",Vd,Bp,rp),Rp(ep,4,"lang",Jd,Bp,ip),Rp(ep,4,"prePowSalt",qd,Bp,sp),Rp(ep,4,"prePowDifficulty",Gd,Bp,op),Rp(ep,4,"customMessages",Hd,Bp,ap),Rp(ep,4,"draft",Wd,Bp,cp),Rp(ep,4,"nickname",Bd,Bp,lp),Rp(ep,4,"comments",Zd,Bp,up),Rp(ep,4,"editPseudonym",Fd,Bp,hp),Rp(ep,4,"deleteCommentId",Ud,Bp,dp),Rp(ep,4,"referenceComment",jd,Bp,pp),Rp(ep,4,"isReply",Dd,Bp,mp),Rp(ep,4,"showAdmin",Ld,Bp,fp),Rp(ep,4,"showHelp",Rd,Bp,gp),Rp(ep,4,"showNotify",Nd,Bp,yp),Rp(ep,4,"showExternalLink",Id,Bp,bp),Rp(ep,4,"externalLinkUrl",Md,Bp,vp),Rp(ep,4,"isAdmin",Od,Bp,kp),Rp(ep,4,"rssFeedUrl",Pd,Bp,wp),Rp(ep,4,"errorMessage",zd,Bp,_p),Rp(ep,4,"commentInput",Td,Bp,xp),Rp(ep,4,"commentAdmin",Cd,Bp,$p),(Bp=Rp(ep,0,"YangChunComment",Qd,Bp)).styles=[me,fe,o`
911
+ :host {
912
+ display: block;
913
+ }
914
+ .dialog-actions {
915
+ margin-top: var(--ycc-spacing-m);
916
+ display: flex;
917
+ justify-content: flex-end;
918
+ gap: var(--ycc-spacing-s);
919
+ }
920
+ .help-content {
921
+ display: flex;
922
+ flex-direction: column;
923
+ gap: var(--ycc-spacing-m);
924
+ }
925
+ .help-desc p {
926
+ margin: 0 0 var(--ycc-spacing-s) 0;
927
+ }
928
+ .help-desc p:last-child {
929
+ margin-bottom: 0;
930
+ }
931
+ .help-md-sample {
932
+ background-color: var(--ycc-bg-secondary);
933
+ padding: var(--ycc-spacing-m);
934
+ border-radius: var(--ycc-radius);
935
+ font-family: var(--ycc-font-monospace);
936
+ font-size: 0.9em;
937
+ line-height: 1.6;
938
+ white-space: pre;
939
+ overflow-x: auto;
940
+ margin: 0;
941
+ }
942
+ .help-footer {
943
+ font-size: 0.85em;
944
+ color: var(--ycc-text-secondary);
945
+ text-align: center;
946
+ margin-top: var(--ycc-spacing-xs);
947
+ }
948
+ .help-footer a {
949
+ color: var(--ycc-primary-color);
950
+ text-decoration: none;
951
+ }
952
+ .help-footer a:hover {
953
+ text-decoration: underline;
954
+ }
955
+ .external-link-url {
956
+ word-break: break-all;
957
+ color: var(--ycc-primary-color);
958
+ font-family: var(--ycc-font-monospace);
959
+ font-size: 0.9em;
960
+ }
961
+ `],Np(ep,1,Bp),e.YangChunComment=Bp,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
962
+ //# sourceMappingURL=yangchun-comment.umd.cjs.map