obi-sdk 0.19.14 → 0.19.16

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 CHANGED
@@ -9,7 +9,7 @@
9
9
  50% { transform: translateX(344px); }
10
10
  100% { transform: translateX(344px); }
11
11
  }
12
- `}),_("article",{style:n.skeletonContainer,role:"status","aria-label":"Loading content",children:[_("section",{style:n.headerSection,children:[_("div",{style:n.avatar,role:"img","aria-label":"Loading avatar",children:_("div",{style:n.shimmer})}),_("div",{style:n.textLines,children:[_("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 1",children:_("div",{style:n.shimmer})}),_("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 2",children:_("div",{style:n.shimmer})})]})]}),_("section",{style:n.contentSection,children:_("div",{style:n.contentBlock,role:"presentation","aria-label":"Loading card content",children:_("div",{style:n.shimmer})})})]})]})}function IC({}){const n={host:{display:"block"},shareContainer:{width:"480px",height:"240px",borderRadius:"12px",display:"grid",placeItems:"center",overflow:"hidden",position:"relative",backgroundColor:"var(--obi-color-tint)"},controlsRow:{zIndex:10,gridRowStart:1,gridColumnStart:1,display:"flex",alignSelf:"flex-start",marginTop:"36px",alignItems:"center",gap:"8px"},monitorIconContainer:{display:"flex",height:"40px",width:"40px",aspectRatio:"1",alignItems:"center",justifyContent:"center",gap:"8px",borderRadius:"2px",border:"1px solid #E4E4E7",background:"#F8FAFC",padding:"8px"},monitorIcon:{width:"24px",height:"24px",color:"#111827"},tabSelector:{display:"flex",width:"260px",height:"40px",padding:"4px",alignItems:"center",borderRadius:"2px",background:"#E4E4E7"},tabButton:e=>({display:"flex",flex:1,alignSelf:"stretch",alignItems:"center",justifyContent:"center",gap:"10px",borderRadius:"2px",padding:"6px 12px",border:"none",cursor:"pointer",fontFamily:"'Satoshi', sans-serif",fontSize:"14px",fontWeight:500,opacity:e?1:.4,background:e?"white":"#F8FAFC",boxShadow:e?"0 1px 2px 0 rgba(0, 0, 0, 0.05)":"none"}),skeletonContainer:{marginTop:"104px",gridColumnStart:1,gridRowStart:1,alignSelf:"center"}};return _("div",{style:n.host,children:_("div",{style:n.shareContainer,children:[_("div",{style:n.controlsRow,children:[_("div",{style:n.monitorIconContainer,children:_("svg",{style:n.monitorIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[_("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",ry:"2"}),_("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),_("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]})}),_("div",{style:n.tabSelector,children:[_("button",{style:n.tabButton(!1),children:"Tab"}),_("button",{style:n.tabButton(!0),children:"Window"})]})]}),_("div",{style:n.skeletonContainer,children:_(EC,{})})]})})}function RC({session:n,speakingState:e,onAction:t}){return _(vr,{title:"Connect your screen",subtitle:"Watch for the prompt in your browser",agentName:n.agentName||"Obi",buttonText:"Share screen",speakingState:e,description:`${n.agentName||"Obi"} will guide you through ${n.appName||"the app"} by watching your screen.`,centerVisual:_(IC,{}),actionDisabled:!0,onAction:t})}function PC({spectrum:n}){return _("div",{style:{borderRadius:"15px",boxShadow:"0 0 20px 2px var(--obi-color-primary)",backgroundColor:"var(--obi-color-primary)",transform:"scale(1.6)"},children:_(Os,{isActive:!0,children:_(qf,{getBands:n})})})}function OC({session:n,speakingState:e,spectrum:t,onAction:i}){return _(vr,{title:"Overview",subtitle:`${n.agentName||"Obi"} will start your tutorial in a moment`,agentName:n.agentName||"Obi",speakingState:e,description:`Get ready to explore ${n.appName||"the app"} with ${n.agentName||"Obi"}.`,centerVisual:_(PC,{spectrum:t}),actionDisabled:!0,onAction:i})}function AC({id:n,name:e,description:t,duration:i=10,order:r=0,selected:o=!1,completed:s=!1,onClick:a}){return _("div",{className:`course-container ${o?"selected":""}`,onClick:()=>{a==null||a({id:n,name:e,description:t,duration:i,order:r})},children:[_("div",{className:"header-row",children:[_("h2",{className:"course-title",children:e}),s&&_("span",{className:"duration",children:"Completed"})]}),t&&_("p",{className:"course-description",children:t})]})}function MC({courses:n=[],selectedCourseId:e=null,loading:t=!1,error:i="",onCourseSelect:r}){const[o,s]=de(""),a=l=>{const d=l.currentTarget;s(d.value)},c=l=>{r==null||r(l)};if(t)return _("div",{className:"loading",children:"Loading..."});if(i)return _("div",{className:"error",children:i});if(!n||n.length===0)return _("div",{className:"empty",children:"No courses available"});const u=n.filter(l=>l.name.toLowerCase().includes(o.toLowerCase())||(l.description||"").toLowerCase().includes(o.toLowerCase()));return _("div",{className:"tour-select",children:[_("div",{className:"controls",children:[_("div",{className:"tabs",children:_("button",{className:"tab active",children:"All"})}),_("div",{className:"filter",children:[_("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:_("path",{d:"M10.0417 8.75002H9.42087L9.20004 8.53502C9.96921 7.63585 10.4417 6.47502 10.4417 5.20835C10.4417 2.56085 8.32254 0.441681 5.67504 0.441681C3.02754 0.441681 0.908374 2.56085 0.908374 5.20835C0.908374 7.85585 3.02754 9.97502 5.67504 9.97502C6.94171 9.97502 8.10254 9.50252 9.00171 8.73335L9.22671 8.95418V9.57502L13.2167 13.5592L14.375 12.4008L10.0417 8.75002ZM5.67504 8.75002C3.72754 8.75002 2.15837 7.18085 2.15837 5.20835C2.15837 3.23585 3.72754 1.66668 5.67504 1.66668C7.62254 1.66668 9.19171 3.23585 9.19171 5.20835C9.19171 7.18085 7.62254 8.75002 5.67504 8.75002Z",fill:"#6B7280"})}),_("input",{type:"text",placeholder:"Search...",value:o,onInput:a})]})]}),_("div",{className:"course-grid",children:u.sort((l,d)=>(l.order||0)-(d.order||0)).map(l=>{const d=l.id===e;return _(AC,{id:l.id,name:l.name,description:l.description||"",duration:l.duration,order:l.order||0,completed:l.completed,selected:d,onClick:c},l.id)})})]})}function NC({open:n,courses:e=[],loading:t=!1,error:i="",agentName:r="Obi",productName:o,onClose:s,onCourseSelect:a,onCourseHighlight:c}){const[u,l]=de(null),d=p=>{l(p),c==null||c(p)},h=()=>{u&&a&&a(u)};return _(jf,{open:n,onClose:s,size:"large",children:_("div",{className:"tour-select-modal-container",children:[_("div",{className:"header",children:[_("div",{className:"icon",style:{color:"white"},children:_(im,{})}),_("div",{className:"title-section",children:t?_(St,{children:[_("div",{className:"skeleton skeleton-title"}),_("div",{className:"skeleton skeleton-subtitle"})]}):_(St,{children:[_("h1",{children:[r," AI Training Assistant"]}),_("p",{className:"subtitle",children:["Start a tutorial and learn how to use ",o," through an interactive conversation."]})]})})]}),_("div",{className:"course-list-wrapper",children:_(MC,{courses:e,selectedCourseId:(u==null?void 0:u.id)||"",loading:t,error:i,onCourseSelect:d})}),_("div",{className:"footer",children:[_("button",{className:"obi-button footer-button",onClick:h,disabled:!u,children:[_("span",{children:"Get started"}),_("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",children:_("path",{d:"M3.83325 8.00065H13.1666M13.1666 8.00065L8.49992 3.33398M13.1666 8.00065L8.49992 12.6673",stroke:u?"#FAFAFA":"#999","stroke-width":"1.33","stroke-linecap":"round","stroke-linejoin":"round"})})]}),_("p",{className:"footer-text",children:"Sessions are securely recorded for quality improvement purposes."})]})]})})}function DC({session:n,sessionState:e,speakingState:t,spectrum:i,onStart:r,onContinue:o,onShareMicrophone:s,onShareScreen:a,onModalChange:c}){const[u,l]=de(null);function d(p){u!==p&&(c==null||c(p),l(p))}function h(){e==="connecting"||e==="connected"||!e?r==null||r():e==="volume-check"||e==="mic-check"?o==null||o():e==="mic-share"?s==null||s():e==="screen-share"&&(a==null||a())}return qu(()=>{switch(e){case null:case"connecting":case"connected":return d("session-start"),_(SC,{session:n,speakingState:t,onAction:h});case"volume-check":return d("voice-guidance"),_(xC,{session:n,speakingState:t,onAction:h});case"mic-check":return d("overview"),_(OC,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-share":return d("share-mic"),_(CC,{session:n,speakingState:t,onAction:h});case"screen-share":return d("share-screen"),_(RC,{session:n,speakingState:t,onAction:h});case"navigate":return d("navigate"),_(_C,{session:n,speakingState:t,onAction:h});default:return null}},[e,t,r,o,s,a])}function LC(n){const{session:e,sessionState:t,speakingState:i,spectrum:r,onClose:o,onStart:s,onContinue:a,onShareMicrophone:c,onShareScreen:u,onModalChange:l}=n,[d,h]=de(null);function p(g){l==null||l(g),h(g)}function m(g){o(g,d),h(null)}const f=(n.open??!0)&&(!t||t==="connecting"||t==="connected"||t==="volume-check"||t==="mic-check"||t==="mic-share"||t==="screen-share"||t==="navigate");return _(yC,{open:f,onClose:m,children:()=>_(DC,{session:e,sessionState:t,speakingState:i,spectrum:r,onStart:s,onContinue:a,onShareMicrophone:c,onShareScreen:u,onModalChange:p})})}const rm={identify:()=>{},track:()=>{},page:()=>{},reset:()=>{}};Ef(rm);let om=null;function UC(n){om=n}function Se(){return om||rm}const FC=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,sm="9.23.0",yr=globalThis;function BC(n,e,t=yr){const i=t.__SENTRY__=t.__SENTRY__||{},r=i[sm]=i[sm]||{};return r[n]||(r[n]=e())}const jC="Sentry Logger ",am=["debug","info","warn","error","log","assert","trace"],cm={};function VC(n){if(!("console"in yr))return n();const e=yr.console,t={},i=Object.keys(cm);i.forEach(r=>{const o=cm[r];t[r]=e[r],e[r]=o});try{return n()}finally{i.forEach(r=>{e[r]=t[r]})}}function zC(){let n=!1;const e={enable:()=>{n=!0},disable:()=>{n=!1},isEnabled:()=>n};return FC?am.forEach(t=>{e[t]=(...i)=>{n&&VC(()=>{yr.console[t](`${jC}[${t}]:`,...i)})}}):am.forEach(t=>{e[t]=()=>{}}),e}BC("logger",zC);const um=1e3;function qC(){return Date.now()/um}function WC(){const{performance:n}=yr;if(!(n!=null&&n.now))return qC;const e=Date.now()-n.now(),t=n.timeOrigin==null?e:n.timeOrigin;return()=>(t+n.now())/um}WC();const lm=50,br="?",dm=/\(error: (.*)\)/,hm=/captureMessage|captureException/;function GC(...n){const e=n.sort((t,i)=>t[0]-i[0]).map(t=>t[1]);return(t,i=0,r=0)=>{const o=[],s=t.split(`
12
+ `}),_("article",{style:n.skeletonContainer,role:"status","aria-label":"Loading content",children:[_("section",{style:n.headerSection,children:[_("div",{style:n.avatar,role:"img","aria-label":"Loading avatar",children:_("div",{style:n.shimmer})}),_("div",{style:n.textLines,children:[_("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 1",children:_("div",{style:n.shimmer})}),_("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 2",children:_("div",{style:n.shimmer})})]})]}),_("section",{style:n.contentSection,children:_("div",{style:n.contentBlock,role:"presentation","aria-label":"Loading card content",children:_("div",{style:n.shimmer})})})]})]})}function IC({}){const n={host:{display:"block"},shareContainer:{width:"480px",height:"240px",borderRadius:"12px",display:"grid",placeItems:"center",overflow:"hidden",position:"relative",backgroundColor:"var(--obi-color-tint)"},controlsRow:{zIndex:10,gridRowStart:1,gridColumnStart:1,display:"flex",alignSelf:"flex-start",marginTop:"36px",alignItems:"center",gap:"8px"},monitorIconContainer:{display:"flex",height:"40px",width:"40px",aspectRatio:"1",alignItems:"center",justifyContent:"center",gap:"8px",borderRadius:"2px",border:"1px solid #E4E4E7",background:"#F8FAFC",padding:"8px"},monitorIcon:{width:"24px",height:"24px",color:"#111827"},tabSelector:{display:"flex",width:"260px",height:"40px",padding:"4px",alignItems:"center",borderRadius:"2px",background:"#E4E4E7"},tabButton:e=>({display:"flex",flex:1,alignSelf:"stretch",alignItems:"center",justifyContent:"center",gap:"10px",borderRadius:"2px",padding:"6px 12px",border:"none",cursor:"pointer",fontFamily:"'Satoshi', sans-serif",fontSize:"14px",fontWeight:500,opacity:e?1:.4,background:e?"white":"#F8FAFC",boxShadow:e?"0 1px 2px 0 rgba(0, 0, 0, 0.05)":"none"}),skeletonContainer:{marginTop:"104px",gridColumnStart:1,gridRowStart:1,alignSelf:"center"}};return _("div",{style:n.host,children:_("div",{style:n.shareContainer,children:[_("div",{style:n.controlsRow,children:[_("div",{style:n.monitorIconContainer,children:_("svg",{style:n.monitorIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[_("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",ry:"2"}),_("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),_("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]})}),_("div",{style:n.tabSelector,children:[_("button",{style:n.tabButton(!1),children:"Tab"}),_("button",{style:n.tabButton(!0),children:"Window"})]})]}),_("div",{style:n.skeletonContainer,children:_(EC,{})})]})})}function RC({session:n,speakingState:e,onAction:t}){return _(vr,{title:"Connect your screen",subtitle:"Watch for the prompt in your browser",agentName:n.agentName||"Obi",buttonText:"Share screen",speakingState:e,description:`${n.agentName||"Obi"} will guide you through ${n.appName||"the app"} by watching your screen.`,centerVisual:_(IC,{}),actionDisabled:!0,onAction:t})}function PC({spectrum:n}){return _("div",{style:{borderRadius:"15px",boxShadow:"0 0 20px 2px var(--obi-color-primary)",backgroundColor:"var(--obi-color-primary)",transform:"scale(1.6)"},children:_(Os,{isActive:!0,children:_(qf,{getBands:n})})})}function OC({session:n,speakingState:e,spectrum:t,onAction:i}){return _(vr,{title:"Overview",subtitle:`${n.agentName||"Obi"} will start your tutorial in a moment`,agentName:n.agentName||"Obi",speakingState:e,description:`Get ready to explore ${n.appName||"the app"} with ${n.agentName||"Obi"}.`,centerVisual:_(PC,{spectrum:t}),actionDisabled:!0,onAction:i})}function AC({id:n,name:e,description:t,duration:i=10,order:r=0,selected:o=!1,completed:s=!1,onClick:a}){return _("div",{className:`course-container ${o?"selected":""}`,onClick:()=>{a==null||a({id:n,name:e,description:t,duration:i,order:r})},children:[_("div",{className:"header-row",children:[_("h2",{className:"course-title",children:e}),s&&_("span",{className:"duration",children:"Completed"})]}),t&&_("p",{className:"course-description",children:t})]})}function MC({courses:n=[],selectedCourseId:e=null,loading:t=!1,error:i="",onCourseSelect:r}){const[o,s]=de(""),a=l=>{const d=l.currentTarget;s(d.value)},c=l=>{r==null||r(l)};if(t)return _("div",{className:"loading",children:"Loading..."});if(i)return _("div",{className:"error",children:i});if(!n||n.length===0)return _("div",{className:"empty",children:"No courses available"});const u=n.filter(l=>l.name.toLowerCase().includes(o.toLowerCase())||(l.description||"").toLowerCase().includes(o.toLowerCase()));return _("div",{className:"tour-select",children:[_("div",{className:"controls",children:[_("div",{className:"tabs",children:_("button",{className:"tab active",children:"All"})}),_("div",{className:"filter",children:[_("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:_("path",{d:"M10.0417 8.75002H9.42087L9.20004 8.53502C9.96921 7.63585 10.4417 6.47502 10.4417 5.20835C10.4417 2.56085 8.32254 0.441681 5.67504 0.441681C3.02754 0.441681 0.908374 2.56085 0.908374 5.20835C0.908374 7.85585 3.02754 9.97502 5.67504 9.97502C6.94171 9.97502 8.10254 9.50252 9.00171 8.73335L9.22671 8.95418V9.57502L13.2167 13.5592L14.375 12.4008L10.0417 8.75002ZM5.67504 8.75002C3.72754 8.75002 2.15837 7.18085 2.15837 5.20835C2.15837 3.23585 3.72754 1.66668 5.67504 1.66668C7.62254 1.66668 9.19171 3.23585 9.19171 5.20835C9.19171 7.18085 7.62254 8.75002 5.67504 8.75002Z",fill:"#6B7280"})}),_("input",{type:"text",placeholder:"Search...",value:o,onInput:a})]})]}),_("div",{className:"course-grid",children:u.sort((l,d)=>(l.order||0)-(d.order||0)).map(l=>{const d=l.id===e;return _(AC,{id:l.id,name:l.name,description:l.description||"",duration:l.duration,order:l.order||0,completed:l.completed,selected:d,onClick:c},l.id)})})]})}function NC({open:n,courses:e=[],loading:t=!1,error:i="",agentName:r="Obi",productName:o,onClose:s,onCourseSelect:a,onCourseHighlight:c}){const[u,l]=de(null),d=p=>{l(p),c==null||c(p)},h=()=>{u&&a&&a(u)};return _(jf,{open:n,onClose:s,size:"large",children:_("div",{className:"tour-select-modal-container",children:[_("div",{className:"header",children:[_("div",{className:"icon",style:{color:"white"},children:_(im,{})}),_("div",{className:"title-section",children:t?_(St,{children:[_("div",{className:"skeleton skeleton-title"}),_("div",{className:"skeleton skeleton-subtitle"})]}):_(St,{children:[_("h1",{children:[r," AI Training Assistant"]}),_("p",{className:"subtitle",children:["Start a tutorial and learn how to use ",o," through an interactive conversation."]})]})})]}),_("div",{className:"course-list-wrapper",children:_(MC,{courses:e,selectedCourseId:(u==null?void 0:u.id)||"",loading:t,error:i,onCourseSelect:d})}),_("div",{className:"footer",children:[_("button",{className:"obi-button footer-button",onClick:h,disabled:!u,children:[_("span",{children:"Get started"}),_("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",children:_("path",{d:"M3.83325 8.00065H13.1666M13.1666 8.00065L8.49992 3.33398M13.1666 8.00065L8.49992 12.6673",stroke:u?"#FAFAFA":"#999","stroke-width":"1.33","stroke-linecap":"round","stroke-linejoin":"round"})})]}),_("p",{className:"footer-text",children:"Sessions are securely recorded for quality improvement purposes."})]})]})})}function DC({session:n,sessionState:e,speakingState:t,spectrum:i,onStart:r,onContinue:o,onShareMicrophone:s,onShareScreen:a,onModalChange:c}){const[u,l]=de(null);function d(p){u!==p&&(c==null||c(p),l(p))}function h(){e==="connecting"||e==="connected"||!e?r==null||r():e==="volume-check"||e==="mic-check"?o==null||o():e==="mic-share"?s==null||s():e==="screen-share"&&(a==null||a())}return qu(()=>{switch(e){case null:case"connecting":case"connected":return d("session-start"),_(SC,{session:n,speakingState:t,onAction:h});case"volume-check":return d("voice-guidance"),_(xC,{session:n,speakingState:t,onAction:h});case"mic-check":return d("overview"),_(OC,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-share":return d("share-mic"),_(CC,{session:n,speakingState:t,onAction:h});case"screen-share":return d("share-screen"),_(RC,{session:n,speakingState:t,onAction:h});case"navigate":return d("navigate"),_(_C,{session:n,speakingState:t,onAction:h});default:return null}},[e,t,r,o,s,a])}function LC(n){const{session:e,sessionState:t,speakingState:i,spectrum:r,onClose:o,onStart:s,onContinue:a,onShareMicrophone:c,onShareScreen:u,onModalChange:l}=n,[d,h]=de(null);function p(g){l==null||l(g),h(g)}function m(g){o(g,d),h(null)}const f=(n.open??!0)&&(!t||t==="connecting"||t==="connected"||t==="volume-check"||t==="mic-check"||t==="mic-share"||t==="screen-share"||t==="navigate");return _(yC,{open:f,onClose:m,children:()=>_(DC,{session:e,sessionState:t,speakingState:i,spectrum:r,onStart:s,onContinue:a,onShareMicrophone:c,onShareScreen:u,onModalChange:p})})}const rm={identify:()=>{},track:()=>{},page:()=>{},reset:()=>{}};Ef(rm);let om=null;function UC(n){om=n}function be(){return om||rm}const FC=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,sm="9.23.0",yr=globalThis;function BC(n,e,t=yr){const i=t.__SENTRY__=t.__SENTRY__||{},r=i[sm]=i[sm]||{};return r[n]||(r[n]=e())}const jC="Sentry Logger ",am=["debug","info","warn","error","log","assert","trace"],cm={};function VC(n){if(!("console"in yr))return n();const e=yr.console,t={},i=Object.keys(cm);i.forEach(r=>{const o=cm[r];t[r]=e[r],e[r]=o});try{return n()}finally{i.forEach(r=>{e[r]=t[r]})}}function zC(){let n=!1;const e={enable:()=>{n=!0},disable:()=>{n=!1},isEnabled:()=>n};return FC?am.forEach(t=>{e[t]=(...i)=>{n&&VC(()=>{yr.console[t](`${jC}[${t}]:`,...i)})}}):am.forEach(t=>{e[t]=()=>{}}),e}BC("logger",zC);const um=1e3;function qC(){return Date.now()/um}function WC(){const{performance:n}=yr;if(!(n!=null&&n.now))return qC;const e=Date.now()-n.now(),t=n.timeOrigin==null?e:n.timeOrigin;return()=>(t+n.now())/um}WC();const lm=50,br="?",dm=/\(error: (.*)\)/,hm=/captureMessage|captureException/;function GC(...n){const e=n.sort((t,i)=>t[0]-i[0]).map(t=>t[1]);return(t,i=0,r=0)=>{const o=[],s=t.split(`
13
13
  `);for(let a=i;a<s.length;a++){const c=s[a];if(c.length>1024)continue;const u=dm.test(c)?c.replace(dm,"$1"):c;if(!u.match(/\S*Error: /)){for(const l of e){const d=l(u);if(d){o.push(d);break}}if(o.length>=lm+r)break}}return $C(o.slice(r))}}function $C(n){if(!n.length)return[];const e=Array.from(n);return/sentryWrapped/.test(Ns(e).function||"")&&e.pop(),e.reverse(),hm.test(Ns(e).function||"")&&(e.pop(),hm.test(Ns(e).function||"")&&e.pop()),e.slice(0,lm).map(t=>({...t,filename:t.filename||Ns(e).filename,function:t.function||br}))}function Ns(n){return n[n.length-1]||{}}var pm;(function(n){n[n.PENDING=0]="PENDING";const e=1;n[n.RESOLVED=e]="RESOLVED";const t=2;n[n.REJECTED=t]="REJECTED"})(pm||(pm={})),yr._sentryClientToLogBufferMap=new WeakMap,typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const HC=30,KC=50;function Yu(n,e,t,i){const r={filename:n,function:e==="<anonymous>"?br:e,in_app:!0};return t!==void 0&&(r.lineno=t),i!==void 0&&(r.colno=i),r}const YC=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,XC=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,JC=/\((\S*)(?::(\d+))(?::(\d+))\)/,ZC=n=>{const e=YC.exec(n);if(e){const[,i,r,o]=e;return Yu(i,br,+r,+o)}const t=XC.exec(n);if(t){if(t[2]&&t[2].indexOf("eval")===0){const o=JC.exec(t[2]);o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3])}const[i,r]=fm(t[1]||br,t[2]);return Yu(r,i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},QC=[HC,ZC],e1=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,t1=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;GC(...[QC,[KC,n=>{const e=e1.exec(n);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const r=t1.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}let t=e[3],i=e[1]||br;return[i,t]=fm(i,t),Yu(t,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]);const fm=(n,e)=>{const t=n.indexOf("safari-extension")!==-1,i=n.indexOf("safari-web-extension")!==-1;return t||i?[n.indexOf("@")!==-1?n.split("@")[0]:br,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[n,e]};typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var q;if(typeof window>"u"){var mm={hostname:""};q={crypto:{randomUUID:function(){throw Error("unsupported")}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:mm,referrer:""},screen:{width:0,height:0},location:mm,addEventListener:function(){},removeEventListener:function(){}}}else q=window;function gm(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=n[t];return i}function vm(n,e,t,i,r,o,s){try{var a=n[o](s),c=a.value}catch(u){t(u);return}a.done?e(c):Promise.resolve(c).then(i,r)}function Xu(n){return function(){var e=this,t=arguments;return new Promise(function(i,r){var o=n.apply(e,t);function s(c){vm(o,i,r,s,a,"next",c)}function a(c){vm(o,i,r,s,a,"throw",c)}s(void 0)})}}function Ds(n,e,t){return ym()?Ds=Reflect.construct:Ds=function(i,r,o){var s=[null];s.push.apply(s,r);var a=Function.bind.apply(i,s),c=new a;return o&&_o(c,o.prototype),c},Ds.apply(null,arguments)}function n1(n,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}}function mt(n,e,t){return e&&n1(n.prototype,e),n}function fe(){return fe=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},fe.apply(this,arguments)}function Ju(n){return Ju=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ju(n)}function wt(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&_o(n,e)}function ne(n,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](n):n instanceof e}function i1(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function bo(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,o;for(o=0;o<i.length;o++)r=i[o],!(e.indexOf(r)>=0)&&(t[r]=n[r]);return t}function _o(n,e){return _o=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t},_o(n,e)}function oe(n){"@swc/helpers - typeof";return n&&typeof Symbol<"u"&&n.constructor===Symbol?"symbol":typeof n}function r1(n,e){if(n){if(typeof n=="string")return gm(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return gm(n,e)}}function Ls(n){var e=typeof Map=="function"?new Map:void 0;return Ls=function(t){if(t===null||!i1(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return Ds(t,arguments,Ju(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),_o(i,t)},Ls(n)}function ym(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ym=function(){return!!n})()}function K(n,e){var t=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t)return(t=t.call(n)).next.bind(t);if(Array.isArray(n)||(t=r1(n))||e){t&&(n=t);var i=0;return function(){return i>=n.length?{done:!0}:{done:!1,value:n[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ko(n,e){var t,i,r,o,s={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,i&&(r=u[0]&2?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[u[0]&2,r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(r=s.trys,!(r=r.length>0&&r[r.length-1])&&(u[0]===6||u[0]===2)){s=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(u[0]===6&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=e.call(n,s)}catch(l){u=[6,l],i=0}finally{t=r=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function bm(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],i=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var o1=Object.defineProperty,s1=function(n,e,t){return e in n?o1(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t},V=function(n,e,t){return s1(n,(typeof e>"u"?"undefined":oe(e))!=="symbol"?e+"":e,t)},_m,a1=Object.defineProperty,c1=function(n,e,t){return e in n?a1(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t},km=function(n,e,t){return c1(n,(typeof e>"u"?"undefined":oe(e))!=="symbol"?e+"":e,t)},ct=function(n){return n[n.Document=0]="Document",n[n.DocumentType=1]="DocumentType",n[n.Element=2]="Element",n[n.Text=3]="Text",n[n.CDATA=4]="CDATA",n[n.Comment=5]="Comment",n}(ct||{}),Sm={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},wm={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Us={},u1=function(){return!!globalThis.Zone};function Zu(n){if(Us[n])return Us[n];var e=globalThis[n],t=e.prototype,i=n in Sm?Sm[n]:void 0,r=!!(i&&i.every(function(l){var d,h;return!!((h=(d=Object.getOwnPropertyDescriptor(t,l))==null?void 0:d.get)!=null&&h.toString().includes("[native code]"))})),o=n in wm?wm[n]:void 0,s=!!(o&&o.every(function(l){var d;return typeof t[l]=="function"&&((d=t[l])==null?void 0:d.toString().includes("[native code]"))}));if(r&&s&&!u1())return Us[n]=e.prototype,e.prototype;try{var a=document.createElement("iframe");document.body.appendChild(a);var c=a.contentWindow;if(!c)return e.prototype;var u=c[n].prototype;return document.body.removeChild(a),u?Us[n]=u:t}catch{return t}}var Qu={};function ti(n,e,t){var i,r=n+"."+String(t);if(Qu[r])return Qu[r].call(e);var o=Zu(n),s=(i=Object.getOwnPropertyDescriptor(o,t))==null?void 0:i.get;return s?(Qu[r]=s,s.call(e)):e[t]}var el={};function Cm(n,e,t){var i=n+"."+String(t);if(el[i])return el[i].bind(e);var r=Zu(n),o=r[t];return typeof o!="function"?e[t]:(el[i]=o,o.bind(e))}function l1(n){return ti("Node",n,"childNodes")}function d1(n){return ti("Node",n,"parentNode")}function h1(n){return ti("Node",n,"parentElement")}function p1(n){return ti("Node",n,"textContent")}function f1(n,e){return Cm("Node",n,"contains")(e)}function m1(n){return Cm("Node",n,"getRootNode")()}function g1(n){return!n||!("host"in n)?null:ti("ShadowRoot",n,"host")}function v1(n){return n.styleSheets}function y1(n){return!n||!("shadowRoot"in n)?null:ti("Element",n,"shadowRoot")}function b1(n,e){return ti("Element",n,"querySelector")(e)}function _1(n,e){return ti("Element",n,"querySelectorAll")(e)}function k1(){return Zu("MutationObserver").constructor}var Ct={childNodes:l1,parentNode:d1,parentElement:h1,textContent:p1,contains:f1,getRootNode:m1,host:g1,styleSheets:v1,shadowRoot:y1,querySelector:b1,querySelectorAll:_1,mutationObserver:k1};function Tm(n){return n.nodeType===n.ELEMENT_NODE}function So(n){var e=n&&"host"in n&&"mode"in n&&Ct.host(n)||null;return!!(e&&"shadowRoot"in e&&Ct.shadowRoot(e)===n)}function wo(n){return Object.prototype.toString.call(n)==="[object ShadowRoot]"}function S1(n){return n.includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),n}function w1(n){var e=n.cssText;if(e.split('"').length<3)return e;var t=["@import","url("+JSON.stringify(n.href)+")"];return n.layerName===""?t.push("layer"):n.layerName&&t.push("layer("+n.layerName+")"),n.supportsText&&t.push("supports("+n.supportsText+")"),n.media.length&&t.push(n.media.mediaText),t.join(" ")+";"}function tl(n){try{var e=n.rules||n.cssRules;if(!e)return null;var t=n.href;!t&&n.ownerNode&&n.ownerNode.ownerDocument&&(t=n.ownerNode.ownerDocument.location.href);var i=Array.from(e,function(r){return xm(r,t)}).join("");return S1(i)}catch{return null}}function xm(n,e){if(T1(n)){var t;try{t=tl(n.styleSheet)||w1(n)}catch{t=n.cssText}return n.styleSheet.href?Fs(t,n.styleSheet.href):t}else{var i=n.cssText;return x1(n)&&n.selectorText.includes(":")&&(i=C1(i)),e?Fs(i,e):i}}function C1(n){var e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return n.replace(e,"$1\\$2")}function T1(n){return"styleSheet"in n}function x1(n){return"selectorText"in n}var Em=function(){function n(){km(this,"idNodeMap",new Map),km(this,"nodeMetaMap",new WeakMap)}var e=n.prototype;return e.getId=function(t){var i;if(!t)return-1;var r=(i=this.getMeta(t))==null?void 0:i.id;return r??-1},e.getNode=function(t){return this.idNodeMap.get(t)||null},e.getIds=function(){return Array.from(this.idNodeMap.keys())},e.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.removeNodeFromMap=function(t){var i=this,r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(function(o){return i.removeNodeFromMap(o)})},e.has=function(t){return this.idNodeMap.has(t)},e.hasNode=function(t){return this.nodeMetaMap.has(t)},e.add=function(t,i){var r=i.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,i)},e.replace=function(t,i){var r=this.getNode(t);if(r){var o=this.nodeMetaMap.get(r);o&&this.nodeMetaMap.set(i,o)}this.idNodeMap.set(t,i)},e.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},n}();function E1(){return new Em}function nl(n){var e=n.element,t=n.maskInputOptions,i=n.tagName,r=n.type,o=n.value,s=n.maskInputFn,a=o||"",c=r&&ji(r);return(t[i.toLowerCase()]||c&&t[c])&&(s?a=s(a,e):a="*".repeat(a.length)),a}function ji(n){return n.toLowerCase()}var Im="__rrweb_original__";function I1(n){var e=n.getContext("2d");if(!e)return!0;for(var t=50,i=0;i<n.width;i+=t)for(var r=0;r<n.height;r+=t){var o=e.getImageData,s=Im in o?o[Im]:o,a=new Uint32Array(s.call(e,i,r,Math.min(t,n.width-i),Math.min(t,n.height-r)).data.buffer);if(a.some(function(c){return c!==0}))return!1}return!0}function il(n){var e=n.type;return n.hasAttribute("data-rr-is-password")?"password":e?ji(e):null}function Rm(n,e){var t;try{t=new URL(n,e??window.location.href)}catch{return null}var i=/\.([0-9a-z]+)(?:$)/i,r=t.pathname.match(i),o;return(o=r==null?void 0:r[1])!=null?o:null}function R1(n){var e="";return n.indexOf("//")>-1?e=n.split("/").slice(0,3).join("/"):e=n.split("/")[0],e=e.split("?")[0],e}var P1=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,O1=/^(?:[a-z+]+:)?\/\//i,A1=/^www\..*/i,M1=/^(data:)([^,]*),(.*)/i;function Fs(n,e){return(n||"").replace(P1,function(t,i,r,o,s,a){var c=r||s||a,u=i||o||"";if(!c)return t;if(O1.test(c)||A1.test(c)||M1.test(c))return"url("+u+c+u+")";if(c[0]==="/")return"url("+u+(R1(e)+c)+u+")";var l=e.split("/"),d=c.split("/");l.pop();for(var h=K(d),p;!(p=h()).done;){var m=p.value;m!=="."&&(m===".."?l.pop():l.push(m))}return"url("+u+l.join("/")+u+")"})}function rl(n){return n.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function N1(n,e){var t=Array.from(e.childNodes),i=[];if(t.length>1&&n&&typeof n=="string"){for(var r=rl(n),o=1;o<t.length;o++)if(t[o].textContent&&typeof t[o].textContent=="string")for(var s=rl(t[o].textContent),a=3;a<s.length;a++){var c=s.substring(0,a);if(r.split(c).length===2){for(var u=r.indexOf(c),l=u;l<n.length;l++)if(rl(n.substring(0,l)).length===u){i.push(n.substring(0,l)),n=n.substring(l);break}break}}}return i.push(n),i}function D1(n,e){return N1(n,e).join("/* rr_split */")}var L1=1,U1=new RegExp("[^a-z0-9-_:]"),Co=-2;function Pm(){return L1++}function F1(n){if(ne(n,HTMLFormElement))return"form";var e=ji(n.tagName);return U1.test(e)?"div":e}var _r,Om,B1=/^[^ \t\n\r\u000c]+/,j1=/^[, \t\n\r\u000c]+/;function V1(n,e){if(e.trim()==="")return e;var t=0;function i(u){var l,d=u.exec(e.substring(t));return d?(l=d[0],t+=l.length,l):""}for(var r=[];i(j1),!(t>=e.length);){var o=i(B1);if(o.slice(-1)===",")o=Bs(n,o.substring(0,o.length-1)),r.push(o);else{var s="";o=Bs(n,o);for(var a=!1;;){var c=e.charAt(t);if(c===""){r.push((o+s).trim());break}else if(a)c===")"&&(a=!1);else if(c===","){t+=1,r.push((o+s).trim());break}else c==="("&&(a=!0);s+=c,t+=1}}}return r.join(", ")}var Am=new WeakMap;function Bs(n,e){return!e||e.trim()===""?e:ol(n,e)}function z1(n){return!!(n.tagName==="svg"||n.ownerSVGElement)}function ol(n,e){var t=Am.get(n);if(t||(t=n.createElement("a"),Am.set(n,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function Mm(n,e,t,i){return i&&(t==="src"||t==="href"&&!(e==="use"&&i[0]==="#")||t==="xlink:href"&&i[0]!=="#"||t==="background"&&(e==="table"||e==="td"||e==="th")?Bs(n,i):t==="srcset"?V1(n,i):t==="style"?Fs(i,ol(n)):e==="object"&&t==="data"?Bs(n,i):i)}function Nm(n,e,t){return(n==="video"||n==="audio")&&e==="autoplay"}function q1(n,e,t){try{if(typeof e=="string"){if(n.classList.contains(e))return!0}else for(var i=n.classList.length;i--;){var r=n.classList[i];if(e.test(r))return!0}if(t)return n.matches(t)}catch{}return!1}function js(n,e,t){if(!n)return!1;if(n.nodeType!==n.ELEMENT_NODE)return t?js(Ct.parentNode(n),e,t):!1;for(var i=n.classList.length;i--;){var r=n.classList[i];if(e.test(r))return!0}return t?js(Ct.parentNode(n),e,t):!1}function Dm(n,e,t,i){var r;if(Tm(n)){if(r=n,!Ct.childNodes(r).length)return!1}else{if(Ct.parentElement(n)===null)return!1;r=Ct.parentElement(n)}try{if(typeof e=="string"){if(i){if(r.closest("."+e))return!0}else if(r.classList.contains(e))return!0}else if(js(r,e,i))return!0;if(t){if(i){if(r.closest(t))return!0}else if(r.matches(t))return!0}}catch{}return!1}function W1(n,e,t){var i=n.contentWindow;if(i){var r=!1,o;try{o=i.document.readyState}catch{return}if(o!=="complete"){var s=setTimeout(function(){r||(e(),r=!0)},t);n.addEventListener("load",function(){clearTimeout(s),r=!0,e()});return}var a="about:blank";if(i.location.href!==a||n.src===a||n.src==="")return setTimeout(e,0),n.addEventListener("load",e);n.addEventListener("load",e)}}function G1(n,e,t){var i=!1,r;try{r=n.sheet}catch{return}if(!r){var o=setTimeout(function(){i||(e(),i=!0)},t);n.addEventListener("load",function(){clearTimeout(o),i=!0,e()})}}function $1(n,e){var t=e.doc,i=e.mirror,r=e.blockClass,o=e.blockSelector,s=e.needsMask,a=e.inlineStylesheet,c=e.maskInputOptions,u=c===void 0?{}:c,l=e.maskTextFn,d=e.maskInputFn,h=e.dataURLOptions,p=h===void 0?{}:h,m=e.inlineImages,f=e.recordCanvas,g=e.keepIframeSrcFn,y=e.newlyAddedElement,b=y===void 0?!1:y,S=e.cssCaptured,w=S===void 0?!1:S,k=H1(t,i);switch(n.nodeType){case n.DOCUMENT_NODE:return n.compatMode!=="CSS1Compat"?{type:ct.Document,childNodes:[],compatMode:n.compatMode}:{type:ct.Document,childNodes:[]};case n.DOCUMENT_TYPE_NODE:return{type:ct.DocumentType,name:n.name,publicId:n.publicId,systemId:n.systemId,rootId:k};case n.ELEMENT_NODE:return Y1(n,{doc:t,blockClass:r,blockSelector:o,inlineStylesheet:a,maskInputOptions:u,maskInputFn:d,dataURLOptions:p,inlineImages:m,recordCanvas:f,keepIframeSrcFn:g,newlyAddedElement:b,rootId:k});case n.TEXT_NODE:return K1(n,{doc:t,needsMask:s,maskTextFn:l,rootId:k,cssCaptured:w});case n.CDATA_SECTION_NODE:return{type:ct.CDATA,textContent:"",rootId:k};case n.COMMENT_NODE:return{type:ct.Comment,textContent:Ct.textContent(n)||"",rootId:k};default:return!1}}function H1(n,e){if(e.hasNode(n)){var t=e.getId(n);return t===1?void 0:t}}function K1(n,e){var t=e.needsMask,i=e.maskTextFn,r=e.rootId,o=e.cssCaptured,s=Ct.parentNode(n),a=s&&s.tagName,c="",u=a==="STYLE"?!0:void 0,l=a==="SCRIPT"?!0:void 0;return l?c="SCRIPT_PLACEHOLDER":o||(c=Ct.textContent(n),u&&c&&(c=Fs(c,ol(e.doc)))),!u&&!l&&c&&t&&(c=i?i(c,Ct.parentElement(n)):c.replace(/[\S]/g,"*")),{type:ct.Text,textContent:c||"",rootId:r}}function Y1(n,e){for(var t=e.doc,i=e.blockClass,r=e.blockSelector,o=e.inlineStylesheet,s=e.maskInputOptions,a=s===void 0?{}:s,c=e.maskInputFn,u=e.dataURLOptions,l=u===void 0?{}:u,d=e.inlineImages,h=e.recordCanvas,p=e.keepIframeSrcFn,m=e.newlyAddedElement,f=m===void 0?!1:m,g=e.rootId,y=q1(n,i,r),b=F1(n),S={},w=n.attributes.length,k=0;k<w;k++){var C=n.attributes[k];Nm(b,C.name,C.value)||(S[C.name]=Mm(t,b,ji(C.name),C.value))}if(b==="link"&&o){var x=Array.from(t.styleSheets).find(function(Ne){return Ne.href===n.href}),I=null;x&&(I=tl(x)),I&&(delete S.rel,delete S.href,S._cssText=I)}if(b==="style"&&n.sheet){var P=tl(n.sheet);P&&(n.childNodes.length>1&&(P=D1(P,n)),S._cssText=P)}if(b==="input"||b==="textarea"||b==="select"){var D=n.value,O=n.checked;S.type!=="radio"&&S.type!=="checkbox"&&S.type!=="submit"&&S.type!=="button"&&D?S.value=nl({element:n,type:il(n),tagName:b,value:D,maskInputOptions:a,maskInputFn:c}):O&&(S.checked=O)}if(b==="option"&&(n.selected&&!a.select?S.selected=!0:delete S.selected),b==="dialog"&&n.open&&(S.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal"),b==="canvas"&&h){if(n.__context==="2d")I1(n)||(S.rr_dataURL=n.toDataURL(l.type,l.quality));else if(!("__context"in n)){var L=n.toDataURL(l.type,l.quality),j=t.createElement("canvas");j.width=n.width,j.height=n.height;var X=j.toDataURL(l.type,l.quality);L!==X&&(S.rr_dataURL=L)}}if(b==="img"&&d){_r||(_r=t.createElement("canvas"),Om=_r.getContext("2d"));var W=n,A=W.currentSrc||W.getAttribute("src")||"<unknown-src>",H=W.crossOrigin,Y=function(){W.removeEventListener("load",Y);try{_r.width=W.naturalWidth,_r.height=W.naturalHeight,Om.drawImage(W,0,0),S.rr_dataURL=_r.toDataURL(l.type,l.quality)}catch(Ne){if(W.crossOrigin!=="anonymous"){W.crossOrigin="anonymous",W.complete&&W.naturalWidth!==0?Y():W.addEventListener("load",Y);return}else console.warn("Cannot inline img src="+A+"! Error: "+Ne)}W.crossOrigin==="anonymous"&&(H?S.crossOrigin=H:W.removeAttribute("crossorigin"))};W.complete&&W.naturalWidth!==0?Y():W.addEventListener("load",Y)}if(b==="audio"||b==="video"){var J=S;J.rr_mediaState=n.paused?"paused":"played",J.rr_mediaCurrentTime=n.currentTime,J.rr_mediaPlaybackRate=n.playbackRate,J.rr_mediaMuted=n.muted,J.rr_mediaLoop=n.loop,J.rr_mediaVolume=n.volume}if(f||(n.scrollLeft&&(S.rr_scrollLeft=n.scrollLeft),n.scrollTop&&(S.rr_scrollTop=n.scrollTop)),y){var ve=n.getBoundingClientRect(),Me=ve.width,Ie=ve.height;S={class:S.class,rr_width:""+Me+"px",rr_height:""+Ie+"px"}}b==="iframe"&&!p(S.src)&&(n.contentDocument||(S.rr_src=S.src),delete S.src);var dt;try{customElements.get(b)&&(dt=!0)}catch{}return{type:ct.Element,tagName:b,attributes:S,childNodes:[],isSVG:z1(n)||void 0,needBlock:y,rootId:g,isCustom:dt}}function De(n){return n==null?"":n.toLowerCase()}function X1(n,e){return!!(e.comment&&n.type===ct.Comment||n.type===ct.Element&&(e.script&&(n.tagName==="script"||n.tagName==="link"&&(n.attributes.rel==="preload"||n.attributes.rel==="modulepreload")&&n.attributes.as==="script"||n.tagName==="link"&&n.attributes.rel==="prefetch"&&typeof n.attributes.href=="string"&&Rm(n.attributes.href)==="js")||e.headFavicon&&(n.tagName==="link"&&n.attributes.rel==="shortcut icon"||n.tagName==="meta"&&(De(n.attributes.name).match(/^msapplication-tile(image|color)$/)||De(n.attributes.name)==="application-name"||De(n.attributes.rel)==="icon"||De(n.attributes.rel)==="apple-touch-icon"||De(n.attributes.rel)==="shortcut icon"))||n.tagName==="meta"&&(e.headMetaDescKeywords&&De(n.attributes.name).match(/^description|keywords$/)||e.headMetaSocial&&(De(n.attributes.property).match(/^(og|twitter|fb):/)||De(n.attributes.name).match(/^(og|twitter):/)||De(n.attributes.name)==="pinterest")||e.headMetaRobots&&(De(n.attributes.name)==="robots"||De(n.attributes.name)==="googlebot"||De(n.attributes.name)==="bingbot")||e.headMetaHttpEquiv&&n.attributes["http-equiv"]!==void 0||e.headMetaAuthorship&&(De(n.attributes.name)==="author"||De(n.attributes.name)==="generator"||De(n.attributes.name)==="framework"||De(n.attributes.name)==="publisher"||De(n.attributes.name)==="progid"||De(n.attributes.property).match(/^article:/)||De(n.attributes.property).match(/^product:/))||e.headMetaVerification&&(De(n.attributes.name)==="google-site-verification"||De(n.attributes.name)==="yandex-verification"||De(n.attributes.name)==="csrf-token"||De(n.attributes.name)==="p:domain_verify"||De(n.attributes.name)==="verify-v1"||De(n.attributes.name)==="verification"||De(n.attributes.name)==="shopify-checkout-api-token"))))}function kr(n,e){var t=e.doc,i=e.mirror,r=e.blockClass,o=e.blockSelector,s=e.maskTextClass,a=e.maskTextSelector,c=e.skipChild,u=c===void 0?!1:c,l=e.inlineStylesheet,d=l===void 0?!0:l,h=e.maskInputOptions,p=h===void 0?{}:h,m=e.maskTextFn,f=e.maskInputFn,g=e.slimDOMOptions,y=e.dataURLOptions,b=y===void 0?{}:y,S=e.inlineImages,w=S===void 0?!1:S,k=e.recordCanvas,C=k===void 0?!1:k,x=e.onSerialize,I=e.onIframeLoad,P=e.iframeLoadTimeout,D=P===void 0?5e3:P,O=e.onStylesheetLoad,L=e.stylesheetLoadTimeout,j=L===void 0?5e3:L,X=e.keepIframeSrcFn,W=X===void 0?function(){return!1}:X,A=e.newlyAddedElement,H=A===void 0?!1:A,Y=e.cssCaptured,J=Y===void 0?!1:Y,ve=e.needsMask,Me=e.preserveWhiteSpace,Ie=Me===void 0?!0:Me;if(!ve){var dt=ve===void 0;ve=Dm(n,s,a,dt)}var Ne=$1(n,{doc:t,mirror:i,blockClass:r,blockSelector:o,needsMask:ve,inlineStylesheet:d,maskInputOptions:p,maskTextFn:m,maskInputFn:f,dataURLOptions:b,inlineImages:w,recordCanvas:C,keepIframeSrcFn:W,newlyAddedElement:H,cssCaptured:J});if(!Ne)return console.warn(n,"not serialized"),null;var Pe;i.hasNode(n)?Pe=i.getId(n):X1(Ne,g)||!Ie&&Ne.type===ct.Text&&!Ne.textContent.replace(/^\s+|\s+$/gm,"").length?Pe=Co:Pe=Pm();var ie=Object.assign(Ne,{id:Pe});if(i.add(n,ie),Pe===Co)return null;x&&x(n);var Ze=!u;if(ie.type===ct.Element){Ze=Ze&&!ie.needBlock,delete ie.needBlock;var kt=Ct.shadowRoot(n);kt&&wo(kt)&&(ie.isShadowHost=!0)}if((ie.type===ct.Document||ie.type===ct.Element)&&Ze){g.headWhitespace&&ie.type===ct.Element&&ie.tagName==="head"&&(Ie=!1);var Gt={doc:t,mirror:i,blockClass:r,blockSelector:o,needsMask:ve,maskTextClass:s,maskTextSelector:a,skipChild:u,inlineStylesheet:d,maskInputOptions:p,maskTextFn:m,maskInputFn:f,slimDOMOptions:g,dataURLOptions:b,inlineImages:w,recordCanvas:C,preserveWhiteSpace:Ie,onSerialize:x,onIframeLoad:I,iframeLoadTimeout:D,onStylesheetLoad:O,stylesheetLoadTimeout:j,keepIframeSrcFn:W,cssCaptured:!1};if(!(ie.type===ct.Element&&ie.tagName==="textarea"&&ie.attributes.value!==void 0)){ie.type===ct.Element&&ie.attributes._cssText!==void 0&&typeof ie.attributes._cssText=="string"&&(Gt.cssCaptured=!0);for(var ur=K(Array.from(Ct.childNodes(n))),ye;!(ye=ur()).done;){var Nt=ye.value,lr=kr(Nt,Gt);lr&&ie.childNodes.push(lr)}}var yn=null;if(Tm(n)&&(yn=Ct.shadowRoot(n)))for(var Dn=K(Array.from(Ct.childNodes(yn))),Zn;!(Zn=Dn()).done;){var Li=Zn.value,fo=kr(Li,Gt);fo&&(wo(yn)&&(fo.isShadow=!0),ie.childNodes.push(fo))}}var dr=Ct.parentNode(n);return dr&&So(dr)&&wo(dr)&&(ie.isShadow=!0),ie.type===ct.Element&&ie.tagName==="iframe"&&W1(n,function(){var Qn=n.contentDocument;if(Qn&&I){var hr=kr(Qn,{doc:Qn,mirror:i,blockClass:r,blockSelector:o,needsMask:ve,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:m,maskInputFn:f,slimDOMOptions:g,dataURLOptions:b,inlineImages:w,recordCanvas:C,preserveWhiteSpace:Ie,onSerialize:x,onIframeLoad:I,iframeLoadTimeout:D,onStylesheetLoad:O,stylesheetLoadTimeout:j,keepIframeSrcFn:W});hr&&I(n,hr)}},D),ie.type===ct.Element&&ie.tagName==="link"&&typeof ie.attributes.rel=="string"&&(ie.attributes.rel==="stylesheet"||ie.attributes.rel==="preload"&&typeof ie.attributes.href=="string"&&Rm(ie.attributes.href)==="css")&&G1(n,function(){if(O){var Qn=kr(n,{doc:t,mirror:i,blockClass:r,blockSelector:o,needsMask:ve,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:m,maskInputFn:f,slimDOMOptions:g,dataURLOptions:b,inlineImages:w,recordCanvas:C,preserveWhiteSpace:Ie,onSerialize:x,onIframeLoad:I,iframeLoadTimeout:D,onStylesheetLoad:O,stylesheetLoadTimeout:j,keepIframeSrcFn:W});Qn&&O(n,Qn)}},j),ie}function J1(n,e){var t=e||{},i=t.mirror,r=i===void 0?new Em:i,o=t.blockClass,s=o===void 0?"rr-block":o,a=t.blockSelector,c=a===void 0?null:a,u=t.maskTextClass,l=u===void 0?"rr-mask":u,d=t.maskTextSelector,h=d===void 0?null:d,p=t.inlineStylesheet,m=p===void 0?!0:p,f=t.inlineImages,g=f===void 0?!1:f,y=t.recordCanvas,b=y===void 0?!1:y,S=t.maskAllInputs,w=S===void 0?!1:S,k=t.maskTextFn,C=t.maskInputFn,x=t.slimDOM,I=x===void 0?!1:x,P=t.dataURLOptions,D=t.preserveWhiteSpace,O=t.onSerialize,L=t.onIframeLoad,j=t.iframeLoadTimeout,X=t.onStylesheetLoad,W=t.stylesheetLoadTimeout,A=t.keepIframeSrcFn,H=A===void 0?function(){return!1}:A,Y=w===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:w===!1?{password:!0}:w,J=I===!0||I==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:I==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:I===!1?{}:I;return kr(n,{doc:n,mirror:r,blockClass:s,blockSelector:c,maskTextClass:l,maskTextSelector:h,skipChild:!1,inlineStylesheet:m,maskInputOptions:Y,maskTextFn:k,maskInputFn:C,slimDOMOptions:J,dataURLOptions:P,inlineImages:g,recordCanvas:b,preserveWhiteSpace:D,onSerialize:O,onIframeLoad:L,iframeLoadTimeout:j,onStylesheetLoad:X,stylesheetLoadTimeout:W,keepIframeSrcFn:H,newlyAddedElement:!1})}function Z1(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Q1(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function i(){return ne(this,i)?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(i){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}),t}var sl={exports:{}},Le=String,Lm=function(){return{isColorSupported:!1,reset:Le,bold:Le,dim:Le,italic:Le,underline:Le,inverse:Le,hidden:Le,strikethrough:Le,black:Le,red:Le,green:Le,yellow:Le,blue:Le,magenta:Le,cyan:Le,white:Le,gray:Le,bgBlack:Le,bgRed:Le,bgGreen:Le,bgYellow:Le,bgBlue:Le,bgMagenta:Le,bgCyan:Le,bgWhite:Le}};sl.exports=Lm(),sl.exports.createColors=Lm;var eT=sl.exports,tT={},nT=Object.freeze(Object.defineProperty({__proto__:null,default:tT},Symbol.toStringTag,{value:"Module"})),et=Q1(nT),Um=eT,Fm=et,al=function(n){wt(e,n);function e(i,r,o,s,a,c){var u;return u=n.call(this,i)||this,u.name="CssSyntaxError",u.reason=i,a&&(u.file=a),s&&(u.source=s),c&&(u.plugin=c),typeof r<"u"&&typeof o<"u"&&(typeof r=="number"?(u.line=r,u.column=o):(u.line=r.line,u.column=r.column,u.endLine=o.line,u.endColumn=o.column)),u.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(u,e),u}var t=e.prototype;return t.setMessage=function(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason},t.showSourceCode=function(i){var r=this;if(!this.source)return"";var o=this.source;i==null&&(i=Um.isColorSupported),Fm&&i&&(o=Fm(o));var s=o.split(/\r?\n/),a=Math.max(this.line-3,0),c=Math.min(this.line+2,s.length),u=String(c).length,l,d;if(i){var h=Um.createColors(!0),p=h.bold,m=h.gray,f=h.red;l=function(g){return p(f(g))},d=function(g){return m(g)}}else l=d=function(g){return g};return s.slice(a,c).map(function(g,y){var b=a+1+y,S=" "+(" "+b).slice(-u)+" | ";if(b===r.line){var w=d(S.replace(/\d/g," "))+g.slice(0,r.column-1).replace(/[^\t]/g," ");return l(">")+d(S)+g+`
14
14
  `+w+l("^")}return" "+d(S)+g}).join(`
15
15
  `)},t.toString=function(){var i=this.showSourceCode();return i&&(i=`
@@ -70,13 +70,13 @@ You tried to parse Less with the standard CSS parser; try again with the postcss
70
70
  https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(n+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
71
71
  https://www.w3ctech.com/topic/2226`));var c=e.apply(void 0,[].concat(s));return c.postcssPlugin=n,c.postcssVersion=new ud().version,c}var r;return Object.defineProperty(i,"postcss",{get:function(){return r||(r=i()),r}}),i.process=function(o,s,a){return xe([i(a)]).process(o,s)},i},xe.stringify=TI,xe.parse=PI,xe.fromJSON=xI,xe.list=OI,xe.comment=function(n){return new xv(n)},xe.atRule=function(n){return new Ev(n)},xe.decl=function(n){return new Cv(n)},xe.rule=function(n){return new Iv(n)},xe.root=function(n){return new Rv(n)},xe.document=function(n){return new Tv(n)},xe.CssSyntaxError=SI,xe.Declaration=Cv,xe.Container=CI,xe.Processor=ud,xe.Document=Tv,xe.Comment=xv,xe.Warning=EI,xe.AtRule=Ev,xe.Result=II,xe.Input=RI,xe.Rule=Iv,xe.Root=Rv,xe.Node=AI,wI.registerPostcss(xe);var MI=xe;xe.default=xe;var qe=Wx(MI);qe.stringify,qe.fromJSON,qe.plugin,qe.parse,qe.list,qe.document,qe.comment,qe.atRule,qe.rule,qe.decl,qe.root,qe.CssSyntaxError,qe.Declaration,qe.Container,qe.Processor,qe.Document,qe.Comment,qe.Warning,qe.AtRule,qe.Result,qe.Input,qe.Rule,qe.Root,qe.Node;var NI=function(){function n(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];Ht(this,"parentElement",null),Ht(this,"parentNode",null),Ht(this,"ownerDocument"),Ht(this,"firstChild",null),Ht(this,"lastChild",null),Ht(this,"previousSibling",null),Ht(this,"nextSibling",null),Ht(this,"ELEMENT_NODE",1),Ht(this,"TEXT_NODE",3),Ht(this,"nodeType"),Ht(this,"nodeName"),Ht(this,"RRNodeType")}var e=n.prototype;return e.contains=function(t){if(ne(t,n)){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1},e.appendChild=function(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")},e.insertBefore=function(t,i){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")},e.removeChild=function(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")},e.toString=function(){return"RRNode"},mt(n,[{key:"childNodes",get:function(){for(var t=[],i=this.firstChild;i;)t.push(i),i=i.nextSibling;return t}}]),n}(),Pv={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Ov={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ea={},DI=function(){return!!globalThis.Zone};function ld(n){if(Ea[n])return Ea[n];var e=globalThis[n],t=e.prototype,i=n in Pv?Pv[n]:void 0,r=!!(i&&i.every(function(l){var d,h;return!!((h=(d=Object.getOwnPropertyDescriptor(t,l))==null?void 0:d.get)!=null&&h.toString().includes("[native code]"))})),o=n in Ov?Ov[n]:void 0,s=!!(o&&o.every(function(l){var d;return typeof t[l]=="function"&&((d=t[l])==null?void 0:d.toString().includes("[native code]"))}));if(r&&s&&!DI())return Ea[n]=e.prototype,e.prototype;try{var a=document.createElement("iframe");document.body.appendChild(a);var c=a.contentWindow;if(!c)return e.prototype;var u=c[n].prototype;return document.body.removeChild(a),u?Ea[n]=u:t}catch{return t}}var dd={};function ri(n,e,t){var i,r=n+"."+String(t);if(dd[r])return dd[r].call(e);var o=ld(n),s=(i=Object.getOwnPropertyDescriptor(o,t))==null?void 0:i.get;return s?(dd[r]=s,s.call(e)):e[t]}var hd={};function Av(n,e,t){var i=n+"."+String(t);if(hd[i])return hd[i].bind(e);var r=ld(n),o=r[t];return typeof o!="function"?e[t]:(hd[i]=o,o.bind(e))}function LI(n){return ri("Node",n,"childNodes")}function UI(n){return ri("Node",n,"parentNode")}function FI(n){return ri("Node",n,"parentElement")}function BI(n){return ri("Node",n,"textContent")}function jI(n,e){return Av("Node",n,"contains")(e)}function VI(n){return Av("Node",n,"getRootNode")()}function zI(n){return!n||!("host"in n)?null:ri("ShadowRoot",n,"host")}function qI(n){return n.styleSheets}function WI(n){return!n||!("shadowRoot"in n)?null:ri("Element",n,"shadowRoot")}function GI(n,e){return ri("Element",n,"querySelector")(e)}function $I(n,e){return ri("Element",n,"querySelectorAll")(e)}function Mv(){return ld("MutationObserver").constructor}var se={childNodes:LI,parentNode:UI,parentElement:FI,textContent:BI,contains:jI,getRootNode:VI,host:zI,styleSheets:qI,shadowRoot:WI,querySelector:GI,querySelectorAll:$I,mutationObserver:Mv};function It(n,e,t){t===void 0&&(t=document);var i={capture:!0,passive:!0};return t.addEventListener(n,e,i),function(){return t.removeEventListener(n,e,i)}}var Ir=`Please stop import mirror directly. Instead of that,\r
72
72
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
73
- or you can use record.mirror to access the mirror instance during recording.`,Nv={map:{},getId:function(){return console.error(Ir),-1},getNode:function(){return console.error(Ir),null},removeNodeFromMap:function(){console.error(Ir)},has:function(){return console.error(Ir),!1},reset:function(){console.error(Ir)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Nv=new Proxy(Nv,{get:function(n,e,t){return e==="map"&&console.error(Ir),Reflect.get(n,e,t)}}));function Bo(n,e,t){t===void 0&&(t={});var i=null,r=0;return function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];var c=Date.now();!r&&t.leading===!1&&(r=c);var u=e-(c-r),l=this;u<=0||u>e?(i&&(clearTimeout(i),i=null),r=c,n.apply(l,s)):!i&&t.trailing!==!1&&(i=setTimeout(function(){r=t.leading===!1?0:Date.now(),i=null,n.apply(l,s)},u))}}function Ia(n,e,t,i,r){r===void 0&&(r=window);var o=r.Object.getOwnPropertyDescriptor(n,e);return r.Object.defineProperty(n,e,i?t:{set:function(s){var a=this;setTimeout(function(){t.set.call(a,s)},0),o&&o.set&&o.set.call(this,s)}}),function(){return Ia(n,e,o||{},!0)}}function Rr(n,e,t){try{if(!(e in n))return function(){};var i=n[e],r=t(i);return typeof r=="function"&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:i}})),n[e]=r,function(){n[e]=i}}catch{return function(){}}}var Ra=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ra=function(){return new Date().getTime()});function Dv(n){var e,t,i,r,o=n.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:o.documentElement.scrollLeft||(o==null?void 0:o.body)&&((e=se.parentElement(o.body))==null?void 0:e.scrollLeft)||((t=o==null?void 0:o.body)==null?void 0:t.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(o==null?void 0:o.documentElement.scrollTop)||(o==null?void 0:o.body)&&((i=se.parentElement(o.body))==null?void 0:i.scrollTop)||((r=o==null?void 0:o.body)==null?void 0:r.scrollTop)||0}}function Lv(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Uv(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Fv(n){if(!n)return null;var e=n.nodeType===n.ELEMENT_NODE?n:se.parentElement(n);return e}function Rt(n,e,t,i){if(!n)return!1;var r=Fv(n);if(!r)return!1;try{if(typeof e=="string"){if(r.classList.contains(e)||i&&r.closest("."+e)!==null)return!0}else if(js(r,e,i))return!0}catch{}return!!(t&&(r.matches(t)||i&&r.closest(t)!==null))}function HI(n,e){return e.getId(n)!==-1}function pd(n,e,t){return n.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(n)===Co}function Bv(n,e){if(So(n))return!1;var t=e.getId(n);if(!e.has(t))return!0;var i=se.parentNode(n);return i&&i.nodeType===n.DOCUMENT_NODE?!1:i?Bv(i,e):!0}function fd(n){return!!n.changedTouches}function KI(n){n===void 0&&(n=window),"NodeList"in n&&!n.NodeList.prototype.forEach&&(n.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in n&&!n.DOMTokenList.prototype.forEach&&(n.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function jv(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function Vv(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function md(n){return n?ne(n,NI)&&"shadowRoot"in n?!!n.shadowRoot:!!se.shadowRoot(n):!1}var YI=function(){function n(){V(this,"id",1),V(this,"styleIDMap",new WeakMap),V(this,"idStyleMap",new Map)}var e=n.prototype;return e.getId=function(t){var i;return(i=this.styleIDMap.get(t))!=null?i:-1},e.has=function(t){return this.styleIDMap.has(t)},e.add=function(t,i){if(this.has(t))return this.getId(t);var r;return i===void 0?r=this.id++:r=i,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r},e.getStyle=function(t){return this.idStyleMap.get(t)||null},e.reset=function(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1},e.generateId=function(){return this.id++},n}();function zv(n){var e,t=null;return"getRootNode"in n&&((e=se.getRootNode(n))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&se.host(se.getRootNode(n))&&(t=se.host(se.getRootNode(n))),t}function XI(n){for(var e=n,t;t=zv(e);)e=t;return e}function JI(n){var e=n.ownerDocument;if(!e)return!1;var t=XI(n);return se.contains(e,t)}function qv(n){var e=n.ownerDocument;return e?se.contains(e,n)||JI(n):!1}var ce=function(n){return n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n}(ce||{}),Q=function(n){return n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n}(Q||{}),Ut=function(n){return n[n.MouseUp=0]="MouseUp",n[n.MouseDown=1]="MouseDown",n[n.Click=2]="Click",n[n.ContextMenu=3]="ContextMenu",n[n.DblClick=4]="DblClick",n[n.Focus=5]="Focus",n[n.Blur=6]="Blur",n[n.TouchStart=7]="TouchStart",n[n.TouchMove_Departed=8]="TouchMove_Departed",n[n.TouchEnd=9]="TouchEnd",n[n.TouchCancel=10]="TouchCancel",n}(Ut||{}),jn=function(n){return n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n}(jn||{}),Pr=function(n){return n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n}(Pr||{}),Or=function(n){return n[n.Play=0]="Play",n[n.Pause=1]="Pause",n[n.Seeked=2]="Seeked",n[n.VolumeChange=3]="VolumeChange",n[n.RateChange=4]="RateChange",n}(Or||{}),Wv=function(n){return n[n.Document=0]="Document",n[n.DocumentType=1]="DocumentType",n[n.Element=2]="Element",n[n.Text=3]="Text",n[n.CDATA=4]="CDATA",n[n.Comment=5]="Comment",n}(Wv||{});function Gv(n){return"__ln"in n}var ZI=function(){function n(){V(this,"length",0),V(this,"head",null),V(this,"tail",null)}var e=n.prototype;return e.get=function(t){if(t>=this.length)throw new Error("Position outside of list range");for(var i=this.head,r=0;r<t;r++)i=(i==null?void 0:i.next)||null;return i},e.addNode=function(t){var i={value:t,previous:null,next:null};if(t.__ln=i,t.previousSibling&&Gv(t.previousSibling)){var r=t.previousSibling.__ln.next;i.next=r,i.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=i,r&&(r.previous=i)}else if(t.nextSibling&&Gv(t.nextSibling)&&t.nextSibling.__ln.previous){var o=t.nextSibling.__ln.previous;i.previous=o,i.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=i,o&&(o.next=i)}else this.head&&(this.head.previous=i),i.next=this.head,this.head=i;i.next===null&&(this.tail=i),this.length++},e.removeNode=function(t){var i=t.__ln;this.head&&(i.previous?(i.previous.next=i.next,i.next?i.next.previous=i.previous:this.tail=i.previous):(this.head=i.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)},n}(),$v=function(n,e){return n+"@"+e},QI=function(){function n(){var t=this;V(this,"frozen",!1),V(this,"locked",!1),V(this,"texts",[]),V(this,"attributes",[]),V(this,"attributeMap",new WeakMap),V(this,"removes",[]),V(this,"mapRemoves",[]),V(this,"movedMap",{}),V(this,"addedSet",new Set),V(this,"movedSet",new Set),V(this,"droppedSet",new Set),V(this,"removesSubTreeCache",new Set),V(this,"mutationCb"),V(this,"blockClass"),V(this,"blockSelector"),V(this,"maskTextClass"),V(this,"maskTextSelector"),V(this,"inlineStylesheet"),V(this,"maskInputOptions"),V(this,"maskTextFn"),V(this,"maskInputFn"),V(this,"keepIframeSrcFn"),V(this,"recordCanvas"),V(this,"inlineImages"),V(this,"slimDOMOptions"),V(this,"dataURLOptions"),V(this,"doc"),V(this,"mirror"),V(this,"iframeManager"),V(this,"stylesheetManager"),V(this,"shadowDomManager"),V(this,"canvasManager"),V(this,"processedNodeManager"),V(this,"unattachedDoc"),V(this,"processMutations",function(i){i.forEach(t.processMutation),t.emit()}),V(this,"emit",function(){if(!(t.frozen||t.locked)){for(var i=[],r=new Set,o=new ZI,s=function(O){for(var L=O,j=Co;j===Co;)L=L&&L.nextSibling,j=L&&t.mirror.getId(L);return j},a=function(O){var L=se.parentNode(O);if(!(!L||!qv(O))){var j=!1;if(O.nodeType===Node.TEXT_NODE){var X=L.tagName;if(X==="TEXTAREA")return;X==="STYLE"&&t.addedSet.has(L)&&(j=!0)}var W=So(L)?t.mirror.getId(zv(O)):t.mirror.getId(L),A=s(O);if(W===-1||A===-1)return o.addNode(O);var H=kr(O,{doc:t.doc,mirror:t.mirror,blockClass:t.blockClass,blockSelector:t.blockSelector,maskTextClass:t.maskTextClass,maskTextSelector:t.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:t.inlineStylesheet,maskInputOptions:t.maskInputOptions,maskTextFn:t.maskTextFn,maskInputFn:t.maskInputFn,slimDOMOptions:t.slimDOMOptions,dataURLOptions:t.dataURLOptions,recordCanvas:t.recordCanvas,inlineImages:t.inlineImages,onSerialize:function(Y){jv(Y,t.mirror)&&t.iframeManager.addIframe(Y),Vv(Y,t.mirror)&&t.stylesheetManager.trackLinkElement(Y),md(O)&&t.shadowDomManager.addShadowRoot(se.shadowRoot(O),t.doc)},onIframeLoad:function(Y,J){t.iframeManager.attachIframe(Y,J),t.shadowDomManager.observeAttachShadow(Y)},onStylesheetLoad:function(Y,J){t.stylesheetManager.attachLinkElement(Y,J)},cssCaptured:j});H&&(i.push({parentId:W,nextId:A,node:H}),r.add(H.id))}};t.mapRemoves.length;)t.mirror.removeNodeFromMap(t.mapRemoves.shift());for(var c=K(t.movedSet),u;!(u=c()).done;){var l=u.value;Hv(t.removesSubTreeCache,l,t.mirror)&&!t.movedSet.has(se.parentNode(l))||a(l)}for(var d=K(t.addedSet),h;!(h=d()).done;){var p=h.value;!Kv(t.droppedSet,p)&&!Hv(t.removesSubTreeCache,p,t.mirror)||Kv(t.movedSet,p)?a(p):t.droppedSet.add(p)}for(var m=null;o.length;){var f=null;if(m){var g=t.mirror.getId(se.parentNode(m.value)),y=s(m.value);g!==-1&&y!==-1&&(f=m)}if(!f)for(var b=o.tail;b;){var S=b;if(b=b.previous,S){var w=t.mirror.getId(se.parentNode(S.value)),k=s(S.value);if(k===-1)continue;if(w!==-1){f=S;break}else{var C=S.value,x=se.parentNode(C);if(x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var I=se.host(x),P=t.mirror.getId(I);if(P!==-1){f=S;break}}}}}if(!f){for(;o.head;)o.removeNode(o.head.value);break}m=f.previous,o.removeNode(f.value),a(f.value)}var D={texts:t.texts.map(function(O){var L=O.node,j=se.parentNode(L);return j&&j.tagName==="TEXTAREA"&&t.genTextAreaValueMutation(j),{id:t.mirror.getId(L),value:O.value}}).filter(function(O){return!r.has(O.id)}).filter(function(O){return t.mirror.has(O.id)}),attributes:t.attributes.map(function(O){var L=O.attributes;if(typeof L.style=="string"){var j=JSON.stringify(O.styleDiff),X=JSON.stringify(O._unchangedStyles);j.length<L.style.length&&(j+X).split("var(").length===L.style.split("var(").length&&(L.style=O.styleDiff)}return{id:t.mirror.getId(O.node),attributes:L}}).filter(function(O){return!r.has(O.id)}).filter(function(O){return t.mirror.has(O.id)}),removes:t.removes,adds:i};!D.texts.length&&!D.attributes.length&&!D.removes.length&&!D.adds.length||(t.texts=[],t.attributes=[],t.attributeMap=new WeakMap,t.removes=[],t.addedSet=new Set,t.movedSet=new Set,t.droppedSet=new Set,t.removesSubTreeCache=new Set,t.movedMap={},t.mutationCb(D))}}),V(this,"genTextAreaValueMutation",function(i){var r=t.attributeMap.get(i);r||(r={node:i,attributes:{},styleDiff:{},_unchangedStyles:{}},t.attributes.push(r),t.attributeMap.set(i,r)),r.attributes.value=Array.from(se.childNodes(i),function(o){return se.textContent(o)||""}).join("")}),V(this,"processMutation",function(i){if(!pd(i.target,t.mirror,t.slimDOMOptions))switch(i.type){case"characterData":{var r=se.textContent(i.target);!Rt(i.target,t.blockClass,t.blockSelector,!1)&&r!==i.oldValue&&t.texts.push({value:Dm(i.target,t.maskTextClass,t.maskTextSelector,!0)&&r?t.maskTextFn?t.maskTextFn(r,Fv(i.target)):r.replace(/[\S]/g,"*"):r,node:i.target});break}case"attributes":{var o=i.target,s=i.attributeName,a=i.target.getAttribute(s);if(s==="value"){var c=il(o);a=nl({element:o,maskInputOptions:t.maskInputOptions,tagName:o.tagName,type:c,value:a,maskInputFn:t.maskInputFn})}if(Rt(i.target,t.blockClass,t.blockSelector,!1)||a===i.oldValue)return;var u=t.attributeMap.get(i.target);if(o.tagName==="IFRAME"&&s==="src"&&!t.keepIframeSrcFn(a))if(!o.contentDocument)s="rr_src";else return;if(u||(u={node:i.target,attributes:{},styleDiff:{},_unchangedStyles:{}},t.attributes.push(u),t.attributeMap.set(i.target,u)),s==="type"&&o.tagName==="INPUT"&&(i.oldValue||"").toLowerCase()==="password"&&o.setAttribute("data-rr-is-password","true"),!Nm(o.tagName,s))if(u.attributes[s]=Mm(t.doc,ji(o.tagName),ji(s),a),s==="style"){if(!t.unattachedDoc)try{t.unattachedDoc=document.implementation.createHTMLDocument()}catch{t.unattachedDoc=t.doc}var l=t.unattachedDoc.createElement("span");i.oldValue&&l.setAttribute("style",i.oldValue);for(var d=K(Array.from(o.style)),h;!(h=d()).done;){var p=h.value,m=o.style.getPropertyValue(p),f=o.style.getPropertyPriority(p);m!==l.style.getPropertyValue(p)||f!==l.style.getPropertyPriority(p)?f===""?u.styleDiff[p]=m:u.styleDiff[p]=[m,f]:u._unchangedStyles[p]=[m,f]}for(var g=K(Array.from(l.style)),y;!(y=g()).done;){var b=y.value;o.style.getPropertyValue(b)===""&&(u.styleDiff[b]=!1)}}else s==="open"&&o.tagName==="DIALOG"&&(o.matches("dialog:modal")?u.attributes.rr_open_mode="modal":u.attributes.rr_open_mode="non-modal");break}case"childList":{if(Rt(i.target,t.blockClass,t.blockSelector,!0))return;if(i.target.tagName==="TEXTAREA"){t.genTextAreaValueMutation(i.target);return}i.addedNodes.forEach(function(S){return t.genAdds(S,i.target)}),i.removedNodes.forEach(function(S){var w=t.mirror.getId(S),k=So(i.target)?t.mirror.getId(se.host(i.target)):t.mirror.getId(i.target);Rt(i.target,t.blockClass,t.blockSelector,!1)||pd(S,t.mirror,t.slimDOMOptions)||!HI(S,t.mirror)||(t.addedSet.has(S)?(gd(t.addedSet,S),t.droppedSet.add(S)):t.addedSet.has(i.target)&&w===-1||Bv(i.target,t.mirror)||(t.movedSet.has(S)&&t.movedMap[$v(w,k)]?gd(t.movedSet,S):(t.removes.push({parentId:k,id:w,isShadow:So(i.target)&&wo(i.target)?!0:void 0}),eR(S,t.removesSubTreeCache))),t.mapRemoves.push(S))});break}}}),V(this,"genAdds",function(i,r){if(!t.processedNodeManager.inOtherBuffer(i,t)&&!(t.addedSet.has(i)||t.movedSet.has(i))){if(t.mirror.hasNode(i)){if(pd(i,t.mirror,t.slimDOMOptions))return;t.movedSet.add(i);var o=null;r&&t.mirror.hasNode(r)&&(o=t.mirror.getId(r)),o&&o!==-1&&(t.movedMap[$v(t.mirror.getId(i),o)]=!0)}else t.addedSet.add(i),t.droppedSet.delete(i);Rt(i,t.blockClass,t.blockSelector,!1)||(se.childNodes(i).forEach(function(s){return t.genAdds(s)}),md(i)&&se.childNodes(se.shadowRoot(i)).forEach(function(s){t.processedNodeManager.add(s,t),t.genAdds(s,i)}))}})}var e=n.prototype;return e.init=function(t){var i=this;["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(function(r){i[r]=t[r]})},e.freeze=function(){this.frozen=!0,this.canvasManager.freeze()},e.unfreeze=function(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()},e.isFrozen=function(){return this.frozen},e.lock=function(){this.locked=!0,this.canvasManager.lock()},e.unlock=function(){this.locked=!1,this.canvasManager.unlock(),this.emit()},e.reset=function(){this.shadowDomManager.reset(),this.canvasManager.reset()},n}();function gd(n,e){n.delete(e),se.childNodes(e).forEach(function(t){return gd(n,t)})}function eR(n,e){for(var t=[n];t.length;){var i=t.pop();e.has(i)||(e.add(i),se.childNodes(i).forEach(function(r){return t.push(r)}))}}function Hv(n,e,t){return n.size===0?!1:tR(n,e)}function tR(n,e,t){var i=se.parentNode(e);return i?n.has(i):!1}function Kv(n,e){return n.size===0?!1:Yv(n,e)}function Yv(n,e){var t=se.parentNode(e);return t?n.has(t)?!0:Yv(n,t):!1}var jo;function nR(n){jo=n}function iR(){jo=void 0}var he=function(n){if(!jo)return n;var e=function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];try{return n.apply(void 0,[].concat(i))}catch(o){if(jo&&jo(o)===!0)return;throw o}};return e},qi=[];function Vo(n){try{if("composedPath"in n){var e=n.composedPath();if(e.length)return e[0]}else if("path"in n&&n.path.length)return n.path[0]}catch{}return n&&n.target}function Xv(n,e){var t=new QI;qi.push(t),t.init(n);var i=new(Mv())(he(t.processMutations.bind(t)));return i.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function rR(n){var e=n.mousemoveCb,t=n.sampling,i=n.doc,r=n.mirror;if(t.mousemove===!1)return function(){};var o=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],c,u=Bo(he(function(h){var p=Date.now()-c;e(a.map(function(m){return m.timeOffset-=p,m}),h),a=[],c=null}),s),l=he(Bo(he(function(h){var p=Vo(h),m=fd(h)?h.changedTouches[0]:h,f=m.clientX,g=m.clientY;c||(c=Ra()),a.push({x:f,y:g,id:r.getId(p),timeOffset:Ra()-c}),u(typeof DragEvent<"u"&&ne(h,DragEvent)?Q.Drag:ne(h,MouseEvent)?Q.MouseMove:Q.TouchMove)}),o,{trailing:!1})),d=[It("mousemove",l,i),It("touchmove",l,i),It("drag",l,i)];return he(function(){d.forEach(function(h){return h()})})}function oR(n){var e=n.mouseInteractionCb,t=n.doc,i=n.mirror,r=n.blockClass,o=n.blockSelector,s=n.sampling;if(s.mouseInteraction===!1)return function(){};var a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,c=[],u=null,l=function(d){return function(h){var p=Vo(h);if(!Rt(p,r,o,!0)){var m=null,f=d;if("pointerType"in h){switch(h.pointerType){case"mouse":m=jn.Mouse;break;case"touch":m=jn.Touch;break;case"pen":m=jn.Pen;break}m===jn.Touch?Ut[d]===Ut.MouseDown?f="TouchStart":Ut[d]===Ut.MouseUp&&(f="TouchEnd"):jn.Pen}else fd(h)&&(m=jn.Touch);m!==null?(u=m,(f.startsWith("Touch")&&m===jn.Touch||f.startsWith("Mouse")&&m===jn.Mouse)&&(m=null)):Ut[d]===Ut.Click&&(m=u,u=null);var g=fd(h)?h.changedTouches[0]:h;if(g){var y=i.getId(p),b=g.clientX,S=g.clientY;he(e)(fe({type:Ut[f],id:y,x:b,y:S},m!==null&&{pointerType:m}))}}}};return Object.keys(Ut).filter(function(d){return Number.isNaN(Number(d))&&!d.endsWith("_Departed")&&a[d]!==!1}).forEach(function(d){var h=ji(d),p=l(d);if(window.PointerEvent)switch(Ut[d]){case Ut.MouseDown:case Ut.MouseUp:h=h.replace("mouse","pointer");break;case Ut.TouchStart:case Ut.TouchEnd:return}c.push(It(h,p,t))}),he(function(){c.forEach(function(d){return d()})})}function Jv(n){var e=n.scrollCb,t=n.doc,i=n.mirror,r=n.blockClass,o=n.blockSelector,s=n.sampling,a=he(Bo(he(function(c){var u=Vo(c);if(!(!u||Rt(u,r,o,!0))){var l=i.getId(u);if(u===t&&t.defaultView){var d=Dv(t.defaultView);e({id:l,x:d.left,y:d.top})}else e({id:l,x:u.scrollLeft,y:u.scrollTop})}}),s.scroll||100));return It("scroll",a,t)}function sR(n,e){var t=n.viewportResizeCb,i=e.win,r=-1,o=-1,s=he(Bo(he(function(){var a=Lv(),c=Uv();(r!==a||o!==c)&&(t({width:Number(c),height:Number(a)}),r=a,o=c)}),200));return It("resize",s,i)}var aR=["INPUT","TEXTAREA","SELECT"],Zv=new WeakMap;function cR(n){var e=n.inputCb,t=n.doc,i=n.mirror,r=n.blockClass,o=n.blockSelector,s=n.ignoreClass,a=n.ignoreSelector,c=n.maskInputOptions,u=n.maskInputFn,l=n.sampling,d=n.userTriggeredOnInput;function h(w){var k=Vo(w),C=w.isTrusted,x=k&&k.tagName;if(k&&x==="OPTION"&&(k=se.parentElement(k)),!(!k||!x||aR.indexOf(x)<0||Rt(k,r,o,!0))&&!(k.classList.contains(s)||a&&k.matches(a))){var I=k.value,P=!1,D=il(k)||"";D==="radio"||D==="checkbox"?P=k.checked:(c[x.toLowerCase()]||c[D])&&(I=nl({element:k,maskInputOptions:c,tagName:x,type:D,value:I,maskInputFn:u})),p(k,d?{text:I,isChecked:P,userTriggered:C}:{text:I,isChecked:P});var O=k.name;D==="radio"&&O&&P&&t.querySelectorAll('input[type="radio"][name="'+O+'"]').forEach(function(L){if(L!==k){var j=L.value;p(L,d?{text:j,isChecked:!P,userTriggered:!1}:{text:j,isChecked:!P})}})}}function p(w,k){var C=Zv.get(w);if(!C||C.text!==k.text||C.isChecked!==k.isChecked){Zv.set(w,k);var x=i.getId(w);he(e)(fe({},k,{id:x}))}}var m=l.input==="last"?["change"]:["input","change"],f=m.map(function(w){return It(w,he(h),t)}),g=t.defaultView;if(!g)return function(){f.forEach(function(w){return w()})};var y=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),b=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];if(y&&y.set){var S;(S=f).push.apply(S,[].concat(b.map(function(w){return Ia(w[0],w[1],{set:function(){he(h)({target:this,isTrusted:!1})}},!1,g)})))}return he(function(){f.forEach(function(w){return w()})})}function Pa(n){var e=[];function t(i,r){if(Oa("CSSGroupingRule")&&ne(i.parentRule,CSSGroupingRule)||Oa("CSSMediaRule")&&ne(i.parentRule,CSSMediaRule)||Oa("CSSSupportsRule")&&ne(i.parentRule,CSSSupportsRule)||Oa("CSSConditionRule")&&ne(i.parentRule,CSSConditionRule)){var o=Array.from(i.parentRule.cssRules),s=o.indexOf(i);r.unshift(s)}else if(i.parentStyleSheet){var a=Array.from(i.parentStyleSheet.cssRules),c=a.indexOf(i);r.unshift(c)}return r}return t(n,e)}function oi(n,e,t){var i,r;return n?(n.ownerNode?i=e.getId(n.ownerNode):r=t.getId(n),{styleId:r,id:i}):{}}function uR(n,e){var t=n.styleSheetRuleCb,i=n.mirror,r=n.stylesheetManager,o=e.win;if(!o.CSSStyleSheet||!o.CSSStyleSheet.prototype)return function(){};var s=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:he(function(h,p,m){var f=m[0],g=m[1],y=oi(p,i,r.styleMirror),b=y.id,S=y.styleId;return(b&&b!==-1||S&&S!==-1)&&t({id:b,styleId:S,adds:[{rule:f,index:g}]}),h.apply(p,m)})}),o.CSSStyleSheet.prototype.addRule=function(h,p,m){m===void 0&&(m=this.cssRules.length);var f=h+" { "+p+" }";return o.CSSStyleSheet.prototype.insertRule.apply(this,[f,m])};var a=o.CSSStyleSheet.prototype.deleteRule;o.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:he(function(h,p,m){var f=m[0],g=oi(p,i,r.styleMirror),y=g.id,b=g.styleId;return(y&&y!==-1||b&&b!==-1)&&t({id:y,styleId:b,removes:[{index:f}]}),h.apply(p,m)})}),o.CSSStyleSheet.prototype.removeRule=function(h){return o.CSSStyleSheet.prototype.deleteRule.apply(this,[h])};var c;o.CSSStyleSheet.prototype.replace&&(c=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=new Proxy(c,{apply:he(function(h,p,m){var f=m[0],g=oi(p,i,r.styleMirror),y=g.id,b=g.styleId;return(y&&y!==-1||b&&b!==-1)&&t({id:y,styleId:b,replace:f}),h.apply(p,m)})}));var u;o.CSSStyleSheet.prototype.replaceSync&&(u=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:he(function(h,p,m){var f=m[0],g=oi(p,i,r.styleMirror),y=g.id,b=g.styleId;return(y&&y!==-1||b&&b!==-1)&&t({id:y,styleId:b,replaceSync:f}),h.apply(p,m)})}));var l={};Aa("CSSGroupingRule")?l.CSSGroupingRule=o.CSSGroupingRule:(Aa("CSSMediaRule")&&(l.CSSMediaRule=o.CSSMediaRule),Aa("CSSConditionRule")&&(l.CSSConditionRule=o.CSSConditionRule),Aa("CSSSupportsRule")&&(l.CSSSupportsRule=o.CSSSupportsRule));var d={};return Object.entries(l).forEach(function(h){var p=h[0],m=h[1];d[p]={insertRule:m.prototype.insertRule,deleteRule:m.prototype.deleteRule},m.prototype.insertRule=new Proxy(d[p].insertRule,{apply:he(function(f,g,y){var b=y[0],S=y[1],w=oi(g.parentStyleSheet,i,r.styleMirror),k=w.id,C=w.styleId;return(k&&k!==-1||C&&C!==-1)&&t({id:k,styleId:C,adds:[{rule:b,index:[].concat(Pa(g),[S||0])}]}),f.apply(g,y)})}),m.prototype.deleteRule=new Proxy(d[p].deleteRule,{apply:he(function(f,g,y){var b=y[0],S=oi(g.parentStyleSheet,i,r.styleMirror),w=S.id,k=S.styleId;return(w&&w!==-1||k&&k!==-1)&&t({id:w,styleId:k,removes:[{index:[].concat(Pa(g),[b])}]}),f.apply(g,y)})})}),he(function(){o.CSSStyleSheet.prototype.insertRule=s,o.CSSStyleSheet.prototype.deleteRule=a,c&&(o.CSSStyleSheet.prototype.replace=c),u&&(o.CSSStyleSheet.prototype.replaceSync=u),Object.entries(l).forEach(function(h){var p=h[0],m=h[1];m.prototype.insertRule=d[p].insertRule,m.prototype.deleteRule=d[p].deleteRule})})}function Qv(n,e){var t=n.mirror,i=n.stylesheetManager,r,o,s,a=null;e.nodeName==="#document"?a=t.getId(e):a=t.getId(se.host(e));var c=e.nodeName==="#document"?(r=e.defaultView)==null?void 0:r.Document:(s=(o=e.ownerDocument)==null?void 0:o.defaultView)==null?void 0:s.ShadowRoot,u=c!=null&&c.prototype?Object.getOwnPropertyDescriptor(c==null?void 0:c.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!c||!u?function(){}:(Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:function(){var l;return(l=u.get)==null?void 0:l.call(this)},set:function(l){var d,h=(d=u.set)==null?void 0:d.call(this,l);if(a!==null&&a!==-1)try{i.adoptStyleSheets(l,a)}catch{}return h}}),he(function(){Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))}function lR(n,e){var t=n.styleDeclarationCb,i=n.mirror,r=n.ignoreCSSAttributes,o=n.stylesheetManager,s=e.win,a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:he(function(u,l,d){var h,p=d[0],m=d[1],f=d[2];if(r.has(p))return a.apply(l,[p,m,f]);var g=oi((h=l.parentRule)==null?void 0:h.parentStyleSheet,i,o.styleMirror),y=g.id,b=g.styleId;return(y&&y!==-1||b&&b!==-1)&&t({id:y,styleId:b,set:{property:p,value:m,priority:f},index:Pa(l.parentRule)}),u.apply(l,d)})});var c=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:he(function(u,l,d){var h,p=d[0];if(r.has(p))return c.apply(l,[p]);var m=oi((h=l.parentRule)==null?void 0:h.parentStyleSheet,i,o.styleMirror),f=m.id,g=m.styleId;return(f&&f!==-1||g&&g!==-1)&&t({id:f,styleId:g,remove:{property:p},index:Pa(l.parentRule)}),u.apply(l,d)})}),he(function(){s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=c})}function dR(n){var e=n.mediaInteractionCb,t=n.blockClass,i=n.blockSelector,r=n.mirror,o=n.sampling,s=n.doc,a=he(function(u){return Bo(he(function(l){var d=Vo(l);if(!(!d||Rt(d,t,i,!0))){var h=d.currentTime,p=d.volume,m=d.muted,f=d.playbackRate,g=d.loop;e({type:u,id:r.getId(d),currentTime:h,volume:p,muted:m,playbackRate:f,loop:g})}}),o.media||500)}),c=[It("play",a(Or.Play),s),It("pause",a(Or.Pause),s),It("seeked",a(Or.Seeked),s),It("volumechange",a(Or.VolumeChange),s),It("ratechange",a(Or.RateChange),s)];return he(function(){c.forEach(function(u){return u()})})}function hR(n){var e=n.fontCb,t=n.doc,i=t.defaultView;if(!i)return function(){};var r=[],o=new WeakMap,s=i.FontFace;i.FontFace=function(c,u,l){var d=new s(c,u,l);return o.set(d,{family:c,buffer:typeof u!="string",descriptors:l,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};var a=Rr(t.fonts,"add",function(c){return function(u){return setTimeout(he(function(){var l=o.get(u);l&&(e(l),o.delete(u))}),0),c.apply(this,[u])}});return r.push(function(){i.FontFace=s}),r.push(a),he(function(){r.forEach(function(c){return c()})})}function pR(n){var e=n.doc,t=n.mirror,i=n.blockClass,r=n.blockSelector,o=n.selectionCb,s=!0,a=he(function(){var c=e.getSelection();if(!(!c||s&&(c!=null&&c.isCollapsed))){s=c.isCollapsed||!1;for(var u=[],l=c.rangeCount||0,d=0;d<l;d++){var h=c.getRangeAt(d),p=h.startContainer,m=h.startOffset,f=h.endContainer,g=h.endOffset,y=Rt(p,i,r,!0)||Rt(f,i,r,!0);y||u.push({start:t.getId(p),startOffset:m,end:t.getId(f),endOffset:g})}o({ranges:u})}});return a(),It("selectionchange",a)}function fR(n){var e=n.doc,t=n.customElementCb,i=e.defaultView;if(!i||!i.customElements)return function(){};var r=Rr(i.customElements,"define",function(o){return function(s,a,c){try{t({define:{name:s}})}catch{console.warn("Custom element callback failed for "+s)}return o.apply(this,[s,a,c])}});return r}function mR(n,e){var t=n.mutationCb,i=n.mousemoveCb,r=n.mouseInteractionCb,o=n.scrollCb,s=n.viewportResizeCb,a=n.inputCb,c=n.mediaInteractionCb,u=n.styleSheetRuleCb,l=n.styleDeclarationCb,d=n.canvasMutationCb,h=n.fontCb,p=n.selectionCb,m=n.customElementCb;n.mutationCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.mutation){var b;(b=e).mutation.apply(b,[].concat(g))}t.apply(void 0,[].concat(g))},n.mousemoveCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.mousemove){var b;(b=e).mousemove.apply(b,[].concat(g))}i.apply(void 0,[].concat(g))},n.mouseInteractionCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.mouseInteraction){var b;(b=e).mouseInteraction.apply(b,[].concat(g))}r.apply(void 0,[].concat(g))},n.scrollCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.scroll){var b;(b=e).scroll.apply(b,[].concat(g))}o.apply(void 0,[].concat(g))},n.viewportResizeCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.viewportResize){var b;(b=e).viewportResize.apply(b,[].concat(g))}s.apply(void 0,[].concat(g))},n.inputCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.input){var b;(b=e).input.apply(b,[].concat(g))}a.apply(void 0,[].concat(g))},n.mediaInteractionCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.mediaInteaction){var b;(b=e).mediaInteaction.apply(b,[].concat(g))}c.apply(void 0,[].concat(g))},n.styleSheetRuleCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.styleSheetRule){var b;(b=e).styleSheetRule.apply(b,[].concat(g))}u.apply(void 0,[].concat(g))},n.styleDeclarationCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.styleDeclaration){var b;(b=e).styleDeclaration.apply(b,[].concat(g))}l.apply(void 0,[].concat(g))},n.canvasMutationCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.canvasMutation){var b;(b=e).canvasMutation.apply(b,[].concat(g))}d.apply(void 0,[].concat(g))},n.fontCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.font){var b;(b=e).font.apply(b,[].concat(g))}h.apply(void 0,[].concat(g))},n.selectionCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.selection){var b;(b=e).selection.apply(b,[].concat(g))}p.apply(void 0,[].concat(g))},n.customElementCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.customElement){var b;(b=e).customElement.apply(b,[].concat(g))}m.apply(void 0,[].concat(g))}}function gR(n,e){e===void 0&&(e={});var t=n.doc.defaultView;if(!t)return function(){};mR(n,e);var i;n.recordDOM&&(i=Xv(n,n.doc));var r=rR(n),o=oR(n),s=Jv(n),a=sR(n,{win:t}),c=cR(n),u=dR(n),l=function(){},d=function(){},h=function(){},p=function(){};n.recordDOM&&(l=uR(n,{win:t}),d=Qv(n,n.doc),h=lR(n,{win:t}),n.collectFonts&&(p=hR(n)));for(var m=pR(n),f=fR(n),g=[],y=K(n.plugins),b;!(b=y()).done;){var S=b.value;g.push(S.observer(S.callback,t,S.options))}return he(function(){qi.forEach(function(w){return w.reset()}),i==null||i.disconnect(),r(),o(),s(),a(),c(),u(),l(),d(),h(),p(),m(),f(),g.forEach(function(w){return w()})})}function Oa(n){return typeof window[n]<"u"}function Aa(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}for(var e0=function(){function n(t){V(this,"iframeIdToRemoteIdMap",new WeakMap),V(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}var e=n.prototype;return e.getId=function(t,i,r,o){var s=r||this.getIdToRemoteIdMap(t),a=o||this.getRemoteIdToIdMap(t),c=s.get(i);return c||(c=this.generateIdFn(),s.set(i,c),a.set(c,i)),c},e.getIds=function(t,i){var r=this,o=this.getIdToRemoteIdMap(t),s=this.getRemoteIdToIdMap(t);return i.map(function(a){return r.getId(t,a,o,s)})},e.getRemoteId=function(t,i,r){var o=r||this.getRemoteIdToIdMap(t);if(typeof i!="number")return i;var s=o.get(i);return s||-1},e.getRemoteIds=function(t,i){var r=this,o=this.getRemoteIdToIdMap(t);return i.map(function(s){return r.getRemoteId(t,s,o)})},e.reset=function(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)},e.getIdToRemoteIdMap=function(t){var i=this.iframeIdToRemoteIdMap.get(t);return i||(i=new Map,this.iframeIdToRemoteIdMap.set(t,i)),i},e.getRemoteIdToIdMap=function(t){var i=this.iframeRemoteIdToIdMap.get(t);return i||(i=new Map,this.iframeRemoteIdToIdMap.set(t,i)),i},n}(),vR=function(){function n(t){V(this,"iframes",new WeakMap),V(this,"crossOriginIframeMap",new WeakMap),V(this,"crossOriginIframeMirror",new e0(Pm)),V(this,"crossOriginIframeStyleMirror"),V(this,"crossOriginIframeRootIdMap",new WeakMap),V(this,"mirror"),V(this,"mutationCb"),V(this,"wrappedEmit"),V(this,"loadListener"),V(this,"stylesheetManager"),V(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new e0(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}var e=n.prototype;return e.addIframe=function(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)},e.addLoadListener=function(t){this.loadListener=t},e.attachIframe=function(t,i){var r,o;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:i}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=t.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(o=this.loadListener)==null||o.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))},e.handleMessage=function(t){var i=t;if(!(i.data.type!=="rrweb"||i.origin!==i.data.origin)){var r=t.source;if(r){var o=this.crossOriginIframeMap.get(t.source);if(o){var s=this.transformCrossOriginEvent(o,i.data.event);s&&this.wrappedEmit(s,i.data.isCheckout)}}}},e.transformCrossOriginEvent=function(t,i){var r=this,o;switch(i.type){case ce.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(i.data.node,t);var s=i.data.node.id;return this.crossOriginIframeRootIdMap.set(t,s),this.patchRootIdOnNode(i.data.node,s),{timestamp:i.timestamp,type:ce.IncrementalSnapshot,data:{source:Q.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:i.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case ce.Meta:case ce.Load:case ce.DomContentLoaded:return!1;case ce.Plugin:return i;case ce.Custom:return this.replaceIds(i.data.payload,t,["id","parentId","previousId","nextId"]),i;case ce.IncrementalSnapshot:switch(i.data.source){case Q.Mutation:return i.data.adds.forEach(function(a){r.replaceIds(a,t,["parentId","nextId","previousId"]),r.replaceIdOnNode(a.node,t);var c=r.crossOriginIframeRootIdMap.get(t);c&&r.patchRootIdOnNode(a.node,c)}),i.data.removes.forEach(function(a){r.replaceIds(a,t,["parentId","id"])}),i.data.attributes.forEach(function(a){r.replaceIds(a,t,["id"])}),i.data.texts.forEach(function(a){r.replaceIds(a,t,["id"])}),i;case Q.Drag:case Q.TouchMove:case Q.MouseMove:return i.data.positions.forEach(function(a){r.replaceIds(a,t,["id"])}),i;case Q.ViewportResize:return!1;case Q.MediaInteraction:case Q.MouseInteraction:case Q.Scroll:case Q.CanvasMutation:case Q.Input:return this.replaceIds(i.data,t,["id"]),i;case Q.StyleSheetRule:case Q.StyleDeclaration:return this.replaceIds(i.data,t,["id"]),this.replaceStyleIds(i.data,t,["styleId"]),i;case Q.Font:return i;case Q.Selection:return i.data.ranges.forEach(function(a){r.replaceIds(a,t,["start","end"])}),i;case Q.AdoptedStyleSheet:return this.replaceIds(i.data,t,["id"]),this.replaceStyleIds(i.data,t,["styleIds"]),(o=i.data.styles)==null||o.forEach(function(a){r.replaceStyleIds(a,t,["styleId"])}),i}}return!1},e.replace=function(t,i,r,o){for(var s=K(o),a;!(a=s()).done;){var c=a.value;!Array.isArray(i[c])&&typeof i[c]!="number"||(Array.isArray(i[c])?i[c]=t.getIds(r,i[c]):i[c]=t.getId(r,i[c]))}return i},e.replaceIds=function(t,i,r){return this.replace(this.crossOriginIframeMirror,t,i,r)},e.replaceStyleIds=function(t,i,r){return this.replace(this.crossOriginIframeStyleMirror,t,i,r)},e.replaceIdOnNode=function(t,i){var r=this;this.replaceIds(t,i,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(function(o){r.replaceIdOnNode(o,i)})},e.patchRootIdOnNode=function(t,i){var r=this;t.type!==Wv.Document&&!t.rootId&&(t.rootId=i),"childNodes"in t&&t.childNodes.forEach(function(o){r.patchRootIdOnNode(o,i)})},n}(),yR=function(){function n(t){V(this,"shadowDoms",new WeakSet),V(this,"mutationCb"),V(this,"scrollCb"),V(this,"bypassOptions"),V(this,"mirror"),V(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}var e=n.prototype;return e.init=function(){this.reset(),this.patchAttachShadow(Element,document)},e.addShadowRoot=function(t,i){var r=this;if(wo(t)&&!this.shadowDoms.has(t)){this.shadowDoms.add(t);var o=Xv(fe({},this.bypassOptions,{doc:i,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(function(){return o.disconnect()}),this.restoreHandlers.push(Jv(fe({},this.bypassOptions,{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(function(){t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&r.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,r.mirror.getId(se.host(t))),r.restoreHandlers.push(Qv({mirror:r.mirror,stylesheetManager:r.bypassOptions.stylesheetManager},t))},0)}},e.observeAttachShadow=function(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)},e.patchAttachShadow=function(t,i){var r=this;this.restoreHandlers.push(Rr(t.prototype,"attachShadow",function(o){return function(s){var a=o.call(this,s),c=se.shadowRoot(this);return c&&qv(this)&&r.addShadowRoot(c,i),a}}))},e.reset=function(){this.restoreHandlers.forEach(function(t){try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet},n}(),Ar="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bR=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ma=0;Ma<Ar.length;Ma++)bR[Ar.charCodeAt(Ma)]=Ma;var _R=function(n){var e=new Uint8Array(n),t,i=e.length,r="";for(t=0;t<i;t+=3)r+=Ar[e[t]>>2],r+=Ar[(e[t]&3)<<4|e[t+1]>>4],r+=Ar[(e[t+1]&15)<<2|e[t+2]>>6],r+=Ar[e[t+2]&63];return i%3===2?r=r.substring(0,r.length-1)+"=":i%3===1&&(r=r.substring(0,r.length-2)+"=="),r},t0=new Map;function kR(n,e){var t=t0.get(n);return t||(t=new Map,t0.set(n,t)),t.has(e)||t.set(e,[]),t.get(e)}var n0=function(n,e,t){if(!(!n||!(r0(n,e)||(typeof n>"u"?"undefined":oe(n))==="object"))){var i=n.constructor.name,r=kR(t,i),o=r.indexOf(n);return o===-1&&(o=r.length,r.push(n)),o}};function Na(n,e,t){if(ne(n,Array))return n.map(function(m){return Na(m,e,t)});if(n===null)return n;if(ne(n,Float32Array)||ne(n,Float64Array)||ne(n,Int32Array)||ne(n,Uint32Array)||ne(n,Uint8Array)||ne(n,Uint16Array)||ne(n,Int16Array)||ne(n,Int8Array)||ne(n,Uint8ClampedArray)){var i=n.constructor.name;return{rr_type:i,args:[Object.values(n)]}}else if(ne(n,ArrayBuffer)){var r=n.constructor.name,o=_R(n);return{rr_type:r,base64:o}}else if(ne(n,DataView)){var s=n.constructor.name;return{rr_type:s,args:[Na(n.buffer,e,t),n.byteOffset,n.byteLength]}}else if(ne(n,HTMLImageElement)){var a=n.constructor.name,c=n.src;return{rr_type:a,src:c}}else if(ne(n,HTMLCanvasElement)){var u="HTMLImageElement",l=n.toDataURL();return{rr_type:u,src:l}}else if(ne(n,ImageData)){var d=n.constructor.name;return{rr_type:d,args:[Na(n.data,e,t),n.width,n.height]}}else if(r0(n,e)||(typeof n>"u"?"undefined":oe(n))==="object"){var h=n.constructor.name,p=n0(n,e,t);return{rr_type:h,index:p}}return n}var i0=function(n,e,t){return n.map(function(i){return Na(i,e,t)})},r0=function(n,e){var t=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"],i=t.filter(function(r){return typeof e[r]=="function"});return!!i.find(function(r){return ne(n,e[r])})};function SR(n,e,t,i){for(var r=function(){var u=c.value;try{if(typeof e.CanvasRenderingContext2D.prototype[u]!="function")return"continue";var l=Rr(e.CanvasRenderingContext2D.prototype,u,function(h){return function(){for(var p=this,m=arguments.length,f=new Array(m),g=0;g<m;g++)f[g]=arguments[g];return Rt(this.canvas,t,i,!0)||setTimeout(function(){var y=i0(f,e,p);n(p.canvas,{type:Pr["2D"],property:u,args:y})},0),h.apply(this,f)}});o.push(l)}catch{var d=Ia(e.CanvasRenderingContext2D.prototype,u,{set:function(h){n(this.canvas,{type:Pr["2D"],property:u,args:[h],setter:!0})}});o.push(d)}},o=[],s=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype),a=K(s),c;!(c=a()).done;)r();return function(){o.forEach(function(u){return u()})}}function wR(n){return n==="experimental-webgl"?"webgl":n}function o0(n,e,t,i){var r=[];try{var o=Rr(n.HTMLCanvasElement.prototype,"getContext",function(s){return function(a){for(var c=arguments.length,u=new Array(c>1?c-1:0),l=1;l<c;l++)u[l-1]=arguments[l];if(!Rt(this,e,t,!0)){var d=wR(a);if("__context"in this||(this.__context=d),i&&["webgl","webgl2"].includes(d))if(u[0]&&oe(u[0])==="object"){var h=u[0];h.preserveDrawingBuffer||(h.preserveDrawingBuffer=!0)}else u.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[].concat([a],u))}});r.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return function(){r.forEach(function(s){return s()})}}function s0(n,e,t,i,r,o){for(var s=function(){var d=l.value;if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(d))return"continue";try{if(typeof n[d]!="function")return"continue";var h=Rr(n,d,function(m){return function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];var b=m.apply(this,g);if(n0(b,o,this),"tagName"in this.canvas&&!Rt(this.canvas,i,r,!0)){var S=i0(g,o,this),w={type:e,property:d,args:S};t(this.canvas,w)}return b}});a.push(h)}catch{var p=Ia(n,d,{set:function(m){t(this.canvas,{type:e,property:d,args:[m],setter:!0})}});a.push(p)}},a=[],c=Object.getOwnPropertyNames(n),u=K(c),l;!(l=u()).done;)s();return a}function CR(n,e,t,i){var r,o=[];if((r=o).push.apply(r,[].concat(s0(e.WebGLRenderingContext.prototype,Pr.WebGL,n,t,i,e))),typeof e.WebGL2RenderingContext<"u"){var s;(s=o).push.apply(s,[].concat(s0(e.WebGL2RenderingContext.prototype,Pr.WebGL2,n,t,i,e)))}return function(){o.forEach(function(a){return a()})}}var a0="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",TR=function(n){return Uint8Array.from(atob(n),function(e){return e.charCodeAt(0)})},c0=typeof window<"u"&&window.Blob&&new Blob([TR(a0)],{type:"text/javascript;charset=utf-8"});function xR(n){var e;try{if(e=c0&&(window.URL||window.webkitURL).createObjectURL(c0),!e)throw"";var t=new Worker(e,{name:n==null?void 0:n.name});return t.addEventListener("error",function(){(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+a0,{name:n==null?void 0:n.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var ER=function(){function n(t){var i=this;V(this,"pendingCanvasMutations",new Map),V(this,"rafStamps",{latestId:0,invokeId:null}),V(this,"mirror"),V(this,"mutationCb"),V(this,"resetObservers"),V(this,"frozen",!1),V(this,"locked",!1),V(this,"processMutation",function(d,h){var p=i.rafStamps.invokeId&&i.rafStamps.latestId!==i.rafStamps.invokeId;(p||!i.rafStamps.invokeId)&&(i.rafStamps.invokeId=i.rafStamps.latestId),i.pendingCanvasMutations.has(d)||i.pendingCanvasMutations.set(d,[]),i.pendingCanvasMutations.get(d).push(h)});var r=t.sampling,o=r===void 0?"all":r,s=t.win,a=t.blockClass,c=t.blockSelector,u=t.recordCanvas,l=t.dataURLOptions;this.mutationCb=t.mutationCb,this.mirror=t.mirror,u&&o==="all"&&this.initCanvasMutationObserver(s,a,c),u&&typeof o=="number"&&this.initCanvasFPSObserver(o,s,a,c,{dataURLOptions:l})}var e=n.prototype;return e.reset=function(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()},e.freeze=function(){this.frozen=!0},e.unfreeze=function(){this.frozen=!1},e.lock=function(){this.locked=!0},e.unlock=function(){this.locked=!1},e.initCanvasFPSObserver=function(t,i,r,o,s){var a=this,c=o0(i,r,o,!0),u=new Map,l=new xR;l.onmessage=function(g){var y=g.data.id;if(u.set(y,!1),"base64"in g.data){var b=g.data,S=b.base64,w=b.type,k=b.width,C=b.height;a.mutationCb({id:y,type:Pr["2D"],commands:[{property:"clearRect",args:[0,0,k,C]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:w}]},0,0]}]})}};var d=1e3/t,h=0,p,m=function(){var g=[];return i.document.querySelectorAll("canvas").forEach(function(y){Rt(y,r,o,!0)||g.push(y)}),g},f=function(g){if(h&&g-h<d){p=requestAnimationFrame(f);return}h=g;var y=a;m().forEach(Xu(function(b){var S,w,k,C;return ko(this,function(x){switch(x.label){case 0:return w=y.mirror.getId(b),u.get(w)?[2]:b.width===0||b.height===0?[2]:(u.set(w,!0),["webgl","webgl2"].includes(b.__context)&&(k=b.getContext(b.__context),((S=k==null?void 0:k.getContextAttributes())==null?void 0:S.preserveDrawingBuffer)===!1&&k.clear(k.COLOR_BUFFER_BIT)),[4,createImageBitmap(b)]);case 1:return C=x.sent(),l.postMessage({id:w,bitmap:C,width:b.width,height:b.height,dataURLOptions:s.dataURLOptions},[C]),[2]}})})),p=requestAnimationFrame(f)};p=requestAnimationFrame(f),this.resetObservers=function(){c(),cancelAnimationFrame(p)}},e.initCanvasMutationObserver=function(t,i,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var o=o0(t,i,r,!1),s=SR(this.processMutation.bind(this),t,i,r),a=CR(this.processMutation.bind(this),t,i,r);this.resetObservers=function(){o(),s(),a()}},e.startPendingCanvasMutationFlusher=function(){var t=this;requestAnimationFrame(function(){return t.flushPendingCanvasMutations()})},e.startRAFTimestamping=function(){var t=this,i=function(r){t.rafStamps.latestId=r,requestAnimationFrame(i)};requestAnimationFrame(i)},e.flushPendingCanvasMutations=function(){var t=this;this.pendingCanvasMutations.forEach(function(i,r){var o=t.mirror.getId(r);t.flushPendingCanvasMutationFor(r,o)}),requestAnimationFrame(function(){return t.flushPendingCanvasMutations()})},e.flushPendingCanvasMutationFor=function(t,i){if(!(this.frozen||this.locked)){var r=this.pendingCanvasMutations.get(t);if(!(!r||i===-1)){var o=r.map(function(a){a.type;var c=bo(a,["type"]);return c}),s=r[0].type;this.mutationCb({id:i,type:s,commands:o}),this.pendingCanvasMutations.delete(t)}}},n}(),IR=function(){function n(t){V(this,"trackedLinkElements",new WeakSet),V(this,"mutationCb"),V(this,"adoptedStyleSheetCb"),V(this,"styleMirror",new YI),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}var e=n.prototype;return e.attachLinkElement=function(t,i){"_cssText"in i.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:i.id,attributes:i.attributes}]}),this.trackLinkElement(t)},e.trackLinkElement=function(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))},e.adoptStyleSheets=function(t,i){var r,o=function(){var l=u.value,d=void 0;r.styleMirror.has(l)?d=r.styleMirror.getId(l):(d=r.styleMirror.add(l),a.push({styleId:d,rules:Array.from(l.rules||CSSRule,function(h,p){return{rule:xm(h,l.href),index:p}})})),s.styleIds.push(d)};if(t.length!==0){for(var s={id:i,styleIds:[]},a=[],c=K(t),u;!(u=c()).done;)r=this,o();a.length>0&&(s.styles=a),this.adoptedStyleSheetCb(s)}},e.reset=function(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet},e.trackStylesheetInLinkElement=function(t){},n}(),RR=function(){function n(){V(this,"nodeMap",new WeakMap),V(this,"active",!1)}var e=n.prototype;return e.inOtherBuffer=function(t,i){var r=this.nodeMap.get(t);return r&&Array.from(r).some(function(o){return o!==i})},e.add=function(t,i){var r=this;this.active||(this.active=!0,requestAnimationFrame(function(){r.nodeMap=new WeakMap,r.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(i))},e.destroy=function(){},n}(),He,Da,vd,La=!1;try{if(Array.from([1],function(n){return n*2})[0]!==2){var yd=document.createElement("iframe");document.body.appendChild(yd),Array.from=((_m=yd.contentWindow)==null?void 0:_m.Array.from)||Array.from,document.body.removeChild(yd)}}catch{}var rn=E1();function si(n){n===void 0&&(n={});var e=n.emit,t=n.checkoutEveryNms,i=n.checkoutEveryNth,r=n.blockClass,o=r===void 0?"rr-block":r,s=n.blockSelector,a=s===void 0?null:s,c=n.ignoreClass,u=c===void 0?"rr-ignore":c,l=n.ignoreSelector,d=l===void 0?null:l,h=n.maskTextClass,p=h===void 0?"rr-mask":h,m=n.maskTextSelector,f=m===void 0?null:m,g=n.inlineStylesheet,y=g===void 0?!0:g,b=n.maskAllInputs,S=n.maskInputOptions,w=n.slimDOMOptions,k=n.maskInputFn,C=n.maskTextFn,x=n.hooks,I=n.packFn,P=n.sampling,D=P===void 0?{}:P,O=n.dataURLOptions,L=O===void 0?{}:O,j=n.mousemoveWait,X=n.recordDOM,W=X===void 0?!0:X,A=n.recordCanvas,H=A===void 0?!1:A,Y=n.recordCrossOriginIframes,J=Y===void 0?!1:Y,ve=n.recordAfter,Me=ve===void 0?n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load":ve,Ie=n.userTriggeredOnInput,dt=Ie===void 0?!1:Ie,Ne=n.collectFonts,Pe=Ne===void 0?!1:Ne,ie=n.inlineImages,Ze=ie===void 0?!1:ie,kt=n.plugins,Gt=n.keepIframeSrcFn,ur=Gt===void 0?function(){return!1}:Gt,ye=n.ignoreCSSAttributes,Nt=ye===void 0?new Set([]):ye,lr=n.errorHandler;nR(lr);var yn=J?window.parent===window:!0,Dn=!1;if(!yn)try{window.parent.document&&(Dn=!1)}catch{Dn=!0}if(yn&&!e)throw new Error("emit function is required");if(!yn&&!Dn)return function(){};j!==void 0&&D.mousemove===void 0&&(D.mousemove=j),rn.reset();var Zn=b===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:S!==void 0?S:{password:!0},Li=w===!0||w==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:w==="all",headMetaDescKeywords:w==="all",headTitleMutations:w==="all"}:w||{};KI();var fo,dr=0,Qn=function(Oe){for(var tn=K(kt||[]),Z;!(Z=tn()).done;){var $e=Z.value;$e.eventProcessor&&(Oe=$e.eventProcessor(Oe))}return I&&!Dn&&(Oe=I(Oe)),Oe};He=function(Oe,tn){var Z,$e=Oe;if($e.timestamp=Ra(),(Z=qi[0])!=null&&Z.isFrozen()&&$e.type!==ce.FullSnapshot&&!($e.type===ce.IncrementalSnapshot&&$e.data.source===Q.Mutation)&&qi.forEach(function(d4){return d4.unfreeze()}),yn)e==null||e(Qn($e),tn);else if(Dn){var c4={type:"rrweb",event:Qn($e),origin:window.location.origin,isCheckout:tn};window.parent.postMessage(c4,"*")}if($e.type===ce.FullSnapshot)fo=$e,dr=0;else if($e.type===ce.IncrementalSnapshot){if($e.data.source===Q.Mutation&&$e.data.isAttachIframe)return;dr++;var u4=i&&dr>=i,l4=t&&$e.timestamp-fo.timestamp>t;(u4||l4)&&Da(!0)}};for(var hr=function(Oe){He({type:ce.IncrementalSnapshot,data:fe({source:Q.Mutation},Oe)})},Tw=function(Oe){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.Scroll},Oe)})},xw=function(Oe){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.CanvasMutation},Oe)})},s4=function(Oe){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.AdoptedStyleSheet},Oe)})},pr=new IR({mutationCb:hr,adoptedStyleSheetCb:s4}),fr=new vR({mirror:rn,mutationCb:hr,stylesheetManager:pr,recordCrossOriginIframes:J,wrappedEmit:He}),a4=K(kt||[]),Ew;!(Ew=a4()).done;){var Iw=Ew.value;Iw.getMirror&&Iw.getMirror({nodeMirror:rn,crossOriginIframeMirror:fr.crossOriginIframeMirror,crossOriginIframeStyleMirror:fr.crossOriginIframeStyleMirror})}var lf=new RR;vd=new ER({recordCanvas:H,mutationCb:xw,win:window,blockClass:o,blockSelector:a,mirror:rn,sampling:D.canvas,dataURLOptions:L});var Mu=new yR({mutationCb:hr,scrollCb:Tw,bypassOptions:{blockClass:o,blockSelector:a,maskTextClass:p,maskTextSelector:f,inlineStylesheet:y,maskInputOptions:Zn,dataURLOptions:L,maskTextFn:C,maskInputFn:k,recordCanvas:H,inlineImages:Ze,sampling:D,slimDOMOptions:Li,iframeManager:fr,stylesheetManager:pr,canvasManager:vd,keepIframeSrcFn:ur,processedNodeManager:lf},mirror:rn});Da=function(Oe){if(Oe===void 0&&(Oe=!1),!!W){He({type:ce.Meta,data:{href:window.location.href,width:Uv(),height:Lv()}},Oe),pr.reset(),Mu.init(),qi.forEach(function(Z){return Z.lock()});var tn=J1(document,{mirror:rn,blockClass:o,blockSelector:a,maskTextClass:p,maskTextSelector:f,inlineStylesheet:y,maskAllInputs:Zn,maskTextFn:C,maskInputFn:k,slimDOM:Li,dataURLOptions:L,recordCanvas:H,inlineImages:Ze,onSerialize:function(Z){jv(Z,rn)&&fr.addIframe(Z),Vv(Z,rn)&&pr.trackLinkElement(Z),md(Z)&&Mu.addShadowRoot(se.shadowRoot(Z),document)},onIframeLoad:function(Z,$e){fr.attachIframe(Z,$e),Mu.observeAttachShadow(Z)},onStylesheetLoad:function(Z,$e){pr.attachLinkElement(Z,$e)},keepIframeSrcFn:ur});if(!tn)return console.warn("Failed to snapshot the document");He({type:ce.FullSnapshot,data:{node:tn,initialOffset:Dv(window)}},Oe),qi.forEach(function(Z){return Z.unlock()}),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&pr.adoptStyleSheets(document.adoptedStyleSheets,rn.getId(document))}};try{var ws=[],Rw=function(Oe){var tn;return he(gR)({mutationCb:hr,mousemoveCb:function(Z,$e){return He({type:ce.IncrementalSnapshot,data:{source:$e,positions:Z}})},mouseInteractionCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.MouseInteraction},Z)})},scrollCb:Tw,viewportResizeCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.ViewportResize},Z)})},inputCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.Input},Z)})},mediaInteractionCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.MediaInteraction},Z)})},styleSheetRuleCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.StyleSheetRule},Z)})},styleDeclarationCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.StyleDeclaration},Z)})},canvasMutationCb:xw,fontCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.Font},Z)})},selectionCb:function(Z){He({type:ce.IncrementalSnapshot,data:fe({source:Q.Selection},Z)})},customElementCb:function(Z){He({type:ce.IncrementalSnapshot,data:fe({source:Q.CustomElement},Z)})},blockClass:o,ignoreClass:u,ignoreSelector:d,maskTextClass:p,maskTextSelector:f,maskInputOptions:Zn,inlineStylesheet:y,sampling:D,recordDOM:W,recordCanvas:H,inlineImages:Ze,userTriggeredOnInput:dt,collectFonts:Pe,doc:Oe,maskInputFn:k,maskTextFn:C,keepIframeSrcFn:ur,blockSelector:a,slimDOMOptions:Li,dataURLOptions:L,mirror:rn,iframeManager:fr,stylesheetManager:pr,shadowDomManager:Mu,processedNodeManager:lf,canvasManager:vd,ignoreCSSAttributes:Nt,plugins:((tn=kt==null?void 0:kt.filter(function(Z){return Z.observer}))==null?void 0:tn.map(function(Z){return{observer:Z.observer,options:Z.options,callback:function($e){return He({type:ce.Plugin,data:{plugin:Z.name,payload:$e}})}}}))||[]},x)};fr.addLoadListener(function(Oe){try{ws.push(Rw(Oe.contentDocument))}catch(tn){console.warn(tn)}});var df=function(){Da(),ws.push(Rw(document)),La=!0};return document.readyState==="interactive"||document.readyState==="complete"?df():(ws.push(It("DOMContentLoaded",function(){He({type:ce.DomContentLoaded,data:{}}),Me==="DOMContentLoaded"&&df()})),ws.push(It("load",function(){He({type:ce.Load,data:{}}),Me==="load"&&df()},window))),function(){ws.forEach(function(Oe){return Oe()}),lf.destroy(),La=!1,iR()}}catch(Oe){console.warn(Oe)}}si.addCustomEvent=function(n,e){if(!La)throw new Error("please add custom event after start recording");He({type:ce.Custom,data:{tag:n,payload:e}})},si.freezePage=function(){qi.forEach(function(n){return n.freeze()})},si.takeFullSnapshot=function(n){if(!La)throw new Error("please take full snapshot after start recording");Da(n)},si.mirror=rn;var u0;(function(n){n[n.NotStarted=0]="NotStarted",n[n.Running=1]="Running",n[n.Stopped=2]="Stopped"})(u0||(u0={})),si.addCustomEvent,si.freezePage,si.takeFullSnapshot;var l0=q.setImmediate,ai,bd,_d,d0=Object.prototype.toString,PR=typeof l0<"u"?function(n){return l0(n)}:setTimeout;try{Object.defineProperty({},"x",{}),ai=function(n,e,t,i){return Object.defineProperty(n,e,{value:t,writable:!0,configurable:i!==!1})}}catch{ai=function(n,e,t){return n[e]=t,n}}_d=function(){var n,e,t;function i(r,o){this.fn=r,this.self=o,this.next=void 0}return{add:function(r,o){t=new i(r,o),e?e.next=t:n=t,e=t,t=void 0},drain:function(){var r=n;for(n=e=bd=void 0;r;)r.fn.call(r.self),r=r.next}}}();function Ua(n,e){_d.add(n,e),bd||(bd=PR(_d.drain))}function h0(n){var e,t=typeof n;return n!==null&&(t==="object"||t==="function")&&(e=n.then),typeof e=="function"?e:!1}function kd(){for(var n=0;n<this.chain.length;n++)OR(this,this.state===1?this.chain[n].success:this.chain[n].failure,this.chain[n]);this.chain.length=0}function OR(n,e,t){var i,r;try{e===!1?t.reject(n.msg):(e===!0?i=n.msg:i=e.call(void 0,n.msg),i===t.promise?t.reject(TypeError("Promise-chain cycle")):(r=h0(i))?r.call(i,t.resolve,t.reject):t.resolve(i))}catch(o){t.reject(o)}}function p0(n){var e,t=this;if(!t.triggered){t.triggered=!0,t.def&&(t=t.def);try{(e=h0(n))?Ua(function(){var i=new m0(t);try{e.call(n,function(){p0.apply(i,arguments)},function(){zo.apply(i,arguments)})}catch(r){zo.call(i,r)}}):(t.msg=n,t.state=1,t.chain.length>0&&Ua(kd,t))}catch(i){zo.call(new m0(t),i)}}}function zo(n){var e=this;e.triggered||(e.triggered=!0,e.def&&(e=e.def),e.msg=n,e.state=2,e.chain.length>0&&Ua(kd,e))}function f0(n,e,t,i){for(var r=0;r<e.length;r++)(function(o){n.resolve(e[o]).then(function(s){t(o,s)},i)})(r)}function m0(n){this.def=n,this.triggered=!1}function AR(n){this.promise=n,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function ci(n){if(typeof n!="function")throw TypeError("Not a function");if(this.__NPO__!==0)throw TypeError("Not a promise");this.__NPO__=1;var e=new AR(this);this.then=function(t,i){var r={success:typeof t=="function"?t:!0,failure:typeof i=="function"?i:!1};return r.promise=new this.constructor(function(o,s){if(typeof o!="function"||typeof s!="function")throw TypeError("Not a function");r.resolve=o,r.reject=s}),e.chain.push(r),e.state!==0&&Ua(kd,e),r.promise},this.catch=function(t){return this.then(void 0,t)};try{n.call(void 0,function(t){p0.call(e,t)},function(t){zo.call(e,t)})}catch(t){zo.call(e,t)}}var g0=ai({},"constructor",ci,!1);ci.prototype=g0,ai(g0,"__NPO__",0,!1),ai(ci,"resolve",function(n){var e=this;return n&&typeof n=="object"&&n.__NPO__===1?n:new e(function(t,i){if(typeof t!="function"||typeof i!="function")throw TypeError("Not a function");t(n)})}),ai(ci,"reject",function(n){return new this(function(e,t){if(typeof e!="function"||typeof t!="function")throw TypeError("Not a function");t(n)})}),ai(ci,"all",function(n){var e=this;return d0.call(n)!=="[object Array]"?e.reject(TypeError("Not an array")):n.length===0?e.resolve([]):new e(function(t,i){if(typeof t!="function"||typeof i!="function")throw TypeError("Not a function");var r=n.length,o=Array(r),s=0;f0(e,n,function(a,c){o[a]=c,++s===r&&t(o)},i)})}),ai(ci,"race",function(n){var e=this;return d0.call(n)!=="[object Array]"?e.reject(TypeError("Not an array")):new e(function(t,i){if(typeof t!="function"||typeof i!="function")throw TypeError("Not a function");f0(e,n,function(r,o){t(o)},i)})});var ke;typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1?ke=Promise:ke=ci;var on={DEBUG:!1,LIB_VERSION:"2.68.0"},qo=24*60*60*1e3,Sd=8*1e3,Fa=Array.prototype,MR=Function.prototype,v0=Object.prototype,Wi=Fa.slice,Wo=v0.toString,Ba=v0.hasOwnProperty,ot=q.console,ui=q.navigator,be=q.document,ja=q.opera,y0=q.screen,Vn=ui.userAgent,wd=MR.bind,b0=Fa.forEach,_0=Fa.indexOf,k0=Fa.map,NR=Array.isArray,Cd={},v={trim:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},_e={log:function(){if(on.DEBUG&&!v.isUndefined(ot)&&ot)try{ot.log.apply(ot,arguments)}catch{v.each(arguments,function(n){ot.log(n)})}},warn:function(){if(on.DEBUG&&!v.isUndefined(ot)&&ot){var n=["Mixpanel warning:"].concat(v.toArray(arguments));try{ot.warn.apply(ot,n)}catch{v.each(n,function(e){ot.warn(e)})}}},error:function(){if(on.DEBUG&&!v.isUndefined(ot)&&ot){var n=["Mixpanel error:"].concat(v.toArray(arguments));try{ot.error.apply(ot,n)}catch{v.each(n,function(e){ot.error(e)})}}},critical:function(){if(!v.isUndefined(ot)&&ot){var n=["Mixpanel error:"].concat(v.toArray(arguments));try{ot.error.apply(ot,n)}catch{v.each(n,function(e){ot.error(e)})}}}},Td=function(n,e){return function(){return arguments[0]="["+e+"] "+arguments[0],n.apply(_e,arguments)}},Gi=function(n){return{log:Td(_e.log,n),error:Td(_e.error,n),critical:Td(_e.critical,n)}},xd=function(n){return function(){try{return n.apply(this,arguments)}catch(e){_e.critical("Implementation error. Please turn on debug and contact support@mixpanel.com."),on.DEBUG&&_e.critical(e)}}},S0=function(n){var e=n.prototype;for(var t in e)typeof e[t]=="function"&&(e[t]=xd(e[t]))};v.bind=function(n,e){var t,i;if(wd&&n.bind===wd)return wd.apply(n,Wi.call(arguments,1));if(!v.isFunction(n))throw new TypeError;return t=Wi.call(arguments,2),i=function(){if(!(this instanceof i))return n.apply(e,t.concat(Wi.call(arguments)));var r={};r.prototype=n.prototype;var o=new r;r.prototype=null;var s=n.apply(o,t.concat(Wi.call(arguments)));return Object(s)===s?s:o},i},v.each=function(n,e,t){if(n!=null){if(b0&&n.forEach===b0)n.forEach(e,t);else if(n.length===+n.length){for(var i=0,r=n.length;i<r;i++)if(i in n&&e.call(t,n[i],i,n)===Cd)return}else for(var o in n)if(Ba.call(n,o)&&e.call(t,n[o],o,n)===Cd)return}},v.extend=function(n){return v.each(Wi.call(arguments,1),function(e){for(var t in e)e[t]!==void 0&&(n[t]=e[t])}),n},v.isArray=NR||function(n){return Wo.call(n)==="[object Array]"},v.isFunction=function(n){try{return/^\s*\bfunction\b/.test(n)}catch{return!1}},v.isArguments=function(n){return!!(n&&Ba.call(n,"callee"))},v.toArray=function(n){return n?n.toArray?n.toArray():v.isArray(n)||v.isArguments(n)?Wi.call(n):v.values(n):[]},v.map=function(n,e,t){if(k0&&n.map===k0)return n.map(e,t);var i=[];return v.each(n,function(r){i.push(e.call(t,r))}),i},v.keys=function(n){var e=[];return n===null||v.each(n,function(t,i){e[e.length]=i}),e},v.values=function(n){var e=[];return n===null||v.each(n,function(t){e[e.length]=t}),e},v.include=function(n,e){var t=!1;return n===null?t:_0&&n.indexOf===_0?n.indexOf(e)!=-1:(v.each(n,function(i){if(t||(t=i===e))return Cd}),t)},v.includes=function(n,e){return n.indexOf(e)!==-1},v.inherit=function(n,e){return n.prototype=new e,n.prototype.constructor=n,n.superclass=e.prototype,n},v.isObject=function(n){return n===Object(n)&&!v.isArray(n)},v.isEmptyObject=function(n){if(v.isObject(n)){for(var e in n)if(Ba.call(n,e))return!1;return!0}return!1},v.isUndefined=function(n){return n===void 0},v.isString=function(n){return Wo.call(n)=="[object String]"},v.isDate=function(n){return Wo.call(n)=="[object Date]"},v.isNumber=function(n){return Wo.call(n)=="[object Number]"},v.isElement=function(n){return!!(n&&n.nodeType===1)},v.encodeDates=function(n){return v.each(n,function(e,t){v.isDate(e)?n[t]=v.formatDate(e):v.isObject(e)&&(n[t]=v.encodeDates(e))}),n},v.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},v.formatDate=function(n){function e(t){return t<10?"0"+t:t}return n.getUTCFullYear()+"-"+e(n.getUTCMonth()+1)+"-"+e(n.getUTCDate())+"T"+e(n.getUTCHours())+":"+e(n.getUTCMinutes())+":"+e(n.getUTCSeconds())},v.strip_empty_properties=function(n){var e={};return v.each(n,function(t,i){v.isString(t)&&t.length>0&&(e[i]=t)}),e},v.truncate=function(n,e){var t;return typeof n=="string"?t=n.slice(0,e):v.isArray(n)?(t=[],v.each(n,function(i){t.push(v.truncate(i,e))})):v.isObject(n)?(t={},v.each(n,function(i,r){t[r]=v.truncate(i,e)})):t=n,t},v.JSONEncode=function(){return function(n){var e=n,t=function(r){var o=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return o.lastIndex=0,o.test(r)?'"'+r.replace(o,function(a){var c=s[a];return typeof c=="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+r+'"'},i=function(r,o){var s="",a=" ",c=0,u="",l="",d=0,h=s,p=[],m=o[r];switch(m&&typeof m=="object"&&typeof m.toJSON=="function"&&(m=m.toJSON(r)),typeof m){case"string":return t(m);case"number":return isFinite(m)?String(m):"null";case"boolean":case"null":return String(m);case"object":if(!m)return"null";if(s+=a,p=[],Wo.apply(m)==="[object Array]"){for(d=m.length,c=0;c<d;c+=1)p[c]=i(c,m)||"null";return l=p.length===0?"[]":s?`[
73
+ or you can use record.mirror to access the mirror instance during recording.`,Nv={map:{},getId:function(){return console.error(Ir),-1},getNode:function(){return console.error(Ir),null},removeNodeFromMap:function(){console.error(Ir)},has:function(){return console.error(Ir),!1},reset:function(){console.error(Ir)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Nv=new Proxy(Nv,{get:function(n,e,t){return e==="map"&&console.error(Ir),Reflect.get(n,e,t)}}));function Bo(n,e,t){t===void 0&&(t={});var i=null,r=0;return function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];var c=Date.now();!r&&t.leading===!1&&(r=c);var u=e-(c-r),l=this;u<=0||u>e?(i&&(clearTimeout(i),i=null),r=c,n.apply(l,s)):!i&&t.trailing!==!1&&(i=setTimeout(function(){r=t.leading===!1?0:Date.now(),i=null,n.apply(l,s)},u))}}function Ia(n,e,t,i,r){r===void 0&&(r=window);var o=r.Object.getOwnPropertyDescriptor(n,e);return r.Object.defineProperty(n,e,i?t:{set:function(s){var a=this;setTimeout(function(){t.set.call(a,s)},0),o&&o.set&&o.set.call(this,s)}}),function(){return Ia(n,e,o||{},!0)}}function Rr(n,e,t){try{if(!(e in n))return function(){};var i=n[e],r=t(i);return typeof r=="function"&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:i}})),n[e]=r,function(){n[e]=i}}catch{return function(){}}}var Ra=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ra=function(){return new Date().getTime()});function Dv(n){var e,t,i,r,o=n.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:o.documentElement.scrollLeft||(o==null?void 0:o.body)&&((e=se.parentElement(o.body))==null?void 0:e.scrollLeft)||((t=o==null?void 0:o.body)==null?void 0:t.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(o==null?void 0:o.documentElement.scrollTop)||(o==null?void 0:o.body)&&((i=se.parentElement(o.body))==null?void 0:i.scrollTop)||((r=o==null?void 0:o.body)==null?void 0:r.scrollTop)||0}}function Lv(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Uv(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Fv(n){if(!n)return null;var e=n.nodeType===n.ELEMENT_NODE?n:se.parentElement(n);return e}function Rt(n,e,t,i){if(!n)return!1;var r=Fv(n);if(!r)return!1;try{if(typeof e=="string"){if(r.classList.contains(e)||i&&r.closest("."+e)!==null)return!0}else if(js(r,e,i))return!0}catch{}return!!(t&&(r.matches(t)||i&&r.closest(t)!==null))}function HI(n,e){return e.getId(n)!==-1}function pd(n,e,t){return n.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(n)===Co}function Bv(n,e){if(So(n))return!1;var t=e.getId(n);if(!e.has(t))return!0;var i=se.parentNode(n);return i&&i.nodeType===n.DOCUMENT_NODE?!1:i?Bv(i,e):!0}function fd(n){return!!n.changedTouches}function KI(n){n===void 0&&(n=window),"NodeList"in n&&!n.NodeList.prototype.forEach&&(n.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in n&&!n.DOMTokenList.prototype.forEach&&(n.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function jv(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function Vv(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function md(n){return n?ne(n,NI)&&"shadowRoot"in n?!!n.shadowRoot:!!se.shadowRoot(n):!1}var YI=function(){function n(){V(this,"id",1),V(this,"styleIDMap",new WeakMap),V(this,"idStyleMap",new Map)}var e=n.prototype;return e.getId=function(t){var i;return(i=this.styleIDMap.get(t))!=null?i:-1},e.has=function(t){return this.styleIDMap.has(t)},e.add=function(t,i){if(this.has(t))return this.getId(t);var r;return i===void 0?r=this.id++:r=i,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r},e.getStyle=function(t){return this.idStyleMap.get(t)||null},e.reset=function(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1},e.generateId=function(){return this.id++},n}();function zv(n){var e,t=null;return"getRootNode"in n&&((e=se.getRootNode(n))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&se.host(se.getRootNode(n))&&(t=se.host(se.getRootNode(n))),t}function XI(n){for(var e=n,t;t=zv(e);)e=t;return e}function JI(n){var e=n.ownerDocument;if(!e)return!1;var t=XI(n);return se.contains(e,t)}function qv(n){var e=n.ownerDocument;return e?se.contains(e,n)||JI(n):!1}var ce=function(n){return n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n}(ce||{}),Q=function(n){return n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n}(Q||{}),Ut=function(n){return n[n.MouseUp=0]="MouseUp",n[n.MouseDown=1]="MouseDown",n[n.Click=2]="Click",n[n.ContextMenu=3]="ContextMenu",n[n.DblClick=4]="DblClick",n[n.Focus=5]="Focus",n[n.Blur=6]="Blur",n[n.TouchStart=7]="TouchStart",n[n.TouchMove_Departed=8]="TouchMove_Departed",n[n.TouchEnd=9]="TouchEnd",n[n.TouchCancel=10]="TouchCancel",n}(Ut||{}),jn=function(n){return n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n}(jn||{}),Pr=function(n){return n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n}(Pr||{}),Or=function(n){return n[n.Play=0]="Play",n[n.Pause=1]="Pause",n[n.Seeked=2]="Seeked",n[n.VolumeChange=3]="VolumeChange",n[n.RateChange=4]="RateChange",n}(Or||{}),Wv=function(n){return n[n.Document=0]="Document",n[n.DocumentType=1]="DocumentType",n[n.Element=2]="Element",n[n.Text=3]="Text",n[n.CDATA=4]="CDATA",n[n.Comment=5]="Comment",n}(Wv||{});function Gv(n){return"__ln"in n}var ZI=function(){function n(){V(this,"length",0),V(this,"head",null),V(this,"tail",null)}var e=n.prototype;return e.get=function(t){if(t>=this.length)throw new Error("Position outside of list range");for(var i=this.head,r=0;r<t;r++)i=(i==null?void 0:i.next)||null;return i},e.addNode=function(t){var i={value:t,previous:null,next:null};if(t.__ln=i,t.previousSibling&&Gv(t.previousSibling)){var r=t.previousSibling.__ln.next;i.next=r,i.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=i,r&&(r.previous=i)}else if(t.nextSibling&&Gv(t.nextSibling)&&t.nextSibling.__ln.previous){var o=t.nextSibling.__ln.previous;i.previous=o,i.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=i,o&&(o.next=i)}else this.head&&(this.head.previous=i),i.next=this.head,this.head=i;i.next===null&&(this.tail=i),this.length++},e.removeNode=function(t){var i=t.__ln;this.head&&(i.previous?(i.previous.next=i.next,i.next?i.next.previous=i.previous:this.tail=i.previous):(this.head=i.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)},n}(),$v=function(n,e){return n+"@"+e},QI=function(){function n(){var t=this;V(this,"frozen",!1),V(this,"locked",!1),V(this,"texts",[]),V(this,"attributes",[]),V(this,"attributeMap",new WeakMap),V(this,"removes",[]),V(this,"mapRemoves",[]),V(this,"movedMap",{}),V(this,"addedSet",new Set),V(this,"movedSet",new Set),V(this,"droppedSet",new Set),V(this,"removesSubTreeCache",new Set),V(this,"mutationCb"),V(this,"blockClass"),V(this,"blockSelector"),V(this,"maskTextClass"),V(this,"maskTextSelector"),V(this,"inlineStylesheet"),V(this,"maskInputOptions"),V(this,"maskTextFn"),V(this,"maskInputFn"),V(this,"keepIframeSrcFn"),V(this,"recordCanvas"),V(this,"inlineImages"),V(this,"slimDOMOptions"),V(this,"dataURLOptions"),V(this,"doc"),V(this,"mirror"),V(this,"iframeManager"),V(this,"stylesheetManager"),V(this,"shadowDomManager"),V(this,"canvasManager"),V(this,"processedNodeManager"),V(this,"unattachedDoc"),V(this,"processMutations",function(i){i.forEach(t.processMutation),t.emit()}),V(this,"emit",function(){if(!(t.frozen||t.locked)){for(var i=[],r=new Set,o=new ZI,s=function(O){for(var L=O,j=Co;j===Co;)L=L&&L.nextSibling,j=L&&t.mirror.getId(L);return j},a=function(O){var L=se.parentNode(O);if(!(!L||!qv(O))){var j=!1;if(O.nodeType===Node.TEXT_NODE){var X=L.tagName;if(X==="TEXTAREA")return;X==="STYLE"&&t.addedSet.has(L)&&(j=!0)}var W=So(L)?t.mirror.getId(zv(O)):t.mirror.getId(L),A=s(O);if(W===-1||A===-1)return o.addNode(O);var H=kr(O,{doc:t.doc,mirror:t.mirror,blockClass:t.blockClass,blockSelector:t.blockSelector,maskTextClass:t.maskTextClass,maskTextSelector:t.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:t.inlineStylesheet,maskInputOptions:t.maskInputOptions,maskTextFn:t.maskTextFn,maskInputFn:t.maskInputFn,slimDOMOptions:t.slimDOMOptions,dataURLOptions:t.dataURLOptions,recordCanvas:t.recordCanvas,inlineImages:t.inlineImages,onSerialize:function(Y){jv(Y,t.mirror)&&t.iframeManager.addIframe(Y),Vv(Y,t.mirror)&&t.stylesheetManager.trackLinkElement(Y),md(O)&&t.shadowDomManager.addShadowRoot(se.shadowRoot(O),t.doc)},onIframeLoad:function(Y,J){t.iframeManager.attachIframe(Y,J),t.shadowDomManager.observeAttachShadow(Y)},onStylesheetLoad:function(Y,J){t.stylesheetManager.attachLinkElement(Y,J)},cssCaptured:j});H&&(i.push({parentId:W,nextId:A,node:H}),r.add(H.id))}};t.mapRemoves.length;)t.mirror.removeNodeFromMap(t.mapRemoves.shift());for(var c=K(t.movedSet),u;!(u=c()).done;){var l=u.value;Hv(t.removesSubTreeCache,l,t.mirror)&&!t.movedSet.has(se.parentNode(l))||a(l)}for(var d=K(t.addedSet),h;!(h=d()).done;){var p=h.value;!Kv(t.droppedSet,p)&&!Hv(t.removesSubTreeCache,p,t.mirror)||Kv(t.movedSet,p)?a(p):t.droppedSet.add(p)}for(var m=null;o.length;){var f=null;if(m){var g=t.mirror.getId(se.parentNode(m.value)),y=s(m.value);g!==-1&&y!==-1&&(f=m)}if(!f)for(var b=o.tail;b;){var S=b;if(b=b.previous,S){var w=t.mirror.getId(se.parentNode(S.value)),k=s(S.value);if(k===-1)continue;if(w!==-1){f=S;break}else{var C=S.value,x=se.parentNode(C);if(x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var I=se.host(x),P=t.mirror.getId(I);if(P!==-1){f=S;break}}}}}if(!f){for(;o.head;)o.removeNode(o.head.value);break}m=f.previous,o.removeNode(f.value),a(f.value)}var D={texts:t.texts.map(function(O){var L=O.node,j=se.parentNode(L);return j&&j.tagName==="TEXTAREA"&&t.genTextAreaValueMutation(j),{id:t.mirror.getId(L),value:O.value}}).filter(function(O){return!r.has(O.id)}).filter(function(O){return t.mirror.has(O.id)}),attributes:t.attributes.map(function(O){var L=O.attributes;if(typeof L.style=="string"){var j=JSON.stringify(O.styleDiff),X=JSON.stringify(O._unchangedStyles);j.length<L.style.length&&(j+X).split("var(").length===L.style.split("var(").length&&(L.style=O.styleDiff)}return{id:t.mirror.getId(O.node),attributes:L}}).filter(function(O){return!r.has(O.id)}).filter(function(O){return t.mirror.has(O.id)}),removes:t.removes,adds:i};!D.texts.length&&!D.attributes.length&&!D.removes.length&&!D.adds.length||(t.texts=[],t.attributes=[],t.attributeMap=new WeakMap,t.removes=[],t.addedSet=new Set,t.movedSet=new Set,t.droppedSet=new Set,t.removesSubTreeCache=new Set,t.movedMap={},t.mutationCb(D))}}),V(this,"genTextAreaValueMutation",function(i){var r=t.attributeMap.get(i);r||(r={node:i,attributes:{},styleDiff:{},_unchangedStyles:{}},t.attributes.push(r),t.attributeMap.set(i,r)),r.attributes.value=Array.from(se.childNodes(i),function(o){return se.textContent(o)||""}).join("")}),V(this,"processMutation",function(i){if(!pd(i.target,t.mirror,t.slimDOMOptions))switch(i.type){case"characterData":{var r=se.textContent(i.target);!Rt(i.target,t.blockClass,t.blockSelector,!1)&&r!==i.oldValue&&t.texts.push({value:Dm(i.target,t.maskTextClass,t.maskTextSelector,!0)&&r?t.maskTextFn?t.maskTextFn(r,Fv(i.target)):r.replace(/[\S]/g,"*"):r,node:i.target});break}case"attributes":{var o=i.target,s=i.attributeName,a=i.target.getAttribute(s);if(s==="value"){var c=il(o);a=nl({element:o,maskInputOptions:t.maskInputOptions,tagName:o.tagName,type:c,value:a,maskInputFn:t.maskInputFn})}if(Rt(i.target,t.blockClass,t.blockSelector,!1)||a===i.oldValue)return;var u=t.attributeMap.get(i.target);if(o.tagName==="IFRAME"&&s==="src"&&!t.keepIframeSrcFn(a))if(!o.contentDocument)s="rr_src";else return;if(u||(u={node:i.target,attributes:{},styleDiff:{},_unchangedStyles:{}},t.attributes.push(u),t.attributeMap.set(i.target,u)),s==="type"&&o.tagName==="INPUT"&&(i.oldValue||"").toLowerCase()==="password"&&o.setAttribute("data-rr-is-password","true"),!Nm(o.tagName,s))if(u.attributes[s]=Mm(t.doc,ji(o.tagName),ji(s),a),s==="style"){if(!t.unattachedDoc)try{t.unattachedDoc=document.implementation.createHTMLDocument()}catch{t.unattachedDoc=t.doc}var l=t.unattachedDoc.createElement("span");i.oldValue&&l.setAttribute("style",i.oldValue);for(var d=K(Array.from(o.style)),h;!(h=d()).done;){var p=h.value,m=o.style.getPropertyValue(p),f=o.style.getPropertyPriority(p);m!==l.style.getPropertyValue(p)||f!==l.style.getPropertyPriority(p)?f===""?u.styleDiff[p]=m:u.styleDiff[p]=[m,f]:u._unchangedStyles[p]=[m,f]}for(var g=K(Array.from(l.style)),y;!(y=g()).done;){var b=y.value;o.style.getPropertyValue(b)===""&&(u.styleDiff[b]=!1)}}else s==="open"&&o.tagName==="DIALOG"&&(o.matches("dialog:modal")?u.attributes.rr_open_mode="modal":u.attributes.rr_open_mode="non-modal");break}case"childList":{if(Rt(i.target,t.blockClass,t.blockSelector,!0))return;if(i.target.tagName==="TEXTAREA"){t.genTextAreaValueMutation(i.target);return}i.addedNodes.forEach(function(S){return t.genAdds(S,i.target)}),i.removedNodes.forEach(function(S){var w=t.mirror.getId(S),k=So(i.target)?t.mirror.getId(se.host(i.target)):t.mirror.getId(i.target);Rt(i.target,t.blockClass,t.blockSelector,!1)||pd(S,t.mirror,t.slimDOMOptions)||!HI(S,t.mirror)||(t.addedSet.has(S)?(gd(t.addedSet,S),t.droppedSet.add(S)):t.addedSet.has(i.target)&&w===-1||Bv(i.target,t.mirror)||(t.movedSet.has(S)&&t.movedMap[$v(w,k)]?gd(t.movedSet,S):(t.removes.push({parentId:k,id:w,isShadow:So(i.target)&&wo(i.target)?!0:void 0}),eR(S,t.removesSubTreeCache))),t.mapRemoves.push(S))});break}}}),V(this,"genAdds",function(i,r){if(!t.processedNodeManager.inOtherBuffer(i,t)&&!(t.addedSet.has(i)||t.movedSet.has(i))){if(t.mirror.hasNode(i)){if(pd(i,t.mirror,t.slimDOMOptions))return;t.movedSet.add(i);var o=null;r&&t.mirror.hasNode(r)&&(o=t.mirror.getId(r)),o&&o!==-1&&(t.movedMap[$v(t.mirror.getId(i),o)]=!0)}else t.addedSet.add(i),t.droppedSet.delete(i);Rt(i,t.blockClass,t.blockSelector,!1)||(se.childNodes(i).forEach(function(s){return t.genAdds(s)}),md(i)&&se.childNodes(se.shadowRoot(i)).forEach(function(s){t.processedNodeManager.add(s,t),t.genAdds(s,i)}))}})}var e=n.prototype;return e.init=function(t){var i=this;["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(function(r){i[r]=t[r]})},e.freeze=function(){this.frozen=!0,this.canvasManager.freeze()},e.unfreeze=function(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()},e.isFrozen=function(){return this.frozen},e.lock=function(){this.locked=!0,this.canvasManager.lock()},e.unlock=function(){this.locked=!1,this.canvasManager.unlock(),this.emit()},e.reset=function(){this.shadowDomManager.reset(),this.canvasManager.reset()},n}();function gd(n,e){n.delete(e),se.childNodes(e).forEach(function(t){return gd(n,t)})}function eR(n,e){for(var t=[n];t.length;){var i=t.pop();e.has(i)||(e.add(i),se.childNodes(i).forEach(function(r){return t.push(r)}))}}function Hv(n,e,t){return n.size===0?!1:tR(n,e)}function tR(n,e,t){var i=se.parentNode(e);return i?n.has(i):!1}function Kv(n,e){return n.size===0?!1:Yv(n,e)}function Yv(n,e){var t=se.parentNode(e);return t?n.has(t)?!0:Yv(n,t):!1}var jo;function nR(n){jo=n}function iR(){jo=void 0}var he=function(n){if(!jo)return n;var e=function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];try{return n.apply(void 0,[].concat(i))}catch(o){if(jo&&jo(o)===!0)return;throw o}};return e},qi=[];function Vo(n){try{if("composedPath"in n){var e=n.composedPath();if(e.length)return e[0]}else if("path"in n&&n.path.length)return n.path[0]}catch{}return n&&n.target}function Xv(n,e){var t=new QI;qi.push(t),t.init(n);var i=new(Mv())(he(t.processMutations.bind(t)));return i.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function rR(n){var e=n.mousemoveCb,t=n.sampling,i=n.doc,r=n.mirror;if(t.mousemove===!1)return function(){};var o=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],c,u=Bo(he(function(h){var p=Date.now()-c;e(a.map(function(m){return m.timeOffset-=p,m}),h),a=[],c=null}),s),l=he(Bo(he(function(h){var p=Vo(h),m=fd(h)?h.changedTouches[0]:h,f=m.clientX,g=m.clientY;c||(c=Ra()),a.push({x:f,y:g,id:r.getId(p),timeOffset:Ra()-c}),u(typeof DragEvent<"u"&&ne(h,DragEvent)?Q.Drag:ne(h,MouseEvent)?Q.MouseMove:Q.TouchMove)}),o,{trailing:!1})),d=[It("mousemove",l,i),It("touchmove",l,i),It("drag",l,i)];return he(function(){d.forEach(function(h){return h()})})}function oR(n){var e=n.mouseInteractionCb,t=n.doc,i=n.mirror,r=n.blockClass,o=n.blockSelector,s=n.sampling;if(s.mouseInteraction===!1)return function(){};var a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,c=[],u=null,l=function(d){return function(h){var p=Vo(h);if(!Rt(p,r,o,!0)){var m=null,f=d;if("pointerType"in h){switch(h.pointerType){case"mouse":m=jn.Mouse;break;case"touch":m=jn.Touch;break;case"pen":m=jn.Pen;break}m===jn.Touch?Ut[d]===Ut.MouseDown?f="TouchStart":Ut[d]===Ut.MouseUp&&(f="TouchEnd"):jn.Pen}else fd(h)&&(m=jn.Touch);m!==null?(u=m,(f.startsWith("Touch")&&m===jn.Touch||f.startsWith("Mouse")&&m===jn.Mouse)&&(m=null)):Ut[d]===Ut.Click&&(m=u,u=null);var g=fd(h)?h.changedTouches[0]:h;if(g){var y=i.getId(p),b=g.clientX,S=g.clientY;he(e)(fe({type:Ut[f],id:y,x:b,y:S},m!==null&&{pointerType:m}))}}}};return Object.keys(Ut).filter(function(d){return Number.isNaN(Number(d))&&!d.endsWith("_Departed")&&a[d]!==!1}).forEach(function(d){var h=ji(d),p=l(d);if(window.PointerEvent)switch(Ut[d]){case Ut.MouseDown:case Ut.MouseUp:h=h.replace("mouse","pointer");break;case Ut.TouchStart:case Ut.TouchEnd:return}c.push(It(h,p,t))}),he(function(){c.forEach(function(d){return d()})})}function Jv(n){var e=n.scrollCb,t=n.doc,i=n.mirror,r=n.blockClass,o=n.blockSelector,s=n.sampling,a=he(Bo(he(function(c){var u=Vo(c);if(!(!u||Rt(u,r,o,!0))){var l=i.getId(u);if(u===t&&t.defaultView){var d=Dv(t.defaultView);e({id:l,x:d.left,y:d.top})}else e({id:l,x:u.scrollLeft,y:u.scrollTop})}}),s.scroll||100));return It("scroll",a,t)}function sR(n,e){var t=n.viewportResizeCb,i=e.win,r=-1,o=-1,s=he(Bo(he(function(){var a=Lv(),c=Uv();(r!==a||o!==c)&&(t({width:Number(c),height:Number(a)}),r=a,o=c)}),200));return It("resize",s,i)}var aR=["INPUT","TEXTAREA","SELECT"],Zv=new WeakMap;function cR(n){var e=n.inputCb,t=n.doc,i=n.mirror,r=n.blockClass,o=n.blockSelector,s=n.ignoreClass,a=n.ignoreSelector,c=n.maskInputOptions,u=n.maskInputFn,l=n.sampling,d=n.userTriggeredOnInput;function h(w){var k=Vo(w),C=w.isTrusted,x=k&&k.tagName;if(k&&x==="OPTION"&&(k=se.parentElement(k)),!(!k||!x||aR.indexOf(x)<0||Rt(k,r,o,!0))&&!(k.classList.contains(s)||a&&k.matches(a))){var I=k.value,P=!1,D=il(k)||"";D==="radio"||D==="checkbox"?P=k.checked:(c[x.toLowerCase()]||c[D])&&(I=nl({element:k,maskInputOptions:c,tagName:x,type:D,value:I,maskInputFn:u})),p(k,d?{text:I,isChecked:P,userTriggered:C}:{text:I,isChecked:P});var O=k.name;D==="radio"&&O&&P&&t.querySelectorAll('input[type="radio"][name="'+O+'"]').forEach(function(L){if(L!==k){var j=L.value;p(L,d?{text:j,isChecked:!P,userTriggered:!1}:{text:j,isChecked:!P})}})}}function p(w,k){var C=Zv.get(w);if(!C||C.text!==k.text||C.isChecked!==k.isChecked){Zv.set(w,k);var x=i.getId(w);he(e)(fe({},k,{id:x}))}}var m=l.input==="last"?["change"]:["input","change"],f=m.map(function(w){return It(w,he(h),t)}),g=t.defaultView;if(!g)return function(){f.forEach(function(w){return w()})};var y=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),b=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];if(y&&y.set){var S;(S=f).push.apply(S,[].concat(b.map(function(w){return Ia(w[0],w[1],{set:function(){he(h)({target:this,isTrusted:!1})}},!1,g)})))}return he(function(){f.forEach(function(w){return w()})})}function Pa(n){var e=[];function t(i,r){if(Oa("CSSGroupingRule")&&ne(i.parentRule,CSSGroupingRule)||Oa("CSSMediaRule")&&ne(i.parentRule,CSSMediaRule)||Oa("CSSSupportsRule")&&ne(i.parentRule,CSSSupportsRule)||Oa("CSSConditionRule")&&ne(i.parentRule,CSSConditionRule)){var o=Array.from(i.parentRule.cssRules),s=o.indexOf(i);r.unshift(s)}else if(i.parentStyleSheet){var a=Array.from(i.parentStyleSheet.cssRules),c=a.indexOf(i);r.unshift(c)}return r}return t(n,e)}function oi(n,e,t){var i,r;return n?(n.ownerNode?i=e.getId(n.ownerNode):r=t.getId(n),{styleId:r,id:i}):{}}function uR(n,e){var t=n.styleSheetRuleCb,i=n.mirror,r=n.stylesheetManager,o=e.win;if(!o.CSSStyleSheet||!o.CSSStyleSheet.prototype)return function(){};var s=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:he(function(h,p,m){var f=m[0],g=m[1],y=oi(p,i,r.styleMirror),b=y.id,S=y.styleId;return(b&&b!==-1||S&&S!==-1)&&t({id:b,styleId:S,adds:[{rule:f,index:g}]}),h.apply(p,m)})}),o.CSSStyleSheet.prototype.addRule=function(h,p,m){m===void 0&&(m=this.cssRules.length);var f=h+" { "+p+" }";return o.CSSStyleSheet.prototype.insertRule.apply(this,[f,m])};var a=o.CSSStyleSheet.prototype.deleteRule;o.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:he(function(h,p,m){var f=m[0],g=oi(p,i,r.styleMirror),y=g.id,b=g.styleId;return(y&&y!==-1||b&&b!==-1)&&t({id:y,styleId:b,removes:[{index:f}]}),h.apply(p,m)})}),o.CSSStyleSheet.prototype.removeRule=function(h){return o.CSSStyleSheet.prototype.deleteRule.apply(this,[h])};var c;o.CSSStyleSheet.prototype.replace&&(c=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=new Proxy(c,{apply:he(function(h,p,m){var f=m[0],g=oi(p,i,r.styleMirror),y=g.id,b=g.styleId;return(y&&y!==-1||b&&b!==-1)&&t({id:y,styleId:b,replace:f}),h.apply(p,m)})}));var u;o.CSSStyleSheet.prototype.replaceSync&&(u=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:he(function(h,p,m){var f=m[0],g=oi(p,i,r.styleMirror),y=g.id,b=g.styleId;return(y&&y!==-1||b&&b!==-1)&&t({id:y,styleId:b,replaceSync:f}),h.apply(p,m)})}));var l={};Aa("CSSGroupingRule")?l.CSSGroupingRule=o.CSSGroupingRule:(Aa("CSSMediaRule")&&(l.CSSMediaRule=o.CSSMediaRule),Aa("CSSConditionRule")&&(l.CSSConditionRule=o.CSSConditionRule),Aa("CSSSupportsRule")&&(l.CSSSupportsRule=o.CSSSupportsRule));var d={};return Object.entries(l).forEach(function(h){var p=h[0],m=h[1];d[p]={insertRule:m.prototype.insertRule,deleteRule:m.prototype.deleteRule},m.prototype.insertRule=new Proxy(d[p].insertRule,{apply:he(function(f,g,y){var b=y[0],S=y[1],w=oi(g.parentStyleSheet,i,r.styleMirror),k=w.id,C=w.styleId;return(k&&k!==-1||C&&C!==-1)&&t({id:k,styleId:C,adds:[{rule:b,index:[].concat(Pa(g),[S||0])}]}),f.apply(g,y)})}),m.prototype.deleteRule=new Proxy(d[p].deleteRule,{apply:he(function(f,g,y){var b=y[0],S=oi(g.parentStyleSheet,i,r.styleMirror),w=S.id,k=S.styleId;return(w&&w!==-1||k&&k!==-1)&&t({id:w,styleId:k,removes:[{index:[].concat(Pa(g),[b])}]}),f.apply(g,y)})})}),he(function(){o.CSSStyleSheet.prototype.insertRule=s,o.CSSStyleSheet.prototype.deleteRule=a,c&&(o.CSSStyleSheet.prototype.replace=c),u&&(o.CSSStyleSheet.prototype.replaceSync=u),Object.entries(l).forEach(function(h){var p=h[0],m=h[1];m.prototype.insertRule=d[p].insertRule,m.prototype.deleteRule=d[p].deleteRule})})}function Qv(n,e){var t=n.mirror,i=n.stylesheetManager,r,o,s,a=null;e.nodeName==="#document"?a=t.getId(e):a=t.getId(se.host(e));var c=e.nodeName==="#document"?(r=e.defaultView)==null?void 0:r.Document:(s=(o=e.ownerDocument)==null?void 0:o.defaultView)==null?void 0:s.ShadowRoot,u=c!=null&&c.prototype?Object.getOwnPropertyDescriptor(c==null?void 0:c.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!c||!u?function(){}:(Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:function(){var l;return(l=u.get)==null?void 0:l.call(this)},set:function(l){var d,h=(d=u.set)==null?void 0:d.call(this,l);if(a!==null&&a!==-1)try{i.adoptStyleSheets(l,a)}catch{}return h}}),he(function(){Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))}function lR(n,e){var t=n.styleDeclarationCb,i=n.mirror,r=n.ignoreCSSAttributes,o=n.stylesheetManager,s=e.win,a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:he(function(u,l,d){var h,p=d[0],m=d[1],f=d[2];if(r.has(p))return a.apply(l,[p,m,f]);var g=oi((h=l.parentRule)==null?void 0:h.parentStyleSheet,i,o.styleMirror),y=g.id,b=g.styleId;return(y&&y!==-1||b&&b!==-1)&&t({id:y,styleId:b,set:{property:p,value:m,priority:f},index:Pa(l.parentRule)}),u.apply(l,d)})});var c=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:he(function(u,l,d){var h,p=d[0];if(r.has(p))return c.apply(l,[p]);var m=oi((h=l.parentRule)==null?void 0:h.parentStyleSheet,i,o.styleMirror),f=m.id,g=m.styleId;return(f&&f!==-1||g&&g!==-1)&&t({id:f,styleId:g,remove:{property:p},index:Pa(l.parentRule)}),u.apply(l,d)})}),he(function(){s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=c})}function dR(n){var e=n.mediaInteractionCb,t=n.blockClass,i=n.blockSelector,r=n.mirror,o=n.sampling,s=n.doc,a=he(function(u){return Bo(he(function(l){var d=Vo(l);if(!(!d||Rt(d,t,i,!0))){var h=d.currentTime,p=d.volume,m=d.muted,f=d.playbackRate,g=d.loop;e({type:u,id:r.getId(d),currentTime:h,volume:p,muted:m,playbackRate:f,loop:g})}}),o.media||500)}),c=[It("play",a(Or.Play),s),It("pause",a(Or.Pause),s),It("seeked",a(Or.Seeked),s),It("volumechange",a(Or.VolumeChange),s),It("ratechange",a(Or.RateChange),s)];return he(function(){c.forEach(function(u){return u()})})}function hR(n){var e=n.fontCb,t=n.doc,i=t.defaultView;if(!i)return function(){};var r=[],o=new WeakMap,s=i.FontFace;i.FontFace=function(c,u,l){var d=new s(c,u,l);return o.set(d,{family:c,buffer:typeof u!="string",descriptors:l,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};var a=Rr(t.fonts,"add",function(c){return function(u){return setTimeout(he(function(){var l=o.get(u);l&&(e(l),o.delete(u))}),0),c.apply(this,[u])}});return r.push(function(){i.FontFace=s}),r.push(a),he(function(){r.forEach(function(c){return c()})})}function pR(n){var e=n.doc,t=n.mirror,i=n.blockClass,r=n.blockSelector,o=n.selectionCb,s=!0,a=he(function(){var c=e.getSelection();if(!(!c||s&&(c!=null&&c.isCollapsed))){s=c.isCollapsed||!1;for(var u=[],l=c.rangeCount||0,d=0;d<l;d++){var h=c.getRangeAt(d),p=h.startContainer,m=h.startOffset,f=h.endContainer,g=h.endOffset,y=Rt(p,i,r,!0)||Rt(f,i,r,!0);y||u.push({start:t.getId(p),startOffset:m,end:t.getId(f),endOffset:g})}o({ranges:u})}});return a(),It("selectionchange",a)}function fR(n){var e=n.doc,t=n.customElementCb,i=e.defaultView;if(!i||!i.customElements)return function(){};var r=Rr(i.customElements,"define",function(o){return function(s,a,c){try{t({define:{name:s}})}catch{console.warn("Custom element callback failed for "+s)}return o.apply(this,[s,a,c])}});return r}function mR(n,e){var t=n.mutationCb,i=n.mousemoveCb,r=n.mouseInteractionCb,o=n.scrollCb,s=n.viewportResizeCb,a=n.inputCb,c=n.mediaInteractionCb,u=n.styleSheetRuleCb,l=n.styleDeclarationCb,d=n.canvasMutationCb,h=n.fontCb,p=n.selectionCb,m=n.customElementCb;n.mutationCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.mutation){var b;(b=e).mutation.apply(b,[].concat(g))}t.apply(void 0,[].concat(g))},n.mousemoveCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.mousemove){var b;(b=e).mousemove.apply(b,[].concat(g))}i.apply(void 0,[].concat(g))},n.mouseInteractionCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.mouseInteraction){var b;(b=e).mouseInteraction.apply(b,[].concat(g))}r.apply(void 0,[].concat(g))},n.scrollCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.scroll){var b;(b=e).scroll.apply(b,[].concat(g))}o.apply(void 0,[].concat(g))},n.viewportResizeCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.viewportResize){var b;(b=e).viewportResize.apply(b,[].concat(g))}s.apply(void 0,[].concat(g))},n.inputCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.input){var b;(b=e).input.apply(b,[].concat(g))}a.apply(void 0,[].concat(g))},n.mediaInteractionCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.mediaInteaction){var b;(b=e).mediaInteaction.apply(b,[].concat(g))}c.apply(void 0,[].concat(g))},n.styleSheetRuleCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.styleSheetRule){var b;(b=e).styleSheetRule.apply(b,[].concat(g))}u.apply(void 0,[].concat(g))},n.styleDeclarationCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.styleDeclaration){var b;(b=e).styleDeclaration.apply(b,[].concat(g))}l.apply(void 0,[].concat(g))},n.canvasMutationCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.canvasMutation){var b;(b=e).canvasMutation.apply(b,[].concat(g))}d.apply(void 0,[].concat(g))},n.fontCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.font){var b;(b=e).font.apply(b,[].concat(g))}h.apply(void 0,[].concat(g))},n.selectionCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.selection){var b;(b=e).selection.apply(b,[].concat(g))}p.apply(void 0,[].concat(g))},n.customElementCb=function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];if(e.customElement){var b;(b=e).customElement.apply(b,[].concat(g))}m.apply(void 0,[].concat(g))}}function gR(n,e){e===void 0&&(e={});var t=n.doc.defaultView;if(!t)return function(){};mR(n,e);var i;n.recordDOM&&(i=Xv(n,n.doc));var r=rR(n),o=oR(n),s=Jv(n),a=sR(n,{win:t}),c=cR(n),u=dR(n),l=function(){},d=function(){},h=function(){},p=function(){};n.recordDOM&&(l=uR(n,{win:t}),d=Qv(n,n.doc),h=lR(n,{win:t}),n.collectFonts&&(p=hR(n)));for(var m=pR(n),f=fR(n),g=[],y=K(n.plugins),b;!(b=y()).done;){var S=b.value;g.push(S.observer(S.callback,t,S.options))}return he(function(){qi.forEach(function(w){return w.reset()}),i==null||i.disconnect(),r(),o(),s(),a(),c(),u(),l(),d(),h(),p(),m(),f(),g.forEach(function(w){return w()})})}function Oa(n){return typeof window[n]<"u"}function Aa(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}for(var e0=function(){function n(t){V(this,"iframeIdToRemoteIdMap",new WeakMap),V(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}var e=n.prototype;return e.getId=function(t,i,r,o){var s=r||this.getIdToRemoteIdMap(t),a=o||this.getRemoteIdToIdMap(t),c=s.get(i);return c||(c=this.generateIdFn(),s.set(i,c),a.set(c,i)),c},e.getIds=function(t,i){var r=this,o=this.getIdToRemoteIdMap(t),s=this.getRemoteIdToIdMap(t);return i.map(function(a){return r.getId(t,a,o,s)})},e.getRemoteId=function(t,i,r){var o=r||this.getRemoteIdToIdMap(t);if(typeof i!="number")return i;var s=o.get(i);return s||-1},e.getRemoteIds=function(t,i){var r=this,o=this.getRemoteIdToIdMap(t);return i.map(function(s){return r.getRemoteId(t,s,o)})},e.reset=function(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)},e.getIdToRemoteIdMap=function(t){var i=this.iframeIdToRemoteIdMap.get(t);return i||(i=new Map,this.iframeIdToRemoteIdMap.set(t,i)),i},e.getRemoteIdToIdMap=function(t){var i=this.iframeRemoteIdToIdMap.get(t);return i||(i=new Map,this.iframeRemoteIdToIdMap.set(t,i)),i},n}(),vR=function(){function n(t){V(this,"iframes",new WeakMap),V(this,"crossOriginIframeMap",new WeakMap),V(this,"crossOriginIframeMirror",new e0(Pm)),V(this,"crossOriginIframeStyleMirror"),V(this,"crossOriginIframeRootIdMap",new WeakMap),V(this,"mirror"),V(this,"mutationCb"),V(this,"wrappedEmit"),V(this,"loadListener"),V(this,"stylesheetManager"),V(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new e0(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}var e=n.prototype;return e.addIframe=function(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)},e.addLoadListener=function(t){this.loadListener=t},e.attachIframe=function(t,i){var r,o;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:i}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=t.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(o=this.loadListener)==null||o.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))},e.handleMessage=function(t){var i=t;if(!(i.data.type!=="rrweb"||i.origin!==i.data.origin)){var r=t.source;if(r){var o=this.crossOriginIframeMap.get(t.source);if(o){var s=this.transformCrossOriginEvent(o,i.data.event);s&&this.wrappedEmit(s,i.data.isCheckout)}}}},e.transformCrossOriginEvent=function(t,i){var r=this,o;switch(i.type){case ce.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(i.data.node,t);var s=i.data.node.id;return this.crossOriginIframeRootIdMap.set(t,s),this.patchRootIdOnNode(i.data.node,s),{timestamp:i.timestamp,type:ce.IncrementalSnapshot,data:{source:Q.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:i.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case ce.Meta:case ce.Load:case ce.DomContentLoaded:return!1;case ce.Plugin:return i;case ce.Custom:return this.replaceIds(i.data.payload,t,["id","parentId","previousId","nextId"]),i;case ce.IncrementalSnapshot:switch(i.data.source){case Q.Mutation:return i.data.adds.forEach(function(a){r.replaceIds(a,t,["parentId","nextId","previousId"]),r.replaceIdOnNode(a.node,t);var c=r.crossOriginIframeRootIdMap.get(t);c&&r.patchRootIdOnNode(a.node,c)}),i.data.removes.forEach(function(a){r.replaceIds(a,t,["parentId","id"])}),i.data.attributes.forEach(function(a){r.replaceIds(a,t,["id"])}),i.data.texts.forEach(function(a){r.replaceIds(a,t,["id"])}),i;case Q.Drag:case Q.TouchMove:case Q.MouseMove:return i.data.positions.forEach(function(a){r.replaceIds(a,t,["id"])}),i;case Q.ViewportResize:return!1;case Q.MediaInteraction:case Q.MouseInteraction:case Q.Scroll:case Q.CanvasMutation:case Q.Input:return this.replaceIds(i.data,t,["id"]),i;case Q.StyleSheetRule:case Q.StyleDeclaration:return this.replaceIds(i.data,t,["id"]),this.replaceStyleIds(i.data,t,["styleId"]),i;case Q.Font:return i;case Q.Selection:return i.data.ranges.forEach(function(a){r.replaceIds(a,t,["start","end"])}),i;case Q.AdoptedStyleSheet:return this.replaceIds(i.data,t,["id"]),this.replaceStyleIds(i.data,t,["styleIds"]),(o=i.data.styles)==null||o.forEach(function(a){r.replaceStyleIds(a,t,["styleId"])}),i}}return!1},e.replace=function(t,i,r,o){for(var s=K(o),a;!(a=s()).done;){var c=a.value;!Array.isArray(i[c])&&typeof i[c]!="number"||(Array.isArray(i[c])?i[c]=t.getIds(r,i[c]):i[c]=t.getId(r,i[c]))}return i},e.replaceIds=function(t,i,r){return this.replace(this.crossOriginIframeMirror,t,i,r)},e.replaceStyleIds=function(t,i,r){return this.replace(this.crossOriginIframeStyleMirror,t,i,r)},e.replaceIdOnNode=function(t,i){var r=this;this.replaceIds(t,i,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(function(o){r.replaceIdOnNode(o,i)})},e.patchRootIdOnNode=function(t,i){var r=this;t.type!==Wv.Document&&!t.rootId&&(t.rootId=i),"childNodes"in t&&t.childNodes.forEach(function(o){r.patchRootIdOnNode(o,i)})},n}(),yR=function(){function n(t){V(this,"shadowDoms",new WeakSet),V(this,"mutationCb"),V(this,"scrollCb"),V(this,"bypassOptions"),V(this,"mirror"),V(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}var e=n.prototype;return e.init=function(){this.reset(),this.patchAttachShadow(Element,document)},e.addShadowRoot=function(t,i){var r=this;if(wo(t)&&!this.shadowDoms.has(t)){this.shadowDoms.add(t);var o=Xv(fe({},this.bypassOptions,{doc:i,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(function(){return o.disconnect()}),this.restoreHandlers.push(Jv(fe({},this.bypassOptions,{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(function(){t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&r.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,r.mirror.getId(se.host(t))),r.restoreHandlers.push(Qv({mirror:r.mirror,stylesheetManager:r.bypassOptions.stylesheetManager},t))},0)}},e.observeAttachShadow=function(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)},e.patchAttachShadow=function(t,i){var r=this;this.restoreHandlers.push(Rr(t.prototype,"attachShadow",function(o){return function(s){var a=o.call(this,s),c=se.shadowRoot(this);return c&&qv(this)&&r.addShadowRoot(c,i),a}}))},e.reset=function(){this.restoreHandlers.forEach(function(t){try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet},n}(),Ar="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bR=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ma=0;Ma<Ar.length;Ma++)bR[Ar.charCodeAt(Ma)]=Ma;var _R=function(n){var e=new Uint8Array(n),t,i=e.length,r="";for(t=0;t<i;t+=3)r+=Ar[e[t]>>2],r+=Ar[(e[t]&3)<<4|e[t+1]>>4],r+=Ar[(e[t+1]&15)<<2|e[t+2]>>6],r+=Ar[e[t+2]&63];return i%3===2?r=r.substring(0,r.length-1)+"=":i%3===1&&(r=r.substring(0,r.length-2)+"=="),r},t0=new Map;function kR(n,e){var t=t0.get(n);return t||(t=new Map,t0.set(n,t)),t.has(e)||t.set(e,[]),t.get(e)}var n0=function(n,e,t){if(!(!n||!(r0(n,e)||(typeof n>"u"?"undefined":oe(n))==="object"))){var i=n.constructor.name,r=kR(t,i),o=r.indexOf(n);return o===-1&&(o=r.length,r.push(n)),o}};function Na(n,e,t){if(ne(n,Array))return n.map(function(m){return Na(m,e,t)});if(n===null)return n;if(ne(n,Float32Array)||ne(n,Float64Array)||ne(n,Int32Array)||ne(n,Uint32Array)||ne(n,Uint8Array)||ne(n,Uint16Array)||ne(n,Int16Array)||ne(n,Int8Array)||ne(n,Uint8ClampedArray)){var i=n.constructor.name;return{rr_type:i,args:[Object.values(n)]}}else if(ne(n,ArrayBuffer)){var r=n.constructor.name,o=_R(n);return{rr_type:r,base64:o}}else if(ne(n,DataView)){var s=n.constructor.name;return{rr_type:s,args:[Na(n.buffer,e,t),n.byteOffset,n.byteLength]}}else if(ne(n,HTMLImageElement)){var a=n.constructor.name,c=n.src;return{rr_type:a,src:c}}else if(ne(n,HTMLCanvasElement)){var u="HTMLImageElement",l=n.toDataURL();return{rr_type:u,src:l}}else if(ne(n,ImageData)){var d=n.constructor.name;return{rr_type:d,args:[Na(n.data,e,t),n.width,n.height]}}else if(r0(n,e)||(typeof n>"u"?"undefined":oe(n))==="object"){var h=n.constructor.name,p=n0(n,e,t);return{rr_type:h,index:p}}return n}var i0=function(n,e,t){return n.map(function(i){return Na(i,e,t)})},r0=function(n,e){var t=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"],i=t.filter(function(r){return typeof e[r]=="function"});return!!i.find(function(r){return ne(n,e[r])})};function SR(n,e,t,i){for(var r=function(){var u=c.value;try{if(typeof e.CanvasRenderingContext2D.prototype[u]!="function")return"continue";var l=Rr(e.CanvasRenderingContext2D.prototype,u,function(h){return function(){for(var p=this,m=arguments.length,f=new Array(m),g=0;g<m;g++)f[g]=arguments[g];return Rt(this.canvas,t,i,!0)||setTimeout(function(){var y=i0(f,e,p);n(p.canvas,{type:Pr["2D"],property:u,args:y})},0),h.apply(this,f)}});o.push(l)}catch{var d=Ia(e.CanvasRenderingContext2D.prototype,u,{set:function(h){n(this.canvas,{type:Pr["2D"],property:u,args:[h],setter:!0})}});o.push(d)}},o=[],s=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype),a=K(s),c;!(c=a()).done;)r();return function(){o.forEach(function(u){return u()})}}function wR(n){return n==="experimental-webgl"?"webgl":n}function o0(n,e,t,i){var r=[];try{var o=Rr(n.HTMLCanvasElement.prototype,"getContext",function(s){return function(a){for(var c=arguments.length,u=new Array(c>1?c-1:0),l=1;l<c;l++)u[l-1]=arguments[l];if(!Rt(this,e,t,!0)){var d=wR(a);if("__context"in this||(this.__context=d),i&&["webgl","webgl2"].includes(d))if(u[0]&&oe(u[0])==="object"){var h=u[0];h.preserveDrawingBuffer||(h.preserveDrawingBuffer=!0)}else u.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[].concat([a],u))}});r.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return function(){r.forEach(function(s){return s()})}}function s0(n,e,t,i,r,o){for(var s=function(){var d=l.value;if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(d))return"continue";try{if(typeof n[d]!="function")return"continue";var h=Rr(n,d,function(m){return function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];var b=m.apply(this,g);if(n0(b,o,this),"tagName"in this.canvas&&!Rt(this.canvas,i,r,!0)){var S=i0(g,o,this),w={type:e,property:d,args:S};t(this.canvas,w)}return b}});a.push(h)}catch{var p=Ia(n,d,{set:function(m){t(this.canvas,{type:e,property:d,args:[m],setter:!0})}});a.push(p)}},a=[],c=Object.getOwnPropertyNames(n),u=K(c),l;!(l=u()).done;)s();return a}function CR(n,e,t,i){var r,o=[];if((r=o).push.apply(r,[].concat(s0(e.WebGLRenderingContext.prototype,Pr.WebGL,n,t,i,e))),typeof e.WebGL2RenderingContext<"u"){var s;(s=o).push.apply(s,[].concat(s0(e.WebGL2RenderingContext.prototype,Pr.WebGL2,n,t,i,e)))}return function(){o.forEach(function(a){return a()})}}var a0="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",TR=function(n){return Uint8Array.from(atob(n),function(e){return e.charCodeAt(0)})},c0=typeof window<"u"&&window.Blob&&new Blob([TR(a0)],{type:"text/javascript;charset=utf-8"});function xR(n){var e;try{if(e=c0&&(window.URL||window.webkitURL).createObjectURL(c0),!e)throw"";var t=new Worker(e,{name:n==null?void 0:n.name});return t.addEventListener("error",function(){(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+a0,{name:n==null?void 0:n.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var ER=function(){function n(t){var i=this;V(this,"pendingCanvasMutations",new Map),V(this,"rafStamps",{latestId:0,invokeId:null}),V(this,"mirror"),V(this,"mutationCb"),V(this,"resetObservers"),V(this,"frozen",!1),V(this,"locked",!1),V(this,"processMutation",function(d,h){var p=i.rafStamps.invokeId&&i.rafStamps.latestId!==i.rafStamps.invokeId;(p||!i.rafStamps.invokeId)&&(i.rafStamps.invokeId=i.rafStamps.latestId),i.pendingCanvasMutations.has(d)||i.pendingCanvasMutations.set(d,[]),i.pendingCanvasMutations.get(d).push(h)});var r=t.sampling,o=r===void 0?"all":r,s=t.win,a=t.blockClass,c=t.blockSelector,u=t.recordCanvas,l=t.dataURLOptions;this.mutationCb=t.mutationCb,this.mirror=t.mirror,u&&o==="all"&&this.initCanvasMutationObserver(s,a,c),u&&typeof o=="number"&&this.initCanvasFPSObserver(o,s,a,c,{dataURLOptions:l})}var e=n.prototype;return e.reset=function(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()},e.freeze=function(){this.frozen=!0},e.unfreeze=function(){this.frozen=!1},e.lock=function(){this.locked=!0},e.unlock=function(){this.locked=!1},e.initCanvasFPSObserver=function(t,i,r,o,s){var a=this,c=o0(i,r,o,!0),u=new Map,l=new xR;l.onmessage=function(g){var y=g.data.id;if(u.set(y,!1),"base64"in g.data){var b=g.data,S=b.base64,w=b.type,k=b.width,C=b.height;a.mutationCb({id:y,type:Pr["2D"],commands:[{property:"clearRect",args:[0,0,k,C]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:w}]},0,0]}]})}};var d=1e3/t,h=0,p,m=function(){var g=[];return i.document.querySelectorAll("canvas").forEach(function(y){Rt(y,r,o,!0)||g.push(y)}),g},f=function(g){if(h&&g-h<d){p=requestAnimationFrame(f);return}h=g;var y=a;m().forEach(Xu(function(b){var S,w,k,C;return ko(this,function(x){switch(x.label){case 0:return w=y.mirror.getId(b),u.get(w)?[2]:b.width===0||b.height===0?[2]:(u.set(w,!0),["webgl","webgl2"].includes(b.__context)&&(k=b.getContext(b.__context),((S=k==null?void 0:k.getContextAttributes())==null?void 0:S.preserveDrawingBuffer)===!1&&k.clear(k.COLOR_BUFFER_BIT)),[4,createImageBitmap(b)]);case 1:return C=x.sent(),l.postMessage({id:w,bitmap:C,width:b.width,height:b.height,dataURLOptions:s.dataURLOptions},[C]),[2]}})})),p=requestAnimationFrame(f)};p=requestAnimationFrame(f),this.resetObservers=function(){c(),cancelAnimationFrame(p)}},e.initCanvasMutationObserver=function(t,i,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var o=o0(t,i,r,!1),s=SR(this.processMutation.bind(this),t,i,r),a=CR(this.processMutation.bind(this),t,i,r);this.resetObservers=function(){o(),s(),a()}},e.startPendingCanvasMutationFlusher=function(){var t=this;requestAnimationFrame(function(){return t.flushPendingCanvasMutations()})},e.startRAFTimestamping=function(){var t=this,i=function(r){t.rafStamps.latestId=r,requestAnimationFrame(i)};requestAnimationFrame(i)},e.flushPendingCanvasMutations=function(){var t=this;this.pendingCanvasMutations.forEach(function(i,r){var o=t.mirror.getId(r);t.flushPendingCanvasMutationFor(r,o)}),requestAnimationFrame(function(){return t.flushPendingCanvasMutations()})},e.flushPendingCanvasMutationFor=function(t,i){if(!(this.frozen||this.locked)){var r=this.pendingCanvasMutations.get(t);if(!(!r||i===-1)){var o=r.map(function(a){a.type;var c=bo(a,["type"]);return c}),s=r[0].type;this.mutationCb({id:i,type:s,commands:o}),this.pendingCanvasMutations.delete(t)}}},n}(),IR=function(){function n(t){V(this,"trackedLinkElements",new WeakSet),V(this,"mutationCb"),V(this,"adoptedStyleSheetCb"),V(this,"styleMirror",new YI),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}var e=n.prototype;return e.attachLinkElement=function(t,i){"_cssText"in i.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:i.id,attributes:i.attributes}]}),this.trackLinkElement(t)},e.trackLinkElement=function(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))},e.adoptStyleSheets=function(t,i){var r,o=function(){var l=u.value,d=void 0;r.styleMirror.has(l)?d=r.styleMirror.getId(l):(d=r.styleMirror.add(l),a.push({styleId:d,rules:Array.from(l.rules||CSSRule,function(h,p){return{rule:xm(h,l.href),index:p}})})),s.styleIds.push(d)};if(t.length!==0){for(var s={id:i,styleIds:[]},a=[],c=K(t),u;!(u=c()).done;)r=this,o();a.length>0&&(s.styles=a),this.adoptedStyleSheetCb(s)}},e.reset=function(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet},e.trackStylesheetInLinkElement=function(t){},n}(),RR=function(){function n(){V(this,"nodeMap",new WeakMap),V(this,"active",!1)}var e=n.prototype;return e.inOtherBuffer=function(t,i){var r=this.nodeMap.get(t);return r&&Array.from(r).some(function(o){return o!==i})},e.add=function(t,i){var r=this;this.active||(this.active=!0,requestAnimationFrame(function(){r.nodeMap=new WeakMap,r.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(i))},e.destroy=function(){},n}(),He,Da,vd,La=!1;try{if(Array.from([1],function(n){return n*2})[0]!==2){var yd=document.createElement("iframe");document.body.appendChild(yd),Array.from=((_m=yd.contentWindow)==null?void 0:_m.Array.from)||Array.from,document.body.removeChild(yd)}}catch{}var rn=E1();function si(n){n===void 0&&(n={});var e=n.emit,t=n.checkoutEveryNms,i=n.checkoutEveryNth,r=n.blockClass,o=r===void 0?"rr-block":r,s=n.blockSelector,a=s===void 0?null:s,c=n.ignoreClass,u=c===void 0?"rr-ignore":c,l=n.ignoreSelector,d=l===void 0?null:l,h=n.maskTextClass,p=h===void 0?"rr-mask":h,m=n.maskTextSelector,f=m===void 0?null:m,g=n.inlineStylesheet,y=g===void 0?!0:g,b=n.maskAllInputs,S=n.maskInputOptions,w=n.slimDOMOptions,k=n.maskInputFn,C=n.maskTextFn,x=n.hooks,I=n.packFn,P=n.sampling,D=P===void 0?{}:P,O=n.dataURLOptions,L=O===void 0?{}:O,j=n.mousemoveWait,X=n.recordDOM,W=X===void 0?!0:X,A=n.recordCanvas,H=A===void 0?!1:A,Y=n.recordCrossOriginIframes,J=Y===void 0?!1:Y,ve=n.recordAfter,Me=ve===void 0?n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load":ve,Ie=n.userTriggeredOnInput,dt=Ie===void 0?!1:Ie,Ne=n.collectFonts,Pe=Ne===void 0?!1:Ne,ie=n.inlineImages,Ze=ie===void 0?!1:ie,kt=n.plugins,Gt=n.keepIframeSrcFn,ur=Gt===void 0?function(){return!1}:Gt,ye=n.ignoreCSSAttributes,Nt=ye===void 0?new Set([]):ye,lr=n.errorHandler;nR(lr);var yn=J?window.parent===window:!0,Dn=!1;if(!yn)try{window.parent.document&&(Dn=!1)}catch{Dn=!0}if(yn&&!e)throw new Error("emit function is required");if(!yn&&!Dn)return function(){};j!==void 0&&D.mousemove===void 0&&(D.mousemove=j),rn.reset();var Zn=b===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:S!==void 0?S:{password:!0},Li=w===!0||w==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:w==="all",headMetaDescKeywords:w==="all",headTitleMutations:w==="all"}:w||{};KI();var fo,dr=0,Qn=function(Oe){for(var tn=K(kt||[]),Z;!(Z=tn()).done;){var $e=Z.value;$e.eventProcessor&&(Oe=$e.eventProcessor(Oe))}return I&&!Dn&&(Oe=I(Oe)),Oe};He=function(Oe,tn){var Z,$e=Oe;if($e.timestamp=Ra(),(Z=qi[0])!=null&&Z.isFrozen()&&$e.type!==ce.FullSnapshot&&!($e.type===ce.IncrementalSnapshot&&$e.data.source===Q.Mutation)&&qi.forEach(function(d4){return d4.unfreeze()}),yn)e==null||e(Qn($e),tn);else if(Dn){var c4={type:"rrweb",event:Qn($e),origin:window.location.origin,isCheckout:tn};window.parent.postMessage(c4,"*")}if($e.type===ce.FullSnapshot)fo=$e,dr=0;else if($e.type===ce.IncrementalSnapshot){if($e.data.source===Q.Mutation&&$e.data.isAttachIframe)return;dr++;var u4=i&&dr>=i,l4=t&&$e.timestamp-fo.timestamp>t;(u4||l4)&&Da(!0)}};for(var hr=function(Oe){He({type:ce.IncrementalSnapshot,data:fe({source:Q.Mutation},Oe)})},Tw=function(Oe){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.Scroll},Oe)})},xw=function(Oe){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.CanvasMutation},Oe)})},s4=function(Oe){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.AdoptedStyleSheet},Oe)})},pr=new IR({mutationCb:hr,adoptedStyleSheetCb:s4}),fr=new vR({mirror:rn,mutationCb:hr,stylesheetManager:pr,recordCrossOriginIframes:J,wrappedEmit:He}),a4=K(kt||[]),Ew;!(Ew=a4()).done;){var Iw=Ew.value;Iw.getMirror&&Iw.getMirror({nodeMirror:rn,crossOriginIframeMirror:fr.crossOriginIframeMirror,crossOriginIframeStyleMirror:fr.crossOriginIframeStyleMirror})}var lf=new RR;vd=new ER({recordCanvas:H,mutationCb:xw,win:window,blockClass:o,blockSelector:a,mirror:rn,sampling:D.canvas,dataURLOptions:L});var Mu=new yR({mutationCb:hr,scrollCb:Tw,bypassOptions:{blockClass:o,blockSelector:a,maskTextClass:p,maskTextSelector:f,inlineStylesheet:y,maskInputOptions:Zn,dataURLOptions:L,maskTextFn:C,maskInputFn:k,recordCanvas:H,inlineImages:Ze,sampling:D,slimDOMOptions:Li,iframeManager:fr,stylesheetManager:pr,canvasManager:vd,keepIframeSrcFn:ur,processedNodeManager:lf},mirror:rn});Da=function(Oe){if(Oe===void 0&&(Oe=!1),!!W){He({type:ce.Meta,data:{href:window.location.href,width:Uv(),height:Lv()}},Oe),pr.reset(),Mu.init(),qi.forEach(function(Z){return Z.lock()});var tn=J1(document,{mirror:rn,blockClass:o,blockSelector:a,maskTextClass:p,maskTextSelector:f,inlineStylesheet:y,maskAllInputs:Zn,maskTextFn:C,maskInputFn:k,slimDOM:Li,dataURLOptions:L,recordCanvas:H,inlineImages:Ze,onSerialize:function(Z){jv(Z,rn)&&fr.addIframe(Z),Vv(Z,rn)&&pr.trackLinkElement(Z),md(Z)&&Mu.addShadowRoot(se.shadowRoot(Z),document)},onIframeLoad:function(Z,$e){fr.attachIframe(Z,$e),Mu.observeAttachShadow(Z)},onStylesheetLoad:function(Z,$e){pr.attachLinkElement(Z,$e)},keepIframeSrcFn:ur});if(!tn)return console.warn("Failed to snapshot the document");He({type:ce.FullSnapshot,data:{node:tn,initialOffset:Dv(window)}},Oe),qi.forEach(function(Z){return Z.unlock()}),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&pr.adoptStyleSheets(document.adoptedStyleSheets,rn.getId(document))}};try{var ws=[],Rw=function(Oe){var tn;return he(gR)({mutationCb:hr,mousemoveCb:function(Z,$e){return He({type:ce.IncrementalSnapshot,data:{source:$e,positions:Z}})},mouseInteractionCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.MouseInteraction},Z)})},scrollCb:Tw,viewportResizeCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.ViewportResize},Z)})},inputCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.Input},Z)})},mediaInteractionCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.MediaInteraction},Z)})},styleSheetRuleCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.StyleSheetRule},Z)})},styleDeclarationCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.StyleDeclaration},Z)})},canvasMutationCb:xw,fontCb:function(Z){return He({type:ce.IncrementalSnapshot,data:fe({source:Q.Font},Z)})},selectionCb:function(Z){He({type:ce.IncrementalSnapshot,data:fe({source:Q.Selection},Z)})},customElementCb:function(Z){He({type:ce.IncrementalSnapshot,data:fe({source:Q.CustomElement},Z)})},blockClass:o,ignoreClass:u,ignoreSelector:d,maskTextClass:p,maskTextSelector:f,maskInputOptions:Zn,inlineStylesheet:y,sampling:D,recordDOM:W,recordCanvas:H,inlineImages:Ze,userTriggeredOnInput:dt,collectFonts:Pe,doc:Oe,maskInputFn:k,maskTextFn:C,keepIframeSrcFn:ur,blockSelector:a,slimDOMOptions:Li,dataURLOptions:L,mirror:rn,iframeManager:fr,stylesheetManager:pr,shadowDomManager:Mu,processedNodeManager:lf,canvasManager:vd,ignoreCSSAttributes:Nt,plugins:((tn=kt==null?void 0:kt.filter(function(Z){return Z.observer}))==null?void 0:tn.map(function(Z){return{observer:Z.observer,options:Z.options,callback:function($e){return He({type:ce.Plugin,data:{plugin:Z.name,payload:$e}})}}}))||[]},x)};fr.addLoadListener(function(Oe){try{ws.push(Rw(Oe.contentDocument))}catch(tn){console.warn(tn)}});var df=function(){Da(),ws.push(Rw(document)),La=!0};return document.readyState==="interactive"||document.readyState==="complete"?df():(ws.push(It("DOMContentLoaded",function(){He({type:ce.DomContentLoaded,data:{}}),Me==="DOMContentLoaded"&&df()})),ws.push(It("load",function(){He({type:ce.Load,data:{}}),Me==="load"&&df()},window))),function(){ws.forEach(function(Oe){return Oe()}),lf.destroy(),La=!1,iR()}}catch(Oe){console.warn(Oe)}}si.addCustomEvent=function(n,e){if(!La)throw new Error("please add custom event after start recording");He({type:ce.Custom,data:{tag:n,payload:e}})},si.freezePage=function(){qi.forEach(function(n){return n.freeze()})},si.takeFullSnapshot=function(n){if(!La)throw new Error("please take full snapshot after start recording");Da(n)},si.mirror=rn;var u0;(function(n){n[n.NotStarted=0]="NotStarted",n[n.Running=1]="Running",n[n.Stopped=2]="Stopped"})(u0||(u0={})),si.addCustomEvent,si.freezePage,si.takeFullSnapshot;var l0=q.setImmediate,ai,bd,_d,d0=Object.prototype.toString,PR=typeof l0<"u"?function(n){return l0(n)}:setTimeout;try{Object.defineProperty({},"x",{}),ai=function(n,e,t,i){return Object.defineProperty(n,e,{value:t,writable:!0,configurable:i!==!1})}}catch{ai=function(n,e,t){return n[e]=t,n}}_d=function(){var n,e,t;function i(r,o){this.fn=r,this.self=o,this.next=void 0}return{add:function(r,o){t=new i(r,o),e?e.next=t:n=t,e=t,t=void 0},drain:function(){var r=n;for(n=e=bd=void 0;r;)r.fn.call(r.self),r=r.next}}}();function Ua(n,e){_d.add(n,e),bd||(bd=PR(_d.drain))}function h0(n){var e,t=typeof n;return n!==null&&(t==="object"||t==="function")&&(e=n.then),typeof e=="function"?e:!1}function kd(){for(var n=0;n<this.chain.length;n++)OR(this,this.state===1?this.chain[n].success:this.chain[n].failure,this.chain[n]);this.chain.length=0}function OR(n,e,t){var i,r;try{e===!1?t.reject(n.msg):(e===!0?i=n.msg:i=e.call(void 0,n.msg),i===t.promise?t.reject(TypeError("Promise-chain cycle")):(r=h0(i))?r.call(i,t.resolve,t.reject):t.resolve(i))}catch(o){t.reject(o)}}function p0(n){var e,t=this;if(!t.triggered){t.triggered=!0,t.def&&(t=t.def);try{(e=h0(n))?Ua(function(){var i=new m0(t);try{e.call(n,function(){p0.apply(i,arguments)},function(){zo.apply(i,arguments)})}catch(r){zo.call(i,r)}}):(t.msg=n,t.state=1,t.chain.length>0&&Ua(kd,t))}catch(i){zo.call(new m0(t),i)}}}function zo(n){var e=this;e.triggered||(e.triggered=!0,e.def&&(e=e.def),e.msg=n,e.state=2,e.chain.length>0&&Ua(kd,e))}function f0(n,e,t,i){for(var r=0;r<e.length;r++)(function(o){n.resolve(e[o]).then(function(s){t(o,s)},i)})(r)}function m0(n){this.def=n,this.triggered=!1}function AR(n){this.promise=n,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function ci(n){if(typeof n!="function")throw TypeError("Not a function");if(this.__NPO__!==0)throw TypeError("Not a promise");this.__NPO__=1;var e=new AR(this);this.then=function(t,i){var r={success:typeof t=="function"?t:!0,failure:typeof i=="function"?i:!1};return r.promise=new this.constructor(function(o,s){if(typeof o!="function"||typeof s!="function")throw TypeError("Not a function");r.resolve=o,r.reject=s}),e.chain.push(r),e.state!==0&&Ua(kd,e),r.promise},this.catch=function(t){return this.then(void 0,t)};try{n.call(void 0,function(t){p0.call(e,t)},function(t){zo.call(e,t)})}catch(t){zo.call(e,t)}}var g0=ai({},"constructor",ci,!1);ci.prototype=g0,ai(g0,"__NPO__",0,!1),ai(ci,"resolve",function(n){var e=this;return n&&typeof n=="object"&&n.__NPO__===1?n:new e(function(t,i){if(typeof t!="function"||typeof i!="function")throw TypeError("Not a function");t(n)})}),ai(ci,"reject",function(n){return new this(function(e,t){if(typeof e!="function"||typeof t!="function")throw TypeError("Not a function");t(n)})}),ai(ci,"all",function(n){var e=this;return d0.call(n)!=="[object Array]"?e.reject(TypeError("Not an array")):n.length===0?e.resolve([]):new e(function(t,i){if(typeof t!="function"||typeof i!="function")throw TypeError("Not a function");var r=n.length,o=Array(r),s=0;f0(e,n,function(a,c){o[a]=c,++s===r&&t(o)},i)})}),ai(ci,"race",function(n){var e=this;return d0.call(n)!=="[object Array]"?e.reject(TypeError("Not an array")):new e(function(t,i){if(typeof t!="function"||typeof i!="function")throw TypeError("Not a function");f0(e,n,function(r,o){t(o)},i)})});var Se;typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1?Se=Promise:Se=ci;var on={DEBUG:!1,LIB_VERSION:"2.68.0"},qo=24*60*60*1e3,Sd=8*1e3,Fa=Array.prototype,MR=Function.prototype,v0=Object.prototype,Wi=Fa.slice,Wo=v0.toString,Ba=v0.hasOwnProperty,ot=q.console,ui=q.navigator,_e=q.document,ja=q.opera,y0=q.screen,Vn=ui.userAgent,wd=MR.bind,b0=Fa.forEach,_0=Fa.indexOf,k0=Fa.map,NR=Array.isArray,Cd={},v={trim:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},ke={log:function(){if(on.DEBUG&&!v.isUndefined(ot)&&ot)try{ot.log.apply(ot,arguments)}catch{v.each(arguments,function(n){ot.log(n)})}},warn:function(){if(on.DEBUG&&!v.isUndefined(ot)&&ot){var n=["Mixpanel warning:"].concat(v.toArray(arguments));try{ot.warn.apply(ot,n)}catch{v.each(n,function(e){ot.warn(e)})}}},error:function(){if(on.DEBUG&&!v.isUndefined(ot)&&ot){var n=["Mixpanel error:"].concat(v.toArray(arguments));try{ot.error.apply(ot,n)}catch{v.each(n,function(e){ot.error(e)})}}},critical:function(){if(!v.isUndefined(ot)&&ot){var n=["Mixpanel error:"].concat(v.toArray(arguments));try{ot.error.apply(ot,n)}catch{v.each(n,function(e){ot.error(e)})}}}},Td=function(n,e){return function(){return arguments[0]="["+e+"] "+arguments[0],n.apply(ke,arguments)}},Gi=function(n){return{log:Td(ke.log,n),error:Td(ke.error,n),critical:Td(ke.critical,n)}},xd=function(n){return function(){try{return n.apply(this,arguments)}catch(e){ke.critical("Implementation error. Please turn on debug and contact support@mixpanel.com."),on.DEBUG&&ke.critical(e)}}},S0=function(n){var e=n.prototype;for(var t in e)typeof e[t]=="function"&&(e[t]=xd(e[t]))};v.bind=function(n,e){var t,i;if(wd&&n.bind===wd)return wd.apply(n,Wi.call(arguments,1));if(!v.isFunction(n))throw new TypeError;return t=Wi.call(arguments,2),i=function(){if(!(this instanceof i))return n.apply(e,t.concat(Wi.call(arguments)));var r={};r.prototype=n.prototype;var o=new r;r.prototype=null;var s=n.apply(o,t.concat(Wi.call(arguments)));return Object(s)===s?s:o},i},v.each=function(n,e,t){if(n!=null){if(b0&&n.forEach===b0)n.forEach(e,t);else if(n.length===+n.length){for(var i=0,r=n.length;i<r;i++)if(i in n&&e.call(t,n[i],i,n)===Cd)return}else for(var o in n)if(Ba.call(n,o)&&e.call(t,n[o],o,n)===Cd)return}},v.extend=function(n){return v.each(Wi.call(arguments,1),function(e){for(var t in e)e[t]!==void 0&&(n[t]=e[t])}),n},v.isArray=NR||function(n){return Wo.call(n)==="[object Array]"},v.isFunction=function(n){try{return/^\s*\bfunction\b/.test(n)}catch{return!1}},v.isArguments=function(n){return!!(n&&Ba.call(n,"callee"))},v.toArray=function(n){return n?n.toArray?n.toArray():v.isArray(n)||v.isArguments(n)?Wi.call(n):v.values(n):[]},v.map=function(n,e,t){if(k0&&n.map===k0)return n.map(e,t);var i=[];return v.each(n,function(r){i.push(e.call(t,r))}),i},v.keys=function(n){var e=[];return n===null||v.each(n,function(t,i){e[e.length]=i}),e},v.values=function(n){var e=[];return n===null||v.each(n,function(t){e[e.length]=t}),e},v.include=function(n,e){var t=!1;return n===null?t:_0&&n.indexOf===_0?n.indexOf(e)!=-1:(v.each(n,function(i){if(t||(t=i===e))return Cd}),t)},v.includes=function(n,e){return n.indexOf(e)!==-1},v.inherit=function(n,e){return n.prototype=new e,n.prototype.constructor=n,n.superclass=e.prototype,n},v.isObject=function(n){return n===Object(n)&&!v.isArray(n)},v.isEmptyObject=function(n){if(v.isObject(n)){for(var e in n)if(Ba.call(n,e))return!1;return!0}return!1},v.isUndefined=function(n){return n===void 0},v.isString=function(n){return Wo.call(n)=="[object String]"},v.isDate=function(n){return Wo.call(n)=="[object Date]"},v.isNumber=function(n){return Wo.call(n)=="[object Number]"},v.isElement=function(n){return!!(n&&n.nodeType===1)},v.encodeDates=function(n){return v.each(n,function(e,t){v.isDate(e)?n[t]=v.formatDate(e):v.isObject(e)&&(n[t]=v.encodeDates(e))}),n},v.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},v.formatDate=function(n){function e(t){return t<10?"0"+t:t}return n.getUTCFullYear()+"-"+e(n.getUTCMonth()+1)+"-"+e(n.getUTCDate())+"T"+e(n.getUTCHours())+":"+e(n.getUTCMinutes())+":"+e(n.getUTCSeconds())},v.strip_empty_properties=function(n){var e={};return v.each(n,function(t,i){v.isString(t)&&t.length>0&&(e[i]=t)}),e},v.truncate=function(n,e){var t;return typeof n=="string"?t=n.slice(0,e):v.isArray(n)?(t=[],v.each(n,function(i){t.push(v.truncate(i,e))})):v.isObject(n)?(t={},v.each(n,function(i,r){t[r]=v.truncate(i,e)})):t=n,t},v.JSONEncode=function(){return function(n){var e=n,t=function(r){var o=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return o.lastIndex=0,o.test(r)?'"'+r.replace(o,function(a){var c=s[a];return typeof c=="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+r+'"'},i=function(r,o){var s="",a=" ",c=0,u="",l="",d=0,h=s,p=[],m=o[r];switch(m&&typeof m=="object"&&typeof m.toJSON=="function"&&(m=m.toJSON(r)),typeof m){case"string":return t(m);case"number":return isFinite(m)?String(m):"null";case"boolean":case"null":return String(m);case"object":if(!m)return"null";if(s+=a,p=[],Wo.apply(m)==="[object Array]"){for(d=m.length,c=0;c<d;c+=1)p[c]=i(c,m)||"null";return l=p.length===0?"[]":s?`[
74
74
  `+s+p.join(`,
75
75
  `+s)+`
76
76
  `+h+"]":"["+p.join(",")+"]",s=h,l}for(u in m)Ba.call(m,u)&&(l=i(u,m),l&&p.push(t(u)+(s?": ":":")+l));return l=p.length===0?"{}":s?"{"+p.join(",")+h+"}":"{"+p.join(",")+"}",s=h,l}};return i("",{"":e})}}(),v.JSONDecode=function(){var n,e,t={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
77
77
  `,r:"\r",t:" "},i,r=function(p){var m=new SyntaxError(p);throw m.at=n,m.text=i,m},o=function(p){return p&&p!==e&&r("Expected '"+p+"' instead of '"+e+"'"),e=i.charAt(n),n+=1,e},s=function(){var p,m="";for(e==="-"&&(m="-",o("-"));e>="0"&&e<="9";)m+=e,o();if(e===".")for(m+=".";o()&&e>="0"&&e<="9";)m+=e;if(e==="e"||e==="E")for(m+=e,o(),(e==="-"||e==="+")&&(m+=e,o());e>="0"&&e<="9";)m+=e,o();if(p=+m,!isFinite(p))r("Bad number");else return p},a=function(){var p,m,f="",g;if(e==='"')for(;o();){if(e==='"')return o(),f;if(e==="\\")if(o(),e==="u"){for(g=0,m=0;m<4&&(p=parseInt(o(),16),!!isFinite(p));m+=1)g=g*16+p;f+=String.fromCharCode(g)}else if(typeof t[e]=="string")f+=t[e];else break;else f+=e}r("Bad string")},c=function(){for(;e&&e<=" ";)o()},u=function(){switch(e){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null}r('Unexpected "'+e+'"')},l,d=function(){var p=[];if(e==="["){if(o("["),c(),e==="]")return o("]"),p;for(;e;){if(p.push(l()),c(),e==="]")return o("]"),p;o(","),c()}}r("Bad array")},h=function(){var p,m={};if(e==="{"){if(o("{"),c(),e==="}")return o("}"),m;for(;e;){if(p=a(),c(),o(":"),Object.hasOwnProperty.call(m,p)&&r('Duplicate key "'+p+'"'),m[p]=l(),c(),e==="}")return o("}"),m;o(","),c()}}r("Bad object")};return l=function(){switch(c(),e){case"{":return h();case"[":return d();case'"':return a();case"-":return s();default:return e>="0"&&e<="9"?s():u()}},function(p){var m;return i=p,n=0,e=" ",m=l(),c(),e&&r("Syntax error"),m}}(),v.base64Encode=function(n){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",t,i,r,o,s,a,c,u,l=0,d=0,h="",p=[];if(!n)return n;n=v.utf8Encode(n);do t=n.charCodeAt(l++),i=n.charCodeAt(l++),r=n.charCodeAt(l++),u=t<<16|i<<8|r,o=u>>18&63,s=u>>12&63,a=u>>6&63,c=u&63,p[d++]=e.charAt(o)+e.charAt(s)+e.charAt(a)+e.charAt(c);while(l<n.length);switch(h=p.join(""),n.length%3){case 1:h=h.slice(0,-2)+"==";break;case 2:h=h.slice(0,-1)+"=";break}return h},v.utf8Encode=function(n){n=(n+"").replace(/\r\n/g,`
78
78
  `).replace(/\r/g,`
79
- `);var e="",t,i,r=0,o;for(t=i=0,r=n.length,o=0;o<r;o++){var s=n.charCodeAt(o),a=null;s<128?i++:s>127&&s<2048?a=String.fromCharCode(s>>6|192,s&63|128):a=String.fromCharCode(s>>12|224,s>>6&63|128,s&63|128),a!==null&&(i>t&&(e+=n.substring(t,i)),e+=a,t=i=o+1)}return i>t&&(e+=n.substring(t,n.length)),e},v.UUID=function(){try{return q.crypto.randomUUID()}catch{for(var n=new Array(36),e=0;e<36;e++)n[e]=Math.floor(Math.random()*16);return n[14]=4,n[19]=n[19]&=-5,n[19]=n[19]|=8,n[8]=n[13]=n[18]=n[23]="-",v.map(n,function(t){return t.toString(16)}).join("")}};var w0=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];v.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<w0.length;e++)if(n.indexOf(w0[e])!==-1)return!0;return!1},v.HTTPBuildQuery=function(n,e){var t,i,r=[];return v.isUndefined(e)&&(e="&"),v.each(n,function(o,s){t=encodeURIComponent(o.toString()),i=encodeURIComponent(s),r[r.length]=i+"="+t}),r.join(e)},v.getQueryParam=function(n,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var t="[\\?&]"+e+"=([^&#]*)",i=new RegExp(t),r=i.exec(n);if(r===null||r&&typeof r[1]!="string"&&r[1].length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch{_e.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},v.cookie={get:function(n){for(var e=n+"=",t=be.cookie.split(";"),i=0;i<t.length;i++){for(var r=t[i];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}return null},parse:function(n){var e;try{e=v.JSONDecode(v.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,t,i,r,o,s){var a="",c="",u="";if(s)a="; domain="+s;else if(i){var l=x0(be.location.hostname);a=l?"; domain=."+l:""}if(t){var d=new Date;d.setTime(d.getTime()+t*1e3),c="; expires="+d.toGMTString()}o&&(r=!0,u="; SameSite=None"),r&&(u+="; secure"),be.cookie=n+"="+encodeURIComponent(e)+c+"; path=/"+a+u},set:function(n,e,t,i,r,o,s){var a="",c="",u="";if(s)a="; domain="+s;else if(i){var l=x0(be.location.hostname);a=l?"; domain=."+l:""}if(t){var d=new Date;d.setTime(d.getTime()+t*24*60*60*1e3),c="; expires="+d.toGMTString()}o&&(r=!0,u="; SameSite=None"),r&&(u+="; secure");var h=n+"="+encodeURIComponent(e)+c+"; path=/"+a+u;return be.cookie=h,h},remove:function(n,e,t){v.cookie.set(n,"",-1,e,!1,!1,t)}};var C0=function(n){var e=!0;try{var t="__mplss_"+Rd(8),i="xyz";n.setItem(t,i),n.getItem(t)!==i&&(e=!1),n.removeItem(t)}catch{e=!1}return e},Ed=null,Go=function(n,e){return Ed!==null&&!e?Ed:Ed=C0(n||q.localStorage)},Id=null,DR=function(n,e){return Id!==null&&!e?Id:Id=C0(n||q.sessionStorage)};function T0(n,e,t){var i=function(r){_e.error(e+" error: "+r)};return{is_supported:function(r){var o=t(n,r);return o||_e.error(e+" unsupported"),o},error:i,get:function(r){try{return n.getItem(r)}catch(o){i(o)}return null},parse:function(r){try{return v.JSONDecode(n.getItem(r))||{}}catch{}return null},set:function(r,o){try{n.setItem(r,o)}catch(s){i(s)}},remove:function(r){try{n.removeItem(r)}catch(o){i(o)}}}}v.localStorage=T0(q.localStorage,"localStorage",Go),v.sessionStorage=T0(q.sessionStorage,"sessionStorage",DR),v.register_event=function(){var n=function(i,r,o,s,a){if(!i){_e.error("No valid element provided to register_event");return}if(i.addEventListener&&!s)i.addEventListener(r,o,!!a);else{var c="on"+r,u=i[c];i[c]=e(i,o,u)}};function e(i,r,o){var s=function(a){if(a=a||t(q.event),!!a){var c=!0,u,l;return v.isFunction(o)&&(u=o(a)),l=r.call(i,a),(u===!1||l===!1)&&(c=!1),c}};return s}function t(i){return i&&(i.preventDefault=t.preventDefault,i.stopPropagation=t.stopPropagation),i}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},n}();var LR=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');v.dom_query=function(){function n(r){return r.all?r.all:r.getElementsByTagName("*")}var e=/[\t\r\n]/g;function t(r,o){var s=" "+o+" ";return(" "+r.className+" ").replace(e," ").indexOf(s)>=0}function i(r){if(!be.getElementsByTagName)return[];var o=r.split(" "),s,a,c,u,l,d,h,p,m,f,g=[be];for(d=0;d<o.length;d++){if(s=o[d].replace(/^\s+/,"").replace(/\s+$/,""),s.indexOf("#")>-1){a=s.split("#"),c=a[0];var y=a[1],b=be.getElementById(y);if(!b||c&&b.nodeName.toLowerCase()!=c)return[];g=[b];continue}if(s.indexOf(".")>-1){a=s.split("."),c=a[0];var S=a[1];for(c||(c="*"),u=[],l=0,h=0;h<g.length;h++)for(c=="*"?m=n(g[h]):m=g[h].getElementsByTagName(c),p=0;p<m.length;p++)u[l++]=m[p];for(g=[],f=0,h=0;h<u.length;h++)u[h].className&&v.isString(u[h].className)&&t(u[h],S)&&(g[f++]=u[h]);continue}var w=s.match(LR);if(w){c=w[1];var k=w[2],C=w[3],x=w[4];for(c||(c="*"),u=[],l=0,h=0;h<g.length;h++)for(c=="*"?m=n(g[h]):m=g[h].getElementsByTagName(c),p=0;p<m.length;p++)u[l++]=m[p];g=[],f=0;var I;switch(C){case"=":I=function(P){return P.getAttribute(k)==x};break;case"~":I=function(P){return P.getAttribute(k).match(new RegExp("\\b"+x+"\\b"))};break;case"|":I=function(P){return P.getAttribute(k).match(new RegExp("^"+x+"-?"))};break;case"^":I=function(P){return P.getAttribute(k).indexOf(x)===0};break;case"$":I=function(P){return P.getAttribute(k).lastIndexOf(x)==P.getAttribute(k).length-x.length};break;case"*":I=function(P){return P.getAttribute(k).indexOf(x)>-1};break;default:I=function(P){return P.getAttribute(k)}}for(g=[],f=0,h=0;h<u.length;h++)I(u[h])&&(g[f++]=u[h]);continue}for(c=s,u=[],l=0,h=0;h<g.length;h++)for(m=g[h].getElementsByTagName(c),p=0;p<m.length;p++)u[l++]=m[p];g=u}return g}return function(r){return v.isElement(r)?[r]:v.isObject(r)&&!v.isUndefined(r.length)?r:i.call(this,r)}}();var UR=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],FR=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];v.info={campaignParams:function(n){var e="",t={};return v.each(UR,function(i){e=v.getQueryParam(be.URL,i),e.length?t[i]=e:n!==void 0&&(t[i]=n)}),t},clickParams:function(){var n="",e={};return v.each(FR,function(t){n=v.getQueryParam(be.URL,t),n.length&&(e[t]=n)}),e},marketingParams:function(){return v.extend(v.info.campaignParams(),v.info.clickParams())},searchEngine:function(n){return n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(n){var e=v.info.searchEngine(n),t=e!="yahoo"?"q":"p",i={};if(e!==null){i.$search_engine=e;var r=v.getQueryParam(n,t);r.length&&(i.mp_keyword=r)}return i},browser:function(n,e,t){return e=e||"",t||v.includes(n," OPR/")?v.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":v.includes(n,"IEMobile")||v.includes(n,"WPDesktop")?"Internet Explorer Mobile":v.includes(n,"SamsungBrowser/")?"Samsung Internet":v.includes(n,"Edge")||v.includes(n,"Edg/")?"Microsoft Edge":v.includes(n,"FBIOS")?"Facebook Mobile":v.includes(n,"Whale/")?"Whale Browser":v.includes(n,"Chrome")?"Chrome":v.includes(n,"CriOS")?"Chrome iOS":v.includes(n,"UCWEB")||v.includes(n,"UCBrowser")?"UC Browser":v.includes(n,"FxiOS")?"Firefox iOS":v.includes(e,"Apple")?v.includes(n,"Mobile")?"Mobile Safari":"Safari":v.includes(n,"Android")?"Android Mobile":v.includes(n,"Konqueror")?"Konqueror":v.includes(n,"Firefox")?"Firefox":v.includes(n,"MSIE")||v.includes(n,"Trident/")?"Internet Explorer":v.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,t){var i=v.info.browser(n,e,t),r={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/,"Whale Browser":/Whale\/(\d+(\.\d+)?)/},o=r[i];if(o===void 0)return null;var s=n.match(o);return s?parseFloat(s[s.length-2]):null},os:function(){var n=Vn;return/Windows/i.test(n)?/Phone/.test(n)||/WPDesktop/.test(n)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(n)?"iOS":/Android/.test(n)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Mac/i.test(n)?"Mac OS X":/Linux/.test(n)?"Linux":/CrOS/.test(n)?"Chrome OS":""},device:function(n){return/Windows Phone/i.test(n)||/WPDesktop/.test(n)?"Windows Phone":/iPad/.test(n)?"iPad":/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Android/.test(n)?"Android":""},referringDomain:function(n){var e=n.split("/");return e.length>=3?e[2]:""},currentUrl:function(){return q.location.href},properties:function(n){return typeof n!="object"&&(n={}),v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(Vn,ui.vendor,ja),$referrer:be.referrer,$referring_domain:v.info.referringDomain(be.referrer),$device:v.info.device(Vn)}),{$current_url:v.info.currentUrl(),$browser_version:v.info.browserVersion(Vn,ui.vendor,ja),$screen_height:y0.height,$screen_width:y0.width,mp_lib:"web",$lib_version:on.LIB_VERSION,$insert_id:Rd(),time:v.timestamp()/1e3},v.strip_empty_properties(n))},people_properties:function(){return v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(Vn,ui.vendor,ja)}),{$browser_version:v.info.browserVersion(Vn,ui.vendor,ja)})},mpPageViewProperties:function(){return v.strip_empty_properties({current_page_title:be.title,current_domain:q.location.hostname,current_url_path:q.location.pathname,current_url_protocol:q.location.protocol,current_url_search:q.location.search})}};var BR=function(n,e){var t=null,i=[];return function(r){var o=this;return i.push(r),t||(t=new ke(function(s){setTimeout(function(){var a=n.apply(o,[i]);t=null,i=[],s(a)},e)})),t}},Rd=function(n){var e=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return n?e.substring(0,n):e},jR=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,VR=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,x0=function(n){var e=VR,t=n.split("."),i=t[t.length-1];(i.length>4||i==="com"||i==="org")&&(e=jR);var r=n.match(e);return r?r[0]:""},zR=function(){var n=q.navigator.onLine;return v.isUndefined(n)||n},li=function(){},Mr=null,Va=null;typeof JSON<"u"&&(Mr=JSON.stringify,Va=JSON.parse),Mr=Mr||v.JSONEncode,Va=Va||v.JSONDecode,v.info=v.info,v.info.browser=v.info.browser,v.info.browserVersion=v.info.browserVersion,v.info.device=v.info.device,v.info.properties=v.info.properties,v.isBlockedUA=v.isBlockedUA,v.isEmptyObject=v.isEmptyObject,v.isObject=v.isObject,v.JSONDecode=v.JSONDecode,v.JSONEncode=v.JSONEncode,v.toArray=v.toArray,v.NPO=ci;var qR="mixpanelBrowserDb",E0="mixpanelRecordingEvents",Pd="mixpanelRecordingRegistry",WR=1,GR=[E0,Pd],Sn=function(n){this.dbPromise=null,this.storeName=n};Sn.prototype._openDb=function(){return new ke(function(n,e){var t=q.indexedDB.open(qR,WR);t.onerror=function(){e(t.error)},t.onsuccess=function(){n(t.result)},t.onupgradeneeded=function(i){var r=i.target.result;GR.forEach(function(o){r.createObjectStore(o)})}})},Sn.prototype.init=function(){return q.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(n){return n instanceof q.IDBDatabase?ke.resolve():ke.reject(n)})):ke.reject("indexedDB is not supported in this browser")},Sn.prototype.makeTransaction=function(n,e){var t=this.storeName,i=function(r){return new ke(function(o,s){var a=r.transaction(t,n);a.oncomplete=function(){o(a)},a.onabort=a.onerror=function(){s(a.error)},e(a.objectStore(t))})};return this.dbPromise.then(i).catch((function(r){return r&&r.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(i)):ke.reject(r)}).bind(this))},Sn.prototype.setItem=function(n,e){return this.makeTransaction("readwrite",function(t){t.put(e,n)})},Sn.prototype.getItem=function(n){var e;return this.makeTransaction("readonly",function(t){e=t.get(n)}).then(function(){return e.result})},Sn.prototype.removeItem=function(n){return this.makeTransaction("readwrite",function(e){e.delete(n)})},Sn.prototype.getAll=function(){var n;return this.makeTransaction("readonly",function(e){n=e.getAll()}).then(function(){return n.result})};var $R="__mp_opt_in_out_";function HR(n,e){P0(!0,n,e)}function KR(n,e){P0(!1,n,e)}function YR(n,e){return R0(n,e)==="1"}function I0(n,e){if(JR(e))return _e.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var t=R0(n,e)==="0";return t&&_e.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),t}function di(n){return Md(n,function(e){return this.get_config(e)})}function hi(n){return Md(n,function(e){return this._get_config(e)})}function Nr(n){return Md(n,function(e){return this._get_config(e)})}function XR(n,e){e=e||{},Od(e).remove(Ad(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function Od(n){return n=n||{},n.persistenceType==="localStorage"?v.localStorage:v.cookie}function Ad(n,e){return e=e||{},(e.persistencePrefix||$R)+n}function R0(n,e){return Od(e).get(Ad(n,e))}function JR(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||q,t=e.navigator||{},i=!1;return v.each([t.doNotTrack,t.msDoNotTrack,e.doNotTrack],function(r){v.includes([!0,1,"1","yes"],r)&&(i=!0)}),i}function P0(n,e,t){if(!v.isString(e)||!e.length){_e.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}t=t||{},Od(t).set(Ad(e,t),n?1:0,v.isNumber(t.cookieExpiration)?t.cookieExpiration:null,!!t.crossSubdomainCookie,!!t.secureCookie,!!t.crossSiteCookie,t.cookieDomain),t.track&&n&&t.track(t.trackEventName||"$opt_in",t.trackProperties,{send_immediately:!0})}function Md(n,e){return function(){var t=!1;try{var i=e.call(this,"token"),r=e.call(this,"ignore_dnt"),o=e.call(this,"opt_out_tracking_persistence_type"),s=e.call(this,"opt_out_tracking_cookie_prefix"),a=e.call(this,"window");i&&(t=I0(i,{ignoreDnt:r,persistenceType:o,persistencePrefix:s,window:a}))}catch(u){_e.error("Unexpected error when checking tracking opt-out status: "+u)}if(!t)return n.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var ZR=Gi("lock"),O0=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||q.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3,this.promiseImpl=e.promiseImpl||ke};O0.prototype.withLock=function(n,e){var t=this.promiseImpl;return new t(v.bind(function(i,r){var o=e||new Date().getTime()+"|"+Math.random(),s=new Date().getTime(),a=this.storageKey,c=this.pollIntervalMS,u=this.timeoutMS,l=this.storage,d=a+":X",h=a+":Y",p=a+":Z",m=function(S){if(new Date().getTime()-s>u){ZR.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+o+"]"),l.removeItem(p),l.removeItem(h),y();return}setTimeout(function(){try{S()}catch(w){r(w)}},c*(Math.random()+.1))},f=function(S,w){S()?w():m(function(){f(S,w)})},g=function(){var S=l.getItem(h);return S&&S!==o?!1:(l.setItem(h,o),l.getItem(h)===o?!0:(Go(l,!0)||r(new Error("localStorage support dropped while acquiring lock")),!1))},y=function(){l.setItem(d,o),f(g,function(){if(l.getItem(d)===o){b();return}m(function(){if(l.getItem(h)!==o){y();return}f(function(){return!l.getItem(p)},b)})})},b=function(){l.setItem(p,"1");var S=function(){l.removeItem(p),l.getItem(h)===o&&l.removeItem(h),l.getItem(d)===o&&l.removeItem(d)};n().then(function(w){S(),i(w)}).catch(function(w){S(),r(w)})};try{if(Go(l,!0))y();else throw new Error("localStorage support check failed")}catch(S){r(S)}},this))};var $o=function(n){this.storage=n||q.localStorage};$o.prototype.init=function(){return ke.resolve()},$o.prototype.setItem=function(n,e){return new ke(v.bind(function(t,i){try{this.storage.setItem(n,Mr(e))}catch(r){i(r)}t()},this))},$o.prototype.getItem=function(n){return new ke(v.bind(function(e,t){var i;try{i=Va(this.storage.getItem(n))}catch(r){t(r)}e(i)},this))},$o.prototype.removeItem=function(n){return new ke(v.bind(function(e,t){try{this.storage.removeItem(n)}catch(i){t(i)}e()},this))};var A0=Gi("batch"),wn=function(n,e){e=e||{},this.storageKey=n,this.usePersistence=e.usePersistence,this.usePersistence&&(this.queueStorage=e.queueStorage||new $o,this.lock=new O0(n,{storage:e.sharedLockStorage||q.localStorage,timeoutMS:e.sharedLockTimeoutMS})),this.reportError=e.errorReporter||v.bind(A0.error,A0),this.pid=e.pid||null,this.memQueue=[],this.initialized=!1,e.enqueueThrottleMs?this.enqueuePersisted=BR(v.bind(this._enqueuePersisted,this),e.enqueueThrottleMs):this.enqueuePersisted=v.bind(function(t){return this._enqueuePersisted([t])},this)};wn.prototype.ensureInit=function(){return this.initialized?ke.resolve():this.queueStorage.init().then(v.bind(function(){this.initialized=!0},this)).catch(v.bind(function(n){this.reportError("Error initializing queue persistence. Disabling persistence",n),this.initialized=!0,this.usePersistence=!1},this))},wn.prototype.enqueue=function(n,e){var t={id:Rd(),flushAfter:new Date().getTime()+e*2,payload:n};return this.usePersistence?this.enqueuePersisted(t):(this.memQueue.push(t),ke.resolve(!0))},wn.prototype._enqueuePersisted=function(n){var e=v.bind(function(){return this.ensureInit().then(v.bind(function(){return this.readFromStorage()},this)).then(v.bind(function(t){return this.saveToStorage(t.concat(n))},this)).then(v.bind(function(t){return t&&(this.memQueue=this.memQueue.concat(n)),t},this)).catch(v.bind(function(t){return this.reportError("Error enqueueing items",t,n),!1},this))},this);return this.lock.withLock(e,this.pid).catch(v.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this))},wn.prototype.fillBatch=function(n){var e=this.memQueue.slice(0,n);return this.usePersistence&&e.length<n?this.ensureInit().then(v.bind(function(){return this.readFromStorage()},this)).then(v.bind(function(t){if(t.length){var i={};v.each(e,function(s){i[s.id]=!0});for(var r=0;r<t.length;r++){var o=t[r];if(new Date().getTime()>o.flushAfter&&!i[o.id]&&(o.orphaned=!0,e.push(o),e.length>=n))break}}return e},this)):ke.resolve(e)};var M0=function(n,e){var t=[];return v.each(n,function(i){i.id&&!e[i.id]&&t.push(i)}),t};wn.prototype.removeItemsByID=function(n){var e={};if(v.each(n,function(i){e[i]=!0}),this.memQueue=M0(this.memQueue,e),this.usePersistence){var t=v.bind(function(){return this.ensureInit().then(v.bind(function(){return this.readFromStorage()},this)).then(v.bind(function(i){return i=M0(i,e),this.saveToStorage(i)},this)).then(v.bind(function(){return this.readFromStorage()},this)).then(v.bind(function(i){for(var r=0;r<i.length;r++){var o=i[r];if(o.id&&e[o.id])throw new Error("Item not removed from storage")}return!0},this)).catch(v.bind(function(i){return this.reportError("Error removing items",i,n),!1},this))},this);return this.lock.withLock(t,this.pid).catch(v.bind(function(i){return this.reportError("Error acquiring storage lock",i),Go(this.lock.storage,!0)?!1:t().then(v.bind(function(r){return r||this.queueStorage.removeItem(this.storageKey).then(function(){return r})},this)).catch(v.bind(function(r){return this.reportError("Error clearing queue",r),!1},this))},this))}else return ke.resolve(!0)};var N0=function(n,e){var t=[];return v.each(n,function(i){var r=i.id;if(r in e){var o=e[r];o!==null&&(i.payload=o,t.push(i))}else t.push(i)}),t};wn.prototype.updatePayloads=function(n){return this.memQueue=N0(this.memQueue,n),this.usePersistence?this.lock.withLock(v.bind(function(){return this.ensureInit().then(v.bind(function(){return this.readFromStorage()},this)).then(v.bind(function(e){return e=N0(e,n),this.saveToStorage(e)},this)).catch(v.bind(function(e){return this.reportError("Error updating items",n,e),!1},this))},this),this.pid).catch(v.bind(function(e){return this.reportError("Error acquiring storage lock",e),!1},this)):ke.resolve(!0)},wn.prototype.readFromStorage=function(){return this.ensureInit().then(v.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(v.bind(function(n){return n&&(v.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null)),n||[]},this)).catch(v.bind(function(n){return this.reportError("Error retrieving queue",n),[]},this))},wn.prototype.saveToStorage=function(n){return this.ensureInit().then(v.bind(function(){return this.queueStorage.setItem(this.storageKey,n)},this)).then(function(){return!0}).catch(v.bind(function(e){return this.reportError("Error saving queue",e),!1},this))},wn.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(v.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):ke.resolve()};var QR=10*60*1e3,Ho=Gi("batch"),Kt=function(n,e){this.errorReporter=e.errorReporter,this.queue=new wn(n,{errorReporter:v.bind(this.reportError,this),queueStorage:e.queueStorage,sharedLockStorage:e.sharedLockStorage,sharedLockTimeoutMS:e.sharedLockTimeoutMS,usePersistence:e.usePersistence,enqueueThrottleMs:e.enqueueThrottleMs}),this.libConfig=e.libConfig,this.sendRequest=e.sendRequestFunc,this.beforeSendHook=e.beforeSendHook,this.stopAllBatching=e.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=e.flushOnlyOnInterval||!1,this._flushPromise=null};Kt.prototype.enqueue=function(n){return this.queue.enqueue(n,this.flushInterval)},Kt.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},Kt.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},Kt.prototype.clear=function(){return this.queue.clear()},Kt.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},Kt.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},Kt.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(v.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},Kt.prototype.sendRequestPromise=function(n,e){return new ke(v.bind(function(t){this.sendRequest(n,e,t)},this))},Kt.prototype.flush=function(n){if(this.requestInProgress)return Ho.log("Flush: Request already in progress"),ke.resolve();this.requestInProgress=!0,n=n||{};var e=this.libConfig.batch_request_timeout_ms,t=new Date().getTime(),i=this.batchSize;return this.queue.fillBatch(i).then(v.bind(function(r){var o=r.length===i,s=[],a={};if(v.each(r,function(d){var h=d.payload;if(this.beforeSendHook&&!d.orphaned&&(h=this.beforeSendHook(h)),h){h.event&&h.properties&&(h.properties=v.extend({},h.properties,{mp_sent_by_lib_version:on.LIB_VERSION}));var p=!0,m=d.id;m?(this.itemIdsSentSuccessfully[m]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:d,batchSize:r.length,timesSent:this.itemIdsSentSuccessfully[m]}),p=!1):this.reportError("[dupe] found item with no ID",{item:d}),p&&s.push(h)}a[d.id]=h},this),s.length<1)return this.requestInProgress=!1,this.resetFlush(),ke.resolve();var c=v.bind(function(){return this.queue.removeItemsByID(v.map(r,function(d){return d.id})).then(v.bind(function(d){return v.each(r,v.bind(function(h){var p=h.id;p?(this.itemIdsSentSuccessfully[p]=this.itemIdsSentSuccessfully[p]||0,this.itemIdsSentSuccessfully[p]++,this.itemIdsSentSuccessfully[p]>5&&this.reportError("[dupe] item ID sent too many times",{item:h,batchSize:r.length,timesSent:this.itemIdsSentSuccessfully[p]})):this.reportError("[dupe] found item with no ID while removing",{item:h})},this)),d?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?(this.resetFlush(),ke.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),ke.resolve())},this))},this),u=v.bind(function(d){this.requestInProgress=!1;try{if(n.unloading)return this.queue.updatePayloads(a);if(v.isObject(d)&&d.error==="timeout"&&new Date().getTime()-t>=e)return this.reportError("Network timeout; retrying"),this.flush();if(v.isObject(d)&&(d.httpStatusCode>=500||d.httpStatusCode===429||d.httpStatusCode<=0&&!zR()||d.error==="timeout")){var h=this.flushInterval*2;return d.retryAfter&&(h=parseInt(d.retryAfter,10)*1e3||h),h=Math.min(QR,h),this.reportError("Error; retry in "+h+" ms"),this.scheduleFlush(h),ke.resolve()}else if(v.isObject(d)&&d.httpStatusCode===413)if(r.length>1){var p=Math.max(1,Math.floor(i/2));return this.batchSize=Math.min(this.batchSize,p,r.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),ke.resolve()}else return this.reportError("Single-event request too large; dropping",r),this.resetBatchSize(),c();else return c()}catch(m){this.reportError("Error handling API response",m),this.resetFlush()}},this),l={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};return n.unloading&&(l.transport="sendBeacon"),Ho.log("MIXPANEL REQUEST:",s),this.sendRequestPromise(s,l).then(u)},this)).catch(v.bind(function(r){this.reportError("Error flushing request queue",r),this.resetFlush()},this))},Kt.prototype.reportError=function(n,e){if(Ho.error.apply(Ho.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(t){Ho.error(t)}};var Nd=function(n){var e=Date.now();return!n||e>n.maxExpires||e>n.idleExpires},eP=250,Dr=Gi("recorder"),D0=q.CompressionStream,tP={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},nP=new Set([Q.MouseMove,Q.MouseInteraction,Q.Scroll,Q.ViewportResize,Q.Input,Q.TouchMove,Q.MediaInteraction,Q.Drag,Q.Selection]);function iP(n){return n.type===ce.IncrementalSnapshot&&nP.has(n.data.source)}var gt=function(n){this._mixpanel=n.mixpanelInstance,this._onIdleTimeout=n.onIdleTimeout||li,this._onMaxLengthReached=n.onMaxLengthReached||li,this._onBatchSent=n.onBatchSent||li,this._rrwebRecord=n.rrwebRecord||null,this._stopRecording=null,this.replayId=n.replayId,this.batchStartUrl=n.batchStartUrl||null,this.replayStartUrl=n.replayStartUrl||null,this.idleExpires=n.idleExpires||null,this.maxExpires=n.maxExpires||null,this.replayStartTime=n.replayStartTime||null,this.seqNo=n.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=qo,this.recordMinMs=0;var e=Go(n.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new Sn(E0),this.batcher=new Kt(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:tP,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:n.sharedLockStorage,usePersistence:e,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:eP,sharedLockTimeoutMS:10*1e3})};gt.prototype.getUserIdInfo=function(){if(this.finalFlushUserIdInfo)return this.finalFlushUserIdInfo;var n={distinct_id:String(this._mixpanel.get_distinct_id())},e=this._mixpanel.get_property("$device_id");e&&(n.$device_id=e);var t=this._mixpanel.get_property("$user_id");return t&&(n.$user_id=t),n},gt.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))},gt.prototype.getConfig=function(n){return this._mixpanel.get_config(n)},gt.prototype.get_config=function(n){return this.getConfig(n)},gt.prototype.startRecording=function(n){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){Dr.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>qo&&(this.recordMaxMs=qo,Dr.critical("record_max_ms cannot be greater than "+qo+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Sd&&(this.recordMinMs=Sd,Dr.critical("record_min_ms cannot be greater than "+Sd+"ms. Capping value.")),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=v.info.currentUrl(),this.replayStartUrl=v.info.currentUrl()),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=(function(){clearTimeout(this.idleTimeoutId);var r=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,r),this.idleExpires=new Date().getTime()+r}).bind(this);e();var t=this.getConfig("record_block_selector");(t===""||t===null)&&(t=void 0);try{this._stopRecording=this._rrwebRecord({emit:(function(r){if(this.idleExpires&&this.idleExpires<r.timestamp){this._onIdleTimeout();return}iP(r)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),e()),this.__enqueuePromise=this.batcher.enqueue(r)}).bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:t,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector"),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15}})}catch(r){this.reportError("Unexpected error when starting rrweb recording.",r)}if(typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}var i=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),i)},gt.prototype.stopRecording=function(n){if(this.finalFlushUserIdInfo=this.getUserIdInfo(),!this.isRrwebStopped()){try{this._stopRecording()}catch(t){this.reportError("Error with rrweb stopRecording",t)}this._stopRecording=null}var e;return this.batcher.stopped?e=this.batcher.clear():n||(e=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),e},gt.prototype.isRrwebStopped=function(){return this._stopRecording===null},gt.prototype.flushEventsWithOptOut=function(n,e,t){var i=(function(r){r===0&&(this.stopRecording(),t({error:"Tracking has been opted out, stopping recording."}))}).bind(this);this._flushEvents(n,e,t,i)},gt.prototype.serialize=function(){var n;try{n=this._mixpanel.get_tab_id()}catch(e){this.reportError("Error getting tab ID for serialization ",e),n=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:n}},gt.deserialize=function(n,e){var t=new gt(v.extend({},e,{replayId:n.replayId,batchStartUrl:n.batchStartUrl,replayStartUrl:n.replayStartUrl,idleExpires:n.idleExpires,maxExpires:n.maxExpires,replayStartTime:n.replayStartTime,seqNo:n.seqNo,sharedLockStorage:e.sharedLockStorage}));return t},gt.prototype._sendRequest=function(n,e,t,i){var r=(function(s,a){s.status===200&&this.replayId===n&&(this.seqNo++,this.batchStartUrl=v.info.currentUrl()),this._onBatchSent(),i({status:0,httpStatusCode:s.status,responseBody:a,retryAfter:s.headers.get("Retry-After")})}).bind(this),o=this._mixpanel.get_api_host&&this._mixpanel.get_api_host("record")||this.getConfig("api_host");q.fetch(o+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(e),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:t}).then(function(s){s.json().then(function(a){r(s,a)}).catch(function(a){i({error:a})})}).catch(function(s){i({error:s,httpStatusCode:0})})},gt.prototype._flushEvents=di(function(n,e,t){var i=n.length;if(i>0){for(var r=this.replayId,o=1/0,s=-1/0,a=!1,c=0;c<i;c++)o=Math.min(o,n[c].timestamp),s=Math.max(s,n[c].timestamp),n[c].type===ce.FullSnapshot&&(a=!0);if(this.seqNo===0){if(!a){t({error:"First batch does not contain a full snapshot. Aborting recording."}),this.stopRecording(!0);return}this.replayStartTime=o}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var u=s-this.replayStartTime,l={$current_url:this.batchStartUrl,$lib_version:on.LIB_VERSION,batch_start_time:o/1e3,mp_lib:"web",replay_id:r,replay_length_ms:u,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},d=JSON.stringify(n);if(Object.assign(l,this.getUserIdInfo()),D0){var h=new Blob([d],{type:"application/json"}).stream(),p=h.pipeThrough(new D0("gzip"));new Response(p).blob().then((function(m){l.format="gzip",this._sendRequest(r,l,m,t)}).bind(this))}else l.format="body",this._sendRequest(r,l,d,t)}}),gt.prototype.reportError=function(n,e){Dr.error.apply(Dr.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.getConfig("error_reporter")(n,e)}catch(t){Dr.error(t)}};var Lr=function(n){this.idb=new Sn(Pd),this.errorReporter=n.errorReporter,this.mixpanelInstance=n.mixpanelInstance,this.sharedLockStorage=n.sharedLockStorage};Lr.prototype.handleError=function(n){this.errorReporter("IndexedDB error: ",n)},Lr.prototype.setActiveRecording=function(n){var e=n.tabId;return e?this.idb.init().then((function(){return this.idb.setItem(e,n)}).bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),ke.resolve())},Lr.prototype.getActiveRecording=function(){return this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(n){return Nd(n)?null:n}).bind(this)).catch(this.handleError.bind(this))},Lr.prototype.clearActiveRecording=function(){return this.getActiveRecording().then((function(n){if(n)return n.maxExpires=0,this.setActiveRecording(n)}).bind(this)).catch(this.handleError.bind(this))},Lr.prototype.flushInactiveRecordings=function(){return this.idb.init().then((function(){return this.idb.getAll()}).bind(this)).then((function(n){var e=n.filter(function(t){return Nd(t)}).map((function(t){var i=gt.deserialize(t,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return i.unloadPersistedData().then((function(){return this.idb.removeItem(t.tabId)}).bind(this)).catch(this.handleError.bind(this))}).bind(this));return ke.all(e)}).bind(this)).catch(this.handleError.bind(this))};var Ko=Gi("recorder"),zn=function(n,e,t){this.mixpanelInstance=n,this.rrwebRecord=e||si,this.sharedLockStorage=t,this.recordingRegistry=new Lr({mixpanelInstance:this.mixpanelInstance,errorReporter:Ko.error,sharedLockStorage:t}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null,this.stopRecordingInProgress=!1};zn.prototype.startRecording=function(n){if(n=n||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){Ko.log("Recording already in progress, skipping startRecording.");return}var e=(function(){Ko.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),t=(function(){Ko.log("Max recording length reached, stopping recording."),this.resetRecording()}).bind(this),i=(function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}).bind(this),r={mixpanelInstance:this.mixpanelInstance,onBatchSent:i,onIdleTimeout:e,onMaxLengthReached:t,replayId:v.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return n.activeSerializedRecording?this.activeRecording=gt.deserialize(n.activeSerializedRecording,r):this.activeRecording=new gt(r),this.activeRecording.startRecording(n.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},zn.prototype.stopRecording=function(){return this.stopRecordingInProgress=!0,this._stopCurrentRecording(!1,!0).then((function(){return this.recordingRegistry.clearActiveRecording()}).bind(this)).then((function(){this.stopRecordingInProgress=!1}).bind(this))},zn.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},zn.prototype._stopCurrentRecording=function(n,e){if(this.activeRecording){var t=this.activeRecording.stopRecording(n);return e&&(this.activeRecording=null),t}return ke.resolve()},zn.prototype.resumeRecording=function(n){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),ke.resolve(null)):this.recordingRegistry.getActiveRecording().then((function(e){return e&&!this.stopRecordingInProgress?this.startRecording({activeSerializedRecording:e}):n?this.startRecording({shouldStopBatcher:!1}):(Ko.log("No resumable recording found."),null)}).bind(this))},zn.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},zn.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(zn.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),q.__mp_recorder=zn;var za="change",$i="click",L0="hashchange",Ur="mp_locationchange",U0="popstate",F0="scrollend",Dd="submit",rP=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],B0=["mp-include"],Ld=["mp-no-track"],j0=Ld.concat(["mp-sensitive"]),oP=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],Pt=Gi("autocapture");function Ud(n){for(var e={},t=V0(n).split(" "),i=0;i<t.length;i++){var r=t[i];r&&(e[r]=!0)}return e}function V0(n){switch(typeof n.className){case"string":return n.className;case"object":return n.className.baseVal||n.getAttribute("class")||"";default:return""}}function sP(n){if(n.previousElementSibling)return n.previousElementSibling;do n=n.previousSibling;while(n&&!W0(n));return n}function z0(n,e,t,i,r,o){var s={$classes:V0(n).split(" "),$tag_name:n.tagName.toLowerCase()},a=n.id;a&&(s.$id=a),jd(n,e,r,o)&&v.each(oP.concat(i),function(d){if(n.hasAttribute(d)&&!t[d]){var h=n.getAttribute(d);qa(h)&&(s["$attr-"+d]=h)}});for(var c=1,u=1,l=n;l=sP(l);)c++,l.tagName===n.tagName&&u++;return s.$nth_child=c,s.$nth_of_type=u,s}function aP(n,e){var t=e.allowElementCallback,i=e.allowSelectors||[],r=e.blockAttrs||[],o=e.blockElementCallback,s=e.blockSelectors||[],a=e.captureTextContent||!1,c=e.captureExtraAttrs||[],u=e.capturedForHeatMap||!1,l={};v.each(r,function(k){l[k]=!0});var d=null,h=typeof n.target>"u"?n.srcElement:n.target;if(G0(h)&&(h=h.parentNode),lP(h,n)&&Fd(h,n,t,i)&&!Bd(h,n,o,s)){for(var p=[h],m=h;m.parentNode&&!Cn(m,"body");)p.push(m.parentNode),m=m.parentNode;var f=[],g,y=!1;if(v.each(p,function(k){var C=jd(k,n,t,i);!l.href&&k.tagName.toLowerCase()==="a"&&(g=k.getAttribute("href"),g=C&&qa(g)&&g),Bd(k,n,o,s)&&(y=!0),f.push(z0(k,n,l,c,t,i))},this),!y){var b=be.documentElement;if(d={$event_type:n.type,$host:q.location.host,$pathname:q.location.pathname,$elements:f,$el_attr__href:g,$viewportHeight:Math.max(b.clientHeight,q.innerHeight||0),$viewportWidth:Math.max(b.clientWidth,q.innerWidth||0),$pageHeight:be.body.offsetHeight||0,$pageWidth:be.body.offsetWidth||0},v.each(c,function(k){if(!l[k]&&h.hasAttribute(k)){var C=h.getAttribute(k);qa(C)&&(d["$el_attr__"+k]=C)}}),a&&(S=q0(h,n,t,i),S&&S.length&&(d.$el_text=S)),n.type===$i&&(v.each(rP,function(k){k in n&&(d["$"+k]=n[k])}),u&&(d.$captured_for_heatmap=!0),h=cP(n)),a){var S=q0(h,n,t,i);S&&S.length&&(d.$el_text=S)}if(h){if(!Fd(h,n,t,i)||Bd(h,n,o,s))return null;var w=z0(h,n,l,c,t,i);d.$target=w,d.$el_classes=w.$classes,v.extend(d,v.strip_empty_properties({$el_id:w.$id,$el_tag_name:w.$tag_name}))}}}return d}function q0(n,e,t,i){var r="";return jd(n,e,t,i)&&n.childNodes&&n.childNodes.length&&v.each(n.childNodes,function(o){G0(o)&&o.textContent&&(r+=v.trim(o.textContent).split(/(\s+)/).filter(qa).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),v.trim(r)}function cP(n){for(var e=n.target,t=n.composedPath(),i=0;i<t.length;i++){var r=t[i];if(Cn(r,"a")||Cn(r,"button")||Cn(r,"input")||Cn(r,"select")||r.getAttribute&&r.getAttribute("role")==="button"){e=r;break}if(r===e)break}return e}function Fd(n,e,t,i){if(t)try{if(!t(n,e))return!1}catch(s){return Pt.critical("Error while checking element in allowElementCallback",s),!1}if(!i.length)return!0;for(var r=0;r<i.length;r++){var o=i[r];try{if(n.matches(o))return!0}catch(s){Pt.critical("Error while checking selector: "+o,s)}}return!1}function Bd(n,e,t,i){var r;if(t)try{if(t(n,e))return!0}catch(a){return Pt.critical("Error while checking element in blockElementCallback",a),!0}if(i&&i.length)for(r=0;r<i.length;r++){var o=i[r];try{if(n.matches(o))return!0}catch(a){Pt.critical("Error while checking selector: "+o,a)}}var s=Ud(n);for(r=0;r<Ld.length;r++)if(s[Ld[r]])return!0;return!1}function W0(n){return n&&n.nodeType===1}function Cn(n,e){return n&&n.tagName&&n.tagName.toLowerCase()===e.toLowerCase()}function G0(n){return n&&n.nodeType===3}function uP(){try{var n=be.createElement("div");return!!n.matches}catch{return!1}}function lP(n,e){if(!n||Cn(n,"html")||!W0(n))return!1;var t=n.tagName.toLowerCase();switch(t){case"form":return e.type===Dd;case"input":return["button","submit"].indexOf(n.getAttribute("type"))===-1?e.type===za:e.type===$i;case"select":case"textarea":return e.type===za;default:return e.type===$i}}function jd(n,e,t,i){var r;if(!Fd(n,e,t,i))return!1;for(var o=n;o.parentNode&&!Cn(o,"body");o=o.parentNode){var s=Ud(o);for(r=0;r<j0.length;r++)if(s[j0[r]])return!1}var a=Ud(n);for(r=0;r<B0.length;r++)if(a[B0[r]])return!0;if(Cn(n,"input")||Cn(n,"select")||Cn(n,"textarea")||n.getAttribute("contenteditable")==="true")return!1;var c=n.type||"";if(typeof c=="string")switch(c.toLowerCase()){case"hidden":return!1;case"password":return!1}var u=n.name||n.id||"";if(typeof u=="string"){var l=/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;if(l.test(u.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function qa(n){if(n===null||v.isUndefined(n))return!1;if(typeof n=="string"){n=v.trim(n);var e=/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/;if(e.test((n||"").replace(/[- ]/g,"")))return!1;var t=/(^\d{3}-?\d{2}-?\d{4}$)/;if(t.test(n))return!1}return!0}var dP=30,hP=1e3,pP=4;function $0(){this.clicks=[]}$0.prototype.isRageClick=function(n,e,t){t=t||{};var i=t.threshold_px||dP,r=t.timeout_ms||hP,o=t.click_count||pP,s=Date.now(),a=this.clicks[this.clicks.length-1];if(a&&s-a.timestamp<r&&Math.sqrt(Math.pow(n-a.x,2)+Math.pow(e-a.y,2))<i){if(this.clicks.push({x:n,y:e,timestamp:s}),this.clicks.length>=o)return this.clicks=[],!0}else this.clicks=[{x:n,y:e,timestamp:s}];return!1};var H0="autocapture",fP="track_pageview",K0="full-url",mP="url-with-path-and-query-string",gP="url-with-path",vP="allow_element_callback",Y0="allow_selectors",X0="allow_url_regexes",J0="block_attrs",Z0="block_element_callback",Q0="block_selectors",ey="block_url_regexes",ty="capture_extra_attrs",ny="capture_text_content",iy="scroll_capture_all",ry="scroll_depth_percent_checkpoints",Wa="click",Vd="input",oy="pageview",sy="rage_click",zd="scroll",qd="submit",ht={};ht[Y0]=[],ht[X0]=[],ht[J0]=[],ht[Z0]=null,ht[Q0]=[],ht[ey]=[],ht[ty]=[],ht[ny]=!1,ht[iy]=!1,ht[ry]=[25,50,75,100],ht[Wa]=!0,ht[Vd]=!0,ht[oy]=K0,ht[sy]=!0,ht[zd]=!0,ht[qd]=!0;var Ga={$mp_autocapture:!0},ay="$mp_click",yP="$mp_input_change",cy="$mp_rage_click",bP="$mp_scroll",_P="$mp_submit",Ot=function(n){this.mp=n};Ot.prototype.init=function(){if(!uP()){Pt.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageviewTracking(),this.initClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking(),this.initRageClickTracking()},Ot.prototype.getFullConfig=function(){var n=this.mp.get_config(H0);return n?v.isObject(n)?v.extend({},ht,n):ht:{}},Ot.prototype.getConfig=function(n){return this.getFullConfig()[n]},Ot.prototype.currentUrlBlocked=function(){var n,e=v.info.currentUrl(),t=this.getConfig(X0)||[];if(t.length){var i=!1;for(n=0;n<t.length;n++){var r=t[n];try{if(e.match(r)){i=!0;break}}catch(s){return Pt.critical("Error while checking block URL regex: "+r,s),!0}}if(!i)return!0}var o=this.getConfig(ey)||[];if(!o||!o.length)return!1;for(n=0;n<o.length;n++)try{if(e.match(o[n]))return!0}catch(s){return Pt.critical("Error while checking block URL regex: "+o[n],s),!0}return!1},Ot.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(H0)?this.getConfig(oy):this.mp.get_config(fP)},Ot.prototype.trackDomEvent=function(n,e){if(!this.currentUrlBlocked()){var t=this.mp.is_recording_heatmap_data()&&(e===ay&&!this.getConfig(Wa)||e===cy&&!this._getRageClickConfig()),i=aP(n,{allowElementCallback:this.getConfig(vP),allowSelectors:this.getConfig(Y0),blockAttrs:this.getConfig(J0),blockElementCallback:this.getConfig(Z0),blockSelectors:this.getConfig(Q0),captureExtraAttrs:this.getConfig(ty),captureTextContent:this.getConfig(ny),capturedForHeatMap:t});i&&(v.extend(i,Ga),this.mp.track(e,i))}},Ot.prototype._getRageClickConfig=function(){var n=this.getConfig(sy);return n?n===!0?{}:typeof n=="object"?n:{}:null},Ot.prototype.initClickTracking=function(){q.removeEventListener($i,this.listenerClick),!(!this.getConfig(Wa)&&!this.mp.get_config("record_heatmap_data"))&&(Pt.log("Initializing click tracking"),this.listenerClick=q.addEventListener($i,(function(n){!this.getConfig(Wa)&&!this.mp.is_recording_heatmap_data()||this.trackDomEvent(n,ay)}).bind(this)))},Ot.prototype.initInputTracking=function(){q.removeEventListener(za,this.listenerChange),this.getConfig(Vd)&&(Pt.log("Initializing input tracking"),this.listenerChange=q.addEventListener(za,(function(n){this.getConfig(Vd)&&this.trackDomEvent(n,yP)}).bind(this)))},Ot.prototype.initPageviewTracking=function(){if(q.removeEventListener(U0,this.listenerPopstate),q.removeEventListener(L0,this.listenerHashchange),q.removeEventListener(Ur,this.listenerLocationchange),!!this.pageviewTrackingConfig()){Pt.log("Initializing pageview tracking");var n="",e=!1;this.currentUrlBlocked()||(e=this.mp.track_pageview(Ga)),e&&(n=v.info.currentUrl()),this.listenerPopstate=q.addEventListener(U0,function(){q.dispatchEvent(new Event(Ur))}),this.listenerHashchange=q.addEventListener(L0,function(){q.dispatchEvent(new Event(Ur))});var t=q.history.pushState;typeof t=="function"&&(q.history.pushState=function(r,o,s){t.call(q.history,r,o,s),q.dispatchEvent(new Event(Ur))});var i=q.history.replaceState;typeof i=="function"&&(q.history.replaceState=function(r,o,s){i.call(q.history,r,o,s),q.dispatchEvent(new Event(Ur))}),this.listenerLocationchange=q.addEventListener(Ur,xd((function(){if(!this.currentUrlBlocked()){var r=v.info.currentUrl(),o=!1,s=r.split("#")[0].split("?")[0]!==n.split("#")[0].split("?")[0],a=this.pageviewTrackingConfig();if(a===K0?o=r!==n:a===mP?o=r.split("#")[0]!==n.split("#")[0]:a===gP&&(o=s),o){var c=this.mp.track_pageview(Ga);c&&(n=r),s&&(this.lastScrollCheckpoint=0,Pt.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)))}},Ot.prototype.initRageClickTracking=function(){q.removeEventListener($i,this.listenerRageClick);var n=this._getRageClickConfig();!n&&!this.mp.get_config("record_heatmap_data")||(Pt.log("Initializing rage click tracking"),this._rageClickTracker||(this._rageClickTracker=new $0),this.listenerRageClick=(function(e){var t=this._getRageClickConfig();!t&&!this.mp.is_recording_heatmap_data()||this.currentUrlBlocked()||this._rageClickTracker.isRageClick(e.pageX,e.pageY,t)&&this.trackDomEvent(e,cy)}).bind(this),q.addEventListener($i,this.listenerRageClick))},Ot.prototype.initScrollTracking=function(){q.removeEventListener(F0,this.listenerScroll),this.getConfig(zd)&&(Pt.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0,this.listenerScroll=q.addEventListener(F0,xd((function(){if(this.getConfig(zd)&&!this.currentUrlBlocked()){var n=this.getConfig(iy),e=(this.getConfig(ry)||[]).slice().sort(function(c,u){return c-u}),t=q.scrollY,i=v.extend({$scroll_top:t},Ga);try{var r=be.body.scrollHeight,o=Math.round(t/(r-q.innerHeight)*100);if(i.$scroll_height=r,i.$scroll_percentage=o,o>this.lastScrollCheckpoint)for(var s=0;s<e.length;s++){var a=e[s];o>=a&&this.lastScrollCheckpoint<a&&(i.$scroll_checkpoint=a,this.lastScrollCheckpoint=a,n=!0)}}catch(c){Pt.critical("Error while calculating scroll percentage",c)}n&&this.mp.track(bP,i)}}).bind(this))))},Ot.prototype.initSubmitTracking=function(){q.removeEventListener(Dd,this.listenerSubmit),this.getConfig(qd)&&(Pt.log("Initializing submit tracking"),this.listenerSubmit=q.addEventListener(Dd,(function(n){this.getConfig(qd)&&this.trackDomEvent(n,_P)}).bind(this)))},S0(Ot);var kP=q.fetch,At=Gi("flags"),$a="flags",Ha="context",Wd={};Wd[Ha]={};var ae=function(n){this.getFullApiRoute=n.getFullApiRoute,this.getMpConfig=n.getConfigFunc,this.setMpConfig=n.setConfigFunc,this.getMpProperty=n.getPropertyFunc,this.track=n.trackingFunc};ae.prototype.init=function(){if(!SP()){At.critical("Feature Flags unavailable: missing minimum required APIs");return}this.flags=null,this.fetchFlags(),this.trackedFeatures=new Set},ae.prototype.getFullConfig=function(){var n=this.getMpConfig($a);return n?v.isObject(n)?v.extend({},Wd,n):Wd:{}},ae.prototype.getConfig=function(n){return this.getFullConfig()[n]},ae.prototype.isSystemEnabled=function(){return!!this.getMpConfig($a)},ae.prototype.updateContext=function(n,e){if(!this.isSystemEnabled())return At.critical("Feature Flags not enabled, cannot update context"),Promise.resolve();var t=this.getMpConfig($a);v.isObject(t)||(t={});var i=e&&e.replace?{}:this.getConfig(Ha);return t[Ha]=v.extend({},i,n),this.setMpConfig($a,t),this.fetchFlags()},ae.prototype.areFlagsReady=function(){return this.isSystemEnabled()||At.error("Feature Flags not enabled"),!!this.flags},ae.prototype.fetchFlags=function(){if(!this.isSystemEnabled())return Promise.resolve();var n=this.getMpProperty("distinct_id"),e=this.getMpProperty("$device_id");At.log("Fetching flags for distinct ID: "+n);var t={context:v.extend({distinct_id:n,device_id:e},this.getConfig(Ha))};return this._fetchInProgressStartTime=Date.now(),this.fetchPromise=q.fetch(this.getFullApiRoute(),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getMpConfig("token")+":"),"Content-Type":"application/octet-stream"},body:JSON.stringify(t)}).then((function(i){return this.markFetchComplete(),i.json().then((function(r){var o=r.flags;if(!o)throw new Error("No flags in API response");var s=new Map;v.each(o,function(a,c){s.set(c,{key:a.variant_key,value:a.variant_value})}),this.flags=s}).bind(this)).catch((function(r){this.markFetchComplete(),At.error(r)}).bind(this))}).bind(this)).catch((function(i){this.markFetchComplete(),At.error(i)}).bind(this)),this.fetchPromise},ae.prototype.markFetchComplete=function(){if(!this._fetchInProgressStartTime){At.error("Fetch in progress started time not set, cannot mark fetch complete");return}this._fetchStartTime=this._fetchInProgressStartTime,this._fetchCompleteTime=Date.now(),this._fetchLatency=this._fetchCompleteTime-this._fetchStartTime,this._fetchInProgressStartTime=null},ae.prototype.getVariant=function(n,e){return this.fetchPromise?this.fetchPromise.then((function(){return this.getVariantSync(n,e)}).bind(this)).catch(function(t){return At.error(t),e}):new Promise(function(t){At.critical("Feature Flags not initialized"),t(e)})},ae.prototype.getVariantSync=function(n,e){if(!this.areFlagsReady())return At.log("Flags not loaded yet"),e;var t=this.flags.get(n);return t?(this.trackFeatureCheck(n,t),t):(At.log('No flag found: "'+n+'"'),e)},ae.prototype.getVariantValue=function(n,e){return this.getVariant(n,{value:e}).then(function(t){return t.value}).catch(function(t){return At.error(t),e})},ae.prototype.getFeatureData=function(n,e){return At.critical("mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead."),this.getVariantValue(n,e)},ae.prototype.getVariantValueSync=function(n,e){return this.getVariantSync(n,{value:e}).value},ae.prototype.isEnabled=function(n,e){return this.getVariantValue(n).then((function(){return this.isEnabledSync(n,e)}).bind(this)).catch(function(t){return At.error(t),e})},ae.prototype.isEnabledSync=function(n,e){e=e||!1;var t=this.getVariantValueSync(n,e);return t!==!0&&t!==!1&&(At.error('Feature flag "'+n+'" value: '+t+" is not a boolean; returning fallback value: "+e),t=e),t},ae.prototype.trackFeatureCheck=function(n,e){this.trackedFeatures.has(n)||(this.trackedFeatures.add(n),this.track("$experiment_started",{"Experiment name":n,"Variant name":e.key,$experiment_type:"feature_flag","Variant fetch start time":new Date(this._fetchStartTime).toISOString(),"Variant fetch complete time":new Date(this._fetchCompleteTime).toISOString(),"Variant fetch latency (ms)":this._fetchLatency}))};function SP(){return!!kP&&typeof Promise<"u"&&typeof Map<"u"&&typeof Set<"u"}S0(ae),ae.prototype.are_flags_ready=ae.prototype.areFlagsReady,ae.prototype.get_variant=ae.prototype.getVariant,ae.prototype.get_variant_sync=ae.prototype.getVariantSync,ae.prototype.get_variant_value=ae.prototype.getVariantValue,ae.prototype.get_variant_value_sync=ae.prototype.getVariantValueSync,ae.prototype.is_enabled=ae.prototype.isEnabled,ae.prototype.is_enabled_sync=ae.prototype.isEnabledSync,ae.prototype.update_context=ae.prototype.updateContext,ae.prototype.get_feature_data=ae.prototype.getFeatureData;var qn=function(){};qn.prototype.create_properties=function(){},qn.prototype.event_handler=function(){},qn.prototype.after_track_handler=function(){},qn.prototype.init=function(n){return this.mp=n,this},qn.prototype.track=function(n,e,t,i){var r=this,o=v.dom_query(n);if(o.length===0){_e.error("The DOM query ("+n+") returned 0 elements");return}return v.each(o,function(s){v.register_event(s,this.override_event,function(a){var c={},u=r.create_properties(t,this),l=r.mp.get_config("track_links_timeout");r.event_handler(a,this,c),window.setTimeout(r.track_callback(i,u,c,!0),l),r.mp.track(e,u,r.track_callback(i,u,c))})},this),!0},qn.prototype.track_callback=function(n,e,t,i){i=i||!1;var r=this;return function(){t.callback_fired||(t.callback_fired=!0,!(n&&n(i,e)===!1)&&r.after_track_handler(e,t,i))}},qn.prototype.create_properties=function(n,e){var t;return typeof n=="function"?t=n(e):t=v.extend({},n),t};var Fr=function(){this.override_event="click"};v.inherit(Fr,qn),Fr.prototype.create_properties=function(n,e){var t=Fr.superclass.create_properties.apply(this,arguments);return e.href&&(t.url=e.href),t},Fr.prototype.event_handler=function(n,e,t){t.new_tab=n.which===2||n.metaKey||n.ctrlKey||e.target==="_blank",t.href=e.href,t.new_tab||n.preventDefault()},Fr.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Ka=function(){this.override_event="submit"};v.inherit(Ka,qn),Ka.prototype.event_handler=function(n,e,t){t.element=e,n.preventDefault()},Ka.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var pi="$set",Br="$set_once",sn="$unset",Hi="$add",Tn="$append",Ki="$union",Wn="$remove",wP="$delete",uy={set_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(r,o){this._is_reserved_property(o)||(i[o]=r)},this):i[n]=e,t[pi]=i,t},unset_action:function(n){var e={},t=[];return v.isArray(n)||(n=[n]),v.each(n,function(i){this._is_reserved_property(i)||t.push(i)},this),e[sn]=t,e},set_once_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(r,o){this._is_reserved_property(o)||(i[o]=r)},this):i[n]=e,t[Br]=i,t},union_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(r,o){this._is_reserved_property(o)||(i[o]=v.isArray(r)?r:[r])},this):i[n]=v.isArray(e)?e:[e],t[Ki]=i,t},append_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(r,o){this._is_reserved_property(o)||(i[o]=r)},this):i[n]=e,t[Tn]=i,t},remove_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(r,o){this._is_reserved_property(o)||(i[o]=r)},this):i[n]=e,t[Wn]=i,t},delete_action:function(){var n={};return n[wP]="",n}},Fe=function(){};v.extend(Fe.prototype,uy),Fe.prototype._init=function(n,e,t){this._mixpanel=n,this._group_key=e,this._group_id=t},Fe.prototype.set=Nr(function(n,e,t){var i=this.set_action(n,e);return v.isObject(n)&&(t=e),this._send_request(i,t)}),Fe.prototype.set_once=Nr(function(n,e,t){var i=this.set_once_action(n,e);return v.isObject(n)&&(t=e),this._send_request(i,t)}),Fe.prototype.unset=Nr(function(n,e){var t=this.unset_action(n);return this._send_request(t,e)}),Fe.prototype.union=Nr(function(n,e,t){v.isObject(n)&&(t=e);var i=this.union_action(n,e);return this._send_request(i,t)}),Fe.prototype.delete=Nr(function(n){var e=this.delete_action();return this._send_request(e,n)}),Fe.prototype.remove=Nr(function(n,e,t){var i=this.remove_action(n,e);return this._send_request(i,t)}),Fe.prototype._send_request=function(n,e){n.$group_key=this._group_key,n.$group_id=this._group_id,n.$token=this._get_config("token");var t=v.encodeDates(n);return this._mixpanel._track_or_batch({type:"groups",data:t,endpoint:this._mixpanel.get_api_host("groups")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)},Fe.prototype._is_reserved_property=function(n){return n==="$group_key"||n==="$group_id"},Fe.prototype._get_config=function(n){return this._mixpanel.get_config(n)},Fe.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},Fe.prototype.remove=Fe.prototype.remove,Fe.prototype.set=Fe.prototype.set,Fe.prototype.set_once=Fe.prototype.set_once,Fe.prototype.union=Fe.prototype.union,Fe.prototype.unset=Fe.prototype.unset,Fe.prototype.toString=Fe.prototype.toString;var ee=function(){};v.extend(ee.prototype,uy),ee.prototype._init=function(n){this._mixpanel=n},ee.prototype.set=hi(function(n,e,t){var i=this.set_action(n,e);return v.isObject(n)&&(t=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[pi]=v.extend({},v.info.people_properties(),i[pi]),this._send_request(i,t)}),ee.prototype.set_once=hi(function(n,e,t){var i=this.set_once_action(n,e);return v.isObject(n)&&(t=e),this._send_request(i,t)}),ee.prototype.unset=hi(function(n,e){var t=this.unset_action(n);return this._send_request(t,e)}),ee.prototype.increment=hi(function(n,e,t){var i={},r={};return v.isObject(n)?(v.each(n,function(o,s){if(!this._is_reserved_property(s))if(isNaN(parseFloat(o))){_e.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else r[s]=o},this),t=e):(v.isUndefined(e)&&(e=1),r[n]=e),i[Hi]=r,this._send_request(i,t)}),ee.prototype.append=hi(function(n,e,t){v.isObject(n)&&(t=e);var i=this.append_action(n,e);return this._send_request(i,t)}),ee.prototype.remove=hi(function(n,e,t){v.isObject(n)&&(t=e);var i=this.remove_action(n,e);return this._send_request(i,t)}),ee.prototype.union=hi(function(n,e,t){v.isObject(n)&&(t=e);var i=this.union_action(n,e);return this._send_request(i,t)}),ee.prototype.track_charge=hi(function(){_e.error("mixpanel.people.track_charge() is deprecated and no longer has any effect.")}),ee.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},ee.prototype.delete_user=function(){if(!this._identify_called()){_e.error("mixpanel.people.delete_user() requires you to call identify() first");return}var n={$delete:this._mixpanel.get_distinct_id()};return this._send_request(n)},ee.prototype.toString=function(){return this._mixpanel.toString()+".people"},ee.prototype._send_request=function(n,e){n.$token=this._get_config("token"),n.$distinct_id=this._mixpanel.get_distinct_id();var t=this._mixpanel.get_property("$device_id"),i=this._mixpanel.get_property("$user_id"),r=this._mixpanel.get_property("$had_persisted_distinct_id");t&&(n.$device_id=t),i&&(n.$user_id=i),r&&(n.$had_persisted_distinct_id=r);var o=v.encodeDates(n);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:o,endpoint:this._mixpanel.get_api_host("people")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(n),v.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),v.truncate(o,255))},ee.prototype._get_config=function(n){return this._mixpanel.get_config(n)},ee.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},ee.prototype._enqueue=function(n){pi in n?this._mixpanel.persistence._add_to_people_queue(pi,n):Br in n?this._mixpanel.persistence._add_to_people_queue(Br,n):sn in n?this._mixpanel.persistence._add_to_people_queue(sn,n):Hi in n?this._mixpanel.persistence._add_to_people_queue(Hi,n):Tn in n?this._mixpanel.persistence._add_to_people_queue(Tn,n):Wn in n?this._mixpanel.persistence._add_to_people_queue(Wn,n):Ki in n?this._mixpanel.persistence._add_to_people_queue(Ki,n):_e.error("Invalid call to _enqueue():",n)},ee.prototype._flush_one_queue=function(n,e,t,i){var r=this,o=v.extend({},this._mixpanel.persistence.load_queue(n)),s=o;!v.isUndefined(o)&&v.isObject(o)&&!v.isEmptyObject(o)&&(r._mixpanel.persistence._pop_from_people_queue(n,o),r._mixpanel.persistence.save(),i&&(s=i(o)),e.call(r,s,function(a,c){a===0&&r._mixpanel.persistence._add_to_people_queue(n,o),v.isUndefined(t)||t(a,c)}))},ee.prototype._flush=function(n,e,t,i,r,o,s){var a=this;this._flush_one_queue(pi,this.set,n),this._flush_one_queue(Br,this.set_once,i),this._flush_one_queue(sn,this.unset,o,function(g){return v.keys(g)}),this._flush_one_queue(Hi,this.increment,e),this._flush_one_queue(Ki,this.union,r);var c=this._mixpanel.persistence.load_queue(Tn);if(!v.isUndefined(c)&&v.isArray(c)&&c.length)for(var u,l=function(g,y){g===0&&a._mixpanel.persistence._add_to_people_queue(Tn,u),v.isUndefined(t)||t(g,y)},d=c.length-1;d>=0;d--)c=this._mixpanel.persistence.load_queue(Tn),u=c.pop(),a._mixpanel.persistence.save(),v.isEmptyObject(u)||a.append(u,l);var h=this._mixpanel.persistence.load_queue(Wn);if(!v.isUndefined(h)&&v.isArray(h)&&h.length)for(var p,m=function(g,y){g===0&&a._mixpanel.persistence._add_to_people_queue(Wn,p),v.isUndefined(s)||s(g,y)},f=h.length-1;f>=0;f--)h=this._mixpanel.persistence.load_queue(Wn),p=h.pop(),a._mixpanel.persistence.save(),v.isEmptyObject(p)||a.remove(p,m)},ee.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},ee.prototype.set=ee.prototype.set,ee.prototype.set_once=ee.prototype.set_once,ee.prototype.unset=ee.prototype.unset,ee.prototype.increment=ee.prototype.increment,ee.prototype.append=ee.prototype.append,ee.prototype.remove=ee.prototype.remove,ee.prototype.union=ee.prototype.union,ee.prototype.track_charge=ee.prototype.track_charge,ee.prototype.clear_charges=ee.prototype.clear_charges,ee.prototype.delete_user=ee.prototype.delete_user,ee.prototype.toString=ee.prototype.toString;var Gd="__mps",$d="__mpso",Hd="__mpus",Kd="__mpa",Yd="__mpap",Xd="__mpr",Jd="__mpu",ly="$people_distinct_id",Ya="__alias",Yo="__timers",CP=[Gd,$d,Hd,Kd,Yd,Xd,Jd,ly,Ya,Yo],re=function(n){this.props={},this.campaign_params_saved=!1,n.persistence_name?this.name="mp_"+n.persistence_name:this.name="mp_"+n.token+"_mixpanel";var e=n.persistence;e!=="cookie"&&e!=="localStorage"&&(_e.critical("Unknown persistence type "+e+"; falling back to cookie"),e=n.persistence="cookie"),e==="localStorage"&&v.localStorage.is_supported()?this.storage=v.localStorage:this.storage=v.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};re.prototype.properties=function(){var n={};return this.load(),v.each(this.props,function(e,t){v.include(CP,t)||(n[t]=e)}),n},re.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=v.extend({},n))}},re.prototype.upgrade=function(){var n,e;this.storage===v.localStorage?(n=v.cookie.parse(this.name),v.cookie.remove(this.name),v.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===v.cookie&&(e=v.localStorage.parse(this.name),v.localStorage.remove(this.name),e&&this.register_once(e))},re.prototype.save=function(){this.disabled||this.storage.set(this.name,Mr(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},re.prototype.load_prop=function(n){return this.load(),this.props[n]},re.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},re.prototype.clear=function(){this.remove(),this.props={}},re.prototype.register_once=function(n,e,t){return v.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),v.each(n,function(i,r){(!this.props.hasOwnProperty(r)||this.props[r]===e)&&(this.props[r]=i)},this),this.save(),!0):!1},re.prototype.register=function(n,e){return v.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),v.extend(this.props,n),this.save(),!0):!1},re.prototype.unregister=function(n){this.load(),n in this.props&&(delete this.props[n],this.save())},re.prototype.update_search_keyword=function(n){this.register(v.info.searchInfo(n))},re.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:v.info.referringDomain(n)||"$direct"},"")},re.prototype.get_referrer_info=function(){return v.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},re.prototype.update_config=function(n){this.default_expiry=this.expire_days=n.cookie_expiration,this.set_disabled(n.disable_persistence),this.set_cookie_domain(n.cookie_domain),this.set_cross_site(n.cross_site_cookie),this.set_cross_subdomain(n.cross_subdomain_cookie),this.set_secure(n.secure_cookie)},re.prototype.set_disabled=function(n){this.disabled=n,this.disabled?this.remove():this.save()},re.prototype.set_cookie_domain=function(n){n!==this.cookie_domain&&(this.remove(),this.cookie_domain=n,this.save())},re.prototype.set_cross_site=function(n){n!==this.cross_site&&(this.cross_site=n,this.remove(),this.save())},re.prototype.set_cross_subdomain=function(n){n!==this.cross_subdomain&&(this.cross_subdomain=n,this.remove(),this.save())},re.prototype.get_cross_subdomain=function(){return this.cross_subdomain},re.prototype.set_secure=function(n){n!==this.secure&&(this.secure=!!n,this.remove(),this.save())},re.prototype._add_to_people_queue=function(n,e){var t=this._get_queue_key(n),i=e[n],r=this._get_or_create_queue(pi),o=this._get_or_create_queue(Br),s=this._get_or_create_queue(sn),a=this._get_or_create_queue(Hi),c=this._get_or_create_queue(Ki),u=this._get_or_create_queue(Wn,[]),l=this._get_or_create_queue(Tn,[]);t===Gd?(v.extend(r,i),this._pop_from_people_queue(Hi,i),this._pop_from_people_queue(Ki,i),this._pop_from_people_queue(sn,i)):t===$d?(v.each(i,function(d,h){h in o||(o[h]=d)}),this._pop_from_people_queue(sn,i)):t===Hd?v.each(i,function(d){v.each([r,o,a,c],function(h){d in h&&delete h[d]}),v.each(l,function(h){d in h&&delete h[d]}),s[d]=!0}):t===Kd?(v.each(i,function(d,h){h in r?r[h]+=d:(h in a||(a[h]=0),a[h]+=d)},this),this._pop_from_people_queue(sn,i)):t===Jd?(v.each(i,function(d,h){v.isArray(d)&&(h in c||(c[h]=[]),v.each(d,function(p){v.include(c[h],p)||c[h].push(p)}))}),this._pop_from_people_queue(sn,i)):t===Xd?(u.push(i),this._pop_from_people_queue(Tn,i)):t===Yd&&(l.push(i),this._pop_from_people_queue(sn,i)),_e.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),_e.log(e),this.save()},re.prototype._pop_from_people_queue=function(n,e){var t=this.props[this._get_queue_key(n)];v.isUndefined(t)||v.each(e,function(i,r){n===Tn||n===Wn?v.each(t,function(o){o[r]===i&&delete o[r]}):delete t[r]},this)},re.prototype.load_queue=function(n){return this.load_prop(this._get_queue_key(n))},re.prototype._get_queue_key=function(n){if(n===pi)return Gd;if(n===Br)return $d;if(n===sn)return Hd;if(n===Hi)return Kd;if(n===Tn)return Yd;if(n===Wn)return Xd;if(n===Ki)return Jd;_e.error("Invalid queue:",n)},re.prototype._get_or_create_queue=function(n,e){var t=this._get_queue_key(n);return e=v.isUndefined(e)?{}:e,this.props[t]||(this.props[t]=e)},re.prototype.set_event_timer=function(n,e){var t=this.load_prop(Yo)||{};t[n]=e,this.props[Yo]=t,this.save()},re.prototype.remove_event_timer=function(n){var e=this.load_prop(Yo)||{},t=e[n];return v.isUndefined(t)||(delete this.props[Yo][n],this.save()),t};var Zd,dy=function(n,e){throw new Error(n+" not available in this build.")},Tt,hy=0,TP=1,xP=function(n){return n},Yt="mixpanel",py="base64",EP="json",Qd="$device:",jr=q.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,fy=!jr&&Vn.indexOf("MSIE")===-1&&Vn.indexOf("Mozilla")===-1,Xa=null;ui.sendBeacon&&(Xa=function(){return ui.sendBeacon.apply(ui,arguments)});var my={track:"track/",engage:"engage/",groups:"groups/",record:"record/",flags:"flags/"},gy={api_host:"https://api-js.mixpanel.com",api_hosts:{},api_routes:my,api_extra_query_params:{},api_method:"POST",api_transport:"XHR",api_payload_format:py,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:li,flags:!1,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:li,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video, audio",record_canvas:!1,record_collect_fonts:!1,record_heatmap_data:!1,record_idle_timeout_ms:30*60*1e3,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:qo,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},vy=!1,E=function(){},eh=function(n,e,t){var i,r=t===Yt?Tt:Tt[t];if(r&&Zd===hy)i=r;else{if(r&&!v.isArray(r)){_e.error("You have already initialized "+t);return}i=new E}if(i._cached_groups={},i._init(n,e,t),i.people=new ee,i.people._init(i),!i.get_config("skip_first_touch_marketing")){var o=v.info.campaignParams(null),s={},a=!1;v.each(o,function(c,u){s["initial_"+u]=c,c&&(a=!0)}),a&&i.people.set_once(s)}return on.DEBUG=on.DEBUG||i.get_config("debug"),!v.isUndefined(r)&&v.isArray(r)&&(i._execute_array.call(i.people,r.people),i._execute_array(r)),i};E.prototype.init=function(n,e,t){if(v.isUndefined(t)){this.report_error("You must name your new library: init(token, config, name)");return}if(t===Yt){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var i=eh(n,e,t);return Tt[t]=i,i._loaded(),i},E.prototype._init=function(n,e,t){e=e||{},this.__loaded=!0,this.config={};var i={};if(!("api_payload_format"in e)){var r=e.api_host||gy.api_host;r.match(/\.mixpanel\.com/)&&(i.api_payload_format=EP)}if(this.set_config(v.extend({},gy,i,e,{name:t,token:n,callback_fn:(t===Yt?t:Yt+"."+t)+"._jsc"})),this._jsc=li,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!v.localStorage.is_supported(!0)||!jr)this._batch_requests=!1,_e.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),v.each(this.get_batcher_configs(),function(a){_e.log("Clearing batch queue "+a.queue_key),v.localStorage.remove(a.queue_key)});else if(this.init_batchers(),Xa&&q.addEventListener){var o=v.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);q.addEventListener("pagehide",function(a){a.persisted&&o()}),q.addEventListener("visibilitychange",function(){be.visibilityState==="hidden"&&o()})}}this.persistence=this.cookie=new re(this.config),this.unpersisted_superprops={},this._gdpr_init();var s=v.UUID();this.get_distinct_id()||this.register_once({distinct_id:Qd+s,$device_id:s},""),this.flags=new ae({getFullApiRoute:v.bind(function(){return this.get_api_host("flags")+"/"+this.get_config("api_routes").flags},this),getConfigFunc:v.bind(this.get_config,this),setConfigFunc:v.bind(this.set_config,this),getPropertyFunc:v.bind(this.get_property,this),trackingFunc:v.bind(this.track,this)}),this.flags.init(),this.flags=this.flags,this.autocapture=new Ot(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},E.prototype._init_tab_id=function(){if(v.sessionStorage.is_supported())try{var n=this.get_config("name")+"_"+this.get_config("token"),e="mp_tab_id_"+n,t="mp_gen_new_tab_id_"+n;(v.sessionStorage.get(t)||!v.sessionStorage.get(e))&&v.sessionStorage.set(e,"$tab-"+v.UUID()),v.sessionStorage.set(t,"1"),this.tab_id=v.sessionStorage.get(e),q.addEventListener("beforeunload",function(){v.sessionStorage.remove(t)})}catch(i){this.report_error("Error initializing tab id",i)}else this.report_error("Session storage is not supported, cannot keep track of unique tab ID.")},E.prototype.get_tab_id=function(){return this.tab_id||null},E.prototype._should_load_recorder=function(){var n=new Sn(Pd),e=this.get_tab_id();return n.init().then(function(){return n.getAll()}).then(function(t){for(var i=0;i<t.length;i++)if(Nd(t[i])||t[i].tabId===e)return!0;return!1}).catch(v.bind(function(t){this.report_error("Error checking recording registry",t)},this))},E.prototype._check_and_start_session_recording=di(function(n){if(!q.MutationObserver){_e.critical("Browser does not support MutationObserver; skipping session recording");return}var e=v.bind(function(i){var r=v.bind(function(){this._recorder=this._recorder||new q.__mp_recorder(this),this._recorder.resumeRecording(i)},this);v.isUndefined(q.__mp_recorder)?dy(this.get_config("recorder_src"),r):r()},this),t=this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent");n||t?e(!0):this._should_load_recorder().then(function(i){i&&e(!1)})}),E.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},E.prototype.stop_session_recording=function(){return this._recorder?this._recorder.stopRecording():Promise.resolve()},E.prototype.pause_session_recording=function(){return this._recorder?this._recorder.pauseRecording():Promise.resolve()},E.prototype.resume_session_recording=function(){return this._recorder?this._recorder.resumeRecording():Promise.resolve()},E.prototype.is_recording_heatmap_data=function(){return this._get_session_replay_id()&&this.get_config("record_heatmap_data")},E.prototype.get_session_recording_properties=function(){var n={},e=this._get_session_replay_id();return e&&(n.$mp_replay_id=e),n},E.prototype.get_session_replay_url=function(){var n=null,e=this._get_session_replay_id();if(e){var t=v.HTTPBuildQuery({replay_id:e,distinct_id:this.get_distinct_id(),token:this.get_config("token")});n="https://mixpanel.com/projects/replay-redirect?"+t}return n},E.prototype._get_session_replay_id=function(){var n=null;return this._recorder&&(n=this._recorder.replayId),n||null},E.prototype.__get_recorder=function(){return this._recorder},E.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var n=v.info.campaignParams(null);v.each(n,(function(e,t){this.unregister(t)}).bind(this))}},E.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(be.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(v.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(be.referrer)},E.prototype._dom_loaded=function(){v.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||v.each(this.__request_queue,function(n){this._send_request.apply(this,n)},this),delete this.__dom_loaded_queue,delete this.__request_queue},E.prototype._track_dom=function(n,e){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!vy)return this.__dom_loaded_queue.push([n,e]),!1;var t=new n().init(this);return t.track.apply(t,e)},E.prototype._prepare_callback=function(n,e){if(v.isUndefined(n))return null;if(jr){var t=function(s){n(s,e)};return t}else{var i=this._jsc,r=""+Math.floor(Math.random()*1e8),o=this.get_config("callback_fn")+"["+r+"]";return i[r]=function(s){delete i[r],n(s,e)},o}},E.prototype._send_request=function(n,e,t,i){var r=!0;if(fy)return this.__request_queue.push(arguments),r;var o={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},s=null;!i&&(v.isFunction(t)||typeof t=="string")&&(i=t,t=null),t=v.extend(o,t||{}),jr||(t.method="GET");var a=t.method==="POST",c=Xa&&a&&t.transport.toLowerCase()==="sendbeacon",u=t.verbose;e.verbose&&(u=!0),this.get_config("test")&&(e.test=1),u&&(e.verbose=1),this.get_config("img")&&(e.img=1),jr||(i?e.callback=i:(u||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),a&&(s="data="+encodeURIComponent(e.data),delete e.data),v.extend(e,this.get_config("api_extra_query_params")),n+="?"+v.HTTPBuildQuery(e);var l=this;if("img"in e){var d=be.createElement("img");d.src=n,be.body.appendChild(d)}else if(c){try{r=Xa(n,s)}catch(y){l.report_error(y),r=!1}try{i&&i(r?1:0)}catch(y){l.report_error(y)}}else if(jr)try{var h=new XMLHttpRequest;h.open(t.method,n,!0);var p=this.get_config("xhr_headers");if(a&&(p["Content-Type"]="application/x-www-form-urlencoded"),v.each(p,function(y,b){h.setRequestHeader(b,y)}),t.timeout_ms&&typeof h.timeout<"u"){h.timeout=t.timeout_ms;var m=new Date().getTime()}h.withCredentials=!0,h.onreadystatechange=function(){if(h.readyState===4)if(h.status===200){if(i)if(u){var y;try{y=v.JSONDecode(h.responseText)}catch(w){if(l.report_error(w),t.ignore_json_errors)y=h.responseText;else return}i(y)}else i(Number(h.responseText))}else{var b;if(h.timeout&&!h.status&&new Date().getTime()-m>=h.timeout?b="timeout":b="Bad HTTP status: "+h.status+" "+h.statusText,l.report_error(b),i)if(u){var S=h.responseHeaders||{};i({status:0,httpStatusCode:h.status,error:b,retryAfter:S["Retry-After"]})}else i(0)}},h.send(s)}catch(y){l.report_error(y),r=!1}else{var f=be.createElement("script");f.type="text/javascript",f.async=!0,f.defer=!0,f.src=n;var g=be.getElementsByTagName("script")[0];g.parentNode.insertBefore(f,g)}return r},E.prototype._execute_array=function(n){var e,t=[],i=[],r=[];v.each(n,function(s){s&&(e=s[0],v.isArray(e)?r.push(s):typeof s=="function"?s.call(this):v.isArray(s)&&e==="alias"?t.push(s):v.isArray(s)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?r.push(s):i.push(s))},this);var o=function(s,a){v.each(s,function(c){if(v.isArray(c[0])){var u=a;v.each(c,function(l){u=u[l[0]].apply(u,l.slice(1))})}else this[c[0]].apply(this,c.slice(1))},a)};o(t,this),o(i,this),o(r,this)},E.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},E.prototype.get_batcher_configs=function(){var n="__mpq_"+this.get_config("token");return this._batcher_configs=this._batcher_configs||{events:{type:"events",api_name:"track",queue_key:n+"_ev"},people:{type:"people",api_name:"engage",queue_key:n+"_pp"},groups:{type:"groups",api_name:"groups",queue_key:n+"_gr"}},this._batcher_configs},E.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var n=v.bind(function(t){return new Kt(t.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:v.bind(function(i,r,o){var s=this.get_config("api_routes");this._send_request(this.get_api_host(t.api_name)+"/"+s[t.api_name],this._encode_data_for_request(i),r,this._prepare_callback(o,i))},this),beforeSendHook:v.bind(function(i){return this._run_hook("before_send_"+t.type,i)},this),stopAllBatchingFunc:v.bind(this.stop_batch_senders,this),usePersistence:!0})},this),e=this.get_batcher_configs();this.request_batchers={events:n(e.events),people:n(e.people),groups:n(e.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},E.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,v.each(this.request_batchers,function(n){n.start()}))},E.prototype.stop_batch_senders=function(){this._batch_requests=!1,v.each(this.request_batchers,function(n){n.stop(),n.clear()})},E.prototype.push=function(n){this._execute_array([n])},E.prototype.disable=function(n){typeof n>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(n)},E.prototype._encode_data_for_request=function(n){var e=Mr(n);return this.get_config("api_payload_format")===py&&(e=v.base64Encode(e)),{data:e}},E.prototype._track_or_batch=function(n,e){var t=v.truncate(n.data,255),i=n.endpoint,r=n.batcher,o=n.should_send_immediately,s=n.send_request_options||{};e=e||li;var a=!0,c=v.bind(function(){return s.skip_hooks||(t=this._run_hook("before_send_"+n.type,t)),t?(_e.log("MIXPANEL REQUEST:"),_e.log(t),this._send_request(i,this._encode_data_for_request(t),s,this._prepare_callback(e,t))):null},this);return this._batch_requests&&!o?r.enqueue(t).then(function(u){u?e(1,t):c()}):a=c(),a&&t},E.prototype.track=di(function(n,e,t,i){!i&&typeof t=="function"&&(i=t,t=null),t=t||{};var r=t.transport;r&&(t.transport=r);var o=t.send_immediately;if(typeof i!="function"&&(i=li),v.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){i(0);return}e=v.extend({},e),e.token=this.get_config("token");var s=this.persistence.remove_event_timer(n);if(!v.isUndefined(s)){var a=new Date().getTime()-s;e.$duration=parseFloat((a/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?v.info.marketingParams():{};e=v.extend({},v.info.properties({mp_loader:this.get_config("mp_loader")}),c,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var u=this.get_config("property_blacklist");v.isArray(u)?v.each(u,function(h){delete e[h]}):this.report_error("Invalid value for property_blacklist config: "+u);var l={event:n,properties:e},d=this._track_or_batch({type:"events",data:l,endpoint:this.get_api_host("events")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:o,send_request_options:t},i);return d}),E.prototype.set_group=di(function(n,e,t){v.isArray(e)||(e=[e]);var i={};return i[n]=e,this.register(i),this.people.set(n,e,t)}),E.prototype.add_group=di(function(n,e,t){var i=this.get_property(n),r={};return i===void 0?(r[n]=[e],this.register(r)):i.indexOf(e)===-1&&(i.push(e),r[n]=i,this.register(r)),this.people.union(n,e,t)}),E.prototype.remove_group=di(function(n,e,t){var i=this.get_property(n);if(i!==void 0){var r=i.indexOf(e);r>-1&&(i.splice(r,1),this.register({group_key:i})),i.length===0&&this.unregister(n)}return this.people.remove(n,e,t)}),E.prototype.track_with_groups=di(function(n,e,t,i){var r=v.extend({},e||{});return v.each(t,function(o,s){o!=null&&(r[s]=o)}),this.track(n,r,i)}),E.prototype._create_map_key=function(n,e){return n+"_"+JSON.stringify(e)},E.prototype._remove_group_from_cache=function(n,e){delete this._cached_groups[this._create_map_key(n,e)]},E.prototype.get_group=function(n,e){var t=this._create_map_key(n,e),i=this._cached_groups[t];return(i===void 0||i._group_key!==n||i._group_id!==e)&&(i=new Fe,i._init(this,n,e),this._cached_groups[t]=i),i},E.prototype.track_pageview=di(function(n,e){typeof n!="object"&&(n={}),e=e||{};var t=e.event_name||"$mp_web_page_view",i=v.extend(v.info.mpPageViewProperties(),v.info.campaignParams(),v.info.clickParams()),r=v.extend({},i,n);return this.track(t,r)}),E.prototype.track_links=function(){return this._track_dom.call(this,Fr,arguments)},E.prototype.track_forms=function(){return this._track_dom.call(this,Ka,arguments)},E.prototype.time_event=function(n){if(v.isUndefined(n)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(n)||this.persistence.set_event_timer(n,new Date().getTime())};var IP={persistent:!0},th=function(n){var e;return v.isObject(n)?e=n:v.isUndefined(n)?e={}:e={days:n},v.extend({},IP,e)};E.prototype.register=function(n,e){var t=th(e);t.persistent?this.persistence.register(n,t.days):v.extend(this.unpersisted_superprops,n)},E.prototype.register_once=function(n,e,t){var i=th(t);i.persistent?this.persistence.register_once(n,e,i.days):(typeof e>"u"&&(e="None"),v.each(n,function(r,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===e)&&(this.unpersisted_superprops[o]=r)},this))},E.prototype.unregister=function(n,e){e=th(e),e.persistent?this.persistence.unregister(n):delete this.unpersisted_superprops[n]},E.prototype._register_single=function(n,e){var t={};t[n]=e,this.register(t)},E.prototype.identify=function(n,e,t,i,r,o,s,a){var c=this.get_distinct_id();if(n&&c!==n){if(typeof n=="string"&&n.indexOf(Qd)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var u=c;this.register_once({$had_persisted_distinct_id:!0,$device_id:u},"")}n!==c&&n!==this.get_property(Ya)&&(this.unregister(Ya),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,t,i,r,o,s,a),n!==c&&this.track("$identify",{distinct_id:n,$anon_distinct_id:c},{skip_hooks:!0}),n!==c&&this.flags.fetchFlags()},E.prototype.reset=function(){this.stop_session_recording(),this.persistence.clear(),this._flags.identify_called=!1;var n=v.UUID();this.register_once({distinct_id:Qd+n,$device_id:n},""),this._check_and_start_session_recording()},E.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},E.prototype.alias=function(n,e){if(n===this.get_property(ly))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var t=this;return v.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(Ya,n),this.track("$create_alias",{alias:n,distinct_id:e},{skip_hooks:!0},function(){t.identify(n)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(n),-1)},E.prototype.name_tag=function(n){this._register_single("mp_name_tag",n)},E.prototype.set_config=function(n){if(v.isObject(n)){v.extend(this.config,n);var e=n.batch_size;e&&v.each(this.request_batchers,function(t){t.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),on.DEBUG=on.DEBUG||this.get_config("debug"),("autocapture"in n||"record_heatmap_data"in n)&&this.autocapture&&this.autocapture.init()}},E.prototype.get_config=function(n){return this.config[n]},E.prototype._run_hook=function(n){var e=(this.config.hooks[n]||xP).apply(this,Wi.call(arguments,1));return typeof e>"u"&&(this.report_error(n+" hook did not return a value"),e=null),e},E.prototype.get_property=function(n){return this.persistence.load_prop([n])},E.prototype.get_api_host=function(n){return this.get_config("api_hosts")[n]||this.get_config("api_host")},E.prototype.toString=function(){var n=this.get_config("name");return n!==Yt&&(n=Yt+"."+n),n},E.prototype._event_is_disabled=function(n){return v.isBlockedUA(Vn)||this._flags.disable_all_events||v.include(this.__disabled_events,n)},E.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&v.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||v.cookie.get("mp_optout"))&&(v.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},E.prototype._gdpr_update_persistence=function(n){var e;if(n&&n.clear_persistence)e=!0;else if(n&&n.enable_persistence)e=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==e&&this.persistence.set_disabled(e),e?(this.stop_batch_senders(),this.stop_session_recording()):this._batchers_were_started&&this.start_batch_senders()},E.prototype._gdpr_call_func=function(n,e){return e=v.extend({track:v.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},e),v.localStorage.is_supported()||(e.persistence_type="cookie"),n(this.get_config("token"),{track:e.track,trackEventName:e.track_event_name,trackProperties:e.track_properties,persistenceType:e.persistence_type,persistencePrefix:e.cookie_prefix,cookieDomain:e.cookie_domain,cookieExpiration:e.cookie_expiration,crossSiteCookie:e.cross_site_cookie,crossSubdomainCookie:e.cross_subdomain_cookie,secureCookie:e.secure_cookie,ignoreDnt:e.ignore_dnt})},E.prototype.opt_in_tracking=function(n){n=v.extend({enable_persistence:!0},n),this._gdpr_call_func(HR,n),this._gdpr_update_persistence(n)},E.prototype.opt_out_tracking=function(n){n=v.extend({clear_persistence:!0,delete_user:!0},n),n.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(KR,n),this._gdpr_update_persistence(n)},E.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(YR,n)},E.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(I0,n)},E.prototype.clear_opt_in_out_tracking=function(n){n=v.extend({enable_persistence:!0},n),this._gdpr_call_func(XR,n),this._gdpr_update_persistence(n)},E.prototype.report_error=function(n,e){_e.error.apply(_e.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(t){_e.error(t)}},E.prototype.init=E.prototype.init,E.prototype.reset=E.prototype.reset,E.prototype.disable=E.prototype.disable,E.prototype.time_event=E.prototype.time_event,E.prototype.track=E.prototype.track,E.prototype.track_links=E.prototype.track_links,E.prototype.track_forms=E.prototype.track_forms,E.prototype.track_pageview=E.prototype.track_pageview,E.prototype.register=E.prototype.register,E.prototype.register_once=E.prototype.register_once,E.prototype.unregister=E.prototype.unregister,E.prototype.identify=E.prototype.identify,E.prototype.alias=E.prototype.alias,E.prototype.name_tag=E.prototype.name_tag,E.prototype.set_config=E.prototype.set_config,E.prototype.get_config=E.prototype.get_config,E.prototype.get_api_host=E.prototype.get_api_host,E.prototype.get_property=E.prototype.get_property,E.prototype.get_distinct_id=E.prototype.get_distinct_id,E.prototype.toString=E.prototype.toString,E.prototype.opt_out_tracking=E.prototype.opt_out_tracking,E.prototype.opt_in_tracking=E.prototype.opt_in_tracking,E.prototype.has_opted_out_tracking=E.prototype.has_opted_out_tracking,E.prototype.has_opted_in_tracking=E.prototype.has_opted_in_tracking,E.prototype.clear_opt_in_out_tracking=E.prototype.clear_opt_in_out_tracking,E.prototype.get_group=E.prototype.get_group,E.prototype.set_group=E.prototype.set_group,E.prototype.add_group=E.prototype.add_group,E.prototype.remove_group=E.prototype.remove_group,E.prototype.track_with_groups=E.prototype.track_with_groups,E.prototype.start_batch_senders=E.prototype.start_batch_senders,E.prototype.stop_batch_senders=E.prototype.stop_batch_senders,E.prototype.start_session_recording=E.prototype.start_session_recording,E.prototype.stop_session_recording=E.prototype.stop_session_recording,E.prototype.pause_session_recording=E.prototype.pause_session_recording,E.prototype.resume_session_recording=E.prototype.resume_session_recording,E.prototype.get_session_recording_properties=E.prototype.get_session_recording_properties,E.prototype.get_session_replay_url=E.prototype.get_session_replay_url,E.prototype.get_tab_id=E.prototype.get_tab_id,E.prototype.DEFAULT_API_ROUTES=my,E.prototype.__get_recorder=E.prototype.__get_recorder,re.prototype.properties=re.prototype.properties,re.prototype.update_search_keyword=re.prototype.update_search_keyword,re.prototype.update_referrer_info=re.prototype.update_referrer_info,re.prototype.get_cross_subdomain=re.prototype.get_cross_subdomain,re.prototype.clear=re.prototype.clear;var Vr={},RP=function(){v.each(Vr,function(n,e){e!==Yt&&(Tt[e]=n)}),Tt._=v},PP=function(){Tt.init=function(n,e,t){if(t)return Tt[t]||(Tt[t]=Vr[t]=eh(n,e,t),Tt[t]._loaded()),Tt[t];var i=Tt;Vr[Yt]?i=Vr[Yt]:n&&(i=eh(n,e,Yt),i._loaded(),Vr[Yt]=i),Tt=i,Zd===TP&&(q[Yt]=Tt),RP()}},OP=function(){function n(){n.done||(n.done=!0,vy=!0,fy=!1,v.each(Vr,function(i){i._dom_loaded()}))}function e(){try{be.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(be.addEventListener)be.readyState==="complete"?n():be.addEventListener("DOMContentLoaded",n,!1);else if(be.attachEvent){be.attachEvent("onreadystatechange",n);var t=!1;try{t=q.frameElement===null}catch{}be.documentElement.doScroll&&t&&e()}v.register_event(q,"load",n,!0)};function AP(n){return dy=n,Zd=hy,Tt=new E,PP(),Tt.init(),OP(),Tt}function MP(n,e){e()}var Xo=AP(MP);function NP(n,e={}){const t=e.instanceName||`obi_${Math.random().toString(36).slice(2)}`;Xo.init(n,{debug:e.debug===!0,track_pageview:!1,persistence:"localStorage",...e.config||{}},t);const i=Xo.get_instance?Xo.get_instance(t):Xo[t],r={identify:(o,s)=>{var a;try{i.identify(o),s&&((a=i==null?void 0:i.people)!=null&&a.set)&&i.people.set(s)}catch{}},track:(o,s)=>{try{i.track(o,s||{})}catch{}},page:(o,s)=>{try{i.track("Page Viewed",{name:o,...s||{}})}catch{}},reset:()=>{try{i.reset()}catch{}}};return typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Xo.track("tab_closed",{page_url:window.location.href},{transport:"sendBeacon"})}),r}function DP(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var yy={exports:{}};(function(n){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(c,u,l){this.fn=c,this.context=u,this.once=l||!1}function o(c,u,l,d,h){if(typeof l!="function")throw new TypeError("The listener must be a function");var p=new r(l,d||c,h),m=t?t+u:u;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],p]:c._events[m].push(p):(c._events[m]=p,c._eventsCount++),c}function s(c,u){--c._eventsCount===0?c._events=new i:delete c._events[u]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],l,d;if(this._eventsCount===0)return u;for(d in l=this._events)e.call(l,d)&&u.push(t?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},a.prototype.listeners=function(u){var l=t?t+u:u,d=this._events[l];if(!d)return[];if(d.fn)return[d.fn];for(var h=0,p=d.length,m=new Array(p);h<p;h++)m[h]=d[h].fn;return m},a.prototype.listenerCount=function(u){var l=t?t+u:u,d=this._events[l];return d?d.fn?1:d.length:0},a.prototype.emit=function(u,l,d,h,p,m){var f=t?t+u:u;if(!this._events[f])return!1;var g=this._events[f],y=arguments.length,b,S;if(g.fn){switch(g.once&&this.removeListener(u,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,l),!0;case 3:return g.fn.call(g.context,l,d),!0;case 4:return g.fn.call(g.context,l,d,h),!0;case 5:return g.fn.call(g.context,l,d,h,p),!0;case 6:return g.fn.call(g.context,l,d,h,p,m),!0}for(S=1,b=new Array(y-1);S<y;S++)b[S-1]=arguments[S];g.fn.apply(g.context,b)}else{var w=g.length,k;for(S=0;S<w;S++)switch(g[S].once&&this.removeListener(u,g[S].fn,void 0,!0),y){case 1:g[S].fn.call(g[S].context);break;case 2:g[S].fn.call(g[S].context,l);break;case 3:g[S].fn.call(g[S].context,l,d);break;case 4:g[S].fn.call(g[S].context,l,d,h);break;default:if(!b)for(k=1,b=new Array(y-1);k<y;k++)b[k-1]=arguments[k];g[S].fn.apply(g[S].context,b)}}return!0},a.prototype.on=function(u,l,d){return o(this,u,l,d,!1)},a.prototype.once=function(u,l,d){return o(this,u,l,d,!0)},a.prototype.removeListener=function(u,l,d,h){var p=t?t+u:u;if(!this._events[p])return this;if(!l)return s(this,p),this;var m=this._events[p];if(m.fn)m.fn===l&&(!h||m.once)&&(!d||m.context===d)&&s(this,p);else{for(var f=0,g=[],y=m.length;f<y;f++)(m[f].fn!==l||h&&!m[f].once||d&&m[f].context!==d)&&g.push(m[f]);g.length?this._events[p]=g.length===1?g[0]:g:s(this,p)}return this},a.prototype.removeAllListeners=function(u){var l;return u?(l=t?t+u:u,this._events[l]&&s(this,l)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,n.exports=a})(yy);var LP=yy.exports;const nh=DP(LP);var ih=function(n,e){return ih=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])},ih(n,e)};function an(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ih(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var rh=function(){return rh=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},rh.apply(this,arguments)};function Mt(n,e,t,i){function r(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(l){try{u(i.next(l))}catch(d){s(d)}}function c(l){try{u(i.throw(l))}catch(d){s(d)}}function u(l){l.done?o(l.value):r(l.value).then(a,c)}u((i=i.apply(n,e||[])).next())})}function xt(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(t=0)),t;)try{if(i=1,r&&(o=u[0]&2?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,r=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1],o=u;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(u);break}o[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(l){u=[6,l],r=0}finally{i=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Ja(n,e,t){if(t||arguments.length===2)for(var i=0,r=e.length,o;i<r;i++)(o||!(i in e))&&(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return n.concat(o||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;for(var Gn=function(){function n(e,t,i,r){this.left=e,this.top=t,this.width=i,this.height=r}return n.prototype.add=function(e,t,i,r){return new n(this.left+e,this.top+t,this.width+i,this.height+r)},n.fromClientRect=function(e,t){return new n(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},n.fromDOMRectList=function(e,t){var i=Array.from(t).find(function(r){return r.width!==0});return i?new n(i.left+e.windowBounds.left,i.top+e.windowBounds.top,i.width,i.height):n.EMPTY},n.EMPTY=new n(0,0,0,0),n}(),Za=function(n,e){return Gn.fromClientRect(n,e.getBoundingClientRect())},UP=function(n){var e=n.body,t=n.documentElement;if(!e||!t)throw new Error("Unable to get document size");var i=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),r=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new Gn(0,0,i,r)},Qa=function(n){for(var e=[],t=0,i=n.length;t<i;){var r=n.charCodeAt(t++);if(r>=55296&&r<=56319&&t<i){var o=n.charCodeAt(t++);(o&64512)===56320?e.push(((r&1023)<<10)+(o&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},nt=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,n);var t=n.length;if(!t)return"";for(var i=[],r=-1,o="";++r<t;){var s=n[r];s<=65535?i.push(s):(s-=65536,i.push((s>>10)+55296,s%1024+56320)),(r+1===t||i.length>16384)&&(o+=String.fromCharCode.apply(String,i),i.length=0)}return o},by="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",FP=typeof Uint8Array>"u"?[]:new Uint8Array(256),ec=0;ec<by.length;ec++)FP[by.charCodeAt(ec)]=ec;typeof SuppressedError=="function"&&SuppressedError;for(var _y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",BP=typeof Uint8Array>"u"?[]:new Uint8Array(256),tc=0;tc<_y.length;tc++)BP[_y.charCodeAt(tc)]=tc;for(var ky="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",jP=typeof Uint8Array>"u"?[]:new Uint8Array(256),nc=0;nc<ky.length;nc++)jP[ky.charCodeAt(nc)]=nc;var VP=1,Sy=2,wy=3,zP=5,Cy=8,Ty=10,qP=25,WP=30,GP=37,$P=42,xy="!",fi="\xD7",HP="\xF7",Ey=[VP,Sy,wy,zP],KP=[Ty,Cy],YP=function(n,e){var t=[],i=[],r=[];return n.forEach(function(o,s){throw new Error("UnicodeTrie not initialized")}),[i,t,r]},XP=function(n,e){for(var t=n;t>=0;){var i=e[t];if(i===Ty)t--;else return i}return 0},JP=function(n,e,t,i,r){if(t[i]===0)return fi;var o=i-1;if(Array.isArray(r)&&r[o]===!0)return fi;var s=o-1,a=o+1,c=e[o];s>=0&&e[s];var u=e[a];if(c===Sy&&u===wy)return fi;if(Ey.indexOf(c)!==-1)return xy;if(Ey.indexOf(u)!==-1||KP.indexOf(u)!==-1)return fi;if(XP(o,e)===Cy)return HP;throw new Error("UnicodeTrie not initialized")},ZP=function(n,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=YP(n,e.lineBreak),i=t[0],r=t[1],o=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(a){return[qP,WP,$P].indexOf(a)!==-1?GP:a}));var s=e.wordBreak==="keep-all"?o.map(function(a,c){return a&&n[c]>=19968&&n[c]<=40959}):void 0;return[i,r,s]},QP=function(){function n(e,t,i,r){this.codePoints=e,this.required=t===xy,this.start=i,this.end=r}return n.prototype.slice=function(){return nt.apply(void 0,this.codePoints.slice(this.start,this.end))},n}(),e2=function(n,e){var t=Qa(n),i=ZP(t,e),r=i[0],o=i[1],s=i[2],a=t.length,c=0,u=0;return{next:function(){if(u>=a)return{done:!0,value:null};for(var l=fi;u<a&&(l=JP(t,o,r,++u,s))===fi;);if(l!==fi||u===a){var d=new QP(t,l,c,u);return c=u,{value:d,done:!1}}return{done:!0,value:null}}}},t2=1,n2=2,Jo=4,Iy=8,ic=10,Ry=47,Zo=92,i2=9,r2=32,rc=34,Qo=61,o2=35,s2=36,a2=37,oc=39,sc=40,es=41,c2=95,Ft=45,u2=33,l2=60,d2=62,h2=64,p2=91,f2=93,m2=61,g2=123,ac=63,v2=125,Py=124,y2=126,b2=128,Oy=65533,oh=42,Yi=43,_2=44,k2=58,S2=59,ts=46,w2=0,C2=8,T2=11,x2=14,E2=31,I2=127,xn=-1,Ay=48,My=97,Ny=101,R2=102,P2=117,O2=122,Dy=65,Ly=69,Uy=70,A2=85,M2=90,Et=function(n){return n>=Ay&&n<=57},N2=function(n){return n>=55296&&n<=57343},zr=function(n){return Et(n)||n>=Dy&&n<=Uy||n>=My&&n<=R2},D2=function(n){return n>=My&&n<=O2},L2=function(n){return n>=Dy&&n<=M2},U2=function(n){return D2(n)||L2(n)},F2=function(n){return n>=b2},cc=function(n){return n===ic||n===i2||n===r2},uc=function(n){return U2(n)||F2(n)||n===c2},Fy=function(n){return uc(n)||Et(n)||n===Ft},B2=function(n){return n>=w2&&n<=C2||n===T2||n>=x2&&n<=E2||n===I2},mi=function(n,e){return n!==Zo?!1:e!==ic},lc=function(n,e,t){return n===Ft?uc(e)||mi(e,t):uc(n)?!0:!!(n===Zo&&mi(n,e))},sh=function(n,e,t){return n===Yi||n===Ft?Et(e)?!0:e===ts&&Et(t):Et(n===ts?e:n)},j2=function(n){var e=0,t=1;(n[e]===Yi||n[e]===Ft)&&(n[e]===Ft&&(t=-1),e++);for(var i=[];Et(n[e]);)i.push(n[e++]);var r=i.length?parseInt(nt.apply(void 0,i),10):0;n[e]===ts&&e++;for(var o=[];Et(n[e]);)o.push(n[e++]);var s=o.length,a=s?parseInt(nt.apply(void 0,o),10):0;(n[e]===Ly||n[e]===Ny)&&e++;var c=1;(n[e]===Yi||n[e]===Ft)&&(n[e]===Ft&&(c=-1),e++);for(var u=[];Et(n[e]);)u.push(n[e++]);var l=u.length?parseInt(nt.apply(void 0,u),10):0;return t*(r+a*Math.pow(10,-s))*Math.pow(10,c*l)},V2={type:2},z2={type:3},q2={type:4},W2={type:13},G2={type:8},$2={type:21},H2={type:9},K2={type:10},Y2={type:11},X2={type:12},J2={type:14},dc={type:23},Z2={type:1},Q2={type:25},eO={type:24},tO={type:26},nO={type:27},iO={type:28},rO={type:29},oO={type:31},ah={type:32},By=function(){function n(){this._value=[]}return n.prototype.write=function(e){this._value=this._value.concat(Qa(e))},n.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==ah;)e.push(t),t=this.consumeToken();return e},n.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case rc:return this.consumeStringToken(rc);case o2:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Fy(t)||mi(i,r)){var o=lc(t,i,r)?n2:t2,s=this.consumeName();return{type:5,value:s,flags:o}}break;case s2:if(this.peekCodePoint(0)===Qo)return this.consumeCodePoint(),W2;break;case oc:return this.consumeStringToken(oc);case sc:return V2;case es:return z2;case oh:if(this.peekCodePoint(0)===Qo)return this.consumeCodePoint(),J2;break;case Yi:if(sh(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case _2:return q2;case Ft:var a=e,c=this.peekCodePoint(0),u=this.peekCodePoint(1);if(sh(a,c,u))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(lc(a,c,u))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(c===Ft&&u===d2)return this.consumeCodePoint(),this.consumeCodePoint(),eO;break;case ts:if(sh(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Ry:if(this.peekCodePoint(0)===oh)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===oh&&(l=this.consumeCodePoint(),l===Ry))return this.consumeToken();if(l===xn)return this.consumeToken()}break;case k2:return tO;case S2:return nO;case l2:if(this.peekCodePoint(0)===u2&&this.peekCodePoint(1)===Ft&&this.peekCodePoint(2)===Ft)return this.consumeCodePoint(),this.consumeCodePoint(),Q2;break;case h2:var d=this.peekCodePoint(0),h=this.peekCodePoint(1),p=this.peekCodePoint(2);if(lc(d,h,p)){var s=this.consumeName();return{type:7,value:s}}break;case p2:return iO;case Zo:if(mi(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case f2:return rO;case m2:if(this.peekCodePoint(0)===Qo)return this.consumeCodePoint(),G2;break;case g2:return Y2;case v2:return X2;case P2:case A2:var m=this.peekCodePoint(0),f=this.peekCodePoint(1);return m===Yi&&(zr(f)||f===ac)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Py:if(this.peekCodePoint(0)===Qo)return this.consumeCodePoint(),H2;if(this.peekCodePoint(0)===Py)return this.consumeCodePoint(),$2;break;case y2:if(this.peekCodePoint(0)===Qo)return this.consumeCodePoint(),K2;break;case xn:return ah}return cc(e)?(this.consumeWhiteSpace(),oO):Et(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):uc(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:nt(e)}},n.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},n.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},n.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},n.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();zr(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;t===ac&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i){var r=parseInt(nt.apply(void 0,e.map(function(c){return c===ac?Ay:c})),16),o=parseInt(nt.apply(void 0,e.map(function(c){return c===ac?Uy:c})),16);return{type:30,start:r,end:o}}var s=parseInt(nt.apply(void 0,e),16);if(this.peekCodePoint(0)===Ft&&zr(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var a=[];zr(t)&&a.length<6;)a.push(t),t=this.consumeCodePoint();var o=parseInt(nt.apply(void 0,a),16);return{type:30,start:s,end:o}}else return{type:30,start:s,end:s}},n.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===sc?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===sc?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},n.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===xn)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===oc||t===rc){var i=this.consumeStringToken(this.consumeCodePoint());return i.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===xn||this.peekCodePoint(0)===es)?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),dc)}for(;;){var r=this.consumeCodePoint();if(r===xn||r===es)return{type:22,value:nt.apply(void 0,e)};if(cc(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===xn||this.peekCodePoint(0)===es?(this.consumeCodePoint(),{type:22,value:nt.apply(void 0,e)}):(this.consumeBadUrlRemnants(),dc);if(r===rc||r===oc||r===sc||B2(r))return this.consumeBadUrlRemnants(),dc;if(r===Zo)if(mi(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),dc;else e.push(r)}},n.prototype.consumeWhiteSpace=function(){for(;cc(this.peekCodePoint(0));)this.consumeCodePoint()},n.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===es||e===xn)return;mi(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},n.prototype.consumeStringSlice=function(e){for(var t=5e4,i="";e>0;){var r=Math.min(t,e);i+=nt.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),i},n.prototype.consumeStringToken=function(e){var t="",i=0;do{var r=this._value[i];if(r===xn||r===void 0||r===e)return t+=this.consumeStringSlice(i),{type:0,value:t};if(r===ic)return this._value.splice(0,i),Z2;if(r===Zo){var o=this._value[i+1];o!==xn&&o!==void 0&&(o===ic?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):mi(r,o)&&(t+=this.consumeStringSlice(i),t+=nt(this.consumeEscapedCodePoint()),i=-1))}i++}while(!0)},n.prototype.consumeNumber=function(){var e=[],t=Jo,i=this.peekCodePoint(0);for((i===Yi||i===Ft)&&e.push(this.consumeCodePoint());Et(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(i===ts&&Et(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Iy;Et(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),r=this.peekCodePoint(1);var o=this.peekCodePoint(2);if((i===Ly||i===Ny)&&((r===Yi||r===Ft)&&Et(o)||Et(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Iy;Et(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[j2(e),t]},n.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],r=this.peekCodePoint(0),o=this.peekCodePoint(1),s=this.peekCodePoint(2);if(lc(r,o,s)){var a=this.consumeName();return{type:15,number:t,flags:i,unit:a}}return r===a2?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},n.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(zr(e)){for(var t=nt(e);zr(this.peekCodePoint(0))&&t.length<6;)t+=nt(this.consumeCodePoint());cc(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return i===0||N2(i)||i>1114111?Oy:i}return e===xn?Oy:e},n.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Fy(t))e+=nt(t);else if(mi(t,this.peekCodePoint(0)))e+=nt(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},n}(),jy=function(){function n(e){this._tokens=e}return n.create=function(e){var t=new By;return t.write(e),new n(t.read())},n.parseValue=function(e){return n.create(e).parseComponentValue()},n.parseValues=function(e){return n.create(e).parseComponentValues()},n.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},n.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},n.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},n.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(i.type===32||aO(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},n.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(i.type===32||i.type===3)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},n.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?ah:e},n.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},n}(),gi=function(n){return n.type===15},st=function(n){return n.type===17},ue=function(n){return n.type===20},sO=function(n){return n.type===0},ch=function(n,e){return ue(n)&&n.value===e},Vy=function(n){return n.type!==31},vt=function(n){return n.type!==31&&n.type!==4},En=function(n){var e=[],t=[];return n.forEach(function(i){if(i.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}i.type!==31&&t.push(i)}),t.length&&e.push(t),e},aO=function(n,e){return e===11&&n.type===12||e===28&&n.type===29?!0:e===2&&n.type===3},vi=function(n){return n.type===17||n.type===15},Be=function(n){return n.type===16||vi(n)},zy=function(n){return n.length>1?[n[0],n[1]]:[n[0]]},yt={type:17,number:0,flags:Jo},uh={type:16,number:50,flags:Jo},yi={type:16,number:100,flags:Jo},ns=function(n,e,t){var i=n[0],r=n[1];return[Ee(i,e),Ee(typeof r<"u"?r:i,t)]},Ee=function(n,e){if(n.type===16)return n.number/100*e;if(gi(n))switch(n.unit){case"rem":case"em":return 16*n.number;case"px":default:return n.number}return n.number},qy="deg",Wy="grad",Gy="rad",$y="turn",hc={name:"angle",parse:function(n,e){if(e.type===15)switch(e.unit){case qy:return Math.PI*e.number/180;case Wy:return Math.PI/200*e.number;case Gy:return e.number;case $y:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Hy=function(n){return n.type===15&&(n.unit===qy||n.unit===Wy||n.unit===Gy||n.unit===$y)},Ky=function(n){var e=n.filter(ue).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[yt,yt];case"to top":case"bottom":return Xt(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[yt,yi];case"to right":case"left":return Xt(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[yi,yi];case"to bottom":case"top":return Xt(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[yi,yt];case"to left":case"right":return Xt(270)}return 0},Xt=function(n){return Math.PI*n/180},bi=function(n){return(255&n)===0},pt=function(n){var e=255&n,t=255&n>>8,i=255&n>>16,r=255&n>>24;return e<255?"rgba(".concat(r,",").concat(i,",").concat(t,",").concat(e/255,")"):"rgb(".concat(r,",").concat(i,",").concat(t,")")},In=function(n,e,t,i){return(n<<24|e<<16|t<<8|Math.round(i*255)<<0)>>>0},pc=function(n,e){if(n.type===17)return n.number;if(n.type===16){var t=e===3?1:255;return e===3?n.number/100*t:Math.round(n.number/100*t)}return 0},Xi=function(n){return(n[0].type===20?n[0].value:"unknown")==="from"},Ke=function(n,e,t){return Math.min(Math.max(n,e),t)},Bt=function(n,e){return[n[0]*e[0]+n[1]*e[1]+n[2]*e[2],n[3]*e[0]+n[4]*e[1]+n[5]*e[2],n[6]*e[0]+n[7]*e[1]+n[8]*e[2]]},cO=function(n){return In(Ke(Math.round(n[0]*255),0,255),Ke(Math.round(n[1]*255),0,255),Ke(Math.round(n[2]*255),0,255),Ke(n[3],0,1))},lh=function(n){var e=n[0],t=n[1],i=n[2],r=n[3],o=Ji([e,t,i]);return In(Ke(Math.round(o[0]*255),0,255),Ke(Math.round(o[1]*255),0,255),Ke(Math.round(o[2]*255),0,255),r)},is=function(n){var e=_i([n[0],n[1],n[2]]);return lh([e[0],e[1],e[2],n[3]])},uO=function(n,e){if(Xi(e.filter(vt)))throw new Error("Relative color not supported for lab()");var t=fc(e),i=t[0],r=t[1],o=t[2],s=t[3],a=Ji(_i(vc([i,r,o])));return In(Ke(Math.round(a[0]*255),0,255),Ke(Math.round(a[1]*255),0,255),Ke(Math.round(a[2]*255),0,255),s)},lO=function(n,e){if(Xi(e.filter(vt)))throw new Error("Relative color not supported for oklab()");var t=fc(e),i=t[0],r=t[1],o=t[2],s=t[3],a=Ji(_i(gc([i,r,o])));return In(Ke(Math.round(a[0]*255),0,255),Ke(Math.round(a[1]*255),0,255),Ke(Math.round(a[2]*255),0,255),s)},dO=function(n,e){if(Xi(e.filter(vt)))throw new Error("Relative color not supported for oklch()");var t=Zy(e),i=t[0],r=t[1],o=t[2],s=t[3],a=Ji(_i(gc(mc([i,r,o]))));return In(Ke(Math.round(a[0]*255),0,255),Ke(Math.round(a[1]*255),0,255),Ke(Math.round(a[2]*255),0,255),s)},hO=function(n,e){if(Xi(e.filter(vt)))throw new Error("Relative color not supported for lch()");var t=Jy(e),i=t[0],r=t[1],o=t[2],s=t[3],a=Ji(_i(vc(mc([i,r,o]))));return In(Ke(Math.round(a[0]*255),0,255),Ke(Math.round(a[1]*255),0,255),Ke(Math.round(a[2]*255),0,255),s)},Yy=function(n,e){var t=e.filter(vt),i=t[0],r=t[1],o=t[2],s=t[3],a=(i.type===17?Xt(i.number):hc.parse(n,i))/(Math.PI*2),c=Be(r)?r.number/100:0,u=Be(o)?o.number/100:0,l=typeof s<"u"&&Be(s)?Ee(s,1):1;return[a,c,u,l]},Xy=function(n,e){if(Xi(e))throw new Error("Relative color not supported for hsl()");var t=Yy(n,e),i=t[0],r=t[1],o=t[2],s=t[3],a=eb([i,r,o]);return In(a[0]*255,a[1]*255,a[2]*255,r===0?1:s)},Jy=function(n){var e=n.filter(vt),t=Be(e[0])?e[0].number:0,i=Be(e[1])?e[1].number:0,r=st(e[2])||gi(e[2])?e[2].number:0,o=typeof e[4]<"u"&&Be(e[4])?Ee(e[4],1):1;return[t,i,r,o]},fc=function(n){var e=n.filter(vt),t=e[0].type===16?e[0].number/100:st(e[0])?e[0].number:0,i=e[1].type===16?e[1].number/100:st(e[1])?e[1].number:0,r=st(e[2])||gi(e[2])?e[2].number:0,o=typeof e[4]<"u"&&Be(e[4])?Ee(e[4],1):1;return[t,i,r,o]},Zy=function(n){var e=n.filter(vt),t=e[0].type===16?e[0].number/100:st(e[0])?e[0].number:0,i=e[1].type===16?e[1].number/100:st(e[1])?e[1].number:0,r=st(e[2])||gi(e[2])?e[2].number:0,o=typeof e[4]<"u"&&Be(e[4])?Ee(e[4],1):1;return[t,i,r,o]},Qy=function(n){return Bt([1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371],n)},dh=function(n){return Bt([.955473421488075,-.02309845494876471,.06325924320057072,-.0283697093338637,1.0099953980813041,.021041441191917323,.012314014864481998,-.020507649298898964,1.330365926242124],n)},hh=function(n,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-n)*t*6+n:t<1/2?e:t<2/3?(e-n)*6*(2/3-t)+n:n},eb=function(n){var e=n[0],t=n[1],i=n[2];if(t===0)return[i*255,i*255,i*255];var r=i<=.5?i*(t+1):i+t-i*t,o=i*2-r,s=hh(o,r,e+1/3),a=hh(o,r,e),c=hh(o,r,e-1/3);return[s,a,c]},mc=function(n){var e=n[0],t=n[1],i=n[2];return t<0&&(t=0),isNaN(i)&&(i=0),[e,t*Math.cos(i*Math.PI/180),t*Math.sin(i*Math.PI/180)]},gc=function(n){var e=Bt([1,.3963377773761749,.2158037573099136,1,-.1055613458156586,-.0638541728258133,1,-.0894841775298119,-1.2914855480194092],n),t=e.map(function(i){return Math.pow(i,3)});return Bt([1.2268798758459243,-.5578149944602171,.2813910456659647,-.0405757452148008,1.112286803280317,-.0717110580655164,-.0763729366746601,-.4214933324022432,1.5869240198367816],t)},vc=function(n){var e=(n[0]+16)/116,t=n[1]/500+e,i=e-n[2]/200,r=24389/27,o=24/116,s=[(t>o?Math.pow(t,3):(116*t-16)/r)*.3457/.3585,n[0]>8?Math.pow(e,3):n[0]/r,(i>o?Math.pow(i,3):(116*i-16)/r)*(1-.3457-.3585)/.3585];return dh([s[0],s[1],s[2]])},pO=function(n,e){var t=e.filter(vt);if(t.length===3){var i=t.map(pc),r=i[0],o=i[1],s=i[2],a=fh([r/255,o/255,s/255]),c=ph([a[0],a[1],a[2]]),u=c[0],l=c[1],d=c[2];return[u,l,d,1]}if(t.length===4){var h=t.map(pc),r=h[0],o=h[1],s=h[2],p=h[3],a=fh([r/255,o/255,s/255]),m=ph([a[0],a[1],a[2]]),u=m[0],l=m[1],d=m[2];return[u,l,d,p]}return[0,0,0,1]},fO=function(n,e){var t=Yy(n,e),i=t[0],r=t[1],o=t[2],s=t[3],a=fh(eb([i,r,o])),c=ph([a[0],a[1],a[2]]),u=c[0],l=c[1],d=c[2];return[u,l,d,s]},mO=function(n,e){var t=fc(e),i=t[0],r=t[1],o=t[2],s=t[3],a=vc([i,r,o]),c=a[0],u=a[1],l=a[2];return[c,u,l,s]},gO=function(n,e){var t=Jy(e),i=t[0],r=t[1],o=t[2],s=t[3],a=vc(mc([i,r,o])),c=a[0],u=a[1],l=a[2];return[c,u,l,s]},vO=function(n,e){var t=Zy(e),i=t[0],r=t[1],o=t[2],s=t[3],a=gc(mc([i,r,o])),c=a[0],u=a[1],l=a[2];return[c,u,l,s]},yO=function(n,e){var t=fc(e),i=t[0],r=t[1],o=t[2],s=t[3],a=gc([i,r,o]),c=a[0],u=a[1],l=a[2];return[c,u,l,s]},bO=function(n){return dh([n[0],n[1],n[2]])},tb=function(n){return n},_O=function(n){var e=Qy([n[0],n[2],n[3]]),t=e[0],i=e[1],r=e[2];return[t,i,r,n[3]]},nb=function(n){return is([n[0],n[1],n[2],n[3]])},kO=function(n){var e=bO([n[0],n[1],n[2]]);return is([e[0],e[1],e[2],n[3]])},_i=function(n){return Bt([3.2409699419045226,-1.537383177570094,-.4986107602930034,-.9692436362808796,1.8759675015077202,.04155505740717559,.05563007969699366,-.20397695888897652,1.0569715142428786],n)},ph=function(n){return Bt([.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],n)},Ji=function(n){return n.map(function(e){var t=e<0?-1:1,i=Math.abs(e);return i>.0031308?t*(1.055*Math.pow(i,1/2.4)-.055):12.92*e})},fh=function(n){return n.map(function(e){var t=e<0?-1:1,i=Math.abs(e);return i<=.04045?e/12.92:t*Math.pow((i+.055)/1.055,2.4)})},SO=function(n){var e=Ji(_i([n[0],n[1],n[2]])),t=e[0],i=e[1],r=e[2];return[t,i,r,n[3]]},wO=function(n){var e=_i([n[0],n[1],n[2]]),t=e[0],i=e[1],r=e[2];return[Ke(Math.round(t*255),0,255),Ke(Math.round(i*255),0,255),Ke(Math.round(r*255),0,255),n[3]]},CO=function(n){return Bt([.4865709486482162,.26566769316909306,.1982172852343625,.2289745640697488,.6917385218365064,.079286914093745,0,.04511338185890264,1.043944368900976],n)},TO=function(n){return Bt([2.493496911941425,-.9313836179191239,-.40271078445071684,-.8294889695615747,1.7626640603183463,.023624685841943577,.03584583024378447,-.07617238926804182,.9568845240076872],n)},xO=function(n){return n.map(function(e){var t=e<0?-1:1,i=e*t;return i<=.04045?e/12.92:t*Math.pow((e+.055)/1.055,2.4)||0})},EO=function(n){return Ji(n)},IO=function(n){var e=xO([n[0],n[1],n[2]]);return CO([e[0],e[1],e[2]])},RO=function(n){var e=EO(TO([n[0],n[1],n[2]])),t=e[0],i=e[1],r=e[2];return[t,i,r,n[3]]},PO=function(n){var e=IO([n[0],n[1],n[2]]);return is([e[0],e[1],e[2],n[3]])},OO=function(n){return Bt([2.0415879038107465,-.5650069742788596,-.34473135077832956,-.9692436362808795,1.8759675015077202,.04155505740717557,.013444280632031142,-.11836239223101838,1.0151749943912054],n)},AO=function(n){return Bt([.5766690429101305,.1855582379065463,.1882286462349947,.29734497525053605,.6273635662554661,.0752914584939978,.02703136138641234,.07068885253582723,.9913375368376388],n)},MO=function(n){var e=n.map(function(t){var i=t<0?-1:1,r=Math.abs(t);return i*Math.pow(r,2.19921875)});return[e[0],e[1],e[2]]},NO=function(n){var e=n.map(function(t){var i=t<0?-1:1,r=Math.abs(t);return i*Math.pow(r,.4547069271758437)});return[e[0],e[1],e[2]]},DO=function(n){var e=NO(OO([n[0],n[1],n[2]])),t=e[0],i=e[1],r=e[2];return[t,i,r,n[3]]},LO=function(n){var e=_i(AO(MO([n[0],n[1],n[2]])));return lh([e[0],e[1],e[2],n[3]])},UO=function(n){return Bt([.7977666449006423,.13518129740053308,.0313477341283922,.2880748288194013,.711835234241873,8993693872564e-17,0,0,.8251046025104602],n)},FO=function(n){return Bt([1.3457868816471583,-.25557208737979464,-.05110186497554526,-.5446307051249019,1.5082477428451468,.02052744743642139,0,0,1.2119675456389452],n)},BO=function(n){return n.map(function(e){return e<16/512?e/16:Math.pow(e,1.8)})},jO=function(n){return n.map(function(e){return e>1/512?Math.pow(e,1/1.8):e*16})},VO=function(n){var e=BO([n[0],n[1],n[2]]);return dh(UO([e[0],e[1],e[2]]))},zO=function(n){var e=jO(FO(Qy([n[0],n[1],n[2]]))),t=e[0],i=e[1],r=e[2];return[t,i,r,n[3]]},qO=function(n){var e=VO([n[0],n[1],n[2]]);return is([e[0],e[1],e[2],n[3]])},yc=1.09929682680944,ib=.018053968510807,WO=function(n){return n.map(function(e){return e<ib*4.5?e/4.5:Math.pow((e+yc-1)/yc,1/.45)})},GO=function(n){return n.map(function(e){return e>=ib?yc*Math.pow(e,.45)-(yc-1):4.5*e})},$O=function(n){return Bt([.6369580483012914,.14461690358620832,.1688809751641721,.2627002120112671,.6779980715188708,.05930171646986196,0,.028072693049087428,1.060985057710791],n)},HO=function(n){return Bt([1.716651187971268,-.355670783776392,-.25336628137366,-.666684351832489,1.616481236634939,.0157685458139111,.017639857445311,-.042770613257809,.942103121235474],n)},KO=function(n){var e=WO([n[0],n[1],n[2]]);return $O([e[0],e[1],e[2]])},YO=function(n){var e=GO(HO([n[0],n[1],n[2]])),t=e[0],i=e[1],r=e[2];return[t,i,r,n[3]]},XO=function(n){var e=KO([n[0],n[1],n[2]]);return is([e[0],e[1],e[2],n[3]])},ki={name:"color",parse:function(n,e){if(e.type===18){var t=eA[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'.concat(e.name,'"'));return t(n,e.values)}if(e.type===5){var i=rb(e),r=i[0],o=i[1],s=i[2],a=i[3];return In(r,o,s,a)}if(e.type===20){var c=Rn[e.value.toUpperCase()];if(typeof c<"u")return c}return Rn.TRANSPARENT}},rb=function(n){if(n.value.length===3){var e=n.value.substring(0,1),t=n.value.substring(1,2),i=n.value.substring(2,3);return[parseInt(e+e,16),parseInt(t+t,16),parseInt(i+i,16),1]}if(n.value.length===4){var e=n.value.substring(0,1),t=n.value.substring(1,2),i=n.value.substring(2,3),r=n.value.substring(3,4);return[parseInt(e+e,16),parseInt(t+t,16),parseInt(i+i,16),parseInt(r+r,16)/255]}if(n.value.length===6){var e=n.value.substring(0,2),t=n.value.substring(2,4),i=n.value.substring(4,6);return[parseInt(e,16),parseInt(t,16),parseInt(i,16),1]}if(n.value.length===8){var e=n.value.substring(0,2),t=n.value.substring(2,4),i=n.value.substring(4,6),r=n.value.substring(6,8);return[parseInt(e,16),parseInt(t,16),parseInt(i,16),parseInt(r,16)/255]}return[0,0,0,1]},ob=function(n,e){var t=e.filter(vt);if(Xi(t))throw new Error("Relative color not supported for rgb()");if(t.length===3){var i=t.map(pc),r=i[0],o=i[1],s=i[2];return In(r,o,s,1)}if(t.length===4){var a=t.map(pc),r=a[0],o=a[1],s=a[2],c=a[3];return In(r,o,s,c)}return 0},JO=function(n,e){var t=e.filter(vt),i=t[0].type===20?t[0].value:"unknown",r=!Xi(t);if(r){var o=i,s=sb[o];if(typeof s>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(o,'" for color() function'));var a=st(t[1])?t[1].number:0,c=st(t[2])?t[2].number:0,u=st(t[3])?t[3].number:0,l=t.length>4&&t[4].type===6&&t[4].value==="/"&&st(t[5])?t[5].number:1;return s([a,c,u,l])}else{var d=function(W,A){if(st(A))return A.number;var H=function(Ie){return Ie==="r"||Ie==="x"?0:Ie==="g"||Ie==="y"?1:2};if(ue(A)){var Y=H(A.value);return W[Y]}var J=function(Ie){for(var dt=Ie.filter(vt),Ne="(",Pe=0,ie=dt;Pe<ie.length;Pe++){var Ze=ie[Pe];Ne+=Ze.type===18&&Ze.name==="calc"?J(Ze.values):st(Ze)?Ze.number:Ze.type===6||ue(Ze)?Ze.value:""}return Ne+=")",Ne};if(A.type===18){var ve=A.values.filter(vt);if(A.name==="calc"){var Me=J(ve).replace(/r|x/,W[0].toString()).replace(/g|y/,W[1].toString()).replace(/b|z/,W[2].toString());return new Function("return "+Me)()}}return null},h=t[1].type===18?t[1].name:ue(t[1])||t[1].type===5?"rgb":"unknown",p=ue(t[2])?t[2].value:"unknown",m=t[1].type===18?t[1].values:ue(t[1])?[t[1]]:[];if(ue(t[1])){var f=Rn[t[1].value.toUpperCase()];if(typeof f>"u")throw new Error("Attempting to use unknown color in relative color 'from'");var g=qr(n,t[1].value),y=255&g,b=255&g>>8,S=255&g>>16,w=255&g>>24;m=[{type:17,number:w,flags:1},{type:17,number:S,flags:1},{type:17,number:b,flags:1},{type:17,number:y>1?y/255:y,flags:1}]}else if(t[1].type===5){var k=rb(t[1]),w=k[0],S=k[1],b=k[2],y=k[3];m=[{type:17,number:w,flags:1},{type:17,number:S,flags:1},{type:17,number:b,flags:1},{type:17,number:y>1?y/255:y,flags:1}]}if(m.length===0)throw new Error("Attempting to use unknown color in relative color 'from'");if(p==="unknown")throw new Error("Attempting to use unknown colorspace in relative color 'to'");var C=ZO[h],x=QO[p],I=sb[p];if(typeof C>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(h,'" for color() function'));if(typeof x>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(p,'" for color() function'));var P=C(n,m),D=x(P),a=d(D,t[3]),c=d(D,t[4]),u=d(D,t[5]),l=t.length>6&&t[6].type===6&&t[6].value==="/"&&st(t[7])?t[7].number:1;if(a===null||c===null||u===null)throw new Error("Invalid relative color in color() function");return I([a,c,u,l])}},sb={srgb:cO,"srgb-linear":lh,"display-p3":PO,"a98-rgb":LO,"prophoto-rgb":qO,xyz:nb,"xyz-d50":kO,"xyz-d65":nb,rec2020:XO},ZO={rgb:pO,hsl:fO,lab:mO,lch:gO,oklab:yO,oklch:vO},QO={srgb:SO,"srgb-linear":wO,"display-p3":RO,"a98-rgb":DO,"prophoto-rgb":zO,xyz:tb,"xyz-d50":_O,"xyz-d65":tb,rec2020:YO},eA={hsl:Xy,hsla:Xy,rgb:ob,rgba:ob,lch:hO,oklch:dO,oklab:lO,lab:uO,color:JO},qr=function(n,e){return ki.parse(n,jy.create(e).parseComponentValue())},Rn={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},tA={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(ue(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},nA={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},bc=function(n,e){var t=ki.parse(n,e[0]),i=e[1];return i&&Be(i)?{color:t,stop:i}:{color:t,stop:null}},ab=function(n,e){var t=n[0],i=n[n.length-1];t.stop===null&&(t.stop=yt),i.stop===null&&(i.stop=yi);for(var r=[],o=0,s=0;s<n.length;s++){var a=n[s].stop;if(a!==null){var c=Ee(a,e);c>o?r.push(c):r.push(o),o=c}else r.push(null)}for(var u=null,s=0;s<r.length;s++){var l=r[s];if(l===null)u===null&&(u=s);else if(u!==null){for(var d=s-u,h=r[u-1],p=(l-h)/(d+1),m=1;m<=d;m++)r[u+m-1]=p*m;u=null}}return n.map(function(f,g){var y=f.color;return{color:y,stop:Math.max(Math.min(1,r[g]/e),0)}})},iA=function(n,e,t){var i=e/2,r=t/2,o=Ee(n[0],e)-i,s=r-Ee(n[1],t);return(Math.atan2(s,o)+Math.PI*2)%(Math.PI*2)},rA=function(n,e,t){var i=typeof n=="number"?n:iA(n,e,t),r=Math.abs(e*Math.sin(i))+Math.abs(t*Math.cos(i)),o=e/2,s=t/2,a=r/2,c=Math.sin(i-Math.PI/2)*a,u=Math.cos(i-Math.PI/2)*a;return[r,o-u,o+u,s-c,s+c]},cn=function(n,e){return Math.sqrt(n*n+e*e)},cb=function(n,e,t,i,r){var o=[[0,0],[0,e],[n,0],[n,e]];return o.reduce(function(s,a){var c=a[0],u=a[1],l=cn(t-c,i-u);return(r?l<s.optimumDistance:l>s.optimumDistance)?{optimumCorner:a,optimumDistance:l}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},oA=function(n,e,t,i,r){var o=0,s=0;switch(n.size){case 0:n.shape===0?o=s=Math.min(Math.abs(e),Math.abs(e-i),Math.abs(t),Math.abs(t-r)):n.shape===1&&(o=Math.min(Math.abs(e),Math.abs(e-i)),s=Math.min(Math.abs(t),Math.abs(t-r)));break;case 2:if(n.shape===0)o=s=Math.min(cn(e,t),cn(e,t-r),cn(e-i,t),cn(e-i,t-r));else if(n.shape===1){var a=Math.min(Math.abs(t),Math.abs(t-r))/Math.min(Math.abs(e),Math.abs(e-i)),c=cb(i,r,e,t,!0),u=c[0],l=c[1];o=cn(u-e,(l-t)/a),s=a*o}break;case 1:n.shape===0?o=s=Math.max(Math.abs(e),Math.abs(e-i),Math.abs(t),Math.abs(t-r)):n.shape===1&&(o=Math.max(Math.abs(e),Math.abs(e-i)),s=Math.max(Math.abs(t),Math.abs(t-r)));break;case 3:if(n.shape===0)o=s=Math.max(cn(e,t),cn(e,t-r),cn(e-i,t),cn(e-i,t-r));else if(n.shape===1){var a=Math.max(Math.abs(t),Math.abs(t-r))/Math.max(Math.abs(e),Math.abs(e-i)),d=cb(i,r,e,t,!1),u=d[0],l=d[1];o=cn(u-e,(l-t)/a),s=a*o}break}return Array.isArray(n.size)&&(o=Ee(n.size[0],i),s=n.size.length===2?Ee(n.size[1],r):o),[o,s]},sA=function(n,e){var t=Xt(180),i=[];return En(e).forEach(function(r,o){if(o===0){var s=r[0];if(s.type===20&&s.value==="to"){t=Ky(r);return}else if(Hy(s)){t=hc.parse(n,s);return}}var a=bc(n,r);i.push(a)}),{angle:t,stops:i,type:1}},_c=function(n,e){var t=Xt(180),i=[];return En(e).forEach(function(r,o){if(o===0){var s=r[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=Ky(r);return}else if(Hy(s)){t=(hc.parse(n,s)+Xt(270))%Xt(360);return}}var a=bc(n,r);i.push(a)}),{angle:t,stops:i,type:1}},aA=function(n,e){var t=Xt(180),i=[],r=1,o=0,s=3,a=[];return En(e).forEach(function(c,u){var l=c[0];if(u===0){if(ue(l)&&l.value==="linear"){r=1;return}else if(ue(l)&&l.value==="radial"){r=2;return}}if(l.type===18){if(l.name==="from"){var d=ki.parse(n,l.values[0]);i.push({stop:yt,color:d})}else if(l.name==="to"){var d=ki.parse(n,l.values[0]);i.push({stop:yi,color:d})}else if(l.name==="color-stop"){var h=l.values.filter(vt);if(h.length===2){var d=ki.parse(n,h[1]),p=h[0];st(p)&&i.push({stop:{type:16,number:p.number*100,flags:p.flags},color:d})}}}}),r===1?{angle:(t+Xt(180))%Xt(360),stops:i,type:r}:{size:s,shape:o,stops:i,position:a,type:r}},ub="closest-side",lb="farthest-side",db="closest-corner",hb="farthest-corner",pb="circle",fb="ellipse",mb="cover",gb="contain",cA=function(n,e){var t=0,i=3,r=[],o=[];return En(e).forEach(function(s,a){var c=!0;if(a===0){var u=!1;c=s.reduce(function(d,h){if(u)if(ue(h))switch(h.value){case"center":return o.push(uh),d;case"top":case"left":return o.push(yt),d;case"right":case"bottom":return o.push(yi),d}else(Be(h)||vi(h))&&o.push(h);else if(ue(h))switch(h.value){case pb:return t=0,!1;case fb:return t=1,!1;case"at":return u=!0,!1;case ub:return i=0,!1;case mb:case lb:return i=1,!1;case gb:case db:return i=2,!1;case hb:return i=3,!1}else if(vi(h)||Be(h))return Array.isArray(i)||(i=[]),i.push(h),!1;return d},c)}if(c){var l=bc(n,s);r.push(l)}}),{size:i,shape:t,stops:r,position:o,type:2}},kc=function(n,e){var t=0,i=3,r=[],o=[];return En(e).forEach(function(s,a){var c=!0;if(a===0?c=s.reduce(function(l,d){if(ue(d))switch(d.value){case"center":return o.push(uh),!1;case"top":case"left":return o.push(yt),!1;case"right":case"bottom":return o.push(yi),!1}else if(Be(d)||vi(d))return o.push(d),!1;return l},c):a===1&&(c=s.reduce(function(l,d){if(ue(d))switch(d.value){case pb:return t=0,!1;case fb:return t=1,!1;case gb:case ub:return i=0,!1;case lb:return i=1,!1;case db:return i=2,!1;case mb:case hb:return i=3,!1}else if(vi(d)||Be(d))return Array.isArray(i)||(i=[]),i.push(d),!1;return l},c)),c){var u=bc(n,s);r.push(u)}}),{size:i,shape:t,stops:r,position:o,type:2}},uA=function(n){return n.type===1},lA=function(n){return n.type===2},mh={name:"image",parse:function(n,e){if(e.type===22){var t={url:e.value,type:0};return n.cache.addImage(e.value),t}if(e.type===18){var i=vb[e.name];if(typeof i>"u")throw new Error('Attempting to parse an unsupported image function "'.concat(e.name,'"'));return i(n,e.values)}throw new Error("Unsupported image type ".concat(e.type))}};function dA(n){return!(n.type===20&&n.value==="none")&&(n.type!==18||!!vb[n.name])}var vb={"linear-gradient":sA,"-moz-linear-gradient":_c,"-ms-linear-gradient":_c,"-o-linear-gradient":_c,"-webkit-linear-gradient":_c,"radial-gradient":cA,"-moz-radial-gradient":kc,"-ms-radial-gradient":kc,"-o-radial-gradient":kc,"-webkit-radial-gradient":kc,"-webkit-gradient":aA},hA={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(n,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(i){return vt(i)&&dA(i)}).map(function(i){return mh.parse(n,i)})}},pA={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(ue(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},fA={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(n,e){return En(e).map(function(t){return t.filter(Be)}).map(zy)}},mA={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(n,e){return En(e).map(function(t){return t.filter(ue).map(function(i){return i.value}).join(" ")}).map(gA)}},gA=function(n){switch(n){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},Wr;(function(n){n.AUTO="auto",n.CONTAIN="contain",n.COVER="cover"})(Wr||(Wr={}));var vA={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(n,e){return En(e).map(function(t){return t.filter(yA)})}},yA=function(n){return ue(n)||Be(n)},Sc=function(n){return{name:"border-".concat(n,"-color"),initialValue:"transparent",prefix:!1,type:3,format:"color"}},bA=Sc("top"),_A=Sc("right"),kA=Sc("bottom"),SA=Sc("left"),wc=function(n){return{name:"border-radius-".concat(n),initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return zy(t.filter(Be))}}},wA=wc("top-left"),CA=wc("top-right"),TA=wc("bottom-right"),xA=wc("bottom-left"),Cc=function(n){return{name:"border-".concat(n,"-style"),initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},EA=Cc("top"),IA=Cc("right"),RA=Cc("bottom"),PA=Cc("left"),Tc=function(n){return{name:"border-".concat(n,"-width"),initialValue:"0",type:0,prefix:!1,parse:function(e,t){return gi(t)?t.number:0}}},OA=Tc("top"),AA=Tc("right"),MA=Tc("bottom"),NA=Tc("left"),DA={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},LA={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(n,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},UA={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(n,e){return e.filter(ue).reduce(function(t,i){return t|FA(i.value)},0)}},FA=function(n){switch(n){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},BA={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},jA={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(n,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},xc;(function(n){n.NORMAL="normal",n.STRICT="strict"})(xc||(xc={}));var VA={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"strict":return xc.STRICT;case"normal":default:return xc.NORMAL}}},zA={name:"line-height",initialValue:"normal",prefix:!1,type:4},yb=function(n,e){return ue(n)&&n.value==="normal"?1.2*e:n.type===17?e*n.number:Be(n)?Ee(n,e):e},qA={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(n,e){return e.type===20&&e.value==="none"?null:mh.parse(n,e)}},WA={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(n,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},gh={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 52;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},Ec=function(n){return{name:"margin-".concat(n),initialValue:"0",prefix:!1,type:4}},GA=Ec("top"),$A=Ec("right"),HA=Ec("bottom"),KA=Ec("left"),YA={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(n,e){return e.filter(ue).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},XA={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},Ic=function(n){return{name:"padding-".concat(n),initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},JA=Ic("top"),ZA=Ic("right"),QA=Ic("bottom"),eM=Ic("left"),tM={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(n,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},nM={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(n,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},iM={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&ch(e[0],"none")?[]:En(e).map(function(t){for(var i={color:Rn.TRANSPARENT,offsetX:yt,offsetY:yt,blur:yt},r=0,o=0;o<t.length;o++){var s=t[o];vi(s)?(r===0?i.offsetX=s:r===1?i.offsetY=s:i.blur=s,r++):i.color=ki.parse(n,s)}return i})}},rM={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},oM={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(n,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=cM[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'.concat(e.name,'"'));return t(e.values)}return null}},sM=function(n){var e=n.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},aM=function(n){var e=n.filter(function(c){return c.type===17}).map(function(c){return c.number}),t=e[0],i=e[1];e[2],e[3];var r=e[4],o=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],a=e[13];return e[14],e[15],e.length===16?[t,i,r,o,s,a]:null},cM={matrix:sM,matrix3d:aM},bb={type:16,number:50,flags:Jo},uM=[bb,bb],lM={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(n,e){var t=e.filter(Be);return t.length!==2?uM:[t[0],t[1]]}},dM={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},rs;(function(n){n.NORMAL="normal",n.BREAK_ALL="break-all",n.KEEP_ALL="keep-all"})(rs||(rs={}));var hM={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-all":return rs.BREAK_ALL;case"keep-all":return rs.KEEP_ALL;case"normal":default:return rs.NORMAL}}},pM={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(n,e){if(e.type===20)return{auto:!0,order:0};if(st(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},_b={name:"time",parse:function(n,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},fM={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(n,e){return st(e)?e.number:1}},mM={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},gM={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(n,e){return e.filter(ue).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},vM={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(n,e){var t=[],i=[];return e.forEach(function(r){switch(r.type){case 20:case 0:t.push(r.value);break;case 17:t.push(r.number.toString());break;case 4:i.push(t.join(" ")),t.length=0;break}}),t.length&&i.push(t.join(" ")),i.map(function(r){return r.indexOf(" ")===-1?r:"'".concat(r,"'")})}},yM={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},bM={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(n,e){if(st(e))return e.number;if(ue(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},_M={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.filter(ue).map(function(t){return t.value})}},kM={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},ut=function(n,e){return(n&e)!==0},SM={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(n,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},wM={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(n,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var i=[],r=e.filter(Vy),o=0;o<r.length;o++){var s=r[o],a=r[o+1];if(s.type===20){var c=a&&st(a)?a.number:1;i.push({counter:s.value,increment:c})}}return i}},CM={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(n,e){if(e.length===0)return[];for(var t=[],i=e.filter(Vy),r=0;r<i.length;r++){var o=i[r],s=i[r+1];if(ue(o)&&o.value!=="none"){var a=s&&st(s)?s.number:0;t.push({counter:o.value,reset:a})}}return t}},TM={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(n,e){return e.filter(gi).map(function(t){return _b.parse(n,t)})}},xM={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(n,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var i=[],r=e.filter(sO);if(r.length%2!==0)return null;for(var o=0;o<r.length;o+=2){var s=r[o].value,a=r[o+1].value;i.push({open:s,close:a})}return i}},kb=function(n,e,t){if(!n)return"";var i=n[Math.min(e,n.length-1)];return i?t?i.open:i.close:""},EM={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&ch(e[0],"none")?[]:En(e).map(function(t){for(var i={color:255,offsetX:yt,offsetY:yt,blur:yt,spread:yt,inset:!1},r=0,o=0;o<t.length;o++){var s=t[o];ch(s,"inset")?i.inset=!0:vi(s)?(r===0?i.offsetX=s:r===1?i.offsetY=s:r===2?i.blur=s:i.spread=s,r++):i.color=ki.parse(n,s)}return i})}},IM={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(n,e){var t=[0,1,2],i=[];return e.filter(ue).forEach(function(r){switch(r.value){case"stroke":i.push(1);break;case"fill":i.push(0);break;case"markers":i.push(2);break}}),t.forEach(function(r){i.indexOf(r)===-1&&i.push(r)}),i}},RM={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},PM={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(n,e){return gi(e)?e.number:0}},OM={name:"objectFit",initialValue:"fill",prefix:!1,type:1,parse:function(n,e){return e.filter(ue).reduce(function(t,i){return t|AM(i.value)},0)}},AM=function(n){switch(n){case"contain":return 2;case"cover":return 4;case"none":return 8;case"scale-down":return 16}return 0},MM=function(){function n(e,t){var i,r;this.animationDuration=$(e,TM,t.animationDuration),this.backgroundClip=$(e,tA,t.backgroundClip),this.backgroundColor=$(e,nA,t.backgroundColor),this.backgroundImage=$(e,hA,t.backgroundImage),this.backgroundOrigin=$(e,pA,t.backgroundOrigin),this.backgroundPosition=$(e,fA,t.backgroundPosition),this.backgroundRepeat=$(e,mA,t.backgroundRepeat),this.backgroundSize=$(e,vA,t.backgroundSize),this.borderTopColor=$(e,bA,t.borderTopColor),this.borderRightColor=$(e,_A,t.borderRightColor),this.borderBottomColor=$(e,kA,t.borderBottomColor),this.borderLeftColor=$(e,SA,t.borderLeftColor),this.borderTopLeftRadius=$(e,wA,t.borderTopLeftRadius),this.borderTopRightRadius=$(e,CA,t.borderTopRightRadius),this.borderBottomRightRadius=$(e,TA,t.borderBottomRightRadius),this.borderBottomLeftRadius=$(e,xA,t.borderBottomLeftRadius),this.borderTopStyle=$(e,EA,t.borderTopStyle),this.borderRightStyle=$(e,IA,t.borderRightStyle),this.borderBottomStyle=$(e,RA,t.borderBottomStyle),this.borderLeftStyle=$(e,PA,t.borderLeftStyle),this.borderTopWidth=$(e,OA,t.borderTopWidth),this.borderRightWidth=$(e,AA,t.borderRightWidth),this.borderBottomWidth=$(e,MA,t.borderBottomWidth),this.borderLeftWidth=$(e,NA,t.borderLeftWidth),this.boxShadow=$(e,EM,t.boxShadow),this.color=$(e,DA,t.color),this.direction=$(e,LA,t.direction),this.display=$(e,UA,t.display),this.float=$(e,BA,t.cssFloat),this.fontFamily=$(e,vM,t.fontFamily),this.fontSize=$(e,yM,t.fontSize),this.fontStyle=$(e,kM,t.fontStyle),this.fontVariant=$(e,_M,t.fontVariant),this.fontWeight=$(e,bM,t.fontWeight),this.letterSpacing=$(e,jA,t.letterSpacing),this.lineBreak=$(e,VA,t.lineBreak),this.lineHeight=$(e,zA,t.lineHeight),this.listStyleImage=$(e,qA,t.listStyleImage),this.listStylePosition=$(e,WA,t.listStylePosition),this.listStyleType=$(e,gh,t.listStyleType),this.marginTop=$(e,GA,t.marginTop),this.marginRight=$(e,$A,t.marginRight),this.marginBottom=$(e,HA,t.marginBottom),this.marginLeft=$(e,KA,t.marginLeft),this.opacity=$(e,fM,t.opacity);var o=$(e,YA,t.overflow);this.overflowX=o[0],this.overflowY=o[o.length>1?1:0],this.overflowWrap=$(e,XA,t.overflowWrap),this.paddingTop=$(e,JA,t.paddingTop),this.paddingRight=$(e,ZA,t.paddingRight),this.paddingBottom=$(e,QA,t.paddingBottom),this.paddingLeft=$(e,eM,t.paddingLeft),this.paintOrder=$(e,IM,t.paintOrder),this.position=$(e,nM,t.position),this.textAlign=$(e,tM,t.textAlign),this.textDecorationColor=$(e,mM,(i=t.textDecorationColor)!==null&&i!==void 0?i:t.color),this.textDecorationLine=$(e,gM,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=$(e,iM,t.textShadow),this.textTransform=$(e,rM,t.textTransform),this.transform=$(e,oM,t.transform),this.transformOrigin=$(e,lM,t.transformOrigin),this.visibility=$(e,dM,t.visibility),this.webkitTextStrokeColor=$(e,RM,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=$(e,PM,t.webkitTextStrokeWidth),this.wordBreak=$(e,hM,t.wordBreak),this.zIndex=$(e,pM,t.zIndex),this.objectFit=$(e,OM,t.objectFit)}return n.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},n.prototype.isTransparent=function(){return bi(this.backgroundColor)},n.prototype.isTransformed=function(){return this.transform!==null},n.prototype.isPositioned=function(){return this.position!==0},n.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},n.prototype.isFloating=function(){return this.float!==0},n.prototype.isInlineLevel=function(){return ut(this.display,4)||ut(this.display,33554432)||ut(this.display,268435456)||ut(this.display,536870912)||ut(this.display,67108864)||ut(this.display,134217728)},n}(),NM=function(){function n(e,t){this.content=$(e,SM,t.content),this.quotes=$(e,xM,t.quotes)}return n}(),Sb=function(){function n(e,t){this.counterIncrement=$(e,wM,t.counterIncrement),this.counterReset=$(e,CM,t.counterReset)}return n}(),$=function(n,e,t){var i=new By,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;i.write(r);var o=new jy(i.read());switch(e.type){case 2:var s=o.parseComponentValue();return e.parse(n,ue(s)?s.value:e.initialValue);case 0:return e.parse(n,o.parseComponentValue());case 1:return e.parse(n,o.parseComponentValues());case 4:return o.parseComponentValue();case 3:switch(e.format){case"angle":return hc.parse(n,o.parseComponentValue());case"color":return ki.parse(n,o.parseComponentValue());case"image":return mh.parse(n,o.parseComponentValue());case"length":var a=o.parseComponentValue();return vi(a)?a:yt;case"length-percentage":var c=o.parseComponentValue();return Be(c)?c:yt;case"time":return _b.parse(n,o.parseComponentValue())}break}},DM="data-html2canvas-debug",LM=function(n){var e=n.getAttribute(DM);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},vh=function(n,e){var t=LM(n);return t===1||e===t},Pn=function(){function n(e,t){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,vh(t,3),this.styles=new MM(e,window.getComputedStyle(t,null)),Ih(t)&&(this.styles.animationDuration.some(function(i){return i>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Za(this.context,t),vh(t,4)&&(this.flags|=16)}return n}();typeof SuppressedError=="function"&&SuppressedError;for(var wb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",UM=typeof Uint8Array>"u"?[]:new Uint8Array(256),Rc=0;Rc<wb.length;Rc++)UM[wb.charCodeAt(Rc)]=Rc;for(var Cb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",FM=typeof Uint8Array>"u"?[]:new Uint8Array(256),Pc=0;Pc<Cb.length;Pc++)FM[Cb.charCodeAt(Pc)]=Pc;var BM=1,yh=2,bh=3,Tb=4,xb=5,jM=7,Eb=8,_h=9,kh=10,Ib=11,Rb=12,Pb=13,Ob=14,Sh=15,VM=function(n){for(var e=[],t=0,i=n.length;t<i;){var r=n.charCodeAt(t++);if(r>=55296&&r<=56319&&t<i){var o=n.charCodeAt(t++);(o&64512)===56320?e.push(((r&1023)<<10)+(o&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},zM=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,n);var t=n.length;if(!t)return"";for(var i=[],r=-1,o="";++r<t;){var s=n[r];s<=65535?i.push(s):(s-=65536,i.push((s>>10)+55296,s%1024+56320)),(r+1===t||i.length>16384)&&(o+=String.fromCharCode.apply(String,i),i.length=0)}return o},Jt="\xD7",wh="\xF7",qM=function(n){throw new Error("UnicodeTrie not initialized")},WM=function(n,e,t){var i=t-2,r=e[i],o=e[t-1],s=e[t];if(o===yh&&s===bh)return Jt;if(o===yh||o===bh||o===Tb||s===yh||s===bh||s===Tb)return wh;if(o===Eb&&[Eb,_h,Ib,Rb].indexOf(s)!==-1||(o===Ib||o===_h)&&(s===_h||s===kh)||(o===Rb||o===kh)&&s===kh||s===Pb||s===xb||s===jM||o===BM)return Jt;if(o===Pb&&s===Ob){for(;r===xb;)r=e[--i];if(r===Ob)return Jt}if(o===Sh&&s===Sh){for(var a=0;r===Sh;)a++,r=e[--i];if(a%2===0)return Jt}return wh},GM=function(n){var e=VM(n),t=e.length,i=0,r=0,o=e.map(qM);return{next:function(){if(i>=t)return{done:!0,value:null};for(var s=Jt;i<t&&(s=WM(e,o,++i))===Jt;);if(s!==Jt||i===t){var a=zM.apply(null,e.slice(r,i));return r=i,{value:a,done:!1}}return{done:!0,value:null}}}},$M=function(n){for(var e=GM(n),t=[],i;!(i=e.next()).done;)i.value&&t.push(i.value.slice());return t},HM=function(n){var e=123;if(n.createRange){var t=n.createRange();if(t.getBoundingClientRect){var i=n.createElement("boundtest");i.style.height="".concat(e,"px"),i.style.display="block",n.body.appendChild(i),t.selectNode(i);var r=t.getBoundingClientRect(),o=Math.round(r.height);if(n.body.removeChild(i),o===e)return!0}}return!1},KM=function(n){var e=n.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",n.body.appendChild(e);var t=n.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var i=e.firstChild,r=Qa(i.data).map(function(c){return nt(c)}),o=0,s={},a=r.every(function(c,u){t.setStart(i,o),t.setEnd(i,o+c.length);var l=t.getBoundingClientRect();o+=c.length;var d=l.x>s.x||l.y>s.y;return s=l,u===0?!0:d});return n.body.removeChild(e),a},YM=function(){return typeof new Image().crossOrigin<"u"},XM=function(){return typeof new XMLHttpRequest().responseType=="string"},JM=function(n){var e=new Image,t=n.createElement("canvas"),i=t.getContext("2d");if(!i)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{i.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},Ab=function(n){return n[0]===0&&n[1]===255&&n[2]===0&&n[3]===255},ZM=function(n){var e=n.createElement("canvas"),t=100;e.width=t,e.height=t;var i=e.getContext("2d");if(!i)return Promise.reject(!1);i.fillStyle="rgb(0, 255, 0)",i.fillRect(0,0,t,t);var r=new Image,o=e.toDataURL();r.src=o;var s=Ch(t,t,0,0,r);return i.fillStyle="red",i.fillRect(0,0,t,t),Mb(s).then(function(a){i.drawImage(a,0,0);var c=i.getImageData(0,0,t,t).data;i.fillStyle="red",i.fillRect(0,0,t,t);var u=n.createElement("div");return u.style.backgroundImage="url(".concat(o,")"),u.style.height="".concat(t,"px"),Ab(c)?Mb(Ch(t,t,0,0,u)):Promise.reject(!1)}).then(function(a){return i.drawImage(a,0,0),Ab(i.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Ch=function(n,e,t,i,r){var o="http://www.w3.org/2000/svg",s=document.createElementNS(o,"svg"),a=document.createElementNS(o,"foreignObject");return s.setAttributeNS(null,"width",n.toString()),s.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",t.toString()),a.setAttributeNS(null,"y",i.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(a),a.appendChild(r),s},Mb=function(n){return new Promise(function(e,t){var i=new Image;i.onload=function(){return e(i)},i.onerror=t,i.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(n)))})},bt={get SUPPORT_RANGE_BOUNDS(){var n=HM(document);return Object.defineProperty(bt,"SUPPORT_RANGE_BOUNDS",{value:n}),n},get SUPPORT_WORD_BREAKING(){var n=bt.SUPPORT_RANGE_BOUNDS&&KM(document);return Object.defineProperty(bt,"SUPPORT_WORD_BREAKING",{value:n}),n},get SUPPORT_SVG_DRAWING(){var n=JM(document);return Object.defineProperty(bt,"SUPPORT_SVG_DRAWING",{value:n}),n},get SUPPORT_FOREIGNOBJECT_DRAWING(){var n=typeof Array.from=="function"&&typeof window.fetch=="function"?ZM(document):Promise.resolve(!1);return Object.defineProperty(bt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:n}),n},get SUPPORT_CORS_IMAGES(){var n=YM();return Object.defineProperty(bt,"SUPPORT_CORS_IMAGES",{value:n}),n},get SUPPORT_RESPONSE_TYPE(){var n=XM();return Object.defineProperty(bt,"SUPPORT_RESPONSE_TYPE",{value:n}),n},get SUPPORT_CORS_XHR(){var n="withCredentials"in new XMLHttpRequest;return Object.defineProperty(bt,"SUPPORT_CORS_XHR",{value:n}),n},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var n=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(bt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:n}),n}},os=function(){function n(e,t){this.text=e,this.bounds=t}return n}(),QM=function(n,e,t,i){var r=nN(e,t),o=[],s=0;return r.forEach(function(a){if(t.textDecorationLine.length||a.trim().length>0)if(bt.SUPPORT_RANGE_BOUNDS){var c=Nb(i,s,a.length).getClientRects();if(c.length>1){var u=Th(a),l=0;u.forEach(function(h){o.push(new os(h,Gn.fromDOMRectList(n,Nb(i,l+s,h.length).getClientRects()))),l+=h.length})}else o.push(new os(a,Gn.fromDOMRectList(n,c)))}else{var d=i.splitText(a.length);o.push(new os(a,eN(n,i))),i=d}else bt.SUPPORT_RANGE_BOUNDS||(i=i.splitText(a.length));s+=a.length}),o},eN=function(n,e){var t=e.ownerDocument;if(t){var i=t.createElement("html2canvaswrapper");i.appendChild(e.cloneNode(!0));var r=e.parentNode;if(r){r.replaceChild(i,e);var o=Za(n,i);return i.firstChild&&r.replaceChild(i.firstChild,i),o}}return Gn.EMPTY},Nb=function(n,e,t){var i=n.ownerDocument;if(!i)throw new Error("Node has no owner document");var r=i.createRange();return r.setStart(n,e),r.setEnd(n,e+t),r},Th=function(n){if(bt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(n)).map(function(t){return t.segment})}return $M(n)},tN=function(n,e){if(bt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(n)).map(function(i){return i.segment})}return rN(n,e)},nN=function(n,e){return e.letterSpacing!==0?Th(n):tN(n,e)},iN=[32,160,4961,65792,65793,4153,4241],rN=function(n,e){for(var t=e2(n,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),i=[],r,o=function(){if(r.value){var s=r.value.slice(),a=Qa(s),c="";a.forEach(function(u){iN.indexOf(u)===-1?c+=nt(u):(c.length&&i.push(c),i.push(nt(u)),c="")}),c.length&&i.push(c)}};!(r=t.next()).done;)o();return i},oN=function(){function n(e,t,i){this.text=sN(t.data,i.textTransform),this.textBounds=QM(e,this.text,i,t)}return n}(),sN=function(n,e){switch(e){case 1:return n.toLowerCase();case 3:return n.replace(aN,cN);case 2:return n.toUpperCase();default:return n}},aN=/(^|\s|:|-|\(|\))([a-z])/g,cN=function(n,e,t){return n.length>0?e+t.toUpperCase():n},Db=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;return r.src=i.currentSrc||i.src,r.intrinsicWidth=i.naturalWidth,r.intrinsicHeight=i.naturalHeight,r.context.cache.addImage(r.src),r}return e}(Pn),Lb=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;return r.canvas=i,r.intrinsicWidth=i.width,r.intrinsicHeight=i.height,r}return e}(Pn),Ub=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this,o=new XMLSerializer,s=Za(t,i);return i.setAttribute("width","".concat(s.width,"px")),i.setAttribute("height","".concat(s.height,"px")),r.svg="data:image/svg+xml,".concat(encodeURIComponent(o.serializeToString(i))),r.intrinsicWidth=i.width.baseVal.value,r.intrinsicHeight=i.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e}(Pn),Fb=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;return r.value=i.value,r}return e}(Pn),xh=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;return r.start=i.start,r.reversed=typeof i.reversed=="boolean"&&i.reversed===!0,r}return e}(Pn),uN=[{type:15,flags:0,unit:"px",number:3}],lN=[{type:16,flags:0,number:50}],dN=function(n){return n.width>n.height?new Gn(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width<n.height?new Gn(n.left,n.top+(n.height-n.width)/2,n.width,n.width):n},hN=function(n){var e=n.type===pN?new Array(n.value.length+1).join("\u2022"):n.value;return e.length===0?n.placeholder||"":e},Oc="checkbox",Ac="radio",pN="password",Bb=707406591,Eh=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;switch(r.type=i.type.toLowerCase(),r.checked=i.checked,r.value=hN(i),(r.type===Oc||r.type===Ac)&&(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=dN(r.bounds)),r.type){case Oc:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=uN;break;case Ac:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=lN;break}return r}return e}(Pn),jb=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this,o=i.options[i.selectedIndex||0];return r.value=o&&o.text||"",r}return e}(Pn),Vb=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;return r.value=i.value,r}return e}(Pn),zb=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;r.src=i.src,r.width=parseInt(i.width,10)||0,r.height=parseInt(i.height,10)||0,r.backgroundColor=r.styles.backgroundColor;try{if(i.contentWindow&&i.contentWindow.document&&i.contentWindow.document.documentElement){r.tree=Wb(t,i.contentWindow.document.documentElement);var o=i.contentWindow.document.documentElement?qr(t,getComputedStyle(i.contentWindow.document.documentElement).backgroundColor):Rn.TRANSPARENT,s=i.contentWindow.document.body?qr(t,getComputedStyle(i.contentWindow.document.body).backgroundColor):Rn.TRANSPARENT;r.backgroundColor=bi(o)?bi(s)?r.styles.backgroundColor:s:o}}catch{}return r}return e}(Pn),fN=["OL","UL","MENU"],Mc=function(n,e,t,i){for(var r=e.firstChild,o=void 0;r;r=o)if(o=r.nextSibling,Gb(r)&&r.data.length>0)t.textNodes.push(new oN(n,r,t.styles));else if(Gr(r))if(Jb(r)&&r.assignedNodes)r.assignedNodes().forEach(function(a){return Mc(n,a,t,i)});else{var s=qb(n,r);s.styles.isVisible()&&(mN(r,s,i)?s.flags|=4:gN(s.styles)&&(s.flags|=2),fN.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?Mc(n,r.shadowRoot,s,i):!Dc(r)&&!$b(r)&&!Lc(r)&&Mc(n,r,s,i))}},qb=function(n,e){return Ph(e)?new Db(n,e):Hb(e)?new Lb(n,e):$b(e)?new Ub(n,e):vN(e)?new Fb(n,e):yN(e)?new xh(n,e):bN(e)?new Eh(n,e):Lc(e)?new jb(n,e):Dc(e)?new Vb(n,e):Yb(e)?new zb(n,e):new Pn(n,e)},Wb=function(n,e){var t=qb(n,e);return t.flags|=4,Mc(n,e,t,t),t},mN=function(n,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Rh(n)&&t.styles.isTransparent()},gN=function(n){return n.isPositioned()||n.isFloating()},Gb=function(n){return n.nodeType===Node.TEXT_NODE},Gr=function(n){return n.nodeType===Node.ELEMENT_NODE},Ih=function(n){return Gr(n)&&typeof n.style<"u"&&!Nc(n)},Nc=function(n){return typeof n.className=="object"},vN=function(n){return n.tagName==="LI"},yN=function(n){return n.tagName==="OL"},bN=function(n){return n.tagName==="INPUT"},_N=function(n){return n.tagName==="HTML"},$b=function(n){return n.tagName==="svg"},Rh=function(n){return n.tagName==="BODY"},Hb=function(n){return n.tagName==="CANVAS"},Kb=function(n){return n.tagName==="VIDEO"},Ph=function(n){return n.tagName==="IMG"},Yb=function(n){return n.tagName==="IFRAME"},Xb=function(n){return n.tagName==="STYLE"},kN=function(n){return n.tagName==="SCRIPT"},Dc=function(n){return n.tagName==="TEXTAREA"},Lc=function(n){return n.tagName==="SELECT"},Jb=function(n){return n.tagName==="SLOT"},Zb=function(n){return n.tagName.indexOf("-")>0},SN=function(){function n(){this.counters={}}return n.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},n.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},n.prototype.pop=function(e){var t=this;e.forEach(function(i){return t.counters[i].pop()})},n.prototype.parse=function(e){var t=this,i=e.counterIncrement,r=e.counterReset,o=!0;i!==null&&i.forEach(function(a){var c=t.counters[a.counter];c&&a.increment!==0&&(o=!1,c.length||c.push(1),c[Math.max(0,c.length-1)]+=a.increment)});var s=[];return o&&r.forEach(function(a){var c=t.counters[a.counter];s.push(a.counter),c||(c=t.counters[a.counter]=[]),c.push(a.reset)}),s},n}(),Qb={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},e_={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u0554","\u0553","\u0552","\u0551","\u0550","\u054F","\u054E","\u054D","\u054C","\u054B","\u054A","\u0549","\u0548","\u0547","\u0546","\u0545","\u0544","\u0543","\u0542","\u0541","\u0540","\u053F","\u053E","\u053D","\u053C","\u053B","\u053A","\u0539","\u0538","\u0537","\u0536","\u0535","\u0534","\u0533","\u0532","\u0531"]},wN={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["\u05D9\u05F3","\u05D8\u05F3","\u05D7\u05F3","\u05D6\u05F3","\u05D5\u05F3","\u05D4\u05F3","\u05D3\u05F3","\u05D2\u05F3","\u05D1\u05F3","\u05D0\u05F3","\u05EA","\u05E9","\u05E8","\u05E7","\u05E6","\u05E4","\u05E2","\u05E1","\u05E0","\u05DE","\u05DC","\u05DB","\u05D9\u05D8","\u05D9\u05D7","\u05D9\u05D6","\u05D8\u05D6","\u05D8\u05D5","\u05D9","\u05D8","\u05D7","\u05D6","\u05D5","\u05D4","\u05D3","\u05D2","\u05D1","\u05D0"]},CN={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u10F5","\u10F0","\u10EF","\u10F4","\u10EE","\u10ED","\u10EC","\u10EB","\u10EA","\u10E9","\u10E8","\u10E7","\u10E6","\u10E5","\u10E4","\u10F3","\u10E2","\u10E1","\u10E0","\u10DF","\u10DE","\u10DD","\u10F2","\u10DC","\u10DB","\u10DA","\u10D9","\u10D8","\u10D7","\u10F1","\u10D6","\u10D5","\u10D4","\u10D3","\u10D2","\u10D1","\u10D0"]},$r=function(n,e,t,i,r,o){return n<e||n>t?as(n,r,o.length>0):i.integers.reduce(function(s,a,c){for(;n>=a;)n-=a,s+=i.values[c];return s},"")+o},t_=function(n,e,t,i){var r="";do t||n--,r=i(n)+r,n/=e;while(n*e>=e);return r},it=function(n,e,t,i,r){var o=t-e+1;return(n<0?"-":"")+(t_(Math.abs(n),o,i,function(s){return nt(Math.floor(s%o)+e)})+r)},Zi=function(n,e,t){t===void 0&&(t=". ");var i=e.length;return t_(Math.abs(n),i,!1,function(r){return e[Math.floor(r%i)]})+t},Hr=1,Si=2,wi=4,ss=8,$n=function(n,e,t,i,r,o){if(n<-9999||n>9999)return as(n,4,r.length>0);var s=Math.abs(n),a=r;if(s===0)return e[0]+a;for(var c=0;s>0&&c<=4;c++){var u=s%10;u===0&&ut(o,Hr)&&a!==""?a=e[u]+a:u>1||u===1&&c===0||u===1&&c===1&&ut(o,Si)||u===1&&c===1&&ut(o,wi)&&n>100||u===1&&c>1&&ut(o,ss)?a=e[u]+(c>0?t[c-1]:"")+a:u===1&&c>0&&(a=t[c-1]+a),s=Math.floor(s/10)}return(n<0?i:"")+a},n_="\u5341\u767E\u5343\u842C",i_="\u62FE\u4F70\u4EDF\u842C",r_="\u30DE\u30A4\u30CA\u30B9",Oh="\uB9C8\uC774\uB108\uC2A4",as=function(n,e,t){var i=t?". ":"",r=t?"\u3001":"",o=t?", ":"",s=t?" ":"";switch(e){case 0:return"\u2022"+s;case 1:return"\u25E6"+s;case 2:return"\u25FE"+s;case 5:var a=it(n,48,57,!0,i);return a.length<4?"0".concat(a):a;case 4:return Zi(n,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",r);case 6:return $r(n,1,3999,Qb,3,i).toLowerCase();case 7:return $r(n,1,3999,Qb,3,i);case 8:return it(n,945,969,!1,i);case 9:return it(n,97,122,!1,i);case 10:return it(n,65,90,!1,i);case 11:return it(n,1632,1641,!0,i);case 12:case 49:return $r(n,1,9999,e_,3,i);case 35:return $r(n,1,9999,e_,3,i).toLowerCase();case 13:return it(n,2534,2543,!0,i);case 14:case 30:return it(n,6112,6121,!0,i);case 15:return Zi(n,"\u5B50\u4E11\u5BC5\u536F\u8FB0\u5DF3\u5348\u672A\u7533\u9149\u620C\u4EA5",r);case 16:return Zi(n,"\u7532\u4E59\u4E19\u4E01\u620A\u5DF1\u5E9A\u8F9B\u58EC\u7678",r);case 17:case 48:return $n(n,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",n_,"\u8CA0",r,Si|wi|ss);case 47:return $n(n,"\u96F6\u58F9\u8CB3\u53C3\u8086\u4F0D\u9678\u67D2\u634C\u7396",i_,"\u8CA0",r,Hr|Si|wi|ss);case 42:return $n(n,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",n_,"\u8D1F",r,Si|wi|ss);case 41:return $n(n,"\u96F6\u58F9\u8D30\u53C1\u8086\u4F0D\u9646\u67D2\u634C\u7396",i_,"\u8D1F",r,Hr|Si|wi|ss);case 26:return $n(n,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u4E07",r_,r,0);case 25:return $n(n,"\u96F6\u58F1\u5F10\u53C2\u56DB\u4F0D\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343\u4E07",r_,r,Hr|Si|wi);case 31:return $n(n,"\uC601\uC77C\uC774\uC0BC\uC0AC\uC624\uC721\uCE60\uD314\uAD6C","\uC2ED\uBC31\uCC9C\uB9CC",Oh,o,Hr|Si|wi);case 33:return $n(n,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u842C",Oh,o,0);case 32:return $n(n,"\u96F6\u58F9\u8CB3\u53C3\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343",Oh,o,Hr|Si|wi);case 18:return it(n,2406,2415,!0,i);case 20:return $r(n,1,19999,CN,3,i);case 21:return it(n,2790,2799,!0,i);case 22:return it(n,2662,2671,!0,i);case 52:return $r(n,1,10999,wN,3,i);case 23:return Zi(n,"\u3042\u3044\u3046\u3048\u304A\u304B\u304D\u304F\u3051\u3053\u3055\u3057\u3059\u305B\u305D\u305F\u3061\u3064\u3066\u3068\u306A\u306B\u306C\u306D\u306E\u306F\u3072\u3075\u3078\u307B\u307E\u307F\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308A\u308B\u308C\u308D\u308F\u3090\u3091\u3092\u3093");case 24:return Zi(n,"\u3044\u308D\u306F\u306B\u307B\u3078\u3068\u3061\u308A\u306C\u308B\u3092\u308F\u304B\u3088\u305F\u308C\u305D\u3064\u306D\u306A\u3089\u3080\u3046\u3090\u306E\u304A\u304F\u3084\u307E\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304D\u3086\u3081\u307F\u3057\u3091\u3072\u3082\u305B\u3059");case 27:return it(n,3302,3311,!0,i);case 28:return Zi(n,"\u30A2\u30A4\u30A6\u30A8\u30AA\u30AB\u30AD\u30AF\u30B1\u30B3\u30B5\u30B7\u30B9\u30BB\u30BD\u30BF\u30C1\u30C4\u30C6\u30C8\u30CA\u30CB\u30CC\u30CD\u30CE\u30CF\u30D2\u30D5\u30D8\u30DB\u30DE\u30DF\u30E0\u30E1\u30E2\u30E4\u30E6\u30E8\u30E9\u30EA\u30EB\u30EC\u30ED\u30EF\u30F0\u30F1\u30F2\u30F3",r);case 29:return Zi(n,"\u30A4\u30ED\u30CF\u30CB\u30DB\u30D8\u30C8\u30C1\u30EA\u30CC\u30EB\u30F2\u30EF\u30AB\u30E8\u30BF\u30EC\u30BD\u30C4\u30CD\u30CA\u30E9\u30E0\u30A6\u30F0\u30CE\u30AA\u30AF\u30E4\u30DE\u30B1\u30D5\u30B3\u30A8\u30C6\u30A2\u30B5\u30AD\u30E6\u30E1\u30DF\u30B7\u30F1\u30D2\u30E2\u30BB\u30B9",r);case 34:return it(n,3792,3801,!0,i);case 37:return it(n,6160,6169,!0,i);case 38:return it(n,4160,4169,!0,i);case 39:return it(n,2918,2927,!0,i);case 40:return it(n,1776,1785,!0,i);case 43:return it(n,3046,3055,!0,i);case 44:return it(n,3174,3183,!0,i);case 45:return it(n,3664,3673,!0,i);case 46:return it(n,3872,3881,!0,i);case 3:default:return it(n,48,57,!0,i)}},o_="data-html2canvas-ignore",s_=function(){function n(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new SN,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return n.prototype.toIFrame=function(e,t){var i=this,r=TN(e,t);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var o=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,a=r.contentWindow,c=a.document,u=IN(r).then(function(){return Mt(i,void 0,void 0,function(){var h,p;return xt(this,function(m){switch(m.label){case 0:return this.scrolledElements.forEach(AN),a&&(a.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(a.scrollY!==t.top||a.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(a.scrollX-t.left,a.scrollY-t.top,0,0))),h=this.options.onclone,p=this.clonedReferenceElement,typeof p>"u"?[2,Promise.reject("Error finding the ".concat(this.referenceElement.nodeName," in the cloned document"))]:c.fonts&&c.fonts.ready?[4,c.fonts.ready]:[3,2];case 1:m.sent(),m.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,EN(c)]:[3,4];case 3:m.sent(),m.label=4;case 4:return typeof h=="function"?[2,Promise.resolve().then(function(){return h(c,p)}).then(function(){return r})]:[2,r]}})})}),l=c.baseURI;c.open(),c.write("".concat(PN(document.doctype),"<html></html>")),ON(this.referenceElement.ownerDocument,o,s);var d=c.adoptNode(this.documentElement);return UN(d,l),c.replaceChild(d,c.documentElement),c.close(),u},n.prototype.createElementClone=function(e){if(vh(e,2),Hb(e))return this.createCanvasClone(e);if(Kb(e))return this.createVideoClone(e);if(Xb(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Ph(t)&&(Ph(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Zb(t)?this.createCustomElementClone(t):t},n.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Ah(e.style,t),t},n.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].slice.call(t.cssRules,0).reduce(function(o,s){return s&&typeof s.cssText=="string"?o+s.cssText:o},""),r=e.cloneNode(!1);return r.textContent=i,r}}catch(o){if(this.context.logger.error("Unable to access cssRules property",o),o.name!=="SecurityError")throw o}return e.cloneNode(!1)},n.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var o=e.getContext("2d"),s=r.getContext("2d",{willReadFrequently:!0});if(s)if(!this.options.allowTaint&&o)s.putImageData(o.getImageData(0,0,e.width,e.height),0,0);else{var a=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(a){var c=a.getContextAttributes();(c==null?void 0:c.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return r}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},n.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},n.prototype.appendChildNode=function(e,t,i){(!Gr(t)||!kN(t)&&!t.hasAttribute(o_)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Gr(t)||!Xb(t))&&e.appendChild(this.cloneNode(t,i))},n.prototype.cloneChildNodes=function(e,t,i){for(var r=this,o=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;o;o=o.nextSibling)if(Gr(o)&&Jb(o)&&typeof o.assignedNodes=="function"){var s=o.assignedNodes();s.length&&s.forEach(function(a){return r.appendChildNode(t,a,i)})}else this.appendChildNode(t,o,i)},n.prototype.cloneNode=function(e,t){if(Gb(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&Gr(e)&&(Ih(e)||Nc(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var o=i.getComputedStyle(e),s=i.getComputedStyle(e,":before"),a=i.getComputedStyle(e,":after");this.referenceElement===e&&Ih(r)&&(this.clonedReferenceElement=r),Rh(r)&&DN(r);var c=this.counters.parse(new Sb(this.context,o)),u=this.resolvePseudoContent(e,r,s,cs.BEFORE);Zb(e)&&(t=!0),Kb(e)||this.cloneChildNodes(e,r,t),u&&r.insertBefore(u,r.firstChild);var l=this.resolvePseudoContent(e,r,a,cs.AFTER);return l&&r.appendChild(l),this.counters.pop(c),(o&&(this.options.copyStyles||Nc(e))&&!Yb(e)||t)&&Ah(o,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Dc(e)||Lc(e))&&(Dc(r)||Lc(r))&&(r.value=e.value),r}return e.cloneNode(!1)},n.prototype.resolvePseudoContent=function(e,t,i,r){var o=this;if(i){var s=i.content,a=t.ownerDocument;if(!(!a||!s||s==="none"||s==="-moz-alt-content"||i.display==="none")){this.counters.parse(new Sb(this.context,i));var c=new NM(this.context,i),u=a.createElement("html2canvaspseudoelement");Ah(i,u),c.content.forEach(function(d){if(d.type===0)u.appendChild(a.createTextNode(d.value));else if(d.type===22){var h=a.createElement("img");h.src=d.value,h.style.opacity="1",u.appendChild(h)}else if(d.type===18){if(d.name==="attr"){var p=d.values.filter(ue);p.length&&u.appendChild(a.createTextNode(e.getAttribute(p[0].value)||""))}else if(d.name==="counter"){var m=d.values.filter(vt),f=m[0],g=m[1];if(f&&ue(f)){var y=o.counters.getCounterValue(f.value),b=g&&ue(g)?gh.parse(o.context,g.value):3;u.appendChild(a.createTextNode(as(y,b,!1)))}}else if(d.name==="counters"){var S=d.values.filter(vt),f=S[0],w=S[1],g=S[2];if(f&&ue(f)){var k=o.counters.getCounterValues(f.value),C=g&&ue(g)?gh.parse(o.context,g.value):3,x=w&&w.type===0?w.value:"",I=k.map(function(O){return as(O,C,!1)}).join(x);u.appendChild(a.createTextNode(I))}}}else if(d.type===20)switch(d.value){case"open-quote":u.appendChild(a.createTextNode(kb(c.quotes,o.quoteDepth++,!0)));break;case"close-quote":u.appendChild(a.createTextNode(kb(c.quotes,--o.quoteDepth,!1)));break;default:u.appendChild(a.createTextNode(d.value))}}),u.className="".concat(Mh," ").concat(Nh);var l=r===cs.BEFORE?" ".concat(Mh):" ".concat(Nh);return Nc(t)?t.className.baseValue+=l:t.className+=l,u}}},n.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},n}(),cs;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER"})(cs||(cs={}));var TN=function(n,e){var t=n.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(o_,"true"),n.body.appendChild(t),t},xN=function(n){return new Promise(function(e){if(n.complete){e();return}if(!n.src){e();return}n.onload=e,n.onerror=e})},EN=function(n){return Promise.all([].slice.call(n.images,0).map(xN))},IN=function(n){return new Promise(function(e,t){var i=n.contentWindow;if(!i)return t("No window assigned for iframe");var r=i.document;i.onload=n.onload=function(){i.onload=n.onload=null;var o=setInterval(function(){r.body.childNodes.length>0&&r.readyState==="complete"&&(clearInterval(o),e(n))},50)}})},RN=["all","d","content"],Ah=function(n,e){for(var t=n.length-1;t>=0;t--){var i=n.item(t);RN.indexOf(i)===-1&&e.style.setProperty(i,n.getPropertyValue(i))}return e},PN=function(n){var e="";return n&&(e+="<!DOCTYPE ",n.name&&(e+=n.name),n.internalSubset&&(e+=n.internalSubset),n.publicId&&(e+='"'.concat(n.publicId,'"')),n.systemId&&(e+='"'.concat(n.systemId,'"')),e+=">"),e},ON=function(n,e,t){n&&n.defaultView&&(e!==n.defaultView.pageXOffset||t!==n.defaultView.pageYOffset)&&n.defaultView.scrollTo(e,t)},AN=function(n){var e=n[0],t=n[1],i=n[2];e.scrollLeft=t,e.scrollTop=i},MN=":before",NN=":after",Mh="___html2canvas___pseudoelement_before",Nh="___html2canvas___pseudoelement_after",a_=`{
79
+ `);var e="",t,i,r=0,o;for(t=i=0,r=n.length,o=0;o<r;o++){var s=n.charCodeAt(o),a=null;s<128?i++:s>127&&s<2048?a=String.fromCharCode(s>>6|192,s&63|128):a=String.fromCharCode(s>>12|224,s>>6&63|128,s&63|128),a!==null&&(i>t&&(e+=n.substring(t,i)),e+=a,t=i=o+1)}return i>t&&(e+=n.substring(t,n.length)),e},v.UUID=function(){try{return q.crypto.randomUUID()}catch{for(var n=new Array(36),e=0;e<36;e++)n[e]=Math.floor(Math.random()*16);return n[14]=4,n[19]=n[19]&=-5,n[19]=n[19]|=8,n[8]=n[13]=n[18]=n[23]="-",v.map(n,function(t){return t.toString(16)}).join("")}};var w0=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];v.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<w0.length;e++)if(n.indexOf(w0[e])!==-1)return!0;return!1},v.HTTPBuildQuery=function(n,e){var t,i,r=[];return v.isUndefined(e)&&(e="&"),v.each(n,function(o,s){t=encodeURIComponent(o.toString()),i=encodeURIComponent(s),r[r.length]=i+"="+t}),r.join(e)},v.getQueryParam=function(n,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var t="[\\?&]"+e+"=([^&#]*)",i=new RegExp(t),r=i.exec(n);if(r===null||r&&typeof r[1]!="string"&&r[1].length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch{ke.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},v.cookie={get:function(n){for(var e=n+"=",t=_e.cookie.split(";"),i=0;i<t.length;i++){for(var r=t[i];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}return null},parse:function(n){var e;try{e=v.JSONDecode(v.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,t,i,r,o,s){var a="",c="",u="";if(s)a="; domain="+s;else if(i){var l=x0(_e.location.hostname);a=l?"; domain=."+l:""}if(t){var d=new Date;d.setTime(d.getTime()+t*1e3),c="; expires="+d.toGMTString()}o&&(r=!0,u="; SameSite=None"),r&&(u+="; secure"),_e.cookie=n+"="+encodeURIComponent(e)+c+"; path=/"+a+u},set:function(n,e,t,i,r,o,s){var a="",c="",u="";if(s)a="; domain="+s;else if(i){var l=x0(_e.location.hostname);a=l?"; domain=."+l:""}if(t){var d=new Date;d.setTime(d.getTime()+t*24*60*60*1e3),c="; expires="+d.toGMTString()}o&&(r=!0,u="; SameSite=None"),r&&(u+="; secure");var h=n+"="+encodeURIComponent(e)+c+"; path=/"+a+u;return _e.cookie=h,h},remove:function(n,e,t){v.cookie.set(n,"",-1,e,!1,!1,t)}};var C0=function(n){var e=!0;try{var t="__mplss_"+Rd(8),i="xyz";n.setItem(t,i),n.getItem(t)!==i&&(e=!1),n.removeItem(t)}catch{e=!1}return e},Ed=null,Go=function(n,e){return Ed!==null&&!e?Ed:Ed=C0(n||q.localStorage)},Id=null,DR=function(n,e){return Id!==null&&!e?Id:Id=C0(n||q.sessionStorage)};function T0(n,e,t){var i=function(r){ke.error(e+" error: "+r)};return{is_supported:function(r){var o=t(n,r);return o||ke.error(e+" unsupported"),o},error:i,get:function(r){try{return n.getItem(r)}catch(o){i(o)}return null},parse:function(r){try{return v.JSONDecode(n.getItem(r))||{}}catch{}return null},set:function(r,o){try{n.setItem(r,o)}catch(s){i(s)}},remove:function(r){try{n.removeItem(r)}catch(o){i(o)}}}}v.localStorage=T0(q.localStorage,"localStorage",Go),v.sessionStorage=T0(q.sessionStorage,"sessionStorage",DR),v.register_event=function(){var n=function(i,r,o,s,a){if(!i){ke.error("No valid element provided to register_event");return}if(i.addEventListener&&!s)i.addEventListener(r,o,!!a);else{var c="on"+r,u=i[c];i[c]=e(i,o,u)}};function e(i,r,o){var s=function(a){if(a=a||t(q.event),!!a){var c=!0,u,l;return v.isFunction(o)&&(u=o(a)),l=r.call(i,a),(u===!1||l===!1)&&(c=!1),c}};return s}function t(i){return i&&(i.preventDefault=t.preventDefault,i.stopPropagation=t.stopPropagation),i}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},n}();var LR=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');v.dom_query=function(){function n(r){return r.all?r.all:r.getElementsByTagName("*")}var e=/[\t\r\n]/g;function t(r,o){var s=" "+o+" ";return(" "+r.className+" ").replace(e," ").indexOf(s)>=0}function i(r){if(!_e.getElementsByTagName)return[];var o=r.split(" "),s,a,c,u,l,d,h,p,m,f,g=[_e];for(d=0;d<o.length;d++){if(s=o[d].replace(/^\s+/,"").replace(/\s+$/,""),s.indexOf("#")>-1){a=s.split("#"),c=a[0];var y=a[1],b=_e.getElementById(y);if(!b||c&&b.nodeName.toLowerCase()!=c)return[];g=[b];continue}if(s.indexOf(".")>-1){a=s.split("."),c=a[0];var S=a[1];for(c||(c="*"),u=[],l=0,h=0;h<g.length;h++)for(c=="*"?m=n(g[h]):m=g[h].getElementsByTagName(c),p=0;p<m.length;p++)u[l++]=m[p];for(g=[],f=0,h=0;h<u.length;h++)u[h].className&&v.isString(u[h].className)&&t(u[h],S)&&(g[f++]=u[h]);continue}var w=s.match(LR);if(w){c=w[1];var k=w[2],C=w[3],x=w[4];for(c||(c="*"),u=[],l=0,h=0;h<g.length;h++)for(c=="*"?m=n(g[h]):m=g[h].getElementsByTagName(c),p=0;p<m.length;p++)u[l++]=m[p];g=[],f=0;var I;switch(C){case"=":I=function(P){return P.getAttribute(k)==x};break;case"~":I=function(P){return P.getAttribute(k).match(new RegExp("\\b"+x+"\\b"))};break;case"|":I=function(P){return P.getAttribute(k).match(new RegExp("^"+x+"-?"))};break;case"^":I=function(P){return P.getAttribute(k).indexOf(x)===0};break;case"$":I=function(P){return P.getAttribute(k).lastIndexOf(x)==P.getAttribute(k).length-x.length};break;case"*":I=function(P){return P.getAttribute(k).indexOf(x)>-1};break;default:I=function(P){return P.getAttribute(k)}}for(g=[],f=0,h=0;h<u.length;h++)I(u[h])&&(g[f++]=u[h]);continue}for(c=s,u=[],l=0,h=0;h<g.length;h++)for(m=g[h].getElementsByTagName(c),p=0;p<m.length;p++)u[l++]=m[p];g=u}return g}return function(r){return v.isElement(r)?[r]:v.isObject(r)&&!v.isUndefined(r.length)?r:i.call(this,r)}}();var UR=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],FR=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];v.info={campaignParams:function(n){var e="",t={};return v.each(UR,function(i){e=v.getQueryParam(_e.URL,i),e.length?t[i]=e:n!==void 0&&(t[i]=n)}),t},clickParams:function(){var n="",e={};return v.each(FR,function(t){n=v.getQueryParam(_e.URL,t),n.length&&(e[t]=n)}),e},marketingParams:function(){return v.extend(v.info.campaignParams(),v.info.clickParams())},searchEngine:function(n){return n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(n){var e=v.info.searchEngine(n),t=e!="yahoo"?"q":"p",i={};if(e!==null){i.$search_engine=e;var r=v.getQueryParam(n,t);r.length&&(i.mp_keyword=r)}return i},browser:function(n,e,t){return e=e||"",t||v.includes(n," OPR/")?v.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":v.includes(n,"IEMobile")||v.includes(n,"WPDesktop")?"Internet Explorer Mobile":v.includes(n,"SamsungBrowser/")?"Samsung Internet":v.includes(n,"Edge")||v.includes(n,"Edg/")?"Microsoft Edge":v.includes(n,"FBIOS")?"Facebook Mobile":v.includes(n,"Whale/")?"Whale Browser":v.includes(n,"Chrome")?"Chrome":v.includes(n,"CriOS")?"Chrome iOS":v.includes(n,"UCWEB")||v.includes(n,"UCBrowser")?"UC Browser":v.includes(n,"FxiOS")?"Firefox iOS":v.includes(e,"Apple")?v.includes(n,"Mobile")?"Mobile Safari":"Safari":v.includes(n,"Android")?"Android Mobile":v.includes(n,"Konqueror")?"Konqueror":v.includes(n,"Firefox")?"Firefox":v.includes(n,"MSIE")||v.includes(n,"Trident/")?"Internet Explorer":v.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,t){var i=v.info.browser(n,e,t),r={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/,"Whale Browser":/Whale\/(\d+(\.\d+)?)/},o=r[i];if(o===void 0)return null;var s=n.match(o);return s?parseFloat(s[s.length-2]):null},os:function(){var n=Vn;return/Windows/i.test(n)?/Phone/.test(n)||/WPDesktop/.test(n)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(n)?"iOS":/Android/.test(n)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Mac/i.test(n)?"Mac OS X":/Linux/.test(n)?"Linux":/CrOS/.test(n)?"Chrome OS":""},device:function(n){return/Windows Phone/i.test(n)||/WPDesktop/.test(n)?"Windows Phone":/iPad/.test(n)?"iPad":/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Android/.test(n)?"Android":""},referringDomain:function(n){var e=n.split("/");return e.length>=3?e[2]:""},currentUrl:function(){return q.location.href},properties:function(n){return typeof n!="object"&&(n={}),v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(Vn,ui.vendor,ja),$referrer:_e.referrer,$referring_domain:v.info.referringDomain(_e.referrer),$device:v.info.device(Vn)}),{$current_url:v.info.currentUrl(),$browser_version:v.info.browserVersion(Vn,ui.vendor,ja),$screen_height:y0.height,$screen_width:y0.width,mp_lib:"web",$lib_version:on.LIB_VERSION,$insert_id:Rd(),time:v.timestamp()/1e3},v.strip_empty_properties(n))},people_properties:function(){return v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(Vn,ui.vendor,ja)}),{$browser_version:v.info.browserVersion(Vn,ui.vendor,ja)})},mpPageViewProperties:function(){return v.strip_empty_properties({current_page_title:_e.title,current_domain:q.location.hostname,current_url_path:q.location.pathname,current_url_protocol:q.location.protocol,current_url_search:q.location.search})}};var BR=function(n,e){var t=null,i=[];return function(r){var o=this;return i.push(r),t||(t=new Se(function(s){setTimeout(function(){var a=n.apply(o,[i]);t=null,i=[],s(a)},e)})),t}},Rd=function(n){var e=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return n?e.substring(0,n):e},jR=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,VR=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,x0=function(n){var e=VR,t=n.split("."),i=t[t.length-1];(i.length>4||i==="com"||i==="org")&&(e=jR);var r=n.match(e);return r?r[0]:""},zR=function(){var n=q.navigator.onLine;return v.isUndefined(n)||n},li=function(){},Mr=null,Va=null;typeof JSON<"u"&&(Mr=JSON.stringify,Va=JSON.parse),Mr=Mr||v.JSONEncode,Va=Va||v.JSONDecode,v.info=v.info,v.info.browser=v.info.browser,v.info.browserVersion=v.info.browserVersion,v.info.device=v.info.device,v.info.properties=v.info.properties,v.isBlockedUA=v.isBlockedUA,v.isEmptyObject=v.isEmptyObject,v.isObject=v.isObject,v.JSONDecode=v.JSONDecode,v.JSONEncode=v.JSONEncode,v.toArray=v.toArray,v.NPO=ci;var qR="mixpanelBrowserDb",E0="mixpanelRecordingEvents",Pd="mixpanelRecordingRegistry",WR=1,GR=[E0,Pd],Sn=function(n){this.dbPromise=null,this.storeName=n};Sn.prototype._openDb=function(){return new Se(function(n,e){var t=q.indexedDB.open(qR,WR);t.onerror=function(){e(t.error)},t.onsuccess=function(){n(t.result)},t.onupgradeneeded=function(i){var r=i.target.result;GR.forEach(function(o){r.createObjectStore(o)})}})},Sn.prototype.init=function(){return q.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(n){return n instanceof q.IDBDatabase?Se.resolve():Se.reject(n)})):Se.reject("indexedDB is not supported in this browser")},Sn.prototype.makeTransaction=function(n,e){var t=this.storeName,i=function(r){return new Se(function(o,s){var a=r.transaction(t,n);a.oncomplete=function(){o(a)},a.onabort=a.onerror=function(){s(a.error)},e(a.objectStore(t))})};return this.dbPromise.then(i).catch((function(r){return r&&r.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(i)):Se.reject(r)}).bind(this))},Sn.prototype.setItem=function(n,e){return this.makeTransaction("readwrite",function(t){t.put(e,n)})},Sn.prototype.getItem=function(n){var e;return this.makeTransaction("readonly",function(t){e=t.get(n)}).then(function(){return e.result})},Sn.prototype.removeItem=function(n){return this.makeTransaction("readwrite",function(e){e.delete(n)})},Sn.prototype.getAll=function(){var n;return this.makeTransaction("readonly",function(e){n=e.getAll()}).then(function(){return n.result})};var $R="__mp_opt_in_out_";function HR(n,e){P0(!0,n,e)}function KR(n,e){P0(!1,n,e)}function YR(n,e){return R0(n,e)==="1"}function I0(n,e){if(JR(e))return ke.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var t=R0(n,e)==="0";return t&&ke.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),t}function di(n){return Md(n,function(e){return this.get_config(e)})}function hi(n){return Md(n,function(e){return this._get_config(e)})}function Nr(n){return Md(n,function(e){return this._get_config(e)})}function XR(n,e){e=e||{},Od(e).remove(Ad(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function Od(n){return n=n||{},n.persistenceType==="localStorage"?v.localStorage:v.cookie}function Ad(n,e){return e=e||{},(e.persistencePrefix||$R)+n}function R0(n,e){return Od(e).get(Ad(n,e))}function JR(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||q,t=e.navigator||{},i=!1;return v.each([t.doNotTrack,t.msDoNotTrack,e.doNotTrack],function(r){v.includes([!0,1,"1","yes"],r)&&(i=!0)}),i}function P0(n,e,t){if(!v.isString(e)||!e.length){ke.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}t=t||{},Od(t).set(Ad(e,t),n?1:0,v.isNumber(t.cookieExpiration)?t.cookieExpiration:null,!!t.crossSubdomainCookie,!!t.secureCookie,!!t.crossSiteCookie,t.cookieDomain),t.track&&n&&t.track(t.trackEventName||"$opt_in",t.trackProperties,{send_immediately:!0})}function Md(n,e){return function(){var t=!1;try{var i=e.call(this,"token"),r=e.call(this,"ignore_dnt"),o=e.call(this,"opt_out_tracking_persistence_type"),s=e.call(this,"opt_out_tracking_cookie_prefix"),a=e.call(this,"window");i&&(t=I0(i,{ignoreDnt:r,persistenceType:o,persistencePrefix:s,window:a}))}catch(u){ke.error("Unexpected error when checking tracking opt-out status: "+u)}if(!t)return n.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var ZR=Gi("lock"),O0=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||q.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3,this.promiseImpl=e.promiseImpl||Se};O0.prototype.withLock=function(n,e){var t=this.promiseImpl;return new t(v.bind(function(i,r){var o=e||new Date().getTime()+"|"+Math.random(),s=new Date().getTime(),a=this.storageKey,c=this.pollIntervalMS,u=this.timeoutMS,l=this.storage,d=a+":X",h=a+":Y",p=a+":Z",m=function(S){if(new Date().getTime()-s>u){ZR.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+o+"]"),l.removeItem(p),l.removeItem(h),y();return}setTimeout(function(){try{S()}catch(w){r(w)}},c*(Math.random()+.1))},f=function(S,w){S()?w():m(function(){f(S,w)})},g=function(){var S=l.getItem(h);return S&&S!==o?!1:(l.setItem(h,o),l.getItem(h)===o?!0:(Go(l,!0)||r(new Error("localStorage support dropped while acquiring lock")),!1))},y=function(){l.setItem(d,o),f(g,function(){if(l.getItem(d)===o){b();return}m(function(){if(l.getItem(h)!==o){y();return}f(function(){return!l.getItem(p)},b)})})},b=function(){l.setItem(p,"1");var S=function(){l.removeItem(p),l.getItem(h)===o&&l.removeItem(h),l.getItem(d)===o&&l.removeItem(d)};n().then(function(w){S(),i(w)}).catch(function(w){S(),r(w)})};try{if(Go(l,!0))y();else throw new Error("localStorage support check failed")}catch(S){r(S)}},this))};var $o=function(n){this.storage=n||q.localStorage};$o.prototype.init=function(){return Se.resolve()},$o.prototype.setItem=function(n,e){return new Se(v.bind(function(t,i){try{this.storage.setItem(n,Mr(e))}catch(r){i(r)}t()},this))},$o.prototype.getItem=function(n){return new Se(v.bind(function(e,t){var i;try{i=Va(this.storage.getItem(n))}catch(r){t(r)}e(i)},this))},$o.prototype.removeItem=function(n){return new Se(v.bind(function(e,t){try{this.storage.removeItem(n)}catch(i){t(i)}e()},this))};var A0=Gi("batch"),wn=function(n,e){e=e||{},this.storageKey=n,this.usePersistence=e.usePersistence,this.usePersistence&&(this.queueStorage=e.queueStorage||new $o,this.lock=new O0(n,{storage:e.sharedLockStorage||q.localStorage,timeoutMS:e.sharedLockTimeoutMS})),this.reportError=e.errorReporter||v.bind(A0.error,A0),this.pid=e.pid||null,this.memQueue=[],this.initialized=!1,e.enqueueThrottleMs?this.enqueuePersisted=BR(v.bind(this._enqueuePersisted,this),e.enqueueThrottleMs):this.enqueuePersisted=v.bind(function(t){return this._enqueuePersisted([t])},this)};wn.prototype.ensureInit=function(){return this.initialized?Se.resolve():this.queueStorage.init().then(v.bind(function(){this.initialized=!0},this)).catch(v.bind(function(n){this.reportError("Error initializing queue persistence. Disabling persistence",n),this.initialized=!0,this.usePersistence=!1},this))},wn.prototype.enqueue=function(n,e){var t={id:Rd(),flushAfter:new Date().getTime()+e*2,payload:n};return this.usePersistence?this.enqueuePersisted(t):(this.memQueue.push(t),Se.resolve(!0))},wn.prototype._enqueuePersisted=function(n){var e=v.bind(function(){return this.ensureInit().then(v.bind(function(){return this.readFromStorage()},this)).then(v.bind(function(t){return this.saveToStorage(t.concat(n))},this)).then(v.bind(function(t){return t&&(this.memQueue=this.memQueue.concat(n)),t},this)).catch(v.bind(function(t){return this.reportError("Error enqueueing items",t,n),!1},this))},this);return this.lock.withLock(e,this.pid).catch(v.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this))},wn.prototype.fillBatch=function(n){var e=this.memQueue.slice(0,n);return this.usePersistence&&e.length<n?this.ensureInit().then(v.bind(function(){return this.readFromStorage()},this)).then(v.bind(function(t){if(t.length){var i={};v.each(e,function(s){i[s.id]=!0});for(var r=0;r<t.length;r++){var o=t[r];if(new Date().getTime()>o.flushAfter&&!i[o.id]&&(o.orphaned=!0,e.push(o),e.length>=n))break}}return e},this)):Se.resolve(e)};var M0=function(n,e){var t=[];return v.each(n,function(i){i.id&&!e[i.id]&&t.push(i)}),t};wn.prototype.removeItemsByID=function(n){var e={};if(v.each(n,function(i){e[i]=!0}),this.memQueue=M0(this.memQueue,e),this.usePersistence){var t=v.bind(function(){return this.ensureInit().then(v.bind(function(){return this.readFromStorage()},this)).then(v.bind(function(i){return i=M0(i,e),this.saveToStorage(i)},this)).then(v.bind(function(){return this.readFromStorage()},this)).then(v.bind(function(i){for(var r=0;r<i.length;r++){var o=i[r];if(o.id&&e[o.id])throw new Error("Item not removed from storage")}return!0},this)).catch(v.bind(function(i){return this.reportError("Error removing items",i,n),!1},this))},this);return this.lock.withLock(t,this.pid).catch(v.bind(function(i){return this.reportError("Error acquiring storage lock",i),Go(this.lock.storage,!0)?!1:t().then(v.bind(function(r){return r||this.queueStorage.removeItem(this.storageKey).then(function(){return r})},this)).catch(v.bind(function(r){return this.reportError("Error clearing queue",r),!1},this))},this))}else return Se.resolve(!0)};var N0=function(n,e){var t=[];return v.each(n,function(i){var r=i.id;if(r in e){var o=e[r];o!==null&&(i.payload=o,t.push(i))}else t.push(i)}),t};wn.prototype.updatePayloads=function(n){return this.memQueue=N0(this.memQueue,n),this.usePersistence?this.lock.withLock(v.bind(function(){return this.ensureInit().then(v.bind(function(){return this.readFromStorage()},this)).then(v.bind(function(e){return e=N0(e,n),this.saveToStorage(e)},this)).catch(v.bind(function(e){return this.reportError("Error updating items",n,e),!1},this))},this),this.pid).catch(v.bind(function(e){return this.reportError("Error acquiring storage lock",e),!1},this)):Se.resolve(!0)},wn.prototype.readFromStorage=function(){return this.ensureInit().then(v.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(v.bind(function(n){return n&&(v.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null)),n||[]},this)).catch(v.bind(function(n){return this.reportError("Error retrieving queue",n),[]},this))},wn.prototype.saveToStorage=function(n){return this.ensureInit().then(v.bind(function(){return this.queueStorage.setItem(this.storageKey,n)},this)).then(function(){return!0}).catch(v.bind(function(e){return this.reportError("Error saving queue",e),!1},this))},wn.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(v.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):Se.resolve()};var QR=10*60*1e3,Ho=Gi("batch"),Kt=function(n,e){this.errorReporter=e.errorReporter,this.queue=new wn(n,{errorReporter:v.bind(this.reportError,this),queueStorage:e.queueStorage,sharedLockStorage:e.sharedLockStorage,sharedLockTimeoutMS:e.sharedLockTimeoutMS,usePersistence:e.usePersistence,enqueueThrottleMs:e.enqueueThrottleMs}),this.libConfig=e.libConfig,this.sendRequest=e.sendRequestFunc,this.beforeSendHook=e.beforeSendHook,this.stopAllBatching=e.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=e.flushOnlyOnInterval||!1,this._flushPromise=null};Kt.prototype.enqueue=function(n){return this.queue.enqueue(n,this.flushInterval)},Kt.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},Kt.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},Kt.prototype.clear=function(){return this.queue.clear()},Kt.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},Kt.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},Kt.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(v.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},Kt.prototype.sendRequestPromise=function(n,e){return new Se(v.bind(function(t){this.sendRequest(n,e,t)},this))},Kt.prototype.flush=function(n){if(this.requestInProgress)return Ho.log("Flush: Request already in progress"),Se.resolve();this.requestInProgress=!0,n=n||{};var e=this.libConfig.batch_request_timeout_ms,t=new Date().getTime(),i=this.batchSize;return this.queue.fillBatch(i).then(v.bind(function(r){var o=r.length===i,s=[],a={};if(v.each(r,function(d){var h=d.payload;if(this.beforeSendHook&&!d.orphaned&&(h=this.beforeSendHook(h)),h){h.event&&h.properties&&(h.properties=v.extend({},h.properties,{mp_sent_by_lib_version:on.LIB_VERSION}));var p=!0,m=d.id;m?(this.itemIdsSentSuccessfully[m]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:d,batchSize:r.length,timesSent:this.itemIdsSentSuccessfully[m]}),p=!1):this.reportError("[dupe] found item with no ID",{item:d}),p&&s.push(h)}a[d.id]=h},this),s.length<1)return this.requestInProgress=!1,this.resetFlush(),Se.resolve();var c=v.bind(function(){return this.queue.removeItemsByID(v.map(r,function(d){return d.id})).then(v.bind(function(d){return v.each(r,v.bind(function(h){var p=h.id;p?(this.itemIdsSentSuccessfully[p]=this.itemIdsSentSuccessfully[p]||0,this.itemIdsSentSuccessfully[p]++,this.itemIdsSentSuccessfully[p]>5&&this.reportError("[dupe] item ID sent too many times",{item:h,batchSize:r.length,timesSent:this.itemIdsSentSuccessfully[p]})):this.reportError("[dupe] found item with no ID while removing",{item:h})},this)),d?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?(this.resetFlush(),Se.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),Se.resolve())},this))},this),u=v.bind(function(d){this.requestInProgress=!1;try{if(n.unloading)return this.queue.updatePayloads(a);if(v.isObject(d)&&d.error==="timeout"&&new Date().getTime()-t>=e)return this.reportError("Network timeout; retrying"),this.flush();if(v.isObject(d)&&(d.httpStatusCode>=500||d.httpStatusCode===429||d.httpStatusCode<=0&&!zR()||d.error==="timeout")){var h=this.flushInterval*2;return d.retryAfter&&(h=parseInt(d.retryAfter,10)*1e3||h),h=Math.min(QR,h),this.reportError("Error; retry in "+h+" ms"),this.scheduleFlush(h),Se.resolve()}else if(v.isObject(d)&&d.httpStatusCode===413)if(r.length>1){var p=Math.max(1,Math.floor(i/2));return this.batchSize=Math.min(this.batchSize,p,r.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),Se.resolve()}else return this.reportError("Single-event request too large; dropping",r),this.resetBatchSize(),c();else return c()}catch(m){this.reportError("Error handling API response",m),this.resetFlush()}},this),l={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};return n.unloading&&(l.transport="sendBeacon"),Ho.log("MIXPANEL REQUEST:",s),this.sendRequestPromise(s,l).then(u)},this)).catch(v.bind(function(r){this.reportError("Error flushing request queue",r),this.resetFlush()},this))},Kt.prototype.reportError=function(n,e){if(Ho.error.apply(Ho.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(t){Ho.error(t)}};var Nd=function(n){var e=Date.now();return!n||e>n.maxExpires||e>n.idleExpires},eP=250,Dr=Gi("recorder"),D0=q.CompressionStream,tP={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},nP=new Set([Q.MouseMove,Q.MouseInteraction,Q.Scroll,Q.ViewportResize,Q.Input,Q.TouchMove,Q.MediaInteraction,Q.Drag,Q.Selection]);function iP(n){return n.type===ce.IncrementalSnapshot&&nP.has(n.data.source)}var gt=function(n){this._mixpanel=n.mixpanelInstance,this._onIdleTimeout=n.onIdleTimeout||li,this._onMaxLengthReached=n.onMaxLengthReached||li,this._onBatchSent=n.onBatchSent||li,this._rrwebRecord=n.rrwebRecord||null,this._stopRecording=null,this.replayId=n.replayId,this.batchStartUrl=n.batchStartUrl||null,this.replayStartUrl=n.replayStartUrl||null,this.idleExpires=n.idleExpires||null,this.maxExpires=n.maxExpires||null,this.replayStartTime=n.replayStartTime||null,this.seqNo=n.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=qo,this.recordMinMs=0;var e=Go(n.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new Sn(E0),this.batcher=new Kt(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:tP,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:n.sharedLockStorage,usePersistence:e,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:eP,sharedLockTimeoutMS:10*1e3})};gt.prototype.getUserIdInfo=function(){if(this.finalFlushUserIdInfo)return this.finalFlushUserIdInfo;var n={distinct_id:String(this._mixpanel.get_distinct_id())},e=this._mixpanel.get_property("$device_id");e&&(n.$device_id=e);var t=this._mixpanel.get_property("$user_id");return t&&(n.$user_id=t),n},gt.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))},gt.prototype.getConfig=function(n){return this._mixpanel.get_config(n)},gt.prototype.get_config=function(n){return this.getConfig(n)},gt.prototype.startRecording=function(n){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){Dr.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>qo&&(this.recordMaxMs=qo,Dr.critical("record_max_ms cannot be greater than "+qo+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Sd&&(this.recordMinMs=Sd,Dr.critical("record_min_ms cannot be greater than "+Sd+"ms. Capping value.")),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=v.info.currentUrl(),this.replayStartUrl=v.info.currentUrl()),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=(function(){clearTimeout(this.idleTimeoutId);var r=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,r),this.idleExpires=new Date().getTime()+r}).bind(this);e();var t=this.getConfig("record_block_selector");(t===""||t===null)&&(t=void 0);try{this._stopRecording=this._rrwebRecord({emit:(function(r){if(this.idleExpires&&this.idleExpires<r.timestamp){this._onIdleTimeout();return}iP(r)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),e()),this.__enqueuePromise=this.batcher.enqueue(r)}).bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:t,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector"),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15}})}catch(r){this.reportError("Unexpected error when starting rrweb recording.",r)}if(typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}var i=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),i)},gt.prototype.stopRecording=function(n){if(this.finalFlushUserIdInfo=this.getUserIdInfo(),!this.isRrwebStopped()){try{this._stopRecording()}catch(t){this.reportError("Error with rrweb stopRecording",t)}this._stopRecording=null}var e;return this.batcher.stopped?e=this.batcher.clear():n||(e=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),e},gt.prototype.isRrwebStopped=function(){return this._stopRecording===null},gt.prototype.flushEventsWithOptOut=function(n,e,t){var i=(function(r){r===0&&(this.stopRecording(),t({error:"Tracking has been opted out, stopping recording."}))}).bind(this);this._flushEvents(n,e,t,i)},gt.prototype.serialize=function(){var n;try{n=this._mixpanel.get_tab_id()}catch(e){this.reportError("Error getting tab ID for serialization ",e),n=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:n}},gt.deserialize=function(n,e){var t=new gt(v.extend({},e,{replayId:n.replayId,batchStartUrl:n.batchStartUrl,replayStartUrl:n.replayStartUrl,idleExpires:n.idleExpires,maxExpires:n.maxExpires,replayStartTime:n.replayStartTime,seqNo:n.seqNo,sharedLockStorage:e.sharedLockStorage}));return t},gt.prototype._sendRequest=function(n,e,t,i){var r=(function(s,a){s.status===200&&this.replayId===n&&(this.seqNo++,this.batchStartUrl=v.info.currentUrl()),this._onBatchSent(),i({status:0,httpStatusCode:s.status,responseBody:a,retryAfter:s.headers.get("Retry-After")})}).bind(this),o=this._mixpanel.get_api_host&&this._mixpanel.get_api_host("record")||this.getConfig("api_host");q.fetch(o+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(e),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:t}).then(function(s){s.json().then(function(a){r(s,a)}).catch(function(a){i({error:a})})}).catch(function(s){i({error:s,httpStatusCode:0})})},gt.prototype._flushEvents=di(function(n,e,t){var i=n.length;if(i>0){for(var r=this.replayId,o=1/0,s=-1/0,a=!1,c=0;c<i;c++)o=Math.min(o,n[c].timestamp),s=Math.max(s,n[c].timestamp),n[c].type===ce.FullSnapshot&&(a=!0);if(this.seqNo===0){if(!a){t({error:"First batch does not contain a full snapshot. Aborting recording."}),this.stopRecording(!0);return}this.replayStartTime=o}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var u=s-this.replayStartTime,l={$current_url:this.batchStartUrl,$lib_version:on.LIB_VERSION,batch_start_time:o/1e3,mp_lib:"web",replay_id:r,replay_length_ms:u,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},d=JSON.stringify(n);if(Object.assign(l,this.getUserIdInfo()),D0){var h=new Blob([d],{type:"application/json"}).stream(),p=h.pipeThrough(new D0("gzip"));new Response(p).blob().then((function(m){l.format="gzip",this._sendRequest(r,l,m,t)}).bind(this))}else l.format="body",this._sendRequest(r,l,d,t)}}),gt.prototype.reportError=function(n,e){Dr.error.apply(Dr.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.getConfig("error_reporter")(n,e)}catch(t){Dr.error(t)}};var Lr=function(n){this.idb=new Sn(Pd),this.errorReporter=n.errorReporter,this.mixpanelInstance=n.mixpanelInstance,this.sharedLockStorage=n.sharedLockStorage};Lr.prototype.handleError=function(n){this.errorReporter("IndexedDB error: ",n)},Lr.prototype.setActiveRecording=function(n){var e=n.tabId;return e?this.idb.init().then((function(){return this.idb.setItem(e,n)}).bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),Se.resolve())},Lr.prototype.getActiveRecording=function(){return this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(n){return Nd(n)?null:n}).bind(this)).catch(this.handleError.bind(this))},Lr.prototype.clearActiveRecording=function(){return this.getActiveRecording().then((function(n){if(n)return n.maxExpires=0,this.setActiveRecording(n)}).bind(this)).catch(this.handleError.bind(this))},Lr.prototype.flushInactiveRecordings=function(){return this.idb.init().then((function(){return this.idb.getAll()}).bind(this)).then((function(n){var e=n.filter(function(t){return Nd(t)}).map((function(t){var i=gt.deserialize(t,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return i.unloadPersistedData().then((function(){return this.idb.removeItem(t.tabId)}).bind(this)).catch(this.handleError.bind(this))}).bind(this));return Se.all(e)}).bind(this)).catch(this.handleError.bind(this))};var Ko=Gi("recorder"),zn=function(n,e,t){this.mixpanelInstance=n,this.rrwebRecord=e||si,this.sharedLockStorage=t,this.recordingRegistry=new Lr({mixpanelInstance:this.mixpanelInstance,errorReporter:Ko.error,sharedLockStorage:t}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null,this.stopRecordingInProgress=!1};zn.prototype.startRecording=function(n){if(n=n||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){Ko.log("Recording already in progress, skipping startRecording.");return}var e=(function(){Ko.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),t=(function(){Ko.log("Max recording length reached, stopping recording."),this.resetRecording()}).bind(this),i=(function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}).bind(this),r={mixpanelInstance:this.mixpanelInstance,onBatchSent:i,onIdleTimeout:e,onMaxLengthReached:t,replayId:v.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return n.activeSerializedRecording?this.activeRecording=gt.deserialize(n.activeSerializedRecording,r):this.activeRecording=new gt(r),this.activeRecording.startRecording(n.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},zn.prototype.stopRecording=function(){return this.stopRecordingInProgress=!0,this._stopCurrentRecording(!1,!0).then((function(){return this.recordingRegistry.clearActiveRecording()}).bind(this)).then((function(){this.stopRecordingInProgress=!1}).bind(this))},zn.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},zn.prototype._stopCurrentRecording=function(n,e){if(this.activeRecording){var t=this.activeRecording.stopRecording(n);return e&&(this.activeRecording=null),t}return Se.resolve()},zn.prototype.resumeRecording=function(n){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),Se.resolve(null)):this.recordingRegistry.getActiveRecording().then((function(e){return e&&!this.stopRecordingInProgress?this.startRecording({activeSerializedRecording:e}):n?this.startRecording({shouldStopBatcher:!1}):(Ko.log("No resumable recording found."),null)}).bind(this))},zn.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},zn.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(zn.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),q.__mp_recorder=zn;var za="change",$i="click",L0="hashchange",Ur="mp_locationchange",U0="popstate",F0="scrollend",Dd="submit",rP=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],B0=["mp-include"],Ld=["mp-no-track"],j0=Ld.concat(["mp-sensitive"]),oP=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],Pt=Gi("autocapture");function Ud(n){for(var e={},t=V0(n).split(" "),i=0;i<t.length;i++){var r=t[i];r&&(e[r]=!0)}return e}function V0(n){switch(typeof n.className){case"string":return n.className;case"object":return n.className.baseVal||n.getAttribute("class")||"";default:return""}}function sP(n){if(n.previousElementSibling)return n.previousElementSibling;do n=n.previousSibling;while(n&&!W0(n));return n}function z0(n,e,t,i,r,o){var s={$classes:V0(n).split(" "),$tag_name:n.tagName.toLowerCase()},a=n.id;a&&(s.$id=a),jd(n,e,r,o)&&v.each(oP.concat(i),function(d){if(n.hasAttribute(d)&&!t[d]){var h=n.getAttribute(d);qa(h)&&(s["$attr-"+d]=h)}});for(var c=1,u=1,l=n;l=sP(l);)c++,l.tagName===n.tagName&&u++;return s.$nth_child=c,s.$nth_of_type=u,s}function aP(n,e){var t=e.allowElementCallback,i=e.allowSelectors||[],r=e.blockAttrs||[],o=e.blockElementCallback,s=e.blockSelectors||[],a=e.captureTextContent||!1,c=e.captureExtraAttrs||[],u=e.capturedForHeatMap||!1,l={};v.each(r,function(k){l[k]=!0});var d=null,h=typeof n.target>"u"?n.srcElement:n.target;if(G0(h)&&(h=h.parentNode),lP(h,n)&&Fd(h,n,t,i)&&!Bd(h,n,o,s)){for(var p=[h],m=h;m.parentNode&&!Cn(m,"body");)p.push(m.parentNode),m=m.parentNode;var f=[],g,y=!1;if(v.each(p,function(k){var C=jd(k,n,t,i);!l.href&&k.tagName.toLowerCase()==="a"&&(g=k.getAttribute("href"),g=C&&qa(g)&&g),Bd(k,n,o,s)&&(y=!0),f.push(z0(k,n,l,c,t,i))},this),!y){var b=_e.documentElement;if(d={$event_type:n.type,$host:q.location.host,$pathname:q.location.pathname,$elements:f,$el_attr__href:g,$viewportHeight:Math.max(b.clientHeight,q.innerHeight||0),$viewportWidth:Math.max(b.clientWidth,q.innerWidth||0),$pageHeight:_e.body.offsetHeight||0,$pageWidth:_e.body.offsetWidth||0},v.each(c,function(k){if(!l[k]&&h.hasAttribute(k)){var C=h.getAttribute(k);qa(C)&&(d["$el_attr__"+k]=C)}}),a&&(S=q0(h,n,t,i),S&&S.length&&(d.$el_text=S)),n.type===$i&&(v.each(rP,function(k){k in n&&(d["$"+k]=n[k])}),u&&(d.$captured_for_heatmap=!0),h=cP(n)),a){var S=q0(h,n,t,i);S&&S.length&&(d.$el_text=S)}if(h){if(!Fd(h,n,t,i)||Bd(h,n,o,s))return null;var w=z0(h,n,l,c,t,i);d.$target=w,d.$el_classes=w.$classes,v.extend(d,v.strip_empty_properties({$el_id:w.$id,$el_tag_name:w.$tag_name}))}}}return d}function q0(n,e,t,i){var r="";return jd(n,e,t,i)&&n.childNodes&&n.childNodes.length&&v.each(n.childNodes,function(o){G0(o)&&o.textContent&&(r+=v.trim(o.textContent).split(/(\s+)/).filter(qa).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),v.trim(r)}function cP(n){for(var e=n.target,t=n.composedPath(),i=0;i<t.length;i++){var r=t[i];if(Cn(r,"a")||Cn(r,"button")||Cn(r,"input")||Cn(r,"select")||r.getAttribute&&r.getAttribute("role")==="button"){e=r;break}if(r===e)break}return e}function Fd(n,e,t,i){if(t)try{if(!t(n,e))return!1}catch(s){return Pt.critical("Error while checking element in allowElementCallback",s),!1}if(!i.length)return!0;for(var r=0;r<i.length;r++){var o=i[r];try{if(n.matches(o))return!0}catch(s){Pt.critical("Error while checking selector: "+o,s)}}return!1}function Bd(n,e,t,i){var r;if(t)try{if(t(n,e))return!0}catch(a){return Pt.critical("Error while checking element in blockElementCallback",a),!0}if(i&&i.length)for(r=0;r<i.length;r++){var o=i[r];try{if(n.matches(o))return!0}catch(a){Pt.critical("Error while checking selector: "+o,a)}}var s=Ud(n);for(r=0;r<Ld.length;r++)if(s[Ld[r]])return!0;return!1}function W0(n){return n&&n.nodeType===1}function Cn(n,e){return n&&n.tagName&&n.tagName.toLowerCase()===e.toLowerCase()}function G0(n){return n&&n.nodeType===3}function uP(){try{var n=_e.createElement("div");return!!n.matches}catch{return!1}}function lP(n,e){if(!n||Cn(n,"html")||!W0(n))return!1;var t=n.tagName.toLowerCase();switch(t){case"form":return e.type===Dd;case"input":return["button","submit"].indexOf(n.getAttribute("type"))===-1?e.type===za:e.type===$i;case"select":case"textarea":return e.type===za;default:return e.type===$i}}function jd(n,e,t,i){var r;if(!Fd(n,e,t,i))return!1;for(var o=n;o.parentNode&&!Cn(o,"body");o=o.parentNode){var s=Ud(o);for(r=0;r<j0.length;r++)if(s[j0[r]])return!1}var a=Ud(n);for(r=0;r<B0.length;r++)if(a[B0[r]])return!0;if(Cn(n,"input")||Cn(n,"select")||Cn(n,"textarea")||n.getAttribute("contenteditable")==="true")return!1;var c=n.type||"";if(typeof c=="string")switch(c.toLowerCase()){case"hidden":return!1;case"password":return!1}var u=n.name||n.id||"";if(typeof u=="string"){var l=/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;if(l.test(u.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function qa(n){if(n===null||v.isUndefined(n))return!1;if(typeof n=="string"){n=v.trim(n);var e=/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/;if(e.test((n||"").replace(/[- ]/g,"")))return!1;var t=/(^\d{3}-?\d{2}-?\d{4}$)/;if(t.test(n))return!1}return!0}var dP=30,hP=1e3,pP=4;function $0(){this.clicks=[]}$0.prototype.isRageClick=function(n,e,t){t=t||{};var i=t.threshold_px||dP,r=t.timeout_ms||hP,o=t.click_count||pP,s=Date.now(),a=this.clicks[this.clicks.length-1];if(a&&s-a.timestamp<r&&Math.sqrt(Math.pow(n-a.x,2)+Math.pow(e-a.y,2))<i){if(this.clicks.push({x:n,y:e,timestamp:s}),this.clicks.length>=o)return this.clicks=[],!0}else this.clicks=[{x:n,y:e,timestamp:s}];return!1};var H0="autocapture",fP="track_pageview",K0="full-url",mP="url-with-path-and-query-string",gP="url-with-path",vP="allow_element_callback",Y0="allow_selectors",X0="allow_url_regexes",J0="block_attrs",Z0="block_element_callback",Q0="block_selectors",ey="block_url_regexes",ty="capture_extra_attrs",ny="capture_text_content",iy="scroll_capture_all",ry="scroll_depth_percent_checkpoints",Wa="click",Vd="input",oy="pageview",sy="rage_click",zd="scroll",qd="submit",ht={};ht[Y0]=[],ht[X0]=[],ht[J0]=[],ht[Z0]=null,ht[Q0]=[],ht[ey]=[],ht[ty]=[],ht[ny]=!1,ht[iy]=!1,ht[ry]=[25,50,75,100],ht[Wa]=!0,ht[Vd]=!0,ht[oy]=K0,ht[sy]=!0,ht[zd]=!0,ht[qd]=!0;var Ga={$mp_autocapture:!0},ay="$mp_click",yP="$mp_input_change",cy="$mp_rage_click",bP="$mp_scroll",_P="$mp_submit",Ot=function(n){this.mp=n};Ot.prototype.init=function(){if(!uP()){Pt.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageviewTracking(),this.initClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking(),this.initRageClickTracking()},Ot.prototype.getFullConfig=function(){var n=this.mp.get_config(H0);return n?v.isObject(n)?v.extend({},ht,n):ht:{}},Ot.prototype.getConfig=function(n){return this.getFullConfig()[n]},Ot.prototype.currentUrlBlocked=function(){var n,e=v.info.currentUrl(),t=this.getConfig(X0)||[];if(t.length){var i=!1;for(n=0;n<t.length;n++){var r=t[n];try{if(e.match(r)){i=!0;break}}catch(s){return Pt.critical("Error while checking block URL regex: "+r,s),!0}}if(!i)return!0}var o=this.getConfig(ey)||[];if(!o||!o.length)return!1;for(n=0;n<o.length;n++)try{if(e.match(o[n]))return!0}catch(s){return Pt.critical("Error while checking block URL regex: "+o[n],s),!0}return!1},Ot.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(H0)?this.getConfig(oy):this.mp.get_config(fP)},Ot.prototype.trackDomEvent=function(n,e){if(!this.currentUrlBlocked()){var t=this.mp.is_recording_heatmap_data()&&(e===ay&&!this.getConfig(Wa)||e===cy&&!this._getRageClickConfig()),i=aP(n,{allowElementCallback:this.getConfig(vP),allowSelectors:this.getConfig(Y0),blockAttrs:this.getConfig(J0),blockElementCallback:this.getConfig(Z0),blockSelectors:this.getConfig(Q0),captureExtraAttrs:this.getConfig(ty),captureTextContent:this.getConfig(ny),capturedForHeatMap:t});i&&(v.extend(i,Ga),this.mp.track(e,i))}},Ot.prototype._getRageClickConfig=function(){var n=this.getConfig(sy);return n?n===!0?{}:typeof n=="object"?n:{}:null},Ot.prototype.initClickTracking=function(){q.removeEventListener($i,this.listenerClick),!(!this.getConfig(Wa)&&!this.mp.get_config("record_heatmap_data"))&&(Pt.log("Initializing click tracking"),this.listenerClick=q.addEventListener($i,(function(n){!this.getConfig(Wa)&&!this.mp.is_recording_heatmap_data()||this.trackDomEvent(n,ay)}).bind(this)))},Ot.prototype.initInputTracking=function(){q.removeEventListener(za,this.listenerChange),this.getConfig(Vd)&&(Pt.log("Initializing input tracking"),this.listenerChange=q.addEventListener(za,(function(n){this.getConfig(Vd)&&this.trackDomEvent(n,yP)}).bind(this)))},Ot.prototype.initPageviewTracking=function(){if(q.removeEventListener(U0,this.listenerPopstate),q.removeEventListener(L0,this.listenerHashchange),q.removeEventListener(Ur,this.listenerLocationchange),!!this.pageviewTrackingConfig()){Pt.log("Initializing pageview tracking");var n="",e=!1;this.currentUrlBlocked()||(e=this.mp.track_pageview(Ga)),e&&(n=v.info.currentUrl()),this.listenerPopstate=q.addEventListener(U0,function(){q.dispatchEvent(new Event(Ur))}),this.listenerHashchange=q.addEventListener(L0,function(){q.dispatchEvent(new Event(Ur))});var t=q.history.pushState;typeof t=="function"&&(q.history.pushState=function(r,o,s){t.call(q.history,r,o,s),q.dispatchEvent(new Event(Ur))});var i=q.history.replaceState;typeof i=="function"&&(q.history.replaceState=function(r,o,s){i.call(q.history,r,o,s),q.dispatchEvent(new Event(Ur))}),this.listenerLocationchange=q.addEventListener(Ur,xd((function(){if(!this.currentUrlBlocked()){var r=v.info.currentUrl(),o=!1,s=r.split("#")[0].split("?")[0]!==n.split("#")[0].split("?")[0],a=this.pageviewTrackingConfig();if(a===K0?o=r!==n:a===mP?o=r.split("#")[0]!==n.split("#")[0]:a===gP&&(o=s),o){var c=this.mp.track_pageview(Ga);c&&(n=r),s&&(this.lastScrollCheckpoint=0,Pt.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)))}},Ot.prototype.initRageClickTracking=function(){q.removeEventListener($i,this.listenerRageClick);var n=this._getRageClickConfig();!n&&!this.mp.get_config("record_heatmap_data")||(Pt.log("Initializing rage click tracking"),this._rageClickTracker||(this._rageClickTracker=new $0),this.listenerRageClick=(function(e){var t=this._getRageClickConfig();!t&&!this.mp.is_recording_heatmap_data()||this.currentUrlBlocked()||this._rageClickTracker.isRageClick(e.pageX,e.pageY,t)&&this.trackDomEvent(e,cy)}).bind(this),q.addEventListener($i,this.listenerRageClick))},Ot.prototype.initScrollTracking=function(){q.removeEventListener(F0,this.listenerScroll),this.getConfig(zd)&&(Pt.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0,this.listenerScroll=q.addEventListener(F0,xd((function(){if(this.getConfig(zd)&&!this.currentUrlBlocked()){var n=this.getConfig(iy),e=(this.getConfig(ry)||[]).slice().sort(function(c,u){return c-u}),t=q.scrollY,i=v.extend({$scroll_top:t},Ga);try{var r=_e.body.scrollHeight,o=Math.round(t/(r-q.innerHeight)*100);if(i.$scroll_height=r,i.$scroll_percentage=o,o>this.lastScrollCheckpoint)for(var s=0;s<e.length;s++){var a=e[s];o>=a&&this.lastScrollCheckpoint<a&&(i.$scroll_checkpoint=a,this.lastScrollCheckpoint=a,n=!0)}}catch(c){Pt.critical("Error while calculating scroll percentage",c)}n&&this.mp.track(bP,i)}}).bind(this))))},Ot.prototype.initSubmitTracking=function(){q.removeEventListener(Dd,this.listenerSubmit),this.getConfig(qd)&&(Pt.log("Initializing submit tracking"),this.listenerSubmit=q.addEventListener(Dd,(function(n){this.getConfig(qd)&&this.trackDomEvent(n,_P)}).bind(this)))},S0(Ot);var kP=q.fetch,At=Gi("flags"),$a="flags",Ha="context",Wd={};Wd[Ha]={};var ae=function(n){this.getFullApiRoute=n.getFullApiRoute,this.getMpConfig=n.getConfigFunc,this.setMpConfig=n.setConfigFunc,this.getMpProperty=n.getPropertyFunc,this.track=n.trackingFunc};ae.prototype.init=function(){if(!SP()){At.critical("Feature Flags unavailable: missing minimum required APIs");return}this.flags=null,this.fetchFlags(),this.trackedFeatures=new Set},ae.prototype.getFullConfig=function(){var n=this.getMpConfig($a);return n?v.isObject(n)?v.extend({},Wd,n):Wd:{}},ae.prototype.getConfig=function(n){return this.getFullConfig()[n]},ae.prototype.isSystemEnabled=function(){return!!this.getMpConfig($a)},ae.prototype.updateContext=function(n,e){if(!this.isSystemEnabled())return At.critical("Feature Flags not enabled, cannot update context"),Promise.resolve();var t=this.getMpConfig($a);v.isObject(t)||(t={});var i=e&&e.replace?{}:this.getConfig(Ha);return t[Ha]=v.extend({},i,n),this.setMpConfig($a,t),this.fetchFlags()},ae.prototype.areFlagsReady=function(){return this.isSystemEnabled()||At.error("Feature Flags not enabled"),!!this.flags},ae.prototype.fetchFlags=function(){if(!this.isSystemEnabled())return Promise.resolve();var n=this.getMpProperty("distinct_id"),e=this.getMpProperty("$device_id");At.log("Fetching flags for distinct ID: "+n);var t={context:v.extend({distinct_id:n,device_id:e},this.getConfig(Ha))};return this._fetchInProgressStartTime=Date.now(),this.fetchPromise=q.fetch(this.getFullApiRoute(),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getMpConfig("token")+":"),"Content-Type":"application/octet-stream"},body:JSON.stringify(t)}).then((function(i){return this.markFetchComplete(),i.json().then((function(r){var o=r.flags;if(!o)throw new Error("No flags in API response");var s=new Map;v.each(o,function(a,c){s.set(c,{key:a.variant_key,value:a.variant_value})}),this.flags=s}).bind(this)).catch((function(r){this.markFetchComplete(),At.error(r)}).bind(this))}).bind(this)).catch((function(i){this.markFetchComplete(),At.error(i)}).bind(this)),this.fetchPromise},ae.prototype.markFetchComplete=function(){if(!this._fetchInProgressStartTime){At.error("Fetch in progress started time not set, cannot mark fetch complete");return}this._fetchStartTime=this._fetchInProgressStartTime,this._fetchCompleteTime=Date.now(),this._fetchLatency=this._fetchCompleteTime-this._fetchStartTime,this._fetchInProgressStartTime=null},ae.prototype.getVariant=function(n,e){return this.fetchPromise?this.fetchPromise.then((function(){return this.getVariantSync(n,e)}).bind(this)).catch(function(t){return At.error(t),e}):new Promise(function(t){At.critical("Feature Flags not initialized"),t(e)})},ae.prototype.getVariantSync=function(n,e){if(!this.areFlagsReady())return At.log("Flags not loaded yet"),e;var t=this.flags.get(n);return t?(this.trackFeatureCheck(n,t),t):(At.log('No flag found: "'+n+'"'),e)},ae.prototype.getVariantValue=function(n,e){return this.getVariant(n,{value:e}).then(function(t){return t.value}).catch(function(t){return At.error(t),e})},ae.prototype.getFeatureData=function(n,e){return At.critical("mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead."),this.getVariantValue(n,e)},ae.prototype.getVariantValueSync=function(n,e){return this.getVariantSync(n,{value:e}).value},ae.prototype.isEnabled=function(n,e){return this.getVariantValue(n).then((function(){return this.isEnabledSync(n,e)}).bind(this)).catch(function(t){return At.error(t),e})},ae.prototype.isEnabledSync=function(n,e){e=e||!1;var t=this.getVariantValueSync(n,e);return t!==!0&&t!==!1&&(At.error('Feature flag "'+n+'" value: '+t+" is not a boolean; returning fallback value: "+e),t=e),t},ae.prototype.trackFeatureCheck=function(n,e){this.trackedFeatures.has(n)||(this.trackedFeatures.add(n),this.track("$experiment_started",{"Experiment name":n,"Variant name":e.key,$experiment_type:"feature_flag","Variant fetch start time":new Date(this._fetchStartTime).toISOString(),"Variant fetch complete time":new Date(this._fetchCompleteTime).toISOString(),"Variant fetch latency (ms)":this._fetchLatency}))};function SP(){return!!kP&&typeof Promise<"u"&&typeof Map<"u"&&typeof Set<"u"}S0(ae),ae.prototype.are_flags_ready=ae.prototype.areFlagsReady,ae.prototype.get_variant=ae.prototype.getVariant,ae.prototype.get_variant_sync=ae.prototype.getVariantSync,ae.prototype.get_variant_value=ae.prototype.getVariantValue,ae.prototype.get_variant_value_sync=ae.prototype.getVariantValueSync,ae.prototype.is_enabled=ae.prototype.isEnabled,ae.prototype.is_enabled_sync=ae.prototype.isEnabledSync,ae.prototype.update_context=ae.prototype.updateContext,ae.prototype.get_feature_data=ae.prototype.getFeatureData;var qn=function(){};qn.prototype.create_properties=function(){},qn.prototype.event_handler=function(){},qn.prototype.after_track_handler=function(){},qn.prototype.init=function(n){return this.mp=n,this},qn.prototype.track=function(n,e,t,i){var r=this,o=v.dom_query(n);if(o.length===0){ke.error("The DOM query ("+n+") returned 0 elements");return}return v.each(o,function(s){v.register_event(s,this.override_event,function(a){var c={},u=r.create_properties(t,this),l=r.mp.get_config("track_links_timeout");r.event_handler(a,this,c),window.setTimeout(r.track_callback(i,u,c,!0),l),r.mp.track(e,u,r.track_callback(i,u,c))})},this),!0},qn.prototype.track_callback=function(n,e,t,i){i=i||!1;var r=this;return function(){t.callback_fired||(t.callback_fired=!0,!(n&&n(i,e)===!1)&&r.after_track_handler(e,t,i))}},qn.prototype.create_properties=function(n,e){var t;return typeof n=="function"?t=n(e):t=v.extend({},n),t};var Fr=function(){this.override_event="click"};v.inherit(Fr,qn),Fr.prototype.create_properties=function(n,e){var t=Fr.superclass.create_properties.apply(this,arguments);return e.href&&(t.url=e.href),t},Fr.prototype.event_handler=function(n,e,t){t.new_tab=n.which===2||n.metaKey||n.ctrlKey||e.target==="_blank",t.href=e.href,t.new_tab||n.preventDefault()},Fr.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Ka=function(){this.override_event="submit"};v.inherit(Ka,qn),Ka.prototype.event_handler=function(n,e,t){t.element=e,n.preventDefault()},Ka.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var pi="$set",Br="$set_once",sn="$unset",Hi="$add",Tn="$append",Ki="$union",Wn="$remove",wP="$delete",uy={set_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(r,o){this._is_reserved_property(o)||(i[o]=r)},this):i[n]=e,t[pi]=i,t},unset_action:function(n){var e={},t=[];return v.isArray(n)||(n=[n]),v.each(n,function(i){this._is_reserved_property(i)||t.push(i)},this),e[sn]=t,e},set_once_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(r,o){this._is_reserved_property(o)||(i[o]=r)},this):i[n]=e,t[Br]=i,t},union_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(r,o){this._is_reserved_property(o)||(i[o]=v.isArray(r)?r:[r])},this):i[n]=v.isArray(e)?e:[e],t[Ki]=i,t},append_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(r,o){this._is_reserved_property(o)||(i[o]=r)},this):i[n]=e,t[Tn]=i,t},remove_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(r,o){this._is_reserved_property(o)||(i[o]=r)},this):i[n]=e,t[Wn]=i,t},delete_action:function(){var n={};return n[wP]="",n}},Fe=function(){};v.extend(Fe.prototype,uy),Fe.prototype._init=function(n,e,t){this._mixpanel=n,this._group_key=e,this._group_id=t},Fe.prototype.set=Nr(function(n,e,t){var i=this.set_action(n,e);return v.isObject(n)&&(t=e),this._send_request(i,t)}),Fe.prototype.set_once=Nr(function(n,e,t){var i=this.set_once_action(n,e);return v.isObject(n)&&(t=e),this._send_request(i,t)}),Fe.prototype.unset=Nr(function(n,e){var t=this.unset_action(n);return this._send_request(t,e)}),Fe.prototype.union=Nr(function(n,e,t){v.isObject(n)&&(t=e);var i=this.union_action(n,e);return this._send_request(i,t)}),Fe.prototype.delete=Nr(function(n){var e=this.delete_action();return this._send_request(e,n)}),Fe.prototype.remove=Nr(function(n,e,t){var i=this.remove_action(n,e);return this._send_request(i,t)}),Fe.prototype._send_request=function(n,e){n.$group_key=this._group_key,n.$group_id=this._group_id,n.$token=this._get_config("token");var t=v.encodeDates(n);return this._mixpanel._track_or_batch({type:"groups",data:t,endpoint:this._mixpanel.get_api_host("groups")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)},Fe.prototype._is_reserved_property=function(n){return n==="$group_key"||n==="$group_id"},Fe.prototype._get_config=function(n){return this._mixpanel.get_config(n)},Fe.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},Fe.prototype.remove=Fe.prototype.remove,Fe.prototype.set=Fe.prototype.set,Fe.prototype.set_once=Fe.prototype.set_once,Fe.prototype.union=Fe.prototype.union,Fe.prototype.unset=Fe.prototype.unset,Fe.prototype.toString=Fe.prototype.toString;var ee=function(){};v.extend(ee.prototype,uy),ee.prototype._init=function(n){this._mixpanel=n},ee.prototype.set=hi(function(n,e,t){var i=this.set_action(n,e);return v.isObject(n)&&(t=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[pi]=v.extend({},v.info.people_properties(),i[pi]),this._send_request(i,t)}),ee.prototype.set_once=hi(function(n,e,t){var i=this.set_once_action(n,e);return v.isObject(n)&&(t=e),this._send_request(i,t)}),ee.prototype.unset=hi(function(n,e){var t=this.unset_action(n);return this._send_request(t,e)}),ee.prototype.increment=hi(function(n,e,t){var i={},r={};return v.isObject(n)?(v.each(n,function(o,s){if(!this._is_reserved_property(s))if(isNaN(parseFloat(o))){ke.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else r[s]=o},this),t=e):(v.isUndefined(e)&&(e=1),r[n]=e),i[Hi]=r,this._send_request(i,t)}),ee.prototype.append=hi(function(n,e,t){v.isObject(n)&&(t=e);var i=this.append_action(n,e);return this._send_request(i,t)}),ee.prototype.remove=hi(function(n,e,t){v.isObject(n)&&(t=e);var i=this.remove_action(n,e);return this._send_request(i,t)}),ee.prototype.union=hi(function(n,e,t){v.isObject(n)&&(t=e);var i=this.union_action(n,e);return this._send_request(i,t)}),ee.prototype.track_charge=hi(function(){ke.error("mixpanel.people.track_charge() is deprecated and no longer has any effect.")}),ee.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},ee.prototype.delete_user=function(){if(!this._identify_called()){ke.error("mixpanel.people.delete_user() requires you to call identify() first");return}var n={$delete:this._mixpanel.get_distinct_id()};return this._send_request(n)},ee.prototype.toString=function(){return this._mixpanel.toString()+".people"},ee.prototype._send_request=function(n,e){n.$token=this._get_config("token"),n.$distinct_id=this._mixpanel.get_distinct_id();var t=this._mixpanel.get_property("$device_id"),i=this._mixpanel.get_property("$user_id"),r=this._mixpanel.get_property("$had_persisted_distinct_id");t&&(n.$device_id=t),i&&(n.$user_id=i),r&&(n.$had_persisted_distinct_id=r);var o=v.encodeDates(n);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:o,endpoint:this._mixpanel.get_api_host("people")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(n),v.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),v.truncate(o,255))},ee.prototype._get_config=function(n){return this._mixpanel.get_config(n)},ee.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},ee.prototype._enqueue=function(n){pi in n?this._mixpanel.persistence._add_to_people_queue(pi,n):Br in n?this._mixpanel.persistence._add_to_people_queue(Br,n):sn in n?this._mixpanel.persistence._add_to_people_queue(sn,n):Hi in n?this._mixpanel.persistence._add_to_people_queue(Hi,n):Tn in n?this._mixpanel.persistence._add_to_people_queue(Tn,n):Wn in n?this._mixpanel.persistence._add_to_people_queue(Wn,n):Ki in n?this._mixpanel.persistence._add_to_people_queue(Ki,n):ke.error("Invalid call to _enqueue():",n)},ee.prototype._flush_one_queue=function(n,e,t,i){var r=this,o=v.extend({},this._mixpanel.persistence.load_queue(n)),s=o;!v.isUndefined(o)&&v.isObject(o)&&!v.isEmptyObject(o)&&(r._mixpanel.persistence._pop_from_people_queue(n,o),r._mixpanel.persistence.save(),i&&(s=i(o)),e.call(r,s,function(a,c){a===0&&r._mixpanel.persistence._add_to_people_queue(n,o),v.isUndefined(t)||t(a,c)}))},ee.prototype._flush=function(n,e,t,i,r,o,s){var a=this;this._flush_one_queue(pi,this.set,n),this._flush_one_queue(Br,this.set_once,i),this._flush_one_queue(sn,this.unset,o,function(g){return v.keys(g)}),this._flush_one_queue(Hi,this.increment,e),this._flush_one_queue(Ki,this.union,r);var c=this._mixpanel.persistence.load_queue(Tn);if(!v.isUndefined(c)&&v.isArray(c)&&c.length)for(var u,l=function(g,y){g===0&&a._mixpanel.persistence._add_to_people_queue(Tn,u),v.isUndefined(t)||t(g,y)},d=c.length-1;d>=0;d--)c=this._mixpanel.persistence.load_queue(Tn),u=c.pop(),a._mixpanel.persistence.save(),v.isEmptyObject(u)||a.append(u,l);var h=this._mixpanel.persistence.load_queue(Wn);if(!v.isUndefined(h)&&v.isArray(h)&&h.length)for(var p,m=function(g,y){g===0&&a._mixpanel.persistence._add_to_people_queue(Wn,p),v.isUndefined(s)||s(g,y)},f=h.length-1;f>=0;f--)h=this._mixpanel.persistence.load_queue(Wn),p=h.pop(),a._mixpanel.persistence.save(),v.isEmptyObject(p)||a.remove(p,m)},ee.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},ee.prototype.set=ee.prototype.set,ee.prototype.set_once=ee.prototype.set_once,ee.prototype.unset=ee.prototype.unset,ee.prototype.increment=ee.prototype.increment,ee.prototype.append=ee.prototype.append,ee.prototype.remove=ee.prototype.remove,ee.prototype.union=ee.prototype.union,ee.prototype.track_charge=ee.prototype.track_charge,ee.prototype.clear_charges=ee.prototype.clear_charges,ee.prototype.delete_user=ee.prototype.delete_user,ee.prototype.toString=ee.prototype.toString;var Gd="__mps",$d="__mpso",Hd="__mpus",Kd="__mpa",Yd="__mpap",Xd="__mpr",Jd="__mpu",ly="$people_distinct_id",Ya="__alias",Yo="__timers",CP=[Gd,$d,Hd,Kd,Yd,Xd,Jd,ly,Ya,Yo],re=function(n){this.props={},this.campaign_params_saved=!1,n.persistence_name?this.name="mp_"+n.persistence_name:this.name="mp_"+n.token+"_mixpanel";var e=n.persistence;e!=="cookie"&&e!=="localStorage"&&(ke.critical("Unknown persistence type "+e+"; falling back to cookie"),e=n.persistence="cookie"),e==="localStorage"&&v.localStorage.is_supported()?this.storage=v.localStorage:this.storage=v.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};re.prototype.properties=function(){var n={};return this.load(),v.each(this.props,function(e,t){v.include(CP,t)||(n[t]=e)}),n},re.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=v.extend({},n))}},re.prototype.upgrade=function(){var n,e;this.storage===v.localStorage?(n=v.cookie.parse(this.name),v.cookie.remove(this.name),v.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===v.cookie&&(e=v.localStorage.parse(this.name),v.localStorage.remove(this.name),e&&this.register_once(e))},re.prototype.save=function(){this.disabled||this.storage.set(this.name,Mr(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},re.prototype.load_prop=function(n){return this.load(),this.props[n]},re.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},re.prototype.clear=function(){this.remove(),this.props={}},re.prototype.register_once=function(n,e,t){return v.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),v.each(n,function(i,r){(!this.props.hasOwnProperty(r)||this.props[r]===e)&&(this.props[r]=i)},this),this.save(),!0):!1},re.prototype.register=function(n,e){return v.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),v.extend(this.props,n),this.save(),!0):!1},re.prototype.unregister=function(n){this.load(),n in this.props&&(delete this.props[n],this.save())},re.prototype.update_search_keyword=function(n){this.register(v.info.searchInfo(n))},re.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:v.info.referringDomain(n)||"$direct"},"")},re.prototype.get_referrer_info=function(){return v.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},re.prototype.update_config=function(n){this.default_expiry=this.expire_days=n.cookie_expiration,this.set_disabled(n.disable_persistence),this.set_cookie_domain(n.cookie_domain),this.set_cross_site(n.cross_site_cookie),this.set_cross_subdomain(n.cross_subdomain_cookie),this.set_secure(n.secure_cookie)},re.prototype.set_disabled=function(n){this.disabled=n,this.disabled?this.remove():this.save()},re.prototype.set_cookie_domain=function(n){n!==this.cookie_domain&&(this.remove(),this.cookie_domain=n,this.save())},re.prototype.set_cross_site=function(n){n!==this.cross_site&&(this.cross_site=n,this.remove(),this.save())},re.prototype.set_cross_subdomain=function(n){n!==this.cross_subdomain&&(this.cross_subdomain=n,this.remove(),this.save())},re.prototype.get_cross_subdomain=function(){return this.cross_subdomain},re.prototype.set_secure=function(n){n!==this.secure&&(this.secure=!!n,this.remove(),this.save())},re.prototype._add_to_people_queue=function(n,e){var t=this._get_queue_key(n),i=e[n],r=this._get_or_create_queue(pi),o=this._get_or_create_queue(Br),s=this._get_or_create_queue(sn),a=this._get_or_create_queue(Hi),c=this._get_or_create_queue(Ki),u=this._get_or_create_queue(Wn,[]),l=this._get_or_create_queue(Tn,[]);t===Gd?(v.extend(r,i),this._pop_from_people_queue(Hi,i),this._pop_from_people_queue(Ki,i),this._pop_from_people_queue(sn,i)):t===$d?(v.each(i,function(d,h){h in o||(o[h]=d)}),this._pop_from_people_queue(sn,i)):t===Hd?v.each(i,function(d){v.each([r,o,a,c],function(h){d in h&&delete h[d]}),v.each(l,function(h){d in h&&delete h[d]}),s[d]=!0}):t===Kd?(v.each(i,function(d,h){h in r?r[h]+=d:(h in a||(a[h]=0),a[h]+=d)},this),this._pop_from_people_queue(sn,i)):t===Jd?(v.each(i,function(d,h){v.isArray(d)&&(h in c||(c[h]=[]),v.each(d,function(p){v.include(c[h],p)||c[h].push(p)}))}),this._pop_from_people_queue(sn,i)):t===Xd?(u.push(i),this._pop_from_people_queue(Tn,i)):t===Yd&&(l.push(i),this._pop_from_people_queue(sn,i)),ke.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),ke.log(e),this.save()},re.prototype._pop_from_people_queue=function(n,e){var t=this.props[this._get_queue_key(n)];v.isUndefined(t)||v.each(e,function(i,r){n===Tn||n===Wn?v.each(t,function(o){o[r]===i&&delete o[r]}):delete t[r]},this)},re.prototype.load_queue=function(n){return this.load_prop(this._get_queue_key(n))},re.prototype._get_queue_key=function(n){if(n===pi)return Gd;if(n===Br)return $d;if(n===sn)return Hd;if(n===Hi)return Kd;if(n===Tn)return Yd;if(n===Wn)return Xd;if(n===Ki)return Jd;ke.error("Invalid queue:",n)},re.prototype._get_or_create_queue=function(n,e){var t=this._get_queue_key(n);return e=v.isUndefined(e)?{}:e,this.props[t]||(this.props[t]=e)},re.prototype.set_event_timer=function(n,e){var t=this.load_prop(Yo)||{};t[n]=e,this.props[Yo]=t,this.save()},re.prototype.remove_event_timer=function(n){var e=this.load_prop(Yo)||{},t=e[n];return v.isUndefined(t)||(delete this.props[Yo][n],this.save()),t};var Zd,dy=function(n,e){throw new Error(n+" not available in this build.")},Tt,hy=0,TP=1,xP=function(n){return n},Yt="mixpanel",py="base64",EP="json",Qd="$device:",jr=q.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,fy=!jr&&Vn.indexOf("MSIE")===-1&&Vn.indexOf("Mozilla")===-1,Xa=null;ui.sendBeacon&&(Xa=function(){return ui.sendBeacon.apply(ui,arguments)});var my={track:"track/",engage:"engage/",groups:"groups/",record:"record/",flags:"flags/"},gy={api_host:"https://api-js.mixpanel.com",api_hosts:{},api_routes:my,api_extra_query_params:{},api_method:"POST",api_transport:"XHR",api_payload_format:py,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:li,flags:!1,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:li,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video, audio",record_canvas:!1,record_collect_fonts:!1,record_heatmap_data:!1,record_idle_timeout_ms:30*60*1e3,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:qo,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},vy=!1,E=function(){},eh=function(n,e,t){var i,r=t===Yt?Tt:Tt[t];if(r&&Zd===hy)i=r;else{if(r&&!v.isArray(r)){ke.error("You have already initialized "+t);return}i=new E}if(i._cached_groups={},i._init(n,e,t),i.people=new ee,i.people._init(i),!i.get_config("skip_first_touch_marketing")){var o=v.info.campaignParams(null),s={},a=!1;v.each(o,function(c,u){s["initial_"+u]=c,c&&(a=!0)}),a&&i.people.set_once(s)}return on.DEBUG=on.DEBUG||i.get_config("debug"),!v.isUndefined(r)&&v.isArray(r)&&(i._execute_array.call(i.people,r.people),i._execute_array(r)),i};E.prototype.init=function(n,e,t){if(v.isUndefined(t)){this.report_error("You must name your new library: init(token, config, name)");return}if(t===Yt){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var i=eh(n,e,t);return Tt[t]=i,i._loaded(),i},E.prototype._init=function(n,e,t){e=e||{},this.__loaded=!0,this.config={};var i={};if(!("api_payload_format"in e)){var r=e.api_host||gy.api_host;r.match(/\.mixpanel\.com/)&&(i.api_payload_format=EP)}if(this.set_config(v.extend({},gy,i,e,{name:t,token:n,callback_fn:(t===Yt?t:Yt+"."+t)+"._jsc"})),this._jsc=li,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!v.localStorage.is_supported(!0)||!jr)this._batch_requests=!1,ke.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),v.each(this.get_batcher_configs(),function(a){ke.log("Clearing batch queue "+a.queue_key),v.localStorage.remove(a.queue_key)});else if(this.init_batchers(),Xa&&q.addEventListener){var o=v.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);q.addEventListener("pagehide",function(a){a.persisted&&o()}),q.addEventListener("visibilitychange",function(){_e.visibilityState==="hidden"&&o()})}}this.persistence=this.cookie=new re(this.config),this.unpersisted_superprops={},this._gdpr_init();var s=v.UUID();this.get_distinct_id()||this.register_once({distinct_id:Qd+s,$device_id:s},""),this.flags=new ae({getFullApiRoute:v.bind(function(){return this.get_api_host("flags")+"/"+this.get_config("api_routes").flags},this),getConfigFunc:v.bind(this.get_config,this),setConfigFunc:v.bind(this.set_config,this),getPropertyFunc:v.bind(this.get_property,this),trackingFunc:v.bind(this.track,this)}),this.flags.init(),this.flags=this.flags,this.autocapture=new Ot(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},E.prototype._init_tab_id=function(){if(v.sessionStorage.is_supported())try{var n=this.get_config("name")+"_"+this.get_config("token"),e="mp_tab_id_"+n,t="mp_gen_new_tab_id_"+n;(v.sessionStorage.get(t)||!v.sessionStorage.get(e))&&v.sessionStorage.set(e,"$tab-"+v.UUID()),v.sessionStorage.set(t,"1"),this.tab_id=v.sessionStorage.get(e),q.addEventListener("beforeunload",function(){v.sessionStorage.remove(t)})}catch(i){this.report_error("Error initializing tab id",i)}else this.report_error("Session storage is not supported, cannot keep track of unique tab ID.")},E.prototype.get_tab_id=function(){return this.tab_id||null},E.prototype._should_load_recorder=function(){var n=new Sn(Pd),e=this.get_tab_id();return n.init().then(function(){return n.getAll()}).then(function(t){for(var i=0;i<t.length;i++)if(Nd(t[i])||t[i].tabId===e)return!0;return!1}).catch(v.bind(function(t){this.report_error("Error checking recording registry",t)},this))},E.prototype._check_and_start_session_recording=di(function(n){if(!q.MutationObserver){ke.critical("Browser does not support MutationObserver; skipping session recording");return}var e=v.bind(function(i){var r=v.bind(function(){this._recorder=this._recorder||new q.__mp_recorder(this),this._recorder.resumeRecording(i)},this);v.isUndefined(q.__mp_recorder)?dy(this.get_config("recorder_src"),r):r()},this),t=this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent");n||t?e(!0):this._should_load_recorder().then(function(i){i&&e(!1)})}),E.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},E.prototype.stop_session_recording=function(){return this._recorder?this._recorder.stopRecording():Promise.resolve()},E.prototype.pause_session_recording=function(){return this._recorder?this._recorder.pauseRecording():Promise.resolve()},E.prototype.resume_session_recording=function(){return this._recorder?this._recorder.resumeRecording():Promise.resolve()},E.prototype.is_recording_heatmap_data=function(){return this._get_session_replay_id()&&this.get_config("record_heatmap_data")},E.prototype.get_session_recording_properties=function(){var n={},e=this._get_session_replay_id();return e&&(n.$mp_replay_id=e),n},E.prototype.get_session_replay_url=function(){var n=null,e=this._get_session_replay_id();if(e){var t=v.HTTPBuildQuery({replay_id:e,distinct_id:this.get_distinct_id(),token:this.get_config("token")});n="https://mixpanel.com/projects/replay-redirect?"+t}return n},E.prototype._get_session_replay_id=function(){var n=null;return this._recorder&&(n=this._recorder.replayId),n||null},E.prototype.__get_recorder=function(){return this._recorder},E.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var n=v.info.campaignParams(null);v.each(n,(function(e,t){this.unregister(t)}).bind(this))}},E.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(_e.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(v.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(_e.referrer)},E.prototype._dom_loaded=function(){v.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||v.each(this.__request_queue,function(n){this._send_request.apply(this,n)},this),delete this.__dom_loaded_queue,delete this.__request_queue},E.prototype._track_dom=function(n,e){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!vy)return this.__dom_loaded_queue.push([n,e]),!1;var t=new n().init(this);return t.track.apply(t,e)},E.prototype._prepare_callback=function(n,e){if(v.isUndefined(n))return null;if(jr){var t=function(s){n(s,e)};return t}else{var i=this._jsc,r=""+Math.floor(Math.random()*1e8),o=this.get_config("callback_fn")+"["+r+"]";return i[r]=function(s){delete i[r],n(s,e)},o}},E.prototype._send_request=function(n,e,t,i){var r=!0;if(fy)return this.__request_queue.push(arguments),r;var o={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},s=null;!i&&(v.isFunction(t)||typeof t=="string")&&(i=t,t=null),t=v.extend(o,t||{}),jr||(t.method="GET");var a=t.method==="POST",c=Xa&&a&&t.transport.toLowerCase()==="sendbeacon",u=t.verbose;e.verbose&&(u=!0),this.get_config("test")&&(e.test=1),u&&(e.verbose=1),this.get_config("img")&&(e.img=1),jr||(i?e.callback=i:(u||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),a&&(s="data="+encodeURIComponent(e.data),delete e.data),v.extend(e,this.get_config("api_extra_query_params")),n+="?"+v.HTTPBuildQuery(e);var l=this;if("img"in e){var d=_e.createElement("img");d.src=n,_e.body.appendChild(d)}else if(c){try{r=Xa(n,s)}catch(y){l.report_error(y),r=!1}try{i&&i(r?1:0)}catch(y){l.report_error(y)}}else if(jr)try{var h=new XMLHttpRequest;h.open(t.method,n,!0);var p=this.get_config("xhr_headers");if(a&&(p["Content-Type"]="application/x-www-form-urlencoded"),v.each(p,function(y,b){h.setRequestHeader(b,y)}),t.timeout_ms&&typeof h.timeout<"u"){h.timeout=t.timeout_ms;var m=new Date().getTime()}h.withCredentials=!0,h.onreadystatechange=function(){if(h.readyState===4)if(h.status===200){if(i)if(u){var y;try{y=v.JSONDecode(h.responseText)}catch(w){if(l.report_error(w),t.ignore_json_errors)y=h.responseText;else return}i(y)}else i(Number(h.responseText))}else{var b;if(h.timeout&&!h.status&&new Date().getTime()-m>=h.timeout?b="timeout":b="Bad HTTP status: "+h.status+" "+h.statusText,l.report_error(b),i)if(u){var S=h.responseHeaders||{};i({status:0,httpStatusCode:h.status,error:b,retryAfter:S["Retry-After"]})}else i(0)}},h.send(s)}catch(y){l.report_error(y),r=!1}else{var f=_e.createElement("script");f.type="text/javascript",f.async=!0,f.defer=!0,f.src=n;var g=_e.getElementsByTagName("script")[0];g.parentNode.insertBefore(f,g)}return r},E.prototype._execute_array=function(n){var e,t=[],i=[],r=[];v.each(n,function(s){s&&(e=s[0],v.isArray(e)?r.push(s):typeof s=="function"?s.call(this):v.isArray(s)&&e==="alias"?t.push(s):v.isArray(s)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?r.push(s):i.push(s))},this);var o=function(s,a){v.each(s,function(c){if(v.isArray(c[0])){var u=a;v.each(c,function(l){u=u[l[0]].apply(u,l.slice(1))})}else this[c[0]].apply(this,c.slice(1))},a)};o(t,this),o(i,this),o(r,this)},E.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},E.prototype.get_batcher_configs=function(){var n="__mpq_"+this.get_config("token");return this._batcher_configs=this._batcher_configs||{events:{type:"events",api_name:"track",queue_key:n+"_ev"},people:{type:"people",api_name:"engage",queue_key:n+"_pp"},groups:{type:"groups",api_name:"groups",queue_key:n+"_gr"}},this._batcher_configs},E.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var n=v.bind(function(t){return new Kt(t.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:v.bind(function(i,r,o){var s=this.get_config("api_routes");this._send_request(this.get_api_host(t.api_name)+"/"+s[t.api_name],this._encode_data_for_request(i),r,this._prepare_callback(o,i))},this),beforeSendHook:v.bind(function(i){return this._run_hook("before_send_"+t.type,i)},this),stopAllBatchingFunc:v.bind(this.stop_batch_senders,this),usePersistence:!0})},this),e=this.get_batcher_configs();this.request_batchers={events:n(e.events),people:n(e.people),groups:n(e.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},E.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,v.each(this.request_batchers,function(n){n.start()}))},E.prototype.stop_batch_senders=function(){this._batch_requests=!1,v.each(this.request_batchers,function(n){n.stop(),n.clear()})},E.prototype.push=function(n){this._execute_array([n])},E.prototype.disable=function(n){typeof n>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(n)},E.prototype._encode_data_for_request=function(n){var e=Mr(n);return this.get_config("api_payload_format")===py&&(e=v.base64Encode(e)),{data:e}},E.prototype._track_or_batch=function(n,e){var t=v.truncate(n.data,255),i=n.endpoint,r=n.batcher,o=n.should_send_immediately,s=n.send_request_options||{};e=e||li;var a=!0,c=v.bind(function(){return s.skip_hooks||(t=this._run_hook("before_send_"+n.type,t)),t?(ke.log("MIXPANEL REQUEST:"),ke.log(t),this._send_request(i,this._encode_data_for_request(t),s,this._prepare_callback(e,t))):null},this);return this._batch_requests&&!o?r.enqueue(t).then(function(u){u?e(1,t):c()}):a=c(),a&&t},E.prototype.track=di(function(n,e,t,i){!i&&typeof t=="function"&&(i=t,t=null),t=t||{};var r=t.transport;r&&(t.transport=r);var o=t.send_immediately;if(typeof i!="function"&&(i=li),v.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){i(0);return}e=v.extend({},e),e.token=this.get_config("token");var s=this.persistence.remove_event_timer(n);if(!v.isUndefined(s)){var a=new Date().getTime()-s;e.$duration=parseFloat((a/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?v.info.marketingParams():{};e=v.extend({},v.info.properties({mp_loader:this.get_config("mp_loader")}),c,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var u=this.get_config("property_blacklist");v.isArray(u)?v.each(u,function(h){delete e[h]}):this.report_error("Invalid value for property_blacklist config: "+u);var l={event:n,properties:e},d=this._track_or_batch({type:"events",data:l,endpoint:this.get_api_host("events")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:o,send_request_options:t},i);return d}),E.prototype.set_group=di(function(n,e,t){v.isArray(e)||(e=[e]);var i={};return i[n]=e,this.register(i),this.people.set(n,e,t)}),E.prototype.add_group=di(function(n,e,t){var i=this.get_property(n),r={};return i===void 0?(r[n]=[e],this.register(r)):i.indexOf(e)===-1&&(i.push(e),r[n]=i,this.register(r)),this.people.union(n,e,t)}),E.prototype.remove_group=di(function(n,e,t){var i=this.get_property(n);if(i!==void 0){var r=i.indexOf(e);r>-1&&(i.splice(r,1),this.register({group_key:i})),i.length===0&&this.unregister(n)}return this.people.remove(n,e,t)}),E.prototype.track_with_groups=di(function(n,e,t,i){var r=v.extend({},e||{});return v.each(t,function(o,s){o!=null&&(r[s]=o)}),this.track(n,r,i)}),E.prototype._create_map_key=function(n,e){return n+"_"+JSON.stringify(e)},E.prototype._remove_group_from_cache=function(n,e){delete this._cached_groups[this._create_map_key(n,e)]},E.prototype.get_group=function(n,e){var t=this._create_map_key(n,e),i=this._cached_groups[t];return(i===void 0||i._group_key!==n||i._group_id!==e)&&(i=new Fe,i._init(this,n,e),this._cached_groups[t]=i),i},E.prototype.track_pageview=di(function(n,e){typeof n!="object"&&(n={}),e=e||{};var t=e.event_name||"$mp_web_page_view",i=v.extend(v.info.mpPageViewProperties(),v.info.campaignParams(),v.info.clickParams()),r=v.extend({},i,n);return this.track(t,r)}),E.prototype.track_links=function(){return this._track_dom.call(this,Fr,arguments)},E.prototype.track_forms=function(){return this._track_dom.call(this,Ka,arguments)},E.prototype.time_event=function(n){if(v.isUndefined(n)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(n)||this.persistence.set_event_timer(n,new Date().getTime())};var IP={persistent:!0},th=function(n){var e;return v.isObject(n)?e=n:v.isUndefined(n)?e={}:e={days:n},v.extend({},IP,e)};E.prototype.register=function(n,e){var t=th(e);t.persistent?this.persistence.register(n,t.days):v.extend(this.unpersisted_superprops,n)},E.prototype.register_once=function(n,e,t){var i=th(t);i.persistent?this.persistence.register_once(n,e,i.days):(typeof e>"u"&&(e="None"),v.each(n,function(r,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===e)&&(this.unpersisted_superprops[o]=r)},this))},E.prototype.unregister=function(n,e){e=th(e),e.persistent?this.persistence.unregister(n):delete this.unpersisted_superprops[n]},E.prototype._register_single=function(n,e){var t={};t[n]=e,this.register(t)},E.prototype.identify=function(n,e,t,i,r,o,s,a){var c=this.get_distinct_id();if(n&&c!==n){if(typeof n=="string"&&n.indexOf(Qd)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var u=c;this.register_once({$had_persisted_distinct_id:!0,$device_id:u},"")}n!==c&&n!==this.get_property(Ya)&&(this.unregister(Ya),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,t,i,r,o,s,a),n!==c&&this.track("$identify",{distinct_id:n,$anon_distinct_id:c},{skip_hooks:!0}),n!==c&&this.flags.fetchFlags()},E.prototype.reset=function(){this.stop_session_recording(),this.persistence.clear(),this._flags.identify_called=!1;var n=v.UUID();this.register_once({distinct_id:Qd+n,$device_id:n},""),this._check_and_start_session_recording()},E.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},E.prototype.alias=function(n,e){if(n===this.get_property(ly))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var t=this;return v.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(Ya,n),this.track("$create_alias",{alias:n,distinct_id:e},{skip_hooks:!0},function(){t.identify(n)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(n),-1)},E.prototype.name_tag=function(n){this._register_single("mp_name_tag",n)},E.prototype.set_config=function(n){if(v.isObject(n)){v.extend(this.config,n);var e=n.batch_size;e&&v.each(this.request_batchers,function(t){t.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),on.DEBUG=on.DEBUG||this.get_config("debug"),("autocapture"in n||"record_heatmap_data"in n)&&this.autocapture&&this.autocapture.init()}},E.prototype.get_config=function(n){return this.config[n]},E.prototype._run_hook=function(n){var e=(this.config.hooks[n]||xP).apply(this,Wi.call(arguments,1));return typeof e>"u"&&(this.report_error(n+" hook did not return a value"),e=null),e},E.prototype.get_property=function(n){return this.persistence.load_prop([n])},E.prototype.get_api_host=function(n){return this.get_config("api_hosts")[n]||this.get_config("api_host")},E.prototype.toString=function(){var n=this.get_config("name");return n!==Yt&&(n=Yt+"."+n),n},E.prototype._event_is_disabled=function(n){return v.isBlockedUA(Vn)||this._flags.disable_all_events||v.include(this.__disabled_events,n)},E.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&v.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||v.cookie.get("mp_optout"))&&(v.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},E.prototype._gdpr_update_persistence=function(n){var e;if(n&&n.clear_persistence)e=!0;else if(n&&n.enable_persistence)e=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==e&&this.persistence.set_disabled(e),e?(this.stop_batch_senders(),this.stop_session_recording()):this._batchers_were_started&&this.start_batch_senders()},E.prototype._gdpr_call_func=function(n,e){return e=v.extend({track:v.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},e),v.localStorage.is_supported()||(e.persistence_type="cookie"),n(this.get_config("token"),{track:e.track,trackEventName:e.track_event_name,trackProperties:e.track_properties,persistenceType:e.persistence_type,persistencePrefix:e.cookie_prefix,cookieDomain:e.cookie_domain,cookieExpiration:e.cookie_expiration,crossSiteCookie:e.cross_site_cookie,crossSubdomainCookie:e.cross_subdomain_cookie,secureCookie:e.secure_cookie,ignoreDnt:e.ignore_dnt})},E.prototype.opt_in_tracking=function(n){n=v.extend({enable_persistence:!0},n),this._gdpr_call_func(HR,n),this._gdpr_update_persistence(n)},E.prototype.opt_out_tracking=function(n){n=v.extend({clear_persistence:!0,delete_user:!0},n),n.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(KR,n),this._gdpr_update_persistence(n)},E.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(YR,n)},E.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(I0,n)},E.prototype.clear_opt_in_out_tracking=function(n){n=v.extend({enable_persistence:!0},n),this._gdpr_call_func(XR,n),this._gdpr_update_persistence(n)},E.prototype.report_error=function(n,e){ke.error.apply(ke.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(t){ke.error(t)}},E.prototype.init=E.prototype.init,E.prototype.reset=E.prototype.reset,E.prototype.disable=E.prototype.disable,E.prototype.time_event=E.prototype.time_event,E.prototype.track=E.prototype.track,E.prototype.track_links=E.prototype.track_links,E.prototype.track_forms=E.prototype.track_forms,E.prototype.track_pageview=E.prototype.track_pageview,E.prototype.register=E.prototype.register,E.prototype.register_once=E.prototype.register_once,E.prototype.unregister=E.prototype.unregister,E.prototype.identify=E.prototype.identify,E.prototype.alias=E.prototype.alias,E.prototype.name_tag=E.prototype.name_tag,E.prototype.set_config=E.prototype.set_config,E.prototype.get_config=E.prototype.get_config,E.prototype.get_api_host=E.prototype.get_api_host,E.prototype.get_property=E.prototype.get_property,E.prototype.get_distinct_id=E.prototype.get_distinct_id,E.prototype.toString=E.prototype.toString,E.prototype.opt_out_tracking=E.prototype.opt_out_tracking,E.prototype.opt_in_tracking=E.prototype.opt_in_tracking,E.prototype.has_opted_out_tracking=E.prototype.has_opted_out_tracking,E.prototype.has_opted_in_tracking=E.prototype.has_opted_in_tracking,E.prototype.clear_opt_in_out_tracking=E.prototype.clear_opt_in_out_tracking,E.prototype.get_group=E.prototype.get_group,E.prototype.set_group=E.prototype.set_group,E.prototype.add_group=E.prototype.add_group,E.prototype.remove_group=E.prototype.remove_group,E.prototype.track_with_groups=E.prototype.track_with_groups,E.prototype.start_batch_senders=E.prototype.start_batch_senders,E.prototype.stop_batch_senders=E.prototype.stop_batch_senders,E.prototype.start_session_recording=E.prototype.start_session_recording,E.prototype.stop_session_recording=E.prototype.stop_session_recording,E.prototype.pause_session_recording=E.prototype.pause_session_recording,E.prototype.resume_session_recording=E.prototype.resume_session_recording,E.prototype.get_session_recording_properties=E.prototype.get_session_recording_properties,E.prototype.get_session_replay_url=E.prototype.get_session_replay_url,E.prototype.get_tab_id=E.prototype.get_tab_id,E.prototype.DEFAULT_API_ROUTES=my,E.prototype.__get_recorder=E.prototype.__get_recorder,re.prototype.properties=re.prototype.properties,re.prototype.update_search_keyword=re.prototype.update_search_keyword,re.prototype.update_referrer_info=re.prototype.update_referrer_info,re.prototype.get_cross_subdomain=re.prototype.get_cross_subdomain,re.prototype.clear=re.prototype.clear;var Vr={},RP=function(){v.each(Vr,function(n,e){e!==Yt&&(Tt[e]=n)}),Tt._=v},PP=function(){Tt.init=function(n,e,t){if(t)return Tt[t]||(Tt[t]=Vr[t]=eh(n,e,t),Tt[t]._loaded()),Tt[t];var i=Tt;Vr[Yt]?i=Vr[Yt]:n&&(i=eh(n,e,Yt),i._loaded(),Vr[Yt]=i),Tt=i,Zd===TP&&(q[Yt]=Tt),RP()}},OP=function(){function n(){n.done||(n.done=!0,vy=!0,fy=!1,v.each(Vr,function(i){i._dom_loaded()}))}function e(){try{_e.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(_e.addEventListener)_e.readyState==="complete"?n():_e.addEventListener("DOMContentLoaded",n,!1);else if(_e.attachEvent){_e.attachEvent("onreadystatechange",n);var t=!1;try{t=q.frameElement===null}catch{}_e.documentElement.doScroll&&t&&e()}v.register_event(q,"load",n,!0)};function AP(n){return dy=n,Zd=hy,Tt=new E,PP(),Tt.init(),OP(),Tt}function MP(n,e){e()}var Xo=AP(MP);function NP(n,e={}){const t=e.instanceName||`obi_${Math.random().toString(36).slice(2)}`;Xo.init(n,{debug:e.debug===!0,track_pageview:!1,persistence:"localStorage",...e.config||{}},t);const i=Xo.get_instance?Xo.get_instance(t):Xo[t],r={identify:(o,s)=>{var a;try{i.identify(o),s&&((a=i==null?void 0:i.people)!=null&&a.set)&&i.people.set(s)}catch{}},track:(o,s)=>{try{i.track(o,s||{})}catch{}},page:(o,s)=>{try{i.track("Page Viewed",{name:o,...s||{}})}catch{}},reset:()=>{try{i.reset()}catch{}}};return typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Xo.track("tab-focus-changed",{page_url:window.location.href},{transport:"sendBeacon"})}),r}function DP(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var yy={exports:{}};(function(n){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(c,u,l){this.fn=c,this.context=u,this.once=l||!1}function o(c,u,l,d,h){if(typeof l!="function")throw new TypeError("The listener must be a function");var p=new r(l,d||c,h),m=t?t+u:u;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],p]:c._events[m].push(p):(c._events[m]=p,c._eventsCount++),c}function s(c,u){--c._eventsCount===0?c._events=new i:delete c._events[u]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],l,d;if(this._eventsCount===0)return u;for(d in l=this._events)e.call(l,d)&&u.push(t?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},a.prototype.listeners=function(u){var l=t?t+u:u,d=this._events[l];if(!d)return[];if(d.fn)return[d.fn];for(var h=0,p=d.length,m=new Array(p);h<p;h++)m[h]=d[h].fn;return m},a.prototype.listenerCount=function(u){var l=t?t+u:u,d=this._events[l];return d?d.fn?1:d.length:0},a.prototype.emit=function(u,l,d,h,p,m){var f=t?t+u:u;if(!this._events[f])return!1;var g=this._events[f],y=arguments.length,b,S;if(g.fn){switch(g.once&&this.removeListener(u,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,l),!0;case 3:return g.fn.call(g.context,l,d),!0;case 4:return g.fn.call(g.context,l,d,h),!0;case 5:return g.fn.call(g.context,l,d,h,p),!0;case 6:return g.fn.call(g.context,l,d,h,p,m),!0}for(S=1,b=new Array(y-1);S<y;S++)b[S-1]=arguments[S];g.fn.apply(g.context,b)}else{var w=g.length,k;for(S=0;S<w;S++)switch(g[S].once&&this.removeListener(u,g[S].fn,void 0,!0),y){case 1:g[S].fn.call(g[S].context);break;case 2:g[S].fn.call(g[S].context,l);break;case 3:g[S].fn.call(g[S].context,l,d);break;case 4:g[S].fn.call(g[S].context,l,d,h);break;default:if(!b)for(k=1,b=new Array(y-1);k<y;k++)b[k-1]=arguments[k];g[S].fn.apply(g[S].context,b)}}return!0},a.prototype.on=function(u,l,d){return o(this,u,l,d,!1)},a.prototype.once=function(u,l,d){return o(this,u,l,d,!0)},a.prototype.removeListener=function(u,l,d,h){var p=t?t+u:u;if(!this._events[p])return this;if(!l)return s(this,p),this;var m=this._events[p];if(m.fn)m.fn===l&&(!h||m.once)&&(!d||m.context===d)&&s(this,p);else{for(var f=0,g=[],y=m.length;f<y;f++)(m[f].fn!==l||h&&!m[f].once||d&&m[f].context!==d)&&g.push(m[f]);g.length?this._events[p]=g.length===1?g[0]:g:s(this,p)}return this},a.prototype.removeAllListeners=function(u){var l;return u?(l=t?t+u:u,this._events[l]&&s(this,l)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,n.exports=a})(yy);var LP=yy.exports;const nh=DP(LP);var ih=function(n,e){return ih=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])},ih(n,e)};function an(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ih(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var rh=function(){return rh=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},rh.apply(this,arguments)};function Mt(n,e,t,i){function r(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(l){try{u(i.next(l))}catch(d){s(d)}}function c(l){try{u(i.throw(l))}catch(d){s(d)}}function u(l){l.done?o(l.value):r(l.value).then(a,c)}u((i=i.apply(n,e||[])).next())})}function xt(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(t=0)),t;)try{if(i=1,r&&(o=u[0]&2?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,r=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1],o=u;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(u);break}o[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(l){u=[6,l],r=0}finally{i=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Ja(n,e,t){if(t||arguments.length===2)for(var i=0,r=e.length,o;i<r;i++)(o||!(i in e))&&(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return n.concat(o||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;for(var Gn=function(){function n(e,t,i,r){this.left=e,this.top=t,this.width=i,this.height=r}return n.prototype.add=function(e,t,i,r){return new n(this.left+e,this.top+t,this.width+i,this.height+r)},n.fromClientRect=function(e,t){return new n(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},n.fromDOMRectList=function(e,t){var i=Array.from(t).find(function(r){return r.width!==0});return i?new n(i.left+e.windowBounds.left,i.top+e.windowBounds.top,i.width,i.height):n.EMPTY},n.EMPTY=new n(0,0,0,0),n}(),Za=function(n,e){return Gn.fromClientRect(n,e.getBoundingClientRect())},UP=function(n){var e=n.body,t=n.documentElement;if(!e||!t)throw new Error("Unable to get document size");var i=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),r=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new Gn(0,0,i,r)},Qa=function(n){for(var e=[],t=0,i=n.length;t<i;){var r=n.charCodeAt(t++);if(r>=55296&&r<=56319&&t<i){var o=n.charCodeAt(t++);(o&64512)===56320?e.push(((r&1023)<<10)+(o&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},nt=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,n);var t=n.length;if(!t)return"";for(var i=[],r=-1,o="";++r<t;){var s=n[r];s<=65535?i.push(s):(s-=65536,i.push((s>>10)+55296,s%1024+56320)),(r+1===t||i.length>16384)&&(o+=String.fromCharCode.apply(String,i),i.length=0)}return o},by="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",FP=typeof Uint8Array>"u"?[]:new Uint8Array(256),ec=0;ec<by.length;ec++)FP[by.charCodeAt(ec)]=ec;typeof SuppressedError=="function"&&SuppressedError;for(var _y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",BP=typeof Uint8Array>"u"?[]:new Uint8Array(256),tc=0;tc<_y.length;tc++)BP[_y.charCodeAt(tc)]=tc;for(var ky="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",jP=typeof Uint8Array>"u"?[]:new Uint8Array(256),nc=0;nc<ky.length;nc++)jP[ky.charCodeAt(nc)]=nc;var VP=1,Sy=2,wy=3,zP=5,Cy=8,Ty=10,qP=25,WP=30,GP=37,$P=42,xy="!",fi="\xD7",HP="\xF7",Ey=[VP,Sy,wy,zP],KP=[Ty,Cy],YP=function(n,e){var t=[],i=[],r=[];return n.forEach(function(o,s){throw new Error("UnicodeTrie not initialized")}),[i,t,r]},XP=function(n,e){for(var t=n;t>=0;){var i=e[t];if(i===Ty)t--;else return i}return 0},JP=function(n,e,t,i,r){if(t[i]===0)return fi;var o=i-1;if(Array.isArray(r)&&r[o]===!0)return fi;var s=o-1,a=o+1,c=e[o];s>=0&&e[s];var u=e[a];if(c===Sy&&u===wy)return fi;if(Ey.indexOf(c)!==-1)return xy;if(Ey.indexOf(u)!==-1||KP.indexOf(u)!==-1)return fi;if(XP(o,e)===Cy)return HP;throw new Error("UnicodeTrie not initialized")},ZP=function(n,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=YP(n,e.lineBreak),i=t[0],r=t[1],o=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(a){return[qP,WP,$P].indexOf(a)!==-1?GP:a}));var s=e.wordBreak==="keep-all"?o.map(function(a,c){return a&&n[c]>=19968&&n[c]<=40959}):void 0;return[i,r,s]},QP=function(){function n(e,t,i,r){this.codePoints=e,this.required=t===xy,this.start=i,this.end=r}return n.prototype.slice=function(){return nt.apply(void 0,this.codePoints.slice(this.start,this.end))},n}(),e2=function(n,e){var t=Qa(n),i=ZP(t,e),r=i[0],o=i[1],s=i[2],a=t.length,c=0,u=0;return{next:function(){if(u>=a)return{done:!0,value:null};for(var l=fi;u<a&&(l=JP(t,o,r,++u,s))===fi;);if(l!==fi||u===a){var d=new QP(t,l,c,u);return c=u,{value:d,done:!1}}return{done:!0,value:null}}}},t2=1,n2=2,Jo=4,Iy=8,ic=10,Ry=47,Zo=92,i2=9,r2=32,rc=34,Qo=61,o2=35,s2=36,a2=37,oc=39,sc=40,es=41,c2=95,Ft=45,u2=33,l2=60,d2=62,h2=64,p2=91,f2=93,m2=61,g2=123,ac=63,v2=125,Py=124,y2=126,b2=128,Oy=65533,oh=42,Yi=43,_2=44,k2=58,S2=59,ts=46,w2=0,C2=8,T2=11,x2=14,E2=31,I2=127,xn=-1,Ay=48,My=97,Ny=101,R2=102,P2=117,O2=122,Dy=65,Ly=69,Uy=70,A2=85,M2=90,Et=function(n){return n>=Ay&&n<=57},N2=function(n){return n>=55296&&n<=57343},zr=function(n){return Et(n)||n>=Dy&&n<=Uy||n>=My&&n<=R2},D2=function(n){return n>=My&&n<=O2},L2=function(n){return n>=Dy&&n<=M2},U2=function(n){return D2(n)||L2(n)},F2=function(n){return n>=b2},cc=function(n){return n===ic||n===i2||n===r2},uc=function(n){return U2(n)||F2(n)||n===c2},Fy=function(n){return uc(n)||Et(n)||n===Ft},B2=function(n){return n>=w2&&n<=C2||n===T2||n>=x2&&n<=E2||n===I2},mi=function(n,e){return n!==Zo?!1:e!==ic},lc=function(n,e,t){return n===Ft?uc(e)||mi(e,t):uc(n)?!0:!!(n===Zo&&mi(n,e))},sh=function(n,e,t){return n===Yi||n===Ft?Et(e)?!0:e===ts&&Et(t):Et(n===ts?e:n)},j2=function(n){var e=0,t=1;(n[e]===Yi||n[e]===Ft)&&(n[e]===Ft&&(t=-1),e++);for(var i=[];Et(n[e]);)i.push(n[e++]);var r=i.length?parseInt(nt.apply(void 0,i),10):0;n[e]===ts&&e++;for(var o=[];Et(n[e]);)o.push(n[e++]);var s=o.length,a=s?parseInt(nt.apply(void 0,o),10):0;(n[e]===Ly||n[e]===Ny)&&e++;var c=1;(n[e]===Yi||n[e]===Ft)&&(n[e]===Ft&&(c=-1),e++);for(var u=[];Et(n[e]);)u.push(n[e++]);var l=u.length?parseInt(nt.apply(void 0,u),10):0;return t*(r+a*Math.pow(10,-s))*Math.pow(10,c*l)},V2={type:2},z2={type:3},q2={type:4},W2={type:13},G2={type:8},$2={type:21},H2={type:9},K2={type:10},Y2={type:11},X2={type:12},J2={type:14},dc={type:23},Z2={type:1},Q2={type:25},eO={type:24},tO={type:26},nO={type:27},iO={type:28},rO={type:29},oO={type:31},ah={type:32},By=function(){function n(){this._value=[]}return n.prototype.write=function(e){this._value=this._value.concat(Qa(e))},n.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==ah;)e.push(t),t=this.consumeToken();return e},n.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case rc:return this.consumeStringToken(rc);case o2:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Fy(t)||mi(i,r)){var o=lc(t,i,r)?n2:t2,s=this.consumeName();return{type:5,value:s,flags:o}}break;case s2:if(this.peekCodePoint(0)===Qo)return this.consumeCodePoint(),W2;break;case oc:return this.consumeStringToken(oc);case sc:return V2;case es:return z2;case oh:if(this.peekCodePoint(0)===Qo)return this.consumeCodePoint(),J2;break;case Yi:if(sh(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case _2:return q2;case Ft:var a=e,c=this.peekCodePoint(0),u=this.peekCodePoint(1);if(sh(a,c,u))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(lc(a,c,u))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(c===Ft&&u===d2)return this.consumeCodePoint(),this.consumeCodePoint(),eO;break;case ts:if(sh(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Ry:if(this.peekCodePoint(0)===oh)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===oh&&(l=this.consumeCodePoint(),l===Ry))return this.consumeToken();if(l===xn)return this.consumeToken()}break;case k2:return tO;case S2:return nO;case l2:if(this.peekCodePoint(0)===u2&&this.peekCodePoint(1)===Ft&&this.peekCodePoint(2)===Ft)return this.consumeCodePoint(),this.consumeCodePoint(),Q2;break;case h2:var d=this.peekCodePoint(0),h=this.peekCodePoint(1),p=this.peekCodePoint(2);if(lc(d,h,p)){var s=this.consumeName();return{type:7,value:s}}break;case p2:return iO;case Zo:if(mi(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case f2:return rO;case m2:if(this.peekCodePoint(0)===Qo)return this.consumeCodePoint(),G2;break;case g2:return Y2;case v2:return X2;case P2:case A2:var m=this.peekCodePoint(0),f=this.peekCodePoint(1);return m===Yi&&(zr(f)||f===ac)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Py:if(this.peekCodePoint(0)===Qo)return this.consumeCodePoint(),H2;if(this.peekCodePoint(0)===Py)return this.consumeCodePoint(),$2;break;case y2:if(this.peekCodePoint(0)===Qo)return this.consumeCodePoint(),K2;break;case xn:return ah}return cc(e)?(this.consumeWhiteSpace(),oO):Et(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):uc(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:nt(e)}},n.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},n.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},n.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},n.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();zr(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;t===ac&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i){var r=parseInt(nt.apply(void 0,e.map(function(c){return c===ac?Ay:c})),16),o=parseInt(nt.apply(void 0,e.map(function(c){return c===ac?Uy:c})),16);return{type:30,start:r,end:o}}var s=parseInt(nt.apply(void 0,e),16);if(this.peekCodePoint(0)===Ft&&zr(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var a=[];zr(t)&&a.length<6;)a.push(t),t=this.consumeCodePoint();var o=parseInt(nt.apply(void 0,a),16);return{type:30,start:s,end:o}}else return{type:30,start:s,end:s}},n.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===sc?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===sc?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},n.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===xn)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===oc||t===rc){var i=this.consumeStringToken(this.consumeCodePoint());return i.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===xn||this.peekCodePoint(0)===es)?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),dc)}for(;;){var r=this.consumeCodePoint();if(r===xn||r===es)return{type:22,value:nt.apply(void 0,e)};if(cc(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===xn||this.peekCodePoint(0)===es?(this.consumeCodePoint(),{type:22,value:nt.apply(void 0,e)}):(this.consumeBadUrlRemnants(),dc);if(r===rc||r===oc||r===sc||B2(r))return this.consumeBadUrlRemnants(),dc;if(r===Zo)if(mi(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),dc;else e.push(r)}},n.prototype.consumeWhiteSpace=function(){for(;cc(this.peekCodePoint(0));)this.consumeCodePoint()},n.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===es||e===xn)return;mi(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},n.prototype.consumeStringSlice=function(e){for(var t=5e4,i="";e>0;){var r=Math.min(t,e);i+=nt.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),i},n.prototype.consumeStringToken=function(e){var t="",i=0;do{var r=this._value[i];if(r===xn||r===void 0||r===e)return t+=this.consumeStringSlice(i),{type:0,value:t};if(r===ic)return this._value.splice(0,i),Z2;if(r===Zo){var o=this._value[i+1];o!==xn&&o!==void 0&&(o===ic?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):mi(r,o)&&(t+=this.consumeStringSlice(i),t+=nt(this.consumeEscapedCodePoint()),i=-1))}i++}while(!0)},n.prototype.consumeNumber=function(){var e=[],t=Jo,i=this.peekCodePoint(0);for((i===Yi||i===Ft)&&e.push(this.consumeCodePoint());Et(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(i===ts&&Et(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Iy;Et(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),r=this.peekCodePoint(1);var o=this.peekCodePoint(2);if((i===Ly||i===Ny)&&((r===Yi||r===Ft)&&Et(o)||Et(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Iy;Et(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[j2(e),t]},n.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],r=this.peekCodePoint(0),o=this.peekCodePoint(1),s=this.peekCodePoint(2);if(lc(r,o,s)){var a=this.consumeName();return{type:15,number:t,flags:i,unit:a}}return r===a2?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},n.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(zr(e)){for(var t=nt(e);zr(this.peekCodePoint(0))&&t.length<6;)t+=nt(this.consumeCodePoint());cc(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return i===0||N2(i)||i>1114111?Oy:i}return e===xn?Oy:e},n.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Fy(t))e+=nt(t);else if(mi(t,this.peekCodePoint(0)))e+=nt(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},n}(),jy=function(){function n(e){this._tokens=e}return n.create=function(e){var t=new By;return t.write(e),new n(t.read())},n.parseValue=function(e){return n.create(e).parseComponentValue()},n.parseValues=function(e){return n.create(e).parseComponentValues()},n.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},n.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},n.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},n.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(i.type===32||aO(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},n.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(i.type===32||i.type===3)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},n.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?ah:e},n.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},n}(),gi=function(n){return n.type===15},st=function(n){return n.type===17},ue=function(n){return n.type===20},sO=function(n){return n.type===0},ch=function(n,e){return ue(n)&&n.value===e},Vy=function(n){return n.type!==31},vt=function(n){return n.type!==31&&n.type!==4},En=function(n){var e=[],t=[];return n.forEach(function(i){if(i.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}i.type!==31&&t.push(i)}),t.length&&e.push(t),e},aO=function(n,e){return e===11&&n.type===12||e===28&&n.type===29?!0:e===2&&n.type===3},vi=function(n){return n.type===17||n.type===15},Be=function(n){return n.type===16||vi(n)},zy=function(n){return n.length>1?[n[0],n[1]]:[n[0]]},yt={type:17,number:0,flags:Jo},uh={type:16,number:50,flags:Jo},yi={type:16,number:100,flags:Jo},ns=function(n,e,t){var i=n[0],r=n[1];return[Ee(i,e),Ee(typeof r<"u"?r:i,t)]},Ee=function(n,e){if(n.type===16)return n.number/100*e;if(gi(n))switch(n.unit){case"rem":case"em":return 16*n.number;case"px":default:return n.number}return n.number},qy="deg",Wy="grad",Gy="rad",$y="turn",hc={name:"angle",parse:function(n,e){if(e.type===15)switch(e.unit){case qy:return Math.PI*e.number/180;case Wy:return Math.PI/200*e.number;case Gy:return e.number;case $y:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Hy=function(n){return n.type===15&&(n.unit===qy||n.unit===Wy||n.unit===Gy||n.unit===$y)},Ky=function(n){var e=n.filter(ue).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[yt,yt];case"to top":case"bottom":return Xt(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[yt,yi];case"to right":case"left":return Xt(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[yi,yi];case"to bottom":case"top":return Xt(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[yi,yt];case"to left":case"right":return Xt(270)}return 0},Xt=function(n){return Math.PI*n/180},bi=function(n){return(255&n)===0},pt=function(n){var e=255&n,t=255&n>>8,i=255&n>>16,r=255&n>>24;return e<255?"rgba(".concat(r,",").concat(i,",").concat(t,",").concat(e/255,")"):"rgb(".concat(r,",").concat(i,",").concat(t,")")},In=function(n,e,t,i){return(n<<24|e<<16|t<<8|Math.round(i*255)<<0)>>>0},pc=function(n,e){if(n.type===17)return n.number;if(n.type===16){var t=e===3?1:255;return e===3?n.number/100*t:Math.round(n.number/100*t)}return 0},Xi=function(n){return(n[0].type===20?n[0].value:"unknown")==="from"},Ke=function(n,e,t){return Math.min(Math.max(n,e),t)},Bt=function(n,e){return[n[0]*e[0]+n[1]*e[1]+n[2]*e[2],n[3]*e[0]+n[4]*e[1]+n[5]*e[2],n[6]*e[0]+n[7]*e[1]+n[8]*e[2]]},cO=function(n){return In(Ke(Math.round(n[0]*255),0,255),Ke(Math.round(n[1]*255),0,255),Ke(Math.round(n[2]*255),0,255),Ke(n[3],0,1))},lh=function(n){var e=n[0],t=n[1],i=n[2],r=n[3],o=Ji([e,t,i]);return In(Ke(Math.round(o[0]*255),0,255),Ke(Math.round(o[1]*255),0,255),Ke(Math.round(o[2]*255),0,255),r)},is=function(n){var e=_i([n[0],n[1],n[2]]);return lh([e[0],e[1],e[2],n[3]])},uO=function(n,e){if(Xi(e.filter(vt)))throw new Error("Relative color not supported for lab()");var t=fc(e),i=t[0],r=t[1],o=t[2],s=t[3],a=Ji(_i(vc([i,r,o])));return In(Ke(Math.round(a[0]*255),0,255),Ke(Math.round(a[1]*255),0,255),Ke(Math.round(a[2]*255),0,255),s)},lO=function(n,e){if(Xi(e.filter(vt)))throw new Error("Relative color not supported for oklab()");var t=fc(e),i=t[0],r=t[1],o=t[2],s=t[3],a=Ji(_i(gc([i,r,o])));return In(Ke(Math.round(a[0]*255),0,255),Ke(Math.round(a[1]*255),0,255),Ke(Math.round(a[2]*255),0,255),s)},dO=function(n,e){if(Xi(e.filter(vt)))throw new Error("Relative color not supported for oklch()");var t=Zy(e),i=t[0],r=t[1],o=t[2],s=t[3],a=Ji(_i(gc(mc([i,r,o]))));return In(Ke(Math.round(a[0]*255),0,255),Ke(Math.round(a[1]*255),0,255),Ke(Math.round(a[2]*255),0,255),s)},hO=function(n,e){if(Xi(e.filter(vt)))throw new Error("Relative color not supported for lch()");var t=Jy(e),i=t[0],r=t[1],o=t[2],s=t[3],a=Ji(_i(vc(mc([i,r,o]))));return In(Ke(Math.round(a[0]*255),0,255),Ke(Math.round(a[1]*255),0,255),Ke(Math.round(a[2]*255),0,255),s)},Yy=function(n,e){var t=e.filter(vt),i=t[0],r=t[1],o=t[2],s=t[3],a=(i.type===17?Xt(i.number):hc.parse(n,i))/(Math.PI*2),c=Be(r)?r.number/100:0,u=Be(o)?o.number/100:0,l=typeof s<"u"&&Be(s)?Ee(s,1):1;return[a,c,u,l]},Xy=function(n,e){if(Xi(e))throw new Error("Relative color not supported for hsl()");var t=Yy(n,e),i=t[0],r=t[1],o=t[2],s=t[3],a=eb([i,r,o]);return In(a[0]*255,a[1]*255,a[2]*255,r===0?1:s)},Jy=function(n){var e=n.filter(vt),t=Be(e[0])?e[0].number:0,i=Be(e[1])?e[1].number:0,r=st(e[2])||gi(e[2])?e[2].number:0,o=typeof e[4]<"u"&&Be(e[4])?Ee(e[4],1):1;return[t,i,r,o]},fc=function(n){var e=n.filter(vt),t=e[0].type===16?e[0].number/100:st(e[0])?e[0].number:0,i=e[1].type===16?e[1].number/100:st(e[1])?e[1].number:0,r=st(e[2])||gi(e[2])?e[2].number:0,o=typeof e[4]<"u"&&Be(e[4])?Ee(e[4],1):1;return[t,i,r,o]},Zy=function(n){var e=n.filter(vt),t=e[0].type===16?e[0].number/100:st(e[0])?e[0].number:0,i=e[1].type===16?e[1].number/100:st(e[1])?e[1].number:0,r=st(e[2])||gi(e[2])?e[2].number:0,o=typeof e[4]<"u"&&Be(e[4])?Ee(e[4],1):1;return[t,i,r,o]},Qy=function(n){return Bt([1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371],n)},dh=function(n){return Bt([.955473421488075,-.02309845494876471,.06325924320057072,-.0283697093338637,1.0099953980813041,.021041441191917323,.012314014864481998,-.020507649298898964,1.330365926242124],n)},hh=function(n,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-n)*t*6+n:t<1/2?e:t<2/3?(e-n)*6*(2/3-t)+n:n},eb=function(n){var e=n[0],t=n[1],i=n[2];if(t===0)return[i*255,i*255,i*255];var r=i<=.5?i*(t+1):i+t-i*t,o=i*2-r,s=hh(o,r,e+1/3),a=hh(o,r,e),c=hh(o,r,e-1/3);return[s,a,c]},mc=function(n){var e=n[0],t=n[1],i=n[2];return t<0&&(t=0),isNaN(i)&&(i=0),[e,t*Math.cos(i*Math.PI/180),t*Math.sin(i*Math.PI/180)]},gc=function(n){var e=Bt([1,.3963377773761749,.2158037573099136,1,-.1055613458156586,-.0638541728258133,1,-.0894841775298119,-1.2914855480194092],n),t=e.map(function(i){return Math.pow(i,3)});return Bt([1.2268798758459243,-.5578149944602171,.2813910456659647,-.0405757452148008,1.112286803280317,-.0717110580655164,-.0763729366746601,-.4214933324022432,1.5869240198367816],t)},vc=function(n){var e=(n[0]+16)/116,t=n[1]/500+e,i=e-n[2]/200,r=24389/27,o=24/116,s=[(t>o?Math.pow(t,3):(116*t-16)/r)*.3457/.3585,n[0]>8?Math.pow(e,3):n[0]/r,(i>o?Math.pow(i,3):(116*i-16)/r)*(1-.3457-.3585)/.3585];return dh([s[0],s[1],s[2]])},pO=function(n,e){var t=e.filter(vt);if(t.length===3){var i=t.map(pc),r=i[0],o=i[1],s=i[2],a=fh([r/255,o/255,s/255]),c=ph([a[0],a[1],a[2]]),u=c[0],l=c[1],d=c[2];return[u,l,d,1]}if(t.length===4){var h=t.map(pc),r=h[0],o=h[1],s=h[2],p=h[3],a=fh([r/255,o/255,s/255]),m=ph([a[0],a[1],a[2]]),u=m[0],l=m[1],d=m[2];return[u,l,d,p]}return[0,0,0,1]},fO=function(n,e){var t=Yy(n,e),i=t[0],r=t[1],o=t[2],s=t[3],a=fh(eb([i,r,o])),c=ph([a[0],a[1],a[2]]),u=c[0],l=c[1],d=c[2];return[u,l,d,s]},mO=function(n,e){var t=fc(e),i=t[0],r=t[1],o=t[2],s=t[3],a=vc([i,r,o]),c=a[0],u=a[1],l=a[2];return[c,u,l,s]},gO=function(n,e){var t=Jy(e),i=t[0],r=t[1],o=t[2],s=t[3],a=vc(mc([i,r,o])),c=a[0],u=a[1],l=a[2];return[c,u,l,s]},vO=function(n,e){var t=Zy(e),i=t[0],r=t[1],o=t[2],s=t[3],a=gc(mc([i,r,o])),c=a[0],u=a[1],l=a[2];return[c,u,l,s]},yO=function(n,e){var t=fc(e),i=t[0],r=t[1],o=t[2],s=t[3],a=gc([i,r,o]),c=a[0],u=a[1],l=a[2];return[c,u,l,s]},bO=function(n){return dh([n[0],n[1],n[2]])},tb=function(n){return n},_O=function(n){var e=Qy([n[0],n[2],n[3]]),t=e[0],i=e[1],r=e[2];return[t,i,r,n[3]]},nb=function(n){return is([n[0],n[1],n[2],n[3]])},kO=function(n){var e=bO([n[0],n[1],n[2]]);return is([e[0],e[1],e[2],n[3]])},_i=function(n){return Bt([3.2409699419045226,-1.537383177570094,-.4986107602930034,-.9692436362808796,1.8759675015077202,.04155505740717559,.05563007969699366,-.20397695888897652,1.0569715142428786],n)},ph=function(n){return Bt([.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],n)},Ji=function(n){return n.map(function(e){var t=e<0?-1:1,i=Math.abs(e);return i>.0031308?t*(1.055*Math.pow(i,1/2.4)-.055):12.92*e})},fh=function(n){return n.map(function(e){var t=e<0?-1:1,i=Math.abs(e);return i<=.04045?e/12.92:t*Math.pow((i+.055)/1.055,2.4)})},SO=function(n){var e=Ji(_i([n[0],n[1],n[2]])),t=e[0],i=e[1],r=e[2];return[t,i,r,n[3]]},wO=function(n){var e=_i([n[0],n[1],n[2]]),t=e[0],i=e[1],r=e[2];return[Ke(Math.round(t*255),0,255),Ke(Math.round(i*255),0,255),Ke(Math.round(r*255),0,255),n[3]]},CO=function(n){return Bt([.4865709486482162,.26566769316909306,.1982172852343625,.2289745640697488,.6917385218365064,.079286914093745,0,.04511338185890264,1.043944368900976],n)},TO=function(n){return Bt([2.493496911941425,-.9313836179191239,-.40271078445071684,-.8294889695615747,1.7626640603183463,.023624685841943577,.03584583024378447,-.07617238926804182,.9568845240076872],n)},xO=function(n){return n.map(function(e){var t=e<0?-1:1,i=e*t;return i<=.04045?e/12.92:t*Math.pow((e+.055)/1.055,2.4)||0})},EO=function(n){return Ji(n)},IO=function(n){var e=xO([n[0],n[1],n[2]]);return CO([e[0],e[1],e[2]])},RO=function(n){var e=EO(TO([n[0],n[1],n[2]])),t=e[0],i=e[1],r=e[2];return[t,i,r,n[3]]},PO=function(n){var e=IO([n[0],n[1],n[2]]);return is([e[0],e[1],e[2],n[3]])},OO=function(n){return Bt([2.0415879038107465,-.5650069742788596,-.34473135077832956,-.9692436362808795,1.8759675015077202,.04155505740717557,.013444280632031142,-.11836239223101838,1.0151749943912054],n)},AO=function(n){return Bt([.5766690429101305,.1855582379065463,.1882286462349947,.29734497525053605,.6273635662554661,.0752914584939978,.02703136138641234,.07068885253582723,.9913375368376388],n)},MO=function(n){var e=n.map(function(t){var i=t<0?-1:1,r=Math.abs(t);return i*Math.pow(r,2.19921875)});return[e[0],e[1],e[2]]},NO=function(n){var e=n.map(function(t){var i=t<0?-1:1,r=Math.abs(t);return i*Math.pow(r,.4547069271758437)});return[e[0],e[1],e[2]]},DO=function(n){var e=NO(OO([n[0],n[1],n[2]])),t=e[0],i=e[1],r=e[2];return[t,i,r,n[3]]},LO=function(n){var e=_i(AO(MO([n[0],n[1],n[2]])));return lh([e[0],e[1],e[2],n[3]])},UO=function(n){return Bt([.7977666449006423,.13518129740053308,.0313477341283922,.2880748288194013,.711835234241873,8993693872564e-17,0,0,.8251046025104602],n)},FO=function(n){return Bt([1.3457868816471583,-.25557208737979464,-.05110186497554526,-.5446307051249019,1.5082477428451468,.02052744743642139,0,0,1.2119675456389452],n)},BO=function(n){return n.map(function(e){return e<16/512?e/16:Math.pow(e,1.8)})},jO=function(n){return n.map(function(e){return e>1/512?Math.pow(e,1/1.8):e*16})},VO=function(n){var e=BO([n[0],n[1],n[2]]);return dh(UO([e[0],e[1],e[2]]))},zO=function(n){var e=jO(FO(Qy([n[0],n[1],n[2]]))),t=e[0],i=e[1],r=e[2];return[t,i,r,n[3]]},qO=function(n){var e=VO([n[0],n[1],n[2]]);return is([e[0],e[1],e[2],n[3]])},yc=1.09929682680944,ib=.018053968510807,WO=function(n){return n.map(function(e){return e<ib*4.5?e/4.5:Math.pow((e+yc-1)/yc,1/.45)})},GO=function(n){return n.map(function(e){return e>=ib?yc*Math.pow(e,.45)-(yc-1):4.5*e})},$O=function(n){return Bt([.6369580483012914,.14461690358620832,.1688809751641721,.2627002120112671,.6779980715188708,.05930171646986196,0,.028072693049087428,1.060985057710791],n)},HO=function(n){return Bt([1.716651187971268,-.355670783776392,-.25336628137366,-.666684351832489,1.616481236634939,.0157685458139111,.017639857445311,-.042770613257809,.942103121235474],n)},KO=function(n){var e=WO([n[0],n[1],n[2]]);return $O([e[0],e[1],e[2]])},YO=function(n){var e=GO(HO([n[0],n[1],n[2]])),t=e[0],i=e[1],r=e[2];return[t,i,r,n[3]]},XO=function(n){var e=KO([n[0],n[1],n[2]]);return is([e[0],e[1],e[2],n[3]])},ki={name:"color",parse:function(n,e){if(e.type===18){var t=eA[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'.concat(e.name,'"'));return t(n,e.values)}if(e.type===5){var i=rb(e),r=i[0],o=i[1],s=i[2],a=i[3];return In(r,o,s,a)}if(e.type===20){var c=Rn[e.value.toUpperCase()];if(typeof c<"u")return c}return Rn.TRANSPARENT}},rb=function(n){if(n.value.length===3){var e=n.value.substring(0,1),t=n.value.substring(1,2),i=n.value.substring(2,3);return[parseInt(e+e,16),parseInt(t+t,16),parseInt(i+i,16),1]}if(n.value.length===4){var e=n.value.substring(0,1),t=n.value.substring(1,2),i=n.value.substring(2,3),r=n.value.substring(3,4);return[parseInt(e+e,16),parseInt(t+t,16),parseInt(i+i,16),parseInt(r+r,16)/255]}if(n.value.length===6){var e=n.value.substring(0,2),t=n.value.substring(2,4),i=n.value.substring(4,6);return[parseInt(e,16),parseInt(t,16),parseInt(i,16),1]}if(n.value.length===8){var e=n.value.substring(0,2),t=n.value.substring(2,4),i=n.value.substring(4,6),r=n.value.substring(6,8);return[parseInt(e,16),parseInt(t,16),parseInt(i,16),parseInt(r,16)/255]}return[0,0,0,1]},ob=function(n,e){var t=e.filter(vt);if(Xi(t))throw new Error("Relative color not supported for rgb()");if(t.length===3){var i=t.map(pc),r=i[0],o=i[1],s=i[2];return In(r,o,s,1)}if(t.length===4){var a=t.map(pc),r=a[0],o=a[1],s=a[2],c=a[3];return In(r,o,s,c)}return 0},JO=function(n,e){var t=e.filter(vt),i=t[0].type===20?t[0].value:"unknown",r=!Xi(t);if(r){var o=i,s=sb[o];if(typeof s>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(o,'" for color() function'));var a=st(t[1])?t[1].number:0,c=st(t[2])?t[2].number:0,u=st(t[3])?t[3].number:0,l=t.length>4&&t[4].type===6&&t[4].value==="/"&&st(t[5])?t[5].number:1;return s([a,c,u,l])}else{var d=function(W,A){if(st(A))return A.number;var H=function(Ie){return Ie==="r"||Ie==="x"?0:Ie==="g"||Ie==="y"?1:2};if(ue(A)){var Y=H(A.value);return W[Y]}var J=function(Ie){for(var dt=Ie.filter(vt),Ne="(",Pe=0,ie=dt;Pe<ie.length;Pe++){var Ze=ie[Pe];Ne+=Ze.type===18&&Ze.name==="calc"?J(Ze.values):st(Ze)?Ze.number:Ze.type===6||ue(Ze)?Ze.value:""}return Ne+=")",Ne};if(A.type===18){var ve=A.values.filter(vt);if(A.name==="calc"){var Me=J(ve).replace(/r|x/,W[0].toString()).replace(/g|y/,W[1].toString()).replace(/b|z/,W[2].toString());return new Function("return "+Me)()}}return null},h=t[1].type===18?t[1].name:ue(t[1])||t[1].type===5?"rgb":"unknown",p=ue(t[2])?t[2].value:"unknown",m=t[1].type===18?t[1].values:ue(t[1])?[t[1]]:[];if(ue(t[1])){var f=Rn[t[1].value.toUpperCase()];if(typeof f>"u")throw new Error("Attempting to use unknown color in relative color 'from'");var g=qr(n,t[1].value),y=255&g,b=255&g>>8,S=255&g>>16,w=255&g>>24;m=[{type:17,number:w,flags:1},{type:17,number:S,flags:1},{type:17,number:b,flags:1},{type:17,number:y>1?y/255:y,flags:1}]}else if(t[1].type===5){var k=rb(t[1]),w=k[0],S=k[1],b=k[2],y=k[3];m=[{type:17,number:w,flags:1},{type:17,number:S,flags:1},{type:17,number:b,flags:1},{type:17,number:y>1?y/255:y,flags:1}]}if(m.length===0)throw new Error("Attempting to use unknown color in relative color 'from'");if(p==="unknown")throw new Error("Attempting to use unknown colorspace in relative color 'to'");var C=ZO[h],x=QO[p],I=sb[p];if(typeof C>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(h,'" for color() function'));if(typeof x>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(p,'" for color() function'));var P=C(n,m),D=x(P),a=d(D,t[3]),c=d(D,t[4]),u=d(D,t[5]),l=t.length>6&&t[6].type===6&&t[6].value==="/"&&st(t[7])?t[7].number:1;if(a===null||c===null||u===null)throw new Error("Invalid relative color in color() function");return I([a,c,u,l])}},sb={srgb:cO,"srgb-linear":lh,"display-p3":PO,"a98-rgb":LO,"prophoto-rgb":qO,xyz:nb,"xyz-d50":kO,"xyz-d65":nb,rec2020:XO},ZO={rgb:pO,hsl:fO,lab:mO,lch:gO,oklab:yO,oklch:vO},QO={srgb:SO,"srgb-linear":wO,"display-p3":RO,"a98-rgb":DO,"prophoto-rgb":zO,xyz:tb,"xyz-d50":_O,"xyz-d65":tb,rec2020:YO},eA={hsl:Xy,hsla:Xy,rgb:ob,rgba:ob,lch:hO,oklch:dO,oklab:lO,lab:uO,color:JO},qr=function(n,e){return ki.parse(n,jy.create(e).parseComponentValue())},Rn={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},tA={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(ue(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},nA={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},bc=function(n,e){var t=ki.parse(n,e[0]),i=e[1];return i&&Be(i)?{color:t,stop:i}:{color:t,stop:null}},ab=function(n,e){var t=n[0],i=n[n.length-1];t.stop===null&&(t.stop=yt),i.stop===null&&(i.stop=yi);for(var r=[],o=0,s=0;s<n.length;s++){var a=n[s].stop;if(a!==null){var c=Ee(a,e);c>o?r.push(c):r.push(o),o=c}else r.push(null)}for(var u=null,s=0;s<r.length;s++){var l=r[s];if(l===null)u===null&&(u=s);else if(u!==null){for(var d=s-u,h=r[u-1],p=(l-h)/(d+1),m=1;m<=d;m++)r[u+m-1]=p*m;u=null}}return n.map(function(f,g){var y=f.color;return{color:y,stop:Math.max(Math.min(1,r[g]/e),0)}})},iA=function(n,e,t){var i=e/2,r=t/2,o=Ee(n[0],e)-i,s=r-Ee(n[1],t);return(Math.atan2(s,o)+Math.PI*2)%(Math.PI*2)},rA=function(n,e,t){var i=typeof n=="number"?n:iA(n,e,t),r=Math.abs(e*Math.sin(i))+Math.abs(t*Math.cos(i)),o=e/2,s=t/2,a=r/2,c=Math.sin(i-Math.PI/2)*a,u=Math.cos(i-Math.PI/2)*a;return[r,o-u,o+u,s-c,s+c]},cn=function(n,e){return Math.sqrt(n*n+e*e)},cb=function(n,e,t,i,r){var o=[[0,0],[0,e],[n,0],[n,e]];return o.reduce(function(s,a){var c=a[0],u=a[1],l=cn(t-c,i-u);return(r?l<s.optimumDistance:l>s.optimumDistance)?{optimumCorner:a,optimumDistance:l}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},oA=function(n,e,t,i,r){var o=0,s=0;switch(n.size){case 0:n.shape===0?o=s=Math.min(Math.abs(e),Math.abs(e-i),Math.abs(t),Math.abs(t-r)):n.shape===1&&(o=Math.min(Math.abs(e),Math.abs(e-i)),s=Math.min(Math.abs(t),Math.abs(t-r)));break;case 2:if(n.shape===0)o=s=Math.min(cn(e,t),cn(e,t-r),cn(e-i,t),cn(e-i,t-r));else if(n.shape===1){var a=Math.min(Math.abs(t),Math.abs(t-r))/Math.min(Math.abs(e),Math.abs(e-i)),c=cb(i,r,e,t,!0),u=c[0],l=c[1];o=cn(u-e,(l-t)/a),s=a*o}break;case 1:n.shape===0?o=s=Math.max(Math.abs(e),Math.abs(e-i),Math.abs(t),Math.abs(t-r)):n.shape===1&&(o=Math.max(Math.abs(e),Math.abs(e-i)),s=Math.max(Math.abs(t),Math.abs(t-r)));break;case 3:if(n.shape===0)o=s=Math.max(cn(e,t),cn(e,t-r),cn(e-i,t),cn(e-i,t-r));else if(n.shape===1){var a=Math.max(Math.abs(t),Math.abs(t-r))/Math.max(Math.abs(e),Math.abs(e-i)),d=cb(i,r,e,t,!1),u=d[0],l=d[1];o=cn(u-e,(l-t)/a),s=a*o}break}return Array.isArray(n.size)&&(o=Ee(n.size[0],i),s=n.size.length===2?Ee(n.size[1],r):o),[o,s]},sA=function(n,e){var t=Xt(180),i=[];return En(e).forEach(function(r,o){if(o===0){var s=r[0];if(s.type===20&&s.value==="to"){t=Ky(r);return}else if(Hy(s)){t=hc.parse(n,s);return}}var a=bc(n,r);i.push(a)}),{angle:t,stops:i,type:1}},_c=function(n,e){var t=Xt(180),i=[];return En(e).forEach(function(r,o){if(o===0){var s=r[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=Ky(r);return}else if(Hy(s)){t=(hc.parse(n,s)+Xt(270))%Xt(360);return}}var a=bc(n,r);i.push(a)}),{angle:t,stops:i,type:1}},aA=function(n,e){var t=Xt(180),i=[],r=1,o=0,s=3,a=[];return En(e).forEach(function(c,u){var l=c[0];if(u===0){if(ue(l)&&l.value==="linear"){r=1;return}else if(ue(l)&&l.value==="radial"){r=2;return}}if(l.type===18){if(l.name==="from"){var d=ki.parse(n,l.values[0]);i.push({stop:yt,color:d})}else if(l.name==="to"){var d=ki.parse(n,l.values[0]);i.push({stop:yi,color:d})}else if(l.name==="color-stop"){var h=l.values.filter(vt);if(h.length===2){var d=ki.parse(n,h[1]),p=h[0];st(p)&&i.push({stop:{type:16,number:p.number*100,flags:p.flags},color:d})}}}}),r===1?{angle:(t+Xt(180))%Xt(360),stops:i,type:r}:{size:s,shape:o,stops:i,position:a,type:r}},ub="closest-side",lb="farthest-side",db="closest-corner",hb="farthest-corner",pb="circle",fb="ellipse",mb="cover",gb="contain",cA=function(n,e){var t=0,i=3,r=[],o=[];return En(e).forEach(function(s,a){var c=!0;if(a===0){var u=!1;c=s.reduce(function(d,h){if(u)if(ue(h))switch(h.value){case"center":return o.push(uh),d;case"top":case"left":return o.push(yt),d;case"right":case"bottom":return o.push(yi),d}else(Be(h)||vi(h))&&o.push(h);else if(ue(h))switch(h.value){case pb:return t=0,!1;case fb:return t=1,!1;case"at":return u=!0,!1;case ub:return i=0,!1;case mb:case lb:return i=1,!1;case gb:case db:return i=2,!1;case hb:return i=3,!1}else if(vi(h)||Be(h))return Array.isArray(i)||(i=[]),i.push(h),!1;return d},c)}if(c){var l=bc(n,s);r.push(l)}}),{size:i,shape:t,stops:r,position:o,type:2}},kc=function(n,e){var t=0,i=3,r=[],o=[];return En(e).forEach(function(s,a){var c=!0;if(a===0?c=s.reduce(function(l,d){if(ue(d))switch(d.value){case"center":return o.push(uh),!1;case"top":case"left":return o.push(yt),!1;case"right":case"bottom":return o.push(yi),!1}else if(Be(d)||vi(d))return o.push(d),!1;return l},c):a===1&&(c=s.reduce(function(l,d){if(ue(d))switch(d.value){case pb:return t=0,!1;case fb:return t=1,!1;case gb:case ub:return i=0,!1;case lb:return i=1,!1;case db:return i=2,!1;case mb:case hb:return i=3,!1}else if(vi(d)||Be(d))return Array.isArray(i)||(i=[]),i.push(d),!1;return l},c)),c){var u=bc(n,s);r.push(u)}}),{size:i,shape:t,stops:r,position:o,type:2}},uA=function(n){return n.type===1},lA=function(n){return n.type===2},mh={name:"image",parse:function(n,e){if(e.type===22){var t={url:e.value,type:0};return n.cache.addImage(e.value),t}if(e.type===18){var i=vb[e.name];if(typeof i>"u")throw new Error('Attempting to parse an unsupported image function "'.concat(e.name,'"'));return i(n,e.values)}throw new Error("Unsupported image type ".concat(e.type))}};function dA(n){return!(n.type===20&&n.value==="none")&&(n.type!==18||!!vb[n.name])}var vb={"linear-gradient":sA,"-moz-linear-gradient":_c,"-ms-linear-gradient":_c,"-o-linear-gradient":_c,"-webkit-linear-gradient":_c,"radial-gradient":cA,"-moz-radial-gradient":kc,"-ms-radial-gradient":kc,"-o-radial-gradient":kc,"-webkit-radial-gradient":kc,"-webkit-gradient":aA},hA={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(n,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(i){return vt(i)&&dA(i)}).map(function(i){return mh.parse(n,i)})}},pA={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(ue(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},fA={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(n,e){return En(e).map(function(t){return t.filter(Be)}).map(zy)}},mA={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(n,e){return En(e).map(function(t){return t.filter(ue).map(function(i){return i.value}).join(" ")}).map(gA)}},gA=function(n){switch(n){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},Wr;(function(n){n.AUTO="auto",n.CONTAIN="contain",n.COVER="cover"})(Wr||(Wr={}));var vA={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(n,e){return En(e).map(function(t){return t.filter(yA)})}},yA=function(n){return ue(n)||Be(n)},Sc=function(n){return{name:"border-".concat(n,"-color"),initialValue:"transparent",prefix:!1,type:3,format:"color"}},bA=Sc("top"),_A=Sc("right"),kA=Sc("bottom"),SA=Sc("left"),wc=function(n){return{name:"border-radius-".concat(n),initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return zy(t.filter(Be))}}},wA=wc("top-left"),CA=wc("top-right"),TA=wc("bottom-right"),xA=wc("bottom-left"),Cc=function(n){return{name:"border-".concat(n,"-style"),initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},EA=Cc("top"),IA=Cc("right"),RA=Cc("bottom"),PA=Cc("left"),Tc=function(n){return{name:"border-".concat(n,"-width"),initialValue:"0",type:0,prefix:!1,parse:function(e,t){return gi(t)?t.number:0}}},OA=Tc("top"),AA=Tc("right"),MA=Tc("bottom"),NA=Tc("left"),DA={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},LA={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(n,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},UA={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(n,e){return e.filter(ue).reduce(function(t,i){return t|FA(i.value)},0)}},FA=function(n){switch(n){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},BA={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},jA={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(n,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},xc;(function(n){n.NORMAL="normal",n.STRICT="strict"})(xc||(xc={}));var VA={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"strict":return xc.STRICT;case"normal":default:return xc.NORMAL}}},zA={name:"line-height",initialValue:"normal",prefix:!1,type:4},yb=function(n,e){return ue(n)&&n.value==="normal"?1.2*e:n.type===17?e*n.number:Be(n)?Ee(n,e):e},qA={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(n,e){return e.type===20&&e.value==="none"?null:mh.parse(n,e)}},WA={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(n,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},gh={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 52;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},Ec=function(n){return{name:"margin-".concat(n),initialValue:"0",prefix:!1,type:4}},GA=Ec("top"),$A=Ec("right"),HA=Ec("bottom"),KA=Ec("left"),YA={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(n,e){return e.filter(ue).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},XA={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},Ic=function(n){return{name:"padding-".concat(n),initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},JA=Ic("top"),ZA=Ic("right"),QA=Ic("bottom"),eM=Ic("left"),tM={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(n,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},nM={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(n,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},iM={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&ch(e[0],"none")?[]:En(e).map(function(t){for(var i={color:Rn.TRANSPARENT,offsetX:yt,offsetY:yt,blur:yt},r=0,o=0;o<t.length;o++){var s=t[o];vi(s)?(r===0?i.offsetX=s:r===1?i.offsetY=s:i.blur=s,r++):i.color=ki.parse(n,s)}return i})}},rM={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},oM={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(n,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=cM[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'.concat(e.name,'"'));return t(e.values)}return null}},sM=function(n){var e=n.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},aM=function(n){var e=n.filter(function(c){return c.type===17}).map(function(c){return c.number}),t=e[0],i=e[1];e[2],e[3];var r=e[4],o=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],a=e[13];return e[14],e[15],e.length===16?[t,i,r,o,s,a]:null},cM={matrix:sM,matrix3d:aM},bb={type:16,number:50,flags:Jo},uM=[bb,bb],lM={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(n,e){var t=e.filter(Be);return t.length!==2?uM:[t[0],t[1]]}},dM={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},rs;(function(n){n.NORMAL="normal",n.BREAK_ALL="break-all",n.KEEP_ALL="keep-all"})(rs||(rs={}));var hM={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-all":return rs.BREAK_ALL;case"keep-all":return rs.KEEP_ALL;case"normal":default:return rs.NORMAL}}},pM={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(n,e){if(e.type===20)return{auto:!0,order:0};if(st(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},_b={name:"time",parse:function(n,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},fM={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(n,e){return st(e)?e.number:1}},mM={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},gM={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(n,e){return e.filter(ue).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},vM={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(n,e){var t=[],i=[];return e.forEach(function(r){switch(r.type){case 20:case 0:t.push(r.value);break;case 17:t.push(r.number.toString());break;case 4:i.push(t.join(" ")),t.length=0;break}}),t.length&&i.push(t.join(" ")),i.map(function(r){return r.indexOf(" ")===-1?r:"'".concat(r,"'")})}},yM={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},bM={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(n,e){if(st(e))return e.number;if(ue(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},_M={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.filter(ue).map(function(t){return t.value})}},kM={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},ut=function(n,e){return(n&e)!==0},SM={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(n,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},wM={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(n,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var i=[],r=e.filter(Vy),o=0;o<r.length;o++){var s=r[o],a=r[o+1];if(s.type===20){var c=a&&st(a)?a.number:1;i.push({counter:s.value,increment:c})}}return i}},CM={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(n,e){if(e.length===0)return[];for(var t=[],i=e.filter(Vy),r=0;r<i.length;r++){var o=i[r],s=i[r+1];if(ue(o)&&o.value!=="none"){var a=s&&st(s)?s.number:0;t.push({counter:o.value,reset:a})}}return t}},TM={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(n,e){return e.filter(gi).map(function(t){return _b.parse(n,t)})}},xM={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(n,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var i=[],r=e.filter(sO);if(r.length%2!==0)return null;for(var o=0;o<r.length;o+=2){var s=r[o].value,a=r[o+1].value;i.push({open:s,close:a})}return i}},kb=function(n,e,t){if(!n)return"";var i=n[Math.min(e,n.length-1)];return i?t?i.open:i.close:""},EM={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&ch(e[0],"none")?[]:En(e).map(function(t){for(var i={color:255,offsetX:yt,offsetY:yt,blur:yt,spread:yt,inset:!1},r=0,o=0;o<t.length;o++){var s=t[o];ch(s,"inset")?i.inset=!0:vi(s)?(r===0?i.offsetX=s:r===1?i.offsetY=s:r===2?i.blur=s:i.spread=s,r++):i.color=ki.parse(n,s)}return i})}},IM={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(n,e){var t=[0,1,2],i=[];return e.filter(ue).forEach(function(r){switch(r.value){case"stroke":i.push(1);break;case"fill":i.push(0);break;case"markers":i.push(2);break}}),t.forEach(function(r){i.indexOf(r)===-1&&i.push(r)}),i}},RM={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},PM={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(n,e){return gi(e)?e.number:0}},OM={name:"objectFit",initialValue:"fill",prefix:!1,type:1,parse:function(n,e){return e.filter(ue).reduce(function(t,i){return t|AM(i.value)},0)}},AM=function(n){switch(n){case"contain":return 2;case"cover":return 4;case"none":return 8;case"scale-down":return 16}return 0},MM=function(){function n(e,t){var i,r;this.animationDuration=$(e,TM,t.animationDuration),this.backgroundClip=$(e,tA,t.backgroundClip),this.backgroundColor=$(e,nA,t.backgroundColor),this.backgroundImage=$(e,hA,t.backgroundImage),this.backgroundOrigin=$(e,pA,t.backgroundOrigin),this.backgroundPosition=$(e,fA,t.backgroundPosition),this.backgroundRepeat=$(e,mA,t.backgroundRepeat),this.backgroundSize=$(e,vA,t.backgroundSize),this.borderTopColor=$(e,bA,t.borderTopColor),this.borderRightColor=$(e,_A,t.borderRightColor),this.borderBottomColor=$(e,kA,t.borderBottomColor),this.borderLeftColor=$(e,SA,t.borderLeftColor),this.borderTopLeftRadius=$(e,wA,t.borderTopLeftRadius),this.borderTopRightRadius=$(e,CA,t.borderTopRightRadius),this.borderBottomRightRadius=$(e,TA,t.borderBottomRightRadius),this.borderBottomLeftRadius=$(e,xA,t.borderBottomLeftRadius),this.borderTopStyle=$(e,EA,t.borderTopStyle),this.borderRightStyle=$(e,IA,t.borderRightStyle),this.borderBottomStyle=$(e,RA,t.borderBottomStyle),this.borderLeftStyle=$(e,PA,t.borderLeftStyle),this.borderTopWidth=$(e,OA,t.borderTopWidth),this.borderRightWidth=$(e,AA,t.borderRightWidth),this.borderBottomWidth=$(e,MA,t.borderBottomWidth),this.borderLeftWidth=$(e,NA,t.borderLeftWidth),this.boxShadow=$(e,EM,t.boxShadow),this.color=$(e,DA,t.color),this.direction=$(e,LA,t.direction),this.display=$(e,UA,t.display),this.float=$(e,BA,t.cssFloat),this.fontFamily=$(e,vM,t.fontFamily),this.fontSize=$(e,yM,t.fontSize),this.fontStyle=$(e,kM,t.fontStyle),this.fontVariant=$(e,_M,t.fontVariant),this.fontWeight=$(e,bM,t.fontWeight),this.letterSpacing=$(e,jA,t.letterSpacing),this.lineBreak=$(e,VA,t.lineBreak),this.lineHeight=$(e,zA,t.lineHeight),this.listStyleImage=$(e,qA,t.listStyleImage),this.listStylePosition=$(e,WA,t.listStylePosition),this.listStyleType=$(e,gh,t.listStyleType),this.marginTop=$(e,GA,t.marginTop),this.marginRight=$(e,$A,t.marginRight),this.marginBottom=$(e,HA,t.marginBottom),this.marginLeft=$(e,KA,t.marginLeft),this.opacity=$(e,fM,t.opacity);var o=$(e,YA,t.overflow);this.overflowX=o[0],this.overflowY=o[o.length>1?1:0],this.overflowWrap=$(e,XA,t.overflowWrap),this.paddingTop=$(e,JA,t.paddingTop),this.paddingRight=$(e,ZA,t.paddingRight),this.paddingBottom=$(e,QA,t.paddingBottom),this.paddingLeft=$(e,eM,t.paddingLeft),this.paintOrder=$(e,IM,t.paintOrder),this.position=$(e,nM,t.position),this.textAlign=$(e,tM,t.textAlign),this.textDecorationColor=$(e,mM,(i=t.textDecorationColor)!==null&&i!==void 0?i:t.color),this.textDecorationLine=$(e,gM,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=$(e,iM,t.textShadow),this.textTransform=$(e,rM,t.textTransform),this.transform=$(e,oM,t.transform),this.transformOrigin=$(e,lM,t.transformOrigin),this.visibility=$(e,dM,t.visibility),this.webkitTextStrokeColor=$(e,RM,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=$(e,PM,t.webkitTextStrokeWidth),this.wordBreak=$(e,hM,t.wordBreak),this.zIndex=$(e,pM,t.zIndex),this.objectFit=$(e,OM,t.objectFit)}return n.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},n.prototype.isTransparent=function(){return bi(this.backgroundColor)},n.prototype.isTransformed=function(){return this.transform!==null},n.prototype.isPositioned=function(){return this.position!==0},n.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},n.prototype.isFloating=function(){return this.float!==0},n.prototype.isInlineLevel=function(){return ut(this.display,4)||ut(this.display,33554432)||ut(this.display,268435456)||ut(this.display,536870912)||ut(this.display,67108864)||ut(this.display,134217728)},n}(),NM=function(){function n(e,t){this.content=$(e,SM,t.content),this.quotes=$(e,xM,t.quotes)}return n}(),Sb=function(){function n(e,t){this.counterIncrement=$(e,wM,t.counterIncrement),this.counterReset=$(e,CM,t.counterReset)}return n}(),$=function(n,e,t){var i=new By,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;i.write(r);var o=new jy(i.read());switch(e.type){case 2:var s=o.parseComponentValue();return e.parse(n,ue(s)?s.value:e.initialValue);case 0:return e.parse(n,o.parseComponentValue());case 1:return e.parse(n,o.parseComponentValues());case 4:return o.parseComponentValue();case 3:switch(e.format){case"angle":return hc.parse(n,o.parseComponentValue());case"color":return ki.parse(n,o.parseComponentValue());case"image":return mh.parse(n,o.parseComponentValue());case"length":var a=o.parseComponentValue();return vi(a)?a:yt;case"length-percentage":var c=o.parseComponentValue();return Be(c)?c:yt;case"time":return _b.parse(n,o.parseComponentValue())}break}},DM="data-html2canvas-debug",LM=function(n){var e=n.getAttribute(DM);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},vh=function(n,e){var t=LM(n);return t===1||e===t},Pn=function(){function n(e,t){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,vh(t,3),this.styles=new MM(e,window.getComputedStyle(t,null)),Ih(t)&&(this.styles.animationDuration.some(function(i){return i>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Za(this.context,t),vh(t,4)&&(this.flags|=16)}return n}();typeof SuppressedError=="function"&&SuppressedError;for(var wb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",UM=typeof Uint8Array>"u"?[]:new Uint8Array(256),Rc=0;Rc<wb.length;Rc++)UM[wb.charCodeAt(Rc)]=Rc;for(var Cb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",FM=typeof Uint8Array>"u"?[]:new Uint8Array(256),Pc=0;Pc<Cb.length;Pc++)FM[Cb.charCodeAt(Pc)]=Pc;var BM=1,yh=2,bh=3,Tb=4,xb=5,jM=7,Eb=8,_h=9,kh=10,Ib=11,Rb=12,Pb=13,Ob=14,Sh=15,VM=function(n){for(var e=[],t=0,i=n.length;t<i;){var r=n.charCodeAt(t++);if(r>=55296&&r<=56319&&t<i){var o=n.charCodeAt(t++);(o&64512)===56320?e.push(((r&1023)<<10)+(o&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},zM=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,n);var t=n.length;if(!t)return"";for(var i=[],r=-1,o="";++r<t;){var s=n[r];s<=65535?i.push(s):(s-=65536,i.push((s>>10)+55296,s%1024+56320)),(r+1===t||i.length>16384)&&(o+=String.fromCharCode.apply(String,i),i.length=0)}return o},Jt="\xD7",wh="\xF7",qM=function(n){throw new Error("UnicodeTrie not initialized")},WM=function(n,e,t){var i=t-2,r=e[i],o=e[t-1],s=e[t];if(o===yh&&s===bh)return Jt;if(o===yh||o===bh||o===Tb||s===yh||s===bh||s===Tb)return wh;if(o===Eb&&[Eb,_h,Ib,Rb].indexOf(s)!==-1||(o===Ib||o===_h)&&(s===_h||s===kh)||(o===Rb||o===kh)&&s===kh||s===Pb||s===xb||s===jM||o===BM)return Jt;if(o===Pb&&s===Ob){for(;r===xb;)r=e[--i];if(r===Ob)return Jt}if(o===Sh&&s===Sh){for(var a=0;r===Sh;)a++,r=e[--i];if(a%2===0)return Jt}return wh},GM=function(n){var e=VM(n),t=e.length,i=0,r=0,o=e.map(qM);return{next:function(){if(i>=t)return{done:!0,value:null};for(var s=Jt;i<t&&(s=WM(e,o,++i))===Jt;);if(s!==Jt||i===t){var a=zM.apply(null,e.slice(r,i));return r=i,{value:a,done:!1}}return{done:!0,value:null}}}},$M=function(n){for(var e=GM(n),t=[],i;!(i=e.next()).done;)i.value&&t.push(i.value.slice());return t},HM=function(n){var e=123;if(n.createRange){var t=n.createRange();if(t.getBoundingClientRect){var i=n.createElement("boundtest");i.style.height="".concat(e,"px"),i.style.display="block",n.body.appendChild(i),t.selectNode(i);var r=t.getBoundingClientRect(),o=Math.round(r.height);if(n.body.removeChild(i),o===e)return!0}}return!1},KM=function(n){var e=n.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",n.body.appendChild(e);var t=n.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var i=e.firstChild,r=Qa(i.data).map(function(c){return nt(c)}),o=0,s={},a=r.every(function(c,u){t.setStart(i,o),t.setEnd(i,o+c.length);var l=t.getBoundingClientRect();o+=c.length;var d=l.x>s.x||l.y>s.y;return s=l,u===0?!0:d});return n.body.removeChild(e),a},YM=function(){return typeof new Image().crossOrigin<"u"},XM=function(){return typeof new XMLHttpRequest().responseType=="string"},JM=function(n){var e=new Image,t=n.createElement("canvas"),i=t.getContext("2d");if(!i)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{i.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},Ab=function(n){return n[0]===0&&n[1]===255&&n[2]===0&&n[3]===255},ZM=function(n){var e=n.createElement("canvas"),t=100;e.width=t,e.height=t;var i=e.getContext("2d");if(!i)return Promise.reject(!1);i.fillStyle="rgb(0, 255, 0)",i.fillRect(0,0,t,t);var r=new Image,o=e.toDataURL();r.src=o;var s=Ch(t,t,0,0,r);return i.fillStyle="red",i.fillRect(0,0,t,t),Mb(s).then(function(a){i.drawImage(a,0,0);var c=i.getImageData(0,0,t,t).data;i.fillStyle="red",i.fillRect(0,0,t,t);var u=n.createElement("div");return u.style.backgroundImage="url(".concat(o,")"),u.style.height="".concat(t,"px"),Ab(c)?Mb(Ch(t,t,0,0,u)):Promise.reject(!1)}).then(function(a){return i.drawImage(a,0,0),Ab(i.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Ch=function(n,e,t,i,r){var o="http://www.w3.org/2000/svg",s=document.createElementNS(o,"svg"),a=document.createElementNS(o,"foreignObject");return s.setAttributeNS(null,"width",n.toString()),s.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",t.toString()),a.setAttributeNS(null,"y",i.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(a),a.appendChild(r),s},Mb=function(n){return new Promise(function(e,t){var i=new Image;i.onload=function(){return e(i)},i.onerror=t,i.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(n)))})},bt={get SUPPORT_RANGE_BOUNDS(){var n=HM(document);return Object.defineProperty(bt,"SUPPORT_RANGE_BOUNDS",{value:n}),n},get SUPPORT_WORD_BREAKING(){var n=bt.SUPPORT_RANGE_BOUNDS&&KM(document);return Object.defineProperty(bt,"SUPPORT_WORD_BREAKING",{value:n}),n},get SUPPORT_SVG_DRAWING(){var n=JM(document);return Object.defineProperty(bt,"SUPPORT_SVG_DRAWING",{value:n}),n},get SUPPORT_FOREIGNOBJECT_DRAWING(){var n=typeof Array.from=="function"&&typeof window.fetch=="function"?ZM(document):Promise.resolve(!1);return Object.defineProperty(bt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:n}),n},get SUPPORT_CORS_IMAGES(){var n=YM();return Object.defineProperty(bt,"SUPPORT_CORS_IMAGES",{value:n}),n},get SUPPORT_RESPONSE_TYPE(){var n=XM();return Object.defineProperty(bt,"SUPPORT_RESPONSE_TYPE",{value:n}),n},get SUPPORT_CORS_XHR(){var n="withCredentials"in new XMLHttpRequest;return Object.defineProperty(bt,"SUPPORT_CORS_XHR",{value:n}),n},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var n=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(bt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:n}),n}},os=function(){function n(e,t){this.text=e,this.bounds=t}return n}(),QM=function(n,e,t,i){var r=nN(e,t),o=[],s=0;return r.forEach(function(a){if(t.textDecorationLine.length||a.trim().length>0)if(bt.SUPPORT_RANGE_BOUNDS){var c=Nb(i,s,a.length).getClientRects();if(c.length>1){var u=Th(a),l=0;u.forEach(function(h){o.push(new os(h,Gn.fromDOMRectList(n,Nb(i,l+s,h.length).getClientRects()))),l+=h.length})}else o.push(new os(a,Gn.fromDOMRectList(n,c)))}else{var d=i.splitText(a.length);o.push(new os(a,eN(n,i))),i=d}else bt.SUPPORT_RANGE_BOUNDS||(i=i.splitText(a.length));s+=a.length}),o},eN=function(n,e){var t=e.ownerDocument;if(t){var i=t.createElement("html2canvaswrapper");i.appendChild(e.cloneNode(!0));var r=e.parentNode;if(r){r.replaceChild(i,e);var o=Za(n,i);return i.firstChild&&r.replaceChild(i.firstChild,i),o}}return Gn.EMPTY},Nb=function(n,e,t){var i=n.ownerDocument;if(!i)throw new Error("Node has no owner document");var r=i.createRange();return r.setStart(n,e),r.setEnd(n,e+t),r},Th=function(n){if(bt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(n)).map(function(t){return t.segment})}return $M(n)},tN=function(n,e){if(bt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(n)).map(function(i){return i.segment})}return rN(n,e)},nN=function(n,e){return e.letterSpacing!==0?Th(n):tN(n,e)},iN=[32,160,4961,65792,65793,4153,4241],rN=function(n,e){for(var t=e2(n,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),i=[],r,o=function(){if(r.value){var s=r.value.slice(),a=Qa(s),c="";a.forEach(function(u){iN.indexOf(u)===-1?c+=nt(u):(c.length&&i.push(c),i.push(nt(u)),c="")}),c.length&&i.push(c)}};!(r=t.next()).done;)o();return i},oN=function(){function n(e,t,i){this.text=sN(t.data,i.textTransform),this.textBounds=QM(e,this.text,i,t)}return n}(),sN=function(n,e){switch(e){case 1:return n.toLowerCase();case 3:return n.replace(aN,cN);case 2:return n.toUpperCase();default:return n}},aN=/(^|\s|:|-|\(|\))([a-z])/g,cN=function(n,e,t){return n.length>0?e+t.toUpperCase():n},Db=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;return r.src=i.currentSrc||i.src,r.intrinsicWidth=i.naturalWidth,r.intrinsicHeight=i.naturalHeight,r.context.cache.addImage(r.src),r}return e}(Pn),Lb=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;return r.canvas=i,r.intrinsicWidth=i.width,r.intrinsicHeight=i.height,r}return e}(Pn),Ub=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this,o=new XMLSerializer,s=Za(t,i);return i.setAttribute("width","".concat(s.width,"px")),i.setAttribute("height","".concat(s.height,"px")),r.svg="data:image/svg+xml,".concat(encodeURIComponent(o.serializeToString(i))),r.intrinsicWidth=i.width.baseVal.value,r.intrinsicHeight=i.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e}(Pn),Fb=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;return r.value=i.value,r}return e}(Pn),xh=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;return r.start=i.start,r.reversed=typeof i.reversed=="boolean"&&i.reversed===!0,r}return e}(Pn),uN=[{type:15,flags:0,unit:"px",number:3}],lN=[{type:16,flags:0,number:50}],dN=function(n){return n.width>n.height?new Gn(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width<n.height?new Gn(n.left,n.top+(n.height-n.width)/2,n.width,n.width):n},hN=function(n){var e=n.type===pN?new Array(n.value.length+1).join("\u2022"):n.value;return e.length===0?n.placeholder||"":e},Oc="checkbox",Ac="radio",pN="password",Bb=707406591,Eh=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;switch(r.type=i.type.toLowerCase(),r.checked=i.checked,r.value=hN(i),(r.type===Oc||r.type===Ac)&&(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=dN(r.bounds)),r.type){case Oc:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=uN;break;case Ac:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=lN;break}return r}return e}(Pn),jb=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this,o=i.options[i.selectedIndex||0];return r.value=o&&o.text||"",r}return e}(Pn),Vb=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;return r.value=i.value,r}return e}(Pn),zb=function(n){an(e,n);function e(t,i){var r=n.call(this,t,i)||this;r.src=i.src,r.width=parseInt(i.width,10)||0,r.height=parseInt(i.height,10)||0,r.backgroundColor=r.styles.backgroundColor;try{if(i.contentWindow&&i.contentWindow.document&&i.contentWindow.document.documentElement){r.tree=Wb(t,i.contentWindow.document.documentElement);var o=i.contentWindow.document.documentElement?qr(t,getComputedStyle(i.contentWindow.document.documentElement).backgroundColor):Rn.TRANSPARENT,s=i.contentWindow.document.body?qr(t,getComputedStyle(i.contentWindow.document.body).backgroundColor):Rn.TRANSPARENT;r.backgroundColor=bi(o)?bi(s)?r.styles.backgroundColor:s:o}}catch{}return r}return e}(Pn),fN=["OL","UL","MENU"],Mc=function(n,e,t,i){for(var r=e.firstChild,o=void 0;r;r=o)if(o=r.nextSibling,Gb(r)&&r.data.length>0)t.textNodes.push(new oN(n,r,t.styles));else if(Gr(r))if(Jb(r)&&r.assignedNodes)r.assignedNodes().forEach(function(a){return Mc(n,a,t,i)});else{var s=qb(n,r);s.styles.isVisible()&&(mN(r,s,i)?s.flags|=4:gN(s.styles)&&(s.flags|=2),fN.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?Mc(n,r.shadowRoot,s,i):!Dc(r)&&!$b(r)&&!Lc(r)&&Mc(n,r,s,i))}},qb=function(n,e){return Ph(e)?new Db(n,e):Hb(e)?new Lb(n,e):$b(e)?new Ub(n,e):vN(e)?new Fb(n,e):yN(e)?new xh(n,e):bN(e)?new Eh(n,e):Lc(e)?new jb(n,e):Dc(e)?new Vb(n,e):Yb(e)?new zb(n,e):new Pn(n,e)},Wb=function(n,e){var t=qb(n,e);return t.flags|=4,Mc(n,e,t,t),t},mN=function(n,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Rh(n)&&t.styles.isTransparent()},gN=function(n){return n.isPositioned()||n.isFloating()},Gb=function(n){return n.nodeType===Node.TEXT_NODE},Gr=function(n){return n.nodeType===Node.ELEMENT_NODE},Ih=function(n){return Gr(n)&&typeof n.style<"u"&&!Nc(n)},Nc=function(n){return typeof n.className=="object"},vN=function(n){return n.tagName==="LI"},yN=function(n){return n.tagName==="OL"},bN=function(n){return n.tagName==="INPUT"},_N=function(n){return n.tagName==="HTML"},$b=function(n){return n.tagName==="svg"},Rh=function(n){return n.tagName==="BODY"},Hb=function(n){return n.tagName==="CANVAS"},Kb=function(n){return n.tagName==="VIDEO"},Ph=function(n){return n.tagName==="IMG"},Yb=function(n){return n.tagName==="IFRAME"},Xb=function(n){return n.tagName==="STYLE"},kN=function(n){return n.tagName==="SCRIPT"},Dc=function(n){return n.tagName==="TEXTAREA"},Lc=function(n){return n.tagName==="SELECT"},Jb=function(n){return n.tagName==="SLOT"},Zb=function(n){return n.tagName.indexOf("-")>0},SN=function(){function n(){this.counters={}}return n.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},n.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},n.prototype.pop=function(e){var t=this;e.forEach(function(i){return t.counters[i].pop()})},n.prototype.parse=function(e){var t=this,i=e.counterIncrement,r=e.counterReset,o=!0;i!==null&&i.forEach(function(a){var c=t.counters[a.counter];c&&a.increment!==0&&(o=!1,c.length||c.push(1),c[Math.max(0,c.length-1)]+=a.increment)});var s=[];return o&&r.forEach(function(a){var c=t.counters[a.counter];s.push(a.counter),c||(c=t.counters[a.counter]=[]),c.push(a.reset)}),s},n}(),Qb={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},e_={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u0554","\u0553","\u0552","\u0551","\u0550","\u054F","\u054E","\u054D","\u054C","\u054B","\u054A","\u0549","\u0548","\u0547","\u0546","\u0545","\u0544","\u0543","\u0542","\u0541","\u0540","\u053F","\u053E","\u053D","\u053C","\u053B","\u053A","\u0539","\u0538","\u0537","\u0536","\u0535","\u0534","\u0533","\u0532","\u0531"]},wN={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["\u05D9\u05F3","\u05D8\u05F3","\u05D7\u05F3","\u05D6\u05F3","\u05D5\u05F3","\u05D4\u05F3","\u05D3\u05F3","\u05D2\u05F3","\u05D1\u05F3","\u05D0\u05F3","\u05EA","\u05E9","\u05E8","\u05E7","\u05E6","\u05E4","\u05E2","\u05E1","\u05E0","\u05DE","\u05DC","\u05DB","\u05D9\u05D8","\u05D9\u05D7","\u05D9\u05D6","\u05D8\u05D6","\u05D8\u05D5","\u05D9","\u05D8","\u05D7","\u05D6","\u05D5","\u05D4","\u05D3","\u05D2","\u05D1","\u05D0"]},CN={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u10F5","\u10F0","\u10EF","\u10F4","\u10EE","\u10ED","\u10EC","\u10EB","\u10EA","\u10E9","\u10E8","\u10E7","\u10E6","\u10E5","\u10E4","\u10F3","\u10E2","\u10E1","\u10E0","\u10DF","\u10DE","\u10DD","\u10F2","\u10DC","\u10DB","\u10DA","\u10D9","\u10D8","\u10D7","\u10F1","\u10D6","\u10D5","\u10D4","\u10D3","\u10D2","\u10D1","\u10D0"]},$r=function(n,e,t,i,r,o){return n<e||n>t?as(n,r,o.length>0):i.integers.reduce(function(s,a,c){for(;n>=a;)n-=a,s+=i.values[c];return s},"")+o},t_=function(n,e,t,i){var r="";do t||n--,r=i(n)+r,n/=e;while(n*e>=e);return r},it=function(n,e,t,i,r){var o=t-e+1;return(n<0?"-":"")+(t_(Math.abs(n),o,i,function(s){return nt(Math.floor(s%o)+e)})+r)},Zi=function(n,e,t){t===void 0&&(t=". ");var i=e.length;return t_(Math.abs(n),i,!1,function(r){return e[Math.floor(r%i)]})+t},Hr=1,Si=2,wi=4,ss=8,$n=function(n,e,t,i,r,o){if(n<-9999||n>9999)return as(n,4,r.length>0);var s=Math.abs(n),a=r;if(s===0)return e[0]+a;for(var c=0;s>0&&c<=4;c++){var u=s%10;u===0&&ut(o,Hr)&&a!==""?a=e[u]+a:u>1||u===1&&c===0||u===1&&c===1&&ut(o,Si)||u===1&&c===1&&ut(o,wi)&&n>100||u===1&&c>1&&ut(o,ss)?a=e[u]+(c>0?t[c-1]:"")+a:u===1&&c>0&&(a=t[c-1]+a),s=Math.floor(s/10)}return(n<0?i:"")+a},n_="\u5341\u767E\u5343\u842C",i_="\u62FE\u4F70\u4EDF\u842C",r_="\u30DE\u30A4\u30CA\u30B9",Oh="\uB9C8\uC774\uB108\uC2A4",as=function(n,e,t){var i=t?". ":"",r=t?"\u3001":"",o=t?", ":"",s=t?" ":"";switch(e){case 0:return"\u2022"+s;case 1:return"\u25E6"+s;case 2:return"\u25FE"+s;case 5:var a=it(n,48,57,!0,i);return a.length<4?"0".concat(a):a;case 4:return Zi(n,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",r);case 6:return $r(n,1,3999,Qb,3,i).toLowerCase();case 7:return $r(n,1,3999,Qb,3,i);case 8:return it(n,945,969,!1,i);case 9:return it(n,97,122,!1,i);case 10:return it(n,65,90,!1,i);case 11:return it(n,1632,1641,!0,i);case 12:case 49:return $r(n,1,9999,e_,3,i);case 35:return $r(n,1,9999,e_,3,i).toLowerCase();case 13:return it(n,2534,2543,!0,i);case 14:case 30:return it(n,6112,6121,!0,i);case 15:return Zi(n,"\u5B50\u4E11\u5BC5\u536F\u8FB0\u5DF3\u5348\u672A\u7533\u9149\u620C\u4EA5",r);case 16:return Zi(n,"\u7532\u4E59\u4E19\u4E01\u620A\u5DF1\u5E9A\u8F9B\u58EC\u7678",r);case 17:case 48:return $n(n,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",n_,"\u8CA0",r,Si|wi|ss);case 47:return $n(n,"\u96F6\u58F9\u8CB3\u53C3\u8086\u4F0D\u9678\u67D2\u634C\u7396",i_,"\u8CA0",r,Hr|Si|wi|ss);case 42:return $n(n,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",n_,"\u8D1F",r,Si|wi|ss);case 41:return $n(n,"\u96F6\u58F9\u8D30\u53C1\u8086\u4F0D\u9646\u67D2\u634C\u7396",i_,"\u8D1F",r,Hr|Si|wi|ss);case 26:return $n(n,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u4E07",r_,r,0);case 25:return $n(n,"\u96F6\u58F1\u5F10\u53C2\u56DB\u4F0D\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343\u4E07",r_,r,Hr|Si|wi);case 31:return $n(n,"\uC601\uC77C\uC774\uC0BC\uC0AC\uC624\uC721\uCE60\uD314\uAD6C","\uC2ED\uBC31\uCC9C\uB9CC",Oh,o,Hr|Si|wi);case 33:return $n(n,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u842C",Oh,o,0);case 32:return $n(n,"\u96F6\u58F9\u8CB3\u53C3\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343",Oh,o,Hr|Si|wi);case 18:return it(n,2406,2415,!0,i);case 20:return $r(n,1,19999,CN,3,i);case 21:return it(n,2790,2799,!0,i);case 22:return it(n,2662,2671,!0,i);case 52:return $r(n,1,10999,wN,3,i);case 23:return Zi(n,"\u3042\u3044\u3046\u3048\u304A\u304B\u304D\u304F\u3051\u3053\u3055\u3057\u3059\u305B\u305D\u305F\u3061\u3064\u3066\u3068\u306A\u306B\u306C\u306D\u306E\u306F\u3072\u3075\u3078\u307B\u307E\u307F\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308A\u308B\u308C\u308D\u308F\u3090\u3091\u3092\u3093");case 24:return Zi(n,"\u3044\u308D\u306F\u306B\u307B\u3078\u3068\u3061\u308A\u306C\u308B\u3092\u308F\u304B\u3088\u305F\u308C\u305D\u3064\u306D\u306A\u3089\u3080\u3046\u3090\u306E\u304A\u304F\u3084\u307E\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304D\u3086\u3081\u307F\u3057\u3091\u3072\u3082\u305B\u3059");case 27:return it(n,3302,3311,!0,i);case 28:return Zi(n,"\u30A2\u30A4\u30A6\u30A8\u30AA\u30AB\u30AD\u30AF\u30B1\u30B3\u30B5\u30B7\u30B9\u30BB\u30BD\u30BF\u30C1\u30C4\u30C6\u30C8\u30CA\u30CB\u30CC\u30CD\u30CE\u30CF\u30D2\u30D5\u30D8\u30DB\u30DE\u30DF\u30E0\u30E1\u30E2\u30E4\u30E6\u30E8\u30E9\u30EA\u30EB\u30EC\u30ED\u30EF\u30F0\u30F1\u30F2\u30F3",r);case 29:return Zi(n,"\u30A4\u30ED\u30CF\u30CB\u30DB\u30D8\u30C8\u30C1\u30EA\u30CC\u30EB\u30F2\u30EF\u30AB\u30E8\u30BF\u30EC\u30BD\u30C4\u30CD\u30CA\u30E9\u30E0\u30A6\u30F0\u30CE\u30AA\u30AF\u30E4\u30DE\u30B1\u30D5\u30B3\u30A8\u30C6\u30A2\u30B5\u30AD\u30E6\u30E1\u30DF\u30B7\u30F1\u30D2\u30E2\u30BB\u30B9",r);case 34:return it(n,3792,3801,!0,i);case 37:return it(n,6160,6169,!0,i);case 38:return it(n,4160,4169,!0,i);case 39:return it(n,2918,2927,!0,i);case 40:return it(n,1776,1785,!0,i);case 43:return it(n,3046,3055,!0,i);case 44:return it(n,3174,3183,!0,i);case 45:return it(n,3664,3673,!0,i);case 46:return it(n,3872,3881,!0,i);case 3:default:return it(n,48,57,!0,i)}},o_="data-html2canvas-ignore",s_=function(){function n(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new SN,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return n.prototype.toIFrame=function(e,t){var i=this,r=TN(e,t);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var o=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,a=r.contentWindow,c=a.document,u=IN(r).then(function(){return Mt(i,void 0,void 0,function(){var h,p;return xt(this,function(m){switch(m.label){case 0:return this.scrolledElements.forEach(AN),a&&(a.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(a.scrollY!==t.top||a.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(a.scrollX-t.left,a.scrollY-t.top,0,0))),h=this.options.onclone,p=this.clonedReferenceElement,typeof p>"u"?[2,Promise.reject("Error finding the ".concat(this.referenceElement.nodeName," in the cloned document"))]:c.fonts&&c.fonts.ready?[4,c.fonts.ready]:[3,2];case 1:m.sent(),m.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,EN(c)]:[3,4];case 3:m.sent(),m.label=4;case 4:return typeof h=="function"?[2,Promise.resolve().then(function(){return h(c,p)}).then(function(){return r})]:[2,r]}})})}),l=c.baseURI;c.open(),c.write("".concat(PN(document.doctype),"<html></html>")),ON(this.referenceElement.ownerDocument,o,s);var d=c.adoptNode(this.documentElement);return UN(d,l),c.replaceChild(d,c.documentElement),c.close(),u},n.prototype.createElementClone=function(e){if(vh(e,2),Hb(e))return this.createCanvasClone(e);if(Kb(e))return this.createVideoClone(e);if(Xb(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Ph(t)&&(Ph(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Zb(t)?this.createCustomElementClone(t):t},n.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Ah(e.style,t),t},n.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].slice.call(t.cssRules,0).reduce(function(o,s){return s&&typeof s.cssText=="string"?o+s.cssText:o},""),r=e.cloneNode(!1);return r.textContent=i,r}}catch(o){if(this.context.logger.error("Unable to access cssRules property",o),o.name!=="SecurityError")throw o}return e.cloneNode(!1)},n.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var o=e.getContext("2d"),s=r.getContext("2d",{willReadFrequently:!0});if(s)if(!this.options.allowTaint&&o)s.putImageData(o.getImageData(0,0,e.width,e.height),0,0);else{var a=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(a){var c=a.getContextAttributes();(c==null?void 0:c.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return r}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},n.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},n.prototype.appendChildNode=function(e,t,i){(!Gr(t)||!kN(t)&&!t.hasAttribute(o_)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Gr(t)||!Xb(t))&&e.appendChild(this.cloneNode(t,i))},n.prototype.cloneChildNodes=function(e,t,i){for(var r=this,o=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;o;o=o.nextSibling)if(Gr(o)&&Jb(o)&&typeof o.assignedNodes=="function"){var s=o.assignedNodes();s.length&&s.forEach(function(a){return r.appendChildNode(t,a,i)})}else this.appendChildNode(t,o,i)},n.prototype.cloneNode=function(e,t){if(Gb(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&Gr(e)&&(Ih(e)||Nc(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var o=i.getComputedStyle(e),s=i.getComputedStyle(e,":before"),a=i.getComputedStyle(e,":after");this.referenceElement===e&&Ih(r)&&(this.clonedReferenceElement=r),Rh(r)&&DN(r);var c=this.counters.parse(new Sb(this.context,o)),u=this.resolvePseudoContent(e,r,s,cs.BEFORE);Zb(e)&&(t=!0),Kb(e)||this.cloneChildNodes(e,r,t),u&&r.insertBefore(u,r.firstChild);var l=this.resolvePseudoContent(e,r,a,cs.AFTER);return l&&r.appendChild(l),this.counters.pop(c),(o&&(this.options.copyStyles||Nc(e))&&!Yb(e)||t)&&Ah(o,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Dc(e)||Lc(e))&&(Dc(r)||Lc(r))&&(r.value=e.value),r}return e.cloneNode(!1)},n.prototype.resolvePseudoContent=function(e,t,i,r){var o=this;if(i){var s=i.content,a=t.ownerDocument;if(!(!a||!s||s==="none"||s==="-moz-alt-content"||i.display==="none")){this.counters.parse(new Sb(this.context,i));var c=new NM(this.context,i),u=a.createElement("html2canvaspseudoelement");Ah(i,u),c.content.forEach(function(d){if(d.type===0)u.appendChild(a.createTextNode(d.value));else if(d.type===22){var h=a.createElement("img");h.src=d.value,h.style.opacity="1",u.appendChild(h)}else if(d.type===18){if(d.name==="attr"){var p=d.values.filter(ue);p.length&&u.appendChild(a.createTextNode(e.getAttribute(p[0].value)||""))}else if(d.name==="counter"){var m=d.values.filter(vt),f=m[0],g=m[1];if(f&&ue(f)){var y=o.counters.getCounterValue(f.value),b=g&&ue(g)?gh.parse(o.context,g.value):3;u.appendChild(a.createTextNode(as(y,b,!1)))}}else if(d.name==="counters"){var S=d.values.filter(vt),f=S[0],w=S[1],g=S[2];if(f&&ue(f)){var k=o.counters.getCounterValues(f.value),C=g&&ue(g)?gh.parse(o.context,g.value):3,x=w&&w.type===0?w.value:"",I=k.map(function(O){return as(O,C,!1)}).join(x);u.appendChild(a.createTextNode(I))}}}else if(d.type===20)switch(d.value){case"open-quote":u.appendChild(a.createTextNode(kb(c.quotes,o.quoteDepth++,!0)));break;case"close-quote":u.appendChild(a.createTextNode(kb(c.quotes,--o.quoteDepth,!1)));break;default:u.appendChild(a.createTextNode(d.value))}}),u.className="".concat(Mh," ").concat(Nh);var l=r===cs.BEFORE?" ".concat(Mh):" ".concat(Nh);return Nc(t)?t.className.baseValue+=l:t.className+=l,u}}},n.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},n}(),cs;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER"})(cs||(cs={}));var TN=function(n,e){var t=n.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(o_,"true"),n.body.appendChild(t),t},xN=function(n){return new Promise(function(e){if(n.complete){e();return}if(!n.src){e();return}n.onload=e,n.onerror=e})},EN=function(n){return Promise.all([].slice.call(n.images,0).map(xN))},IN=function(n){return new Promise(function(e,t){var i=n.contentWindow;if(!i)return t("No window assigned for iframe");var r=i.document;i.onload=n.onload=function(){i.onload=n.onload=null;var o=setInterval(function(){r.body.childNodes.length>0&&r.readyState==="complete"&&(clearInterval(o),e(n))},50)}})},RN=["all","d","content"],Ah=function(n,e){for(var t=n.length-1;t>=0;t--){var i=n.item(t);RN.indexOf(i)===-1&&e.style.setProperty(i,n.getPropertyValue(i))}return e},PN=function(n){var e="";return n&&(e+="<!DOCTYPE ",n.name&&(e+=n.name),n.internalSubset&&(e+=n.internalSubset),n.publicId&&(e+='"'.concat(n.publicId,'"')),n.systemId&&(e+='"'.concat(n.systemId,'"')),e+=">"),e},ON=function(n,e,t){n&&n.defaultView&&(e!==n.defaultView.pageXOffset||t!==n.defaultView.pageYOffset)&&n.defaultView.scrollTo(e,t)},AN=function(n){var e=n[0],t=n[1],i=n[2];e.scrollLeft=t,e.scrollTop=i},MN=":before",NN=":after",Mh="___html2canvas___pseudoelement_before",Nh="___html2canvas___pseudoelement_after",a_=`{
80
80
  content: "" !important;
81
81
  display: none !important;
82
82
  }`,DN=function(n){LN(n,".".concat(Mh).concat(MN).concat(a_,`
@@ -118,4 +118,4 @@ a=extmap-allow-mixed`)!==-1){const o=r.sdp.split(`
118
118
  `);n.RTCSessionDescription&&r instanceof n.RTCSessionDescription?arguments[0]=new n.RTCSessionDescription({type:r.type,sdp:o}):r.sdp=o}return t.apply(this,arguments)}}function du(n,e){if(!(n.RTCPeerConnection&&n.RTCPeerConnection.prototype))return;const t=n.RTCPeerConnection.prototype.addIceCandidate;!t||t.length===0||(n.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():t.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function hu(n,e){if(!(n.RTCPeerConnection&&n.RTCPeerConnection.prototype))return;const t=n.RTCPeerConnection.prototype.setLocalDescription;!t||t.length===0||(n.RTCPeerConnection.prototype.setLocalDescription=function(){let r=arguments[0]||{};if(typeof r!="object"||r.type&&r.sdp)return t.apply(this,arguments);if(r={type:r.type,sdp:r.sdp},!r.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":r.type="offer";break;default:r.type="answer";break}return r.sdp||r.type!=="offer"&&r.type!=="answer"?t.apply(this,[r]):(r.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(s=>t.apply(this,[s]))})}var d3=Object.freeze({__proto__:null,removeExtmapAllowMixed:pp,shimAddIceCandidateNullOrEmpty:du,shimConnectionState:hp,shimMaxMessageSize:uu,shimParameterlessSetLocalDescription:hu,shimRTCIceCandidate:cu,shimRTCIceCandidateRelayProtocol:dp,shimSendThrowTypeError:lu});function h3(){let{window:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const t=Ek,i=a3(n),r={browserDetails:i,commonShim:d3,extractVersion:au,disableLog:o3,disableWarnings:s3,sdp:l3};switch(i.browser){case"chrome":if(!jk||!cp||!e.shimChrome)return t("Chrome shim is not included in this adapter release."),r;if(i.version===null)return t("Chrome shim can not determine version, not shimming."),r;t("adapter.js shimming chrome."),r.browserShim=jk,du(n,i),hu(n),Ak(n,i),Mk(n),cp(n,i),Nk(n),Fk(n,i),Dk(n),Lk(n),Bk(n,i),cu(n),dp(n),hp(n),uu(n,i),lu(n),pp(n,i);break;case"firefox":if(!Jk||!up||!e.shimFirefox)return t("Firefox shim is not included in this adapter release."),r;t("adapter.js shimming firefox."),r.browserShim=Jk,du(n,i),hu(n),Vk(n,i),up(n,i),zk(n),Gk(n),qk(n),Wk(n),$k(n),Hk(n),Kk(n),Yk(n),Xk(n),cu(n),hp(n),uu(n,i),lu(n);break;case"safari":if(!aS||!e.shimSafari)return t("Safari shim is not included in this adapter release."),r;t("adapter.js shimming safari."),r.browserShim=aS,du(n,i),hu(n),iS(n),oS(n),eS(n),Zk(n),Qk(n),rS(n),tS(n),sS(n),cu(n),dp(n),uu(n,i),lu(n),pp(n,i);break;default:t("Unsupported browser!");break}return r}h3({window:typeof window>"u"?void 0:window});const p3=10,pu="lk_e2ee",f3={sharedKey:!1,ratchetSalt:"LKFrameEncryptionKey",ratchetWindowSize:8,failureTolerance:p3,keyringSize:16};var Ei;(function(n){n.SetKey="setKey",n.RatchetRequest="ratchetRequest",n.KeyRatcheted="keyRatcheted"})(Ei||(Ei={}));var lS;(function(n){n.KeyRatcheted="keyRatcheted"})(lS||(lS={}));var Ii;(function(n){n.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",n.EncryptionError="encryptionError"})(Ii||(Ii={}));var dS;(function(n){n.Error="cryptorError"})(dS||(dS={}));function m3(){return g3()||fp()}function fp(){return typeof window.RTCRtpScriptTransform<"u"}function g3(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}class g4 extends Mn.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(t,i,r)=>{le.debug("key ratcheted event received",{ratchetResult:t,participantId:i,keyIndex:r})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},f3),e),this.on(Ei.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,t,i){const r={key:e,participantIdentity:t,keyIndex:i};if(!this.options.sharedKey&&!t)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(t??"shared","-").concat(i??0),r),this.emit(Ei.SetKey,r)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,t){this.emit(Ei.RatchetRequest,e,t)}}class Ri extends Error{constructor(e,t){super(t||"an error has occured"),this.name="LiveKitError",this.code=e}}var pe;(function(n){n[n.NotAllowed=0]="NotAllowed",n[n.ServerUnreachable=1]="ServerUnreachable",n[n.InternalError=2]="InternalError",n[n.Cancelled=3]="Cancelled",n[n.LeaveRequest=4]="LeaveRequest"})(pe||(pe={}));class Ae extends Ri{constructor(e,t,i,r){super(1,e),this.name="ConnectionError",this.status=i,this.reason=t,this.context=r,this.reasonName=pe[t]}}class mp extends Ri{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class Yn extends Ri{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class v3 extends Ri{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class lt extends Ri{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class gp extends Ri{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class vp extends Ri{constructor(e,t){super(15,e),this.name="PublishTrackError",this.status=t}}class hS extends Ri{constructor(e,t){super(15,e),this.reason=t,this.reasonName=typeof t=="string"?t:rp[t]}}var fu;(function(n){n.PermissionDenied="PermissionDenied",n.NotFound="NotFound",n.DeviceInUse="DeviceInUse",n.Other="Other"})(fu||(fu={})),function(n){function e(t){if(t&&"name"in t)return t.name==="NotFoundError"||t.name==="DevicesNotFoundError"?n.NotFound:t.name==="NotAllowedError"||t.name==="PermissionDeniedError"?n.PermissionDenied:t.name==="NotReadableError"||t.name==="TrackStartError"?n.DeviceInUse:n.Other}n.getFailure=e}(fu||(fu={}));var pS;(function(n){n[n.InvalidKey=0]="InvalidKey",n[n.MissingKey=1]="MissingKey",n[n.InternalError=2]="InternalError"})(pS||(pS={}));var U;(function(n){n.Connected="connected",n.Reconnecting="reconnecting",n.SignalReconnecting="signalReconnecting",n.Reconnected="reconnected",n.Disconnected="disconnected",n.ConnectionStateChanged="connectionStateChanged",n.Moved="moved",n.MediaDevicesChanged="mediaDevicesChanged",n.ParticipantConnected="participantConnected",n.ParticipantDisconnected="participantDisconnected",n.TrackPublished="trackPublished",n.TrackSubscribed="trackSubscribed",n.TrackSubscriptionFailed="trackSubscriptionFailed",n.TrackUnpublished="trackUnpublished",n.TrackUnsubscribed="trackUnsubscribed",n.TrackMuted="trackMuted",n.TrackUnmuted="trackUnmuted",n.LocalTrackPublished="localTrackPublished",n.LocalTrackUnpublished="localTrackUnpublished",n.LocalAudioSilenceDetected="localAudioSilenceDetected",n.ActiveSpeakersChanged="activeSpeakersChanged",n.ParticipantMetadataChanged="participantMetadataChanged",n.ParticipantNameChanged="participantNameChanged",n.ParticipantAttributesChanged="participantAttributesChanged",n.ParticipantActive="participantActive",n.RoomMetadataChanged="roomMetadataChanged",n.DataReceived="dataReceived",n.SipDTMFReceived="sipDTMFReceived",n.TranscriptionReceived="transcriptionReceived",n.ConnectionQualityChanged="connectionQualityChanged",n.TrackStreamStateChanged="trackStreamStateChanged",n.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",n.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",n.AudioPlaybackStatusChanged="audioPlaybackChanged",n.VideoPlaybackStatusChanged="videoPlaybackChanged",n.MediaDevicesError="mediaDevicesError",n.ParticipantPermissionsChanged="participantPermissionsChanged",n.SignalConnected="signalConnected",n.RecordingStatusChanged="recordingStatusChanged",n.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",n.EncryptionError="encryptionError",n.DCBufferStatusChanged="dcBufferStatusChanged",n.ActiveDeviceChanged="activeDeviceChanged",n.ChatMessage="chatMessage",n.LocalTrackSubscribed="localTrackSubscribed",n.MetricsReceived="metricsReceived"})(U||(U={}));var z;(function(n){n.TrackPublished="trackPublished",n.TrackSubscribed="trackSubscribed",n.TrackSubscriptionFailed="trackSubscriptionFailed",n.TrackUnpublished="trackUnpublished",n.TrackUnsubscribed="trackUnsubscribed",n.TrackMuted="trackMuted",n.TrackUnmuted="trackUnmuted",n.LocalTrackPublished="localTrackPublished",n.LocalTrackUnpublished="localTrackUnpublished",n.ParticipantMetadataChanged="participantMetadataChanged",n.ParticipantNameChanged="participantNameChanged",n.DataReceived="dataReceived",n.SipDTMFReceived="sipDTMFReceived",n.TranscriptionReceived="transcriptionReceived",n.IsSpeakingChanged="isSpeakingChanged",n.ConnectionQualityChanged="connectionQualityChanged",n.TrackStreamStateChanged="trackStreamStateChanged",n.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",n.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",n.MediaDevicesError="mediaDevicesError",n.AudioStreamAcquired="audioStreamAcquired",n.ParticipantPermissionsChanged="participantPermissionsChanged",n.PCTrackAdded="pcTrackAdded",n.AttributesChanged="attributesChanged",n.LocalTrackSubscribed="localTrackSubscribed",n.ChatMessage="chatMessage",n.Active="active"})(z||(z={}));var B;(function(n){n.TransportsCreated="transportsCreated",n.Connected="connected",n.Disconnected="disconnected",n.Resuming="resuming",n.Resumed="resumed",n.Restarting="restarting",n.Restarted="restarted",n.SignalResumed="signalResumed",n.SignalRestarted="signalRestarted",n.Closing="closing",n.MediaTrackAdded="mediaTrackAdded",n.ActiveSpeakersUpdate="activeSpeakersUpdate",n.DataPacketReceived="dataPacketReceived",n.RTPVideoMapUpdate="rtpVideoMapUpdate",n.DCBufferStatusChanged="dcBufferStatusChanged",n.ParticipantUpdate="participantUpdate",n.RoomUpdate="roomUpdate",n.SpeakersChanged="speakersChanged",n.StreamStateChanged="streamStateChanged",n.ConnectionQualityUpdate="connectionQualityUpdate",n.SubscriptionError="subscriptionError",n.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",n.RemoteMute="remoteMute",n.SubscribedQualityUpdate="subscribedQualityUpdate",n.LocalTrackUnpublished="localTrackUnpublished",n.LocalTrackSubscribed="localTrackSubscribed",n.Offline="offline",n.SignalRequestResponse="signalRequestResponse",n.SignalConnected="signalConnected",n.RoomMoved="roomMoved"})(B||(B={}));var F;(function(n){n.Message="message",n.Muted="muted",n.Unmuted="unmuted",n.Restarted="restarted",n.Ended="ended",n.Subscribed="subscribed",n.Unsubscribed="unsubscribed",n.UpdateSettings="updateSettings",n.UpdateSubscription="updateSubscription",n.AudioPlaybackStarted="audioPlaybackStarted",n.AudioPlaybackFailed="audioPlaybackFailed",n.AudioSilenceDetected="audioSilenceDetected",n.VisibilityChanged="visibilityChanged",n.VideoDimensionsChanged="videoDimensionsChanged",n.VideoPlaybackStarted="videoPlaybackStarted",n.VideoPlaybackFailed="videoPlaybackFailed",n.ElementAttached="elementAttached",n.ElementDetached="elementDetached",n.UpstreamPaused="upstreamPaused",n.UpstreamResumed="upstreamResumed",n.SubscriptionPermissionChanged="subscriptionPermissionChanged",n.SubscriptionStatusChanged="subscriptionStatusChanged",n.SubscriptionFailed="subscriptionFailed",n.TrackProcessorUpdate="trackProcessorUpdate",n.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",n.TranscriptionReceived="transcriptionReceived",n.TimeSyncUpdate="timeSyncUpdate"})(F||(F={}));function y3(n){return typeof n>"u"?n:typeof structuredClone=="function"?structuredClone(n):JSON.parse(JSON.stringify(n))}const b3=/version\/(\d+(\.?_?\d+)+)/i;let yp;function fn(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof n>"u"&&typeof navigator>"u")return;const t=(n??navigator.userAgent).toLowerCase();if(yp===void 0||e){const i=_3.find(r=>{let{test:o}=r;return o.test(t)});yp=i==null?void 0:i.describe(t)}return yp}const _3=[{test:/firefox|iceweasel|fxios/i,describe(n){return{name:"Firefox",version:mu(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,n),os:n.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:bp(n)}}},{test:/chrom|crios|crmo/i,describe(n){return{name:"Chrome",version:mu(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,n),os:n.toLowerCase().includes("crios")?"iOS":void 0,osVersion:bp(n)}}},{test:/safari|applewebkit/i,describe(n){return{name:"Safari",version:mu(b3,n),os:n.includes("mobile/")?"iOS":"macOS",osVersion:bp(n)}}}];function mu(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const i=e.match(n);return i&&i.length>=t&&i[t]||""}function bp(n){return n.includes("mac os")?mu(/\(.+?(\d+_\d+(:?_\d+)?)/,n,1).replace(/_/g,"."):void 0}var k3="2.13.0";const S3=k3,w3=16;class _t{}_t.setTimeout=function(){return setTimeout(...arguments)},_t.setInterval=function(){return setInterval(...arguments)},_t.clearTimeout=function(){return clearTimeout(...arguments)},_t.clearInterval=function(){return clearInterval(...arguments)};const C3=5e3,ms=[];var en;(function(n){n[n.LOW=0]="LOW",n[n.MEDIUM=1]="MEDIUM",n[n.HIGH=2]="HIGH"})(en||(en={}));class N extends Mn.EventEmitter{constructor(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r;super(),this.attachedElements=[],this.isMuted=!1,this.streamState=N.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=le,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),C3):this.handleAppVisibilityChanged()},this.log=Kn((r=i.loggerName)!==null&&r!==void 0?r:pn.Track),this.loggerContextCb=i.loggerContextCb,this.setMaxListeners(100),this.kind=t,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=N.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),Ce(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let t="audio";this.kind===N.Kind.Video&&(t="video"),this.attachedElements.length===0&&this.kind===N.Kind.Video&&this.addAppVisibilityListener(),e||(t==="audio"&&(ms.forEach(o=>{o.parentElement===null&&!e&&(e=o)}),e&&ms.splice(ms.indexOf(e),1)),e||(e=document.createElement(t))),this.attachedElements.includes(e)||this.attachedElements.push(e),oo(this.mediaStreamTrack,e);const i=e.srcObject.getTracks(),r=i.some(o=>o.kind==="audio");return e.play().then(()=>{this.emit(r?F.AudioPlaybackStarted:F.VideoPlaybackStarted)}).catch(o=>{o.name==="NotAllowedError"?this.emit(r?F.AudioPlaybackFailed:F.VideoPlaybackFailed,o):o.name==="AbortError"?le.debug("".concat(r?"audio":"video"," playback aborted, likely due to new play request")):le.warn("could not playback ".concat(r?"audio":"video"),o),r&&e&&i.some(s=>s.kind==="video")&&o.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(F.ElementAttached,e),e}detach(e){try{if(e){so(this.mediaStreamTrack,e);const i=this.attachedElements.indexOf(e);return i>=0&&(this.attachedElements.splice(i,1),this.recycleElement(e),this.emit(F.ElementDetached,e)),e}const t=[];return this.attachedElements.forEach(i=>{so(this.mediaStreamTrack,i),t.push(i),this.recycleElement(i),this.emit(F.ElementDetached,i)}),this.attachedElements=[],t}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=Kn(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let t=!0;e.pause(),ms.forEach(i=>{i.parentElement||(t=!1)}),t&&ms.push(e)}}handleAppVisibilityChanged(){return T(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===N.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){Wt()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){Wt()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function oo(n,e){let t;e.srcObject instanceof MediaStream?t=e.srcObject:t=new MediaStream;let i;n.kind==="audio"?i=t.getAudioTracks():i=t.getVideoTracks(),i.includes(n)||(i.forEach(r=>{t.removeTrack(r)}),t.addTrack(n)),(!Pi()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=t.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==t&&(e.srcObject=t,(Pi()||ao())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=t,e.play().catch(()=>{})},0))}function so(n,e){if(e.srcObject instanceof MediaStream){const t=e.srcObject;t.removeTrack(n),t.getTracks().length>0?e.srcObject=t:e.srcObject=null}}(function(n){let e;(function(u){u.Audio="audio",u.Video="video",u.Unknown="unknown"})(e=n.Kind||(n.Kind={}));let t;(function(u){u.Camera="camera",u.Microphone="microphone",u.ScreenShare="screen_share",u.ScreenShareAudio="screen_share_audio",u.Unknown="unknown"})(t=n.Source||(n.Source={}));let i;(function(u){u.Active="active",u.Paused="paused",u.Unknown="unknown"})(i=n.StreamState||(n.StreamState={}));function r(u){switch(u){case e.Audio:return un.AUDIO;case e.Video:return un.VIDEO;default:return un.DATA}}n.kindToProto=r;function o(u){switch(u){case un.AUDIO:return e.Audio;case un.VIDEO:return e.Video;default:return e.Unknown}}n.kindFromProto=o;function s(u){switch(u){case t.Camera:return at.CAMERA;case t.Microphone:return at.MICROPHONE;case t.ScreenShare:return at.SCREEN_SHARE;case t.ScreenShareAudio:return at.SCREEN_SHARE_AUDIO;default:return at.UNKNOWN}}n.sourceToProto=s;function a(u){switch(u){case at.CAMERA:return t.Camera;case at.MICROPHONE:return t.Microphone;case at.SCREEN_SHARE:return t.ScreenShare;case at.SCREEN_SHARE_AUDIO:return t.ScreenShareAudio;default:return t.Unknown}}n.sourceFromProto=a;function c(u){switch(u){case Jh.ACTIVE:return i.Active;case Jh.PAUSED:return i.Paused;default:return i.Unknown}}n.streamStateFromProto=c})(N||(N={}));class Re{constructor(e,t,i,r,o){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(t!==void 0&&i!==void 0)this.width=e,this.height=t,this.aspectRatio=e/t,this.encoding={maxBitrate:i,maxFramerate:r,priority:o};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const T3=["vp8","h264"],x3=["vp8","h264","vp9","av1"];function E3(n){return!!T3.find(e=>e===n)}var fS;(function(n){n[n.PREFER_REGRESSION=0]="PREFER_REGRESSION",n[n.SIMULCAST=1]="SIMULCAST",n[n.REGRESSION=2]="REGRESSION"})(fS||(fS={}));var _p;(function(n){n.telephone={maxBitrate:12e3},n.speech={maxBitrate:24e3},n.music={maxBitrate:48e3},n.musicStereo={maxBitrate:64e3},n.musicHighQuality={maxBitrate:96e3},n.musicHighQualityStereo={maxBitrate:128e3}})(_p||(_p={}));const gs={h90:new Re(160,90,9e4,20),h180:new Re(320,180,16e4,20),h216:new Re(384,216,18e4,20),h360:new Re(640,360,45e4,20),h540:new Re(960,540,8e5,25),h720:new Re(1280,720,17e5,30),h1080:new Re(1920,1080,3e6,30),h1440:new Re(2560,1440,5e6,30),h2160:new Re(3840,2160,8e6,30)},kp={h120:new Re(160,120,7e4,20),h180:new Re(240,180,125e3,20),h240:new Re(320,240,14e4,20),h360:new Re(480,360,33e4,20),h480:new Re(640,480,5e5,20),h540:new Re(720,540,6e5,25),h720:new Re(960,720,13e5,30),h1080:new Re(1440,1080,23e5,30),h1440:new Re(1920,1440,38e5,30)},Sp={h360fps3:new Re(640,360,2e5,3,"medium"),h360fps15:new Re(640,360,4e5,15,"medium"),h720fps5:new Re(1280,720,8e5,5,"medium"),h720fps15:new Re(1280,720,15e5,15,"medium"),h720fps30:new Re(1280,720,2e6,30,"medium"),h1080fps15:new Re(1920,1080,25e5,15,"medium"),h1080fps30:new Re(1920,1080,5e6,30,"medium"),original:new Re(0,0,7e6,30,"medium")},I3="|",mS="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function R3(n){const e=n.split(I3);return e.length>1?[e[0],n.substr(e[0].length+1)]:[n,""]}function qt(n){return T(this,void 0,void 0,function*(){return new Promise(e=>_t.setTimeout(e,n))})}function wp(){return"addTransceiver"in RTCPeerConnection.prototype}function Cp(){return"addTrack"in RTCPeerConnection.prototype}function P3(){if(!("getCapabilities"in RTCRtpSender)||Pi())return!1;const n=RTCRtpSender.getCapabilities("video");let e=!1;if(n){for(const t of n.codecs)if(t.mimeType==="video/AV1"){e=!0;break}}return e}function O3(){if(!("getCapabilities"in RTCRtpSender)||ao())return!1;if(Pi()){const t=fn();if(t!=null&&t.version&&rr(t.version,"16")<0)return!1}const n=RTCRtpSender.getCapabilities("video");let e=!1;if(n){for(const t of n.codecs)if(t.mimeType==="video/VP9"){e=!0;break}}return e}function vs(n){return n==="av1"||n==="vp9"}function Tp(n){return document?(n||(n=document.createElement("audio")),"setSinkId"in n):!1}function A3(){return typeof RTCPeerConnection>"u"?!1:wp()||Cp()}function ao(){var n;return((n=fn())===null||n===void 0?void 0:n.name)==="Firefox"}function Pi(){var n;return((n=fn())===null||n===void 0?void 0:n.name)==="Safari"}function M3(){const n=fn();return(n==null?void 0:n.name)==="Safari"&&n.version.startsWith("17.")}function gS(){var n,e;return Wt()?(e=(n=navigator.userAgentData)===null||n===void 0?void 0:n.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function N3(){const n=fn(),e="17.2";if(n)return n.name!=="Safari"&&n.os!=="iOS"||n.os==="iOS"&&n.osVersion&&rr(e,n.osVersion)>=0?!0:n.name==="Safari"&&rr(e,n.version)>=0}function Wt(){return typeof document<"u"}function Nn(){return navigator.product=="ReactNative"}function xp(n){return n.hostname.endsWith(".livekit.cloud")||n.hostname.endsWith(".livekit.run")}function vS(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function yS(){if(!Nn())return;let n=vS();if(n)return n.platform}function bS(){if(Wt())return window.devicePixelRatio;if(Nn()){let n=vS();if(n)return n.devicePixelRatio}return 1}function rr(n,e){const t=n.split("."),i=e.split("."),r=Math.min(t.length,i.length);for(let o=0;o<r;++o){const s=parseInt(t[o],10),a=parseInt(i[o],10);if(s>a)return 1;if(s<a)return-1;if(o===r-1&&s===a)return 0}return n===""&&e!==""?-1:e===""?1:t.length==i.length?0:t.length<i.length?-1:1}function D3(n){for(const e of n)e.target.handleResize(e)}function L3(n){for(const e of n)e.target.handleVisibilityChanged(e)}let Ep=null;const _S=()=>(Ep||(Ep=new ResizeObserver(D3)),Ep);let Ip=null;const kS=()=>(Ip||(Ip=new IntersectionObserver(L3,{root:null,rootMargin:"0px"})),Ip);function U3(){var n;const e=new xL({sdk:ok.JS,protocol:w3,version:S3});return Nn()&&(e.os=(n=yS())!==null&&n!==void 0?n:""),e}function SS(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const r=document.createElement("canvas");r.width=n,r.height=e;const o=r.getContext("2d");o==null||o.fillRect(0,0,r.width,r.height),i&&o&&(o.beginPath(),o.arc(n/2,e/2,50,0,Math.PI*2,!0),o.closePath(),o.fillStyle="grey",o.fill());const s=r.captureStream(),[a]=s.getTracks();if(!a)throw Error("Could not get empty media stream video track");return a.enabled=t,a}let ys;function Rp(){if(!ys){const n=new AudioContext,e=n.createOscillator(),t=n.createGain();t.gain.setValueAtTime(0,0);const i=n.createMediaStreamDestination();if(e.connect(t),t.connect(i),e.start(),[ys]=i.stream.getAudioTracks(),!ys)throw Error("Could not get empty media stream audio track");ys.enabled=!1}return ys.clone()}class Pp{constructor(e,t){this.onFinally=t,this.promise=new Promise((i,r)=>T(this,void 0,void 0,function*(){this.resolve=i,this.reject=r,e&&(yield e(i,r))})).finally(()=>{var i;return(i=this.onFinally)===null||i===void 0?void 0:i.call(this)})}}function F3(n){return x3.includes(n)}function Oi(n){if(typeof n=="string"||typeof n=="number")return n;if(Array.isArray(n))return n[0];if(n.exact)return Array.isArray(n.exact)?n.exact[0]:n.exact;if(n.ideal)return Array.isArray(n.ideal)?n.ideal[0]:n.ideal;throw Error("could not unwrap constraint")}function B3(n){return n.startsWith("http")?n.replace(/^(http)/,"ws"):n}function Op(n){return n.startsWith("ws")?n.replace(/^(ws)/,"http"):n}function j3(n,e){return n.segments.map(t=>{let{id:i,text:r,language:o,startTime:s,endTime:a,final:c}=t;var u;const l=(u=e.get(i))!==null&&u!==void 0?u:Date.now(),d=Date.now();return c?e.delete(i):e.set(i,l),{id:i,text:r,startTime:Number.parseInt(s.toString()),endTime:Number.parseInt(a.toString()),final:c,language:o,firstReceivedTime:l,lastReceivedTime:d}})}function V3(n){const{id:e,timestamp:t,message:i,editTimestamp:r}=n;return{id:e,timestamp:Number.parseInt(t.toString()),editTimestamp:r?Number.parseInt(r.toString()):void 0,message:i}}function wS(n){switch(n.reason){case pe.LeaveRequest:return n.context;case pe.Cancelled:return ln.CLIENT_INITIATED;case pe.NotAllowed:return ln.USER_REJECTED;case pe.ServerUnreachable:return ln.JOIN_FAILURE;default:return ln.UNKNOWN_REASON}}function gu(n){return n!==void 0?Number(n):void 0}function or(n){return n!==void 0?BigInt(n):void 0}function co(n){return!!n&&!(n instanceof MediaStreamTrack)&&n.isLocal}function Xn(n){return!!n&&n.kind==N.Kind.Audio}function uo(n){return!!n&&n.kind==N.Kind.Video}function Ai(n){return co(n)&&uo(n)}function sr(n){return co(n)&&Xn(n)}function Ap(n){return!!n&&!n.isLocal}function z3(n){return!!n&&!n.isLocal}function Mp(n){return Ap(n)&&uo(n)}function q3(n){return n.isLocal}function W3(n,e){const t=[];let i=new TextEncoder().encode(n);for(;i.length>e;){let r=e;for(;r>0;){const o=i[r];if(o!==void 0&&(o&192)!==128)break;r--}t.push(i.slice(0,r)),i=i.slice(r)}return i.length>0&&t.push(i),t}function CS(n,e,t){var i,r,o,s;const{optionsWithoutProcessor:a,audioProcessor:c,videoProcessor:u}=IS(n??{}),l=e==null?void 0:e.processor,d=t==null?void 0:t.processor,h=a??{};return h.audio===!0&&(h.audio={}),h.video===!0&&(h.video={}),h.audio&&(Np(h.audio,e),(i=(o=h.audio).deviceId)!==null&&i!==void 0||(o.deviceId={ideal:"default"}),(c||l)&&(h.audio.processor=c??l)),h.video&&(Np(h.video,t),(r=(s=h.video).deviceId)!==null&&r!==void 0||(s.deviceId={ideal:"default"}),(u||d)&&(h.video.processor=u??d)),h}function Np(n,e){return Object.keys(e).forEach(t=>{n[t]===void 0&&(n[t]=e[t])}),n}function Dp(n){var e,t,i,r;const o={};if(n.video)if(typeof n.video=="object"){const s={},a=s,c=n.video;Object.keys(c).forEach(u=>{switch(u){case"resolution":Np(a,c.resolution);break;default:a[u]=c[u]}}),o.video=s,(e=(i=o.video).deviceId)!==null&&e!==void 0||(i.deviceId={ideal:"default"})}else o.video=n.video?{deviceId:{ideal:"default"}}:!1;else o.video=!1;return n.audio?typeof n.audio=="object"?(o.audio=n.audio,(t=(r=o.audio).deviceId)!==null&&t!==void 0||(r.deviceId={ideal:"default"})):o.audio={deviceId:{ideal:"default"}}:o.audio=!1,o}function TS(n){return T(this,arguments,void 0,function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){const i=xS();if(i){const r=i.createAnalyser();r.fftSize=2048;const o=r.frequencyBinCount,s=new Uint8Array(o);i.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(r),yield qt(t),r.getByteTimeDomainData(s);const c=s.some(u=>u!==128&&u!==0);return i.close(),!c}return!1}()})}function xS(){var n;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const t=new e({latencyHint:"interactive"});if(t.state==="suspended"&&typeof window<"u"&&(!((n=window.document)===null||n===void 0)&&n.body)){const i=()=>T(this,void 0,void 0,function*(){var r;try{t.state==="suspended"&&(yield t.resume())}catch(o){console.warn("Error trying to auto-resume audio context",o)}(r=window.document.body)===null||r===void 0||r.removeEventListener("click",i)});window.document.body.addEventListener("click",i)}return t}}function G3(n){return n==="audioinput"?N.Source.Microphone:n==="videoinput"?N.Source.Camera:N.Source.Unknown}function ES(n){return n===N.Source.Microphone?"audioinput":n===N.Source.Camera?"videoinput":void 0}function $3(n){var e,t;let i=(e=n.video)!==null&&e!==void 0?e:!0;return n.resolution&&n.resolution.width>0&&n.resolution.height>0&&(i=typeof i=="boolean"?{}:i,Pi()?i=Object.assign(Object.assign({},i),{width:{max:n.resolution.width},height:{max:n.resolution.height},frameRate:n.resolution.frameRate}):i=Object.assign(Object.assign({},i),{width:{ideal:n.resolution.width},height:{ideal:n.resolution.height},frameRate:n.resolution.frameRate})),{audio:(t=n.audio)!==null&&t!==void 0?t:!1,video:i,controller:n.controller,selfBrowserSurface:n.selfBrowserSurface,surfaceSwitching:n.surfaceSwitching,systemAudio:n.systemAudio,preferCurrentTab:n.preferCurrentTab}}function vu(n){return n.split("/")[1].toLowerCase()}function H3(n){const e=[];return n.forEach(t=>{t.track!==void 0&&e.push(new np({cid:t.track.mediaStreamID,track:t.trackInfo}))}),e}function Ce(n){return"mediaStreamTrack"in n?{trackID:n.sid,source:n.source,muted:n.isMuted,enabled:n.mediaStreamTrack.enabled,kind:n.kind,streamID:n.mediaStreamID,streamTrackID:n.mediaStreamTrack.id}:{trackID:n.trackSid,enabled:n.isEnabled,muted:n.isMuted,trackInfo:Object.assign({mimeType:n.mimeType,name:n.trackName,encrypted:n.isEncrypted,kind:n.kind,source:n.source},n.track?Ce(n.track):{})}}function K3(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function Y3(n,e){var t;n===void 0&&(n={}),e===void 0&&(e={});const i=[...Object.keys(e),...Object.keys(n)],r={};for(const o of i)n[o]!==e[o]&&(r[o]=(t=e[o])!==null&&t!==void 0?t:"");return r}function IS(n){const e=Object.assign({},n);let t,i;return typeof e.audio=="object"&&e.audio.processor&&(t=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(i=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:t,videoProcessor:i,optionsWithoutProcessor:y3(e)}}function X3(n){switch(n){case at.CAMERA:return N.Source.Camera;case at.MICROPHONE:return N.Source.Microphone;case at.SCREEN_SHARE:return N.Source.ScreenShare;case at.SCREEN_SHARE_AUDIO:return N.Source.ScreenShareAudio;default:return N.Source.Unknown}}class J3 extends Mn.EventEmitter{constructor(e){super(),this.onWorkerMessage=t=>{var i,r;const{kind:o,data:s}=t.data;switch(o){case"error":le.error(s.error.message),this.emit(Ii.EncryptionError,s.error);break;case"initAck":s.enabled&&this.keyProvider.getKeys().forEach(a=>{this.postKey(a)});break;case"enable":if(s.enabled&&this.keyProvider.getKeys().forEach(a=>{this.postKey(a)}),this.encryptionEnabled!==s.enabled&&s.participantIdentity===((i=this.room)===null||i===void 0?void 0:i.localParticipant.identity))this.emit(Ii.ParticipantEncryptionStatusChanged,s.enabled,this.room.localParticipant),this.encryptionEnabled=s.enabled;else if(s.participantIdentity){const a=(r=this.room)===null||r===void 0?void 0:r.getParticipantByIdentity(s.participantIdentity);if(!a)throw TypeError("couldn't set encryption status, participant not found".concat(s.participantIdentity));this.emit(Ii.ParticipantEncryptionStatusChanged,s.enabled,a)}break;case"ratchetKey":this.keyProvider.emit(Ei.KeyRatcheted,s.ratchetResult,s.participantIdentity,s.keyIndex);break}},this.onWorkerError=t=>{le.error("e2ee worker encountered an error:",{error:t.error}),this.emit(Ii.EncryptionError,t.error)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1}setup(e){if(!m3())throw new mp("tried to setup end-to-end encryption on an unsupported browser");if(le.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const t={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:e3.getLevel()}};this.worker&&(le.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(t))}}setParticipantCryptorEnabled(e,t){le.debug("set e2ee to ".concat(e," for participant ").concat(t)),this.postEnable(e,t)}setSifTrailer(e){!e||e.length===0?le.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(B.RTPVideoMapUpdate,t=>{this.postRTPMap(t)})}setupEventListeners(e,t){e.on(U.TrackPublished,(i,r)=>this.setParticipantCryptorEnabled(i.trackInfo.encryption!==$t.NONE,r.identity)),e.on(U.ConnectionStateChanged,i=>{i===ge.Connected&&e.remoteParticipants.forEach(r=>{r.trackPublications.forEach(o=>{this.setParticipantCryptorEnabled(o.trackInfo.encryption!==$t.NONE,r.identity)})})}).on(U.TrackUnsubscribed,(i,r,o)=>{var s;const a={kind:"removeTransform",data:{participantIdentity:o.identity,trackId:i.mediaStreamID}};(s=this.worker)===null||s===void 0||s.postMessage(a)}).on(U.TrackSubscribed,(i,r,o)=>{this.setupE2EEReceiver(i,o.identity,r.trackInfo)}).on(U.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");t.getKeys().forEach(i=>{this.postKey(i)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(z.LocalTrackPublished,i=>T(this,void 0,void 0,function*(){this.setupE2EESender(i.track,i.track.sender)})),t.on(Ei.SetKey,i=>this.postKey(i)).on(Ei.RatchetRequest,(i,r)=>this.postRatchetRequest(i,r))}postRatchetRequest(e,t){if(!this.worker)throw Error("could not ratchet key, worker is missing");const i={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:t}};this.worker.postMessage(i)}postKey(e){let{key:t,participantIdentity:i,keyIndex:r}=e;var o;if(!this.worker)throw Error("could not set key, worker is missing");const s={kind:"setKey",data:{participantIdentity:i,isPublisher:i===((o=this.room)===null||o===void 0?void 0:o.localParticipant.identity),key:t,keyIndex:r}};this.worker.postMessage(s)}postEnable(e,t){if(this.worker){const i={kind:"enable",data:{enabled:e,participantIdentity:t}};this.worker.postMessage(i)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var t;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((t=this.room)===null||t===void 0)&&t.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const i={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(i)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const t={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(t)}setupE2EEReceiver(e,t,i){if(e.receiver){if(!(i!=null&&i.mimeType)||i.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,t,e.kind==="video"?vu(i.mimeType):void 0)}}setupE2EESender(e,t){if(!co(e)||!t){t||le.warn("early return because sender is not ready");return}this.handleSender(t,e.mediaStreamID,void 0)}handleReceiver(e,t,i,r){return T(this,void 0,void 0,function*(){if(this.worker){if(fp()){const o={kind:"decode",participantIdentity:i,trackId:t,codec:r};e.transform=new RTCRtpScriptTransform(this.worker,o)}else{if(pu in e&&r){const c={kind:"updateCodec",data:{trackId:t,codec:r,participantIdentity:i}};this.worker.postMessage(c);return}let o=e.writableStream,s=e.readableStream;if(!o||!s){const c=e.createEncodedStreams();e.writableStream=c.writable,o=c.writable,e.readableStream=c.readable,s=c.readable}const a={kind:"decode",data:{readableStream:s,writableStream:o,trackId:t,codec:r,participantIdentity:i}};this.worker.postMessage(a,[s,o])}e[pu]=!0}})}handleSender(e,t,i){var r;if(!(pu in e||!this.worker)){if(!(!((r=this.room)===null||r===void 0)&&r.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(fp()){le.info("initialize script transform");const o={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:t,codec:i};e.transform=new RTCRtpScriptTransform(this.worker,o)}else{le.info("initialize encoded streams");const o=e.createEncodedStreams(),s={kind:"encode",data:{readableStream:o.readable,writableStream:o.writable,codec:i,trackId:t,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(s,[o.readable,o.writable])}e[pu]=!0}}}const Lp="default";class ft{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new ft),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return T(this,arguments,void 0,function(t){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var o;if(((o=ft.userMediaPromiseMap)===null||o===void 0?void 0:o.size)>0){le.debug("awaiting getUserMedia promise");try{t?yield ft.userMediaPromiseMap.get(t):yield Promise.all(ft.userMediaPromiseMap.values())}catch{le.warn("error waiting for media permissons")}}let s=yield navigator.mediaDevices.enumerateDevices();if(r&&!(Pi()&&i.hasDeviceInUse(t))&&(s.filter(c=>c.kind===t).length===0||s.some(c=>{const u=c.label==="",l=t?c.kind===t:!0;return u&&l}))){const c={video:t!=="audioinput"&&t!=="audiooutput",audio:t!=="videoinput"&&{deviceId:{ideal:"default"}}},u=yield navigator.mediaDevices.getUserMedia(c);s=yield navigator.mediaDevices.enumerateDevices(),u.getTracks().forEach(l=>{l.stop()})}return i._previousDevices=s,t&&(s=s.filter(a=>a.kind===t)),s}()})}normalizeDeviceId(e,t,i){return T(this,void 0,void 0,function*(){if(t!==Lp)return t;const r=yield this.getDevices(e),o=r.find(a=>a.deviceId===Lp);if(!o){le.warn("could not reliably determine default device");return}const s=r.find(a=>a.deviceId!==Lp&&a.groupId===(i??o.groupId));if(!s){le.warn("could not reliably determine default device");return}return s==null?void 0:s.deviceId})}hasDeviceInUse(e){return e?ft.userMediaPromiseMap.has(e):ft.userMediaPromiseMap.size>0}}ft.mediaDeviceKinds=["audioinput","audiooutput","videoinput"],ft.userMediaPromiseMap=new Map;var bs;(function(n){n[n.WAITING=0]="WAITING",n[n.RUNNING=1]="RUNNING",n[n.COMPLETED=2]="COMPLETED"})(bs||(bs={}));class Z3{constructor(){this.pendingTasks=new Map,this.taskMutex=new jt,this.nextTaskIndex=0}run(e){return T(this,void 0,void 0,function*(){const t={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:bs.WAITING};this.pendingTasks.set(t.id,t);const i=yield this.taskMutex.lock();try{return t.executedAt=Date.now(),t.status=bs.RUNNING,yield e()}finally{t.status=bs.COMPLETED,this.pendingTasks.delete(t.id),i()}})}flush(){return T(this,void 0,void 0,function*(){return this.run(()=>T(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}function Q3(n,e){const t=new URL(B3(n));return e.forEach((i,r)=>{t.searchParams.set(r,i)}),RS(t,"rtc")}function eU(n){const e=new URL(Op(n));return RS(e,"validate")}function tU(n){return n.endsWith("/")?n:"".concat(n,"/")}function RS(n,e){return n.pathname="".concat(tU(n.pathname)).concat(e),n.toString()}const nU=["syncState","trickle","offer","answer","simulate","leave"];function iU(n){const e=nU.indexOf(n.case)>=0;return le.trace("request allowed to bypass queue:",{canPass:e,req:n}),e}var je;(function(n){n[n.CONNECTING=0]="CONNECTING",n[n.CONNECTED=1]="CONNECTED",n[n.RECONNECTING=2]="RECONNECTING",n[n.DISCONNECTING=3]="DISCONNECTING",n[n.DISCONNECTED=4]="DISCONNECTED"})(je||(je={}));class Up{get currentState(){return this.state}get isDisconnected(){return this.state===je.DISCONNECTING||this.state===je.DISCONNECTED}get isEstablishingConnection(){return this.state===je.CONNECTING||this.state===je.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i;this.rtt=0,this.state=je.DISCONNECTED,this.log=le,this._requestId=0,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0},this.log=Kn((i=t.loggerName)!==null&&i!==void 0?i:pn.Signal),this.loggerContextCb=t.loggerContextCb,this.useJSON=e,this.requestQueue=new Z3,this.queuedRequests=[],this.closingLock=new jt,this.connectionLock=new jt,this.state=je.DISCONNECTED}get logContext(){var e,t;return(t=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&t!==void 0?t:{}}join(e,t,i,r){return T(this,void 0,void 0,function*(){return this.state=je.CONNECTING,this.options=i,yield this.connect(e,t,i,r)})}reconnect(e,t,i,r){return T(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext);return}return this.state=je.RECONNECTING,this.clearPingInterval(),yield this.connect(e,t,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:i,reconnectReason:r}))})}connect(e,t,i,r){this.connectOptions=i;const o=U3(),s=rU(t,o,i),a=Q3(e,s),c=eU(a);return new Promise((u,l)=>T(this,void 0,void 0,function*(){const d=yield this.connectionLock.lock();try{const h=()=>T(this,void 0,void 0,function*(){this.close(),clearTimeout(p),l(new Ae("room connection has been cancelled (signal)",pe.Cancelled))}),p=setTimeout(()=>{this.close(),l(new Ae("room connection has timed out (signal)",pe.ServerUnreachable))},i.websocketTimeout);r!=null&&r.aborted&&h(),r==null||r.addEventListener("abort",h);const m=new URL(a);m.searchParams.has("access_token")&&m.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(m),Object.assign({reconnect:i.reconnect,reconnectReason:i.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(a),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(p)},this.ws.onerror=f=>T(this,void 0,void 0,function*(){if(this.state!==je.CONNECTED){this.state=je.DISCONNECTED,clearTimeout(p);try{const g=yield fetch(c);if(g.status.toFixed(0).startsWith("4")){const y=yield g.text();l(new Ae(y,pe.NotAllowed,g.status))}else l(new Ae("Encountered unknown websocket error during connection: ".concat(f.toString()),pe.InternalError,g.status))}catch(g){l(new Ae(g instanceof Error?g.message:"server was not reachable",pe.ServerUnreachable))}return}this.handleWSError(f)}),this.ws.onmessage=f=>T(this,void 0,void 0,function*(){var g,y,b;let S;if(typeof f.data=="string"){const w=JSON.parse(f.data);S=dk.fromJson(w,{ignoreUnknownFields:!0})}else if(f.data instanceof ArrayBuffer)S=dk.fromBinary(new Uint8Array(f.data));else{this.log.error("could not decode websocket message: ".concat(typeof f.data),this.logContext);return}if(this.state!==je.CONNECTED){let w=!1;if(((g=S.message)===null||g===void 0?void 0:g.case)==="join"?(this.state=je.CONNECTED,r==null||r.removeEventListener("abort",h),this.pingTimeoutDuration=S.message.value.pingTimeout,this.pingIntervalDuration=S.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&(this.log.debug("ping config",Object.assign(Object.assign({},this.logContext),{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration})),this.startPingInterval()),u(S.message.value)):this.state===je.RECONNECTING&&S.message.case!=="leave"?(this.state=je.CONNECTED,r==null||r.removeEventListener("abort",h),this.startPingInterval(),((y=S.message)===null||y===void 0?void 0:y.case)==="reconnect"?u(S.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),u(void 0),w=!0)):this.isEstablishingConnection&&S.message.case==="leave"?l(new Ae("Received leave request while trying to (re)connect",pe.LeaveRequest,void 0,S.message.value.reason)):i.reconnect||l(new Ae("did not receive join response, got ".concat((b=S.message)===null||b===void 0?void 0:b.case," instead"),pe.InternalError)),!w)return}this.signalLatency&&(yield qt(this.signalLatency)),this.handleSignalResponse(S)}),this.ws.onclose=f=>{this.isEstablishingConnection&&l(new Ae("Websocket got closed during a (re)connection attempt",pe.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:f.reason,code:f.code,wasClean:f.wasClean,state:this.state})),this.handleOnClose(f.reason)}}finally{d()}}))}close(){return T(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){const i=yield e.closingLock.lock();try{if(e.clearPingInterval(),t&&(e.state=je.DISCONNECTING),e.ws){e.ws.onmessage=null,e.ws.onopen=null,e.ws.onclose=null;const r=new Promise(o=>{e.ws?e.ws.onclose=()=>{o()}:o()});e.ws.readyState<e.ws.CLOSING&&(e.ws.close(),yield Promise.race([r,qt(250)])),e.ws=void 0}}finally{t&&(e.state=je.DISCONNECTED),i()}}()})}sendOffer(e){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:yu(e)})}sendAnswer(e){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:yu(e)})}sendIceCandidate(e,t){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new ep({candidateInit:JSON.stringify(e),target:t})})}sendMuteTrack(e,t){return this.sendRequest({case:"mute",value:new tp({sid:e,muted:t})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,t){return T(this,arguments,void 0,function(i,r){var o=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){const a=o.getNextRequestId();return yield o.sendRequest({case:"updateMetadata",value:new mk({requestId:a,metadata:i,name:r,attributes:s})}),a}()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,t){return this.sendRequest({case:"updateLayers",value:new fk({trackSid:e,layers:t})})}sendUpdateSubscriptionPermissions(e,t){return this.sendRequest({case:"subscriptionPermission",value:new yk({allParticipants:e,trackPermissions:t})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:Ge.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new kk({timestamp:Ge.parse(Date.now()),rtt:Ge.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,t){return this.sendRequest({case:"updateAudioTrack",value:new pk({trackSid:e,features:t})})}sendLeave(){return this.sendRequest({case:"leave",value:new iu({reason:ln.CLIENT_INITIATED,action:io.DISCONNECT})})}sendRequest(e){return T(this,arguments,void 0,function(t){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!r&&!iU(t)&&i.state===je.RECONNECTING){i.queuedRequests.push(()=>T(i,void 0,void 0,function*(){yield this.sendRequest(t,!0)}));return}if(r||(yield i.requestQueue.flush()),i.signalLatency&&(yield qt(i.signalLatency)),!i.ws||i.ws.readyState!==i.ws.OPEN){i.log.error("cannot send signal request before connected, type: ".concat(t==null?void 0:t.case),i.logContext);return}const s=new RL({message:t});try{i.useJSON?i.ws.send(s.toJsonString()):i.ws.send(s.toBinary())}catch(a){i.log.error("error sending signal message",Object.assign(Object.assign({},i.logContext),{error:a}))}}()})}handleSignalResponse(e){var t,i;const r=e.message;if(r==null){this.log.debug("received unsupported message",this.logContext);return}let o=!1;if(r.case==="answer"){const s=PS(r.value);this.onAnswer&&this.onAnswer(s)}else if(r.case==="offer"){const s=PS(r.value);this.onOffer&&this.onOffer(s)}else if(r.case==="trickle"){const s=JSON.parse(r.value.candidateInit);this.onTrickle&&this.onTrickle(s,r.value.target)}else r.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((t=r.value.participants)!==null&&t!==void 0?t:[]):r.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(r.value):r.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((i=r.value.speakers)!==null&&i!==void 0?i:[]):r.case==="leave"?this.onLeave&&this.onLeave(r.value):r.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(r.value.sid,r.value.muted):r.case==="roomUpdate"?this.onRoomUpdate&&r.value.room&&this.onRoomUpdate(r.value.room):r.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(r.value):r.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(r.value):r.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(r.value):r.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(r.value):r.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(r.value):r.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(r.value):r.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(r.value):r.case==="pong"||(r.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(r.value.lastPingTimestamp.toString()),this.resetPingTimeout(),o=!0):r.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(r.value):r.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(r.value.trackSid):r.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(r.value.token),this.onRoomMoved&&this.onRoomMoved(r.value)):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:r.case})));o||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return T(this,void 0,void 0,function*(){if(this.state===je.DISCONNECTED)return;const t=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),t&&t(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=_t.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&_t.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set",this.logContext);return}this.log.debug("start ping interval",this.logContext),this.pingInterval=_t.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&_t.clearInterval(this.pingInterval)}}function PS(n){const e={type:"offer",sdp:n.sdp};switch(n.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=n.type;break}return e}function yu(n){return new nr({sdp:n.sdp,type:n.type})}function rU(n,e,t){var i;const r=new URLSearchParams;return r.set("access_token",n),t.reconnect&&(r.set("reconnect","1"),t.sid&&r.set("sid",t.sid)),r.set("auto_subscribe",t.autoSubscribe?"1":"0"),r.set("sdk",Nn()?"reactnative":"js"),r.set("version",e.version),r.set("protocol",e.protocol.toString()),e.deviceModel&&r.set("device_model",e.deviceModel),e.os&&r.set("os",e.os),e.osVersion&&r.set("os_version",e.osVersion),e.browser&&r.set("browser",e.browser),e.browserVersion&&r.set("browser_version",e.browserVersion),t.adaptiveStream&&r.set("adaptive_stream","1"),t.reconnectReason&&r.set("reconnect_reason",t.reconnectReason.toString()),!((i=navigator.connection)===null||i===void 0)&&i.type&&r.set("network",navigator.connection.type),r}var mn={},Fp={},Bp={exports:{}},OS;function jp(){if(OS)return Bp.exports;OS=1;var n=Bp.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=e.raddr!=null?" raddr %s rport %d":"%v%v",t+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(t+=" generation %d"),t+=e["network-id"]!=null?" network-id %d":"%v",t+=e["network-cost"]!=null?" network-cost %d":"%v",t}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return e.attribute!=null&&(t+=" %s",e.value!=null&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=e.id!=null?"id=%s %s":"%v%s",t+=e.mediaClockValue!=null?"=%s":"",t+=e.rateNumerator!=null?" rate=%s":"",t+=e.rateDenominator!=null?"/%s":"",t}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(n).forEach(function(e){var t=n[e];t.forEach(function(i){i.reg||(i.reg=/(.*)/),i.format||(i.format="%s")})}),Bp.exports}var AS;function oU(){return AS||(AS=1,function(n){var e=function(a){return String(Number(a))===a?Number(a):a},t=function(a,c,u,l){if(l&&!u)c[l]=e(a[1]);else for(var d=0;d<u.length;d+=1)a[d+1]!=null&&(c[u[d]]=e(a[d+1]))},i=function(a,c,u){var l=a.name&&a.names;a.push&&!c[a.push]?c[a.push]=[]:l&&!c[a.name]&&(c[a.name]={});var d=a.push?{}:l?c[a.name]:c;t(u.match(a.reg),d,a.names,a.name),a.push&&c[a.push].push(d)},r=jp(),o=RegExp.prototype.test.bind(/^([a-z])=(.*)/);n.parse=function(a){var c={},u=[],l=c;return a.split(/(\r\n|\r|\n)/).filter(o).forEach(function(d){var h=d[0],p=d.slice(2);h==="m"&&(u.push({rtp:[],fmtp:[]}),l=u[u.length-1]);for(var m=0;m<(r[h]||[]).length;m+=1){var f=r[h][m];if(f.reg.test(p))return i(f,l,p)}}),c.media=u,c};var s=function(a,c){var u=c.split(/=(.+)/,2);return u.length===2?a[u[0]]=e(u[1]):u.length===1&&c.length>1&&(a[u[0]]=void 0),a};n.parseParams=function(a){return a.split(/;\s?/).reduce(s,{})},n.parseFmtpConfig=n.parseParams,n.parsePayloads=function(a){return a.toString().split(" ").map(Number)},n.parseRemoteCandidates=function(a){for(var c=[],u=a.split(" ").map(e),l=0;l<u.length;l+=3)c.push({component:u[l],ip:u[l+1],port:u[l+2]});return c},n.parseImageAttributes=function(a){return a.split(" ").map(function(c){return c.substring(1,c.length-1).split(",").reduce(s,{})})},n.parseSimulcastStreamList=function(a){return a.split(";").map(function(c){return c.split(",").map(function(u){var l,d=!1;return u[0]!=="~"?l=e(u):(l=e(u.substring(1,u.length)),d=!0),{scid:l,paused:d}})})}}(Fp)),Fp}var Vp,MS;function sU(){if(MS)return Vp;MS=1;var n=jp(),e=/%[sdv%]/g,t=function(s){var a=1,c=arguments,u=c.length;return s.replace(e,function(l){if(a>=u)return l;var d=c[a];switch(a+=1,l){case"%%":return"%";case"%s":return String(d);case"%d":return Number(d);case"%v":return""}})},i=function(s,a,c){var u=a.format instanceof Function?a.format(a.push?c:c[a.name]):a.format,l=[s+"="+u];if(a.names)for(var d=0;d<a.names.length;d+=1){var h=a.names[d];a.name?l.push(c[a.name][h]):l.push(c[a.names[d]])}else l.push(c[a.name]);return t.apply(null,l)},r=["v","o","s","i","u","e","p","c","b","t","r","z","a"],o=["i","c","b","a"];return Vp=function(s,a){a=a||{},s.version==null&&(s.version=0),s.name==null&&(s.name=" "),s.media.forEach(function(d){d.payloads==null&&(d.payloads="")});var c=a.outerOrder||r,u=a.innerOrder||o,l=[];return c.forEach(function(d){n[d].forEach(function(h){h.name in s&&s[h.name]!=null?l.push(i(d,h,s)):h.push in s&&s[h.push]!=null&&s[h.push].forEach(function(p){l.push(i(d,h,p))})})}),s.media.forEach(function(d){l.push(i("m",n.m[0],d)),u.forEach(function(h){n[h].forEach(function(p){p.name in d&&d[p.name]!=null?l.push(i(h,p,d)):p.push in d&&d[p.push]!=null&&d[p.push].forEach(function(m){l.push(i(h,p,m))})})})}),l.join(`\r
119
119
  `)+`\r
120
120
  `},Vp}var NS;function aU(){if(NS)return mn;NS=1;var n=oU(),e=sU(),t=jp();return mn.grammar=t,mn.write=e,mn.parse=n.parse,mn.parseParams=n.parseParams,mn.parseFmtpConfig=n.parseFmtpConfig,mn.parsePayloads=n.parsePayloads,mn.parseRemoteCandidates=n.parseRemoteCandidates,mn.parseImageAttributes=n.parseImageAttributes,mn.parseSimulcastStreamList=n.parseSimulcastStreamList,mn}var Mi=aU();function zp(n,e,t){var i,r,o;e===void 0&&(e=50),t===void 0&&(t={});var s=(i=t.isImmediate)!=null&&i,a=(r=t.callback)!=null&&r,c=t.maxWait,u=Date.now(),l=[];function d(){if(c!==void 0){var p=Date.now()-u;if(p+e>=c)return c-p}return e}var h=function(){var p=[].slice.call(arguments),m=this;return new Promise(function(f,g){var y=s&&o===void 0;if(o!==void 0&&clearTimeout(o),o=setTimeout(function(){if(o=void 0,u=Date.now(),!s){var S=n.apply(m,p);a&&a(S),l.forEach(function(w){return(0,w.resolve)(S)}),l=[]}},d()),y){var b=n.apply(m,p);return a&&a(b),f(b)}l.push({resolve:f,reject:g})})};return h.cancel=function(p){o!==void 0&&clearTimeout(o),l.forEach(function(m){return(0,m.reject)(p)}),l=[]},h}const cU=.7,uU=20,lo={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class DS extends Mn.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i;super(),this.log=le,this.ddExtID=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=zp(r=>T(this,void 0,void 0,function*(){this.emit(lo.NegotiationStarted);try{yield this.createAndSendOffer()}catch(o){if(r)r(o);else throw o}}),uU),this.close=()=>{this._pc&&(this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=Kn((i=t.loggerName)!==null&&i!==void 0?i:pn.PCTransport),this.loggerOptions=t,this.config=e,this._pc=this.createPC()}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=t=>{var i;t.candidate&&((i=this.onIceCandidate)===null||i===void 0||i.call(this,t.candidate))},e.onicecandidateerror=t=>{var i;(i=this.onIceCandidateError)===null||i===void 0||i.call(this,t)},e.oniceconnectionstatechange=()=>{var t;(t=this.onIceConnectionStateChange)===null||t===void 0||t.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var t;(t=this.onSignalingStatechange)===null||t===void 0||t.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var t;(t=this.onConnectionStateChange)===null||t===void 0||t.call(this,e.connectionState)},e.ondatachannel=t=>{var i;(i=this.onDataChannel)===null||i===void 0||i.call(this,t)},e.ontrack=t=>{var i;(i=this.onTrack)===null||i===void 0||i.call(this,t)},e}get logContext(){var e,t;return Object.assign({},(t=(e=this.loggerOptions).loggerContextCb)===null||t===void 0?void 0:t.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return T(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e){return T(this,void 0,void 0,function*(){var t;let i;if(e.type==="offer"){let{stereoMids:r,nackMids:o}=lU(e);this.remoteStereoMids=r,this.remoteNackMids=o}else if(e.type==="answer"){const r=Mi.parse((t=e.sdp)!==null&&t!==void 0?t:"");r.media.forEach(o=>{o.type==="audio"&&this.trackBitrates.some(s=>{if(!s.transceiver||o.mid!=s.transceiver.mid)return!1;let a=0;if(o.rtp.some(u=>u.codec.toUpperCase()===s.codec.toUpperCase()?(a=u.payload,!0):!1),a===0)return!0;let c=!1;for(const u of o.fmtp)if(u.payload===a){u.config=u.config.split(";").filter(l=>!l.includes("maxaveragebitrate")).join(";"),s.maxbr>0&&(u.config+=";maxaveragebitrate=".concat(s.maxbr*1e3)),c=!0;break}return c||s.maxbr>0&&o.fmtp.push({payload:a,config:"maxaveragebitrate=".concat(s.maxbr*1e3)}),!0})}),i=Mi.write(r)}yield this.setMungedSDP(e,i,!0),this.pendingCandidates.forEach(r=>{this.pc.addIceCandidate(r)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit(lo.NegotiationComplete),e.sdp&&Mi.parse(e.sdp).media.forEach(o=>{o.type==="video"&&this.emit(lo.RTPVideoPayloadTypes,o.rtp)}))})}createAndSendOffer(e){return T(this,void 0,void 0,function*(){var t;if(this.onOffer===void 0)return;if(e!=null&&e.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const o=this._pc.remoteDescription;if(e!=null&&e.iceRestart&&o)yield this._pc.setRemoteDescription(o);else{this.renegotiate=!0;return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const i=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:i.sdp},this.logContext));const r=Mi.parse((t=i.sdp)!==null&&t!==void 0?t:"");r.media.forEach(o=>{US(o),o.type==="audio"?LS(o,[],[]):o.type==="video"&&this.trackBitrates.some(s=>{if(!o.msid||!s.cid||!o.msid.includes(s.cid))return!1;let a=0;if(o.rtp.some(u=>u.codec.toUpperCase()===s.codec.toUpperCase()?(a=u.payload,!0):!1),a===0||(vs(s.codec)&&this.ensureVideoDDExtensionForSVC(o,r),s.codec!=="av1"))return!0;const c=Math.round(s.maxbr*cU);for(const u of o.fmtp)if(u.payload===a){u.config.includes("x-google-start-bitrate")||(u.config+=";x-google-start-bitrate=".concat(c));break}return!0})}),yield this.setMungedSDP(i,Mi.write(r)),this.onOffer(i)})}createAndSetAnswer(){return T(this,void 0,void 0,function*(){var e;const t=yield this.pc.createAnswer(),i=Mi.parse((e=t.sdp)!==null&&e!==void 0?e:"");return i.media.forEach(r=>{US(r),r.type==="audio"&&LS(r,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(t,Mi.write(i)),t})}createDataChannel(e,t){return this.pc.createDataChannel(e,t)}addTransceiver(e,t){return this.pc.addTransceiver(e,t)}addTrack(e){if(!this._pc)throw new lt("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var t;if(!this._pc)throw new lt("PC closed, cannot configure");return(t=this._pc)===null||t===void 0?void 0:t.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var t;return(t=this._pc)===null||t===void 0?void 0:t.removeTrack(e)}getConnectionState(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&t!==void 0?t:"closed"}getICEConnectionState(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&t!==void 0?t:"closed"}getSignallingState(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&t!==void 0?t:"closed"}getTransceivers(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&t!==void 0?t:[]}getSenders(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&t!==void 0?t:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return T(this,void 0,void 0,function*(){var e;if(!this._pc)return;let t="";const i=new Map,r=new Map;if((yield this._pc.getStats()).forEach(a=>{switch(a.type){case"transport":t=a.selectedCandidatePairId;break;case"candidate-pair":t===""&&a.selected&&(t=a.id),i.set(a.id,a);break;case"remote-candidate":r.set(a.id,"".concat(a.address,":").concat(a.port));break}}),t==="")return;const s=(e=i.get(t))===null||e===void 0?void 0:e.remoteCandidateId;if(s!==void 0)return r.get(s)})}setMungedSDP(e,t,i){return T(this,void 0,void 0,function*(){if(t){const r=e.sdp;e.sdp=t;try{this.log.debug("setting munged ".concat(i?"remote":"local"," description"),this.logContext),i?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(o){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:o,sdp:t})),e.sdp=r}}try{i?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(r){let o="unknown error";r instanceof Error?o=r.message:typeof r=="string"&&(o=r);const s={error:o,sdp:e.sdp};throw!i&&this.pc.remoteDescription&&(s.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:s})),new gp(o)}})}ensureVideoDDExtensionForSVC(e,t){var i,r;if(!((i=e.ext)===null||i===void 0?void 0:i.some(s=>s.uri===mS))){if(this.ddExtID===0){let s=0;t.media.forEach(a=>{var c;a.type==="video"&&((c=a.ext)===null||c===void 0||c.forEach(u=>{u.value>s&&(s=u.value)}))}),this.ddExtID=s+1}(r=e.ext)===null||r===void 0||r.push({value:this.ddExtID,uri:mS})}}}function LS(n,e,t){let i=0;n.rtp.some(r=>r.codec==="opus"?(i=r.payload,!0):!1),i>0&&(n.rtcpFb||(n.rtcpFb=[]),t.includes(n.mid)&&!n.rtcpFb.some(r=>r.payload===i&&r.type==="nack")&&n.rtcpFb.push({payload:i,type:"nack"}),e.includes(n.mid)&&n.fmtp.some(r=>r.payload===i?(r.config.includes("stereo=1")||(r.config+=";stereo=1"),!0):!1))}function lU(n){var e;const t=[],i=[],r=Mi.parse((e=n.sdp)!==null&&e!==void 0?e:"");let o=0;return r.media.forEach(s=>{var a;s.type==="audio"&&(s.rtp.some(c=>c.codec==="opus"?(o=c.payload,!0):!1),!((a=s.rtcpFb)===null||a===void 0)&&a.some(c=>c.payload===o&&c.type==="nack")&&i.push(s.mid),s.fmtp.some(c=>c.payload===o?(c.config.includes("sprop-stereo=1")&&t.push(s.mid),!0):!1))}),{stereoMids:t,nackMids:i}}function US(n){if(n.connection){const e=n.connection.ip.indexOf(":")>=0;(n.connection.version===4&&e||n.connection.version===6&&!e)&&(n.connection.ip="0.0.0.0",n.connection.version=4)}}const qp="vp8",dU={audioPreset:_p.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:Sp.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:qp,backupCodec:!0},FS={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},BS={deviceId:{ideal:"default"},resolution:gs.h720.resolution},hU={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new n3,disconnectOnPageLeave:!0,webAudioMix:!1},Wp={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var Xe;(function(n){n[n.NEW=0]="NEW",n[n.CONNECTING=1]="CONNECTING",n[n.CONNECTED=2]="CONNECTED",n[n.FAILED=3]="FAILED",n[n.CLOSING=4]="CLOSING",n[n.CLOSED=5]="CLOSED"})(Xe||(Xe={}));class pU{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(e,t,i){var r;this.peerConnectionTimeout=Wp.peerConnectionTimeout,this.log=le,this.updateState=()=>{var o;const s=this.state,a=this.requiredTransports.map(c=>c.getConnectionState());a.every(c=>c==="connected")?this.state=Xe.CONNECTED:a.some(c=>c==="failed")?this.state=Xe.FAILED:a.some(c=>c==="connecting")?this.state=Xe.CONNECTING:a.every(c=>c==="closed")?this.state=Xe.CLOSED:a.some(c=>c==="closed")?this.state=Xe.CLOSING:a.every(c=>c==="new")&&(this.state=Xe.NEW),s!==this.state&&(this.log.debug("pc state change: from ".concat(Xe[s]," to ").concat(Xe[this.state]),this.logContext),(o=this.onStateChange)===null||o===void 0||o.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=Kn((r=i.loggerName)!==null&&r!==void 0?r:pn.PCManager),this.loggerOptions=i,this.isPublisherConnectionRequired=!t,this.isSubscriberConnectionRequired=t,this.publisher=new DS(e,i),this.subscriber=new DS(e,i),this.publisher.onConnectionStateChange=this.updateState,this.subscriber.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=o=>{var s;(s=this.onIceCandidate)===null||s===void 0||s.call(this,o,hn.PUBLISHER)},this.subscriber.onIceCandidate=o=>{var s;(s=this.onIceCandidate)===null||s===void 0||s.call(this,o,hn.SUBSCRIBER)},this.subscriber.onDataChannel=o=>{var s;(s=this.onDataChannel)===null||s===void 0||s.call(this,o)},this.subscriber.onTrack=o=>{var s;(s=this.onTrack)===null||s===void 0||s.call(this,o)},this.publisher.onOffer=o=>{var s;(s=this.onPublisherOffer)===null||s===void 0||s.call(this,o)},this.state=Xe.NEW,this.connectionLock=new jt,this.remoteOfferLock=new jt}get logContext(){var e,t;return Object.assign({},(t=(e=this.loggerOptions).loggerContextCb)===null||t===void 0?void 0:t.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}requireSubscriber(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isSubscriberConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e){return this.publisher.setRemoteDescription(e)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return T(this,void 0,void 0,function*(){if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const e=this.publisher;for(const t of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(t)}catch(i){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:i}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()})}triggerIceRestart(){return T(this,void 0,void 0,function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,t){return T(this,void 0,void 0,function*(){t===hn.PUBLISHER?yield this.publisher.addIceCandidate(e):yield this.subscriber.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e){return T(this,void 0,void 0,function*(){this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:this.subscriber.getSignallingState().toString()}));const t=yield this.remoteOfferLock.lock();try{return yield this.subscriber.setRemoteDescription(e),yield this.subscriber.createAndSetAnswer()}finally{t()}})}updateConfiguration(e,t){this.publisher.setConfiguration(e),this.subscriber.setConfiguration(e),t&&this.triggerIceRestart()}ensurePCTransportConnection(e,t){return T(this,void 0,void 0,function*(){var i;const r=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((i=this.requiredTransports)===null||i===void 0?void 0:i.map(o=>this.ensureTransportConnected(o,e,t)))}finally{r()}})}negotiate(e){return T(this,void 0,void 0,function*(){return new Promise((t,i)=>T(this,void 0,void 0,function*(){const r=setTimeout(()=>{i("negotiation timed out")},this.peerConnectionTimeout),o=()=>{clearTimeout(r),i("negotiation aborted")};e.signal.addEventListener("abort",o),this.publisher.once(lo.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(lo.NegotiationComplete,()=>{clearTimeout(r),t()})}),yield this.publisher.negotiate(s=>{clearTimeout(r),i(s)})}))})}addPublisherTransceiver(e,t){return this.publisher.addTransceiver(e,t)}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,t){return this.publisher.createDataChannel(e,t)}getConnectedAddress(e){return e===hn.PUBLISHER?this.publisher.getConnectedAddress():e===hn.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&e.push(this.subscriber),e}ensureTransportConnected(e,t){return T(this,arguments,void 0,function(i,r){var o=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(i.getConnectionState()!=="connected")return new Promise((c,u)=>T(o,void 0,void 0,function*(){const l=()=>{this.log.warn("abort transport connection",this.logContext),_t.clearTimeout(d),u(new Ae("room connection has been cancelled",pe.Cancelled))};r!=null&&r.signal.aborted&&l(),r==null||r.signal.addEventListener("abort",l);const d=_t.setTimeout(()=>{r==null||r.signal.removeEventListener("abort",l),u(new Ae("could not establish pc connection",pe.InternalError))},s);for(;this.state!==Xe.CONNECTED;)if(yield qt(50),r!=null&&r.signal.aborted){u(new Ae("room connection has been cancelled",pe.Cancelled));return}_t.clearTimeout(d),r==null||r.signal.removeEventListener("abort",l),c()}))}()})}}class Je extends Error{constructor(e,t,i){super(t),this.code=e,this.message=VS(t,Je.MAX_MESSAGE_BYTES),this.data=i?VS(i,Je.MAX_DATA_BYTES):void 0}static fromProto(e){return new Je(e.code,e.message,e.data)}toProto(){return new nk({code:this.code,message:this.message,data:this.data})}static builtIn(e,t){return new Je(Je.ErrorCode[e],Je.ErrorMessage[e],t)}}Je.MAX_MESSAGE_BYTES=256,Je.MAX_DATA_BYTES=15360,Je.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404},Je.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const jS=15360;function Gp(n){return new TextEncoder().encode(n).length}function VS(n,e){if(Gp(n)<=e)return n;let t=0,i=n.length;const r=new TextEncoder;for(;t<i;){const o=Math.floor((t+i+1)/2);r.encode(n.slice(0,o)).length<=e?t=o:i=o-1}return n.slice(0,t)}const $p=2e3;function bu(n,e){if(!e)return 0;let t,i;return"bytesReceived"in n?(t=n.bytesReceived,i=e.bytesReceived):"bytesSent"in n&&(t=n.bytesSent,i=e.bytesSent),t===void 0||i===void 0||n.timestamp===void 0||e.timestamp===void 0?0:(t-i)*8*1e3/(n.timestamp-e.timestamp)}const fU=1e3;class zS extends N{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}constructor(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=arguments.length>4?arguments[4]:void 0;super(e,t,o),this.manuallyStopped=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=zp(()=>T(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>T(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(F.Ended,this)},this.reacquireTrack=!1,this.providedByUser=r,this.muteLock=new jt,this.pauseUpstreamLock=new jt,this.processorLock=new jt,this.restartLock=new jt,this.setMediaStreamTrack(e,!0),this._constraints=e.getConstraints(),i&&(this._constraints=i)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==N.Kind.Video)return;const{width:e,height:t}=this._mediaStreamTrack.getSettings();if(e&&t)return{width:e,height:t}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,t;return(t=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&t!==void 0?t:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,t){return T(this,void 0,void 0,function*(){var i;if(e===this._mediaStreamTrack&&!t)return;this._mediaStreamTrack&&(this.attachedElements.forEach(o=>{so(this._mediaStreamTrack,o)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let r;if(this.processor&&e){const o=yield this.processorLock.lock();try{if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(oo(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),r=this.processor.processedTrack}finally{o()}}this.sender&&((i=this.sender.transport)===null||i===void 0?void 0:i.state)!=="closed"&&(yield this.sender.replaceTrack(r??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(o=>{oo(r??e,o)}))})}waitForDimensions(){return T(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fU;return function*(){var i;if(e.kind===N.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((i=fn())===null||i===void 0?void 0:i.os)==="iOS"&&(yield qt(10));const r=Date.now();for(;Date.now()-r<t;){const o=e.dimensions;if(o)return o;yield qt(50)}throw new Yn("unable to get track dimensions after timeout")}()})}setDeviceId(e){return T(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===Oi(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),Oi(e)===this._mediaStreamTrack.getSettings().deviceId)})}getDeviceId(){return T(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(e.source===N.Source.ScreenShare)return;const{deviceId:i,groupId:r}=e._mediaStreamTrack.getSettings(),o=e.kind===N.Kind.Audio?"audioinput":"videoinput";return t?ft.getInstance().normalizeDeviceId(o,i,r):i}()})}mute(){return T(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return T(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,t){return T(this,void 0,void 0,function*(){if(!this.sender)throw new Yn("unable to replace an unpublished track");let i,r;return typeof t=="boolean"?i=t:t!==void 0&&(i=t.userProvidedTrack,r=t.stopProcessor),this.providedByUser=i??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),r&&this.processor&&(yield this.stopProcessor()),this})}restart(e){return T(this,void 0,void 0,function*(){this.manuallyStopped=!1;const t=yield this.restartLock.lock();try{e||(e=this._constraints);const{deviceId:i,facingMode:r}=e,o=i3(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const s={audio:!1,video:!1};this.kind===N.Kind.Video?s.video=i||r?{deviceId:i,facingMode:r}:!0:s.audio=i?{deviceId:i}:!0,this.attachedElements.forEach(u=>{so(this.mediaStreamTrack,u)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const c=(yield navigator.mediaDevices.getUserMedia(s)).getTracks()[0];return yield c.applyConstraints(o),c.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(c),this._constraints=e,this.emit(F.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{t()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?F.Muted:F.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return T(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),gS()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return T(this,void 0,void 0,function*(){var e;const t=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit(F.UpstreamPaused,this);const i=fn();if((i==null?void 0:i.name)==="Safari"&&rr(i.version,"12.0")<0)throw new mp("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{t()}})}resumeUpstream(){return T(this,void 0,void 0,function*(){var e;const t=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(F.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{t()}})}getRTCStatsReport(){return T(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return T(this,arguments,void 0,function(t){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var o;const s=yield i.processorLock.lock();try{i.log.debug("setting up processor",i.logContext);const a=document.createElement(i.kind),c={kind:i.kind,track:i._mediaStreamTrack,element:a,audioContext:i.audioContext};if(yield t.init(c),i.log.debug("processor initialized",i.logContext),i.processor&&(yield i.stopProcessor()),i.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(oo(i._mediaStreamTrack,a),a.muted=!0,a.play().catch(u=>i.log.error("failed to play processor element",Object.assign(Object.assign({},i.logContext),{error:u}))),i.processor=t,i.processorElement=a,i.processor.processedTrack){for(const u of i.attachedElements)u!==i.processorElement&&r&&(so(i._mediaStreamTrack,u),oo(i.processor.processedTrack,u));yield(o=i.sender)===null||o===void 0?void 0:o.replaceTrack(i.processor.processedTrack)}i.emit(F.TrackProcessorUpdate,i.processor)}finally{s()}}()})}getProcessor(){return this.processor}stopProcessor(){return T(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var i,r;e.processor&&(e.log.debug("stopping processor",e.logContext),(i=e.processor.processedTrack)===null||i===void 0||i.stop(),yield e.processor.destroy(),e.processor=void 0,t||((r=e.processorElement)===null||r===void 0||r.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(F.TrackProcessorUpdate))}()})}}class _u extends zS{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;super(e,N.Kind.Audio,t,i,o),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>T(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let s;try{s=yield this.getSenderStats()}catch(a){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:a}));return}s&&this.prevStats&&(this._currentBitrate=bu(s,this.prevStats)),this.prevStats=s}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(F.AudioTrackFeatureUpdate,this,dn.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(F.AudioTrackFeatureUpdate,this,dn.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=r,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return T(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===N.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{t()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return T(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const i=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==Oi(this._constraints.deviceId);return this.source===N.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||i)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{t()}})}restartTrack(e){return T(this,void 0,void 0,function*(){let t;if(e){const i=Dp({audio:e});typeof i.audio!="boolean"&&(t=i.audio)}yield this.restart(t)})}restart(e){const t=Object.create(null,{restart:{get:()=>super.restart}});return T(this,void 0,void 0,function*(){const i=yield t.restart.call(this,e);return this.checkForSilence(),i})}startMonitor(){Wt()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},$p)))}setProcessor(e){return T(this,void 0,void 0,function*(){var t;const i=yield this.processorLock.lock();try{if(!Nn()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.stopProcessor());const r={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(r),this.processor=e,this.processor.processedTrack&&(yield(t=this.sender)===null||t===void 0?void 0:t.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit(F.TrackProcessorUpdate,this.processor)}finally{i()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return T(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const t=yield this.sender.getStats();let i;return t.forEach(r=>{r.type==="outbound-rtp"&&(i={type:"audio",streamId:r.id,packetsSent:r.packetsSent,packetsLost:r.packetsLost,bytesSent:r.bytesSent,timestamp:r.timestamp,roundTripTime:r.roundTripTime,jitter:r.jitter})}),i})}checkForSilence(){return T(this,void 0,void 0,function*(){const e=yield TS(this);return e&&(this.isMuted||this.log.warn("silence detected on local audio track",this.logContext),this.emit(F.AudioSilenceDetected)),e})}}function mU(n,e,t){switch(n.kind){case"audio":return new _u(n,e,!1,void 0,t);case"video":return new Su(n,e,!1,t);default:throw new Yn("unsupported track type: ".concat(n.kind))}}const gU=Object.values(gs),vU=Object.values(kp),yU=Object.values(Sp),bU=[gs.h180,gs.h360],_U=[kp.h180,kp.h360],kU=n=>[{scaleResolutionDownBy:2,fps:n.encoding.maxFramerate}].map(t=>{var i,r;return new Re(Math.floor(n.width/t.scaleResolutionDownBy),Math.floor(n.height/t.scaleResolutionDownBy),Math.max(15e4,Math.floor(n.encoding.maxBitrate/(Math.pow(t.scaleResolutionDownBy,2)*(((i=n.encoding.maxFramerate)!==null&&i!==void 0?i:30)/((r=t.fps)!==null&&r!==void 0?r:30))))),t.fps,n.encoding.priority)}),Hp=["q","h","f"];function Kp(n,e,t,i){var r,o;let s=i==null?void 0:i.videoEncoding;n&&(s=i==null?void 0:i.screenShareEncoding);const a=i==null?void 0:i.simulcast,c=i==null?void 0:i.scalabilityMode,u=i==null?void 0:i.videoCodec;if(!s&&!a&&!c||!e||!t)return[{}];s||(s=wU(n,e,t,u),le.debug("using video encoding",s));const l=s.maxFramerate,d=new Re(e,t,s.maxBitrate,s.maxFramerate,s.priority);if(c&&vs(u)){const m=new ku(c),f=[];if(m.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(c));const g=fn();if(Pi()||Nn()||(g==null?void 0:g.name)==="Chrome"&&rr(g==null?void 0:g.version,"113")<0){const y=m.suffix=="h"?2:3;for(let b=0;b<m.spatial;b+=1)f.push({rid:Hp[2-b],maxBitrate:s.maxBitrate/Math.pow(y,b),maxFramerate:d.encoding.maxFramerate});f[0].scalabilityMode=c}else f.push({maxBitrate:s.maxBitrate,maxFramerate:d.encoding.maxFramerate,scalabilityMode:c});return d.encoding.priority&&(f[0].priority=d.encoding.priority,f[0].networkPriority=d.encoding.priority),le.debug("using svc encoding",{encodings:f}),f}if(!a)return[s];let h=[];n?h=(r=WS(i==null?void 0:i.screenShareSimulcastLayers))!==null&&r!==void 0?r:qS(n,d):h=(o=WS(i==null?void 0:i.videoSimulcastLayers))!==null&&o!==void 0?o:qS(n,d);let p;if(h.length>0){const m=h[0];h.length>1&&([,p]=h);const f=Math.max(e,t);if(f>=960&&p)return Yp(e,t,[m,p,d],l);if(f>=480)return Yp(e,t,[m,d],l)}return Yp(e,t,[d])}function SU(n,e,t){var i,r,o,s;if(!t.backupCodec||t.backupCodec===!0||t.backupCodec.codec===t.videoCodec)return;e!==t.backupCodec.codec&&le.warn("requested a different codec than specified as backup",{serverRequested:e,backup:t.backupCodec.codec}),t.videoCodec=e,t.videoEncoding=t.backupCodec.encoding;const a=n.mediaStreamTrack.getSettings(),c=(i=a.width)!==null&&i!==void 0?i:(r=n.dimensions)===null||r===void 0?void 0:r.width,u=(o=a.height)!==null&&o!==void 0?o:(s=n.dimensions)===null||s===void 0?void 0:s.height;return n.source===N.Source.ScreenShare&&t.simulcast&&(t.simulcast=!1),Kp(n.source===N.Source.ScreenShare,c,u,t)}function wU(n,e,t,i){const r=CU(n,e,t);let{encoding:o}=r[0];const s=Math.max(e,t);for(let a=0;a<r.length;a+=1){const c=r[a];if(o=c.encoding,c.width>=s)break}if(i)switch(i){case"av1":o=Object.assign({},o),o.maxBitrate=o.maxBitrate*.7;break;case"vp9":o=Object.assign({},o),o.maxBitrate=o.maxBitrate*.85;break}return o}function CU(n,e,t){if(n)return yU;const i=e>t?e/t:t/e;return Math.abs(i-16/9)<Math.abs(i-4/3)?gU:vU}function qS(n,e){if(n)return kU(e);const{width:t,height:i}=e,r=t>i?t/i:i/t;return Math.abs(r-16/9)<Math.abs(r-4/3)?bU:_U}function Yp(n,e,t,i){const r=[];if(t.forEach((o,s)=>{if(s>=Hp.length)return;const a=Math.min(n,e),u={rid:Hp[s],scaleResolutionDownBy:Math.max(1,a/Math.min(o.width,o.height)),maxBitrate:o.encoding.maxBitrate},l=i&&o.encoding.maxFramerate?Math.min(i,o.encoding.maxFramerate):o.encoding.maxFramerate;l&&(u.maxFramerate=l);const d=ao()||s===0;o.encoding.priority&&d&&(u.priority=o.encoding.priority,u.networkPriority=o.encoding.priority),r.push(u)}),Nn()&&yS()==="ios"){let o;r.forEach(a=>{o?a.maxFramerate&&a.maxFramerate>o&&(o=a.maxFramerate):o=a.maxFramerate});let s=!0;r.forEach(a=>{var c;a.maxFramerate!=o&&(s&&(s=!1,le.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),le.info('Setting framerate of encoding "'.concat((c=a.rid)!==null&&c!==void 0?c:"",'" to ').concat(o)),a.maxFramerate=o)})}return r}function WS(n){if(n)return n.sort((e,t)=>{const{encoding:i}=e,{encoding:r}=t;return i.maxBitrate>r.maxBitrate?1:i.maxBitrate<r.maxBitrate?-1:i.maxBitrate===r.maxBitrate&&i.maxFramerate&&r.maxFramerate?i.maxFramerate>r.maxFramerate?1:-1:0})}class ku{constructor(e){const t=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!t)throw new Error("invalid scalability mode");if(this.spatial=parseInt(t[1]),this.temporal=parseInt(t[2]),t.length>3)switch(t[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=t[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function TU(n){return n.source===N.Source.ScreenShare||n.constraints.height&&Oi(n.constraints.height)>=1080?"maintain-resolution":"balanced"}const xU=5e3;class Su extends zS{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3?arguments[3]:void 0;super(e,N.Kind.Video,t,i,r),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.monitorSender=()=>T(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let o;try{o=yield this.getSenderStats()}catch(a){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:a}));return}const s=new Map(o.map(a=>[a.rid,a]));if(this.prevStats){let a=0;s.forEach((c,u)=>{var l;const d=(l=this.prevStats)===null||l===void 0?void 0:l.get(u);a+=bu(c,d)}),this._currentBitrate=a}this.prevStats=s}),this.senderLock=new jt}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var t;if(this.signalClient=e,!Wt())return;const i=(t=this.sender)===null||t===void 0?void 0:t.getParameters();i&&(this.encodings=i.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},$p))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return T(this,void 0,void 0,function*(){var t,i,r,o,s;yield e.pauseUpstream.call(this);try{for(var a=!0,c=xi(this.simulcastCodecs.values()),u;u=yield c.next(),t=u.done,!t;a=!0)o=u.value,a=!1,yield(s=o.sender)===null||s===void 0?void 0:s.replaceTrack(null)}catch(l){i={error:l}}finally{try{!a&&!t&&(r=c.return)&&(yield r.call(c))}finally{if(i)throw i.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return T(this,void 0,void 0,function*(){var t,i,r,o,s;yield e.resumeUpstream.call(this);try{for(var a=!0,c=xi(this.simulcastCodecs.values()),u;u=yield c.next(),t=u.done,!t;a=!0){o=u.value,a=!1;const l=o;yield(s=l.sender)===null||s===void 0?void 0:s.replaceTrack(l.mediaStreamTrack)}}catch(l){i={error:l}}finally{try{!a&&!t&&(r=c.return)&&(yield r.call(c))}finally{if(i)throw i.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return T(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===N.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{t()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return T(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.source===N.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{t()}})}setTrackMuted(e){super.setTrackMuted(e);for(const t of this.simulcastCodecs.values())t.mediaStreamTrack.enabled=!e}getSenderStats(){return T(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const t=[],i=yield this.sender.getStats();return i.forEach(r=>{var o;if(r.type==="outbound-rtp"){const s={type:"video",streamId:r.id,frameHeight:r.frameHeight,frameWidth:r.frameWidth,framesPerSecond:r.framesPerSecond,framesSent:r.framesSent,firCount:r.firCount,pliCount:r.pliCount,nackCount:r.nackCount,packetsSent:r.packetsSent,bytesSent:r.bytesSent,qualityLimitationReason:r.qualityLimitationReason,qualityLimitationDurations:r.qualityLimitationDurations,qualityLimitationResolutionChanges:r.qualityLimitationResolutionChanges,rid:(o=r.rid)!==null&&o!==void 0?o:r.id,retransmittedPacketsSent:r.retransmittedPacketsSent,targetBitrate:r.targetBitrate,timestamp:r.timestamp},a=i.get(r.remoteId);a&&(s.jitter=a.jitter,s.packetsLost=a.packetsLost,s.roundTripTime=a.roundTripTime),t.push(s)}}),t.sort((r,o)=>{var s,a;return((s=o.frameWidth)!==null&&s!==void 0?s:0)-((a=r.frameWidth)!==null&&a!==void 0?a:0)}),t})}setPublishingQuality(e){const t=[];for(let i=en.LOW;i<=en.HIGH;i+=1)t.push(new ip({quality:i,enabled:i<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(t)}restartTrack(e){return T(this,void 0,void 0,function*(){var t,i,r,o,s;let a;if(e){const d=Dp({video:e});typeof d.video!="boolean"&&(a=d.video)}yield this.restart(a);try{for(var c=!0,u=xi(this.simulcastCodecs.values()),l;l=yield u.next(),t=l.done,!t;c=!0){o=l.value,c=!1;const d=o;d.sender&&((s=d.sender.transport)===null||s===void 0?void 0:s.state)!=="closed"&&(d.mediaStreamTrack=this.mediaStreamTrack.clone(),yield d.sender.replaceTrack(d.mediaStreamTrack))}}catch(d){i={error:d}}finally{try{!c&&!t&&(r=u.return)&&(yield r.call(u))}finally{if(i)throw i.error}}})}setProcessor(e){const t=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return T(this,arguments,void 0,function(i){var r=this;let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s,a,c,u,l,d;if(yield t.setProcessor.call(r,i,o),!((l=r.processor)===null||l===void 0)&&l.processedTrack)try{for(var h=!0,p=xi(r.simulcastCodecs.values()),m;m=yield p.next(),s=m.done,!s;h=!0)u=m.value,h=!1,yield(d=u.sender)===null||d===void 0?void 0:d.replaceTrack(r.processor.processedTrack)}catch(f){a={error:f}}finally{try{!h&&!s&&(c=p.return)&&(yield c.call(p))}finally{if(a)throw a.error}}}()})}setDegradationPreference(e){return T(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const t=this.sender.getParameters();t.degradationPreference=e,this.sender.setParameters(t)}catch(t){this.log.warn("failed to set degradationPreference",Object.assign({error:t},this.logContext))}})}addSimulcastTrack(e,t){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const i={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:t};return this.simulcastCodecs.set(e,i),i}setSimulcastTrackSender(e,t){const i=this.simulcastCodecs.get(e);i&&(i.sender=t,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},xU))}setPublishingCodecs(e){return T(this,void 0,void 0,function*(){var t,i,r,o,s,a,c;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(e[0].qualities),[];this.subscribedCodecs=e;const u=[];try{for(t=!0,i=xi(e);r=yield i.next(),o=r.done,!o;t=!0){c=r.value,t=!1;const l=c;if(!this.codec||this.codec===l.codec)yield this.setPublishingLayers(l.qualities);else{const d=this.simulcastCodecs.get(l.codec);if(this.log.debug("try setPublishingCodec for ".concat(l.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:d})),!d||!d.sender){for(const h of l.qualities)if(h.enabled){u.push(l.codec);break}}else d.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(l.codec),this.logContext),yield GS(d.sender,d.encodings,l.qualities,this.senderLock,this.log,this.logContext))}}}catch(l){s={error:l}}finally{try{!t&&!o&&(a=i.return)&&(yield a.call(i))}finally{if(s)throw s.error}}return u})}setPublishingLayers(e){return T(this,void 0,void 0,function*(){this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:e})),!(!this.sender||!this.encodings)&&(yield GS(this.sender,this.encodings,e,this.senderLock,this.log,this.logContext))})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return T(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),gS()&&this.isInBackground&&this.source===N.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function GS(n,e,t,i,r,o){return T(this,void 0,void 0,function*(){const s=yield i.lock();r.debug("setPublishingLayersForSender",Object.assign(Object.assign({},o),{sender:n,qualities:t,senderEncodings:e}));try{const a=n.getParameters(),{encodings:c}=a;if(!c)return;if(c.length!==e.length){r.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},o),{encodings:c,senderEncodings:e}));return}let u=!1;const l=fn();if((l==null?void 0:l.name)==="Chrome"&&rr(l==null?void 0:l.version,"133")>0&&c[0].scalabilityMode){const h=c[0],p=new ku(h.scalabilityMode);let m=Qr.OFF;if(t.forEach(f=>{f.enabled&&(m===Qr.OFF||f.quality>m)&&(m=f.quality)}),m===Qr.OFF)h.active&&(h.active=!1,u=!0);else if(!h.active||p.spatial!==m+1){u=!0,h.active=!0;const f=new ku(e[0].scalabilityMode);p.spatial=m+1,p.suffix=f.suffix,p.spatial===1&&(p.suffix=void 0),h.scalabilityMode=p.toString(),h.scaleResolutionDownBy=Math.pow(2,2-m),e[0].maxBitrate&&(h.maxBitrate=e[0].maxBitrate/(h.scaleResolutionDownBy*h.scaleResolutionDownBy))}}else c.forEach((h,p)=>{var m;let f=(m=h.rid)!==null&&m!==void 0?m:"";f===""&&(f="q");const g=$S(f),y=t.find(b=>b.quality===g);y&&h.active!==y.enabled&&(u=!0,h.active=y.enabled,r.debug("setting layer ".concat(y.quality," to ").concat(h.active?"enabled":"disabled"),o),ao()&&(y.enabled?(h.scaleResolutionDownBy=e[p].scaleResolutionDownBy,h.maxBitrate=e[p].maxBitrate,h.maxFrameRate=e[p].maxFrameRate):(h.scaleResolutionDownBy=4,h.maxBitrate=10,h.maxFrameRate=2)))});u&&(a.encodings=c,r.debug("setting encodings",Object.assign(Object.assign({},o),{encodings:a.encodings})),yield n.setParameters(a))}finally{s()}})}function $S(n){switch(n){case"f":return en.HIGH;case"h":return en.MEDIUM;case"q":return en.LOW;default:return en.HIGH}}function HS(n,e,t,i){if(!t)return[new tr({quality:en.HIGH,width:n,height:e,bitrate:0,ssrc:0})];if(i){const r=t[0].scalabilityMode,o=new ku(r),s=[],a=o.suffix=="h"?1.5:2,c=o.suffix=="h"?2:3;for(let u=0;u<o.spatial;u+=1)s.push(new tr({quality:Math.min(en.HIGH,o.spatial-1)-u,width:Math.ceil(n/Math.pow(a,u)),height:Math.ceil(e/Math.pow(a,u)),bitrate:t[0].maxBitrate?Math.ceil(t[0].maxBitrate/Math.pow(c,u)):0,ssrc:0}));return s}return t.map(r=>{var o,s,a;const c=(o=r.scaleResolutionDownBy)!==null&&o!==void 0?o:1;let u=$S((s=r.rid)!==null&&s!==void 0?s:"");return new tr({quality:u,width:Math.ceil(n/c),height:Math.ceil(e/c),bitrate:(a=r.maxBitrate)!==null&&a!==void 0?a:0,ssrc:0})})}const KS="_lossy",YS="_reliable",EU=2*1e3,Xp="leave-reconnect";var gn;(function(n){n[n.New=0]="New",n[n.Connected=1]="Connected",n[n.Disconnected=2]="Disconnected",n[n.Reconnecting=3]="Reconnecting",n[n.Closed=4]="Closed"})(gn||(gn={}));class IU extends Mn.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var t;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=Wp.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.subscriberPrimary=!1,this.pcState=gn.New,this._isClosed=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=le,this.handleDataChannel=i=>T(this,[i],void 0,function(r){var o=this;let{channel:s}=r;return function*(){if(s){if(s.label===YS)o.reliableDCSub=s;else if(s.label===KS)o.lossyDCSub=s;else return;o.log.debug("on data channel ".concat(s.id,", ").concat(s.label),o.logContext),s.onmessage=o.handleDataMessage}}()}),this.handleDataMessage=i=>T(this,void 0,void 0,function*(){var r,o;const s=yield this.dataProcessLock.lock();try{let a;if(i.data instanceof ArrayBuffer)a=i.data;else if(i.data instanceof Blob)a=yield i.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:i.data}));return}const c=zt.fromBinary(new Uint8Array(a));((r=c.value)===null||r===void 0?void 0:r.case)==="speaker"?this.emit(B.ActiveSpeakersUpdate,c.value.value.speakers):(((o=c.value)===null||o===void 0?void 0:o.case)==="user"&&PU(c,c.value.value),this.emit(B.DataPacketReceived,c))}finally{s()}}),this.handleDataError=i=>{const o=i.currentTarget.maxRetransmits===0?"lossy":"reliable";if(i instanceof ErrorEvent&&i.error){const{error:s}=i.error;this.log.error("DataChannel error on ".concat(o,": ").concat(i.message),Object.assign(Object.assign({},this.logContext),{error:s}))}else this.log.error("Unknown DataChannel error on ".concat(o),Object.assign(Object.assign({},this.logContext),{event:i}))},this.handleBufferedAmountLow=i=>{const o=i.currentTarget.maxRetransmits===0?me.LOSSY:me.RELIABLE;this.updateAndEmitDCBufferStatus(o)},this.handleDisconnect=(i,r)=>{if(this._isClosed)return;this.log.warn("".concat(i," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const o=c=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(c,"ms. giving up"),this.logContext),this.emit(B.Disconnected),this.close()},s=Date.now()-this.reconnectStart;let a=this.getNextRetryDelay({elapsedMs:s,retryCount:this.reconnectAttempts});if(a===null){o(s);return}i===Xp&&(a=0),this.log.debug("reconnecting in ".concat(a,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=_t.setTimeout(()=>this.attemptReconnect(r).finally(()=>this.reconnectTimeout=void 0),a)},this.waitForRestarted=()=>new Promise((i,r)=>{this.pcState===gn.Connected&&i();const o=()=>{this.off(B.Disconnected,s),i()},s=()=>{this.off(B.Restarted,o),r()};this.once(B.Restarted,o),this.once(B.Disconnected,s)}),this.updateAndEmitDCBufferStatus=i=>{const r=this.isBufferStatusLow(i);typeof r<"u"&&r!==this.dcBufferStatus.get(i)&&(this.dcBufferStatus.set(i,r),this.emit(B.DCBufferStatusChanged,r,i))},this.isBufferStatusLow=i=>{const r=this.dataChannelForKind(i);if(r)return r.bufferedAmount<=r.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===je.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(eo.RR_SIGNAL_DISCONNECTED))},this.log=Kn((t=e.loggerName)!==null&&t!==void 0?t:pn.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new Up(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.registerOnLineListener(),this.closingLock=new jt,this.dataProcessLock=new jt,this.dcBufferStatus=new Map([[me.LOSSY,!0],[me.RELIABLE,!0]]),this.client.onParticipantUpdate=i=>this.emit(B.ParticipantUpdate,i),this.client.onConnectionQuality=i=>this.emit(B.ConnectionQualityUpdate,i),this.client.onRoomUpdate=i=>this.emit(B.RoomUpdate,i),this.client.onSubscriptionError=i=>this.emit(B.SubscriptionError,i),this.client.onSubscriptionPermissionUpdate=i=>this.emit(B.SubscriptionPermissionUpdate,i),this.client.onSpeakersChanged=i=>this.emit(B.SpeakersChanged,i),this.client.onStreamStateUpdate=i=>this.emit(B.StreamStateChanged,i),this.client.onRequestResponse=i=>this.emit(B.SignalRequestResponse,i)}get logContext(){var e,t,i,r,o,s,a,c;return{room:(t=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||t===void 0?void 0:t.name,roomID:(r=(i=this.latestJoinResponse)===null||i===void 0?void 0:i.room)===null||r===void 0?void 0:r.sid,participant:(s=(o=this.latestJoinResponse)===null||o===void 0?void 0:o.participant)===null||s===void 0?void 0:s.identity,pID:(c=(a=this.latestJoinResponse)===null||a===void 0?void 0:a.participant)===null||c===void 0?void 0:c.sid}}join(e,t,i,r){return T(this,void 0,void 0,function*(){this.url=e,this.token=t,this.signalOpts=i,this.maxJoinAttempts=i.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const o=yield this.client.join(e,t,i,r);return this._isClosed=!1,this.latestJoinResponse=o,this.subscriberPrimary=o.subscriberPrimary,this.pcManager||(yield this.configure(o)),(!this.subscriberPrimary||o.fastPublish)&&this.negotiate(),this.clientConfiguration=o.clientConfiguration,setTimeout(()=>{this.emit(B.SignalConnected)},10),o}catch(o){if(o instanceof Ae&&o.reason===pe.ServerUnreachable&&(this.log.warn("Couldn't connect to server, attempt ".concat(this.joinAttempts," of ").concat(this.maxJoinAttempts),this.logContext),this.joinAttempts<this.maxJoinAttempts))return this.join(e,t,i,r);throw o}})}close(){return T(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(B.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return T(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const t=i=>{i&&(i.close(),i.onbufferedamountlow=null,i.onclose=null,i.onclosing=null,i.onerror=null,i.onmessage=null,i.onopen=null)};t(this.lossyDC),t(this.lossyDCSub),t(this.reliableDC),t(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0})}cleanupClient(){return T(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new Yn("a track with the same ID has already been published");return new Promise((t,i)=>{const r=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],i(new Ae("publication of local track timed out, no response from server",pe.InternalError))},1e4);this.pendingTrackResolvers[e.cid]={resolve:o=>{clearTimeout(r),t(o)},reject:()=>{clearTimeout(r),i(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:t}=this.pendingTrackResolvers[e.track.id];t&&t(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(t){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:t}))}return!1}updateMuteStatus(e,t){this.client.sendMuteTrack(e,t)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return T(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e){return T(this,void 0,void 0,function*(){var t,i;if(this.pcManager&&this.pcManager.currentState!==Xe.NEW)return;this.participantSid=(t=e.participant)===null||t===void 0?void 0:t.sid;const r=this.makeRTCConfiguration(e);this.pcManager=new pU(r,e.subscriberPrimary,this.loggerOptions),this.emit(B.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(o,s)=>{this.client.sendIceCandidate(o,s)},this.pcManager.onPublisherOffer=o=>{this.client.sendOffer(o)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(o,s,a)=>T(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(o),this.logContext),["closed","disconnected","failed"].includes(s)&&(this.publisherConnectionPromise=void 0),o===Xe.CONNECTED){const l=this.pcState===gn.New;this.pcState=gn.Connected,l&&this.emit(B.Connected,e)}else o===Xe.FAILED&&this.pcState===gn.Connected&&(this.pcState=gn.Disconnected,this.handleDisconnect("peerconnection failed",a==="failed"?eo.RR_SUBSCRIBER_FAILED:eo.RR_PUBLISHER_FAILED));const c=this.client.isDisconnected||this.client.currentState===je.RECONNECTING,u=[Xe.FAILED,Xe.CLOSING,Xe.CLOSED].includes(o);c&&u&&!this._isClosed&&this.emit(B.Offline)}),this.pcManager.onTrack=o=>{this.emit(B.MediaTrackAdded,o.track,o.streams[0],o.receiver)},RU((i=e.serverInfo)===null||i===void 0?void 0:i.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=e=>T(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type})),yield this.pcManager.setPublisherAnswer(e))}),this.client.onTrickle=(e,t)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:t})),this.pcManager.addIceCandidate(e,t))},this.client.onOffer=e=>T(this,void 0,void 0,function*(){if(!this.pcManager)return;const t=yield this.pcManager.createSubscriberAnswerFromOffer(e);this.client.sendAnswer(t)}),this.client.onLocalTrackPublished=e=>{var t;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:(t=e.track)===null||t===void 0?void 0:t.sid})),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));return}const{resolve:i}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],i(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(B.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(B.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e},this.client.onRemoteMuteChanged=(e,t)=>{this.emit(B.RemoteMute,e,t)},this.client.onSubscribedQualityUpdate=e=>{this.emit(B.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var t;this.participantSid=(t=e.participant)===null||t===void 0?void 0:t.sid,this.emit(B.RoomMoved,e)},this.client.onClose=()=>{this.handleDisconnect("signal",eo.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:e==null?void 0:e.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(e.regions)),e.action){case io.DISCONNECT:this.emit(B.Disconnected,e==null?void 0:e.reason),this.close();break;case io.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(Xp);break;case io.RESUME:this.handleDisconnect(Xp)}}}makeRTCConfiguration(e){var t;const i=Object.assign({},this.rtcConfig);if(!((t=this.signalOpts)===null||t===void 0)&&t.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),i.encodedInsertableStreams=!0),e.iceServers&&!i.iceServers){const r=[];e.iceServers.forEach(o=>{const s={urls:o.urls};o.username&&(s.username=o.username),o.credential&&(s.credential=o.credential),r.push(s)}),i.iceServers=r}return e.clientConfiguration&&e.clientConfiguration.forceRelay===ps.ENABLED&&(i.iceTransportPolicy="relay"),i.sdpSemantics="unified-plan",i.continualGatheringPolicy="gather_continually",i}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(KS,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(YS,{ordered:!0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=this.handleBufferedAmountLow,this.reliableDC.onbufferedamountlow=this.handleBufferedAmountLow)}createSender(e,t,i){return T(this,void 0,void 0,function*(){if(wp())return yield this.createTransceiverRTCRtpSender(e,t,i);if(Cp())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new lt("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,t,i,r){return T(this,void 0,void 0,function*(){if(wp())return this.createSimulcastTransceiverSender(e,t,i,r);if(Cp())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new lt("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,t,i){return T(this,void 0,void 0,function*(){if(!this.pcManager)throw new lt("publisher is closed");const r=[];e.mediaStream&&r.push(e.mediaStream),uo(e)&&(e.codec=t.videoCodec);const o={direction:"sendonly",streams:r};return i&&(o.sendEncodings=i),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,o)).sender})}createSimulcastTransceiverSender(e,t,i,r){return T(this,void 0,void 0,function*(){if(!this.pcManager)throw new lt("publisher is closed");const o={direction:"sendonly"};r&&(o.sendEncodings=r);const s=yield this.pcManager.addPublisherTransceiver(t.mediaStreamTrack,o);if(i.videoCodec)return e.setSimulcastTrackSender(i.videoCodec,s.sender),s.sender})}createRTCRtpSender(e){return T(this,void 0,void 0,function*(){if(!this.pcManager)throw new lt("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return T(this,void 0,void 0,function*(){var t,i,r;if(!this._isClosed){if(this.attemptingReconnect){le.warn("already attempting reconnect, returning early",this.logContext);return}(((t=this.clientConfiguration)===null||t===void 0?void 0:t.resumeConnection)===ps.DISABLED||((r=(i=this.pcManager)===null||i===void 0?void 0:i.currentState)!==null&&r!==void 0?r:Xe.NEW)===Xe.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(o){this.reconnectAttempts+=1;let s=!0;o instanceof lt?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:o})),s=!1):o instanceof ho||(this.fullReconnectOnNext=!0),s?this.handleDisconnect("reconnect",eo.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up"),this.logContext),this.emit(B.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(t){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:t}))}return null}restartConnection(e){return T(this,void 0,void 0,function*(){var t,i,r;try{if(!this.url||!this.token)throw new lt("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(B.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let o;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new ho;o=yield this.join(e??this.url,this.token,this.signalOpts)}catch(s){throw s instanceof Ae&&s.reason===pe.NotAllowed?new lt("could not reconnect, token might be expired"):new ho}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(B.SignalRestarted,o),yield this.waitForPCReconnected(),this.client.currentState!==je.CONNECTED)throw new ho("Signal connection got severed during reconnect");(t=this.regionUrlProvider)===null||t===void 0||t.resetAttempts(),this.emit(B.Restarted)}catch(o){const s=yield(i=this.regionUrlProvider)===null||i===void 0?void 0:i.getNextBestRegionUrl();if(s){yield this.restartConnection(s);return}else throw(r=this.regionUrlProvider)===null||r===void 0||r.resetAttempts(),o}})}resumeConnection(e){return T(this,void 0,void 0,function*(){var t;if(!this.url||!this.token)throw new lt("could not reconnect, url or token not saved");if(!this.pcManager)throw new lt("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(B.Resuming);let i;try{this.setupSignalClientCallbacks(),i=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(r){let o="";throw r instanceof Error&&(o=r.message,this.log.error(r.message,Object.assign(Object.assign({},this.logContext),{error:r}))),r instanceof Ae&&r.reason===pe.NotAllowed?new lt("could not reconnect, token might be expired"):r instanceof Ae&&r.reason===pe.LeaveRequest?r:new ho(o)}if(this.emit(B.SignalResumed),i){const r=this.makeRTCConfiguration(i);this.pcManager.updateConfiguration(r)}else this.log.warn("Did not receive reconnect response",this.logContext);if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==je.CONNECTED)throw new ho("Signal connection got severed during reconnect");this.client.setReconnected(),((t=this.reliableDC)===null||t===void 0?void 0:t.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),this.emit(B.Resumed)})}waitForPCInitialConnection(e,t){return T(this,void 0,void 0,function*(){if(!this.pcManager)throw new lt("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(t,e)})}waitForPCReconnected(){return T(this,void 0,void 0,function*(){this.pcState=gn.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield qt(EU),!this.pcManager)throw new lt("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=gn.Connected}catch(e){throw this.pcState=gn.Disconnected,new Ae("could not establish PC connection, ".concat(e.message),pe.InternalError)}})}publishRpcResponse(e,t,i,r){return T(this,void 0,void 0,function*(){const o=new zt({destinationIdentities:[e],kind:me.RELIABLE,value:{case:"rpcResponse",value:new tk({requestId:t,value:r?{case:"error",value:r.toProto()}:{case:"payload",value:i??""}})}});yield this.sendDataPacket(o,me.RELIABLE)})}publishRpcAck(e,t){return T(this,void 0,void 0,function*(){const i=new zt({destinationIdentities:[e],kind:me.RELIABLE,value:{case:"rpcAck",value:new ek({requestId:t})}});yield this.sendDataPacket(i,me.RELIABLE)})}sendDataPacket(e,t){return T(this,void 0,void 0,function*(){const i=e.toBinary();yield this.ensurePublisherConnected(t);const r=this.dataChannelForKind(t);r&&r.send(i),this.updateAndEmitDCBufferStatus(t)})}waitForBufferStatusLow(e){return new Promise((t,i)=>T(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))t();else{const r=()=>i("Engine closed");for(this.once(B.Closing,r);!this.dcBufferStatus.get(e);)yield qt(10);this.off(B.Closing,r),t()}}))}ensureDataTransportConnected(e){return T(this,arguments,void 0,function(t){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){var o;if(!i.pcManager)throw new lt("PC manager is closed");const s=r?i.pcManager.subscriber:i.pcManager.publisher,a=r?"Subscriber":"Publisher";if(!s)throw new Ae("".concat(a," connection not set"),pe.InternalError);let c=!1;!r&&!i.dataChannelForKind(t,r)&&(i.createDataChannels(),c=!0),!c&&!r&&!i.pcManager.publisher.isICEConnected&&i.pcManager.publisher.getICEConnectionState()!=="checking"&&(c=!0),c&&i.negotiate();const u=i.dataChannelForKind(t,r);if((u==null?void 0:u.readyState)==="open")return;const l=new Date().getTime()+i.peerConnectionTimeout;for(;new Date().getTime()<l;){if(s.isICEConnected&&((o=i.dataChannelForKind(t,r))===null||o===void 0?void 0:o.readyState)==="open")return;yield qt(50)}throw new Ae("could not establish ".concat(a," connection, state: ").concat(s.getICEConnectionState()),pe.InternalError)}()})}ensurePublisherConnected(e){return T(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==Xe.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return T(this,void 0,void 0,function*(){return new Promise((e,t)=>T(this,void 0,void 0,function*(){if(!this.pcManager){t(new gp("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const i=new AbortController,r=()=>{i.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&t("cannot negotiate on closed engine"),this.on(B.Closing,r),this.pcManager.publisher.once(lo.RTPVideoPayloadTypes,o=>{const s=new Map;o.forEach(a=>{const c=a.codec.toLowerCase();F3(c)&&s.set(a.payload,c)}),this.emit(B.RTPVideoMapUpdate,s)});try{yield this.pcManager.negotiate(i),e()}catch(o){o instanceof gp&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",eo.RR_UNKNOWN),t(o)}finally{this.off(B.Closing,r)}}))})}dataChannelForKind(e,t){if(t){if(e===me.LOSSY)return this.lossyDCSub;if(e===me.RELIABLE)return this.reliableDCSub}else{if(e===me.LOSSY)return this.lossyDC;if(e===me.RELIABLE)return this.reliableDC}}sendSyncState(e,t){var i,r;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const o=this.pcManager.subscriber.getLocalDescription(),s=this.pcManager.subscriber.getRemoteDescription(),a=(r=(i=this.signalOpts)===null||i===void 0?void 0:i.autoSubscribe)!==null&&r!==void 0?r:!0,c=new Array,u=new Array;e.forEach(l=>{l.isDesired!==a&&c.push(l.trackSid),l.isEnabled||u.push(l.trackSid)}),this.client.sendSyncState(new bk({answer:o?yu({sdp:o.sdp,type:o.type}):void 0,offer:s?yu({sdp:s.sdp,type:s.type}):void 0,subscription:new nu({trackSids:c,subscribe:!a,participantTracks:[]}),publishTracks:H3(t),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:u}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],t=(i,r)=>{(i==null?void 0:i.id)!==void 0&&i.id!==null&&e.push(new _k({label:i.label,id:i.id,target:r}))};return t(this.dataChannelForKind(me.LOSSY),hn.PUBLISHER),t(this.dataChannelForKind(me.RELIABLE),hn.PUBLISHER),t(this.dataChannelForKind(me.LOSSY,!0),hn.SUBSCRIBER),t(this.dataChannelForKind(me.RELIABLE,!0),hn.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&_t.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){Wt()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){Wt()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class ho extends Error{}function RU(n){return n!==void 0&&n>13}function PU(n,e){const t=n.participantIdentity?n.participantIdentity:e.participantIdentity;n.participantIdentity=t,e.participantIdentity=t;const i=n.destinationIdentities.length!==0?n.destinationIdentities:e.destinationIdentities;n.destinationIdentities=i,e.destinationIdentities=i}class Jp{constructor(e,t){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=t}updateToken(e){this.token=e}isCloud(){return xp(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(e){return T(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");(!this.regionSettings||Date.now()-this.lastUpdateAt>this.settingsCacheTime)&&(this.regionSettings=yield this.fetchRegionSettings(e));const t=this.regionSettings.regions.filter(i=>!this.attemptedRegions.find(r=>r.url===i.url));if(t.length>0){const i=t[0];return this.attemptedRegions.push(i),le.debug("next region: ".concat(i.region)),i.url}else return null})}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(e){return T(this,void 0,void 0,function*(){const t=yield fetch("".concat(OU(this.serverUrl),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:e});if(t.ok){const i=yield t.json();return this.lastUpdateAt=Date.now(),i}else throw new Ae("Could not fetch region settings: ".concat(t.statusText),t.status===401?pe.NotAllowed:pe.InternalError,t.status)})}setServerReportedRegions(e){this.regionSettings=e,this.lastUpdateAt=Date.now()}}function OU(n){return"".concat(n.protocol.replace("ws","http"),"//").concat(n.host,"/settings")}class XS{get info(){return this._info}constructor(e,t,i){this.reader=t,this.totalByteSize=i,this._info=e,this.bytesReceived=0}}class AU extends XS{handleChunkReceived(e){var t;this.bytesReceived+=e.content.byteLength;const i=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(t=this.onProgress)===null||t===void 0||t.call(this,i)}[Symbol.asyncIterator](){const e=this.reader.getReader();return{next:()=>T(this,void 0,void 0,function*(){try{const{done:t,value:i}=yield e.read();return t?{done:!0,value:void 0}:(this.handleChunkReceived(i),{done:!1,value:i.content})}catch{return{done:!0,value:void 0}}}),return(){return T(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return T(this,void 0,void 0,function*(){var e,t,i,r;let o=new Set;try{for(var s=!0,a=xi(this),c;c=yield a.next(),e=c.done,!e;s=!0){r=c.value,s=!1;const u=r;o.add(u)}}catch(u){t={error:u}}finally{try{!s&&!e&&(i=a.return)&&(yield i.call(a))}finally{if(t)throw t.error}}return Array.from(o)})}}class MU extends XS{constructor(e,t,i){super(e,t,i),this.receivedChunks=new Map}handleChunkReceived(e){var t;const i=gu(e.chunkIndex),r=this.receivedChunks.get(i);if(r&&r.version>e.version)return;this.receivedChunks.set(i,e),this.bytesReceived+=e.content.byteLength;const o=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(t=this.onProgress)===null||t===void 0||t.call(this,o)}[Symbol.asyncIterator](){const e=this.reader.getReader(),t=new TextDecoder;return{next:()=>T(this,void 0,void 0,function*(){try{const{done:i,value:r}=yield e.read();return i?{done:!0,value:void 0}:(this.handleChunkReceived(r),{done:!1,value:t.decode(r.content)})}catch{return{done:!0,value:void 0}}}),return(){return T(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return T(this,void 0,void 0,function*(){var e,t,i,r;let o="";try{for(var s=!0,a=xi(this),c;c=yield a.next(),e=c.done,!e;s=!0)r=c.value,s=!1,o+=r}catch(u){t={error:u}}finally{try{!s&&!e&&(i=a.return)&&(yield i.call(a))}finally{if(t)throw t.error}}return o})}}class JS{constructor(e,t,i){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=i,this.info=t}write(e){return this.defaultWriter.write(e)}close(){return T(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class NU extends JS{}class DU extends JS{}class ZS extends N{constructor(e,t,i,r,o){super(e,i,o),this.sid=t,this.receiver=r}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?F.Muted:F.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const t=i=>{i.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",t),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(F.Ended,this))};e.addEventListener("removetrack",t)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return T(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),$p)),K3()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var t;this.timeSyncHandle=requestAnimationFrame(()=>e());const i=(t=this.receiver)===null||t===void 0?void 0:t.getSynchronizationSources()[0];if(i){const{timestamp:r,rtpTimestamp:o}=i;o&&this.rtpTimestamp!==o&&(this.emit(F.TimeSyncUpdate,{timestamp:r,rtpTimestamp:o}),this.rtpTimestamp=o)}};e()}}class LU extends ZS{constructor(e,t,i,r,o,s){super(e,t,N.Kind.Audio,i,s),this.monitorReceiver=()=>T(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const a=yield this.getReceiverStats();a&&this.prevStats&&this.receiver&&(this._currentBitrate=bu(a,this.prevStats)),this.prevStats=a}),this.audioContext=r,this.webAudioPluginNodes=[],o&&(this.sinkId=o.deviceId)}setVolume(e){var t;for(const i of this.attachedElements)this.audioContext?(t=this.gainNode)===null||t===void 0||t.gain.setTargetAtTime(e,0,.1):i.volume=e;Nn()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(Nn())return 1;let e=0;return this.attachedElements.forEach(t=>{t.volume>e&&(e=t.volume)}),e}setSinkId(e){return T(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(t=>{if(Tp(t))return t.setSinkId(e)}))})}attach(e){const t=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&Tp(e)&&e.setSinkId(this.sinkId).catch(i=>{this.log.error("Failed to set sink id on remote audio track",i,this.logContext)}),this.audioContext&&t&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let t;return e?(t=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(t=super.detach(),this.disconnectWebAudio()),t}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,t){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(t.srcObject);let i=this.sourceNode;this.webAudioPluginNodes.forEach(r=>{i.connect(r),i=r}),this.gainNode=e.createGain(),i.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit(F.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(r=>{this.emit(F.AudioPlaybackFailed,r)})}disconnectWebAudio(){var e,t;(e=this.gainNode)===null||e===void 0||e.disconnect(),(t=this.sourceNode)===null||t===void 0||t.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return T(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let t;return e.forEach(i=>{i.type==="inbound-rtp"&&(t={type:"audio",streamId:i.id,timestamp:i.timestamp,jitter:i.jitter,bytesReceived:i.bytesReceived,concealedSamples:i.concealedSamples,concealmentEvents:i.concealmentEvents,silentConcealedSamples:i.silentConcealedSamples,silentConcealmentEvents:i.silentConcealmentEvents,totalAudioEnergy:i.totalAudioEnergy,totalSamplesDuration:i.totalSamplesDuration})}),t})}}const Zp=100;class UU extends ZS{constructor(e,t,i,r,o){super(e,t,N.Kind.Video,i,o),this.elementInfos=[],this.monitorReceiver=()=>T(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const s=yield this.getReceiverStats();s&&this.prevStats&&this.receiver&&(this._currentBitrate=bu(s,this.prevStats)),this.prevStats=s}),this.debouncedHandleResize=zp(()=>{this.updateDimensions()},Zp),this.adaptiveStreamSettings=r}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(t=>{e?so(this._mediaStreamTrack,t):oo(this._mediaStreamTrack,t)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(t=>t.element===e)===void 0){const t=new FU(e);this.observeElementInfo(t)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(t=>t===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const t=this.elementInfos.filter(i=>i===e);for(const i of t)i.stopObserving();this.elementInfos=this.elementInfos.filter(i=>i!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let t=[];if(e)return this.stopObservingElement(e),super.detach(e);t=super.detach();for(const i of t)this.stopObservingElement(i);return t}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return T(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let t,i="",r=new Map;return e.forEach(o=>{o.type==="inbound-rtp"?(i=o.codecId,t={type:"video",streamId:o.id,framesDecoded:o.framesDecoded,framesDropped:o.framesDropped,framesReceived:o.framesReceived,packetsReceived:o.packetsReceived,packetsLost:o.packetsLost,frameWidth:o.frameWidth,frameHeight:o.frameHeight,pliCount:o.pliCount,firCount:o.firCount,nackCount:o.nackCount,jitter:o.jitter,timestamp:o.timestamp,bytesReceived:o.bytesReceived,decoderImplementation:o.decoderImplementation}):o.type==="codec"&&r.set(o.id,o)}),t&&i!==""&&r.get(i)&&(t.mimeType=r.get(i).mimeType),t})}stopObservingElement(e){const t=this.elementInfos.filter(i=>i.element===e);for(const i of t)this.stopObservingElementInfo(i)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return T(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(){var e,t;const i=this.elementInfos.reduce((a,c)=>Math.max(a,c.visibilityChangedAt||0),0),r=!((t=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pauseVideoInBackground)!==null&&t!==void 0)||t?this.isInBackground:!1,o=this.elementInfos.some(a=>a.pictureInPicture),s=this.elementInfos.some(a=>a.visible)&&!r||o;if(this.lastVisible!==s){if(!s&&Date.now()-i<Zp){_t.setTimeout(()=>{this.updateVisibility()},Zp);return}this.lastVisible=s,this.emit(F.VisibilityChanged,s,this)}}updateDimensions(){var e,t;let i=0,r=0;const o=this.getPixelDensity();for(const s of this.elementInfos){const a=s.width()*o,c=s.height()*o;a+c>i+r&&(i=a,r=c)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===i&&((t=this.lastDimensions)===null||t===void 0?void 0:t.height)===r||(this.lastDimensions={width:i,height:r},this.emit(F.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const t=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return t==="screen"?bS():t||(bS()>2?2:1)}}class FU{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,t){this.onVisibilityChanged=i=>{var r;const{target:o,isIntersecting:s}=i;o===this.element&&(this.isIntersecting=s,this.isPiP=_s(this.element),this.visibilityChangedAt=Date.now(),(r=this.handleVisibilityChanged)===null||r===void 0||r.call(this))},this.onEnterPiP=()=>{var i,r,o;(r=(i=window.documentPictureInPicture)===null||i===void 0?void 0:i.window)===null||r===void 0||r.addEventListener("pagehide",this.onLeavePiP),this.isPiP=_s(this.element),(o=this.handleVisibilityChanged)===null||o===void 0||o.call(this)},this.onLeavePiP=()=>{var i;this.isPiP=_s(this.element),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this)},this.element=e,this.isIntersecting=t??Qp(e),this.isPiP=Wt()&&_s(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,t,i;this.isIntersecting=Qp(this.element),this.isPiP=_s(this.element),this.element.handleResize=()=>{var r;(r=this.handleResize)===null||r===void 0||r.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,kS().observe(this.element),_S().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(i=(t=window.documentPictureInPicture)===null||t===void 0?void 0:t.window)===null||i===void 0||i.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,t,i,r,o;(e=kS())===null||e===void 0||e.unobserve(this.element),(t=_S())===null||t===void 0||t.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(i=window.documentPictureInPicture)===null||i===void 0||i.removeEventListener("enter",this.onEnterPiP),(o=(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window)===null||o===void 0||o.removeEventListener("pagehide",this.onLeavePiP)}}function _s(n){var e,t;return document.pictureInPictureElement===n?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?Qp(n,(t=window.documentPictureInPicture)===null||t===void 0?void 0:t.window):!1}function Qp(n,e){const t=e||window;let i=n.offsetTop,r=n.offsetLeft;const o=n.offsetWidth,s=n.offsetHeight,{hidden:a}=n,{display:c}=getComputedStyle(n);for(;n.offsetParent;)n=n.offsetParent,i+=n.offsetTop,r+=n.offsetLeft;return i<t.pageYOffset+t.innerHeight&&r<t.pageXOffset+t.innerWidth&&i+s>t.pageYOffset&&r+o>t.pageXOffset&&!a&&c!=="none"}class Jn extends Mn.EventEmitter{constructor(e,t,i,r){var o;super(),this.metadataMuted=!1,this.encryption=$t.NONE,this.log=le,this.handleMuted=()=>{this.emit(F.Muted)},this.handleUnmuted=()=>{this.emit(F.Unmuted)},this.log=Kn((o=r==null?void 0:r.loggerName)!==null&&o!==void 0?o:pn.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=t,this.trackName=i,this.source=N.Source.Unknown}setTrack(e){this.track&&(this.track.off(F.Muted,this.handleMuted),this.track.off(F.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(F.Muted,this.handleMuted),e.on(F.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),Ce(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==$t.NONE}get audioTrack(){if(Xn(this.track))return this.track}get videoTrack(){if(uo(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=N.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===N.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(n){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(n.SubscriptionStatus||(n.SubscriptionStatus={})),function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"}(n.PermissionStatus||(n.PermissionStatus={}))})(Jn||(Jn={}));class ef extends Jn{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,t,i,r){super(e,t.sid,t.name,r),this.track=void 0,this.handleTrackEnded=()=>{this.emit(F.Ended)},this.updateInfo(t),this.setTrack(i)}setTrack(e){this.track&&this.track.off(F.Ended,this.handleTrackEnded),super.setTrack(e),e&&e.on(F.Ended,this.handleTrackEnded)}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return T(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return T(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return T(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return T(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(Xn(this.track)){const t=this.track.getSourceTrackSettings(),i=new Set;return t.autoGainControl&&i.add(dn.TF_AUTO_GAIN_CONTROL),t.echoCancellation&&i.add(dn.TF_ECHO_CANCELLATION),t.noiseSuppression&&i.add(dn.TF_NOISE_SUPPRESSION),t.channelCount&&t.channelCount>1&&i.add(dn.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||i.add(dn.TF_NO_DTX),this.track.enhancedNoiseCancellation&&i.add(dn.TF_ENHANCED_NOISE_CANCELLATION),Array.from(i.values())}else return[]}}function wu(n,e){return T(this,void 0,void 0,function*(){n??(n={});let t=!1;const{audioProcessor:i,videoProcessor:r,optionsWithoutProcessor:o}=IS(n);let s=o.audio,a=o.video;if(i&&typeof o.audio=="object"&&(o.audio.processor=i),r&&typeof o.video=="object"&&(o.video.processor=r),n.audio&&typeof o.audio=="object"&&typeof o.audio.deviceId=="string"){const d=o.audio.deviceId;o.audio.deviceId={exact:d},t=!0,s=Object.assign(Object.assign({},o.audio),{deviceId:{ideal:d}})}if(o.video&&typeof o.video=="object"&&typeof o.video.deviceId=="string"){const d=o.video.deviceId;o.video.deviceId={exact:d},t=!0,a=Object.assign(Object.assign({},o.video),{deviceId:{ideal:d}})}(o.audio===!0||typeof o.audio=="object"&&!o.audio.deviceId)&&(o.audio={deviceId:"default"}),o.video===!0?o.video={deviceId:"default"}:typeof o.video=="object"&&!o.video.deviceId&&(o.video.deviceId="default");const c=CS(o,FS,BS),u=Dp(c),l=navigator.mediaDevices.getUserMedia(u);o.audio&&(ft.userMediaPromiseMap.set("audioinput",l),l.catch(()=>ft.userMediaPromiseMap.delete("audioinput"))),o.video&&(ft.userMediaPromiseMap.set("videoinput",l),l.catch(()=>ft.userMediaPromiseMap.delete("videoinput")));try{const d=yield l;return yield Promise.all(d.getTracks().map(h=>T(this,void 0,void 0,function*(){const p=h.kind==="audio";let m=p?c.audio:c.video;(typeof m=="boolean"||!m)&&(m={});let f;const g=p?u.audio:u.video;typeof g!="boolean"&&(f=g);const y=h.getSettings().deviceId;f!=null&&f.deviceId&&Oi(f.deviceId)!==y?f.deviceId=y:f||(f={deviceId:y});const b=mU(h,f,e);return b.kind===N.Kind.Video?b.source=N.Source.Camera:b.kind===N.Kind.Audio&&(b.source=N.Source.Microphone),b.mediaStream=d,Xn(b)&&i?yield b.setProcessor(i):uo(b)&&r&&(yield b.setProcessor(r)),b})))}catch(d){if(!t)throw d;return wu(Object.assign(Object.assign({},n),{audio:s,video:a}),e)}})}function BU(n){return T(this,void 0,void 0,function*(){return(yield wu({audio:!1,video:n??!0}))[0]})}function jU(n){return T(this,void 0,void 0,function*(){return(yield wu({audio:n??!0,video:!1}))[0]})}var Ni;(function(n){n.Excellent="excellent",n.Good="good",n.Poor="poor",n.Lost="lost",n.Unknown="unknown"})(Ni||(Ni={}));function VU(n){switch(n){case hs.EXCELLENT:return Ni.Excellent;case hs.GOOD:return Ni.Good;case hs.POOR:return Ni.Poor;case hs.LOST:return Ni.Lost;default:return Ni.Unknown}}class QS extends Mn.EventEmitter{get logContext(){var e,t;return Object.assign({},(t=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||t===void 0?void 0:t.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===tu.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===to.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,t,i,r,o,s){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:tu.STANDARD;var c;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=Ni.Unknown,this.log=le,this.log=Kn((c=s==null?void 0:s.loggerName)!==null&&c!==void 0?c:pn.Participant),this.loggerOptions=s,this.setMaxListeners(100),this.sid=e,this.identity=t,this.name=i,this.metadata=r,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=a,this._attributes=o??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,t]of this.trackPublications)if(t.source===e)return t}getTrackPublicationByName(e){for(const[,t]of this.trackPublications)if(t.trackName===e)return t}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new Pp,this.once(z.Active,()=>{var e,t;(t=(e=this.activeFuture)===null||e===void 0?void 0:e.resolve)===null||t===void 0||t.call(e),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const t=this.getTrackPublication(N.Source.Camera);return!(!((e=t==null?void 0:t.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const t=this.getTrackPublication(N.Source.Microphone);return!(!((e=t==null?void 0:t.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(N.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){var t;return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===to.ACTIVE&&((t=this.participantInfo)===null||t===void 0?void 0:t.state)!==to.ACTIVE&&this.emit(z.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,!0)}_setMetadata(e){const t=this.metadata!==e,i=this.metadata;this.metadata=e,t&&this.emit(z.ParticipantMetadataChanged,i)}_setName(e){const t=this.name!==e;this.name=e,t&&this.emit(z.ParticipantNameChanged,e)}_setAttributes(e){const t=Y3(this.attributes,e);this._attributes=e,Object.keys(t).length>0&&this.emit(z.AttributesChanged,t)}setPermissions(e){var t,i,r,o,s,a;const c=this.permissions,u=e.canPublish!==((t=this.permissions)===null||t===void 0?void 0:t.canPublish)||e.canSubscribe!==((i=this.permissions)===null||i===void 0?void 0:i.canSubscribe)||e.canPublishData!==((r=this.permissions)===null||r===void 0?void 0:r.canPublishData)||e.hidden!==((o=this.permissions)===null||o===void 0?void 0:o.hidden)||e.recorder!==((s=this.permissions)===null||s===void 0?void 0:s.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((l,d)=>{var h;return l!==((h=this.permissions)===null||h===void 0?void 0:h.canPublishSources[d])})||e.canSubscribeMetrics!==((a=this.permissions)===null||a===void 0?void 0:a.canSubscribeMetrics);return this.permissions=e,u&&this.emit(z.ParticipantPermissionsChanged,c),u}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(z.IsSpeakingChanged,e))}setConnectionQuality(e){const t=this._connectionQuality;this._connectionQuality=VU(e),t!==this._connectionQuality&&this.emit(z.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,t;this.activeFuture&&((t=(e=this.activeFuture).reject)===null||t===void 0||t.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(t=>Xn(t.track)&&t.track.setAudioContext(e))}addTrackPublication(e){e.on(F.Muted,()=>{this.emit(z.TrackMuted,e)}),e.on(F.Unmuted,()=>{this.emit(z.TrackUnmuted,e)});const t=e;switch(t.track&&(t.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case N.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case N.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function zU(n){var e,t,i;if(!n.participantSid&&!n.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new vk({participantIdentity:(e=n.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(t=n.participantSid)!==null&&t!==void 0?t:"",allTracks:(i=n.allowAll)!==null&&i!==void 0?i:!1,trackSids:n.allowedTrackSids||[]})}const ew=15e3;class qU extends QS{constructor(e,t,i,r,o){super(e,t,void 0,void 0,void 0,{loggerName:r.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=$t.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new Pp)},this.handleReconnected=()=>{var s,a;(a=(s=this.reconnectFuture)===null||s===void 0?void 0:s.resolve)===null||a===void 0||a.call(s),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleDisconnected=()=>{var s,a;this.reconnectFuture&&(this.reconnectFuture.promise.catch(c=>this.log.warn(c.message,this.logContext)),(a=(s=this.reconnectFuture)===null||s===void 0?void 0:s.reject)===null||a===void 0||a.call(s,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0)},this.handleSignalRequestResponse=s=>{const{requestId:a,reason:c,message:u}=s,l=this.pendingSignalRequests.get(a);l&&(c!==rp.OK&&l.reject(new hS(u,c)),this.pendingSignalRequests.delete(a))},this.handleDataPacket=s=>{switch(s.value.case){case"rpcResponse":let a=s.value.value,c=null,u=null;a.value.case==="payload"?c=a.value.value:a.value.case==="error"&&(u=Je.fromProto(a.value.value)),this.handleIncomingRpcResponse(a.requestId,c,u);break;case"rpcAck":let l=s.value.value;this.handleIncomingRpcAck(l.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",Object.assign(Object.assign({},this.logContext),{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions})),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(s=>zU(s)))},this.onTrackUnmuted=s=>{this.onTrackMuted(s,s.isUpstreamPaused)},this.onTrackMuted=(s,a)=>{if(a===void 0&&(a=!0),!s.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),Ce(s)));return}this.engine.updateMuteStatus(s.sid,a)},this.onTrackUpstreamPaused=s=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),Ce(s))),this.onTrackMuted(s,!0)},this.onTrackUpstreamResumed=s=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),Ce(s))),this.onTrackMuted(s,s.isMuted)},this.onTrackFeatureUpdate=s=>{const a=this.audioTrackPublications.get(s.sid);if(!a){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(s.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(a.trackSid,a.getTrackFeatures())},this.handleSubscribedQualityUpdate=s=>T(this,void 0,void 0,function*(){var a,c,u,l,d,h;if(!(!((d=this.roomOptions)===null||d===void 0)&&d.dynacast))return;const p=this.videoTrackPublications.get(s.trackSid);if(!p){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:s.trackSid}));return}if(s.subscribedCodecs.length>0){if(!p.videoTrack)return;const y=yield p.videoTrack.setPublishingCodecs(s.subscribedCodecs);try{for(var m=!0,f=xi(y),g;g=yield f.next(),a=g.done,!a;m=!0){l=g.value,m=!1;const b=l;E3(b)&&(this.log.debug("publish ".concat(b," for ").concat(p.videoTrack.sid),Object.assign(Object.assign({},this.logContext),Ce(p))),yield this.publishAdditionalCodecForTrack(p.videoTrack,b,p.options))}}catch(b){c={error:b}}finally{try{!m&&!a&&(u=f.return)&&(yield u.call(f))}finally{if(c)throw c.error}}}else s.subscribedQualities.length>0&&(yield(h=p.videoTrack)===null||h===void 0?void 0:h.setPublishingLayers(s.subscribedQualities))}),this.handleLocalTrackUnpublished=s=>{const a=this.trackPublications.get(s.trackSid);if(!a){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:s.trackSid}));return}this.unpublishTrack(a.track)},this.handleTrackEnded=s=>T(this,void 0,void 0,function*(){if(s.source===N.Source.ScreenShare||s.source===N.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),Ce(s))),this.unpublishTrack(s);else if(s.isUserProvided)yield s.mute();else if(sr(s)||Ai(s))try{if(Wt())try{const a=yield navigator==null?void 0:navigator.permissions.query({name:s.source===N.Source.Camera?"camera":"microphone"});if(a&&a.state==="denied")throw this.log.warn("user has revoked access to ".concat(s.source),Object.assign(Object.assign({},this.logContext),Ce(s))),a.onchange=()=>{a.state!=="denied"&&(s.isMuted||s.restartTrack(),a.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}s.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),Ce(s))),sr(s)?yield s.restartTrack({deviceId:"default"}):yield s.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),Ce(s))),yield s.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=i,this.roomOptions=r,this.setupEngine(i),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=o}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==$t.NONE}getTrackPublication(e){const t=super.getTrackPublication(e);if(t)return t}getTrackPublicationByName(e){const t=super.getTrackPublicationByName(e);if(t)return t}setupEngine(e){this.engine=e,this.engine.on(B.RemoteMute,(t,i)=>{const r=this.trackPublications.get(t);!r||!r.track||(i?r.mute():r.unmute())}),this.engine.on(B.Connected,this.handleReconnected).on(B.SignalRestarted,this.handleReconnected).on(B.SignalResumed,this.handleReconnected).on(B.Restarting,this.handleReconnecting).on(B.Resuming,this.handleReconnecting).on(B.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(B.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(B.Disconnected,this.handleDisconnected).on(B.SignalRequestResponse,this.handleSignalRequestResponse).on(B.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return T(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return T(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return T(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return T(this,arguments,void 0,function(t){var i=this;let{metadata:r,name:o,attributes:s}=t;return function*(){return new Promise((a,c)=>T(i,void 0,void 0,function*(){var u,l;try{let d=!1;const h=yield this.engine.client.sendUpdateLocalMetadata((u=r??this.metadata)!==null&&u!==void 0?u:"",(l=o??this.name)!==null&&l!==void 0?l:"",s),p=performance.now();for(this.pendingSignalRequests.set(h,{resolve:a,reject:m=>{c(m),d=!0},values:{name:o,metadata:r,attributes:s}});performance.now()-p<5e3&&!d;){if((!o||this.name===o)&&(!r||this.metadata===r)&&(!s||Object.entries(s).every(m=>{let[f,g]=m;return this.attributes[f]===g||g===""&&!this.attributes[f]}))){this.pendingSignalRequests.delete(h),a();return}yield qt(50)}c(new hS("Request to update local metadata timed out","TimeoutError"))}catch(d){d instanceof Error&&c(d)}}))}()})}setCameraEnabled(e,t,i){return this.setTrackEnabled(N.Source.Camera,e,t,i)}setMicrophoneEnabled(e,t,i){return this.setTrackEnabled(N.Source.Microphone,e,t,i)}setScreenShareEnabled(e,t,i){return this.setTrackEnabled(N.Source.ScreenShare,e,t,i)}setPermissions(e){const t=this.permissions,i=super.setPermissions(e);return i&&t&&this.emit(z.ParticipantPermissionsChanged,t),i}setE2EEEnabled(e){return T(this,void 0,void 0,function*(){this.encryptionType=e?$t.GCM:$t.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,t,i,r){return T(this,void 0,void 0,function*(){var o,s;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:t})),this.republishPromise&&(yield this.republishPromise);let a=this.getTrackPublication(e);if(t)if(a)yield a.unmute();else{let c;if(this.pendingPublishing.has(e)){const u=yield this.waitForPendingPublicationOfSource(e);return u||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield u==null?void 0:u.unmute(),u}this.pendingPublishing.add(e);try{switch(e){case N.Source.Camera:c=yield this.createTracks({video:(o=i)!==null&&o!==void 0?o:!0});break;case N.Source.Microphone:c=yield this.createTracks({audio:(s=i)!==null&&s!==void 0?s:!0});break;case N.Source.ScreenShare:c=yield this.createScreenTracks(Object.assign({},i));break;default:throw new Yn(e)}}catch(u){throw c==null||c.forEach(l=>{l.stop()}),u instanceof Error&&this.emit(z.MediaDevicesError,u),this.pendingPublishing.delete(e),u}try{const u=[];for(const d of c)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),Ce(d))),u.push(this.publishTrack(d,r));[a]=yield Promise.all(u)}catch(u){throw c==null||c.forEach(l=>{l.stop()}),u}finally{this.pendingPublishing.delete(e)}}else if(!(a!=null&&a.track)&&this.pendingPublishing.has(e)&&(a=yield this.waitForPendingPublicationOfSource(e),a||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),a&&a.track)if(e===N.Source.ScreenShare){a=yield this.unpublishTrack(a.track);const c=this.getTrackPublication(N.Source.ScreenShareAudio);c&&c.track&&this.unpublishTrack(c.track)}else yield a.mute();return a})}enableCameraAndMicrophone(){return T(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(N.Source.Camera)||this.pendingPublishing.has(N.Source.Microphone))){this.pendingPublishing.add(N.Source.Camera),this.pendingPublishing.add(N.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(t=>this.publishTrack(t)))}finally{this.pendingPublishing.delete(N.Source.Camera),this.pendingPublishing.delete(N.Source.Microphone)}}})}createTracks(e){return T(this,void 0,void 0,function*(){var t,i;e??(e={});const r=CS(e,(t=this.roomOptions)===null||t===void 0?void 0:t.audioCaptureDefaults,(i=this.roomOptions)===null||i===void 0?void 0:i.videoCaptureDefaults);try{return(yield wu(r,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(a=>(Xn(a)&&(this.microphoneError=void 0,a.setAudioContext(this.audioContext),a.source=N.Source.Microphone,this.emit(z.AudioStreamAcquired)),uo(a)&&(this.cameraError=void 0,a.source=N.Source.Camera),a))}catch(o){throw o instanceof Error&&(e.audio&&(this.microphoneError=o),e.video&&(this.cameraError=o)),o}})}createScreenTracks(e){return T(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new mp("getDisplayMedia not supported");e.resolution===void 0&&!M3()&&(e.resolution=Sp.h1080fps30.resolution);const t=$3(e),i=yield navigator.mediaDevices.getDisplayMedia(t),r=i.getVideoTracks();if(r.length===0)throw new Yn("no video track found");const o=new Su(r[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});o.source=N.Source.ScreenShare,e.contentHint&&(o.mediaStreamTrack.contentHint=e.contentHint);const s=[o];if(i.getAudioTracks().length>0){this.emit(z.AudioStreamAcquired);const a=new _u(i.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});a.source=N.Source.ScreenShareAudio,s.push(a)}return s})}publishTrack(e,t){return T(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,t)})}publishOrRepublishTrack(e,t){return T(this,arguments,void 0,function(i,r){var o=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return function*(){var a,c,u,l;sr(i)&&i.setAudioContext(o.audioContext),yield(a=o.reconnectFuture)===null||a===void 0?void 0:a.promise,o.republishPromise&&!s&&(yield o.republishPromise),co(i)&&o.pendingPublishPromises.has(i)&&(yield o.pendingPublishPromises.get(i));let d;if(i instanceof MediaStreamTrack)d=i.getConstraints();else{d=i.constraints;let y;switch(i.source){case N.Source.Microphone:y="audioinput";break;case N.Source.Camera:y="videoinput"}y&&o.activeDeviceMap.has(y)&&(d=Object.assign(Object.assign({},d),{deviceId:o.activeDeviceMap.get(y)}))}if(i instanceof MediaStreamTrack)switch(i.kind){case"audio":i=new _u(i,d,!0,o.audioContext,{loggerName:o.roomOptions.loggerName,loggerContextCb:()=>o.logContext});break;case"video":i=new Su(i,d,!0,{loggerName:o.roomOptions.loggerName,loggerContextCb:()=>o.logContext});break;default:throw new Yn("unsupported MediaStreamTrack kind ".concat(i.kind))}else i.updateLoggerOptions({loggerName:o.roomOptions.loggerName,loggerContextCb:()=>o.logContext});let h;if(o.trackPublications.forEach(y=>{y.track&&y.track===i&&(h=y)}),h)return o.log.warn("track has already been published, skipping",Object.assign(Object.assign({},o.logContext),Ce(h))),h;const p="channelCount"in i.mediaStreamTrack.getSettings()&&i.mediaStreamTrack.getSettings().channelCount===2||i.mediaStreamTrack.getConstraints().channelCount===2,m=(c=r==null?void 0:r.forceStereo)!==null&&c!==void 0?c:p;m&&(r||(r={}),r.dtx===void 0&&o.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},o.logContext),Ce(i))),r.red===void 0&&o.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(u=r.dtx)!==null&&u!==void 0||(r.dtx=!1),(l=r.red)!==null&&l!==void 0||(r.red=!1));const f=Object.assign(Object.assign({},o.roomOptions.publishDefaults),r);!N3()&&o.roomOptions.e2ee&&(o.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2",Object.assign({},o.logContext)),f.simulcast=!1),f.source&&(i.source=f.source);const g=new Promise((y,b)=>T(o,void 0,void 0,function*(){try{if(this.engine.client.currentState!==je.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:Ce(i)}));const S=()=>T(this,void 0,void 0,function*(){try{const w=yield this.publish(i,f,m);y(w)}catch(w){b(w)}});setTimeout(()=>{this.engine.off(B.SignalConnected,S),b(new vp("publishing rejected as engine not connected within timeout",408))},15e3),this.engine.once(B.SignalConnected,S),this.engine.on(B.Closing,()=>{this.engine.off(B.SignalConnected,S),b(new vp("publishing rejected as engine closed",499))})}else try{const S=yield this.publish(i,f,m);y(S)}catch(S){b(S)}}catch(S){b(S)}}));o.pendingPublishPromises.set(i,g);try{return yield g}catch(y){throw y}finally{o.pendingPublishPromises.delete(i)}}()})}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),Ce(e))),!1;const{canPublish:t,canPublishSources:i}=this.permissions;return t&&(i.length===0||i.map(r=>X3(r)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),Ce(e))),!1)}publish(e,t,i){return T(this,void 0,void 0,function*(){var r,o,s,a,c,u,l,d,h,p;if(!this.hasPermissionsToPublish(e))throw new vp("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(k=>co(e)&&k.source===e.source)&&e.source!==N.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),Ce(e))),t.stopMicTrackOnMute&&Xn(e)&&(e.stopOnMute=!0),e.source===N.Source.ScreenShare&&ao()&&(t.simulcast=!1),t.videoCodec==="av1"&&!P3()&&(t.videoCodec=void 0),t.videoCodec==="vp9"&&!O3()&&(t.videoCodec=void 0),t.videoCodec===void 0&&(t.videoCodec=qp),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(k=>t.videoCodec===vu(k.mime))||(t.videoCodec=vu(this.enabledPublishVideoCodecs[0].mime)));const f=t.videoCodec;e.on(F.Muted,this.onTrackMuted),e.on(F.Unmuted,this.onTrackUnmuted),e.on(F.Ended,this.handleTrackEnded),e.on(F.UpstreamPaused,this.onTrackUpstreamPaused),e.on(F.UpstreamResumed,this.onTrackUpstreamResumed),e.on(F.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const g=new Qh({cid:e.mediaStreamTrack.id,name:t.name,type:N.kindToProto(e.kind),muted:e.isMuted,source:N.sourceToProto(e.source),disableDtx:!(!((r=t.dtx)!==null&&r!==void 0)||r),encryption:this.encryptionType,stereo:i,disableRed:this.isE2EEEnabled||!(!((o=t.red)!==null&&o!==void 0)||o),stream:t==null?void 0:t.stream,backupCodecPolicy:t==null?void 0:t.backupCodecPolicy});let y;if(e.kind===N.Kind.Video){let k={width:0,height:0};try{k=yield e.waitForDimensions()}catch{const x=(a=(s=this.roomOptions.videoCaptureDefaults)===null||s===void 0?void 0:s.resolution)!==null&&a!==void 0?a:gs.h720.resolution;k={width:x.width,height:x.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),Ce(e)),{dims:k}))}g.width=k.width,g.height=k.height,Ai(e)&&(vs(f)&&(e.source===N.Source.ScreenShare&&(t.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),Ce(e))))),t.scalabilityMode=(c=t.scalabilityMode)!==null&&c!==void 0?c:"L3T3_KEY"),g.simulcastCodecs=[new Zh({codec:f,cid:e.mediaStreamTrack.id})],t.backupCodec===!0&&(t.backupCodec={codec:qp}),t.backupCodec&&f!==t.backupCodec.codec&&g.encryption===$t.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),g.simulcastCodecs.push(new Zh({codec:t.backupCodec.codec,cid:""})))),y=Kp(e.source===N.Source.ScreenShare,g.width,g.height,t),g.layers=HS(g.width,g.height,y,vs(t.videoCodec))}else e.kind===N.Kind.Audio&&(y=[{maxBitrate:(u=t.audioPreset)===null||u===void 0?void 0:u.maxBitrate,priority:(d=(l=t.audioPreset)===null||l===void 0?void 0:l.priority)!==null&&d!==void 0?d:"high",networkPriority:(p=(h=t.audioPreset)===null||h===void 0?void 0:h.priority)!==null&&p!==void 0?p:"high"}]);if(!this.engine||this.engine.isClosed)throw new lt("cannot publish track when not connected");const b=()=>T(this,void 0,void 0,function*(){var k,C,x;if(!this.engine.pcManager)throw new lt("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,t,y),Ai(e)&&((k=t.degradationPreference)!==null&&k!==void 0||(t.degradationPreference=TU(e)),e.setDegradationPreference(t.degradationPreference)),y)if(ao()&&e.kind===N.Kind.Audio){let I;for(const P of this.engine.pcManager.publisher.getTransceivers())if(P.sender===e.sender){I=P;break}I&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:I,codec:"opus",maxbr:!((C=y[0])===null||C===void 0)&&C.maxBitrate?y[0].maxBitrate/1e3:0})}else e.codec&&vs(e.codec)&&(!((x=y[0])===null||x===void 0)&&x.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:g.cid,codec:e.codec,maxbr:y[0].maxBitrate/1e3});yield this.engine.negotiate()});let S;if(this.enabledPublishVideoCodecs.length>0)S=(yield Promise.all([this.engine.addTrack(g),b()]))[0];else{S=yield this.engine.addTrack(g);let k;if(S.codecs.forEach(C=>{k===void 0&&(k=C.mimeType)}),k&&e.kind===N.Kind.Video){const C=vu(k);C!==f&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),Ce(e)),{codec:C})),t.videoCodec=C,y=Kp(e.source===N.Source.ScreenShare,g.width,g.height,t))}yield b()}const w=new ef(e.kind,S,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});return w.options=t,e.sid=S.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:y,trackInfo:S})),Ai(e)?e.startMonitor(this.engine.client):sr(e)&&e.startMonitor(),this.addTrackPublication(w),this.emit(z.LocalTrackPublished,w),w})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,t,i){return T(this,void 0,void 0,function*(){var r;if(this.encryptionType!==$t.NONE)return;let o;if(this.trackPublications.forEach(p=>{p.track&&p.track===e&&(o=p)}),!o)throw new Yn("track is not published");if(!Ai(e))throw new Yn("track is not a video track");const s=Object.assign(Object.assign({},(r=this.roomOptions)===null||r===void 0?void 0:r.publishDefaults),i),a=SU(e,t,s);if(!a){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),Ce(e)));return}const c=e.addSimulcastTrack(t,a);if(!c)return;const u=new Qh({cid:c.mediaStreamTrack.id,type:N.kindToProto(e.kind),muted:e.isMuted,source:N.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:s.videoCodec,cid:c.mediaStreamTrack.id}]});if(u.layers=HS(u.width,u.height,a),!this.engine||this.engine.isClosed)throw new lt("cannot publish track when not connected");const l=()=>T(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,c,s,a),yield this.engine.negotiate()}),h=(yield Promise.all([this.engine.addTrack(u),l()]))[0];this.log.debug("published ".concat(t," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:a,trackInfo:h}))})}unpublishTrack(e,t){return T(this,void 0,void 0,function*(){var i,r;if(co(e)){const u=this.pendingPublishPromises.get(e);u&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),Ce(e))),yield u)}const o=this.getPublicationForTrack(e),s=o?Ce(o):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),s)),!o||!o.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),s));return}e=o.track,e.off(F.Muted,this.onTrackMuted),e.off(F.Unmuted,this.onTrackUnmuted),e.off(F.Ended,this.handleTrackEnded),e.off(F.UpstreamPaused,this.onTrackUpstreamPaused),e.off(F.UpstreamResumed,this.onTrackUpstreamResumed),e.off(F.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),t===void 0&&(t=(r=(i=this.roomOptions)===null||i===void 0?void 0:i.stopLocalTrackOnUnpublish)!==null&&r!==void 0?r:!0),t?e.stop():e.stopMonitor();let a=!1;const c=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<Xe.FAILED&&c)try{for(const u of this.engine.pcManager.publisher.getTransceivers())u.sender===c&&(u.direction="inactive",a=!0);if(this.engine.removeTrack(c)&&(a=!0),Ai(e)){for(const[,u]of e.simulcastCodecs)u.sender&&(this.engine.removeTrack(u.sender)&&(a=!0),u.sender=void 0);e.simulcastCodecs.clear()}}catch(u){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),s),{error:u}))}switch(this.trackPublications.delete(o.trackSid),o.kind){case N.Kind.Audio:this.audioTrackPublications.delete(o.trackSid);break;case N.Kind.Video:this.videoTrackPublications.delete(o.trackSid);break}return this.emit(z.LocalTrackUnpublished,o),o.setTrack(void 0),a&&(yield this.engine.negotiate()),o})}unpublishTracks(e){return T(this,void 0,void 0,function*(){return(yield Promise.all(e.map(i=>this.unpublishTrack(i)))).filter(i=>!!i)})}republishAllTracks(e){return T(this,arguments,void 0,function(t){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){i.republishPromise&&(yield i.republishPromise),i.republishPromise=new Promise((o,s)=>T(i,void 0,void 0,function*(){try{const a=[];this.trackPublications.forEach(c=>{c.track&&(t&&(c.options=Object.assign(Object.assign({},c.options),t)),a.push(c))}),yield Promise.all(a.map(c=>T(this,void 0,void 0,function*(){const u=c.track;yield this.unpublishTrack(u,!1),r&&!u.isMuted&&u.source!==N.Source.ScreenShare&&u.source!==N.Source.ScreenShareAudio&&(sr(u)||Ai(u))&&!u.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:c.trackSid})),yield u.restartTrack()),yield this.publishOrRepublishTrack(u,c.options,!0)}))),o()}catch(a){s(a)}finally{this.republishPromise=void 0}})),yield i.republishPromise}()})}publishData(e){return T(this,arguments,void 0,function(t){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const o=r.reliable?me.RELIABLE:me.LOSSY,s=r.destinationIdentities,a=r.topic,c=new zt({kind:o,value:{case:"user",value:new J_({participantIdentity:i.identity,payload:t,destinationIdentities:s,topic:a})}});yield i.engine.sendDataPacket(c,o)}()})}publishDtmf(e,t){return T(this,void 0,void 0,function*(){const i=new zt({kind:me.RELIABLE,value:{case:"sipDtmf",value:new Z_({code:e,digit:t})}});yield this.engine.sendDataPacket(i,me.RELIABLE)})}sendChatMessage(e,t){return T(this,void 0,void 0,function*(){const i={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:t==null?void 0:t.attachments},r=new zt({value:{case:"chatMessage",value:new $h(Object.assign(Object.assign({},i),{timestamp:Ge.parse(i.timestamp)}))}});return yield this.engine.sendDataPacket(r,me.RELIABLE),this.emit(z.ChatMessage,i),i})}editChatMessage(e,t){return T(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},t),{message:e,editTimestamp:Date.now()}),r=new zt({value:{case:"chatMessage",value:new $h(Object.assign(Object.assign({},i),{timestamp:Ge.parse(i.timestamp),editTimestamp:Ge.parse(i.editTimestamp)}))}});return yield this.engine.sendDataPacket(r,me.RELIABLE),this.emit(z.ChatMessage,i),i})}sendText(e,t){return T(this,void 0,void 0,function*(){var i;const r=crypto.randomUUID(),s=new TextEncoder().encode(e).byteLength,a=(i=t==null?void 0:t.attachments)===null||i===void 0?void 0:i.map(()=>crypto.randomUUID()),c=new Array(a?a.length+1:1).fill(0),u=(d,h)=>{var p;c[h]=d;const m=c.reduce((f,g)=>f+g,0);(p=t==null?void 0:t.onProgress)===null||p===void 0||p.call(t,m)},l=yield this.streamText({streamId:r,totalSize:s,destinationIdentities:t==null?void 0:t.destinationIdentities,topic:t==null?void 0:t.topic,attachedStreamIds:a,attributes:t==null?void 0:t.attributes});return yield l.write(e),u(1,0),yield l.close(),t!=null&&t.attachments&&a&&(yield Promise.all(t.attachments.map((d,h)=>T(this,void 0,void 0,function*(){return this._sendFile(a[h],d,{topic:t.topic,mimeType:d.type,onProgress:p=>{u(p,h+1)}})})))),l.info})}streamText(e){return T(this,void 0,void 0,function*(){var t,i;const r=(t=e==null?void 0:e.streamId)!==null&&t!==void 0?t:crypto.randomUUID(),o={id:r,mimeType:"text/plain",timestamp:Date.now(),topic:(i=e==null?void 0:e.topic)!==null&&i!==void 0?i:"",size:e==null?void 0:e.totalSize,attributes:e==null?void 0:e.attributes},s=new Kh({streamId:r,mimeType:o.mimeType,topic:o.topic,timestamp:or(o.timestamp),totalLength:or(e==null?void 0:e.totalSize),attributes:o.attributes,contentHeader:{case:"textHeader",value:new uk({version:e==null?void 0:e.version,attachedStreamIds:e==null?void 0:e.attachedStreamIds,replyToStreamId:e==null?void 0:e.replyToStreamId,operationType:(e==null?void 0:e.type)==="update"?Hh.UPDATE:Hh.CREATE})}}),a=e==null?void 0:e.destinationIdentities,c=new zt({destinationIdentities:a,value:{case:"streamHeader",value:s}});yield this.engine.sendDataPacket(c,me.RELIABLE);let u=0;const l=this,d=new WritableStream({write(m){return T(this,void 0,void 0,function*(){for(const f of W3(m,ew)){yield l.engine.waitForBufferStatusLow(me.RELIABLE);const g=new Yh({content:f,streamId:r,chunkIndex:or(u)}),y=new zt({destinationIdentities:a,value:{case:"streamChunk",value:g}});yield l.engine.sendDataPacket(y,me.RELIABLE),u+=1}})},close(){return T(this,void 0,void 0,function*(){const m=new Xh({streamId:r}),f=new zt({destinationIdentities:a,value:{case:"streamTrailer",value:m}});yield l.engine.sendDataPacket(f,me.RELIABLE)})},abort(m){console.log("Sink error:",m)}});let h=()=>T(this,void 0,void 0,function*(){yield p.close()});l.engine.once(B.Closing,h);const p=new NU(d,o,()=>this.engine.off(B.Closing,h));return p})}sendFile(e,t){return T(this,void 0,void 0,function*(){const i=crypto.randomUUID();return yield this._sendFile(i,e,t),{id:i}})}_sendFile(e,t,i){return T(this,void 0,void 0,function*(){var r;const o=yield this.streamBytes({streamId:e,totalSize:t.size,name:t.name,mimeType:(r=i==null?void 0:i.mimeType)!==null&&r!==void 0?r:t.type,topic:i==null?void 0:i.topic,destinationIdentities:i==null?void 0:i.destinationIdentities}),s=t.stream().getReader();for(;;){const{done:a,value:c}=yield s.read();if(a)break;yield o.write(c)}return yield o.close(),o.info})}streamBytes(e){return T(this,void 0,void 0,function*(){var t,i,r,o,s;const a=(t=e==null?void 0:e.streamId)!==null&&t!==void 0?t:crypto.randomUUID(),c=e==null?void 0:e.destinationIdentities,u={id:a,mimeType:(i=e==null?void 0:e.mimeType)!==null&&i!==void 0?i:"application/octet-stream",topic:(r=e==null?void 0:e.topic)!==null&&r!==void 0?r:"",timestamp:Date.now(),attributes:e==null?void 0:e.attributes,size:e==null?void 0:e.totalSize,name:(o=e==null?void 0:e.name)!==null&&o!==void 0?o:"unknown"},l=new Kh({totalLength:or((s=u.size)!==null&&s!==void 0?s:0),mimeType:u.mimeType,streamId:a,topic:u.topic,timestamp:or(Date.now()),attributes:u.attributes,contentHeader:{case:"byteHeader",value:new lk({name:u.name})}}),d=new zt({destinationIdentities:c,value:{case:"streamHeader",value:l}});yield this.engine.sendDataPacket(d,me.RELIABLE);let h=0;const p=new jt,m=this.engine,f=this.log,g=new WritableStream({write(b){return T(this,void 0,void 0,function*(){const S=yield p.lock();let w=0;try{for(;w<b.byteLength;){const k=b.slice(w,w+ew);yield m.waitForBufferStatusLow(me.RELIABLE);const C=new zt({destinationIdentities:c,value:{case:"streamChunk",value:new Yh({content:k,streamId:a,chunkIndex:or(h)})}});yield m.sendDataPacket(C,me.RELIABLE),h+=1,w+=k.byteLength}}finally{S()}})},close(){return T(this,void 0,void 0,function*(){const b=new Xh({streamId:a}),S=new zt({destinationIdentities:c,value:{case:"streamTrailer",value:b}});yield m.sendDataPacket(S,me.RELIABLE)})},abort(b){f.error("Sink error:",b)}});return new DU(g,u)})}performRpc(e){return T(this,arguments,void 0,function(t){var i=this;let{destinationIdentity:r,method:o,payload:s,responseTimeout:a=1e4}=t;return function*(){return new Promise((u,l)=>T(i,void 0,void 0,function*(){var d,h,p,m;if(Gp(s)>jS){l(Je.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((h=(d=this.engine.latestJoinResponse)===null||d===void 0?void 0:d.serverInfo)===null||h===void 0)&&h.version&&rr((m=(p=this.engine.latestJoinResponse)===null||p===void 0?void 0:p.serverInfo)===null||m===void 0?void 0:m.version,"1.8.0")<0){l(Je.builtIn("UNSUPPORTED_SERVER"));return}const f=crypto.randomUUID();yield this.publishRpcRequest(r,f,o,s,a-2e3);const g=setTimeout(()=>{this.pendingAcks.delete(f),l(Je.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(f),clearTimeout(y)},2e3);this.pendingAcks.set(f,{resolve:()=>{clearTimeout(g)},participantIdentity:r});const y=setTimeout(()=>{this.pendingResponses.delete(f),l(Je.builtIn("RESPONSE_TIMEOUT"))},a);this.pendingResponses.set(f,{resolve:(b,S)=>{clearTimeout(y),this.pendingAcks.has(f)&&(console.warn("RPC response received before ack",f),this.pendingAcks.delete(f),clearTimeout(g)),S?l(S):u(b??"")},participantIdentity:r})}))}()})}registerRpcMethod(e,t){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,t)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=t,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const t=this.pendingAcks.get(e);t?(t.resolve(),this.pendingAcks.delete(e)):console.error("Ack received for unexpected RPC request",e)}handleIncomingRpcResponse(e,t,i){const r=this.pendingResponses.get(e);r?(r.resolve(t,i),this.pendingResponses.delete(e)):console.error("Response received for unexpected RPC request",e)}publishRpcRequest(e,t,i,r,o){return T(this,void 0,void 0,function*(){const s=new zt({destinationIdentities:[e],kind:me.RELIABLE,value:{case:"rpcRequest",value:new Q_({id:t,method:i,payload:r,responseTimeoutMs:o,version:1})}});yield this.engine.sendDataPacket(s,me.RELIABLE)})}handleParticipantDisconnected(e){for(const[t,{participantIdentity:i}]of this.pendingAcks)i===e&&this.pendingAcks.delete(t);for(const[t,{participantIdentity:i,resolve:r}]of this.pendingResponses)i===e&&(r(null,Je.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(t))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(t=>t.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return super.updateInfo(e)?(e.tracks.forEach(t=>{var i,r;const o=this.trackPublications.get(t.sid);if(o){const s=o.isMuted||((r=(i=o.track)===null||i===void 0?void 0:i.isUpstreamPaused)!==null&&r!==void 0?r:!1);s!==t.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),Ce(o)),{mutedOnServer:s})),this.engine.client.sendMuteTrack(t.sid,s))}}),!0):!1}getPublicationForTrack(e){let t;return this.trackPublications.forEach(i=>{const r=i.track;r&&(e instanceof MediaStreamTrack?(sr(r)||Ai(r))&&r.mediaStreamTrack===e&&(t=i):e===r&&(t=i))}),t}waitForPendingPublicationOfSource(e){return T(this,void 0,void 0,function*(){const i=Date.now();for(;Date.now()<i+1e4;){const r=Array.from(this.pendingPublishPromises.entries()).find(o=>{let[s]=o;return s.source===e});if(r)return r[1];yield qt(20)}})}}class WU extends Jn{constructor(e,t,i,r){super(e,t.sid,t.name,r),this.track=void 0,this.allowed=!0,this.disabled=!1,this.currentVideoQuality=en.HIGH,this.handleEnded=o=>{this.setTrack(void 0),this.emit(F.Ended,o)},this.handleVisibilityChange=o=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(o),this.logContext),this.disabled=!o,this.emitTrackUpdate()},this.handleVideoDimensionsChange=o=>{this.log.debug("adaptivestream video dimensions ".concat(o.width,"x").concat(o.height),this.logContext),this.videoDimensions=o,this.emitTrackUpdate()},this.subscribed=i,this.updateInfo(t)}setSubscribed(e){const t=this.subscriptionStatus,i=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const r=new nu({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new ik({participantSid:"",trackSids:[this.trackSid]})]});this.emit(F.UpdateSubscription,r),this.emitSubscriptionUpdateIfChanged(t),this.emitPermissionUpdateIfChanged(i)}get subscriptionStatus(){return this.subscribed===!1?Jn.SubscriptionStatus.Unsubscribed:super.isSubscribed?Jn.SubscriptionStatus.Subscribed:Jn.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Jn.PermissionStatus.Allowed:Jn.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return!this.disabled}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.disabled===!e||(this.disabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.currentVideoQuality===e||(this.currentVideoQuality=e,this.videoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var t,i;this.isManualOperationAllowed()&&(((t=this.videoDimensions)===null||t===void 0?void 0:t.width)===e.width&&((i=this.videoDimensions)===null||i===void 0?void 0:i.height)===e.height||(Mp(this.track)&&(this.videoDimensions=e),this.currentVideoQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&Mp(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){return this.currentVideoQuality}setTrack(e){const t=this.subscriptionStatus,i=this.permissionStatus,r=this.track;r!==e&&(r&&(r.off(F.VideoDimensionsChanged,this.handleVideoDimensionsChange),r.off(F.VisibilityChanged,this.handleVisibilityChange),r.off(F.Ended,this.handleEnded),r.detach(),r.stopMonitor(),this.emit(F.Unsubscribed,r)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(F.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(F.VisibilityChanged,this.handleVisibilityChange),e.on(F.Ended,this.handleEnded),this.emit(F.Subscribed,e)),this.emitPermissionUpdateIfChanged(i),this.emitSubscriptionUpdateIfChanged(t))}setAllowed(e){const t=this.subscriptionStatus,i=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(i),this.emitSubscriptionUpdateIfChanged(t)}setSubscriptionError(e){this.emit(F.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const t=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):t!==e.muted&&this.emit(e.muted?F.Muted:F.Unmuted)}emitSubscriptionUpdateIfChanged(e){const t=this.subscriptionStatus;e!==t&&this.emit(F.SubscriptionStatusChanged,t,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(F.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.kind===N.Kind.Video&&this.isAdaptiveStream?(this.log.warn("adaptive stream is enabled, cannot change video track settings",this.logContext),!1):this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return Mp(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new hk({trackSids:[this.trackSid],disabled:this.disabled,fps:this.fps});this.videoDimensions?(e.width=Math.ceil(this.videoDimensions.width),e.height=Math.ceil(this.videoDimensions.height)):this.currentVideoQuality!==void 0?e.quality=this.currentVideoQuality:e.quality=en.HIGH,this.emit(F.UpdateSettings,e)}}class Cu extends QS{static fromParticipantInfo(e,t,i){return new Cu(e,t.sid,t.identity,t.name,t.metadata,t.attributes,i,t.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,t,i,r,o,s,a){let c=arguments.length>7&&arguments[7]!==void 0?arguments[7]:tu.STANDARD;super(t,i||"",r,o,s,a,c),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on(F.UpdateSettings,t=>{this.log.debug("send update settings",Object.assign(Object.assign({},this.logContext),Ce(e))),this.signalClient.sendUpdateTrackSettings(t)}),e.on(F.UpdateSubscription,t=>{t.participantTracks.forEach(i=>{i.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(t)}),e.on(F.SubscriptionPermissionChanged,t=>{this.emit(z.TrackSubscriptionPermissionChanged,e,t)}),e.on(F.SubscriptionStatusChanged,t=>{this.emit(z.TrackSubscriptionStatusChanged,e,t)}),e.on(F.Subscribed,t=>{this.emit(z.TrackSubscribed,t,e)}),e.on(F.Unsubscribed,t=>{this.emit(z.TrackUnsubscribed,t,e)}),e.on(F.SubscriptionFailed,t=>{this.emit(z.TrackSubscriptionFailed,e.trackSid,t)})}getTrackPublication(e){const t=super.getTrackPublication(e);if(t)return t}getTrackPublicationByName(e){const t=super.getTrackPublicationByName(e);if(t)return t}setVolume(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:N.Source.Microphone;this.volumeMap.set(t,e);const i=this.getTrackPublication(t);i&&i.track&&i.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:N.Source.Microphone;const t=this.getTrackPublication(e);return t&&t.track?t.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,t,i,r,o,s){let a=this.getTrackPublicationBySid(t);if(a||t.startsWith("TR")||this.trackPublications.forEach(l=>{!a&&e.kind===l.kind.toString()&&(a=l)}),!a){if(s===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:t})),this.emit(z.TrackSubscriptionFailed,t);return}s===void 0&&(s=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,t,i,r,o,s-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),Ce(a))),this.emit(z.TrackSubscriptionFailed,t);return}const c=e.kind==="video";let u;return c?u=new UU(e,t,r,o):u=new LU(e,t,r,this.audioContext,this.audioOutput),u.source=a.source,u.isMuted=a.isMuted,u.setMediaStream(i),u.start(),a.setTrack(u),this.volumeMap.has(a.source)&&Ap(u)&&Xn(u)&&u.setVolume(this.volumeMap.get(a.source)),a}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const t=new Map,i=new Map;return e.tracks.forEach(r=>{var o,s;let a=this.getTrackPublicationBySid(r.sid);if(a)a.updateInfo(r);else{const c=N.kindFromProto(r.type);if(!c)return;a=new WU(c,r,(o=this.signalClient.connectOptions)===null||o===void 0?void 0:o.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(s=this.loggerOptions)===null||s===void 0?void 0:s.loggerName}),a.updateInfo(r),i.set(r.sid,a);const u=Array.from(this.trackPublications.values()).find(l=>l.source===(a==null?void 0:a.source));u&&a.source!==N.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(a.source),Object.assign(Object.assign({},this.logContext),{oldTrack:Ce(u),newTrack:Ce(a)})),this.addTrackPublication(a)}t.set(r.sid,a)}),this.trackPublications.forEach(r=>{t.has(r.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),Ce(r))),this.unpublishTrack(r.trackSid,!0))}),i.forEach(r=>{this.emit(z.TrackPublished,r)}),!0}unpublishTrack(e,t){const i=this.trackPublications.get(e);if(!i)return;const{track:r}=i;switch(r&&(r.stop(),i.setTrack(void 0)),this.trackPublications.delete(e),i.kind){case N.Kind.Audio:this.audioTrackPublications.delete(e);break;case N.Kind.Video:this.videoTrackPublications.delete(e);break}t&&this.emit(z.TrackUnpublished,i)}setAudioOutput(e){return T(this,void 0,void 0,function*(){this.audioOutput=e;const t=[];this.audioTrackPublications.forEach(i=>{var r;Xn(i.track)&&Ap(i.track)&&t.push(i.track.setSinkId((r=e.deviceId)!==null&&r!==void 0?r:"default"))}),yield Promise.all(t)})}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:i})),super.emit(e,...i)}}var ge;(function(n){n.Disconnected="disconnected",n.Connecting="connecting",n.Connected="connected",n.Reconnecting="reconnecting",n.SignalReconnecting="signalReconnecting"})(ge||(ge={}));const GU=4*1e3;class po extends Mn.EventEmitter{constructor(e){var t,i,r,o;if(super(),t=this,this.state=ge.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=le,this.bufferedEvents=[],this.isResuming=!1,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map,this.rpcHandlers=new Map,this.connect=(s,a,c)=>T(this,void 0,void 0,function*(){var u;if(!A3())throw Nn()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const l=yield this.disconnectLock.lock();if(this.state===ge.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),l(),Promise.resolve();if(this.connectFuture)return l(),this.connectFuture.promise;this.setAndEmitConnectionState(ge.Connecting),((u=this.regionUrlProvider)===null||u===void 0?void 0:u.getServerUrl().toString())!==s&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),xp(new URL(s))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new Jp(s,a):this.regionUrlProvider.updateToken(a),this.regionUrlProvider.fetchRegionSettings().then(p=>{var m;(m=this.regionUrlProvider)===null||m===void 0||m.setServerReportedRegions(p)}).catch(p=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:p}))}));const d=(p,m,f)=>T(this,void 0,void 0,function*(){var g,y;this.abortController&&this.abortController.abort();const b=new AbortController;this.abortController=b,l==null||l();try{yield this.attemptConnection(f??s,a,c,b),this.abortController=void 0,p()}catch(S){if(this.regionUrlProvider&&S instanceof Ae&&S.reason!==pe.Cancelled&&S.reason!==pe.NotAllowed){let w=null;try{w=yield this.regionUrlProvider.getNextBestRegionUrl((g=this.abortController)===null||g===void 0?void 0:g.signal)}catch(k){if(k instanceof Ae&&(k.status===401||k.reason===pe.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),m(k);return}}w&&!(!((y=this.abortController)===null||y===void 0)&&y.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(S.message,". Retrying with another region: ").concat(w),this.logContext),this.recreateEngine(),yield d(p,m,w)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,wS(S)),m(S))}else{let w=ln.UNKNOWN_REASON;S instanceof Ae&&(w=wS(S)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,w),m(S)}}}),h=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new Pp((p,m)=>{d(p,m,h)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(s,a,c,u,l,d)=>T(this,void 0,void 0,function*(){var h,p,m;const f=yield c.join(s,a,{autoSubscribe:u.autoSubscribe,adaptiveStream:typeof l.adaptiveStream=="object"?!0:l.adaptiveStream,maxRetries:u.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:u.websocketTimeout},d.signal);let g=f.serverInfo;if(g||(g={version:f.serverVersion,region:f.serverRegion}),this.serverInfo=g,this.log.debug("connected to Livekit Server ".concat(Object.entries(g).map(y=>{let[b,S]=y;return"".concat(b,": ").concat(S)}).join(", ")),{room:(h=f.room)===null||h===void 0?void 0:h.name,roomSid:(p=f.room)===null||p===void 0?void 0:p.sid,identity:(m=f.participant)===null||m===void 0?void 0:m.identity}),!g.version)throw new v3("unknown server version");return g.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),l.dynacast=!1),f}),this.applyJoinResponse=s=>{const a=s.participant;if(this.localParticipant.sid=a.sid,this.localParticipant.identity=a.identity,this.localParticipant.setEnabledPublishCodecs(s.enabledPublishCodecs),this.options.e2ee&&this.e2eeManager)try{this.e2eeManager.setSifTrailer(s.sifTrailer)}catch(c){this.log.error(c instanceof Error?c.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:c}))}this.handleParticipantUpdates([a,...s.otherParticipants]),s.room&&this.handleRoomUpdate(s.room)},this.attemptConnection=(s,a,c,u)=>T(this,void 0,void 0,function*(){var l,d;this.state===ge.Reconnecting||this.isResuming||!((l=this.engine)===null||l===void 0)&&l.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((d=this.regionUrlProvider)===null||d===void 0)&&d.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},Wp),c),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const h=yield this.connectSignal(s,a,this.engine,this.connOptions,this.options,u);this.applyJoinResponse(h),this.setupLocalParticipantEvents(),this.emit(U.SignalConnected)}catch(h){yield this.engine.close(),this.recreateEngine();const p=new Ae("could not establish signal connection",pe.ServerUnreachable);throw h instanceof Error&&(p.message="".concat(p.message,": ").concat(h.message)),h instanceof Ae&&(p.reason=h.reason,p.status=h.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:h})),p}if(u.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new Ae("Connection attempt aborted",pe.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,u)}catch(h){throw yield this.engine.close(),this.recreateEngine(),h}Wt()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),Wt()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(ge.Connected),this.emit(U.Connected),this.registerConnectionReconcile()}),this.disconnect=function(){for(var s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];return T(t,[...a],void 0,function(){var u=this;let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var d,h,p,m;const f=yield u.disconnectLock.lock();try{if(u.state===ge.Disconnected){u.log.debug("already disconnected",u.logContext);return}u.log.info("disconnect from room",Object.assign({},u.logContext)),(u.state===ge.Connecting||u.state===ge.Reconnecting||u.isResuming)&&(u.log.warn("abort connection attempt",u.logContext),(d=u.abortController)===null||d===void 0||d.abort(),(p=(h=u.connectFuture)===null||h===void 0?void 0:h.reject)===null||p===void 0||p.call(h,new Ae("Client initiated disconnect",pe.Cancelled)),u.connectFuture=void 0),!((m=u.engine)===null||m===void 0)&&m.client.isDisconnected||(yield u.engine.client.sendLeave()),u.engine&&(yield u.engine.close()),u.handleDisconnect(l,ln.CLIENT_INITIATED),u.engine=void 0}finally{f()}}()})},this.onPageLeave=()=>T(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>T(this,void 0,void 0,function*(){const s=[],a=fn();if(a&&a.os==="iOS"){const c="livekit-dummy-audio-el";let u=document.getElementById(c);if(!u){u=document.createElement("audio"),u.id=c,u.autoplay=!0,u.hidden=!0;const l=Rp();l.enabled=!0;const d=new MediaStream([l]);u.srcObject=d,document.addEventListener("visibilitychange",()=>{u&&(u.srcObject=document.hidden?null:d,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(u),this.once(U.Disconnected,()=>{u==null||u.remove(),u=null})}s.push(u)}this.remoteParticipants.forEach(c=>{c.audioTrackPublications.forEach(u=>{u.track&&u.track.attachedElements.forEach(l=>{s.push(l)})})});try{yield Promise.all([this.acquireAudioContext(),...s.map(c=>(c.muted=!1,c.play()))]),this.handleAudioPlaybackStarted()}catch(c){throw this.handleAudioPlaybackFailed(c),c}}),this.startVideo=()=>T(this,void 0,void 0,function*(){const s=[];for(const a of this.remoteParticipants.values())a.videoTrackPublications.forEach(c=>{var u;(u=c.track)===null||u===void 0||u.attachedElements.forEach(l=>{s.includes(l)||s.push(l)})});yield Promise.all(s.map(a=>a.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(a=>{a.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler",this.logContext)})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const s of this.remoteParticipants.values())this.handleParticipantDisconnected(s.identity,s);this.setAndEmitConnectionState(ge.Reconnecting)&&this.emit(U.Reconnecting)},this.handleSignalRestarted=s=>T(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(s.serverRegion),Object.assign(Object.assign({},this.logContext),{region:s.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(s);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(a){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:a}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:s.serverRegion}))}catch{return}this.setAndEmitConnectionState(ge.Connected),this.emit(U.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=s=>{s.forEach(a=>{var c;if(a.identity===this.localParticipant.identity){this.localParticipant.updateInfo(a);return}a.identity===""&&(a.identity=(c=this.sidToIdentity.get(a.sid))!==null&&c!==void 0?c:"");let u=this.remoteParticipants.get(a.identity);a.state===to.DISCONNECTED?this.handleParticipantDisconnected(a.identity,u):u=this.getOrCreateParticipant(a.identity,a)})},this.handleActiveSpeakersUpdate=s=>{const a=[],c={};s.forEach(u=>{if(c[u.sid]=!0,u.sid===this.localParticipant.sid)this.localParticipant.audioLevel=u.level,this.localParticipant.setIsSpeaking(!0),a.push(this.localParticipant);else{const l=this.getRemoteParticipantBySid(u.sid);l&&(l.audioLevel=u.level,l.setIsSpeaking(!0),a.push(l))}}),c[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(u=>{c[u.sid]||(u.audioLevel=0,u.setIsSpeaking(!1))}),this.activeSpeakers=a,this.emitWhenConnected(U.ActiveSpeakersChanged,a)},this.handleSpeakersChanged=s=>{const a=new Map;this.activeSpeakers.forEach(u=>{const l=this.remoteParticipants.get(u.identity);l&&l.sid!==u.sid||a.set(u.sid,u)}),s.forEach(u=>{let l=this.getRemoteParticipantBySid(u.sid);u.sid===this.localParticipant.sid&&(l=this.localParticipant),l&&(l.audioLevel=u.level,l.setIsSpeaking(u.active),u.active?a.set(u.sid,l):a.delete(u.sid))});const c=Array.from(a.values());c.sort((u,l)=>l.audioLevel-u.audioLevel),this.activeSpeakers=c,this.emitWhenConnected(U.ActiveSpeakersChanged,c)},this.handleStreamStateUpdate=s=>{s.streamStates.forEach(a=>{const c=this.getRemoteParticipantBySid(a.participantSid);if(!c)return;const u=c.getTrackPublicationBySid(a.trackSid);if(!u||!u.track)return;const l=N.streamStateFromProto(a.state);l!==u.track.streamState&&(u.track.streamState=l,c.emit(z.TrackStreamStateChanged,u,u.track.streamState),this.emitWhenConnected(U.TrackStreamStateChanged,u,u.track.streamState,c))})},this.handleSubscriptionPermissionUpdate=s=>{const a=this.getRemoteParticipantBySid(s.participantSid);if(!a)return;const c=a.getTrackPublicationBySid(s.trackSid);c&&c.setAllowed(s.allowed)},this.handleSubscriptionError=s=>{const a=Array.from(this.remoteParticipants.values()).find(u=>u.trackPublications.has(s.trackSid));if(!a)return;const c=a.getTrackPublicationBySid(s.trackSid);c&&c.setSubscriptionError(s.err)},this.handleDataPacket=s=>{const a=this.remoteParticipants.get(s.participantIdentity);if(s.value.case==="user")this.handleUserPacket(a,s.value.value,s.kind);else if(s.value.case==="transcription")this.handleTranscription(a,s.value.value);else if(s.value.case==="sipDtmf")this.handleSipDtmf(a,s.value.value);else if(s.value.case==="chatMessage")this.handleChatMessage(a,s.value.value);else if(s.value.case==="metrics")this.handleMetrics(s.value.value,a);else if(s.value.case==="streamHeader")this.handleStreamHeader(s.value.value,s.participantIdentity);else if(s.value.case==="streamChunk")this.handleStreamChunk(s.value.value);else if(s.value.case==="streamTrailer")this.handleStreamTrailer(s.value.value);else if(s.value.case==="rpcRequest"){const c=s.value.value;this.handleIncomingRpcRequest(s.participantIdentity,c.id,c.method,c.payload,c.responseTimeoutMs,c.version)}},this.handleUserPacket=(s,a,c)=>{this.emit(U.DataReceived,a.payload,s,c,a.topic),s==null||s.emit(z.DataReceived,a.payload,c)},this.handleSipDtmf=(s,a)=>{this.emit(U.SipDTMFReceived,a,s),s==null||s.emit(z.SipDTMFReceived,a)},this.bufferedSegments=new Map,this.handleTranscription=(s,a)=>{const c=a.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(a.transcribedParticipantIdentity),u=c==null?void 0:c.trackPublications.get(a.trackId),l=j3(a,this.transcriptionReceivedTimes);u==null||u.emit(F.TranscriptionReceived,l),c==null||c.emit(z.TranscriptionReceived,l,u),this.emit(U.TranscriptionReceived,l,c,u)},this.handleChatMessage=(s,a)=>{const c=V3(a);this.emit(U.ChatMessage,c,s)},this.handleMetrics=(s,a)=>{this.emit(U.MetricsReceived,s,a)},this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(U.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=s=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:s})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(U.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(U.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(U.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>T(this,void 0,void 0,function*(){var s,a,c;const u=ft.getInstance().previousDevices,l=yield ft.getInstance().getDevices(void 0,!1),d=fn();if((d==null?void 0:d.name)==="Chrome"&&d.os!=="iOS")for(let p of l){const m=u.find(f=>f.deviceId===p.deviceId);m&&m.label!==""&&m.kind===p.kind&&m.label!==p.label&&this.getActiveDevice(p.kind)==="default"&&this.emit(U.ActiveDeviceChanged,p.kind,p.deviceId)}const h=["audiooutput","audioinput","videoinput"];for(let p of h){const m=G3(p),f=this.localParticipant.getTrackPublication(m);if(f&&(!((s=f.track)===null||s===void 0)&&s.isUserProvided))continue;const g=l.filter(b=>b.kind===p),y=this.getActiveDevice(p);if(y===((a=u.filter(b=>b.kind===p)[0])===null||a===void 0?void 0:a.deviceId)&&g.length>0&&((c=g[0])===null||c===void 0?void 0:c.deviceId)!==y){yield this.switchActiveDevice(p,g[0].deviceId);continue}p==="audioinput"&&!Pi()||p==="videoinput"||g.length>0&&!g.find(b=>b.deviceId===this.getActiveDevice(p))&&(yield this.switchActiveDevice(p,g[0].deviceId))}this.emit(U.MediaDevicesChanged)}),this.handleRoomUpdate=s=>{const a=this.roomInfo;this.roomInfo=s,a&&a.metadata!==s.metadata&&this.emitWhenConnected(U.RoomMetadataChanged,s.metadata),(a==null?void 0:a.activeRecording)!==s.activeRecording&&this.emitWhenConnected(U.RecordingStatusChanged,s.activeRecording)},this.handleConnectionQualityUpdate=s=>{s.updates.forEach(a=>{if(a.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(a.quality);return}const c=this.getRemoteParticipantBySid(a.participantSid);c&&c.setConnectionQuality(a.quality)})},this.onLocalParticipantMetadataChanged=s=>{this.emit(U.ParticipantMetadataChanged,s,this.localParticipant)},this.onLocalParticipantNameChanged=s=>{this.emit(U.ParticipantNameChanged,s,this.localParticipant)},this.onLocalAttributesChanged=s=>{this.emit(U.ParticipantAttributesChanged,s,this.localParticipant)},this.onLocalTrackMuted=s=>{this.emit(U.TrackMuted,s,this.localParticipant)},this.onLocalTrackUnmuted=s=>{this.emit(U.TrackUnmuted,s,this.localParticipant)},this.onTrackProcessorUpdate=s=>{var a;(a=s==null?void 0:s.onPublish)===null||a===void 0||a.call(s,this)},this.onLocalTrackPublished=s=>T(this,void 0,void 0,function*(){var a,c,u,l,d,h;(a=s.track)===null||a===void 0||a.on(F.TrackProcessorUpdate,this.onTrackProcessorUpdate),(c=s.track)===null||c===void 0||c.on(F.Restarted,this.onLocalTrackRestarted),(d=(l=(u=s.track)===null||u===void 0?void 0:u.getProcessor())===null||l===void 0?void 0:l.onPublish)===null||d===void 0||d.call(l,this),this.emit(U.LocalTrackPublished,s,this.localParticipant),sr(s.track)&&(yield s.track.checkForSilence())&&this.emit(U.LocalAudioSilenceDetected,s);const p=yield(h=s.track)===null||h===void 0?void 0:h.getDeviceId(!1),m=ES(s.source);m&&p&&p!==this.localParticipant.activeDeviceMap.get(m)&&(this.localParticipant.activeDeviceMap.set(m,p),this.emit(U.ActiveDeviceChanged,m,p))}),this.onLocalTrackUnpublished=s=>{var a,c;(a=s.track)===null||a===void 0||a.off(F.TrackProcessorUpdate,this.onTrackProcessorUpdate),(c=s.track)===null||c===void 0||c.off(F.Restarted,this.onLocalTrackRestarted),this.emit(U.LocalTrackUnpublished,s,this.localParticipant)},this.onLocalTrackRestarted=s=>T(this,void 0,void 0,function*(){const a=yield s.getDeviceId(!1),c=ES(s.source);c&&a&&a!==this.localParticipant.activeDeviceMap.get(c)&&(this.log.debug("local track restarted, setting ".concat(c," ").concat(a," active"),this.logContext),this.localParticipant.activeDeviceMap.set(c,a),this.emit(U.ActiveDeviceChanged,c,a))}),this.onLocalConnectionQualityChanged=s=>{this.emit(U.ConnectionQualityChanged,s,this.localParticipant)},this.onMediaDevicesError=s=>{this.emit(U.MediaDevicesError,s)},this.onLocalParticipantPermissionsChanged=s=>{this.emit(U.ParticipantPermissionsChanged,s,this.localParticipant)},this.onLocalChatMessageSent=s=>{this.emit(U.ChatMessage,s,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},hU),e),this.log=Kn((i=this.options.loggerName)!==null&&i!==void 0?i:pn.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},FS),e==null?void 0:e.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},BS),e==null?void 0:e.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},dU),e==null?void 0:e.publishDefaults),this.maybeCreateEngine(),this.disconnectLock=new jt,this.localParticipant=new qU("","",this.engine,this.options,this.rpcHandlers),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Oi(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Oi(this.options.audioCaptureDefaults.deviceId)),!((r=this.options.audioOutput)===null||r===void 0)&&r.deviceId&&this.switchActiveDevice("audiooutput",Oi(this.options.audioOutput.deviceId)).catch(s=>this.log.warn("Could not set audio output: ".concat(s.message),this.logContext)),this.options.e2ee&&this.setupE2EE(),Wt()){const s=new AbortController;(o=navigator.mediaDevices)===null||o===void 0||o.addEventListener("devicechange",this.handleDeviceChange,{signal:s.signal}),po.cleanupRegistry&&po.cleanupRegistry.register(this,()=>{s.abort()})}}registerTextStreamHandler(e,t){if(this.textStreamHandlers.has(e))throw new TypeError('A text stream handler for topic "'.concat(e,'" has already been set.'));this.textStreamHandlers.set(e,t)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,t){if(this.byteStreamHandlers.has(e))throw new TypeError('A byte stream handler for topic "'.concat(e,'" has already been set.'));this.byteStreamHandlers.set(e,t)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}registerRpcMethod(e,t){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,t)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}handleIncomingRpcRequest(e,t,i,r,o,s){return T(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,t),s!==1){yield this.engine.publishRpcResponse(e,t,null,Je.builtIn("UNSUPPORTED_VERSION"));return}const a=this.rpcHandlers.get(i);if(!a){yield this.engine.publishRpcResponse(e,t,null,Je.builtIn("UNSUPPORTED_METHOD"));return}let c=null,u=null;try{const l=yield a({requestId:t,callerIdentity:e,payload:r,responseTimeout:o});Gp(l)>jS?(c=Je.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),console.warn("RPC Response payload too large for ".concat(i))):u=l}catch(l){l instanceof Je?c=l:(console.warn("Uncaught error returned by RPC handler for ".concat(i,". Returning APPLICATION_ERROR instead."),l),c=Je.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,t,u,c)})}setE2EEEnabled(e){return T(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var e;this.options.e2ee&&("e2eeManager"in this.options.e2ee?this.e2eeManager=this.options.e2ee.e2eeManager:this.e2eeManager=new J3(this.options.e2ee),this.e2eeManager.on(Ii.ParticipantEncryptionStatusChanged,(t,i)=>{q3(i)&&(this.isE2EEEnabled=t),this.emit(U.ParticipantEncryptionStatusChanged,t,i)}),this.e2eeManager.on(Ii.EncryptionError,t=>this.emit(U.EncryptionError,t)),(e=this.e2eeManager)===null||e===void 0||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,t;return(t=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&t!==void 0?t:!1}getSid(){return T(this,void 0,void 0,function*(){return this.state===ge.Disconnected?"":this.roomInfo&&this.roomInfo.sid!==""?this.roomInfo.sid:new Promise((e,t)=>{const i=r=>{r.sid!==""&&(this.engine.off(B.RoomUpdate,i),e(r.sid))};this.engine.on(B.RoomUpdate,i),this.once(U.Disconnected,()=>{this.engine.off(B.RoomUpdate,i),t("Room disconnected before room server id was available")})})})}get name(){var e,t;return(t=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,t;return(t=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&t!==void 0?t:0}get numPublishers(){var e,t;return(t=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&t!==void 0?t:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new IU(this.options),this.engine.on(B.ParticipantUpdate,this.handleParticipantUpdates).on(B.RoomUpdate,this.handleRoomUpdate).on(B.SpeakersChanged,this.handleSpeakersChanged).on(B.StreamStateChanged,this.handleStreamStateUpdate).on(B.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(B.SubscriptionError,this.handleSubscriptionError).on(B.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(B.MediaTrackAdded,(e,t,i)=>{this.onTrackAdded(e,t,i)}).on(B.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(B.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(B.DataPacketReceived,this.handleDataPacket).on(B.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(ge.SignalReconnecting)&&this.emit(U.SignalReconnecting)}).on(B.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(ge.Connected)&&this.emit(U.Reconnected)}).on(B.SignalResumed,()=>{this.bufferedEvents=[],(this.state===ge.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(B.Restarting,this.handleRestarting).on(B.SignalRestarted,this.handleSignalRestarted).on(B.Offline,()=>{this.setAndEmitConnectionState(ge.Reconnecting)&&this.emit(U.Reconnecting)}).on(B.DCBufferStatusChanged,(e,t)=>{this.emit(U.DCBufferStatusChanged,e,t)}).on(B.LocalTrackSubscribed,e=>{const t=this.localParticipant.getTrackPublications().find(i=>{let{trackSid:r}=i;return r===e});if(!t){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(z.LocalTrackSubscribed,t),this.emitWhenConnected(U.LocalTrackSubscribed,t,this.localParticipant)}).on(B.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((t,i)=>{this.handleParticipantDisconnected(i,t)}),this.emit(U.Moved,e.room.name,e.token),e.participant?this.handleParticipantUpdates([e.participant,...e.otherParticipants]):this.handleParticipantUpdates(e.otherParticipants)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine))}static getLocalDevices(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ft.getInstance().getDevices(e,t)}prepareConnection(e,t){return T(this,void 0,void 0,function*(){if(this.state===ge.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(xp(new URL(e))&&t){this.regionUrlProvider=new Jp(e,t);const i=yield this.regionUrlProvider.getNextBestRegionUrl();i&&this.state===ge.Disconnected&&(this.regionUrl=i,yield fetch(Op(i),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(i),this.logContext))}else yield fetch(Op(e),{method:"HEAD"})}catch(i){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:i}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,t){return T(this,void 0,void 0,function*(){let i=()=>{},r;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":r=new An({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":r=new An({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":r=new An({scenario:{case:"serverLeave",value:!0}});break;case"migration":r=new An({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":i=()=>T(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),r=new An({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":i=()=>T(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),r=new An({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":r=new An({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),i=()=>T(this,void 0,void 0,function*(){const o=this.engine.client.onLeave;o&&o(new iu({reason:ln.CLIENT_INITIATED,action:io.RECONNECT}))});break;case"subscriber-bandwidth":if(t===void 0||typeof t!="number")throw new Error("subscriber-bandwidth requires a number as argument");r=new An({scenario:{case:"subscriberBandwidth",value:or(t)}});break;case"leave-full-reconnect":r=new An({scenario:{case:"leaveRequestFullReconnect",value:!0}})}r&&(yield this.engine.client.sendSimulateScenario(r),yield i())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,t){return T(this,arguments,void 0,function(i,r){var o=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var a,c,u,l,d,h,p,m;let f=!0,g=!1;const y=s?{exact:r}:r;if(i==="audioinput"){g=o.localParticipant.audioTrackPublications.size===0;const b=(a=o.getActiveDevice(i))!==null&&a!==void 0?a:o.options.audioCaptureDefaults.deviceId;o.options.audioCaptureDefaults.deviceId=y;const S=Array.from(o.localParticipant.audioTrackPublications.values()).filter(w=>w.source===N.Source.Microphone);try{f=(yield Promise.all(S.map(w=>{var k;return(k=w.audioTrack)===null||k===void 0?void 0:k.setDeviceId(y)}))).every(w=>w===!0)}catch(w){throw o.options.audioCaptureDefaults.deviceId=b,w}}else if(i==="videoinput"){g=o.localParticipant.videoTrackPublications.size===0;const b=(c=o.getActiveDevice(i))!==null&&c!==void 0?c:o.options.videoCaptureDefaults.deviceId;o.options.videoCaptureDefaults.deviceId=y;const S=Array.from(o.localParticipant.videoTrackPublications.values()).filter(w=>w.source===N.Source.Camera);try{f=(yield Promise.all(S.map(w=>{var k;return(k=w.videoTrack)===null||k===void 0?void 0:k.setDeviceId(y)}))).every(w=>w===!0)}catch(w){throw o.options.videoCaptureDefaults.deviceId=b,w}}else if(i==="audiooutput"){if(!Tp()&&!o.options.webAudioMix||o.options.webAudioMix&&o.audioContext&&!("setSinkId"in o.audioContext))throw new Error("cannot switch audio output, setSinkId not supported");o.options.webAudioMix&&(r=(u=yield ft.getInstance().normalizeDeviceId("audiooutput",r))!==null&&u!==void 0?u:""),(l=(m=o.options).audioOutput)!==null&&l!==void 0||(m.audioOutput={});const b=(d=o.getActiveDevice(i))!==null&&d!==void 0?d:o.options.audioOutput.deviceId;o.options.audioOutput.deviceId=r;try{o.options.webAudioMix&&((h=o.audioContext)===null||h===void 0||h.setSinkId(r)),yield Promise.all(Array.from(o.remoteParticipants.values()).map(S=>S.setAudioOutput({deviceId:r})))}catch(S){throw o.options.audioOutput.deviceId=b,S}}return(g||i==="audiooutput")&&(o.localParticipant.activeDeviceMap.set(i,i==="audiooutput"&&((p=o.options.audioOutput)===null||p===void 0?void 0:p.deviceId)||r),o.emit(U.ActiveDeviceChanged,i,r)),f}()})}setupLocalParticipantEvents(){this.localParticipant.on(z.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(z.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(z.AttributesChanged,this.onLocalAttributesChanged).on(z.TrackMuted,this.onLocalTrackMuted).on(z.TrackUnmuted,this.onLocalTrackUnmuted).on(z.LocalTrackPublished,this.onLocalTrackPublished).on(z.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(z.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(z.MediaDevicesError,this.onMediaDevicesError).on(z.AudioStreamAcquired,this.startAudio).on(z.ChatMessage,this.onLocalChatMessageSent).on(z.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;(e=this.engine)===null||e===void 0||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,t,i){if(this.state===ge.Connecting||this.state===ge.Reconnecting){const l=()=>{this.onTrackAdded(e,t,i),d()},d=()=>{this.off(U.Reconnected,l),this.off(U.Connected,l),this.off(U.Disconnected,d)};this.once(U.Reconnected,l),this.once(U.Connected,l),this.once(U.Disconnected,d);return}if(this.state===ge.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(e.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const r=R3(t.id),o=r[0];let s=r[1],a=e.id;if(s&&s.startsWith("TR")&&(a=s),o===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const c=Array.from(this.remoteParticipants.values()).find(l=>l.sid===o);if(!c){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(o),this.logContext);return}let u;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?u=this.options.adaptiveStream:u={}),c.addSubscribedMediaTrack(e,a,t,i,u)}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1?arguments[1]:void 0;var i;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.state!==ge.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach(r=>{r.trackPublications.forEach(o=>{r.unpublishTrack(o.trackSid)})}),this.localParticipant.trackPublications.forEach(r=>{var o,s,a;r.track&&this.localParticipant.unpublishTrack(r.track,e),e?((o=r.track)===null||o===void 0||o.detach(),(s=r.track)===null||s===void 0||s.stop()):(a=r.track)===null||a===void 0||a.stopMonitor()}),this.localParticipant.off(z.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(z.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(z.AttributesChanged,this.onLocalAttributesChanged).off(z.TrackMuted,this.onLocalTrackMuted).off(z.TrackUnmuted,this.onLocalTrackUnmuted).off(z.LocalTrackPublished,this.onLocalTrackPublished).off(z.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(z.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(z.MediaDevicesError,this.onMediaDevicesError).off(z.AudioStreamAcquired,this.startAudio).off(z.ChatMessage,this.onLocalChatMessageSent).off(z.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),Wt()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(i=navigator.mediaDevices)===null||i===void 0||i.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(ge.Disconnected),this.emit(U.Disconnected,t)}}}handleParticipantDisconnected(e,t){var i;this.remoteParticipants.delete(e),t&&(t.trackPublications.forEach(r=>{t.unpublishTrack(r.trackSid,!0)}),this.emit(U.ParticipantDisconnected,t),t.setDisconnected(),(i=this.localParticipant)===null||i===void 0||i.handleParticipantDisconnected(t.identity))}handleStreamHeader(e,t){return T(this,void 0,void 0,function*(){var i;if(e.contentHeader.case==="byteHeader"){const r=this.byteStreamHandlers.get(e.topic);if(!r){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let o;const s={id:e.streamId,name:(i=e.contentHeader.value.name)!==null&&i!==void 0?i:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:gu(e.timestamp),attributes:e.attributes},a=new ReadableStream({start:c=>{o=c,this.byteStreamControllers.set(e.streamId,{info:s,controller:o,startTime:Date.now()})}});r(new AU(s,a,gu(e.totalLength)),{identity:t})}else if(e.contentHeader.case==="textHeader"){const r=this.textStreamHandlers.get(e.topic);if(!r){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let o;const s={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes},a=new ReadableStream({start:c=>{o=c,this.textStreamControllers.set(e.streamId,{info:s,controller:o,startTime:Date.now()})}});r(new MU(s,a,gu(e.totalLength)),{identity:t})}})}handleStreamChunk(e){const t=this.byteStreamControllers.get(e.streamId);t&&e.content.length>0&&t.controller.enqueue(e);const i=this.textStreamControllers.get(e.streamId);i&&e.content.length>0&&i.controller.enqueue(e)}handleStreamTrailer(e){const t=this.textStreamControllers.get(e.streamId);t&&(t.info.attributes=Object.assign(Object.assign({},t.info.attributes),e.attributes),t.controller.close(),this.textStreamControllers.delete(e.streamId));const i=this.byteStreamControllers.get(e.streamId);i&&(i.info.attributes=Object.assign(Object.assign({},i.info.attributes),e.attributes),i.controller.close(),this.byteStreamControllers.delete(e.streamId))}acquireAudioContext(){return T(this,void 0,void 0,function*(){var e,t;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=xS())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(r=>r.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),qt(200)])}catch(r){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:r}))}const i=((t=this.audioContext)===null||t===void 0?void 0:t.state)==="running";i!==this.canPlaybackAudio&&(this.audioEnabled=i,this.emit(U.AudioPlaybackStatusChanged,i))})}createParticipant(e,t){var i;let r;return t?r=Cu.fromParticipantInfo(this.engine.client,t,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):r=new Cu(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&r.setAudioContext(this.audioContext),!((i=this.options.audioOutput)===null||i===void 0)&&i.deviceId&&r.setAudioOutput(this.options.audioOutput).catch(o=>this.log.warn("Could not set audio output: ".concat(o.message),this.logContext)),r}getOrCreateParticipant(e,t){if(this.remoteParticipants.has(e)){const r=this.remoteParticipants.get(e);return t&&r.updateInfo(t)&&this.sidToIdentity.set(t.sid,t.identity),r}const i=this.createParticipant(e,t);return this.remoteParticipants.set(e,i),this.sidToIdentity.set(t.sid,t.identity),this.emitWhenConnected(U.ParticipantConnected,i),i.on(z.TrackPublished,r=>{this.emitWhenConnected(U.TrackPublished,r,i)}).on(z.TrackSubscribed,(r,o)=>{r.kind===N.Kind.Audio?(r.on(F.AudioPlaybackStarted,this.handleAudioPlaybackStarted),r.on(F.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):r.kind===N.Kind.Video&&(r.on(F.VideoPlaybackFailed,this.handleVideoPlaybackFailed),r.on(F.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(U.TrackSubscribed,r,o,i)}).on(z.TrackUnpublished,r=>{this.emit(U.TrackUnpublished,r,i)}).on(z.TrackUnsubscribed,(r,o)=>{this.emit(U.TrackUnsubscribed,r,o,i)}).on(z.TrackMuted,r=>{this.emitWhenConnected(U.TrackMuted,r,i)}).on(z.TrackUnmuted,r=>{this.emitWhenConnected(U.TrackUnmuted,r,i)}).on(z.ParticipantMetadataChanged,r=>{this.emitWhenConnected(U.ParticipantMetadataChanged,r,i)}).on(z.ParticipantNameChanged,r=>{this.emitWhenConnected(U.ParticipantNameChanged,r,i)}).on(z.AttributesChanged,r=>{this.emitWhenConnected(U.ParticipantAttributesChanged,r,i)}).on(z.ConnectionQualityChanged,r=>{this.emitWhenConnected(U.ConnectionQualityChanged,r,i)}).on(z.ParticipantPermissionsChanged,r=>{this.emitWhenConnected(U.ParticipantPermissionsChanged,r,i)}).on(z.TrackSubscriptionStatusChanged,(r,o)=>{this.emitWhenConnected(U.TrackSubscriptionStatusChanged,r,o,i)}).on(z.TrackSubscriptionFailed,(r,o)=>{this.emit(U.TrackSubscriptionFailed,r,i,o)}).on(z.TrackSubscriptionPermissionChanged,(r,o)=>{this.emitWhenConnected(U.TrackSubscriptionPermissionChanged,r,o,i)}).on(z.Active,()=>{this.emitWhenConnected(U.ParticipantActive,i)}),t&&i.updateInfo(t),i}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((i,r)=>(i.push(...r.getTrackPublications()),i),[]),t=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,t)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const t of e.videoTrackPublications.values())t.isSubscribed&&z3(t)&&t.emitTrackUpdate()}getRemoteParticipantBySid(e){const t=this.sidToIdentity.get(e);if(t)return this.remoteParticipants.get(t)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=_t.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,ln.STATE_MISMATCH))):e=0},GU)}clearConnectionReconcile(){this.connectionReconcileInterval&&_t.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(U.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[t,i]=e;this.emit(t,...i)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];if(this.state===ge.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,i]);else if(this.state===ge.Connected)return this.emit(e,...i);return!1}simulateParticipants(e){return T(this,void 0,void 0,function*(){var t,i;const r=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),o=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new Qc({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:Ge.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new er({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(U.SignalConnected),this.emit(U.Connected),this.setAndEmitConnectionState(ge.Connected),r.video){const s=new ef(N.Kind.Video,new no({source:at.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:un.AUDIO,name:"video-dummy"}),new Su(r.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:SS(160*((t=o.aspectRatios[0])!==null&&t!==void 0?t:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(s),this.localParticipant.emit(z.LocalTrackPublished,s)}if(r.audio){const s=new ef(N.Kind.Audio,new no({source:at.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:un.AUDIO}),new _u(r.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:Rp(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(s),this.localParticipant.emit(z.LocalTrackPublished,s)}for(let s=0;s<o.count-1;s+=1){let a=new er({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(s),state:to.ACTIVE,tracks:[],joinedAt:Ge.parse(Date.now())});const c=this.getOrCreateParticipant(a.identity,a);if(o.video){const u=SS(160*((i=o.aspectRatios[s%o.aspectRatios.length])!==null&&i!==void 0?i:1),160,!1,!0),l=new no({source:at.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:un.AUDIO});c.addSubscribedMediaTrack(u,l.sid,new MediaStream([u]),new RTCRtpReceiver),a.tracks=[...a.tracks,l]}if(o.audio){const u=Rp(),l=new no({source:at.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:un.AUDIO});c.addSubscribedMediaTrack(u,l.sid,new MediaStream([u]),new RTCRtpReceiver),a.tracks=[...a.tracks,l]}c.updateInfo(a)}})}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];if(e!==U.ActiveSpeakersChanged&&e!==U.TranscriptionReceived){const o=tw(i).filter(s=>s!==void 0);this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:o}))}return super.emit(e,...i)}}po.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(n=>{n()});function tw(n){return n.map(e=>{if(e)return Array.isArray(e)?tw(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var vn;(function(n){n[n.IDLE=0]="IDLE",n[n.RUNNING=1]="RUNNING",n[n.SKIPPED=2]="SKIPPED",n[n.SUCCESS=3]="SUCCESS",n[n.FAILED=4]="FAILED"})(vn||(vn={}));class Di extends Mn.EventEmitter{constructor(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=vn.IDLE,this.logs=[],this.options={},this.url=e,this.token=t,this.name=this.constructor.name,this.room=new po(i.roomOptions),this.connectOptions=i.connectOptions,this.options=i}run(e){return T(this,void 0,void 0,function*(){if(this.status!==vn.IDLE)throw Error("check is running already");this.setStatus(vn.RUNNING);try{yield this.perform()}catch(t){t instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(t.message):this.appendError(t.message))}return yield this.disconnect(),yield new Promise(t=>setTimeout(t,500)),this.status!==vn.SKIPPED&&this.setStatus(this.isSuccess()?vn.SUCCESS:vn.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return T(this,void 0,void 0,function*(){return this.room.state===ge.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return T(this,void 0,void 0,function*(){this.room&&this.room.state!==ge.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(vn.SKIPPED)}switchProtocol(e){return T(this,void 0,void 0,function*(){let t=!1,i=!1;if(this.room.on(U.Reconnecting,()=>{t=!0}),this.room.once(U.Reconnected,()=>{i=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(o=>setTimeout(o,1e3)),!t)return;const r=Date.now()+1e4;for(;Date.now()<r;){if(i)return;yield qt(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class $U extends Di{get description(){return"Cloud regions"}perform(){return T(this,void 0,void 0,function*(){const e=new Jp(this.url,this.token);if(!e.isCloud()){this.skip();return}const t=[],i=new Set;for(let o=0;o<3;o++){const s=yield e.getNextBestRegionUrl();if(!s)break;if(i.has(s))continue;i.add(s);const a=yield this.checkCloudRegion(s);this.appendMessage("".concat(a.region," RTT: ").concat(a.rtt,"ms, duration: ").concat(a.duration,"ms")),t.push(a)}t.sort((o,s)=>(o.duration-s.duration)*.5+(o.rtt-s.rtt)*.5);const r=t[0];this.bestStats=r,this.appendMessage("best Cloud region: ".concat(r.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return T(this,void 0,void 0,function*(){var t,i;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const r=(t=this.room.serverInfo)===null||t===void 0?void 0:t.region;if(!r)throw new Error("Region not found");const o=yield this.room.localParticipant.streamText({topic:"test"}),s=1e3,c=1e6/s,u="A".repeat(s),l=Date.now();for(let m=0;m<c;m++)yield o.write(u);yield o.close();const d=Date.now(),h=yield(i=this.room.engine.pcManager)===null||i===void 0?void 0:i.publisher.getStats(),p={region:r,rtt:1e4,duration:d-l};return h==null||h.forEach(m=>{m.type==="candidate-pair"&&m.nominated&&(p.rtt=m.currentRoundTripTime*1e3)}),yield this.disconnect(),p})}}const tf=1e4;class HU extends Di{get description(){return"Connection via UDP vs TCP"}perform(){return T(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),t=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-t.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-t.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=t):this.appendMessage("best connection quality via udp");const i=this.bestStats;this.appendMessage("upstream bitrate: ".concat((i.bitrateTotal/i.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((i.rttTotal/i.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((i.jitterTotal/i.count*1e3).toFixed(2)," ms")),i.packetsLost>0&&this.appendWarning("packets lost: ".concat((i.packetsLost/i.packetsSent*100).toFixed(2),"%")),i.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((i.qualityLimitationDurations.bandwidth/(tf/1e3)*100).toFixed(2),"%")),i.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((i.qualityLimitationDurations.cpu/(tf/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return T(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const t=document.createElement("canvas");t.width=1280,t.height=720;const i=t.getContext("2d");if(!i)throw new Error("Could not get canvas context");let r=0;const o=()=>{r=(r+1)%360,i.fillStyle="hsl(".concat(r,", 100%, 50%)"),i.fillRect(0,0,t.width,t.height),requestAnimationFrame(o)};o();const a=t.captureStream(30).getVideoTracks()[0],u=(yield this.room.localParticipant.publishTrack(a,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,l={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},d=setInterval(()=>T(this,void 0,void 0,function*(){const h=yield u.getRTCStatsReport();h==null||h.forEach(p=>{p.type==="outbound-rtp"?(l.packetsSent=p.packetsSent,l.qualityLimitationDurations=p.qualityLimitationDurations,l.bitrateTotal+=p.targetBitrate,l.count++):p.type==="remote-inbound-rtp"&&(l.packetsLost=p.packetsLost,l.rttTotal+=p.roundTripTime,l.jitterTotal+=p.jitter)})}),1e3);return yield new Promise(h=>setTimeout(h,tf)),clearInterval(d),a.stop(),t.remove(),yield this.disconnect(),l})}}class KU extends Di{get description(){return"Can publish audio"}perform(){return T(this,void 0,void 0,function*(){var e;const t=yield this.connect(),i=yield jU();if(yield TS(i,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),t.localParticipant.publishTrack(i),yield new Promise(a=>setTimeout(a,3e3));const o=yield(e=i.sender)===null||e===void 0?void 0:e.getStats();if(!o)throw new Error("Could not get RTCStats");let s=0;if(o.forEach(a=>{a.type==="outbound-rtp"&&(a.kind==="audio"||!a.kind&&a.mediaType==="audio")&&(s=a.packetsSent)}),s===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(s," audio packets"))})}}class YU extends Di{get description(){return"Can publish video"}perform(){return T(this,void 0,void 0,function*(){var e;const t=yield this.connect(),i=yield BU();yield this.checkForVideo(i.mediaStreamTrack),t.localParticipant.publishTrack(i),yield new Promise(s=>setTimeout(s,5e3));const r=yield(e=i.sender)===null||e===void 0?void 0:e.getStats();if(!r)throw new Error("Could not get RTCStats");let o=0;if(r.forEach(s=>{s.type==="outbound-rtp"&&(s.kind==="video"||!s.kind&&s.mediaType==="video")&&(o+=s.packetsSent)}),o===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(o," video packets"))})}checkForVideo(e){return T(this,void 0,void 0,function*(){const t=new MediaStream;t.addTrack(e.clone());const i=document.createElement("video");i.srcObject=t,i.muted=!0,yield new Promise(r=>{i.onplay=()=>{setTimeout(()=>{var o,s,a,c;const u=document.createElement("canvas"),l=e.getSettings(),d=(s=(o=l.width)!==null&&o!==void 0?o:i.videoWidth)!==null&&s!==void 0?s:1280,h=(c=(a=l.height)!==null&&a!==void 0?a:i.videoHeight)!==null&&c!==void 0?c:720;u.width=d,u.height=h;const p=u.getContext("2d");p.drawImage(i,0,0);const f=p.getImageData(0,0,u.width,u.height).data;let g=!0;for(let y=0;y<f.length;y+=4)if(f[y]!==0||f[y+1]!==0||f[y+2]!==0){g=!1;break}g?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),r()},1e3)},i.play()}),i.remove()})}}class XU extends Di{get description(){return"Resuming connection after interruption"}perform(){return T(this,void 0,void 0,function*(){var e;const t=yield this.connect();let i=!1,r=!1,o;const s=new Promise(u=>{setTimeout(u,5e3),o=u}),a=()=>{i=!0};t.on(U.SignalReconnecting,a).on(U.Reconnecting,a).on(U.Reconnected,()=>{r=!0,o(!0)}),(e=t.engine.client.ws)===null||e===void 0||e.close();const c=t.engine.client.onClose;if(c&&c(""),yield s,i){if(!r||t.state!==ge.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class JU extends Di{get description(){return"Can connect via TURN"}perform(){return T(this,void 0,void 0,function*(){var e,t;const i=new Up,r=yield i.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});let o=!1,s=!1,a=!1;for(let c of r.iceServers)for(let u of c.urls)u.startsWith("turn:")?(s=!0,a=!0):u.startsWith("turns:")&&(s=!0,a=!0,o=!0),u.startsWith("stun:")&&(a=!0);a?s&&!o&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield i.close(),!((t=(e=this.connectOptions)===null||e===void 0?void 0:e.rtcConfig)===null||t===void 0)&&t.iceServers||s?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(c=>setTimeout(c,0)))})}}class ZU extends Di{get description(){return"Establishing WebRTC connection"}perform(){return T(this,void 0,void 0,function*(){let e=!1,t=!1;this.room.on(U.SignalConnected,()=>{const i=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(r,o)=>{if(r.candidate){const s=new RTCIceCandidate(r);let a="".concat(s.protocol," ").concat(s.address,":").concat(s.port," ").concat(s.type);s.address&&(QU(s.address)?a+=" (private)":s.protocol==="tcp"&&s.tcpType==="passive"?(e=!0,a+=" (passive)"):s.protocol==="udp"&&(t=!0)),this.appendMessage(a)}i&&i(r,o)},this.room.engine.pcManager&&(this.room.engine.pcManager.subscriber.onIceCandidateError=r=>{r instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(r.errorCode," ").concat(r.errorText," ").concat(r.url))})});try{yield this.connect(),le.info("now the room is connected")}catch(i){throw this.appendWarning("ports need to be open on firewall in order to connect."),i}e||this.appendWarning("Server is not configured for ICE/TCP"),t||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function QU(n){const e=n.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const t=parseInt(e[1],10);if(t>=16&&t<=31)return!0}}return!1}class e5 extends Di{get description(){return"Connecting to signal connection via WebSocket"}perform(){return T(this,void 0,void 0,function*(){var e,t,i;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let r=new Up;const o=yield r.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});this.appendMessage("Connected to server, version ".concat(o.serverVersion,".")),((e=o.serverInfo)===null||e===void 0?void 0:e.edition)===rk.Cloud&&(!((t=o.serverInfo)===null||t===void 0)&&t.region)&&this.appendMessage("LiveKit Cloud: ".concat((i=o.serverInfo)===null||i===void 0?void 0:i.region)),yield r.close()})}}class v4 extends Mn.EventEmitter{constructor(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=t,this.options=i}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:vn.IDLE,name:"",description:""}),e}updateCheck(e,t){this.checkResults.set(e,t),this.emit("checkUpdate",e,t)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==vn.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return T(this,void 0,void 0,function*(){const t=this.getNextCheckId(),i=new e(this.url,this.token,this.options),r=s=>{this.updateCheck(t,s)};i.on("update",r);const o=yield i.run();return i.off("update",r),o})}checkWebsocket(){return T(this,void 0,void 0,function*(){return this.createAndRunCheck(e5)})}checkWebRTC(){return T(this,void 0,void 0,function*(){return this.createAndRunCheck(ZU)})}checkTURN(){return T(this,void 0,void 0,function*(){return this.createAndRunCheck(JU)})}checkReconnect(){return T(this,void 0,void 0,function*(){return this.createAndRunCheck(XU)})}checkPublishAudio(){return T(this,void 0,void 0,function*(){return this.createAndRunCheck(KU)})}checkPublishVideo(){return T(this,void 0,void 0,function*(){return this.createAndRunCheck(YU)})}checkConnectionProtocol(){return T(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(HU);if(e.data&&"protocol"in e.data){const t=e.data;this.options.protocol=t.protocol}return e})}checkCloudRegion(){return T(this,void 0,void 0,function*(){return this.createAndRunCheck($U)})}}const t5=/\{[^{}]+\}/g;function n5(){return Math.random().toString(36).slice(2,11)}function i5(n){let{baseUrl:e="",Request:t=globalThis.Request,fetch:i=globalThis.fetch,querySerializer:r,bodySerializer:o,headers:s,...a}={...n};e=ow(e);const c=[];async function u(l,d){const{baseUrl:h,fetch:p=i,Request:m=t,headers:f,params:g={},parseAs:y="json",querySerializer:b,bodySerializer:S=o??o5,body:w,...k}=d||{};h&&(e=ow(h));let C=typeof r=="function"?r:rw(r);b&&(C=typeof b=="function"?b:rw({...typeof r=="object"?r:{},...b}));const x=w===void 0?void 0:S(w),I=x===void 0||x instanceof FormData?{}:{"Content-Type":"application/json"},P={redirect:"follow",...a,...k,body:x,headers:a5(I,s,f,g.header)};let D,O,L=new t(s5(l,{baseUrl:e,params:g,querySerializer:C}),P);for(const W in k)W in L||(L[W]=k[W]);if(c.length){D=n5(),O=Object.freeze({baseUrl:e,fetch:p,parseAs:y,querySerializer:C,bodySerializer:S});for(const W of c)if(W&&typeof W=="object"&&typeof W.onRequest=="function"){const A=await W.onRequest({request:L,schemaPath:l,params:g,options:O,id:D});if(A){if(!(A instanceof t))throw new Error("onRequest: must return new Request() when modifying the request");L=A}}}let j=await p(L);if(c.length)for(let W=c.length-1;W>=0;W--){const A=c[W];if(A&&typeof A=="object"&&typeof A.onResponse=="function"){const H=await A.onResponse({request:L,response:j,schemaPath:l,params:g,options:O,id:D});if(H){if(!(H instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");j=H}}}if(j.status===204||j.headers.get("Content-Length")==="0")return j.ok?{data:{},response:j}:{error:{},response:j};if(j.ok)return y==="stream"?{data:j.body,response:j}:{data:await j[y](),response:j};let X=await j.text();try{X=JSON.parse(X)}catch{}return{error:X,response:j}}return{GET(l,d){return u(l,{...d,method:"GET"})},PUT(l,d){return u(l,{...d,method:"PUT"})},POST(l,d){return u(l,{...d,method:"POST"})},DELETE(l,d){return u(l,{...d,method:"DELETE"})},OPTIONS(l,d){return u(l,{...d,method:"OPTIONS"})},HEAD(l,d){return u(l,{...d,method:"HEAD"})},PATCH(l,d){return u(l,{...d,method:"PATCH"})},TRACE(l,d){return u(l,{...d,method:"TRACE"})},use(...l){for(const d of l)if(d){if(typeof d!="object"||!("onRequest"in d||"onResponse"in d))throw new Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");c.push(d)}},eject(...l){for(const d of l){const h=c.indexOf(d);h!==-1&&c.splice(h,1)}}}}function Tu(n,e,t){if(e==null)return"";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${n}=${(t==null?void 0:t.allowReserved)===!0?e:encodeURIComponent(e)}`}function nw(n,e,t){if(!e||typeof e!="object")return"";const i=[],r={simple:",",label:".",matrix:";"}[t.style]||"&";if(t.style!=="deepObject"&&t.explode===!1){for(const a in e)i.push(a,t.allowReserved===!0?e[a]:encodeURIComponent(e[a]));const s=i.join(",");switch(t.style){case"form":return`${n}=${s}`;case"label":return`.${s}`;case"matrix":return`;${n}=${s}`;default:return s}}for(const s in e){const a=t.style==="deepObject"?`${n}[${s}]`:s;i.push(Tu(a,e[s],t))}const o=i.join(r);return t.style==="label"||t.style==="matrix"?`${r}${o}`:o}function iw(n,e,t){if(!Array.isArray(e))return"";if(t.explode===!1){const o={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[t.style]||",",s=(t.allowReserved===!0?e:e.map(a=>encodeURIComponent(a))).join(o);switch(t.style){case"simple":return s;case"label":return`.${s}`;case"matrix":return`;${n}=${s}`;default:return`${n}=${s}`}}const i={simple:",",label:".",matrix:";"}[t.style]||"&",r=[];for(const o of e)t.style==="simple"||t.style==="label"?r.push(t.allowReserved===!0?o:encodeURIComponent(o)):r.push(Tu(n,o,t));return t.style==="label"||t.style==="matrix"?`${i}${r.join(i)}`:r.join(i)}function rw(n){return function(t){const i=[];if(t&&typeof t=="object")for(const r in t){const o=t[r];if(o!=null){if(Array.isArray(o)){if(o.length===0)continue;i.push(iw(r,o,{style:"form",explode:!0,...n==null?void 0:n.array,allowReserved:(n==null?void 0:n.allowReserved)||!1}));continue}if(typeof o=="object"){i.push(nw(r,o,{style:"deepObject",explode:!0,...n==null?void 0:n.object,allowReserved:(n==null?void 0:n.allowReserved)||!1}));continue}i.push(Tu(r,o,n))}}return i.join("&")}}function r5(n,e){let t=n;for(const i of n.match(t5)??[]){let r=i.substring(1,i.length-1),o=!1,s="simple";if(r.endsWith("*")&&(o=!0,r=r.substring(0,r.length-1)),r.startsWith(".")?(s="label",r=r.substring(1)):r.startsWith(";")&&(s="matrix",r=r.substring(1)),!e||e[r]===void 0||e[r]===null)continue;const a=e[r];if(Array.isArray(a)){t=t.replace(i,iw(r,a,{style:s,explode:o}));continue}if(typeof a=="object"){t=t.replace(i,nw(r,a,{style:s,explode:o}));continue}if(s==="matrix"){t=t.replace(i,`;${Tu(r,a)}`);continue}t=t.replace(i,s==="label"?`.${encodeURIComponent(a)}`:encodeURIComponent(a))}return t}function o5(n){return n instanceof FormData?n:JSON.stringify(n)}function s5(n,e){var r;let t=`${e.baseUrl}${n}`;(r=e.params)!=null&&r.path&&(t=r5(t,e.params.path));let i=e.querySerializer(e.params.query??{});return i.startsWith("?")&&(i=i.substring(1)),i&&(t+=`?${i}`),t}function a5(...n){const e=new Headers;for(const t of n){if(!t||typeof t!="object")continue;const i=t instanceof Headers?t.entries():Object.entries(t);for(const[r,o]of i)if(o===null)e.delete(r);else if(Array.isArray(o))for(const s of o)e.append(r,s);else o!==void 0&&e.set(r,o)}return e}function ow(n){return n.endsWith("/")?n.substring(0,n.length-1):n}const sw="Onboardee-Session-Token",aw="OnboardeeSessionToken";class cw{constructor(e){this.client=i5({baseUrl:e.baseUrl,headers:e.headers,fetch:e.fetch}),this.client.use({onRequest({request:t}){if(window.localStorage){const i=window.localStorage.getItem(aw);i&&t.headers.set(sw,i)}return t},onResponse({response:t}){const i=t.headers.get(sw);return i&&window.localStorage&&window.localStorage.setItem(aw,i),t}})}setAuthToken(e){this.client.use({onRequest({request:t}){return t.headers.set("Authorization",`Bearer ${e}`),t}})}setApiToken(e){this.client.use({onRequest({request:t}){return t.headers.set("Authorization",`Token ${e}`),t}})}async getAuthUrl(e){return await this.client.GET("/api/auth/{type}",{params:{path:{type:e}}})}async getConnectUrl(e){return await this.client.GET("/api/connect/{type}",{params:{path:{type:e}}})}async logout(){return await this.client.POST("/api/logout")}async getCurrentUser(){return await this.client.GET("/api/me")}async clientInitialise(e,t={}){return await this.client.POST("/api/client/{appToken}/initialise",{params:{path:{appToken:e}},body:t})}async clientStartSession(e,t){return await this.client.POST("/api/client/{appToken}/start-session",{params:{path:{appToken:e}},body:t})}async createPresignedUploadUrl(e){return await this.client.POST("/api/files",{body:e})}async createKnowledgeBlock(e){return await this.client.POST("/api/knowledge",{body:e})}async listOnboardees(){return await this.client.GET("/api/onboardees")}async getOnboardee(e){return await this.client.GET("/api/onboardees/{id}",{params:{path:{id:e}}})}async getOnboardeeWidgetConfig(e,t){return await this.client.GET("/api/onboardees/{id}/config",{params:{path:{id:e}},signal:t})}async listPlans(e){return await this.client.GET("/api/plans",{params:{query:{...e&&{client_type:e}}}})}async listPlansWithStatus(){return await this.client.GET("/api/plans-with-status")}async listProducts(){return await this.client.GET("/api/products")}async getProduct(e){return await this.client.GET("/api/products/{id}",{params:{path:{id:e}}})}async getProductAnalytics(e,t,i,r){return await this.client.GET("/api/products/{id}/analytics",{params:{path:{id:e},query:{...t&&{start_date:t},...i&&{end_date:i},...r&&{course_id:r}}}})}async createProduct(e){return await this.client.POST("/api/products",{body:e})}async updateProduct(e,t){return await this.client.PATCH("/api/products/{id}",{params:{path:{id:e}},body:t})}async getProductNavigationIndex(e){return await this.client.GET("/api/products/{id}/navigation-index",{params:{path:{id:e}}})}async replaceProductNavigationIndex(e,t){return await this.client.PUT("/api/products/{id}/navigation-index",{params:{path:{id:e}},body:t})}async listProductKnowledgeBlocks(e){return await this.client.GET("/api/products/{id}/knowledge-blocks",{params:{path:{id:e}}})}async createProductKnowledgeBlock(e,t){return await this.client.POST("/api/products/{id}/knowledge-blocks",{params:{path:{id:e}},body:t})}async searchProductKnowledgeBlocks(e,t,i){return await this.client.GET("/api/products/{id}/knowledge-blocks/search",{params:{path:{id:e},query:{q:t,...i&&{limit:i.toString()}}}})}async updateProductKnowledgeBlock(e,t,i){return await this.client.PATCH("/api/products/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:t}},body:i})}async deleteProductKnowledgeBlock(e,t){return await this.client.DELETE("/api/products/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:t}}})}async createPlan(e){return await this.client.POST("/api/plans",{body:e})}async getPlan(e){return await this.client.GET("/api/plans/{id}",{params:{path:{id:e}}})}async getAdminPlan(e){return await this.client.GET("/api/admin/plans/{id}",{params:{path:{id:e}}})}async getPlanAnalytics(e,t,i){return await this.client.GET("/api/plans/{id}/analytics",{params:{path:{id:e},query:{...t&&{start_date:t},...i&&{end_date:i}}}})}async replacePlan(e,t){return await this.client.PUT("/api/plans/{id}",{params:{path:{id:e}},body:t})}async updatePlan(e,t){return await this.client.PATCH("/api/plans/{id}",{params:{path:{id:e}},body:t})}async getPlanVideoUrl(e){return await this.client.GET("/api/plans/{id}/video-url",{params:{path:{id:e}}})}async getPlanVideoMetadata(e){return await this.client.GET("/api/plans/{id}/video-metadata",{params:{path:{id:e}}})}async deletePlan(e){return await this.client.DELETE("/api/admin/plans/{id}",{params:{path:{id:e}}})}async publishPlanRevision(e,t){return await this.client.POST("/api/plans/{id}/publish",{params:{path:{id:e}},body:t})}async listPlanRevisions(e){return await this.client.GET("/api/plans/{id}/revisions",{params:{path:{id:e}}})}async listPlanKnowledgeBlocks(e){return await this.client.GET("/api/plans/{id}/knowledge-blocks",{params:{path:{id:e}}})}async createPlanKnowledgeBlock(e,t){return await this.client.POST("/api/plans/{id}/knowledge-blocks",{params:{path:{id:e}},body:t})}async updatePlanKnowledgeBlock(e,t,i){return await this.client.PUT("/api/plans/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:t}},body:i})}async deletePlanKnowledgeBlock(e,t){return await this.client.DELETE("/api/plans/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:t}}})}async getPlanNavigationIndex(e){return await this.client.GET("/api/plans/{id}/navigation-index",{params:{path:{id:e}}})}async replacePlanNavigationIndex(e,t){return await this.client.POST("/api/plans/{id}/navigation-index",{params:{path:{id:e}},body:t})}async getRevisionNavigationIndex(e){return await this.client.GET("/api/revisions/{id}/navigation-index",{params:{path:{id:e}}})}async replaceRevisionNavigationIndex(e,t){return await this.client.PUT("/api/revisions/{id}/navigation-index",{params:{path:{id:e}},body:t})}async getPlanFAQ(e){return await this.client.GET("/api/plans/{id}/faq",{params:{path:{id:e}}})}async getRevisionFAQ(e){return await this.client.GET("/api/revisions/{id}/faq",{params:{path:{id:e}}})}async replaceRevisionFAQ(e,t){return await this.client.PUT("/api/revisions/{id}/faq",{params:{path:{id:e}},body:t})}async listRevisionKnowledgeBlocks(e){return await this.client.GET("/api/revisions/{id}/knowledge-blocks",{params:{path:{id:e}}})}async getRevisionSteps(e){return await this.client.GET("/api/revisions/{id}/steps",{params:{path:{id:e}}})}async replaceRevisionKnowledgeBlocks(e,t){return await this.client.PUT("/api/revisions/{id}/knowledge-blocks",{params:{path:{id:e}},body:t})}async createRevisionKnowledgeBlock(e,t){return await this.client.POST("/api/revisions/{id}/knowledge-blocks",{params:{path:{id:e}},body:t})}async updateRevisionKnowledgeBlock(e,t,i){return await this.client.PUT("/api/revisions/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:t}},body:i})}async deleteRevisionKnowledgeBlock(e,t){return await this.client.DELETE("/api/revisions/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:t}}})}async listSessions(e,t){const i={token:e};return t!=null&&t.productId&&(i.product_id=t.productId),t!=null&&t.startDate&&(i.start_date=t.startDate),t!=null&&t.endDate&&(i.end_date=t.endDate),await this.client.GET("/api/sessions",{params:{query:i}})}async createSession(e){return await this.client.POST("/api/sessions",{body:e})}async getSession(e){return await this.client.GET("/api/sessions/{id}",{params:{path:{id:e}}})}async startSession(e,t){return await this.client.GET("/api/sessions/{id}/start-session",{params:{path:{id:e},query:{token:t}}})}async getSessionRecording(e){return await this.client.GET("/api/sessions/{id}/recording",{params:{path:{id:e}}})}async getSessionSummary(e){return await this.client.GET("/api/sessions/{id}/summary",{params:{path:{id:e}}})}async getSessionProductUrl(e){return await this.client.GET("/api/sessions/{id}/product-url",{params:{path:{id:e}}})}async updateSession(e,t){return await this.client.PATCH("/api/sessions/{id}",{params:{path:{id:e}},body:t})}async listUserSessions(e){const t={};return e!=null&&e.productId&&(t.product_id=e.productId),e!=null&&e.courseId&&(t.course_id=e.courseId),e!=null&&e.startDate&&(t.start_date=e.startDate),e!=null&&e.endDate&&(t.end_date=e.endDate),e!=null&&e.page&&(t.page=e.page),e!=null&&e.limit&&(t.limit=e.limit),e!=null&&e.courseName&&(t.course_name=e.courseName),e!=null&&e.userName&&(t.user_name=e.userName),e!=null&&e.company&&(t.company=e.company),e!=null&&e.email&&(t.email=e.email),e!=null&&e.sortBy&&(t.sort_by=e.sortBy),e!=null&&e.sortOrder&&(t.sort_order=e.sortOrder),await this.client.GET("/api/user-sessions",{params:Object.keys(t).length>0?{query:t}:void 0})}async listUserSessionsAggregate(e){const t={};return e!=null&&e.productId&&(t.product_id=e.productId),e!=null&&e.courseId&&(t.course_id=e.courseId),e!=null&&e.startDate&&(t.start_date=e.startDate),e!=null&&e.endDate&&(t.end_date=e.endDate),await this.client.GET("/api/user-sessions-aggregate",{params:Object.keys(t).length>0?{query:t}:void 0})}async getJoinToken(e,{clientType:t,user:i}={}){return await this.client.GET("/api/join-token",{params:{query:{token:e,...t&&{client_type:t},...i&&{user:encodeURIComponent(i)}}}})}async getSessionPlan(e){return await this.client.GET("/api/sessions/{id}/plan",{params:{path:{id:e}}})}async getPlanSDK(e){return await this.client.GET("/api/plans/{uuid}/sdk",{params:{path:{uuid:e}}})}async getGraphemes(){return await this.client.GET("/api/graphemes")}getClient(){return this.client}}const uw="https://app.coragents.ai";class xu extends nh{constructor(e,t,i,r){super(),this.state=null,this.isPaused=!1,this.speakingState=null,this.captureScreen=null,this.sessionUuid=null,this.roomId=null,this.joinToken=null,this.roomUrl=null,this.room=null,this.startedAt=null,this.agentAnalyser=null,this.userAnalyser=null,this.appToken=e,this.planId=t,this.clientType=i,this.api=r.api||new cw({baseUrl:uw}),this.identity=r.identity||null,this.roomFactory=r.roomFactory||(o=>new po(o)),this.captureScreen=r.captureScreen||null}async start(){this.planId,this.setState("connecting"),this.speakingStateChanged("thinking");try{const t=(await this.api.clientStartSession(this.appToken,{client_type:this.clientType,onboarding_plan:this.planId})).data;if(!(t!=null&&t.url)||!(t!=null&&t.token)||!(t!=null&&t.room)||!(t!=null&&t.session_uuid))throw new Error("Invalid room info");this.sessionUuid=t==null?void 0:t.session_uuid,this.roomId=t==null?void 0:t.room,this.joinToken=t==null?void 0:t.token,this.roomUrl=t==null?void 0:t.url,this.startedAt=Date.now(),await this.joinRoom(),this.setState("connected"),this.planId,this.sessionUuid}catch(e){console.error("[obi] error starting session",{error:e}),this.setState("error")}}async joinRoom({withMicrophone:e=!1,withStateRecovery:t=!1}={}){this.room=this.roomFactory({adaptiveStream:!0,dynacast:!0}),this.room.on(U.Disconnected,i=>{if(!this.room)return;let r=null;switch(i){case 12:r="invalid-room";break}this.shutdown(r)}),this.room.on(U.TrackSubscribed,i=>{i.kind==="audio"&&(i.attach(),i.source===N.Source.Microphone&&(this.agentAnalyser&&this.agentAnalyser.disconnect(),this.agentAnalyser=this.createFFT(i.mediaStream)))}),this.room.on(U.LocalTrackPublished,i=>{i.kind==="audio"&&(this.userAnalyser&&this.userAnalyser.disconnect(),this.userAnalyser=this.createFFT(i.audioTrack.mediaStream))}),this.room.on(U.ParticipantAttributesChanged,i=>{if(!i["lk.agent.state"])return;const r=i["lk.agent.state"];switch(r){case"speaking":this.speakingStateChanged("speaking");break;case"listening":this.state!=="connected"&&this.speakingStateChanged("listening");break;case"thinking":this.speakingStateChanged("thinking");break;default:console.warn("[obi] unknown speaking state",r)}}),this.room.on(U.DataReceived,async i=>{try{const r=new TextDecoder().decode(i),o=JSON.parse(r);switch(o.status||o.request||o.type){case"course_progress":typeof o.current_step=="number"&&typeof o.total_steps=="number"&&Array.isArray(o.step_names)&&this.emit("courseProgress",{currentStep:Math.max(1,o.current_step),totalSteps:Math.max(1,o.total_steps),stepNames:o.step_names});break;case"using_tool":this.speakingStateChanged("busy");break;case"using_tool_ended":this.speakingStateChanged("speaking");break;case"prompt_user":this.setState("volume-check");break;case"mic_check":this.setState("mic-check");break;case"share_mic":this.setState("mic-share");break;case"share_screen":this.setState("screen-share");break;case"navigate":this.setState("navigate");break;case"shutdown":this.shutdown("server-sent");break;default:console.warn("[obi] unknown data received",o)}}catch(r){console.error("[obi] error parsing data",r)}}),this.room.localParticipant.registerRpcMethod("mic_check",async i=>(this.sessionUuid,await this.checkMicrophone()?"ok":"error")),this.room.localParticipant.registerRpcMethod("screen_capture",async i=>{if(!this.captureScreen)return console.error("[obi] no captureScreen function provided"),"error";let r=null,o=null;try{r=await this.captureScreen()}catch(s){r=null,s=s}if(!r||o)return console.error("[obi] error capturing screen",{error:o}),"error";try{return await this.room.localParticipant.sendFile(new File([r],"screen_capture.png",{type:"image/png"}),{mimeType:"image/png",topic:"screen_capture"}),"ok"}catch(s){return console.error("[obi] error sending screen capture",{error:s}),"error"}}),await this.room.connect(this.roomUrl,this.joinToken);for(let i=0;i<9&&!(this.room.state===ge.Connected&&this.room.remoteParticipants.size>=1);i++)await new Promise(r=>setTimeout(r,1e3));if(!(this.room.state===ge.Connected&&this.room.remoteParticipants.size>=1)){console.error("[obi] room not connected",{state:this.room.state,numParticipants:this.room.remoteParticipants.size}),this.shutdown("invalid-room");return}if(e&&await this.room.localParticipant.setMicrophoneEnabled(!0),t){let i=!1;for(const r of this.room.remoteParticipants.values())r.isSpeaking&&(i=!0);i?this.speakingState="speaking":this.speakingState="listening"}}async continue(){this.sessionUuid,this.speakingStateChanged("thinking"),await this.sendData({request:"prompt_user",success:!0})}async checkMicrophone(){let e=!1;try{e=(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch(t){console.error("[obi] error checking microphone permission:",t)}return e?(this.sessionUuid,await this.room.localParticipant.setMicrophoneEnabled(!0),this.isMicShared=!0):this.sessionUuid,e&&this.clientType==="sdk"&&this.setState("in-progress"),this.emit("micCheckComplete",e),e}async shareMicrophone(){this.sessionUuid,this.speakingStateChanged("thinking");let e=null,t=null;try{e=await this.room.localParticipant.setMicrophoneEnabled(!0),this.isMicShared=!0}catch(i){i=i,this.isMicShared=!1}e?this.sessionUuid:console.error("[obi] failed to share microphone",{error:t}),await this.sendData({request:"share_mic",success:!!e}),this.clientType==="sdk"&&this.setState("in-progress")}async shareMicrophoneFailed(){this.isMicShared=!1,await this.sendData({request:"share_mic",success:!1}),this.clientType==="sdk"&&this.setState("in-progress")}async shareScreen(){this.sessionUuid,this.speakingStateChanged("thinking"),await this.room.localParticipant.setScreenShareEnabled(!0,{video:{displaySurface:"window"}}),await this.sendData({request:"share_screen",success:!0}),this.setState("navigate")}async pause(){this.muteMicrophone(),this.isPaused=!0,this.emit("paused"),await this.sendData({request:"pause"}),console.log("[obi] paused session",{sessionUuid:this.sessionUuid})}async unpause(){this.unmuteMicrophone(),this.isPaused=!1,this.emit("unpaused"),await this.sendData({request:"unpause"}),console.log("[obi] unpaused session",{sessionUuid:this.sessionUuid})}muteMicrophone(){this.sessionUuid,this.room.localParticipant.getTrackPublications().forEach(e=>{var t,i;e.handleMuted(),(i=(t=e.track)==null?void 0:t.mediaStream)==null||i.getTracks().forEach(r=>r.enabled=!1)})}unmuteMicrophone(){this.sessionUuid,this.room.localParticipant.getTrackPublications().forEach(e=>{var t,i;e.handleUnmuted(),(i=(t=e.track)==null?void 0:t.mediaStream)==null||i.getTracks().forEach(r=>r.enabled=!0)})}async stop(){this.emit("stopped"),await this.shutdown()}async shutdown(e=null){if(this.room){this.sessionUuid,e!=="server-sent"&&await this.sendData({request:"shutdown"});const t=this.room;this.room=null,await t.disconnect(),this.sessionUuid}this.sessionUuid=null,this.roomId=null,this.joinToken=null,this.roomUrl=null,this.emit("shutdown",e)}async say(e){this.speakingStateChanged("thinking"),this.isPaused&&await this.unpause(),await this.sendData({request:"say",message:e})}serialise(){return JSON.stringify({state:this.state,speakingState:this.speakingState,appToken:this.appToken,planId:this.planId,clientType:this.clientType,isPaused:this.isPaused,identity:this.identity,sessionUuid:this.sessionUuid,roomId:this.roomId,joinToken:this.joinToken,roomUrl:this.roomUrl,startedAt:this.startedAt})}audioSpectrum(){return this.speakingState==="speaking"&&this.agentAnalyser?this.normaliseSpectrum(this.agentAnalyser):this.speakingState==="listening"&&this.userAnalyser?this.normaliseSpectrum(this.userAnalyser):null}normaliseSpectrum(e){const i=e.context.sampleRate/2/e.frequencyBinCount,r=new Uint8Array(e.frequencyBinCount);e.getByteFrequencyData(r);const o=[],s=50,a=5e3,c=8,u=Math.pow(a/s,1/c);for(let l=0;l<c;l++){const d=s*Math.pow(u,l),h=s*Math.pow(u,l+1),p=Math.floor(d/i),m=Math.floor(h/i),f=Math.min(m,r.length),g=Math.min(p,f);if(g<f){const y=r.slice(g,f).reduce((b,S)=>b+S,0)/(f-g)/255;o.push(y)}else o.push(0)}return o}setState(e){this.state;const t=this.state;this.state=e,this.emit("stateChanged",e,t)}static deserialise(e,t,i,r={}){const o=JSON.parse(e),s=new xu(t,o.planId,i,r);return s.state=o.state,s.speakingState=o.speakingState,s.identity=o.identity||null,s.isPaused=o.isPaused||!1,s.sessionUuid=o.sessionUuid||null,s.roomId=o.roomId||null,s.joinToken=o.joinToken||null,s.roomUrl=o.roomUrl||null,s.startedAt=o.startedAt||null,s}speakingStateChanged(e){this.speakingState;const t=this.speakingState;this.speakingState=e,this.emit("speakingStateChanged",e,t)}async sendData(e){await this.room.localParticipant.publishData(new TextEncoder().encode(JSON.stringify(e)),{reliable:!0})}createFFT(e){const t=new AudioContext,i=t.createAnalyser();return t.createMediaStreamSource(e).connect(i),i.fftSize=2048,i.smoothingTimeConstant=.6,i}}class Eu extends nh{constructor(e,t,i={}){super(),this.state="loading",this.error=null,this.identity=null,this.product=null,this.plans=[],this.planIsCompleted=[],this.selectedPlan=null,this.selectedPlanUuid=null,this.showWidget=!1,this.session=null,this.captureScreen=null,this.appToken=e,this.clientType=t,this.api=i.api||new cw({baseUrl:i.apiBaseUrl||uw}),this.sessionFactory=i.sessionFactory||((r,o,s,a)=>new xu(r,o,s,a)),this.captureScreen=i.captureScreen||null}async initialise(e={}){var t,i,r,o,s;if(!this.appToken)throw new Error("App token is required");this.setState("loading");try{const a=await this.api.clientInitialise(this.appToken,{identity:e.identity,client_type:this.clientType});if(this.identity=e.identity||null,this.product=((t=a.data)==null?void 0:t.product)||null,this.plans=((i=a.data)==null?void 0:i.onboarding_plans)||[],this.selectedPlan=((r=a.data)==null?void 0:r.selected_plan)||null,this.planIsCompleted=((o=a.data)==null?void 0:o.plan_is_completed)||[],this.showWidget=((s=a.data)==null?void 0:s.show_widget)||!1,e.planUuid){let c=null;try{const u=await this.api.getPlanSDK(e.planUuid);if(u.error)throw new Error(`Plan not found: ${u.error}`);u.data&&(c=u.data)}catch(u){try{const l=await this.api.getSessionPlan(e.planUuid);if(l.error)throw new Error(`Session plan not found: ${l.error}`);l.data&&(c=l.data)}catch(l){console.error("[obi] error getting plan via both endpoints",{planErr:u,sessionErr:l})}}c?(this.selectedPlan=c,this.selectedPlanUuid=e.planUuid):console.warn("[obi] plan not found",{planUuid:e.planUuid})}this.identity,this.product,this.plans,this.selectedPlan,this.showWidget}catch(a){throw this.error=a instanceof Error?a:new Error(String(a)),this.setState("error"),a}finally{this.setState("ready")}}selectPlan(e){this.selectedPlan=e,this.selectedPlanUuid=(e==null?void 0:e.uuid)||null,this.emit("planSelected",e)}async startSession(e,t){return await this._stopSession(),this.session=this.sessionFactory(this.appToken,e,this.clientType,{api:this.api,identity:this.identity,captureScreen:this.captureScreen}),this.prepareSession(t),this.session.start().then(()=>{this.emit("sessionStarted",this.session)}).catch(i=>{this.session=null,console.error("[obi] error starting session",i)}),this.session}async resumeSession(e){var t,i;return this.state,(t=this.session)==null||t.state,(i=this.session)==null||i.speakingState,this.session.captureScreen=this.captureScreen,this.prepareSession(e),this.session.joinRoom({withMicrophone:!0,withStateRecovery:!0}).then(()=>{this.emit("sessionResumed",this.session)}).catch(r=>{console.error("[obi] error joining room",{error:r}),r instanceof Error&&r.message==="Room is not connected"&&this.session.stop()}),this.session}prepareSession(e){if(!this.session)throw new Error("No session to prepare");return e(this.session),this.session.on("stopped",()=>{this.emit("sessionStopped")}),this.session.on("shutdown",t=>{var i,r,o;if((i=this.session)!=null&&i.startedAt&&this.session.startedAt+5*60*1e3<Date.now()){const s=this.plans.findIndex(a=>{var c;return a.uuid===((c=this.selectedPlan)==null?void 0:c.uuid)});s!==-1&&(this.planIsCompleted[s]=!0)}(o=(r=this.session)==null?void 0:r.removeAllListeners)==null||o.call(r),this.session=null,this.selectedPlan=null,this.selectedPlanUuid=null,this.emit("sessionShutdown",t)}),this.session}async stopSession(){await this._stopSession(),this.selectedPlan&&this.selectPlan(null)}async _stopSession(){this.session&&(this.trackEvent("session-stopped",{sessionUuid:this.session.sessionUuid}),await this.session.stop(),this.session=null)}isLoading(){return this.state==="loading"}isReady(){return this.state==="ready"}serialise(){var e;return JSON.stringify({state:this.state,appToken:this.appToken,clientType:this.clientType,identity:this.identity,product:this.product,plans:this.plans,selectedPlan:this.selectedPlan,selectedPlanUuid:this.selectedPlanUuid,showWidget:this.showWidget,session:(e=this.session)==null?void 0:e.serialise(),serialisedAt:new Date().toISOString()})}static deserialise(e,t,i,r={}){const o=JSON.parse(e);if(o.serialisedAt){const a=new Date(o.serialisedAt);if(new Date().getTime()-a.getTime()>1e3*20)throw new Error("Client was serialised more than 20 seconds ago, assuming it's dead.")}else throw new Error("Client was not serialised, assuming it's dead.");const s=new Eu(t,i,r);return s.state=o.state,s.identity=o.identity||null,s.product=o.product||null,s.plans=o.plans||[],s.selectedPlan=o.selectedPlan||null,s.selectedPlanUuid=o.selectedPlanUuid||null,s.showWidget=o.showWidget||!1,o.session&&(s.session=xu.deserialise(o.session,t,i,{api:s.api})),s}setState(e){const t=this.state;this.state=e,this.emit("stateChanged",e,t)}trackEvent(e,t={}){var i,r,o;this.emit("trackEvent",e,{...t,clientType:this.clientType,planId:(i=this.selectedPlan)==null?void 0:i.uuid,productId:(r=this.product)==null?void 0:r.uuid,sessionId:(o=this.session)==null?void 0:o.sessionUuid})}}function c5(n,e,t,i){function r(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(l){try{u(i.next(l))}catch(d){s(d)}}function c(l){try{u(i.throw(l))}catch(d){s(d)}}function u(l){l.done?o(l.value):r(l.value).then(a,c)}u((i=i.apply(n,e||[])).next())})}function u5(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(t=0)),t;)try{if(i=1,r&&(o=u[0]&2?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,r=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1],o=u;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(u);break}o[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(l){u=[6,l],r=0}finally{i=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;for(var lw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ks=typeof Uint8Array>"u"?[]:new Uint8Array(256),Iu=0;Iu<lw.length;Iu++)ks[lw.charCodeAt(Iu)]=Iu;for(var l5=function(n){var e=n.length*.75,t=n.length,i,r=0,o,s,a,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);var u=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),l=Array.isArray(u)?u:new Uint8Array(u);for(i=0;i<t;i+=4)o=ks[n.charCodeAt(i)],s=ks[n.charCodeAt(i+1)],a=ks[n.charCodeAt(i+2)],c=ks[n.charCodeAt(i+3)],l[r++]=o<<2|s>>4,l[r++]=(s&15)<<4|a>>2,l[r++]=(a&3)<<6|c&63;return u},d5=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},h5=function(n){for(var e=n.length,t=[],i=0;i<e;i+=4)t.push(n[i+3]<<24|n[i+2]<<16|n[i+1]<<8|n[i]);return t},ar=5,nf=6+5,rf=2,p5=nf-ar,dw=65536>>ar,f5=1<<ar,of=f5-1,m5=1024>>ar,g5=dw+m5,v5=g5,y5=32,b5=v5+y5,_5=65536>>nf,k5=1<<p5,S5=k5-1,hw=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},w5=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},C5=function(n,e){var t=l5(n),i=Array.isArray(t)?h5(t):new Uint32Array(t),r=Array.isArray(t)?d5(t):new Uint16Array(t),o=24,s=hw(r,o/2,i[4]/2),a=i[5]===2?hw(r,(o+i[4])/2):w5(i,Math.ceil((o+i[4])/4));return new T5(i[0],i[1],i[2],i[3],s,a)},T5=function(){function n(e,t,i,r,o,s){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=o,this.data=s}return n.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>ar],t=(t<<rf)+(e&of),this.data[t];if(e<=65535)return t=this.index[dw+(e-55296>>ar)],t=(t<<rf)+(e&of),this.data[t];if(e<this.highStart)return t=b5-_5+(e>>nf),t=this.index[t],t+=e>>ar&S5,t=this.index[t],t=(t<<rf)+(e&of),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),pw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x5=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ru=0;Ru<pw.length;Ru++)x5[pw.charCodeAt(Ru)]=Ru;var fw=null;function E5(n){return c5(this,void 0,void 0,function(){var e;return u5(this,function(t){switch(t.label){case 0:return fw!==null?[3,2]:[4,n()];case 1:if(e=t.sent(),!e.base64||!e.byte_length)throw new Error("Invalid graphemes response");fw=C5(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}for(var mw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",I5=typeof Uint8Array>"u"?[]:new Uint8Array(256),Pu=0;Pu<mw.length;Pu++)I5[mw.charCodeAt(Pu)]=Pu;function R5(n,e,t,i){function r(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(l){try{u(i.next(l))}catch(d){s(d)}}function c(l){try{u(i.throw(l))}catch(d){s(d)}}function u(l){l.done?o(l.value):r(l.value).then(a,c)}u((i=i.apply(n,e||[])).next())})}function P5(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(t=0)),t;)try{if(i=1,r&&(o=u[0]&2?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,r=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1],o=u;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(u);break}o[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(l){u=[6,l],r=0}finally{i=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;for(var gw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ss=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ou=0;Ou<gw.length;Ou++)Ss[gw.charCodeAt(Ou)]=Ou;for(var O5=function(n){var e=n.length*.75,t=n.length,i,r=0,o,s,a,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);var u=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),l=Array.isArray(u)?u:new Uint8Array(u);for(i=0;i<t;i+=4)o=Ss[n.charCodeAt(i)],s=Ss[n.charCodeAt(i+1)],a=Ss[n.charCodeAt(i+2)],c=Ss[n.charCodeAt(i+3)],l[r++]=o<<2|s>>4,l[r++]=(s&15)<<4|a>>2,l[r++]=(a&3)<<6|c&63;return u},A5=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},M5=function(n){for(var e=n.length,t=[],i=0;i<e;i+=4)t.push(n[i+3]<<24|n[i+2]<<16|n[i+1]<<8|n[i]);return t},cr=5,sf=6+5,af=2,N5=sf-cr,vw=65536>>cr,D5=1<<cr,cf=D5-1,L5=1024>>cr,U5=vw+L5,F5=U5,B5=32,j5=F5+B5,V5=65536>>sf,z5=1<<N5,q5=z5-1,yw=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},W5=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},G5=function(n,e){var t=O5(n),i=Array.isArray(t)?M5(t):new Uint32Array(t),r=Array.isArray(t)?A5(t):new Uint16Array(t),o=24,s=yw(r,o/2,i[4]/2),a=i[5]===2?yw(r,(o+i[4])/2):W5(i,Math.ceil((o+i[4])/4));return new $5(i[0],i[1],i[2],i[3],s,a)},$5=function(){function n(e,t,i,r,o,s){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=o,this.data=s}return n.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>cr],t=(t<<af)+(e&cf),this.data[t];if(e<=65535)return t=this.index[vw+(e-55296>>cr)],t=(t<<af)+(e&cf),this.data[t];if(e<this.highStart)return t=j5-V5+(e>>sf),t=this.index[t],t+=e>>cr&q5,t=this.index[t],t=(t<<af)+(e&cf),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),bw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",H5=typeof Uint8Array>"u"?[]:new Uint8Array(256),Au=0;Au<bw.length;Au++)H5[bw.charCodeAt(Au)]=Au;var _w=null;function K5(n){return R5(this,void 0,void 0,function(){var e;return P5(this,function(t){switch(t.label){case 0:return _w!==null?[3,2]:[4,n()];case 1:if(e=t.sent(),!e.base64||!e.byte_length)throw console.error("invalid graphemes response",e),new Error("Invalid graphemes response");_w=G5(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}const Y5=`:root,:host{--obi-modal-padding: 48px 48px 32px;--obi-modal-background-color: #FFFFFF;--obi-modal-border-radius: 12px;--obi-modal-shadow: 0px 1px 2px rgba(0, 0, 0, .05);--obi-modal-xsmall-width: 320px;--obi-modal-xsmall-height: 240px;--obi-modal-small-width: 480px;--obi-modal-small-height: 400px;--obi-modal-medium-width: 640px;--obi-modal-medium-height: 545px;--obi-modal-large-width: 1200px;--obi-modal-large-height: 700px;--obi-font-family: "Satoshi", sans-serif;--obi-color-primary: #9500FF;--obi-color-primary-50: color-mix(in srgb, var(--obi-color-primary) 50%, white 50%);--obi-color-primary-30: color-mix(in srgb, var(--obi-color-primary) 30%, white 70%);--obi-color-tint: color-mix(in srgb, var(--obi-color-primary) 5%, white 95%);--obi-color-text: #18181B;--obi-course-color-selected: var(--obi-color-primary-50);--obi-course-color-tint: var(--obi-color-tint);--obi-course-progress-step-completed: #B3B3B3;--obi-course-progress-step-incomplete: #D9D9D9;--obi-course-progress-text-color: #757575;font-family:var(--obi-font-family);color:var(--obi-color-text)}.obi-button{font-family:var(--obi-font-family);color:var(--obi-color-text)}dialog{margin:auto;padding:0;border:none;border-radius:var(--obi-modal-border-radius);box-shadow:var(--obi-modal-shadow);background:var(--obi-modal-background-color);box-sizing:border-box}dialog>.modal-content{padding:var(--obi-modal-padding);box-sizing:border-box}dialog,dialog.modal-medium,dialog>.modal-content,dialog.modal-medium>.modal-content{width:var(--obi-modal-medium-width);min-height:var(--obi-modal-medium-height)}dialog.modal-xsmall,dialog.modal-xsmall>.modal-content{width:var(--obi-modal-xsmall-width);min-height:var(--obi-modal-xsmall-height)}dialog.modal-small,dialog.modal-small>.modal-content{width:var(--obi-modal-small-width);min-height:var(--obi-modal-small-height)}dialog.modal-large,dialog.modal-large>.modal-content{width:var(--obi-modal-large-width);min-height:var(--obi-modal-large-height)}dialog::backdrop{background:rgba(0,0,0,.5)}.tour-content{display:block;width:100%;height:100%}.tour-content .container{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;padding:0;width:100%;height:100%}.tour-content .header{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:100%}.tour-content .title{width:100%;font-family:Satoshi,sans-serif;font-style:normal;font-weight:700;font-size:32px;line-height:90%;text-align:center;letter-spacing:-.03em;color:#18181b;margin:0}.tour-content .subtitle{width:100%;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;margin:0}.tour-content .visual{width:480px;height:240px;margin-top:24px;border-radius:12px;display:flex;align-items:center;justify-content:center;position:relative}.tour-content .description{width:100%;min-height:48px;margin:24px 0 0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b}.tour-content .button-container{display:flex;margin-top:24px;flex-direction:column;align-items:center;gap:16px;width:100%}.tour-content .action-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;min-width:200px;height:40px;background:#303030;border:1px solid #303030;border-radius:4px;cursor:pointer;text-decoration:none}.tour-content .action-button.disabled{opacity:.6;cursor:not-allowed}.tour-content .button-text{height:16px;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:100%;color:#fbf3ff}.tour.content-area{flex:1;display:flex;flex-direction:column}.obi-close-button{position:absolute;top:24px;right:24px;width:24px;height:24px;cursor:pointer;border:none;background:none;padding:0;display:flex;align-items:center;justify-content:center;z-index:1}.obi-panel{box-sizing:border-box;padding:24px;background-color:#fff;box-shadow:0 16px 32px -4px #0000001f,0 4px 8px -2px #00000014,inset 0 1px #fff9;border-radius:12px}.obi-pill.container{width:96px;height:30px;display:flex;align-items:center;justify-content:center}.obi-pill.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill.container .pill.button{cursor:pointer}.obi-pill.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill.container.active .pill{width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill.container.busy,.obi-pill.container.busy .pill{width:220px}.obi-pill2.container{display:flex;align-items:center;justify-content:center}.obi-pill2.container .pill{display:flex;align-items:center;justify-content:center;min-width:48px;max-width:48px;height:6px;opacity:.7;border-radius:3px;border:1px solid #FFFFFF1F;background-color:var(--obi-color-primary);transform:translateY(0);overflow:hidden;white-space:nowrap;flex:0 0 auto;box-sizing:border-box;padding-left:0;padding-right:0;transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill2.container .pill.button{cursor:pointer}.obi-pill2.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill2.container:not(.active) .pill{transform:translateY(12px);transition:transform 0s linear .15s,max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill2.container.active{transition:none;height:30px}.obi-pill2.container.active .pill{transition:transform 0s,max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out;max-width:1000px;height:30px;border-radius:15px;opacity:1;padding-left:14px;padding-right:14px}.obi-pill2.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill2.container:not(.active) .pill .text{opacity:0;animation:none}.obi-pill-up.container{display:flex;align-items:flex-end;justify-content:center}.obi-pill-up.container .pill{display:flex;align-items:center;justify-content:center;min-width:48px;max-width:48px;height:6px;opacity:.7;border-radius:3px;border:1px solid #FFFFFF1F;background-color:var(--obi-color-primary);overflow:hidden;white-space:nowrap;flex:0 0 auto;box-sizing:border-box;padding-left:0;padding-right:0;transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill-up.container .pill.button{cursor:pointer}.obi-pill-up.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill-up.container:not(.active) .pill{transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill-up.container.active{transition:none;height:30px}.obi-pill-up.container.active .pill{transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out;max-width:1000px;height:30px;border-radius:15px;opacity:1;padding-left:14px;padding-right:14px}.obi-pill-up.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill-up.container:not(.active) .pill .text{opacity:0;animation:none}.obi-popout{position:relative;display:inline-block}.obi-popout .obi-popout-target{cursor:pointer;display:inline-block}.obi-popout .content{position:absolute;background-color:#fff0;z-index:100;animation:popout-appear .15s ease-out}@keyframes popout-appear{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.obi-round-button-popout{z-index:600}.obi-round-button{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;padding:0;box-sizing:border-box;background-color:#fff;border:1px solid #D9D9D9;box-shadow:none}.obi-round-button:hover{cursor:pointer}.obi-round-button:disabled{box-shadow:none;background-color:#f0f0f0;color:#999;cursor:not-allowed!important;pointer-events:none}.obi-round-button-title{padding:8px 16px;border-radius:12px;background-color:#fff;color:#000;font-size:14px;font-weight:400;white-space:nowrap;box-shadow:0 4px 12px #00000026,0 2px 4px #0000001a;border:1px solid rgba(0,0,0,.08);z-index:5000;pointer-events:none;-webkit-user-select:none;user-select:none;position:relative}.obi-round-button-title:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid white;filter:drop-shadow(0 2px 2px rgba(0,0,0,.1))}.obi-equaliser{display:flex;align-items:center;gap:2px;height:32px}.obi-equaliser .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-equaliser .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1}.obi-message{display:inline-flex;align-items:center;justify-content:center;padding:0 15px;text-wrap:nowrap;font-size:16px;font-weight:400;height:30px;box-sizing:border-box;background-color:#fff;border-radius:15px;border:1px solid #D9D9D9}.obi-message.clickable{box-shadow:0 4px 6px #0000001a;cursor:pointer}.obi-loading-dots{display:flex;align-items:center;gap:2px;height:32px}.obi-loading-dots .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-loading-dots .dot{width:3px;height:3px;border-radius:2px;position:relative;z-index:2}.obi-loading-dots .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1;height:0px;animation:bounce .9s ease-in-out infinite}@keyframes bounce{0%,60%,to{height:0px}30%{height:16px}}.obi-exit-survey{position:relative;width:320px;margin:0 auto;-webkit-backdrop-filter:none;backdrop-filter:none;background:white;z-index:9999}.obi-exit-survey-container{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-header{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-title{width:272px;height:22px;margin:0;font-family:Satoshi,sans-serif;font-size:16px;font-weight:600;line-height:140%;text-align:center;color:#1e1e1e;flex:none;align-self:stretch}.obi-exit-survey-subtitle{width:272px;height:20px;margin:0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;text-align:center;color:#757575;flex:none;align-self:stretch}.obi-exit-survey-options{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-options textarea{height:80px;resize:none;outline:none}.obi-exit-survey-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;width:272px;height:44px;border-radius:12px;cursor:pointer;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-button:hover{transform:translateY(-1px);box-shadow:0 4px 8px #0000001a}.obi-exit-survey-button:active{transform:translateY(0)}.obi-exit-survey-button-continue{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-button-continue:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-button-wrap-up{background:#303030;border:1px solid rgba(217,217,217);color:#fff;font-weight:500}.obi-exit-survey-button-wrap-up:hover{background:#404040;border-color:#d9d9d9}.obi-exit-survey-reason-button{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-reason-button:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-reason-button-secondary{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:4px 6px;gap:8px;width:272px;height:28px;border-radius:4px;cursor:pointer;border:none;background:transparent;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;color:#5a5a5a;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-reason-button-secondary:hover{background:rgba(0,0,0,.05);color:#3a3a3a}.obi-message-input{display:inline-block;position:relative}.obi-message-input .container{width:212px;height:30px;box-sizing:border-box;background:#FFFFFF;border:1px solid var(--obi-color-primary-30);border-radius:15px;display:flex;align-items:center;flex:none;order:2;flex-grow:0;transition:height .3s ease,border-radius .3s ease;animation:expandMessageInput .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .container{height:auto;min-height:140px;border-radius:15px;align-items:flex-start;padding:8px 0;animation:expandMessageInputWide .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input .field{flex:1 1 0;border:none;background:transparent;outline:none;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:18px;color:#000;padding:4px 3px 0 16px;height:100%;box-sizing:border-box;min-width:0;resize:none;overflow:hidden;scrollbar-width:none;transition:padding .3s ease;animation:fadeInInputField .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .field{height:auto;min-height:120px;padding:4px 16px;overflow-y:auto;line-height:18px}.obi-message-input .field::placeholder{color:#999}.obi-message-input .field:disabled{cursor:not-allowed;opacity:.6}.obi-message-input .send{position:absolute;bottom:3px;right:4px;flex-shrink:0;width:24px;height:24px;background:var(--obi-color-primary);border:none;border-radius:9999px;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:all .3s ease;color:#fff}.obi-message-input.expanded .send{width:28px;height:28px;position:relative;top:0;bottom:0;margin-right:0}.obi-message-input.expanded .button-container{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:8px}.obi-message-input .send:disabled{background:#CCCCCC;cursor:not-allowed;transform:none}.obi-message-input .container:focus-within{border-color:var(--obi-color-primary);box-shadow:0 0 0 2px #9008ff1a}@keyframes expandMessageInput{0%{width:32px}to{width:212px}}@keyframes expandMessageInputWide{0%{width:212px}to{width:340px}}@keyframes fadeInInputField{0%{opacity:0}60%{opacity:0}to{opacity:1}}.obi-course-progress{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:6px;width:100%;min-width:0;height:24px;flex:none;order:1;align-self:stretch;flex-grow:0}.obi-course-progress-steps{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0;gap:2px;width:100%;height:6px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-container{display:flex;flex-direction:column;justify-content:center;align-items:stretch;padding:2px 0;height:6px;flex:1;min-width:0}.obi-course-progress-step{width:100%;height:2px;background:var(--obi-course-progress-step-incomplete);border-radius:24px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-step.completed{background:var(--obi-course-progress-step-completed)}.obi-course-progress-description{width:100%;height:14px;font-family:var(--obi-font-family);font-style:normal;font-weight:500;font-size:14px;line-height:100%;color:var(--obi-course-progress-text-color);flex:none;order:1;flex-grow:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.obi-widget-popout{z-index:400}.obi-widget-panel{display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;min-width:222px;width:min-content;padding:12px;box-sizing:border-box;border-radius:27px;background:white;transition:background .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel:not(.messaging){width:256px}.obi-widget-panel.tool-usage{width:384px}.obi-widget-panel:not(.expanded){background:transparent;border:none;box-shadow:none;transition:background .1s ease-out .1s,border .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel.maximized{transform:translateY(-110px)}.obi-widget-panel .obi-widget{display:flex;align-items:center;min-width:192px;padding-left:58px;box-sizing:border-box;gap:4px}.obi-widget-panel .obi-widget.active.in-plan{padding-left:0}.obi-widget-panel .obi-widget.active.in-plan .obi-round-button{animation:fade-in-button .2s ease-out .15s both}.obi-widget-panel .obi-widget.active .obi-equaliser{animation:fade-in-equaliser .2s ease-out .15s both}@keyframes fade-in-button{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes fade-in-equaliser{0%{opacity:0}to{opacity:1}}.obi-widget-panel .obi-course-progress-container{display:none;width:100%;max-height:0;opacity:0;transform:translateY(-10px);overflow:hidden;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,transform .3s ease-in-out}.obi-widget-panel:hover .obi-course-progress-container{display:block;max-width:22 0px;animation:expand-course-progress .3s ease-in-out forwards}.obi-widget-panel:hover .obi-course-progress-container.expanded{max-width:330px}@keyframes expand-course-progress{0%{max-height:0;opacity:0;transform:translateY(-10px)}to{max-height:40px;opacity:1;transform:translateY(0)}}.obi-widget-pill-text{font-size:16px;font-weight:400;color:#fff;opacity:0;animation:fade-in-pill-text .3s ease-in-out forwards}@keyframes fade-in-pill-text{0%{opacity:0}40%{opacity:0}to{opacity:1}}.obi-widget-buttons{display:flex;flex-direction:row;gap:4px}.obi-widget-out-of-plan{display:flex;align-items:center;gap:0}.obi-widget-out-of-plan .text{font-size:16px;color:#fff;display:inline-flex;align-items:center;gap:8px;animation:fade-in-pill-text .3s ease-in-out forwards}.obi-widget-out-of-plan .round-button{display:none;animation:fade-in-button .2s ease-out .15s both}.obi-widget-out-of-plan .message{display:none}.obi-widget-out-of-plan.active{gap:0}.obi-widget-out-of-plan.active:hover,.obi-widget-out-of-plan.active.hover{gap:4px}.obi-widget-out-of-plan.active:hover .round-button,.obi-widget-out-of-plan.active:hover .message,.obi-widget-out-of-plan.active.hover .round-button,.obi-widget-out-of-plan.active.hover .message{display:flex}.obi-static-voice-visual{display:flex;align-items:center;gap:2px;height:32px}.obi-static-voice-visual .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-static-voice-visual .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;background-color:#fff;border-radius:2px;z-index:1}.obi-static-voice-visual .bar-1{height:2px}.obi-static-voice-visual .bar-2{height:6px}.obi-static-voice-visual .bar-3{height:10px}.obi-static-voice-visual .bar-4,.obi-static-voice-visual .bar-5{height:16px}.obi-static-voice-visual .bar-6{height:10px}.obi-static-voice-visual .bar-7{height:6px}.obi-static-voice-visual .bar-8{height:2px}.tour-select{display:block;font-family:Inter,sans-serif}.course-container{display:flex;padding:20px;align-items:flex-start;gap:8px;height:180px;border-radius:6px;border:1px solid rgba(0,0,0,.6);background:#fff;cursor:pointer;transition:all .2s;flex-direction:column;box-sizing:border-box;overflow:hidden}.course-container:hover{background-color:#f9fafb;border-color:#d1d5db;box-shadow:0 1px 2px #0000000d}.course-container:active{transform:scale(.98)}.course-container.selected{border-radius:6px;border:1px solid var(--obi-course-color-selected);background:var(--obi-course-color-tint)}.course-container.selected:hover{background:var(--obi-course-color-tint)}.header-row{display:flex;justify-content:space-between;align-items:flex-start;align-self:stretch;flex-shrink:0;text-align:left}.course-title{color:#000;font-family:Inter,sans-serif;font-size:20px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.2px;margin:0}.duration{display:flex;padding:4px 12px;justify-content:center;align-items:center;gap:8px;border-radius:9999px;background:var(--obi-course-color-tint);color:#000;font-family:Inter,sans-serif;font-size:14px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.14px;flex-shrink:0}.course-container.selected .duration{background:#fff}.course-description{flex:1 0 0;color:#0009;font-family:Inter,sans-serif;font-size:16px;font-style:normal;font-weight:400;line-height:140%;letter-spacing:-.16px;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;text-align:left}.course-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;padding:0;flex:1 0 0;align-self:stretch;min-height:364px}.controls{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.tabs{display:flex;gap:10px}.tab{display:flex;padding:6px 12px;justify-content:center;align-items:center;align-self:stretch;border:none;background:none;cursor:pointer;font-family:Inter,sans-serif;font-size:16px;font-weight:500;color:#0006;border-bottom:2px solid transparent;transition:all .2s}.tab.active{color:#000;border-bottom:2px solid var(--obi-color-primary)}.tab:hover{color:#000}.filter{position:relative;display:flex;align-items:center;width:336px;height:40px}.filter input{color:var(--obi-color-text);caret-color:var(--obi-color-text);padding:8px 12px 8px 36px;border-radius:6px;border:1px solid rgba(0,0,0,.1);background:#fff;font-family:Inter,sans-serif;font-size:14px;line-height:20px;width:100%;height:100%;box-sizing:border-box;outline:none}.filter input:focus{outline:1px solid var(--obi-color-primary);outline-offset:-1px}.filter input::placeholder{color:#0006}.filter svg{position:absolute;left:12px;pointer-events:none}@media (max-width: 767px){.course-grid{grid-template-columns:1fr}}.loading,.error,.empty{display:flex;justify-content:center;align-items:center;margin-top:16px}.error{color:#ef4444}.tour-select-modal-container{display:flex;flex-direction:column;align-items:center;gap:24px;flex:1 0 0;align-self:stretch;font-family:Satoshi,sans-serif;color:#000;text-align:center;max-width:1200px;width:100%;min-height:600px;box-sizing:border-box}.course-list-wrapper{flex:1;overflow-y:auto;width:100%;min-height:0;max-height:424px;padding-right:3px;box-sizing:border-box}.course-list-wrapper::-webkit-scrollbar{width:3px}.course-list-wrapper::-webkit-scrollbar-track{background:transparent}.course-list-wrapper::-webkit-scrollbar-thumb{background-color:#000;border-radius:2px;min-height:20px}.course-list-wrapper::-webkit-scrollbar-thumb:hover{background-color:#333}.header{display:flex;align-items:flex-start;gap:16px;width:100%;text-align:left}.icon{display:flex;width:56px;height:56px;padding:12px;justify-content:center;align-items:center;border-radius:12px;border:1px solid var(--obi-color-primary);background:var(--obi-color-primary);box-sizing:border-box}.icon img{width:32px;height:32px;color:#fff;fill:#fff}.title-section{align-self:stretch;flex:1}.tour-select-modal-container h1{color:#18181b;font-family:Satoshi;font-size:32px;font-style:normal;font-weight:700;line-height:90%;letter-spacing:-.96px;margin:0 0 8px}.subtitle{color:#18181b;font-family:Satoshi;font-size:20px;font-style:normal;font-weight:500;line-height:90%;letter-spacing:-.6px;margin:0}.footer{display:flex;width:360px;flex-direction:column;align-items:center;gap:12px}.footer-button{display:flex;height:48px;padding:16px;justify-content:center;align-items:center;gap:8px;align-self:stretch;border-radius:6px;background:#18181b;border:none;cursor:pointer;color:#fafafa;font-family:Satoshi;font-weight:500;transition:opacity .2s ease}.footer-button:disabled{opacity:.5;cursor:not-allowed}.footer-button:not(:disabled){opacity:1}.footer-button:not(:disabled):hover{background:#27272a}.footer-text{color:#18181b;font-family:Satoshi;font-size:12px;font-style:normal;font-weight:400;line-height:100%;letter-spacing:-.12px;margin:0;text-align:center}.skeleton{background:linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 50%,#e5e7eb 75%);background-size:200% 100%;animation:loading 1.5s infinite;border-radius:4px}@keyframes loading{0%{background-position:200% 0}to{background-position:-200% 0}}.skeleton-title{height:32px;width:60%;margin-bottom:12px}.skeleton-subtitle{height:20px;width:80%}
121
- `;function X5(n){let e=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function J5(n,e){if(!e||e.length===0)return!1;const t=n.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(i=>{try{const r=X5(i);return r.test(t)||r.test(n)}catch(r){return console.warn(`Invalid URL pattern: ${i}`,r),!1}})}function uf(n){if(!n||n.length===0)return!1;const e=window.location.origin+window.location.pathname;return J5(e,n)}function Z5(n){var C,x,I,P,D,O,L,j,X,W;const[e,t]=de(!1),[i,r]=de(!1),[o,s]=de(null),a=Q5(n.sdk,c,n.shadowHost,s);function c(A){var H;(H=a.client)!=null&&H.session||(t(A),A&&Se().track("course-list-opened"))}if(!a.client)return null;const u=a.client.planIsCompleted.filter(Boolean).length===a.client.plans.length,l=e4((C=a.client.product)==null?void 0:C.widget_url_blacklist),d=u?a.completedWidgetDisplay||((x=a.client.product)==null?void 0:x.completed_widget_display):a.widgetDisplay||((I=a.client.product)==null?void 0:I.widget_display),h=a.widgetPosition||((P=a.client.product)==null?void 0:P.widget_position);let p=a.isActive;((O=(D=a.client)==null?void 0:D.product)==null?void 0:O.name)==="Canibuild"&&(p=!0);const m=a.client.session,f=!!m,g=f&&!e;let y;switch(m==null?void 0:m.speakingState){case"listening":y="user-speaking";break;case"speaking":y="agent-speaking";break;case"thinking":y="thinking";break;case"busy":y="busy";break}const b=m==null?void 0:m.isPaused,S=f||a.client.state==="ready"&&p&&!l&&(a.client.selectedPlan||!((L=a.client.product)!=null&&L.widget_link_only_access))&&(d!=="invisible"||a.client.selectedPlan),w=()=>{var A,H,Y,J,ve,Me;return{name:(A=a.client.selectedPlan)==null?void 0:A.name,description:(H=a.client.selectedPlan)==null?void 0:H.description,appName:(Y=a.client.product)==null?void 0:Y.name,appLogoUrl:((J=a.client.product)==null?void 0:J.logo_url)||"",url:(ve=a.client.product)==null?void 0:ve.url,agentName:((Me=a.client.product)==null?void 0:Me.agent_name)||"Obi"}},k=h==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};return g?k.top="calc(100vh - 100px)":k.bottom="20px",_("div",{children:[e&&_(NC,{open:e,courses:a.client.plans.map((A,H)=>{var Y,J;return{id:A.uuid,name:A.name,description:A.description||"",duration:A.duration||0,completed:((J=(Y=a.client)==null?void 0:Y.planIsCompleted)==null?void 0:J[H])||!1}}),loading:!1,agentName:((j=a.client.product)==null?void 0:j.agent_name)||"Obi",productName:((X=a.client.product)==null?void 0:X.name)||"",onCourseHighlight:A=>{A&&Se().track("course-selected",{courseName:A.name,courseUuid:A.id})},onCourseSelect:A=>{const H=a.client.plans.find(Y=>Y.uuid===A.id)||null;H&&(H==null?void 0:H.uuid)!==a.client.selectedPlanUuid&&(a.client.selectPlan(H),t(!1),r(!0),Se().track("course-get-started",{courseName:A.name,courseUuid:A.id}))},onClose:A=>{A==="user-initiated"&&a.client.selectPlan(null),t(!1)}}),S&&_(St,{children:[_("div",{style:k,children:_(mC,{inPlan:f,isActive:i?!1:void 0,defaultIsActive:d!=="minimized",isPaused:b,messaging:(m==null?void 0:m.isMicShared)===!1?!0:void 0,speakingStatus:y,spectrum:()=>(m==null?void 0:m.audioSpectrum())||null,courseProgress:o,onOpen:()=>{t(!0),Se().track("course-list-opened")},onCancelClick:()=>{Se().track("close-button-clicked")},onCancelAbort:()=>{Se().track("close-confirmation-no")},onCancel:()=>{var A;(A=a.client.session)==null||A.stop(),Se().track("close-confirmation-yes")},onCancelReason:(A,H)=>{Se().track("close-survey-answered",{reason:A,reasonText:H})},onPause:()=>{var A,H;(H=(A=a.client.session)==null?void 0:A.pause)==null||H.call(A),Se().track("pause-button-clicked")},onUnpause:()=>{var A,H;(H=(A=a.client.session)==null?void 0:A.unpause)==null||H.call(A),Se().track("play-button-clicked")},onMessagingChange:A=>{var H,Y,J,ve;A?((Y=(H=a.client.session)==null?void 0:H.muteMicrophone)==null||Y.call(H),Se().track("switch-to-chat-clicked")):((ve=(J=a.client.session)==null?void 0:J.unmuteMicrophone)==null||ve.call(J),Se().track("switch-to-voice-clicked"))},onMessageChange:A=>{Se().track("chat-input-provided",{message:A,length:A.length})},onMessage:A=>{a.say(A),Se().track("chat-message-sent",{message:A,length:A.length})},onHover:A=>{A&&!f&&Se().track("widget-hover-on")},onOneClickAction:A=>{Se().track("one-click-action-clicked",{action:A})},onMinimize:()=>{Se().track("minimise-button-clicked",{inSession:f})},agentName:((W=a.client.product)==null?void 0:W.agent_name)||"Obi",completedTutorials:a.client.planIsCompleted.filter(Boolean).length,totalTutorials:a.client.plans.length})}),!!a.client.selectedPlan&&_(LC,{open:!0,session:w(),sessionState:(m==null?void 0:m.state)||null,speakingState:(m==null?void 0:m.speakingState)||null,spectrum:()=>(m==null?void 0:m.audioSpectrum())||null,onModalChange:A=>{A==="session-start"?Se().track("course-screen-opened"):A==="voice-guidance"?Se().track("can-you-hear-opened"):A==="overview"?Se().track("welcome-tour-opened"):A==="share-mic"&&Se().track("connect-mic-opened")},onClose:(A,H)=>{var Y,J;A==="user-initiated"&&(H==="session-start"?Se().track("course-screen-closed"):H==="voice-guidance"?Se().track("can-you-hear-closed"):H==="overview"?Se().track("welcome-tour-closed"):H==="share-mic"&&Se().track("connect-mic-closed"),((Y=a.client.session)==null?void 0:Y.state)==="mic-share"?(J=a.client.session)==null||J.shareMicrophoneFailed():a.client.stopSession()),r(!1)},onStart:()=>{a.client.selectedPlanUuid&&(Se().track("course-screen-continue"),a.startSession())},onContinue:()=>{m==null||m.continue(),Se().track("can-you-hear-continue")},onShareMicrophone:()=>{m==null||m.shareMicrophone(),Se().track("connect-mic-continue")}})]})]})}function Q5(n,e,t,i){const[r,o]=de(0),[s,a]=de(null);return Dt(()=>{n.on("showMenu",c=>{e(c)}),n.on("configUpdated",()=>{o(c=>c+1)})},[n]),Dt(()=>{n.client&&(n.client.session&&a(n.client.session),n.client.on("sessionStarted",c=>{a(c),o(u=>u+1)}),n.client.on("sessionStopped",()=>{a(null),o(c=>c+1)}),n.client.on("sessionShutdown",()=>{o(c=>c+1)}),n.client.on("sessionResumed",()=>{o(c=>c+1)}),n.client.on("stateChanged",()=>{var c;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((c=n.client.product)==null?void 0:c.primary_color)||"#9500FF"),o(u=>u+1)}),n.client.on("planSelected",()=>{o(c=>c+1)}))},[n,n.client]),Dt(()=>{if(!s)return;s.on("stateChanged",()=>{o(u=>u+1)}),s.on("speakingStateChanged",()=>{o(u=>u+1)}),s.on("paused",()=>{o(u=>u+1)}),s.on("unpaused",()=>{o(u=>u+1)});const c=u=>{i(u)};return s.on&&s.on("courseProgress",c),()=>{s.off&&s.off("courseProgress",c)}},[s]),n}function e4(n){const[e,t]=de(()=>uf(n));return Dt(()=>{t(uf(n))},[n]),Dt(()=>{t4();const i=()=>{t(uf(n))};return window.addEventListener("locationchange",i),window.addEventListener("popstate",i),window.addEventListener("hashchange",i),()=>{window.removeEventListener("locationchange",i),window.removeEventListener("popstate",i),window.removeEventListener("hashchange",i)}},[n]),e}function t4(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,i=r=>function(...o){const s=r.apply(this,o);return window.dispatchEvent(new Event("locationchange")),s};window.history.pushState=i(e),window.history.replaceState=i(t),n.__obi_history_patched=!0}function n4(n){if(document.querySelector("obi-widget"))return;i4();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),i=document.createElement("div");i.id="obi-container",t.appendChild(i);const r=new CSSStyleSheet;r.replaceSync(Y5),t.adoptedStyleSheets=[r],Dw(_(Z5,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function i4(){kw("https://fonts.cdnfonts.com/css/satoshi"),kw("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function kw(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const Sw="49206C6F7665204F6269_session",ww="obi-url-params";class r4 extends nh{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandQueue=[],this._resumed=!1,this.dispatchCommand=(t,i)=>{var r,o,s,a,c;switch(t){case"update":this.updateConfig(i);break;case"startSession":if(!(i!=null&&i.planUuid)){console.warn("[obi] startSession command requires a planUuid",i);return}const u=(((r=this.client)==null?void 0:r.plans)||[]).find(l=>l.uuid===i.planUuid)||null;if(!u){console.warn("[obi] startSession command requires a valid planUuid",i);return}this.updateActive(!0),(s=(o=this.client)==null?void 0:o.selectPlan)==null||s.call(o,u);break;case"stopSession":(c=(a=this.client)==null?void 0:a.stopSession)==null||c.call(a);break;case"say":this.say(i);break;default:console.warn("[obi] unknown command",{commandType:t,args:i})}},e&&this.createClient(e),this.parsePassiveParams()}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const i=this.load();if(i)try{t=Eu.deserialise(i,e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)}),this._resumed=!0}catch(r){console.error("[obi] error loading cached client",r)}t||(t=new Eu(e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",r=>{var o,s,a,c,u,l,d,h,p;r==="ready"&&this.updateConfig({isActive:(o=this.client)==null?void 0:o.showWidget,primaryColour:((a=(s=this.client)==null?void 0:s.product)==null?void 0:a.primary_color)||"#9500FF",widgetDisplay:((c=window==null?void 0:window.obiWidgetConfig)==null?void 0:c.widgetDisplay)||((l=(u=this.client)==null?void 0:u.product)==null?void 0:l.widget_display)||"regular",completedWidgetDisplay:((d=window==null?void 0:window.obiWidgetConfig)==null?void 0:d.completedWidgetDisplay)||((p=(h=this.client)==null?void 0:h.product)==null?void 0:p.completed_widget_display)||"regular"})}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",r=>{r==="invalid-room"&&localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(r,o)=>{Se().track(r,o)}),this.client.session&&this.client.resumeSession(r=>{r.on("stateChanged",o=>{o!=="disconnecting"&&o!=="disconnected"&&o!=="error"&&o!=="connecting"&&this.save()}),r.on("paused",()=>{this.save()}),r.on("unpaused",()=>{this.save()})})}async initialise(e={}){this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised"),this.dispatchCommandQueue()}).catch(t=>{console.error("[obi] error initialising client",t),this.emit("error",t)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),this.updateWidgetDisplay(e.widgetDisplay),this.updateCompletedWidgetDisplay(e.completedWidgetDisplay),this.updateWidgetPosition(e.widgetPosition),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}updateWidgetDisplay(e){e===void 0||e==this.widgetDisplay||(this.widgetDisplay=e)}updateCompletedWidgetDisplay(e){e===void 0||e==this.completedWidgetDisplay||(this.completedWidgetDisplay=e)}updateWidgetPosition(e){e===void 0||e==this.widgetPosition||(this.widgetPosition=e)}async updateIdentity(e){var i;if(e===void 0||e==((i=this.client)==null?void 0:i.identity))return;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(r=>{console.error("[obi] error initialising client",r),this.emit("error",r)}),e!=null&&e.email&&Se().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,i,r;await((r=(i=(t=this.client)==null?void 0:t.session)==null?void 0:i.say)==null?void 0:r.call(i,e))}async startSession(){await this.client.startSession(this.client.selectedPlan.uuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(i){console.error("[obi] error dispatching command",i)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(ww)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((o,s)=>{e[s]=o});const t=e[Sw];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(Sw),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(ww),this.passivePlanUuid=t}mountWidget(){n4(this)}async captureScreen(){try{await E5(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await K5(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.css_line_breaks))}catch(e){throw console.error("[obi] error initialising unicode trie",e),e}try{return(await bD(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}catch(e){throw console.error("[obi] error capturing screen",e),e}}save(){var e;localStorage.setItem("obi-client",((e=this.client)==null?void 0:e.serialise())||"")}load(){return localStorage.getItem("obi-client")}}async function Cw(n){let e;try{e=window}catch{console.warn("[obi] no window object found"),e={}}return o4({appToken:n,window:e})}async function o4({appToken:n,window:e}){var r,o;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}n||(n=(r=e==null?void 0:e.obiWidgetConfig)==null?void 0:r.apiKey);let t;try{t=((o=e.ObiSDK)==null?void 0:o.q)||[]}catch{t=[]}const i=new r4(n);return e.ObiSDK=i.dispatchCommand,await i.initialise({queuedCommands:t}),e.obi=i,i.mountWidget(),i}UC(NP("d37cde23ca4b5d8c7ed30653f07f9e47")),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Cw()}):Cw()})();
121
+ `;function X5(n){let e=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function J5(n,e){if(!e||e.length===0)return!1;const t=n.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(i=>{try{const r=X5(i);return r.test(t)||r.test(n)}catch(r){return console.warn(`Invalid URL pattern: ${i}`,r),!1}})}function uf(n){if(!n||n.length===0)return!1;const e=window.location.origin+window.location.pathname;return J5(e,n)}function Z5(n){var C,x,I,P,D,O,L,j,X,W;const[e,t]=de(!1),[i,r]=de(!1),[o,s]=de(null),a=Q5(n.sdk,c,n.shadowHost,s);function c(A){var H;(H=a.client)!=null&&H.session||(t(A),A&&be().track("course-list-opened"))}if(!a.client)return null;const u=a.client.planIsCompleted.filter(Boolean).length===a.client.plans.length,l=e4((C=a.client.product)==null?void 0:C.widget_url_blacklist),d=u?a.completedWidgetDisplay||((x=a.client.product)==null?void 0:x.completed_widget_display):a.widgetDisplay||((I=a.client.product)==null?void 0:I.widget_display),h=a.widgetPosition||((P=a.client.product)==null?void 0:P.widget_position);let p=a.isActive;((O=(D=a.client)==null?void 0:D.product)==null?void 0:O.name)==="Canibuild"&&(p=!0);const m=a.client.session,f=!!m,g=f&&!e;let y;switch(m==null?void 0:m.speakingState){case"listening":y="user-speaking";break;case"speaking":y="agent-speaking";break;case"thinking":y="thinking";break;case"busy":y="busy";break}const b=m==null?void 0:m.isPaused,S=f||a.client.state==="ready"&&p&&!l&&(a.client.selectedPlan||!((L=a.client.product)!=null&&L.widget_link_only_access))&&(d!=="invisible"||a.client.selectedPlan),w=()=>{var A,H,Y,J,ve,Me;return{name:(A=a.client.selectedPlan)==null?void 0:A.name,description:(H=a.client.selectedPlan)==null?void 0:H.description,appName:(Y=a.client.product)==null?void 0:Y.name,appLogoUrl:((J=a.client.product)==null?void 0:J.logo_url)||"",url:(ve=a.client.product)==null?void 0:ve.url,agentName:((Me=a.client.product)==null?void 0:Me.agent_name)||"Obi"}},k=h==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};return g?k.top="calc(100vh - 100px)":k.bottom="20px",_("div",{children:[e&&_(NC,{open:e,courses:a.client.plans.map((A,H)=>{var Y,J;return{id:A.uuid,name:A.name,description:A.description||"",duration:A.duration||0,completed:((J=(Y=a.client)==null?void 0:Y.planIsCompleted)==null?void 0:J[H])||!1}}),loading:!1,agentName:((j=a.client.product)==null?void 0:j.agent_name)||"Obi",productName:((X=a.client.product)==null?void 0:X.name)||"",onCourseHighlight:A=>{A&&be().track("course-selected",{courseName:A.name,courseUuid:A.id})},onCourseSelect:A=>{const H=a.client.plans.find(Y=>Y.uuid===A.id)||null;H&&(H==null?void 0:H.uuid)!==a.client.selectedPlanUuid&&(a.client.selectPlan(H),t(!1),r(!0),be().track("course-get-started",{courseName:A.name,courseUuid:A.id}))},onClose:A=>{A==="user-initiated"&&a.client.selectPlan(null),t(!1)}}),S&&_(St,{children:[_("div",{style:k,children:_(mC,{inPlan:f,isActive:i?!1:void 0,defaultIsActive:d!=="minimized",isPaused:b,messaging:(m==null?void 0:m.isMicShared)===!1?!0:void 0,speakingStatus:y,spectrum:()=>(m==null?void 0:m.audioSpectrum())||null,courseProgress:o,onOpen:()=>{t(!0),be().track("course-list-opened")},onCancelClick:()=>{be().track("close-button-clicked")},onCancelAbort:()=>{be().track("close-confirmation-no")},onCancel:()=>{var A;(A=a.client.session)==null||A.stop(),be().track("close-confirmation-yes")},onCancelReason:(A,H)=>{be().track("close-survey-answered",{reason:A,reasonText:H})},onPause:()=>{var A,H;(H=(A=a.client.session)==null?void 0:A.pause)==null||H.call(A),be().track("pause-button-clicked")},onUnpause:()=>{var A,H;(H=(A=a.client.session)==null?void 0:A.unpause)==null||H.call(A),be().track("play-button-clicked")},onMessagingChange:A=>{var H,Y,J,ve;A?((Y=(H=a.client.session)==null?void 0:H.muteMicrophone)==null||Y.call(H),be().track("switch-to-chat-clicked")):((ve=(J=a.client.session)==null?void 0:J.unmuteMicrophone)==null||ve.call(J),be().track("switch-to-voice-clicked"))},onMessageChange:A=>{be().track("chat-input-provided",{message:A,length:A.length})},onMessage:A=>{a.say(A),be().track("chat-message-sent",{message:A,length:A.length})},onHover:A=>{A&&!f&&be().track("widget-hover-on")},onOneClickAction:A=>{be().track("one-click-action-clicked",{action:A})},onMinimize:()=>{be().track("minimise-button-clicked",{inSession:f})},agentName:((W=a.client.product)==null?void 0:W.agent_name)||"Obi",completedTutorials:a.client.planIsCompleted.filter(Boolean).length,totalTutorials:a.client.plans.length})}),!!a.client.selectedPlan&&_(LC,{open:!0,session:w(),sessionState:(m==null?void 0:m.state)||null,speakingState:(m==null?void 0:m.speakingState)||null,spectrum:()=>(m==null?void 0:m.audioSpectrum())||null,onModalChange:A=>{A==="session-start"?be().track("course-screen-opened"):A==="voice-guidance"?be().track("can-you-hear-opened"):A==="overview"?be().track("welcome-tour-opened"):A==="share-mic"&&be().track("connect-mic-opened")},onClose:(A,H)=>{var Y,J;A==="user-initiated"&&(H==="session-start"?be().track("course-screen-closed"):H==="voice-guidance"?be().track("can-you-hear-closed"):H==="overview"?be().track("welcome-tour-closed"):H==="share-mic"&&be().track("connect-mic-closed"),((Y=a.client.session)==null?void 0:Y.state)==="mic-share"?(J=a.client.session)==null||J.shareMicrophoneFailed():a.client.stopSession()),r(!1)},onStart:()=>{a.client.selectedPlanUuid&&(be().track("course-screen-continue"),a.startSession())},onContinue:()=>{m==null||m.continue(),be().track("can-you-hear-continue")},onShareMicrophone:()=>{m==null||m.shareMicrophone(),be().track("connect-mic-continue")}})]})]})}function Q5(n,e,t,i){const[r,o]=de(0),[s,a]=de(null);return Dt(()=>{n.on("showMenu",c=>{e(c)}),n.on("configUpdated",()=>{o(c=>c+1)})},[n]),Dt(()=>{n.client&&(n.client.session&&a(n.client.session),n.client.on("sessionStarted",c=>{a(c),o(u=>u+1)}),n.client.on("sessionStopped",()=>{a(null),o(c=>c+1)}),n.client.on("sessionShutdown",()=>{o(c=>c+1)}),n.client.on("sessionResumed",()=>{o(c=>c+1)}),n.client.on("stateChanged",()=>{var c;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((c=n.client.product)==null?void 0:c.primary_color)||"#9500FF"),o(u=>u+1)}),n.client.on("planSelected",()=>{o(c=>c+1)}))},[n,n.client]),Dt(()=>{if(!s)return;s.on("stateChanged",()=>{o(u=>u+1)}),s.on("speakingStateChanged",()=>{o(u=>u+1)}),s.on("paused",()=>{o(u=>u+1)}),s.on("unpaused",()=>{o(u=>u+1)}),s.on("micCheckComplete",u=>{u?be().track("mic-check-granted"):be().track("mic-check-denied")});const c=u=>{i(u)};return s.on&&s.on("courseProgress",c),()=>{s.off&&s.off("courseProgress",c)}},[s]),n}function e4(n){const[e,t]=de(()=>uf(n));return Dt(()=>{t(uf(n))},[n]),Dt(()=>{t4();const i=()=>{t(uf(n))};return window.addEventListener("locationchange",i),window.addEventListener("popstate",i),window.addEventListener("hashchange",i),()=>{window.removeEventListener("locationchange",i),window.removeEventListener("popstate",i),window.removeEventListener("hashchange",i)}},[n]),e}function t4(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,i=r=>function(...o){const s=r.apply(this,o);return window.dispatchEvent(new Event("locationchange")),s};window.history.pushState=i(e),window.history.replaceState=i(t),n.__obi_history_patched=!0}function n4(n){if(document.querySelector("obi-widget"))return;i4();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),i=document.createElement("div");i.id="obi-container",t.appendChild(i);const r=new CSSStyleSheet;r.replaceSync(Y5),t.adoptedStyleSheets=[r],Dw(_(Z5,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function i4(){kw("https://fonts.cdnfonts.com/css/satoshi"),kw("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function kw(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const Sw="49206C6F7665204F6269_session",ww="obi-url-params";class r4 extends nh{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandQueue=[],this._resumed=!1,this.dispatchCommand=(t,i)=>{var r,o,s,a,c;switch(t){case"update":this.updateConfig(i);break;case"startSession":if(!(i!=null&&i.planUuid)){console.warn("[obi] startSession command requires a planUuid",i);return}const u=(((r=this.client)==null?void 0:r.plans)||[]).find(l=>l.uuid===i.planUuid)||null;if(!u){console.warn("[obi] startSession command requires a valid planUuid",i);return}this.updateActive(!0),(s=(o=this.client)==null?void 0:o.selectPlan)==null||s.call(o,u);break;case"stopSession":(c=(a=this.client)==null?void 0:a.stopSession)==null||c.call(a);break;case"say":this.say(i);break;default:console.warn("[obi] unknown command",{commandType:t,args:i})}},e&&this.createClient(e),this.parsePassiveParams()}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const i=this.load();if(i)try{t=Eu.deserialise(i,e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)}),this._resumed=!0}catch(r){console.error("[obi] error loading cached client",r)}t||(t=new Eu(e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",r=>{var o,s,a,c,u,l,d,h,p;r==="ready"&&this.updateConfig({isActive:(o=this.client)==null?void 0:o.showWidget,primaryColour:((a=(s=this.client)==null?void 0:s.product)==null?void 0:a.primary_color)||"#9500FF",widgetDisplay:((c=window==null?void 0:window.obiWidgetConfig)==null?void 0:c.widgetDisplay)||((l=(u=this.client)==null?void 0:u.product)==null?void 0:l.widget_display)||"regular",completedWidgetDisplay:((d=window==null?void 0:window.obiWidgetConfig)==null?void 0:d.completedWidgetDisplay)||((p=(h=this.client)==null?void 0:h.product)==null?void 0:p.completed_widget_display)||"regular"})}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",r=>{r==="invalid-room"&&localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(r,o)=>{be().track(r,o)}),this.client.session&&this.client.resumeSession(r=>{r.on("stateChanged",o=>{o!=="disconnecting"&&o!=="disconnected"&&o!=="error"&&o!=="connecting"&&this.save()}),r.on("paused",()=>{this.save()}),r.on("unpaused",()=>{this.save()})})}async initialise(e={}){this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised"),this.dispatchCommandQueue()}).catch(t=>{console.error("[obi] error initialising client",t),this.emit("error",t)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),this.updateWidgetDisplay(e.widgetDisplay),this.updateCompletedWidgetDisplay(e.completedWidgetDisplay),this.updateWidgetPosition(e.widgetPosition),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}updateWidgetDisplay(e){e===void 0||e==this.widgetDisplay||(this.widgetDisplay=e)}updateCompletedWidgetDisplay(e){e===void 0||e==this.completedWidgetDisplay||(this.completedWidgetDisplay=e)}updateWidgetPosition(e){e===void 0||e==this.widgetPosition||(this.widgetPosition=e)}async updateIdentity(e){var i;if(e===void 0||e==((i=this.client)==null?void 0:i.identity))return;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(r=>{console.error("[obi] error initialising client",r),this.emit("error",r)}),e!=null&&e.email&&be().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,i,r;await((r=(i=(t=this.client)==null?void 0:t.session)==null?void 0:i.say)==null?void 0:r.call(i,e))}async startSession(){await this.client.startSession(this.client.selectedPlan.uuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(i){console.error("[obi] error dispatching command",i)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(ww)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((o,s)=>{e[s]=o});const t=e[Sw];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(Sw),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(ww),this.passivePlanUuid=t}mountWidget(){n4(this)}async captureScreen(){try{await E5(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await K5(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.css_line_breaks))}catch(e){throw console.error("[obi] error initialising unicode trie",e),e}try{return(await bD(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}catch(e){throw console.error("[obi] error capturing screen",e),e}}save(){var e;localStorage.setItem("obi-client",((e=this.client)==null?void 0:e.serialise())||"")}load(){return localStorage.getItem("obi-client")}}async function Cw(n){let e;try{e=window}catch{console.warn("[obi] no window object found"),e={}}return o4({appToken:n,window:e})}async function o4({appToken:n,window:e}){var r,o;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}n||(n=(r=e==null?void 0:e.obiWidgetConfig)==null?void 0:r.apiKey);let t;try{t=((o=e.ObiSDK)==null?void 0:o.q)||[]}catch{t=[]}const i=new r4(n);return e.ObiSDK=i.dispatchCommand,await i.initialise({queuedCommands:t}),e.obi=i,i.mountWidget(),i}UC(NP("d37cde23ca4b5d8c7ed30653f07f9e47")),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Cw()}):Cw()})();