@scoperat/tracker 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/dist/widget/index.js +3 -6
- package/dist/widget/index.js.map +1 -1
- package/dist/widget.global.js +1 -1
- package/dist/widget.global.js.map +1 -1
- package/package.json +1 -1
package/dist/widget.global.js
CHANGED
|
@@ -897,7 +897,7 @@
|
|
|
897
897
|
background-clip: padding-box;
|
|
898
898
|
}
|
|
899
899
|
`}var qe,O,dn,$r,Ke=0,Hr=[],M=R,Dr=M.__b,Pr=M.__r,Or=M.diffed,Nr=M.__c,Mr=M.unmount,zr=M.__;function fn(t,e){M.__h&&M.__h(O,t,Ke||e),Ke=0;var n=O.__H||(O.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function z(t){return Ke=1,vs(Br,t)}function vs(t,e,n){var r=fn(qe++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):Br(void 0,e),function(u){var l=r.__N?r.__N[0]:r.__[0],p=r.t(l,u);l!==p&&(r.__N=[p,r.__[1]],r.__c.setState({}))}],r.__c=O,!O.__f)){var i=function(u,l,p){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(m){return m.__c});if(h.every(function(m){return!m.__N}))return!s||s.call(this,u,l,p);var d=r.__c.props!==u;return h.some(function(m){if(m.__N){var g=m.__[0];m.__=m.__N,m.__N=void 0,g!==m.__[0]&&(d=!0)}}),s&&s.call(this,u,l,p)||d};O.__f=!0;var s=O.shouldComponentUpdate,o=O.componentWillUpdate;O.componentWillUpdate=function(u,l,p){if(this.__e){var h=s;s=void 0,i(u,l,p),s=h}o&&o.call(this,u,l,p)},O.shouldComponentUpdate=i}return r.__N||r.__}function Se(t,e){var n=fn(qe++,3);!M.__s&&Ur(n.__H,e)&&(n.__=t,n.u=e,O.__H.__h.push(n))}function Ve(t){return Ke=5,Ee(function(){return{current:t}},[])}function Ee(t,e){var n=fn(qe++,7);return Ur(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function fe(t,e){return Ke=8,Ee(function(){return t},e)}function ys(){for(var t;t=Hr.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(St),e.__h.some(hn),e.__h=[]}catch(n){e.__h=[],M.__e(n,t.__v)}}}M.__b=function(t){O=null,Dr&&Dr(t)},M.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),zr&&zr(t,e)},M.__r=function(t){Pr&&Pr(t),qe=0;var e=(O=t.__c).__H;e&&(dn===O?(e.__h=[],O.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.some(St),e.__h.some(hn),e.__h=[],qe=0)),dn=O},M.diffed=function(t){Or&&Or(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Hr.push(e)!==1&&$r===M.requestAnimationFrame||(($r=M.requestAnimationFrame)||Ts)(ys)),e.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),dn=O=null},M.__c=function(t,e){e.some(function(n){try{n.__h.some(St),n.__h=n.__h.filter(function(r){return!r.__||hn(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],M.__e(r,n.__v)}}),Nr&&Nr(t,e)},M.unmount=function(t){Mr&&Mr(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.some(function(r){try{St(r)}catch(i){e=i}}),n.__H=void 0,e&&M.__e(e,n.__v))};var Fr=typeof requestAnimationFrame=="function";function Ts(t){var e,n=function(){clearTimeout(r),Fr&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);Fr&&(e=requestAnimationFrame(n))}function St(t){var e=O,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),O=e}function hn(t){var e=O;t.__c=t.__(),O=e}function Ur(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function Br(t,e){return typeof e=="function"?e(t):e}var Ye=[],jr=!1;function Xe(t){Ye.push(t),Ye.length>20&&(Ye=Ye.slice(-20))}function gn(t,e=120){return t.length>e?t.slice(0,e)+"\u2026":t}function mn(){return[...Ye]}function Wr(t){Xe(t)}function Gr(){if(jr||typeof window>"u")return;jr=!0,document.addEventListener("click",n=>{let r=n.target;if(!r)return;let i=r.textContent?.trim()||r.getAttribute("aria-label")||"";Xe({type:"user",category:"click",message:gn(`${r.tagName.toLowerCase()}${i?` "${i}"`:""}`),timestamp:Date.now(),data:{tagName:r.tagName.toLowerCase(),className:r.className?gn(r.className,80):void 0}})},{capture:!0});let t=history.pushState;history.pushState=function(...n){let r=location.pathname;t.apply(this,n),Xe({type:"navigation",category:"navigation",message:`${r} \u2192 ${location.pathname}`,timestamp:Date.now()})},window.addEventListener("popstate",()=>{Xe({type:"navigation",category:"navigation",message:`popstate \u2192 ${location.pathname}`,timestamp:Date.now()})});let e=n=>{let r=console[n];console[n]=(...i)=>{Xe({type:"console",category:`console.${n}`,message:gn(i.map(s=>typeof s=="string"?s:String(s)).join(" ")),timestamp:Date.now()}),r.apply(console,i)}};e("error"),e("warn")}function Ze(){return typeof window>"u"?{}:{page:{url:window.location.href,path:window.location.pathname,title:document.title,referrer:document.referrer||void 0},screen:{width:window.screen.width,height:window.screen.height},locale:navigator.language,userAgent:navigator.userAgent,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}var qr=new Map;function Ss(t,e){let n=e?.split(`
|
|
900
|
-
`)[1]?.trim()??"";return`${t}:${n}`}function Es(t){let e=qr.get(t);return e&&Date.now()-e<6e4?!0:(qr.set(t,Date.now()),!1)}function Kr(t,e,n){let r=Ss(e.type,e.stack);Es(r)||t.track("$exception",{...e,context:{breadcrumbs:n()}})}function Vr(t,e){typeof window>"u"||(window.onerror=(n,r,i,s,o)=>{let u=o??new Error(String(n));Kr(t,{type:u.name||"Error",message:u.message||String(n),stack:u.stack,handled:!1,mechanism:"onerror",source:"browser",filename:r,lineno:i,colno:s},e)},window.onunhandledrejection=n=>{let r=n.reason,i=r instanceof Error?r:new Error(String(r));Kr(t,{type:i.name||"UnhandledRejection",message:i.message,stack:i.stack,handled:!1,mechanism:"onunhandledrejection",source:"browser"},e)})}var Et=class{constructor(e){b(this,"endpoint");b(this,"writeKey");b(this,"timeout");b(this,"environment");b(this,"getIdentity");b(this,"onEvaluation");b(this,"cache",new Map);b(this,"ready",!1);b(this,"readyCallbacks",[]);b(this,"changeListeners",new Set);b(this,"evalTracked",new Set);b(this,"timer",null);this.endpoint=e.endpoint,this.writeKey=e.writeKey,this.timeout=e.timeout??1e4,this.environment=e.environment,this.getIdentity=e.getIdentity,this.onEvaluation=e.onEvaluation;let n=e.pollInterval??6e4;this.fetch(),this.timer=setInterval(()=>this.fetch(),n)}getFlag(e,n){let r=this.cache.get(e);return r?(this.evalTracked.has(e)||(this.evalTracked.add(e),this.onEvaluation?.(e,r)),r.value):n}onFlagsReady(e){this.ready?e():this.readyCallbacks.push(e)}onFlagChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}async refresh(){await this.fetch()}destroy(){this.timer&&(clearInterval(this.timer),this.timer=null)}async fetch(){if(!this.writeKey||!this.endpoint)return;let e=new URLSearchParams;this.environment&&e.set("environment",this.environment);let n=this.getIdentity(),r=n.userId??n.anonymousId;r&&e.set("identifier",r),n.orgId&&e.set("orgId",n.orgId);let i=e.toString(),s=`${this.endpoint}/api/flags${i?`?${i}`:""}`;try{let o=await globalThis.fetch(s,{headers:{Authorization:`Bearer ${this.writeKey}`},signal:AbortSignal.timeout(this.timeout)});if(!o.ok)return;let u=await o.json();this.cache.clear();for(let[l,p]of Object.entries(u.flags))this.cache.set(l,p);if(!this.ready){this.ready=!0;for(let l of this.readyCallbacks)try{l()}catch{}this.readyCallbacks=[]}for(let l of this.changeListeners)try{l()}catch{}}catch{}}};var Yr=10,Xr=3e3,Zr=1e4,Qr=1800*1e3,Jr=100,ei="__scoperat_anon_id",_n="__scoperat_session_id",At="__scoperat_last_activity",xn="__scoperat_user_id",ti="$session_start",bn="$session_end",It="__scoperat_ticket_session";function Qe(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function ni(){if(!(typeof window>"u"||typeof localStorage>"u"))try{let t=localStorage.getItem(ei);return t||(t=Qe(),localStorage.setItem(ei,t)),t}catch{return Qe()}}var kn=class{constructor(){b(this,"writeKey",null);b(this,"endpoint","");b(this,"flushAt",Yr);b(this,"flushInterval",Xr);b(this,"timeout",Zr);b(this,"onError");b(this,"buffer",[]);b(this,"timer",null);b(this,"visibilityHandler",null);b(this,"userId");b(this,"orgId");b(this,"traits",{});b(this,"userHash");b(this,"anonymousId");b(this,"sessionId");b(this,"sessionTimeout",Qr);b(this,"ticketSessionFetch",null);b(this,"_flagClient",null)}init(e,n={}){this.writeKey=e,this.endpoint=(n.endpoint??globalThis.location?.origin??"").replace(/\/+$/,""),this.flushAt=n.flushAt??Yr,this.flushInterval=n.flushInterval??Xr,this.timeout=n.timeout??Zr,this.onError=n.onError,this.sessionTimeout=n.sessionTimeout??Qr,this.anonymousId=ni(),this.timer&&clearInterval(this.timer),this.timer=setInterval(()=>{this.buffer.length>0&&this.flush().catch(()=>{})},this.flushInterval),typeof window<"u"&&(this.visibilityHandler&&window.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.buffer.length>0&&this.flushSync()},window.addEventListener("visibilitychange",this.visibilityHandler)),n.captureErrors&&(Vr(this,mn),Gr()),this._flagClient?.destroy(),this._flagClient=new Et({endpoint:this.endpoint,writeKey:e,timeout:this.timeout,environment:n.environment,pollInterval:n.flagPollInterval,getIdentity:()=>({userId:this.userId,anonymousId:this.anonymousId,orgId:this.orgId}),onEvaluation:(r,i)=>this.track("$flag_evaluation",{flag_key:r,flag_value:i.value,flag_type:i.type,flag_source:i.source})})}get flags(){if(!this._flagClient)throw new Error("Tracker not initialized. Call init() first.");return this._flagClient}identify(e,n,r){let i=this.userId??this.readStoredUserId();this.userId=e,n&&(this.traits={...n},n.orgId&&(this.orgId=n.orgId)),this.userHash=r?.userHash;for(let s of this.buffer)s.user_id||(s.user_id=e),!s.org_id&&this.orgId&&(s.org_id=this.orgId);e!==i&&(this.writeStoredUserId(e),this.startSession("login")),this._flagClient?.refresh()}reset(){this.endSession("logout",!0),this.userId=void 0,this.orgId=void 0,this.traits={},this.userHash=void 0,this.anonymousId=ni(),this.clearStoredUserId(),this.clearTicketSession()}startSession(e="login"){if(typeof window>"u")return this.sessionId;let n=Date.now(),r=this.readStoredSession();r&&this.emitSessionEvent(bn,r,e);let i=Qe();return this.persistSession(i,n),this.emitSessionEvent(ti,i,e),i}endSession(e="logout",n=!1){if(typeof window>"u")return;let r=this.readStoredSession();r&&this.emitSessionEvent(bn,r,e),this.sessionId=void 0,this.clearSession(),n&&this.flushSync()}readStoredUserId(){if(!(typeof localStorage>"u"))try{return localStorage.getItem(xn)??void 0}catch{return}}writeStoredUserId(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(xn,e)}catch{}}clearStoredUserId(){if(!(typeof localStorage>"u"))try{localStorage.removeItem(xn)}catch{}}clearTicketSession(){if(this.ticketSessionFetch=null,!(typeof localStorage>"u"))try{localStorage.removeItem(It)}catch{}}readStoredTicketSession(){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(It);if(!e)return null;let n=JSON.parse(e);if(typeof n.anonymousId=="string"&&typeof n.token=="string"&&typeof n.expiresAt=="number"&&n.expiresAt>Date.now()+6e4)return n;localStorage.removeItem(It)}catch{}return null}_ensureTicketSession(){let e=this.readStoredTicketSession();return e?Promise.resolve(e):this.ticketSessionFetch?this.ticketSessionFetch:this.writeKey?(this.ticketSessionFetch=(async()=>{try{let n=await fetch(`${this.endpoint}/api/ingest/ticket/session`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.writeKey}`},body:"{}",signal:AbortSignal.timeout(this.timeout)});if(!n.ok)return null;let r=await n.json();if(typeof r?.anonymousId=="string"&&typeof r?.token=="string"&&typeof r?.expiresAt=="number"){try{localStorage?.setItem(It,JSON.stringify(r))}catch{}return this.anonymousId=r.anonymousId,r}return null}catch{return null}finally{this.ticketSessionFetch=null}})(),this.ticketSessionFetch):Promise.resolve(null)}ensureSession(e){if(typeof window>"u")return this.sessionId;try{let n=this.readLastActivity(),r=this.readStoredSession(),i=n===void 0||e-n>this.sessionTimeout;if(r&&!i){this.sessionId=r;try{localStorage.setItem(At,String(e))}catch{}return r}r&&this.emitSessionEvent(bn,r,"timeout",n!==void 0?new Date(n).toISOString():void 0);let s=Qe();return this.persistSession(s,e),this.emitSessionEvent(ti,s,r?"timeout":"initial"),s}catch{return this.sessionId??Qe()}}readStoredSession(){if(this.sessionId)return this.sessionId;if(!(typeof sessionStorage>"u"))try{return sessionStorage.getItem(_n)??void 0}catch{return}}readLastActivity(){if(!(typeof localStorage>"u"))try{let e=localStorage.getItem(At);return e?Number(e):void 0}catch{return}}persistSession(e,n){if(this.sessionId=e,!(typeof window>"u"))try{sessionStorage.setItem(_n,e),localStorage.setItem(At,String(n))}catch{}}emitSessionEvent(e,n,r,i){if(!this.writeKey)return;let s=Object.keys(this.traits).length>0?{traits:this.traits}:{};this.buffer.push({event:e,properties:{reason:r},occurred_at:i??new Date().toISOString(),source:"browser",org_id:this.orgId,user_id:this.userId,anonymous_id:this.anonymousId,session_id:n,context:{...Ze(),...s}})}clearSession(){if(!(typeof window>"u"))try{sessionStorage.removeItem(_n),localStorage.removeItem(At)}catch{}}getSessionId(){return this.ensureSession(Date.now())}_getEndpoint(){return this.endpoint}_getWriteKey(){return this.writeKey}_getIdentity(){return{userId:this.userId,anonymousId:this.anonymousId,email:this.traits.email,name:this.traits.name,userHash:this.userHash}}captureException(e,n){if(!this.writeKey)return;let r=mn();this.track("$exception",{type:e.name||"Error",message:e.message,stack:e.stack,handled:!0,mechanism:n?.mechanism??"manual",source:"browser",...n,context:{breadcrumbs:r}})}addBreadcrumb(e,n,r){Wr({type:"custom",category:e,message:n,timestamp:Date.now(),data:r})}track(e,n){if(!this.writeKey)return;let r=typeof e=="string"?{event:e,properties:n}:e,i=Object.keys(this.traits).length>0?{traits:this.traits}:{},s={...r,occurred_at:r.occurred_at??new Date().toISOString(),source:r.source??"browser",org_id:r.org_id??this.orgId,user_id:r.user_id??this.userId,anonymous_id:r.anonymous_id??this.anonymousId,session_id:r.session_id??this.ensureSession(Date.now()),context:{...Ze(),...i,...r.context}};this.buffer.push(s),this.buffer.length>=this.flushAt&&this.flush().catch(()=>{})}async flush(){if(!this.writeKey||this.buffer.length===0)return{success:!0,ingested:0};let e=this.buffer.splice(0,Jr);try{let n=await fetch(`${this.endpoint}/api/ingest/track`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.writeKey}`},body:JSON.stringify({events:e}),signal:AbortSignal.timeout(this.timeout)});if(!n.ok){let i=await n.text().catch(()=>"");throw new Error(`API returned ${n.status}: ${i}`)}return{success:!0,ingested:(await n.json()).ingested}}catch(n){this.buffer.unshift(...e);let r=n instanceof Error?n:new Error(String(n));return this.onError?.(r,e),{success:!1,ingested:0}}}flushSync(){if(!this.writeKey||typeof fetch>"u"||this.buffer.length===0)return;let e=this.buffer.splice(0,Jr);try{fetch(`${this.endpoint}/api/ingest/track`,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.writeKey}`},body:JSON.stringify({events:e})}).catch(()=>{})}catch{}}getFlag(e,n){return this._flagClient?.getFlag(e,n)??n}onFlagsReady(e){this._flagClient?.onFlagsReady(e)}onFlagChange(e){return this._flagClient?.onFlagChange(e)??(()=>{})}async refreshFlags(){await this._flagClient?.refresh()}async shutdown(){for(this.timer&&(clearInterval(this.timer),this.timer=null),this._flagClient?.destroy(),this._flagClient=null,typeof window<"u"&&this.visibilityHandler&&(window.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null);this.buffer.length>0;)await this.flush()}},As=new kn,ee=As;async function ri(){let t=ee._getIdentity();if(t.userId&&t.userHash)return{"X-Scoperat-User-Hash":t.userHash,"X-Scoperat-User-Id":t.userId};let e=await ee._ensureTicketSession();return e?{"X-Scoperat-Session":e.token}:{}}async function ii(){let t=new URLSearchParams,e=ee._getIdentity();if(e.userId&&e.userHash)return t.set("user_id",e.userId),t.set("user_hash",e.userHash),t;let n=await ee._ensureTicketSession();return n&&t.set("session",n.token),t}async function si(){let t=ee._getWriteKey();return{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{},...await ri()}}async function wn(){let t=ee._getWriteKey();return{...t?{Authorization:`Bearer ${t}`}:{},...await ri()}}function ze(){return ee._getEndpoint()}async function Rt(t){let e=new FormData;e.append("file",t);let n=await fetch(`${ze()}/api/ingest/ticket/upload`,{method:"POST",headers:await wn(),body:e});if(!n.ok){let r=await n.text().catch(()=>"");throw new Error(`Upload failed: ${n.status} ${r}`)}return n.json()}async function oi(t){let e=ee._getIdentity(),n=Ze(),r=await fetch(`${ze()}/api/ingest/ticket`,{method:"POST",headers:await si(),body:JSON.stringify({...t,attachments:t.attachments?.map(i=>({storageKey:i.storageKey,fileName:i.fileName,mimeType:i.mimeType,fileSize:i.size})),email:t.email??e.email,name:t.name??e.name,metadata:{...n,...t.metadata}})});if(!r.ok){let i=await r.text().catch(()=>"");throw new Error(`Failed to create ticket: ${r.status} ${i}`)}return r.json()}async function ai(t,e,n){let r=await fetch(`${ze()}/api/ingest/ticket/message`,{method:"POST",headers:await si(),body:JSON.stringify({ticketId:t,body:e,attachments:n?.map(i=>({storageKey:i.storageKey,fileName:i.fileName,mimeType:i.mimeType,fileSize:i.size}))})});if(!r.ok){let i=await r.text().catch(()=>"");throw new Error(`Failed to send message: ${r.status} ${i}`)}return r.json()}async function li(){let t=await ii(),e=ee._getWriteKey();e&&t.set("key",e);let n=await fetch(`${ze()}/api/ingest/tickets?${t.toString()}`,{headers:await wn()});return n.ok?(await n.json()).tickets:[]}async function vn(t){let e=await ii(),n=await fetch(`${ze()}/api/ingest/ticket/${t}?${e.toString()}`,{headers:await wn()});if(!n.ok)throw new Error(`Failed to fetch conversation: ${n.status}`);return n.json()}async function ci(t,e){try{let n=await fetch(`${ze()}/api/kb/${t}/${e}`);return n.ok?n.json():null}catch{return null}}var yn=new Set,Ct={isOpen:!1,view:"conversations",tickets:[],activeTicketId:null,activeConversation:null,loading:!1,error:null};function Is(){for(let t of yn)t()}function Ae(){return Ct}function ui(t){return yn.add(t),()=>yn.delete(t)}function J(t){Ct={...Ct,...t},Is()}function pi(){J({isOpen:!Ct.isOpen})}function Lt(t){J({view:t})}function $t(t){J({view:"thread",activeTicketId:t})}function di(){J({view:"conversations",activeTicketId:null,activeConversation:null})}var Rs=0;function c(t,e,n,r,i,s){e||(e={});var o,u,l=e;if("ref"in l)for(u in l={},e)u=="ref"?o=e[u]:l[u]=e[u];var p={type:t,props:l,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Rs,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(u in o)l[u]===void 0&&(l[u]=o[u]);return R.vnode&&R.vnode(p),p}function Cs(t){let e=Math.floor((Date.now()-new Date(t).getTime())/1e3);if(e<60)return"just now";let n=Math.floor(e/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Ls({ticket:t}){return c("li",{class:"sr-ticket-item",onClick:()=>$t(t.id),children:[c("h4",{children:t.subject}),c("div",{class:"sr-meta",children:c("span",{children:Cs(t.lastMessageAt??t.createdAt)})})]})}function hi(){let t=Ae();return Se(()=>{J({loading:!0}),li().then(e=>J({tickets:e,loading:!1})).catch(()=>J({loading:!1}))},[]),t.loading?c("div",{class:"sr-loading",children:"Loading conversations..."}):c("div",{children:t.tickets.length===0?c("div",{class:"sr-empty",children:[c("p",{children:"No conversations yet"}),c("button",{class:"sr-btn sr-btn-secondary",onClick:()=>Lt("new-ticket"),children:"Start one"})]}):c("ul",{class:"sr-ticket-list",children:t.tickets.map(e=>c(Ls,{ticket:e},e.id))})})}var{entries:vi,setPrototypeOf:fi,isFrozen:$s,getPrototypeOf:Ds,getOwnPropertyDescriptor:Ps}=Object,{freeze:V,seal:te,create:it}=Object,{apply:Cn,construct:Ln}=typeof Reflect<"u"&&Reflect;V||(V=function(e){return e});te||(te=function(e){return e});Cn||(Cn=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(n,i)});Ln||(Ln=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return new e(...r)});var Je=Y(Array.prototype.forEach),Os=Y(Array.prototype.lastIndexOf),gi=Y(Array.prototype.pop),et=Y(Array.prototype.push),Ns=Y(Array.prototype.splice),Pt=Y(String.prototype.toLowerCase),Tn=Y(String.prototype.toString),Sn=Y(String.prototype.match),Fe=Y(String.prototype.replace),Ms=Y(String.prototype.indexOf),zs=Y(String.prototype.trim),re=Y(Object.prototype.hasOwnProperty),K=Y(RegExp.prototype.test),tt=Fs(TypeError);function Y(t){return function(e){e instanceof RegExp&&(e.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 Cn(t,e,r)}}function Fs(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return Ln(t,n)}}function y(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Pt;fi&&fi(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){let s=n(i);s!==i&&($s(e)||(e[r]=s),i=s)}t[i]=!0}return t}function Hs(t){for(let e=0;e<t.length;e++)re(t,e)||(t[e]=null);return t}function le(t){let e=it(null);for(let[n,r]of vi(t))re(t,n)&&(Array.isArray(r)?e[n]=Hs(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=le(r):e[n]=r);return e}function nt(t,e){for(;t!==null;){let r=Ps(t,e);if(r){if(r.get)return Y(r.get);if(typeof r.value=="function")return Y(r.value)}t=Ds(t)}function n(){return null}return n}var mi=V(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),En=V(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),An=V(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Us=V(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),In=V(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Bs=V(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_i=V(["#text"]),xi=V(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Rn=V(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),bi=V(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),Dt=V(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),js=te(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ws=te(/<%[\w\W]*|[\w\W]*%>/gm),Gs=te(/\$\{[\w\W]*/gm),qs=te(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ks=te(/^aria-[\-\w]+$/),yi=te(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Vs=te(/^(?:\w+script|data):/i),Ys=te(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ti=te(/^html$/i),Xs=te(/^[a-z][.\w]*(-[.\w]+)+$/i),ki=Object.freeze({__proto__:null,ARIA_ATTR:Ks,ATTR_WHITESPACE:Ys,CUSTOM_ELEMENT:Xs,DATA_ATTR:qs,DOCTYPE_NAME:Ti,ERB_EXPR:Ws,IS_ALLOWED_URI:yi,IS_SCRIPT_OR_DATA:Vs,MUSTACHE_EXPR:js,TMPLIT_EXPR:Gs}),rt={element:1,text:3,progressingInstruction:7,comment:8,document:9},Zs=function(){return typeof window>"u"?null:window},Qs=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));let s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},wi=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Si(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Zs(),e=k=>Si(k);if(e.version="3.4.0",e.removed=[],!t||!t.document||t.document.nodeType!==rt.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t,r=n,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:u,Element:l,NodeFilter:p,NamedNodeMap:h=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:m,trustedTypes:g}=t,_=l.prototype,E=nt(_,"cloneNode"),w=nt(_,"remove"),v=nt(_,"nextSibling"),T=nt(_,"childNodes"),D=nt(_,"parentNode");if(typeof o=="function"){let k=n.createElement("template");k.content&&k.content.ownerDocument&&(n=k.content.ownerDocument)}let A,U="",{implementation:q,createNodeIterator:ue,createDocumentFragment:ge,getElementsByTagName:I}=n,{importNode:F}=r,$=wi();e.isSupported=typeof vi=="function"&&typeof D=="function"&&q&&q.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:pe,ERB_EXPR:Le,TMPLIT_EXPR:$e,DATA_ATTR:Xi,ARIA_ATTR:Zi,IS_SCRIPT_OR_DATA:Qi,ATTR_WHITESPACE:Kn,CUSTOM_ELEMENT:Ji}=ki,{IS_ALLOWED_URI:Vn}=ki,B=null,Yn=y({},[...mi,...En,...An,...In,..._i]),j=null,Xn=y({},[...xi,...Rn,...bi,...Dt]),P=Object.seal(it(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}})),Ue=null,lt=null,me=Object.seal(it(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Zn=!0,jt=!0,Qn=!1,Jn=!0,ve=!1,Be=!0,ye=!1,Wt=!1,Gt=!1,De=!1,ct=!1,ut=!1,er=!0,tr=!1,es="user-content-",qt=!0,je=!1,Pe={},oe=null,Kt=y({},["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"]),nr=null,rr=y({},["audio","video","img","source","image","track"]),Vt=null,ir=y({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pt="http://www.w3.org/1998/Math/MathML",dt="http://www.w3.org/2000/svg",ae="http://www.w3.org/1999/xhtml",Oe=ae,Yt=!1,Xt=null,ts=y({},[pt,dt,ae],Tn),ht=y({},["mi","mo","mn","ms","mtext"]),ft=y({},["annotation-xml"]),ns=y({},["title","style","font","a","script"]),We=null,rs=["application/xhtml+xml","text/html"],is="text/html",H=null,Ne=null,ss=n.createElement("form"),sr=function(a){return a instanceof RegExp||a instanceof Function},Zt=function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ne&&Ne===a)){if((!a||typeof a!="object")&&(a={}),a=le(a),We=rs.indexOf(a.PARSER_MEDIA_TYPE)===-1?is:a.PARSER_MEDIA_TYPE,H=We==="application/xhtml+xml"?Tn:Pt,B=re(a,"ALLOWED_TAGS")?y({},a.ALLOWED_TAGS,H):Yn,j=re(a,"ALLOWED_ATTR")?y({},a.ALLOWED_ATTR,H):Xn,Xt=re(a,"ALLOWED_NAMESPACES")?y({},a.ALLOWED_NAMESPACES,Tn):ts,Vt=re(a,"ADD_URI_SAFE_ATTR")?y(le(ir),a.ADD_URI_SAFE_ATTR,H):ir,nr=re(a,"ADD_DATA_URI_TAGS")?y(le(rr),a.ADD_DATA_URI_TAGS,H):rr,oe=re(a,"FORBID_CONTENTS")?y({},a.FORBID_CONTENTS,H):Kt,Ue=re(a,"FORBID_TAGS")?y({},a.FORBID_TAGS,H):le({}),lt=re(a,"FORBID_ATTR")?y({},a.FORBID_ATTR,H):le({}),Pe=re(a,"USE_PROFILES")?a.USE_PROFILES:!1,Zn=a.ALLOW_ARIA_ATTR!==!1,jt=a.ALLOW_DATA_ATTR!==!1,Qn=a.ALLOW_UNKNOWN_PROTOCOLS||!1,Jn=a.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ve=a.SAFE_FOR_TEMPLATES||!1,Be=a.SAFE_FOR_XML!==!1,ye=a.WHOLE_DOCUMENT||!1,De=a.RETURN_DOM||!1,ct=a.RETURN_DOM_FRAGMENT||!1,ut=a.RETURN_TRUSTED_TYPE||!1,Gt=a.FORCE_BODY||!1,er=a.SANITIZE_DOM!==!1,tr=a.SANITIZE_NAMED_PROPS||!1,qt=a.KEEP_CONTENT!==!1,je=a.IN_PLACE||!1,Vn=a.ALLOWED_URI_REGEXP||yi,Oe=a.NAMESPACE||ae,ht=a.MATHML_TEXT_INTEGRATION_POINTS||ht,ft=a.HTML_INTEGRATION_POINTS||ft,P=a.CUSTOM_ELEMENT_HANDLING||it(null),a.CUSTOM_ELEMENT_HANDLING&&sr(a.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=a.CUSTOM_ELEMENT_HANDLING.tagNameCheck),a.CUSTOM_ELEMENT_HANDLING&&sr(a.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=a.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),a.CUSTOM_ELEMENT_HANDLING&&typeof a.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(P.allowCustomizedBuiltInElements=a.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ve&&(jt=!1),ct&&(De=!0),Pe&&(B=y({},_i),j=it(null),Pe.html===!0&&(y(B,mi),y(j,xi)),Pe.svg===!0&&(y(B,En),y(j,Rn),y(j,Dt)),Pe.svgFilters===!0&&(y(B,An),y(j,Rn),y(j,Dt)),Pe.mathMl===!0&&(y(B,In),y(j,bi),y(j,Dt))),me.tagCheck=null,me.attributeCheck=null,a.ADD_TAGS&&(typeof a.ADD_TAGS=="function"?me.tagCheck=a.ADD_TAGS:(B===Yn&&(B=le(B)),y(B,a.ADD_TAGS,H))),a.ADD_ATTR&&(typeof a.ADD_ATTR=="function"?me.attributeCheck=a.ADD_ATTR:(j===Xn&&(j=le(j)),y(j,a.ADD_ATTR,H))),a.ADD_URI_SAFE_ATTR&&y(Vt,a.ADD_URI_SAFE_ATTR,H),a.FORBID_CONTENTS&&(oe===Kt&&(oe=le(oe)),y(oe,a.FORBID_CONTENTS,H)),a.ADD_FORBID_CONTENTS&&(oe===Kt&&(oe=le(oe)),y(oe,a.ADD_FORBID_CONTENTS,H)),qt&&(B["#text"]=!0),ye&&y(B,["html","head","body"]),B.table&&(y(B,["tbody"]),delete Ue.tbody),a.TRUSTED_TYPES_POLICY){if(typeof a.TRUSTED_TYPES_POLICY.createHTML!="function")throw tt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof a.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw tt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=a.TRUSTED_TYPES_POLICY,U=A.createHTML("")}else A===void 0&&(A=Qs(g,i)),A!==null&&typeof U=="string"&&(U=A.createHTML(""));V&&V(a),Ne=a}},or=y({},[...En,...An,...Us]),ar=y({},[...In,...Bs]),os=function(a){let f=D(a);(!f||!f.tagName)&&(f={namespaceURI:Oe,tagName:"template"});let x=Pt(a.tagName),L=Pt(f.tagName);return Xt[a.namespaceURI]?a.namespaceURI===dt?f.namespaceURI===ae?x==="svg":f.namespaceURI===pt?x==="svg"&&(L==="annotation-xml"||ht[L]):!!or[x]:a.namespaceURI===pt?f.namespaceURI===ae?x==="math":f.namespaceURI===dt?x==="math"&&ft[L]:!!ar[x]:a.namespaceURI===ae?f.namespaceURI===dt&&!ft[L]||f.namespaceURI===pt&&!ht[L]?!1:!ar[x]&&(ns[x]||!or[x]):!!(We==="application/xhtml+xml"&&Xt[a.namespaceURI]):!1},ne=function(a){et(e.removed,{element:a});try{D(a).removeChild(a)}catch{w(a)}},Te=function(a,f){try{et(e.removed,{attribute:f.getAttributeNode(a),from:f})}catch{et(e.removed,{attribute:null,from:f})}if(f.removeAttribute(a),a==="is")if(De||ct)try{ne(f)}catch{}else try{f.setAttribute(a,"")}catch{}},lr=function(a){let f=null,x=null;if(Gt)a="<remove></remove>"+a;else{let N=Sn(a,/^[\r\n\t ]+/);x=N&&N[0]}We==="application/xhtml+xml"&&Oe===ae&&(a='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+a+"</body></html>");let L=A?A.createHTML(a):a;if(Oe===ae)try{f=new m().parseFromString(L,We)}catch{}if(!f||!f.documentElement){f=q.createDocument(Oe,"template",null);try{f.documentElement.innerHTML=Yt?U:L}catch{}}let G=f.body||f.documentElement;return a&&x&&G.insertBefore(n.createTextNode(x),G.childNodes[0]||null),Oe===ae?I.call(f,ye?"html":"body")[0]:ye?f.documentElement:G},cr=function(a){return ue.call(a.ownerDocument||a,a,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Qt=function(a){return a instanceof d&&(typeof a.nodeName!="string"||typeof a.textContent!="string"||typeof a.removeChild!="function"||!(a.attributes instanceof h)||typeof a.removeAttribute!="function"||typeof a.setAttribute!="function"||typeof a.namespaceURI!="string"||typeof a.insertBefore!="function"||typeof a.hasChildNodes!="function")},Jt=function(a){return typeof u=="function"&&a instanceof u};function de(k,a,f){Je(k,x=>{x.call(e,a,f,Ne)})}let ur=function(a){let f=null;if(de($.beforeSanitizeElements,a,null),Qt(a))return ne(a),!0;let x=H(a.nodeName);if(de($.uponSanitizeElement,a,{tagName:x,allowedTags:B}),Be&&a.hasChildNodes()&&!Jt(a.firstElementChild)&&K(/<[/\w!]/g,a.innerHTML)&&K(/<[/\w!]/g,a.textContent)||Be&&a.namespaceURI===ae&&x==="style"&&Jt(a.firstElementChild)||a.nodeType===rt.progressingInstruction||Be&&a.nodeType===rt.comment&&K(/<[/\w]/g,a.data))return ne(a),!0;if(Ue[x]||!(me.tagCheck instanceof Function&&me.tagCheck(x))&&!B[x]){if(!Ue[x]&&dr(x)&&(P.tagNameCheck instanceof RegExp&&K(P.tagNameCheck,x)||P.tagNameCheck instanceof Function&&P.tagNameCheck(x)))return!1;if(qt&&!oe[x]){let L=D(a)||a.parentNode,G=T(a)||a.childNodes;if(G&&L){let N=G.length;for(let Z=N-1;Z>=0;--Z){let Q=E(G[Z],!0);Q.__removalCount=(a.__removalCount||0)+1,L.insertBefore(Q,v(a))}}}return ne(a),!0}return a instanceof l&&!os(a)||(x==="noscript"||x==="noembed"||x==="noframes")&&K(/<\/no(script|embed|frames)/i,a.innerHTML)?(ne(a),!0):(ve&&a.nodeType===rt.text&&(f=a.textContent,Je([pe,Le,$e],L=>{f=Fe(f,L," ")}),a.textContent!==f&&(et(e.removed,{element:a.cloneNode()}),a.textContent=f)),de($.afterSanitizeElements,a,null),!1)},pr=function(a,f,x){if(lt[f]||er&&(f==="id"||f==="name")&&(x in n||x in ss))return!1;if(!(jt&&!lt[f]&&K(Xi,f))){if(!(Zn&&K(Zi,f))){if(!(me.attributeCheck instanceof Function&&me.attributeCheck(f,a))){if(!j[f]||lt[f]){if(!(dr(a)&&(P.tagNameCheck instanceof RegExp&&K(P.tagNameCheck,a)||P.tagNameCheck instanceof Function&&P.tagNameCheck(a))&&(P.attributeNameCheck instanceof RegExp&&K(P.attributeNameCheck,f)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(f,a))||f==="is"&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&K(P.tagNameCheck,x)||P.tagNameCheck instanceof Function&&P.tagNameCheck(x))))return!1}else if(!Vt[f]){if(!K(Vn,Fe(x,Kn,""))){if(!((f==="src"||f==="xlink:href"||f==="href")&&a!=="script"&&Ms(x,"data:")===0&&nr[a])){if(!(Qn&&!K(Qi,Fe(x,Kn,"")))){if(x)return!1}}}}}}}return!0},dr=function(a){return a!=="annotation-xml"&&Sn(a,Ji)},hr=function(a){de($.beforeSanitizeAttributes,a,null);let{attributes:f}=a;if(!f||Qt(a))return;let x={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0},L=f.length;for(;L--;){let G=f[L],{name:N,namespaceURI:Z,value:Q}=G,_e=H(N),en=Q,W=N==="value"?en:zs(en);if(x.attrName=_e,x.attrValue=W,x.keepAttr=!0,x.forceKeepAttr=void 0,de($.uponSanitizeAttribute,a,x),W=x.attrValue,tr&&(_e==="id"||_e==="name")&&(Te(N,a),W=es+W),Be&&K(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,W)){Te(N,a);continue}if(_e==="attributename"&&Sn(W,"href")){Te(N,a);continue}if(x.forceKeepAttr)continue;if(!x.keepAttr){Te(N,a);continue}if(!Jn&&K(/\/>/i,W)){Te(N,a);continue}ve&&Je([pe,Le,$e],mr=>{W=Fe(W,mr," ")});let gr=H(a.nodeName);if(!pr(gr,_e,W)){Te(N,a);continue}if(A&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Z)switch(g.getAttributeType(gr,_e)){case"TrustedHTML":{W=A.createHTML(W);break}case"TrustedScriptURL":{W=A.createScriptURL(W);break}}if(W!==en)try{Z?a.setAttributeNS(Z,N,W):a.setAttribute(N,W),Qt(a)?ne(a):gi(e.removed)}catch{Te(N,a)}}de($.afterSanitizeAttributes,a,null)},fr=function(a){let f=null,x=cr(a);for(de($.beforeSanitizeShadowDOM,a,null);f=x.nextNode();)de($.uponSanitizeShadowNode,f,null),ur(f),hr(f),f.content instanceof s&&fr(f.content);de($.afterSanitizeShadowDOM,a,null)};return e.sanitize=function(k){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=null,x=null,L=null,G=null;if(Yt=!k,Yt&&(k="<!-->"),typeof k!="string"&&!Jt(k))if(typeof k.toString=="function"){if(k=k.toString(),typeof k!="string")throw tt("dirty is not a string, aborting")}else throw tt("toString is not a function");if(!e.isSupported)return k;if(Wt||Zt(a),e.removed=[],typeof k=="string"&&(je=!1),je){if(k.nodeName){let Q=H(k.nodeName);if(!B[Q]||Ue[Q])throw tt("root node is forbidden and cannot be sanitized in-place")}}else if(k instanceof u)f=lr("<!---->"),x=f.ownerDocument.importNode(k,!0),x.nodeType===rt.element&&x.nodeName==="BODY"||x.nodeName==="HTML"?f=x:f.appendChild(x);else{if(!De&&!ve&&!ye&&k.indexOf("<")===-1)return A&&ut?A.createHTML(k):k;if(f=lr(k),!f)return De?null:ut?U:""}f&&Gt&&ne(f.firstChild);let N=cr(je?k:f);for(;L=N.nextNode();)ur(L),hr(L),L.content instanceof s&&fr(L.content);if(je)return k;if(De){if(ve){f.normalize();let Q=f.innerHTML;Je([pe,Le,$e],_e=>{Q=Fe(Q,_e," ")}),f.innerHTML=Q}if(ct)for(G=ge.call(f.ownerDocument);f.firstChild;)G.appendChild(f.firstChild);else G=f;return(j.shadowroot||j.shadowrootmode)&&(G=F.call(r,G,!0)),G}let Z=ye?f.outerHTML:f.innerHTML;return ye&&B["!doctype"]&&f.ownerDocument&&f.ownerDocument.doctype&&f.ownerDocument.doctype.name&&K(Ti,f.ownerDocument.doctype.name)&&(Z="<!DOCTYPE "+f.ownerDocument.doctype.name+`>
|
|
900
|
+
`)[1]?.trim()??"";return`${t}:${n}`}function Es(t){let e=qr.get(t);return e&&Date.now()-e<6e4?!0:(qr.set(t,Date.now()),!1)}function Kr(t,e,n){let r=Ss(e.type,e.stack);Es(r)||t.track("$exception",{...e,context:{breadcrumbs:n()}})}function Vr(t,e){typeof window>"u"||(window.onerror=(n,r,i,s,o)=>{let u=o??new Error(String(n));Kr(t,{type:u.name||"Error",message:u.message||String(n),stack:u.stack,handled:!1,mechanism:"onerror",source:"browser",filename:r,lineno:i,colno:s},e)},window.onunhandledrejection=n=>{let r=n.reason,i=r instanceof Error?r:new Error(String(r));Kr(t,{type:i.name||"UnhandledRejection",message:i.message,stack:i.stack,handled:!1,mechanism:"onunhandledrejection",source:"browser"},e)})}var Et=class{constructor(e){b(this,"endpoint");b(this,"writeKey");b(this,"timeout");b(this,"environment");b(this,"getIdentity");b(this,"onEvaluation");b(this,"cache",new Map);b(this,"ready",!1);b(this,"readyCallbacks",[]);b(this,"changeListeners",new Set);b(this,"evalTracked",new Set);b(this,"timer",null);this.endpoint=e.endpoint,this.writeKey=e.writeKey,this.timeout=e.timeout??1e4,this.environment=e.environment,this.getIdentity=e.getIdentity,this.onEvaluation=e.onEvaluation;let n=e.pollInterval??6e4;this.fetch(),this.timer=setInterval(()=>this.fetch(),n)}getFlag(e,n){let r=this.cache.get(e);return r?(this.evalTracked.has(e)||(this.evalTracked.add(e),this.onEvaluation?.(e,r)),r.value):n}onFlagsReady(e){this.ready?e():this.readyCallbacks.push(e)}onFlagChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}async refresh(){await this.fetch()}destroy(){this.timer&&(clearInterval(this.timer),this.timer=null)}async fetch(){if(!this.writeKey||!this.endpoint)return;let e=new URLSearchParams;this.environment&&e.set("environment",this.environment);let n=this.getIdentity(),r=n.userId??n.anonymousId;r&&e.set("identifier",r),n.orgId&&e.set("orgId",n.orgId);let i=e.toString(),s=`${this.endpoint}/api/flags${i?`?${i}`:""}`;try{let o=await globalThis.fetch(s,{headers:{Authorization:`Bearer ${this.writeKey}`},signal:AbortSignal.timeout(this.timeout)});if(!o.ok)return;let u=await o.json();this.cache.clear();for(let[l,p]of Object.entries(u.flags))this.cache.set(l,p);if(!this.ready){this.ready=!0;for(let l of this.readyCallbacks)try{l()}catch{}this.readyCallbacks=[]}for(let l of this.changeListeners)try{l()}catch{}}catch{}}};var Yr=10,Xr=3e3,Zr=1e4,Qr=1800*1e3,Jr=100,ei="__scoperat_anon_id",_n="__scoperat_session_id",At="__scoperat_last_activity",xn="__scoperat_user_id",ti="$session_start",bn="$session_end",It="__scoperat_ticket_session";function Qe(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function ni(){if(!(typeof window>"u"||typeof localStorage>"u"))try{let t=localStorage.getItem(ei);return t||(t=Qe(),localStorage.setItem(ei,t)),t}catch{return Qe()}}var kn=class{constructor(){b(this,"writeKey",null);b(this,"endpoint","");b(this,"flushAt",Yr);b(this,"flushInterval",Xr);b(this,"timeout",Zr);b(this,"onError");b(this,"buffer",[]);b(this,"timer",null);b(this,"visibilityHandler",null);b(this,"userId");b(this,"orgId");b(this,"traits",{});b(this,"userHash");b(this,"anonymousId");b(this,"sessionId");b(this,"sessionTimeout",Qr);b(this,"ticketSessionFetch",null);b(this,"_flagClient",null)}init(e,n={}){this.writeKey=e,this.endpoint=(n.endpoint??globalThis.location?.origin??"").replace(/\/+$/,""),this.flushAt=n.flushAt??Yr,this.flushInterval=n.flushInterval??Xr,this.timeout=n.timeout??Zr,this.onError=n.onError,this.sessionTimeout=n.sessionTimeout??Qr,this.anonymousId=ni(),this.timer&&clearInterval(this.timer),this.timer=setInterval(()=>{this.buffer.length>0&&this.flush().catch(()=>{})},this.flushInterval),typeof window<"u"&&(this.visibilityHandler&&window.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.buffer.length>0&&this.flushSync()},window.addEventListener("visibilitychange",this.visibilityHandler)),n.captureErrors&&(Vr(this,mn),Gr()),this._flagClient?.destroy(),this._flagClient=new Et({endpoint:this.endpoint,writeKey:e,timeout:this.timeout,environment:n.environment,pollInterval:n.flagPollInterval,getIdentity:()=>({userId:this.userId,anonymousId:this.anonymousId,orgId:this.orgId})})}get flags(){if(!this._flagClient)throw new Error("Tracker not initialized. Call init() first.");return this._flagClient}identify(e,n,r){let i=this.userId??this.readStoredUserId();this.userId=e,n&&(this.traits={...n},n.orgId&&(this.orgId=n.orgId)),this.userHash=r?.userHash;for(let s of this.buffer)s.user_id||(s.user_id=e),!s.org_id&&this.orgId&&(s.org_id=this.orgId);e!==i&&(this.writeStoredUserId(e),this.startSession("login")),this._flagClient?.refresh()}reset(){this.endSession("logout",!0),this.userId=void 0,this.orgId=void 0,this.traits={},this.userHash=void 0,this.anonymousId=ni(),this.clearStoredUserId(),this.clearTicketSession()}startSession(e="login"){if(typeof window>"u")return this.sessionId;let n=Date.now(),r=this.readStoredSession();r&&this.emitSessionEvent(bn,r,e);let i=Qe();return this.persistSession(i,n),this.emitSessionEvent(ti,i,e),i}endSession(e="logout",n=!1){if(typeof window>"u")return;let r=this.readStoredSession();r&&this.emitSessionEvent(bn,r,e),this.sessionId=void 0,this.clearSession(),n&&this.flushSync()}readStoredUserId(){if(!(typeof localStorage>"u"))try{return localStorage.getItem(xn)??void 0}catch{return}}writeStoredUserId(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(xn,e)}catch{}}clearStoredUserId(){if(!(typeof localStorage>"u"))try{localStorage.removeItem(xn)}catch{}}clearTicketSession(){if(this.ticketSessionFetch=null,!(typeof localStorage>"u"))try{localStorage.removeItem(It)}catch{}}readStoredTicketSession(){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(It);if(!e)return null;let n=JSON.parse(e);if(typeof n.anonymousId=="string"&&typeof n.token=="string"&&typeof n.expiresAt=="number"&&n.expiresAt>Date.now()+6e4)return n;localStorage.removeItem(It)}catch{}return null}_ensureTicketSession(){let e=this.readStoredTicketSession();return e?Promise.resolve(e):this.ticketSessionFetch?this.ticketSessionFetch:this.writeKey?(this.ticketSessionFetch=(async()=>{try{let n=await fetch(`${this.endpoint}/api/ingest/ticket/session`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.writeKey}`},body:"{}",signal:AbortSignal.timeout(this.timeout)});if(!n.ok)return null;let r=await n.json();if(typeof r?.anonymousId=="string"&&typeof r?.token=="string"&&typeof r?.expiresAt=="number"){try{localStorage?.setItem(It,JSON.stringify(r))}catch{}return this.anonymousId=r.anonymousId,r}return null}catch{return null}finally{this.ticketSessionFetch=null}})(),this.ticketSessionFetch):Promise.resolve(null)}ensureSession(e){if(typeof window>"u")return this.sessionId;try{let n=this.readLastActivity(),r=this.readStoredSession(),i=n===void 0||e-n>this.sessionTimeout;if(r&&!i){this.sessionId=r;try{localStorage.setItem(At,String(e))}catch{}return r}r&&this.emitSessionEvent(bn,r,"timeout",n!==void 0?new Date(n).toISOString():void 0);let s=Qe();return this.persistSession(s,e),this.emitSessionEvent(ti,s,r?"timeout":"initial"),s}catch{return this.sessionId??Qe()}}readStoredSession(){if(this.sessionId)return this.sessionId;if(!(typeof sessionStorage>"u"))try{return sessionStorage.getItem(_n)??void 0}catch{return}}readLastActivity(){if(!(typeof localStorage>"u"))try{let e=localStorage.getItem(At);return e?Number(e):void 0}catch{return}}persistSession(e,n){if(this.sessionId=e,!(typeof window>"u"))try{sessionStorage.setItem(_n,e),localStorage.setItem(At,String(n))}catch{}}emitSessionEvent(e,n,r,i){if(!this.writeKey)return;let s=Object.keys(this.traits).length>0?{traits:this.traits}:{};this.buffer.push({event:e,properties:{reason:r},occurred_at:i??new Date().toISOString(),source:"browser",org_id:this.orgId,user_id:this.userId,anonymous_id:this.anonymousId,session_id:n,context:{...Ze(),...s}})}clearSession(){if(!(typeof window>"u"))try{sessionStorage.removeItem(_n),localStorage.removeItem(At)}catch{}}getSessionId(){return this.ensureSession(Date.now())}_getEndpoint(){return this.endpoint}_getWriteKey(){return this.writeKey}_getIdentity(){return{userId:this.userId,anonymousId:this.anonymousId,email:this.traits.email,name:this.traits.name,userHash:this.userHash}}captureException(e,n){if(!this.writeKey)return;let r=mn();this.track("$exception",{type:e.name||"Error",message:e.message,stack:e.stack,handled:!0,mechanism:n?.mechanism??"manual",source:"browser",...n,context:{breadcrumbs:r}})}addBreadcrumb(e,n,r){Wr({type:"custom",category:e,message:n,timestamp:Date.now(),data:r})}track(e,n){if(!this.writeKey)return;let r=typeof e=="string"?{event:e,properties:n}:e,i=Object.keys(this.traits).length>0?{traits:this.traits}:{},s={...r,occurred_at:r.occurred_at??new Date().toISOString(),source:r.source??"browser",org_id:r.org_id??this.orgId,user_id:r.user_id??this.userId,anonymous_id:r.anonymous_id??this.anonymousId,session_id:r.session_id??this.ensureSession(Date.now()),context:{...Ze(),...i,...r.context}};this.buffer.push(s),this.buffer.length>=this.flushAt&&this.flush().catch(()=>{})}async flush(){if(!this.writeKey||this.buffer.length===0)return{success:!0,ingested:0};let e=this.buffer.splice(0,Jr);try{let n=await fetch(`${this.endpoint}/api/ingest/track`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.writeKey}`},body:JSON.stringify({events:e}),signal:AbortSignal.timeout(this.timeout)});if(!n.ok){let i=await n.text().catch(()=>"");throw new Error(`API returned ${n.status}: ${i}`)}return{success:!0,ingested:(await n.json()).ingested}}catch(n){this.buffer.unshift(...e);let r=n instanceof Error?n:new Error(String(n));return this.onError?.(r,e),{success:!1,ingested:0}}}flushSync(){if(!this.writeKey||typeof fetch>"u"||this.buffer.length===0)return;let e=this.buffer.splice(0,Jr);try{fetch(`${this.endpoint}/api/ingest/track`,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.writeKey}`},body:JSON.stringify({events:e})}).catch(()=>{})}catch{}}getFlag(e,n){return this._flagClient?.getFlag(e,n)??n}onFlagsReady(e){this._flagClient?.onFlagsReady(e)}onFlagChange(e){return this._flagClient?.onFlagChange(e)??(()=>{})}async refreshFlags(){await this._flagClient?.refresh()}async shutdown(){for(this.timer&&(clearInterval(this.timer),this.timer=null),this._flagClient?.destroy(),this._flagClient=null,typeof window<"u"&&this.visibilityHandler&&(window.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null);this.buffer.length>0;)await this.flush()}},As=new kn,ee=As;async function ri(){let t=ee._getIdentity();if(t.userId&&t.userHash)return{"X-Scoperat-User-Hash":t.userHash,"X-Scoperat-User-Id":t.userId};let e=await ee._ensureTicketSession();return e?{"X-Scoperat-Session":e.token}:{}}async function ii(){let t=new URLSearchParams,e=ee._getIdentity();if(e.userId&&e.userHash)return t.set("user_id",e.userId),t.set("user_hash",e.userHash),t;let n=await ee._ensureTicketSession();return n&&t.set("session",n.token),t}async function si(){let t=ee._getWriteKey();return{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{},...await ri()}}async function wn(){let t=ee._getWriteKey();return{...t?{Authorization:`Bearer ${t}`}:{},...await ri()}}function ze(){return ee._getEndpoint()}async function Rt(t){let e=new FormData;e.append("file",t);let n=await fetch(`${ze()}/api/ingest/ticket/upload`,{method:"POST",headers:await wn(),body:e});if(!n.ok){let r=await n.text().catch(()=>"");throw new Error(`Upload failed: ${n.status} ${r}`)}return n.json()}async function oi(t){let e=ee._getIdentity(),n=Ze(),r=await fetch(`${ze()}/api/ingest/ticket`,{method:"POST",headers:await si(),body:JSON.stringify({...t,attachments:t.attachments?.map(i=>({storageKey:i.storageKey,fileName:i.fileName,mimeType:i.mimeType,fileSize:i.size})),email:t.email??e.email,name:t.name??e.name,metadata:{...n,...t.metadata}})});if(!r.ok){let i=await r.text().catch(()=>"");throw new Error(`Failed to create ticket: ${r.status} ${i}`)}return r.json()}async function ai(t,e,n){let r=await fetch(`${ze()}/api/ingest/ticket/message`,{method:"POST",headers:await si(),body:JSON.stringify({ticketId:t,body:e,attachments:n?.map(i=>({storageKey:i.storageKey,fileName:i.fileName,mimeType:i.mimeType,fileSize:i.size}))})});if(!r.ok){let i=await r.text().catch(()=>"");throw new Error(`Failed to send message: ${r.status} ${i}`)}return r.json()}async function li(){let t=await ii(),e=ee._getWriteKey();e&&t.set("key",e);let n=await fetch(`${ze()}/api/ingest/tickets?${t.toString()}`,{headers:await wn()});return n.ok?(await n.json()).tickets:[]}async function vn(t){let e=await ii(),n=await fetch(`${ze()}/api/ingest/ticket/${t}?${e.toString()}`,{headers:await wn()});if(!n.ok)throw new Error(`Failed to fetch conversation: ${n.status}`);return n.json()}async function ci(t,e){try{let n=await fetch(`${ze()}/api/kb/${t}/${e}`);return n.ok?n.json():null}catch{return null}}var yn=new Set,Ct={isOpen:!1,view:"conversations",tickets:[],activeTicketId:null,activeConversation:null,loading:!1,error:null};function Is(){for(let t of yn)t()}function Ae(){return Ct}function ui(t){return yn.add(t),()=>yn.delete(t)}function J(t){Ct={...Ct,...t},Is()}function pi(){J({isOpen:!Ct.isOpen})}function Lt(t){J({view:t})}function $t(t){J({view:"thread",activeTicketId:t})}function di(){J({view:"conversations",activeTicketId:null,activeConversation:null})}var Rs=0;function c(t,e,n,r,i,s){e||(e={});var o,u,l=e;if("ref"in l)for(u in l={},e)u=="ref"?o=e[u]:l[u]=e[u];var p={type:t,props:l,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Rs,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(u in o)l[u]===void 0&&(l[u]=o[u]);return R.vnode&&R.vnode(p),p}function Cs(t){let e=Math.floor((Date.now()-new Date(t).getTime())/1e3);if(e<60)return"just now";let n=Math.floor(e/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Ls({ticket:t}){return c("li",{class:"sr-ticket-item",onClick:()=>$t(t.id),children:[c("h4",{children:t.subject}),c("div",{class:"sr-meta",children:c("span",{children:Cs(t.lastMessageAt??t.createdAt)})})]})}function hi(){let t=Ae();return Se(()=>{J({loading:!0}),li().then(e=>J({tickets:e,loading:!1})).catch(()=>J({loading:!1}))},[]),t.loading?c("div",{class:"sr-loading",children:"Loading conversations..."}):c("div",{children:t.tickets.length===0?c("div",{class:"sr-empty",children:[c("p",{children:"No conversations yet"}),c("button",{class:"sr-btn sr-btn-secondary",onClick:()=>Lt("new-ticket"),children:"Start one"})]}):c("ul",{class:"sr-ticket-list",children:t.tickets.map(e=>c(Ls,{ticket:e},e.id))})})}var{entries:vi,setPrototypeOf:fi,isFrozen:$s,getPrototypeOf:Ds,getOwnPropertyDescriptor:Ps}=Object,{freeze:V,seal:te,create:it}=Object,{apply:Cn,construct:Ln}=typeof Reflect<"u"&&Reflect;V||(V=function(e){return e});te||(te=function(e){return e});Cn||(Cn=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(n,i)});Ln||(Ln=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return new e(...r)});var Je=Y(Array.prototype.forEach),Os=Y(Array.prototype.lastIndexOf),gi=Y(Array.prototype.pop),et=Y(Array.prototype.push),Ns=Y(Array.prototype.splice),Pt=Y(String.prototype.toLowerCase),Tn=Y(String.prototype.toString),Sn=Y(String.prototype.match),Fe=Y(String.prototype.replace),Ms=Y(String.prototype.indexOf),zs=Y(String.prototype.trim),re=Y(Object.prototype.hasOwnProperty),K=Y(RegExp.prototype.test),tt=Fs(TypeError);function Y(t){return function(e){e instanceof RegExp&&(e.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 Cn(t,e,r)}}function Fs(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return Ln(t,n)}}function y(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Pt;fi&&fi(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){let s=n(i);s!==i&&($s(e)||(e[r]=s),i=s)}t[i]=!0}return t}function Hs(t){for(let e=0;e<t.length;e++)re(t,e)||(t[e]=null);return t}function le(t){let e=it(null);for(let[n,r]of vi(t))re(t,n)&&(Array.isArray(r)?e[n]=Hs(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=le(r):e[n]=r);return e}function nt(t,e){for(;t!==null;){let r=Ps(t,e);if(r){if(r.get)return Y(r.get);if(typeof r.value=="function")return Y(r.value)}t=Ds(t)}function n(){return null}return n}var mi=V(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),En=V(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),An=V(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Us=V(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),In=V(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Bs=V(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_i=V(["#text"]),xi=V(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Rn=V(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),bi=V(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),Dt=V(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),js=te(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ws=te(/<%[\w\W]*|[\w\W]*%>/gm),Gs=te(/\$\{[\w\W]*/gm),qs=te(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ks=te(/^aria-[\-\w]+$/),yi=te(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Vs=te(/^(?:\w+script|data):/i),Ys=te(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ti=te(/^html$/i),Xs=te(/^[a-z][.\w]*(-[.\w]+)+$/i),ki=Object.freeze({__proto__:null,ARIA_ATTR:Ks,ATTR_WHITESPACE:Ys,CUSTOM_ELEMENT:Xs,DATA_ATTR:qs,DOCTYPE_NAME:Ti,ERB_EXPR:Ws,IS_ALLOWED_URI:yi,IS_SCRIPT_OR_DATA:Vs,MUSTACHE_EXPR:js,TMPLIT_EXPR:Gs}),rt={element:1,text:3,progressingInstruction:7,comment:8,document:9},Zs=function(){return typeof window>"u"?null:window},Qs=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));let s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},wi=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Si(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Zs(),e=k=>Si(k);if(e.version="3.4.0",e.removed=[],!t||!t.document||t.document.nodeType!==rt.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t,r=n,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:u,Element:l,NodeFilter:p,NamedNodeMap:h=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:m,trustedTypes:g}=t,_=l.prototype,E=nt(_,"cloneNode"),w=nt(_,"remove"),v=nt(_,"nextSibling"),T=nt(_,"childNodes"),D=nt(_,"parentNode");if(typeof o=="function"){let k=n.createElement("template");k.content&&k.content.ownerDocument&&(n=k.content.ownerDocument)}let A,U="",{implementation:q,createNodeIterator:ue,createDocumentFragment:ge,getElementsByTagName:I}=n,{importNode:F}=r,$=wi();e.isSupported=typeof vi=="function"&&typeof D=="function"&&q&&q.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:pe,ERB_EXPR:Le,TMPLIT_EXPR:$e,DATA_ATTR:Xi,ARIA_ATTR:Zi,IS_SCRIPT_OR_DATA:Qi,ATTR_WHITESPACE:Kn,CUSTOM_ELEMENT:Ji}=ki,{IS_ALLOWED_URI:Vn}=ki,B=null,Yn=y({},[...mi,...En,...An,...In,..._i]),j=null,Xn=y({},[...xi,...Rn,...bi,...Dt]),P=Object.seal(it(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}})),Ue=null,lt=null,me=Object.seal(it(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Zn=!0,jt=!0,Qn=!1,Jn=!0,ve=!1,Be=!0,ye=!1,Wt=!1,Gt=!1,De=!1,ct=!1,ut=!1,er=!0,tr=!1,es="user-content-",qt=!0,je=!1,Pe={},oe=null,Kt=y({},["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"]),nr=null,rr=y({},["audio","video","img","source","image","track"]),Vt=null,ir=y({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pt="http://www.w3.org/1998/Math/MathML",dt="http://www.w3.org/2000/svg",ae="http://www.w3.org/1999/xhtml",Oe=ae,Yt=!1,Xt=null,ts=y({},[pt,dt,ae],Tn),ht=y({},["mi","mo","mn","ms","mtext"]),ft=y({},["annotation-xml"]),ns=y({},["title","style","font","a","script"]),We=null,rs=["application/xhtml+xml","text/html"],is="text/html",H=null,Ne=null,ss=n.createElement("form"),sr=function(a){return a instanceof RegExp||a instanceof Function},Zt=function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ne&&Ne===a)){if((!a||typeof a!="object")&&(a={}),a=le(a),We=rs.indexOf(a.PARSER_MEDIA_TYPE)===-1?is:a.PARSER_MEDIA_TYPE,H=We==="application/xhtml+xml"?Tn:Pt,B=re(a,"ALLOWED_TAGS")?y({},a.ALLOWED_TAGS,H):Yn,j=re(a,"ALLOWED_ATTR")?y({},a.ALLOWED_ATTR,H):Xn,Xt=re(a,"ALLOWED_NAMESPACES")?y({},a.ALLOWED_NAMESPACES,Tn):ts,Vt=re(a,"ADD_URI_SAFE_ATTR")?y(le(ir),a.ADD_URI_SAFE_ATTR,H):ir,nr=re(a,"ADD_DATA_URI_TAGS")?y(le(rr),a.ADD_DATA_URI_TAGS,H):rr,oe=re(a,"FORBID_CONTENTS")?y({},a.FORBID_CONTENTS,H):Kt,Ue=re(a,"FORBID_TAGS")?y({},a.FORBID_TAGS,H):le({}),lt=re(a,"FORBID_ATTR")?y({},a.FORBID_ATTR,H):le({}),Pe=re(a,"USE_PROFILES")?a.USE_PROFILES:!1,Zn=a.ALLOW_ARIA_ATTR!==!1,jt=a.ALLOW_DATA_ATTR!==!1,Qn=a.ALLOW_UNKNOWN_PROTOCOLS||!1,Jn=a.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ve=a.SAFE_FOR_TEMPLATES||!1,Be=a.SAFE_FOR_XML!==!1,ye=a.WHOLE_DOCUMENT||!1,De=a.RETURN_DOM||!1,ct=a.RETURN_DOM_FRAGMENT||!1,ut=a.RETURN_TRUSTED_TYPE||!1,Gt=a.FORCE_BODY||!1,er=a.SANITIZE_DOM!==!1,tr=a.SANITIZE_NAMED_PROPS||!1,qt=a.KEEP_CONTENT!==!1,je=a.IN_PLACE||!1,Vn=a.ALLOWED_URI_REGEXP||yi,Oe=a.NAMESPACE||ae,ht=a.MATHML_TEXT_INTEGRATION_POINTS||ht,ft=a.HTML_INTEGRATION_POINTS||ft,P=a.CUSTOM_ELEMENT_HANDLING||it(null),a.CUSTOM_ELEMENT_HANDLING&&sr(a.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=a.CUSTOM_ELEMENT_HANDLING.tagNameCheck),a.CUSTOM_ELEMENT_HANDLING&&sr(a.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=a.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),a.CUSTOM_ELEMENT_HANDLING&&typeof a.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(P.allowCustomizedBuiltInElements=a.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ve&&(jt=!1),ct&&(De=!0),Pe&&(B=y({},_i),j=it(null),Pe.html===!0&&(y(B,mi),y(j,xi)),Pe.svg===!0&&(y(B,En),y(j,Rn),y(j,Dt)),Pe.svgFilters===!0&&(y(B,An),y(j,Rn),y(j,Dt)),Pe.mathMl===!0&&(y(B,In),y(j,bi),y(j,Dt))),me.tagCheck=null,me.attributeCheck=null,a.ADD_TAGS&&(typeof a.ADD_TAGS=="function"?me.tagCheck=a.ADD_TAGS:(B===Yn&&(B=le(B)),y(B,a.ADD_TAGS,H))),a.ADD_ATTR&&(typeof a.ADD_ATTR=="function"?me.attributeCheck=a.ADD_ATTR:(j===Xn&&(j=le(j)),y(j,a.ADD_ATTR,H))),a.ADD_URI_SAFE_ATTR&&y(Vt,a.ADD_URI_SAFE_ATTR,H),a.FORBID_CONTENTS&&(oe===Kt&&(oe=le(oe)),y(oe,a.FORBID_CONTENTS,H)),a.ADD_FORBID_CONTENTS&&(oe===Kt&&(oe=le(oe)),y(oe,a.ADD_FORBID_CONTENTS,H)),qt&&(B["#text"]=!0),ye&&y(B,["html","head","body"]),B.table&&(y(B,["tbody"]),delete Ue.tbody),a.TRUSTED_TYPES_POLICY){if(typeof a.TRUSTED_TYPES_POLICY.createHTML!="function")throw tt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof a.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw tt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=a.TRUSTED_TYPES_POLICY,U=A.createHTML("")}else A===void 0&&(A=Qs(g,i)),A!==null&&typeof U=="string"&&(U=A.createHTML(""));V&&V(a),Ne=a}},or=y({},[...En,...An,...Us]),ar=y({},[...In,...Bs]),os=function(a){let f=D(a);(!f||!f.tagName)&&(f={namespaceURI:Oe,tagName:"template"});let x=Pt(a.tagName),L=Pt(f.tagName);return Xt[a.namespaceURI]?a.namespaceURI===dt?f.namespaceURI===ae?x==="svg":f.namespaceURI===pt?x==="svg"&&(L==="annotation-xml"||ht[L]):!!or[x]:a.namespaceURI===pt?f.namespaceURI===ae?x==="math":f.namespaceURI===dt?x==="math"&&ft[L]:!!ar[x]:a.namespaceURI===ae?f.namespaceURI===dt&&!ft[L]||f.namespaceURI===pt&&!ht[L]?!1:!ar[x]&&(ns[x]||!or[x]):!!(We==="application/xhtml+xml"&&Xt[a.namespaceURI]):!1},ne=function(a){et(e.removed,{element:a});try{D(a).removeChild(a)}catch{w(a)}},Te=function(a,f){try{et(e.removed,{attribute:f.getAttributeNode(a),from:f})}catch{et(e.removed,{attribute:null,from:f})}if(f.removeAttribute(a),a==="is")if(De||ct)try{ne(f)}catch{}else try{f.setAttribute(a,"")}catch{}},lr=function(a){let f=null,x=null;if(Gt)a="<remove></remove>"+a;else{let N=Sn(a,/^[\r\n\t ]+/);x=N&&N[0]}We==="application/xhtml+xml"&&Oe===ae&&(a='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+a+"</body></html>");let L=A?A.createHTML(a):a;if(Oe===ae)try{f=new m().parseFromString(L,We)}catch{}if(!f||!f.documentElement){f=q.createDocument(Oe,"template",null);try{f.documentElement.innerHTML=Yt?U:L}catch{}}let G=f.body||f.documentElement;return a&&x&&G.insertBefore(n.createTextNode(x),G.childNodes[0]||null),Oe===ae?I.call(f,ye?"html":"body")[0]:ye?f.documentElement:G},cr=function(a){return ue.call(a.ownerDocument||a,a,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Qt=function(a){return a instanceof d&&(typeof a.nodeName!="string"||typeof a.textContent!="string"||typeof a.removeChild!="function"||!(a.attributes instanceof h)||typeof a.removeAttribute!="function"||typeof a.setAttribute!="function"||typeof a.namespaceURI!="string"||typeof a.insertBefore!="function"||typeof a.hasChildNodes!="function")},Jt=function(a){return typeof u=="function"&&a instanceof u};function de(k,a,f){Je(k,x=>{x.call(e,a,f,Ne)})}let ur=function(a){let f=null;if(de($.beforeSanitizeElements,a,null),Qt(a))return ne(a),!0;let x=H(a.nodeName);if(de($.uponSanitizeElement,a,{tagName:x,allowedTags:B}),Be&&a.hasChildNodes()&&!Jt(a.firstElementChild)&&K(/<[/\w!]/g,a.innerHTML)&&K(/<[/\w!]/g,a.textContent)||Be&&a.namespaceURI===ae&&x==="style"&&Jt(a.firstElementChild)||a.nodeType===rt.progressingInstruction||Be&&a.nodeType===rt.comment&&K(/<[/\w]/g,a.data))return ne(a),!0;if(Ue[x]||!(me.tagCheck instanceof Function&&me.tagCheck(x))&&!B[x]){if(!Ue[x]&&dr(x)&&(P.tagNameCheck instanceof RegExp&&K(P.tagNameCheck,x)||P.tagNameCheck instanceof Function&&P.tagNameCheck(x)))return!1;if(qt&&!oe[x]){let L=D(a)||a.parentNode,G=T(a)||a.childNodes;if(G&&L){let N=G.length;for(let Z=N-1;Z>=0;--Z){let Q=E(G[Z],!0);Q.__removalCount=(a.__removalCount||0)+1,L.insertBefore(Q,v(a))}}}return ne(a),!0}return a instanceof l&&!os(a)||(x==="noscript"||x==="noembed"||x==="noframes")&&K(/<\/no(script|embed|frames)/i,a.innerHTML)?(ne(a),!0):(ve&&a.nodeType===rt.text&&(f=a.textContent,Je([pe,Le,$e],L=>{f=Fe(f,L," ")}),a.textContent!==f&&(et(e.removed,{element:a.cloneNode()}),a.textContent=f)),de($.afterSanitizeElements,a,null),!1)},pr=function(a,f,x){if(lt[f]||er&&(f==="id"||f==="name")&&(x in n||x in ss))return!1;if(!(jt&&!lt[f]&&K(Xi,f))){if(!(Zn&&K(Zi,f))){if(!(me.attributeCheck instanceof Function&&me.attributeCheck(f,a))){if(!j[f]||lt[f]){if(!(dr(a)&&(P.tagNameCheck instanceof RegExp&&K(P.tagNameCheck,a)||P.tagNameCheck instanceof Function&&P.tagNameCheck(a))&&(P.attributeNameCheck instanceof RegExp&&K(P.attributeNameCheck,f)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(f,a))||f==="is"&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&K(P.tagNameCheck,x)||P.tagNameCheck instanceof Function&&P.tagNameCheck(x))))return!1}else if(!Vt[f]){if(!K(Vn,Fe(x,Kn,""))){if(!((f==="src"||f==="xlink:href"||f==="href")&&a!=="script"&&Ms(x,"data:")===0&&nr[a])){if(!(Qn&&!K(Qi,Fe(x,Kn,"")))){if(x)return!1}}}}}}}return!0},dr=function(a){return a!=="annotation-xml"&&Sn(a,Ji)},hr=function(a){de($.beforeSanitizeAttributes,a,null);let{attributes:f}=a;if(!f||Qt(a))return;let x={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0},L=f.length;for(;L--;){let G=f[L],{name:N,namespaceURI:Z,value:Q}=G,_e=H(N),en=Q,W=N==="value"?en:zs(en);if(x.attrName=_e,x.attrValue=W,x.keepAttr=!0,x.forceKeepAttr=void 0,de($.uponSanitizeAttribute,a,x),W=x.attrValue,tr&&(_e==="id"||_e==="name")&&(Te(N,a),W=es+W),Be&&K(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,W)){Te(N,a);continue}if(_e==="attributename"&&Sn(W,"href")){Te(N,a);continue}if(x.forceKeepAttr)continue;if(!x.keepAttr){Te(N,a);continue}if(!Jn&&K(/\/>/i,W)){Te(N,a);continue}ve&&Je([pe,Le,$e],mr=>{W=Fe(W,mr," ")});let gr=H(a.nodeName);if(!pr(gr,_e,W)){Te(N,a);continue}if(A&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Z)switch(g.getAttributeType(gr,_e)){case"TrustedHTML":{W=A.createHTML(W);break}case"TrustedScriptURL":{W=A.createScriptURL(W);break}}if(W!==en)try{Z?a.setAttributeNS(Z,N,W):a.setAttribute(N,W),Qt(a)?ne(a):gi(e.removed)}catch{Te(N,a)}}de($.afterSanitizeAttributes,a,null)},fr=function(a){let f=null,x=cr(a);for(de($.beforeSanitizeShadowDOM,a,null);f=x.nextNode();)de($.uponSanitizeShadowNode,f,null),ur(f),hr(f),f.content instanceof s&&fr(f.content);de($.afterSanitizeShadowDOM,a,null)};return e.sanitize=function(k){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=null,x=null,L=null,G=null;if(Yt=!k,Yt&&(k="<!-->"),typeof k!="string"&&!Jt(k))if(typeof k.toString=="function"){if(k=k.toString(),typeof k!="string")throw tt("dirty is not a string, aborting")}else throw tt("toString is not a function");if(!e.isSupported)return k;if(Wt||Zt(a),e.removed=[],typeof k=="string"&&(je=!1),je){if(k.nodeName){let Q=H(k.nodeName);if(!B[Q]||Ue[Q])throw tt("root node is forbidden and cannot be sanitized in-place")}}else if(k instanceof u)f=lr("<!---->"),x=f.ownerDocument.importNode(k,!0),x.nodeType===rt.element&&x.nodeName==="BODY"||x.nodeName==="HTML"?f=x:f.appendChild(x);else{if(!De&&!ve&&!ye&&k.indexOf("<")===-1)return A&&ut?A.createHTML(k):k;if(f=lr(k),!f)return De?null:ut?U:""}f&&Gt&&ne(f.firstChild);let N=cr(je?k:f);for(;L=N.nextNode();)ur(L),hr(L),L.content instanceof s&&fr(L.content);if(je)return k;if(De){if(ve){f.normalize();let Q=f.innerHTML;Je([pe,Le,$e],_e=>{Q=Fe(Q,_e," ")}),f.innerHTML=Q}if(ct)for(G=ge.call(f.ownerDocument);f.firstChild;)G.appendChild(f.firstChild);else G=f;return(j.shadowroot||j.shadowrootmode)&&(G=F.call(r,G,!0)),G}let Z=ye?f.outerHTML:f.innerHTML;return ye&&B["!doctype"]&&f.ownerDocument&&f.ownerDocument.doctype&&f.ownerDocument.doctype.name&&K(Ti,f.ownerDocument.doctype.name)&&(Z="<!DOCTYPE "+f.ownerDocument.doctype.name+`>
|
|
901
901
|
`+Z),ve&&Je([pe,Le,$e],Q=>{Z=Fe(Z,Q," ")}),A&&ut?A.createHTML(Z):Z},e.setConfig=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Zt(k),Wt=!0},e.clearConfig=function(){Ne=null,Wt=!1},e.isValidAttribute=function(k,a,f){Ne||Zt({});let x=H(k),L=H(a);return pr(x,L,f)},e.addHook=function(k,a){typeof a=="function"&&et($[k],a)},e.removeHook=function(k,a){if(a!==void 0){let f=Os($[k],a);return f===-1?void 0:Ns($[k],f,1)[0]}return gi($[k])},e.removeHooks=function(k){$[k]=[]},e.removeAllHooks=function(){$=wi()},e}var $n=Si();function Nn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ce=Nn();function Di(t){Ce=t}var Ie={exec:()=>null};function S(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(X.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var Js=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),X={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,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,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},eo=/^(?:[ \t]*(?:\n|$))+/,to=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,no=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,at=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ro=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Mn=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Pi=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Oi=S(Pi).replace(/bull/g,Mn).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(),io=S(Pi).replace(/bull/g,Mn).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(),zn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,so=/^[^\n]+/,Fn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,oo=S(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Fn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ao=S(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Mn).getRegex(),Ht="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",Hn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,lo=S("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Hn).replace("tag",Ht).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ni=S(zn).replace("hr",at).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ht).getRegex(),co=S(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ni).getRegex(),Un={blockquote:co,code:to,def:oo,fences:no,heading:ro,hr:at,html:lo,lheading:Oi,list:ao,newline:eo,paragraph:Ni,table:Ie,text:so},Ei=S("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",at).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ht).getRegex(),uo={...Un,lheading:io,table:Ei,paragraph:S(zn).replace("hr",at).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ei).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ht).getRegex()},po={...Un,html:S(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Hn).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:Ie,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:S(zn).replace("hr",at).replace("heading",` *#{1,6} *[^
|
|
902
902
|
]`).replace("lheading",Oi).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ho=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,fo=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Mi=/^( {2,}|\\)\n(?!\s*$)/,go=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,He=/[\p{P}\p{S}]/u,Ut=/[\s\p{P}\p{S}]/u,Bn=/[^\s\p{P}\p{S}]/u,mo=S(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ut).getRegex(),zi=/(?!~)[\p{P}\p{S}]/u,_o=/(?!~)[\s\p{P}\p{S}]/u,xo=/(?:[^\s\p{P}\p{S}]|~)/u,bo=S(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Js?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Fi=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ko=S(Fi,"u").replace(/punct/g,He).getRegex(),wo=S(Fi,"u").replace(/punct/g,zi).getRegex(),Hi="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",vo=S(Hi,"gu").replace(/notPunctSpace/g,Bn).replace(/punctSpace/g,Ut).replace(/punct/g,He).getRegex(),yo=S(Hi,"gu").replace(/notPunctSpace/g,xo).replace(/punctSpace/g,_o).replace(/punct/g,zi).getRegex(),To=S("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Bn).replace(/punctSpace/g,Ut).replace(/punct/g,He).getRegex(),So=S(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,He).getRegex(),Eo="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ao=S(Eo,"gu").replace(/notPunctSpace/g,Bn).replace(/punctSpace/g,Ut).replace(/punct/g,He).getRegex(),Io=S(/\\(punct)/,"gu").replace(/punct/g,He).getRegex(),Ro=S(/^<(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(),Co=S(Hn).replace("(?:-->|$)","-->").getRegex(),Lo=S("^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",Co).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Mt=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,$o=S(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Mt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ui=S(/^!?\[(label)\]\[(ref)\]/).replace("label",Mt).replace("ref",Fn).getRegex(),Bi=S(/^!?\[(ref)\](?:\[\])?/).replace("ref",Fn).getRegex(),Do=S("reflink|nolink(?!\\()","g").replace("reflink",Ui).replace("nolink",Bi).getRegex(),Ai=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,jn={_backpedal:Ie,anyPunctuation:Io,autolink:Ro,blockSkip:bo,br:Mi,code:fo,del:Ie,delLDelim:Ie,delRDelim:Ie,emStrongLDelim:ko,emStrongRDelimAst:vo,emStrongRDelimUnd:To,escape:ho,link:$o,nolink:Bi,punctuation:mo,reflink:Ui,reflinkSearch:Do,tag:Lo,text:go,url:Ie},Po={...jn,link:S(/^!?\[(label)\]\((.*?)\)/).replace("label",Mt).getRegex(),reflink:S(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Mt).getRegex()},Dn={...jn,emStrongRDelimAst:yo,emStrongLDelim:wo,delLDelim:So,delRDelim:Ao,url:S(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ai).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:S(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ai).getRegex()},Oo={...Dn,br:S(Mi).replace("{2,}","*").getRegex(),text:S(Dn.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ot={normal:Un,gfm:uo,pedantic:po},st={normal:jn,gfm:Dn,breaks:Oo,pedantic:Po},No={"&":"&","<":"<",">":">",'"':""","'":"'"},Ii=t=>No[t];function ce(t,e){if(e){if(X.escapeTest.test(t))return t.replace(X.escapeReplace,Ii)}else if(X.escapeTestNoEncode.test(t))return t.replace(X.escapeReplaceNoEncode,Ii);return t}function Ri(t){try{t=encodeURI(t).replace(X.percentDecode,"%")}catch{return null}return t}function Ci(t,e){let n=t.replace(X.findPipe,(s,o,u)=>{let l=!1,p=o;for(;--p>=0&&u[p]==="\\";)l=!l;return l?"|":" |"}),r=n.split(X.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(X.slashPipe,"|");return r}function ke(t,e,n){let r=t.length;if(r===0)return"";let i=0;for(;i<r;){let s=t.charAt(r-i-1);if(s===e&&!n)i++;else if(s!==e&&n)i++;else break}return t.slice(0,r-i)}function Li(t){let e=t.split(`
|
|
903
903
|
`),n=e.length-1;for(;n>=0&&!e[n].trim();)n--;return e.length-n<=2?t:e.slice(0,n+1).join(`
|