@syntrologie/runtime-sdk 2.15.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SmartCanvasApp.d.ts +4 -1
- package/dist/api.d.ts +3 -0
- package/dist/bootstrap-init.d.ts +2 -0
- package/dist/{chunk-CVMZW3II.js → chunk-NVV7IWJC.js} +330 -24
- package/dist/{chunk-CVMZW3II.js.map → chunk-NVV7IWJC.js.map} +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +75 -1
- package/dist/index.js.map +4 -4
- package/dist/platform/PlatformAdapter.d.ts +46 -0
- package/dist/platform/ShopifyAdapter.d.ts +36 -0
- package/dist/platform/ShopifyAnchorResolver.d.ts +31 -0
- package/dist/platform/ShopifyAntiFlicker.d.ts +21 -0
- package/dist/platform/ShopifyPixelBridge.d.ts +37 -0
- package/dist/platform/detect.d.ts +9 -0
- package/dist/platform/index.d.ts +10 -0
- package/dist/platform/shopify-cookie-contract.d.ts +39 -0
- package/dist/react.js +1 -1
- package/dist/shopify-pixel-entry.d.ts +68 -0
- package/dist/shopify-pixel.js +77 -0
- package/dist/shopify-pixel.js.map +7 -0
- package/dist/shopify-pixel.min.js +2 -0
- package/dist/shopify-pixel.min.js.map +7 -0
- package/dist/smart-canvas.esm.js +135 -135
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +288 -10
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +135 -135
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/smart-canvas.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var K0=Object.create;var Zo=Object.defineProperty;var Y0=Object.getOwnPropertyDescriptor;var X0=Object.getOwnPropertyNames;var Q0=Object.getPrototypeOf,J0=Object.prototype.hasOwnProperty;var ff=n=>{throw TypeError(n)};var ex=(n,e,t)=>e in n?Zo(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var fc=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),tx=(n,e)=>{for(var t in e)Zo(n,t,{get:e[t],enumerable:!0})},nx=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of X0(e))!J0.call(n,i)&&i!==t&&Zo(n,i,{get:()=>e[i],enumerable:!(r=Y0(e,i))||r.enumerable});return n};var Wr=(n,e,t)=>(t=n!=null?K0(Q0(n)):{},nx(e||!n||!n.__esModule?Zo(t,"default",{value:n,enumerable:!0}):t,n));var me=(n,e,t)=>ex(n,typeof e!="symbol"?e+"":e,t),gc=(n,e,t)=>e.has(n)||ff("Cannot "+t);var $=(n,e,t)=>(gc(n,e,"read from private field"),t?t.call(n):e.get(n)),ee=(n,e,t)=>e.has(n)?ff("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),K=(n,e,t,r)=>(gc(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),te=(n,e,t)=>(gc(n,e,"access private method"),t);var mc=(n,e,t,r)=>({set _(i){K(n,e,i,t)},get _(){return $(n,e,r)}});var Tc=fc((I2,lg)=>{var Xx=function(){return null},Qx={get:function(n,e){return Xx}};lg.exports=new Proxy({__esModule:!0,default:{}},Qx)});var Ic=fc(($2,cg)=>{var Jx=function(){return null},ew={get:function(n,e){return Jx}};cg.exports=new Proxy({__esModule:!0,default:{}},ew)});var $c=fc((M2,ug)=>{var tw=function(){return null},nw={get:function(n,e){return tw}};ug.exports=new Proxy({__esModule:!0,default:{}},nw)});function gf(n,e,t,r){let i=r?.maxRetries??3,s=r?.debounceMs??50,o=n.parentElement??e.parentElement;if(!o)return()=>{};let a=0,l=null,c=!1,u=new MutationObserver(d=>{if(!c){for(let h of d)for(let g of h.removedNodes)if(g===n){if(a>=i){u.disconnect(),c=!0;return}l&&clearTimeout(l),l=setTimeout(()=>{if(!c){if(!e.isConnected){u.disconnect(),c=!0;return}a++;try{t()}catch{u.disconnect(),c=!0}}},s);return}}});return u.observe(o,{childList:!0,subtree:!0}),()=>{c=!0,u.disconnect(),l&&clearTimeout(l)}}var rx=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button","svg","path","circle","line","polyline","polygon","rect","g"]);function vc(n){if(typeof window.Sanitizer=="function")try{let l=new window.Sanitizer({}).sanitizeToFragment(n),c=document.createElement("div");return c.append(l),c.innerHTML}catch{}let t=document.createElement("template");t.innerHTML=n;let r=t.content,i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,null),s=[];for(;i.nextNode();){let a=i.currentNode,l=a.tagName.toLowerCase();if(!rx.has(l)){s.push(a);continue}for(let c of Array.from(a.attributes)){let u=c.name.toLowerCase(),d=c.value.trim().toLowerCase(),h=u.startsWith("on"),v=(u==="href"||u==="src"||u==="formaction")&&(d.startsWith("javascript:")||d.startsWith("vbscript:")||d.startsWith("data:text/html"));(h||v)&&a.removeAttribute(c.name)}}let o=Array.from(r.querySelectorAll("svg"));for(let a of o)s.some(l=>a.contains(l)&&l.tagName.toLowerCase()==="script")&&s.push(a);for(let a of s){for(;a.firstChild;)a.parentNode?.insertBefore(a.firstChild,a);a.remove()}return t.innerHTML}var mf=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=vc(n.html),i="data-syntro-insert-label",s=n.label;if(s){let d=CSS.escape(s),g=(t.parentElement??t).querySelector(`[${i}="${d}"]`);g&&g.remove()}let o=document.createElement("div");o.setAttribute("data-syntro-action-id",e.generateId()),s&&o.setAttribute(i,s),o.innerHTML=r;let a=null;switch(n.position){case"before":t.insertAdjacentElement("beforebegin",o);break;case"after":t.insertAdjacentElement("afterend",o);break;case"prepend":t.insertBefore(o,t.firstChild);break;case"append":t.appendChild(o);break;case"replace":a=t.innerHTML,t.replaceWith(o);break}let l=null;if(n.deepLink){let{tileId:d,itemId:h}=n.deepLink;l=()=>{let g=window.SynOS?.handle;g&&(g.open(),g.runtime?.events?.publish("notification.deep_link",{tileId:d,itemId:h}))},o.style.cursor="pointer",o.addEventListener("click",l)}e.publishEvent("action.applied",{id:e.generateId(),kind:"content:insertHtml",anchorId:n.anchorId,position:n.position});let u=gf(o,t,()=>{switch(n.position){case"before":t.insertAdjacentElement("beforebegin",o);break;case"after":t.insertAdjacentElement("afterend",o);break;case"prepend":t.insertBefore(o,t.firstChild);break;case"append":t.appendChild(o);break;case"replace":break}});return{cleanup:()=>{if(l&&o.removeEventListener("click",l),u(),!!o.isConnected)try{if(n.position==="replace"&&a!==null){let d=document.createElement(t.tagName);d.innerHTML=a,Array.from(t.attributes).forEach(h=>{d.setAttribute(h.name,h.value)}),o.replaceWith(d)}else o.remove()}catch{}},updateFn:d=>{"html"in d&&typeof d.html=="string"&&(o.innerHTML=vc(d.html))}}};function vf(n){if(n.children.length===0)return n;let e=Array.from(n.children).filter(t=>t.textContent?.trim());if(e.length===1){let t=e[0];if(t.textContent?.trim()===n.textContent?.trim())return vf(t)}return n}var yf=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=vf(t),i=r.textContent??"";return r.textContent=n.text,e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setText",anchorId:n.anchorId}),{cleanup:()=>{t.isConnected&&(r.textContent=i)},updateFn:s=>{"text"in s&&typeof s.text=="string"&&(r.textContent=s.text)}}},bf=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=n.attr.toLowerCase();if(r.startsWith("on"))throw new Error(`Dangerous attribute not allowed: ${n.attr}`);if(r==="href"||r==="src"||r==="formaction"){let a=n.value.trim().toLowerCase();if(a.startsWith("javascript:")||a.startsWith("vbscript:")||a.startsWith("data:text/html"))throw new Error(`Dangerous URL not allowed in ${n.attr}: ${n.value}`)}let s=t.getAttribute(n.attr),o=t.hasAttribute(n.attr);return t.setAttribute(n.attr,n.value),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setAttr",anchorId:n.anchorId,attr:n.attr}),{cleanup:()=>{t.isConnected&&(o&&s!==null?t.setAttribute(n.attr,s):t.removeAttribute(n.attr))},updateFn:a=>{"value"in a&&typeof a.value=="string"&&t.setAttribute(n.attr,a.value)}}},_f=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=t.classList.contains(n.className);return t.classList.add(n.className),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:addClass",anchorId:n.anchorId,className:n.className}),{cleanup:()=>{t.isConnected&&(r||t.classList.remove(n.className))}}},xf=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=t.classList.contains(n.className);return t.classList.remove(n.className),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:removeClass",anchorId:n.anchorId,className:n.className}),{cleanup:()=>{t.isConnected&&r&&t.classList.add(n.className)}}},wf=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=new Map;for(let i of Object.keys(n.styles)){let s=t.style.getPropertyValue(i);r.set(i,s)}for(let[i,s]of Object.entries(n.styles))t.style.setProperty(i,s);return e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setStyle",anchorId:n.anchorId,styles:Object.keys(n.styles)}),{cleanup:()=>{if(t.isConnected)for(let[i,s]of r)s?t.style.setProperty(i,s):t.style.removeProperty(i)},updateFn:i=>{if("styles"in i&&typeof i.styles=="object"&&i.styles)for(let[s,o]of Object.entries(i.styles))t.style.setProperty(s,o)}}},yc=[{kind:"content:insertHtml",executor:mf},{kind:"content:setText",executor:yf},{kind:"content:setAttr",executor:bf},{kind:"content:addClass",executor:_f},{kind:"content:removeClass",executor:xf},{kind:"content:setStyle",executor:wf}],bc={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:yc};var ix={light:50,medium:100,heavy:200},sx=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],kf={init(n,e,t){let r=ix[t.intensity],i=t.colors.length>0?t.colors:sx,s=[];for(let o=0;o<r;o++)s.push({x:Math.random()*n,y:Math.random()*-e*.3,vx:(Math.random()-.5)*4,vy:Math.random()*2+1,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.2,size:Math.random()*6+4,color:i[Math.floor(Math.random()*i.length)],opacity:1,shape:Math.random()>.5?"rect":"circle"});return s},update(n,e,t){let r=!1;for(let i of n)i.vy+=.15,i.vx*=.99,i.x+=i.vx,i.y+=i.vy,i.rotation+=i.rotationSpeed,i.y>0&&i.opacity>0&&i.y>500&&(i.opacity-=.02,i.opacity<0&&(i.opacity=0)),i.opacity>.01&&(r=!0);return r},render(n,e){for(let t of e)t.opacity<.01||(n.save(),n.globalAlpha=t.opacity,n.fillStyle=t.color,n.translate(t.x,t.y),n.rotate(t.rotation),t.shape==="circle"?(n.beginPath(),n.arc(0,0,t.size/2,0,Math.PI*2),n.fill()):n.fillRect(-t.size/2,-t.size/2,t.size,t.size*.6),n.restore())}};var ox={light:20,medium:40,heavy:80},ax="\u{1F389}",Sf={init(n,e,t){let r=ox[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:ax,s=[];for(let o=0;o<r;o++)s.push({x:Math.random()*n,y:Math.random()*-200,vx:0,vy:Math.random()*1.5+1,rotation:0,rotationSpeed:0,size:Math.random()*12+16,color:"#000000",opacity:1,shape:"emoji",emoji:i,data:{wobblePhase:Math.random()*Math.PI*2,wobbleAmp:Math.random()*1.5+.5,originX:0}});for(let o of s)o.data&&(o.data.originX=o.x);return s},update(n,e,t){let r=!1;for(let i of n){i.y+=i.vy;let s=i.data?.wobblePhase??0,o=i.data?.wobbleAmp??1,a=i.data?.originX??i.x;i.x=a+Math.sin(t*.003+s)*o*20,i.y>600&&(i.opacity-=.02,i.opacity<0&&(i.opacity=0)),i.opacity>.01&&(r=!0)}return r},render(n,e){for(let t of e)t.opacity<.01||!t.emoji||(n.save(),n.globalAlpha=t.opacity,n.font=`${t.size}px serif`,n.textAlign="center",n.textBaseline="middle",n.fillText(t.emoji,t.x,t.y),n.restore())}};var lx={light:20,medium:40,heavy:80},cx={light:3,medium:4,heavy:5},Ef={init(n,e,t){let r=lx[t.intensity],i=cx[t.intensity],s=t.colors.length>0?t.colors:["#ff4444","#44ff44","#4444ff"],o=[];for(let a=0;a<i;a++){let l=Math.random()*n*.8+n*.1,c=Math.random()*e*.6,u=s[Math.floor(Math.random()*s.length)];for(let d=0;d<r;d++){let h=Math.PI*2*d/r+(Math.random()-.5)*.3,g=Math.random()*3+2;o.push({x:l,y:c,vx:Math.cos(h)*g,vy:Math.sin(h)*g,rotation:0,rotationSpeed:0,size:Math.random()*3+2,color:u,opacity:1,shape:"circle",data:{centerX:l,centerY:c}})}}return o},update(n,e,t){let r=!1;for(let i of n)i.vx*=.97,i.vy*=.97,i.vy+=.03,i.x+=i.vx,i.y+=i.vy,i.opacity-=.008,i.opacity<0&&(i.opacity=0),i.opacity>.01&&(r=!0);return r},render(n,e){for(let t of e)t.opacity<.01||(n.save(),n.globalAlpha=t.opacity,n.fillStyle=t.color,n.shadowBlur=12,n.shadowColor=t.color,n.beginPath(),n.arc(t.x,t.y,t.size,0,Math.PI*2),n.fill(),n.restore())}};var ux={light:30,medium:60,heavy:120},Cf={init(n,e,t){let r=ux[t.intensity],i=t.colors.length>0?t.colors:["#ffd700","#ffffff","#fffacd"],s=[];for(let o=0;o<r;o++)s.push({x:Math.random()*n,y:Math.random()*e,vx:(Math.random()-.5)*.3,vy:-(Math.random()*.5+.2),rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.1,size:Math.random()*4+2,color:i[Math.floor(Math.random()*i.length)],opacity:Math.random()*.5+.5,shape:"circle",data:{phase:Math.random()*Math.PI*2,baseOpacity:Math.random()*.5+.5}});return s},update(n,e,t){let r=!1;for(let i of n){i.x+=i.vx,i.y+=i.vy,i.rotation+=i.rotationSpeed,i.data&&(i.data.baseOpacity=(i.data.baseOpacity??1)-.001,i.data.baseOpacity<0&&(i.data.baseOpacity=0));let s=i.data?.phase??0,o=i.data?.baseOpacity??1;if(o<=.01)i.opacity=0;else{let a=Math.sin(t*.005+s)*.4+.6;i.opacity=o*a}i.opacity>.01&&(r=!0)}return r},render(n,e){for(let t of e){if(t.opacity<.01)continue;n.save(),n.globalAlpha=t.opacity,n.fillStyle=t.color,n.translate(t.x,t.y),n.rotate(t.rotation);let r=t.size;n.beginPath(),n.moveTo(0,-r),n.lineTo(r*.3,-r*.3),n.lineTo(r,0),n.lineTo(r*.3,r*.3),n.lineTo(0,r),n.lineTo(-r*.3,r*.3),n.lineTo(-r,0),n.lineTo(-r*.3,-r*.3),n.closePath(),n.fill(),n.restore()}}};var Go=class{constructor(){this.canvas=null,this.ctx=null,this.rafId=null,this.particles=[],this.startTime=0,this.lastFrame=0,this.duration=0,this.effect=null,this.container=null}start(e,t,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;this.container=e,this.effect=t,this.duration=r.duration;let s=document.createElement("canvas");s.setAttribute("data-syntro-celebrate",""),Object.assign(s.style,{position:"fixed",inset:"0",pointerEvents:"none",zIndex:"2147483646"});let o=window.devicePixelRatio||1,a=window.innerWidth,l=window.innerHeight;s.width=a*o,s.height=l*o,s.style.width=`${a}px`,s.style.height=`${l}px`;let c=s.getContext("2d");c&&(c.scale(o,o),this.canvas=s,this.ctx=c,e.appendChild(s),this.particles=t.init(a,l,r),this.startTime=performance.now(),this.lastFrame=this.startTime,this.tick=this.tick.bind(this),this.rafId=requestAnimationFrame(this.tick))}stop(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas&&this.container&&(this.canvas.remove(),this.canvas=null),this.ctx=null,this.effect=null,this.container=null,this.particles=[]}tick(e){if(!this.ctx||!this.canvas||!this.effect)return;let t=e-this.startTime,r=e-this.lastFrame;if(this.lastFrame=e,t>=this.duration){this.stop();return}let i=this.canvas.width/(window.devicePixelRatio||1),s=this.canvas.height/(window.devicePixelRatio||1);if(this.ctx.clearRect(0,0,i,s),!this.effect.update(this.particles,r,t)){this.stop();return}this.effect.render(this.ctx,this.particles),this.rafId=requestAnimationFrame(this.tick)}};var dx=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function px(n,e){return[n,e,`${n}cc`,`${e}cc`,"#ffffff",`${n}80`]}function hx(n){try{let e=getComputedStyle(n),t=e.getPropertyValue("--sc-color-primary")?.trim(),r=e.getPropertyValue("--sc-color-primary-hover")?.trim();if(t?.startsWith("#")&&t.length>=7)return px(t,r||t)}catch{}return null}var Af=new Map([["confetti",kf],["fireworks",Ef],["sparkles",Cf],["emoji-rain",Sf]]),Rf=async(n,e)=>{let t=Af.get(n.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${n.effect}". Available: ${[...Af.keys()].join(", ")}`),{cleanup:()=>{}};let r=n.colors??hx(e.overlayRoot)??dx,i={duration:n.duration??3e3,intensity:n.intensity??"medium",colors:r,props:n.props},s=new Go;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:n.effect}),{cleanup:()=>{s.stop()}}};var xc="syntro_active_tour",Ko=new Map;function fx(n){try{let e=localStorage.getItem(xc);if(!e)return null;let t=JSON.parse(e);return t.tourId!==n?null:t}catch{return null}}function _c(n){try{localStorage.setItem(xc,JSON.stringify(n))}catch{}}function gx(){try{localStorage.removeItem(xc)}catch{}}function Yi(){return window.location.pathname}function mx(n){if(!n.route)return!0;let e=Yi();return n.route.includes("*")?new RegExp(`^${n.route.replace(/\*/g,".*")}$`).test(e):e===n.route}var wc=async(n,e)=>{let{tourId:t,steps:r,startStep:i,autoStart:s=!0}=n;if(r.length===0)throw new Error(`Tour "${t}" has no steps`);if(Ko.has(t))return{cleanup:async()=>{let _=Ko.get(t);_&&await _.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=fx(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||r[0].id,startedAt:Date.now()},_c(o));let l=r.findIndex(_=>_.id===o.currentStepId);if(l===-1){let _=i||r[0].id;l=r.findIndex(b=>b.id===_),l===-1&&(l=0),o.currentStepId=r[l].id,_c(o)}let c=r[l];if(!mx(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:Yi()}),{cleanup:()=>{}};let u=!1,d=null,h=null,g=null,v=async()=>{h&&(h(),h=null),d?.isApplied()&&(await d.revert(),d=null)},f=async _=>{if(u)return;if(await v(),_==="end"){gx(),e.publishEvent("tour.completed",{tourId:t,totalSteps:r.length}),u=!0;return}let b=r.find(w=>w.id===_);if(!b){console.error(`[Tour] Step "${_}" not found`);return}if(o.currentStepId=_,_c(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:_}),b.route&&b.route!==Yi()){e.publishEvent("tour.awaiting_navigation",{tourId:t,stepId:_,targetRoute:b.route});return}await m(b)},m=async _=>{if(!u){e.publishEvent("tour.step_started",{tourId:t,stepId:_.id,stepIndex:r.findIndex(b=>b.id===_.id),totalSteps:r.length});try{d=await e.applyAction(_.action)}catch(b){console.error(`[Tour] Failed to execute step "${_.id}":`,b),e.publishEvent("tour.step_failed",{tourId:t,stepId:_.id,error:String(b)});return}if(_.onAction&&e.subscribeEvent){h=e.subscribeEvent("action.modal_cta_clicked",E=>{let x=E?.actionId;if(x&&_.onAction){let R=_.onAction[x];R&&f(R)}});let b=e.subscribeEvent("action.tooltip_cta_clicked",E=>{let x=E?.actionId;if(x&&_.onAction){let R=_.onAction[x];R&&f(R)}}),w=h;h=()=>{w(),b()}}}};g=(()=>{let _=Yi(),b=()=>{let x=Yi();x!==_&&(_=x,e.publishEvent("tour.route_changed",{tourId:t,newRoute:x}))};if(e.subscribeNavigation)return e.subscribeNavigation(()=>b());window.addEventListener("popstate",b);let w=history.pushState.bind(history),E=history.replaceState.bind(history);return history.pushState=(...x)=>{w(...x),queueMicrotask(b)},history.replaceState=(...x)=>{E(...x),queueMicrotask(b)},()=>{window.removeEventListener("popstate",b),history.pushState=w,history.replaceState=E}})(),a?e.publishEvent("tour.resumed",{tourId:t,stepId:o.currentStepId}):e.publishEvent("tour.started",{tourId:t,totalSteps:r.length,startStepId:o.currentStepId}),await m(c);let k=async()=>{u=!0,Ko.delete(t),await v(),g&&g(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return Ko.set(t,{cleanup:k}),{cleanup:k}};var Ct={white:"#ffffff",black:"#000000"},ie={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},S={0:"#07080a",1:"#0f1318",2:"#0e1114",3:"#1c222a",4:"#2b333f",5:"#394454",6:"#475569",7:"#677384",8:"#87919f",9:"#a8afba",10:"#cbd0d7",11:"#e8eaee",12:"#f6f7f9"},ye={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},De={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},Ae={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},qe={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},Xi={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},Ke={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},Qi={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"};var ot={primary:S[10],secondary:S[9],tertiary:S[8]},CT={primary:S[2],secondary:S[0]},kc={primary:S[4],secondary:S[3]},Yo={primary:{text:Ct.white,icon:Ct.white,border:ie[3],backgroundDefault:ie[3],backgroundHover:ie[2]},neutral:{text:S[10],textHover:Ct.white,icon:S[10],iconHover:Ct.white,border:S[4],background:S[2]},link:{text:Ct.white,icon:Ct.white,hover:ie[5]},error:{text:Ae[5],hover:Ae[6]},success:{text:ye[5],hover:ye[6]}},AT={slateGrey:{content:S[10],pillOutline:S[10],borderPrimary:S[5],borderSecondary:S[5],background:S[3]},brand:{content:ie[9],pillOutline:ie[9],borderPrimary:ie[6],borderSecondary:ie[6],background:ie[0]},red:{content:Ae[8],pillOutline:Ae[4],borderPrimary:Ae[2],borderSecondary:Ae[2],background:Ae[0]},yellow:{content:De[8],pillOutline:De[4],borderPrimary:De[2],borderSecondary:De[2],background:De[0]},green:{content:ye[8],pillOutline:ye[4],borderPrimary:ye[2],borderSecondary:ye[2],background:ye[0]},purple:{content:Ke[8],pillOutline:Ke[4],borderPrimary:Ke[2],borderSecondary:Ke[2],background:Ke[0]},blue:{content:qe[8],pillOutline:qe[4],borderPrimary:qe[2],borderSecondary:qe[2],background:qe[0]},orange:{content:Xi[8],pillOutline:Xi[4],borderPrimary:Xi[2],borderSecondary:Xi[2],background:Xi[0]},pink:{content:Qi[8],pillOutline:Qi[4],borderPrimary:Qi[2],borderSecondary:Qi[2],background:Qi[0]}},RT={green:{content:ye[8],border:ye[2],background:ye[0]},yellow:{content:De[8],border:De[2],background:De[0]},red:{content:Ae[8],border:Ae[2],background:Ae[0]}},TT={green:{content:ye[1],background:ye[9]},yellow:{content:De[1],background:De[9]},red:{content:Ae[1],background:Ae[9]}},IT={content:S[10],border:S[4],background:S[3]},$T={backgroundDefault:S[2],backgroundHover:S[1],selected:S[3]},MT={background:S[2],icon:S[10],borderDefault:S[4],borderSelected:ie[3],textLabel:S[9],textPlaceholder:S[8],textHint:S[8]},PT={backgroundDefault:S[2],backgroundDisabled:S[0],textLabel:S[9],textPlaceholder:S[8],textHint:S[8],textError:Ae[5],iconDefault:S[9],iconPlaceholder:S[10],iconError:Ae[5],borderDefault:S[4],borderSelected:ie[3],borderError:Ae[5]},OT={handleDefault:Ct.white,handleDisabled:S[10],off:{backgroundDefault:S[4],backgroundHover:S[5],backgroundDisabled:S[4]},on:{backgroundDefault:ye[3],backgroundHover:ye[2],backgroundDisabled:S[4]}},NT={off:{backgroundDefault:"#00000000",backgroundHover:S[5],backgroundDisabled:S[2],border:S[6]},on:{backgroundDefault:ye[0],backgroundHover:ye[1],backgroundDisabled:S[2],border:ye[3]}},LT={content:S[10],background:S[4]},FT={background:S[4],active:ye[3]},DT={background:S[1],content:S[9],border:S[4]},HT={backgroundDefault:S[1],backgroundHover:S[3],backgroundActive:S[4],border:S[4],contentPrimary:S[10],contentSecondary:S[9],contentTertiary:S[8]},BT={background:S[1],content:S[9],border:S[4]},VT={activeBackground:S[3],activeContent:ie[5],inactiveContent:S[9],border:S[4]},WT={header:{textDefault:S[9],textHover:S[8],backgroundDefault:S[1]},border:S[4],cell:{textPrimary:S[10],textSecondary:S[9],backgroundDefault:S[2],backgroundHover:S[1]}},jT={textPrimaryDefault:S[10],textPrimaryHover:S[10],textSecondaryDefault:S[8],textSecondaryHover:S[9],iconPrimary:S[10],iconSecondary:S[8]},UT={background:ye[1],active:ye[5]},zT={textDefault:S[10],textSelected:Ct.white,textDisabled:S[7],backgroundDefault:S[2],backgroundMiddle:S[3],backgroundSelected:ie[3],border:S[4]},qT=S[9];var YT={size:56,inset:12,background:Ct.black,color:Ct.white,border:`2px solid ${ie[3]}`,shadowOpen:"0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.08)",shadowClosed:"0 4px 24px rgba(0,0,0,0.6)"};var Tf=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function If(n,e,t){let r=t?.paddingPx??12,i=t?.radiusPx??12,s=Math.min(Math.max(t?.scrimOpacity??.55,0),1),o=t?.ringColor??`var(--syntro-ring, ${qe[5]})`,a=t?.blocking??!1,l=t?.onClickOutside??!0,c=t?.onEsc??!0,u=getComputedStyle(document.documentElement),d=u.getPropertyValue("--syntro-spotlight-backdrop").trim(),h=u.getPropertyValue("--syntro-ring").trim(),g=document.createElement("div");g.className="syntro-spotlight-scrim";let v=a||l;Object.assign(g.style,{position:"fixed",inset:"0",zIndex:"2147483646",pointerEvents:v?"auto":"none",background:d||`rgba(2, 6, 23, ${s})`,transition:"opacity 220ms ease",opacity:"0"}),e.appendChild(g),requestAnimationFrame(()=>g.style.opacity="1");let f=document.createElement("div");f.className="syntro-spotlight-ring",Object.assign(f.style,{position:"fixed",pointerEvents:"none",borderRadius:`${i}px`,border:`2px solid ${o||h||qe[5]}`,boxShadow:"0 0 0 4px rgba(255,255,255,0.35)",zIndex:"2147483647",transition:"all 220ms cubic-bezier(0.16,1,0.3,1)"}),e.appendChild(f);let m=[];if(!Tf)for(let I=0;I<4;I++){let O=document.createElement("div");O.style.position="fixed",O.style.background="inherit",m.push(O),g.appendChild(O)}let y=I=>{g.style.clipPath=I,g.style.webkitClipPath=I},k=()=>{if(!n.isConnected){R.destroy();return}let I=n.getBoundingClientRect(),O=I.left-r,P=I.top-r,G=I.width+r*2,L=I.height+r*2;if(Object.assign(f.style,{left:`${O}px`,top:`${P}px`,width:`${G}px`,height:`${L}px`}),Tf){let F=window.innerWidth,Z=window.innerHeight,A=Math.min(i,G/2,L/2),H=`M 0 0 L ${F} 0 L ${F} ${Z} L 0 ${Z} Z`,M=`M ${O+A} ${P} A ${A} ${A} 0 0 0 ${O} ${P+A} L ${O} ${P+L-A} A ${A} ${A} 0 0 0 ${O+A} ${P+L} L ${O+G-A} ${P+L} A ${A} ${A} 0 0 0 ${O+G} ${P+L-A} L ${O+G} ${P+A} A ${A} ${A} 0 0 0 ${O+G-A} ${P} L ${O+A} ${P} Z`;y(`path('${H} ${M}')`)}else{let[F,Z,A,H]=m;Object.assign(F.style,{left:"0px",top:"0px",width:"100vw",height:`${P}px`}),Object.assign(A.style,{left:"0px",top:`${P+L}px`,width:"100vw",height:`${Math.max(0,window.innerHeight-(P+L))}px`}),Object.assign(H.style,{left:"0px",top:`${P}px`,width:`${O}px`,height:`${L}px`}),Object.assign(Z.style,{left:`${O+G}px`,top:`${P}px`,width:`${Math.max(0,window.innerWidth-(O+G))}px`,height:`${L}px`})}},_=new ResizeObserver(()=>requestAnimationFrame(k));_.observe(n);let b=()=>requestAnimationFrame(k),w=()=>requestAnimationFrame(k);window.addEventListener("scroll",b,!0),window.addEventListener("resize",w);let E=I=>{I.key==="Escape"&&c&&(t?.onDismiss?.(),R.destroy())};c&&window.addEventListener("keydown",E);let x=I=>{a?(I.preventDefault(),I.stopPropagation()):l&&(t?.onDismiss?.(),R.destroy())};g.addEventListener("click",x);let R={destroy(){_.disconnect(),window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",w),c&&window.removeEventListener("keydown",E),g.removeEventListener("click",x),g.style.pointerEvents="none",g.style.opacity="0",setTimeout(()=>{try{g.remove()}catch{}try{f.remove()}catch{}},220)}};return k(),R}var vx=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button","svg","path","circle","line","polyline","polygon","rect","g"]);function at(n){if(typeof window.Sanitizer=="function")try{let a=new window.Sanitizer({}).sanitizeToFragment(n),l=document.createElement("div");return l.append(a),l.innerHTML}catch{}let t=document.createElement("template");t.innerHTML=n;let r=t.content,i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,null),s=[];for(;i.nextNode();){let o=i.currentNode,a=o.tagName.toLowerCase();if(!vx.has(a)){s.push(o);continue}for(let l of Array.from(o.attributes)){let c=l.name.toLowerCase(),u=l.value.trim().toLowerCase(),d=c.startsWith("on"),h=(c==="href"||c==="src")&&u.startsWith("javascript:");(d||h)&&o.removeAttribute(l.name)}}for(let o of s){for(;o.firstChild;)o.parentNode?.insertBefore(o.firstChild,o);o.remove()}return t.innerHTML}var Kn={bg:"var(--sc-overlay-background, #ffffff)",title:"var(--sc-overlay-title-color, var(--sc-overlay-text-color, #111827))",text:"var(--sc-overlay-text-color, #4b5563)",accent:"var(--sc-color-primary, #4f46e5)",radius:"var(--sc-border-radius, 12px)"},Sc=async(n,e)=>{let{content:t,size:r="md",blocking:i=!1,scrim:s,dismiss:o,ctaButtons:a}=n,l=document.createElement("div");l.className="syntro-modal-scrim",l.style.cssText=`
|
|
1
|
+
var ex=Object.create;var Go=Object.defineProperty;var tx=Object.getOwnPropertyDescriptor;var nx=Object.getOwnPropertyNames;var rx=Object.getPrototypeOf,ix=Object.prototype.hasOwnProperty;var bf=n=>{throw TypeError(n)};var sx=(n,e,t)=>e in n?Go(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var yc=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),ox=(n,e)=>{for(var t in e)Go(n,t,{get:e[t],enumerable:!0})},ax=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of nx(e))!ix.call(n,i)&&i!==t&&Go(n,i,{get:()=>e[i],enumerable:!(r=tx(e,i))||r.enumerable});return n};var Wr=(n,e,t)=>(t=n!=null?ex(rx(n)):{},ax(e||!n||!n.__esModule?Go(t,"default",{value:n,enumerable:!0}):t,n));var ve=(n,e,t)=>sx(n,typeof e!="symbol"?e+"":e,t),bc=(n,e,t)=>e.has(n)||bf("Cannot "+t);var I=(n,e,t)=>(bc(n,e,"read from private field"),t?t.call(n):e.get(n)),ee=(n,e,t)=>e.has(n)?bf("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Z=(n,e,t,r)=>(bc(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),te=(n,e,t)=>(bc(n,e,"access private method"),t);var _c=(n,e,t,r)=>({set _(i){Z(n,e,i,t)},get _(){return I(n,e,r)}});var Pc=yc((DI,hg)=>{var nw=function(){return null},rw={get:function(n,e){return nw}};hg.exports=new Proxy({__esModule:!0,default:{}},rw)});var Oc=yc((HI,fg)=>{var iw=function(){return null},sw={get:function(n,e){return iw}};fg.exports=new Proxy({__esModule:!0,default:{}},sw)});var Nc=yc((BI,gg)=>{var ow=function(){return null},aw={get:function(n,e){return ow}};gg.exports=new Proxy({__esModule:!0,default:{}},aw)});function _f(n,e,t,r){let i=r?.maxRetries??3,s=r?.debounceMs??50,o=n.parentElement??e.parentElement;if(!o)return()=>{};let a=0,l=null,c=!1,u=new MutationObserver(d=>{if(!c){for(let h of d)for(let g of h.removedNodes)if(g===n){if(a>=i){u.disconnect(),c=!0;return}l&&clearTimeout(l),l=setTimeout(()=>{if(!c){if(!e.isConnected){u.disconnect(),c=!0;return}a++;try{t()}catch{u.disconnect(),c=!0}}},s);return}}});return u.observe(o,{childList:!0,subtree:!0}),()=>{c=!0,u.disconnect(),l&&clearTimeout(l)}}var lx=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button","svg","path","circle","line","polyline","polygon","rect","g"]);function xc(n){if(typeof window.Sanitizer=="function")try{let l=new window.Sanitizer({}).sanitizeToFragment(n),c=document.createElement("div");return c.append(l),c.innerHTML}catch{}let t=document.createElement("template");t.innerHTML=n;let r=t.content,i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,null),s=[];for(;i.nextNode();){let a=i.currentNode,l=a.tagName.toLowerCase();if(!lx.has(l)){s.push(a);continue}for(let c of Array.from(a.attributes)){let u=c.name.toLowerCase(),d=c.value.trim().toLowerCase(),h=u.startsWith("on"),v=(u==="href"||u==="src"||u==="formaction")&&(d.startsWith("javascript:")||d.startsWith("vbscript:")||d.startsWith("data:text/html"));(h||v)&&a.removeAttribute(c.name)}}let o=Array.from(r.querySelectorAll("svg"));for(let a of o)s.some(l=>a.contains(l)&&l.tagName.toLowerCase()==="script")&&s.push(a);for(let a of s){for(;a.firstChild;)a.parentNode?.insertBefore(a.firstChild,a);a.remove()}return t.innerHTML}var xf=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=xc(n.html),i="data-syntro-insert-label",s=n.label;if(s){let d=CSS.escape(s),g=(t.parentElement??t).querySelector(`[${i}="${d}"]`);g&&g.remove()}let o=document.createElement("div");o.setAttribute("data-syntro-action-id",e.generateId()),s&&o.setAttribute(i,s),o.innerHTML=r;let a=null;switch(n.position){case"before":t.insertAdjacentElement("beforebegin",o);break;case"after":t.insertAdjacentElement("afterend",o);break;case"prepend":t.insertBefore(o,t.firstChild);break;case"append":t.appendChild(o);break;case"replace":a=t.innerHTML,t.replaceWith(o);break}let l=null;if(n.deepLink){let{tileId:d,itemId:h}=n.deepLink;l=()=>{let g=window.SynOS?.handle;g&&(g.open(),g.runtime?.events?.publish("notification.deep_link",{tileId:d,itemId:h}))},o.style.cursor="pointer",o.addEventListener("click",l)}e.publishEvent("action.applied",{id:e.generateId(),kind:"content:insertHtml",anchorId:n.anchorId,position:n.position});let u=_f(o,t,()=>{switch(n.position){case"before":t.insertAdjacentElement("beforebegin",o);break;case"after":t.insertAdjacentElement("afterend",o);break;case"prepend":t.insertBefore(o,t.firstChild);break;case"append":t.appendChild(o);break;case"replace":break}});return{cleanup:()=>{if(l&&o.removeEventListener("click",l),u(),!!o.isConnected)try{if(n.position==="replace"&&a!==null){let d=document.createElement(t.tagName);d.innerHTML=a,Array.from(t.attributes).forEach(h=>{d.setAttribute(h.name,h.value)}),o.replaceWith(d)}else o.remove()}catch{}},updateFn:d=>{"html"in d&&typeof d.html=="string"&&(o.innerHTML=xc(d.html))}}};function wf(n){if(n.children.length===0)return n;let e=Array.from(n.children).filter(t=>t.textContent?.trim());if(e.length===1){let t=e[0];if(t.textContent?.trim()===n.textContent?.trim())return wf(t)}return n}var kf=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=wf(t),i=r.textContent??"";return r.textContent=n.text,e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setText",anchorId:n.anchorId}),{cleanup:()=>{t.isConnected&&(r.textContent=i)},updateFn:s=>{"text"in s&&typeof s.text=="string"&&(r.textContent=s.text)}}},Sf=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=n.attr.toLowerCase();if(r.startsWith("on"))throw new Error(`Dangerous attribute not allowed: ${n.attr}`);if(r==="href"||r==="src"||r==="formaction"){let a=n.value.trim().toLowerCase();if(a.startsWith("javascript:")||a.startsWith("vbscript:")||a.startsWith("data:text/html"))throw new Error(`Dangerous URL not allowed in ${n.attr}: ${n.value}`)}let s=t.getAttribute(n.attr),o=t.hasAttribute(n.attr);return t.setAttribute(n.attr,n.value),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setAttr",anchorId:n.anchorId,attr:n.attr}),{cleanup:()=>{t.isConnected&&(o&&s!==null?t.setAttribute(n.attr,s):t.removeAttribute(n.attr))},updateFn:a=>{"value"in a&&typeof a.value=="string"&&t.setAttribute(n.attr,a.value)}}},Ef=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=t.classList.contains(n.className);return t.classList.add(n.className),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:addClass",anchorId:n.anchorId,className:n.className}),{cleanup:()=>{t.isConnected&&(r||t.classList.remove(n.className))}}},Cf=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=t.classList.contains(n.className);return t.classList.remove(n.className),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:removeClass",anchorId:n.anchorId,className:n.className}),{cleanup:()=>{t.isConnected&&r&&t.classList.add(n.className)}}},Af=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=new Map;for(let i of Object.keys(n.styles)){let s=t.style.getPropertyValue(i);r.set(i,s)}for(let[i,s]of Object.entries(n.styles))t.style.setProperty(i,s);return e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setStyle",anchorId:n.anchorId,styles:Object.keys(n.styles)}),{cleanup:()=>{if(t.isConnected)for(let[i,s]of r)s?t.style.setProperty(i,s):t.style.removeProperty(i)},updateFn:i=>{if("styles"in i&&typeof i.styles=="object"&&i.styles)for(let[s,o]of Object.entries(i.styles))t.style.setProperty(s,o)}}},wc=[{kind:"content:insertHtml",executor:xf},{kind:"content:setText",executor:kf},{kind:"content:setAttr",executor:Sf},{kind:"content:addClass",executor:Ef},{kind:"content:removeClass",executor:Cf},{kind:"content:setStyle",executor:Af}],kc={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:wc};var cx={light:50,medium:100,heavy:200},ux=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],Rf={init(n,e,t){let r=cx[t.intensity],i=t.colors.length>0?t.colors:ux,s=[];for(let o=0;o<r;o++)s.push({x:Math.random()*n,y:Math.random()*-e*.3,vx:(Math.random()-.5)*4,vy:Math.random()*2+1,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.2,size:Math.random()*6+4,color:i[Math.floor(Math.random()*i.length)],opacity:1,shape:Math.random()>.5?"rect":"circle"});return s},update(n,e,t){let r=!1;for(let i of n)i.vy+=.15,i.vx*=.99,i.x+=i.vx,i.y+=i.vy,i.rotation+=i.rotationSpeed,i.y>0&&i.opacity>0&&i.y>500&&(i.opacity-=.02,i.opacity<0&&(i.opacity=0)),i.opacity>.01&&(r=!0);return r},render(n,e){for(let t of e)t.opacity<.01||(n.save(),n.globalAlpha=t.opacity,n.fillStyle=t.color,n.translate(t.x,t.y),n.rotate(t.rotation),t.shape==="circle"?(n.beginPath(),n.arc(0,0,t.size/2,0,Math.PI*2),n.fill()):n.fillRect(-t.size/2,-t.size/2,t.size,t.size*.6),n.restore())}};var dx={light:20,medium:40,heavy:80},px="\u{1F389}",Tf={init(n,e,t){let r=dx[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:px,s=[];for(let o=0;o<r;o++)s.push({x:Math.random()*n,y:Math.random()*-200,vx:0,vy:Math.random()*1.5+1,rotation:0,rotationSpeed:0,size:Math.random()*12+16,color:"#000000",opacity:1,shape:"emoji",emoji:i,data:{wobblePhase:Math.random()*Math.PI*2,wobbleAmp:Math.random()*1.5+.5,originX:0}});for(let o of s)o.data&&(o.data.originX=o.x);return s},update(n,e,t){let r=!1;for(let i of n){i.y+=i.vy;let s=i.data?.wobblePhase??0,o=i.data?.wobbleAmp??1,a=i.data?.originX??i.x;i.x=a+Math.sin(t*.003+s)*o*20,i.y>600&&(i.opacity-=.02,i.opacity<0&&(i.opacity=0)),i.opacity>.01&&(r=!0)}return r},render(n,e){for(let t of e)t.opacity<.01||!t.emoji||(n.save(),n.globalAlpha=t.opacity,n.font=`${t.size}px serif`,n.textAlign="center",n.textBaseline="middle",n.fillText(t.emoji,t.x,t.y),n.restore())}};var hx={light:20,medium:40,heavy:80},fx={light:3,medium:4,heavy:5},If={init(n,e,t){let r=hx[t.intensity],i=fx[t.intensity],s=t.colors.length>0?t.colors:["#ff4444","#44ff44","#4444ff"],o=[];for(let a=0;a<i;a++){let l=Math.random()*n*.8+n*.1,c=Math.random()*e*.6,u=s[Math.floor(Math.random()*s.length)];for(let d=0;d<r;d++){let h=Math.PI*2*d/r+(Math.random()-.5)*.3,g=Math.random()*3+2;o.push({x:l,y:c,vx:Math.cos(h)*g,vy:Math.sin(h)*g,rotation:0,rotationSpeed:0,size:Math.random()*3+2,color:u,opacity:1,shape:"circle",data:{centerX:l,centerY:c}})}}return o},update(n,e,t){let r=!1;for(let i of n)i.vx*=.97,i.vy*=.97,i.vy+=.03,i.x+=i.vx,i.y+=i.vy,i.opacity-=.008,i.opacity<0&&(i.opacity=0),i.opacity>.01&&(r=!0);return r},render(n,e){for(let t of e)t.opacity<.01||(n.save(),n.globalAlpha=t.opacity,n.fillStyle=t.color,n.shadowBlur=12,n.shadowColor=t.color,n.beginPath(),n.arc(t.x,t.y,t.size,0,Math.PI*2),n.fill(),n.restore())}};var gx={light:30,medium:60,heavy:120},$f={init(n,e,t){let r=gx[t.intensity],i=t.colors.length>0?t.colors:["#ffd700","#ffffff","#fffacd"],s=[];for(let o=0;o<r;o++)s.push({x:Math.random()*n,y:Math.random()*e,vx:(Math.random()-.5)*.3,vy:-(Math.random()*.5+.2),rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.1,size:Math.random()*4+2,color:i[Math.floor(Math.random()*i.length)],opacity:Math.random()*.5+.5,shape:"circle",data:{phase:Math.random()*Math.PI*2,baseOpacity:Math.random()*.5+.5}});return s},update(n,e,t){let r=!1;for(let i of n){i.x+=i.vx,i.y+=i.vy,i.rotation+=i.rotationSpeed,i.data&&(i.data.baseOpacity=(i.data.baseOpacity??1)-.001,i.data.baseOpacity<0&&(i.data.baseOpacity=0));let s=i.data?.phase??0,o=i.data?.baseOpacity??1;if(o<=.01)i.opacity=0;else{let a=Math.sin(t*.005+s)*.4+.6;i.opacity=o*a}i.opacity>.01&&(r=!0)}return r},render(n,e){for(let t of e){if(t.opacity<.01)continue;n.save(),n.globalAlpha=t.opacity,n.fillStyle=t.color,n.translate(t.x,t.y),n.rotate(t.rotation);let r=t.size;n.beginPath(),n.moveTo(0,-r),n.lineTo(r*.3,-r*.3),n.lineTo(r,0),n.lineTo(r*.3,r*.3),n.lineTo(0,r),n.lineTo(-r*.3,r*.3),n.lineTo(-r,0),n.lineTo(-r*.3,-r*.3),n.closePath(),n.fill(),n.restore()}}};var Ko=class{constructor(){this.canvas=null,this.ctx=null,this.rafId=null,this.particles=[],this.startTime=0,this.lastFrame=0,this.duration=0,this.effect=null,this.container=null}start(e,t,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;this.container=e,this.effect=t,this.duration=r.duration;let s=document.createElement("canvas");s.setAttribute("data-syntro-celebrate",""),Object.assign(s.style,{position:"fixed",inset:"0",pointerEvents:"none",zIndex:"2147483646"});let o=window.devicePixelRatio||1,a=window.innerWidth,l=window.innerHeight;s.width=a*o,s.height=l*o,s.style.width=`${a}px`,s.style.height=`${l}px`;let c=s.getContext("2d");c&&(c.scale(o,o),this.canvas=s,this.ctx=c,e.appendChild(s),this.particles=t.init(a,l,r),this.startTime=performance.now(),this.lastFrame=this.startTime,this.tick=this.tick.bind(this),this.rafId=requestAnimationFrame(this.tick))}stop(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas&&this.container&&(this.canvas.remove(),this.canvas=null),this.ctx=null,this.effect=null,this.container=null,this.particles=[]}tick(e){if(!this.ctx||!this.canvas||!this.effect)return;let t=e-this.startTime,r=e-this.lastFrame;if(this.lastFrame=e,t>=this.duration){this.stop();return}let i=this.canvas.width/(window.devicePixelRatio||1),s=this.canvas.height/(window.devicePixelRatio||1);if(this.ctx.clearRect(0,0,i,s),!this.effect.update(this.particles,r,t)){this.stop();return}this.effect.render(this.ctx,this.particles),this.rafId=requestAnimationFrame(this.tick)}};var mx=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function vx(n,e){return[n,e,`${n}cc`,`${e}cc`,"#ffffff",`${n}80`]}function yx(n){try{let e=getComputedStyle(n),t=e.getPropertyValue("--sc-color-primary")?.trim(),r=e.getPropertyValue("--sc-color-primary-hover")?.trim();if(t?.startsWith("#")&&t.length>=7)return vx(t,r||t)}catch{}return null}var Mf=new Map([["confetti",Rf],["fireworks",If],["sparkles",$f],["emoji-rain",Tf]]),Pf=async(n,e)=>{let t=Mf.get(n.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${n.effect}". Available: ${[...Mf.keys()].join(", ")}`),{cleanup:()=>{}};let r=n.colors??yx(e.overlayRoot)??mx,i={duration:n.duration??3e3,intensity:n.intensity??"medium",colors:r,props:n.props},s=new Ko;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:n.effect}),{cleanup:()=>{s.stop()}}};var Ec="syntro_active_tour",Yo=new Map;function bx(n){try{let e=localStorage.getItem(Ec);if(!e)return null;let t=JSON.parse(e);return t.tourId!==n?null:t}catch{return null}}function Sc(n){try{localStorage.setItem(Ec,JSON.stringify(n))}catch{}}function _x(){try{localStorage.removeItem(Ec)}catch{}}function Xi(){return window.location.pathname}function xx(n){if(!n.route)return!0;let e=Xi();return n.route.includes("*")?new RegExp(`^${n.route.replace(/\*/g,".*")}$`).test(e):e===n.route}var Cc=async(n,e)=>{let{tourId:t,steps:r,startStep:i,autoStart:s=!0}=n;if(r.length===0)throw new Error(`Tour "${t}" has no steps`);if(Yo.has(t))return{cleanup:async()=>{let _=Yo.get(t);_&&await _.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=bx(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||r[0].id,startedAt:Date.now()},Sc(o));let l=r.findIndex(_=>_.id===o.currentStepId);if(l===-1){let _=i||r[0].id;l=r.findIndex(b=>b.id===_),l===-1&&(l=0),o.currentStepId=r[l].id,Sc(o)}let c=r[l];if(!xx(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:Xi()}),{cleanup:()=>{}};let u=!1,d=null,h=null,g=null,v=async()=>{h&&(h(),h=null),d?.isApplied()&&(await d.revert(),d=null)},f=async _=>{if(u)return;if(await v(),_==="end"){_x(),e.publishEvent("tour.completed",{tourId:t,totalSteps:r.length}),u=!0;return}let b=r.find(x=>x.id===_);if(!b){console.error(`[Tour] Step "${_}" not found`);return}if(o.currentStepId=_,Sc(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:_}),b.route&&b.route!==Xi()){e.publishEvent("tour.awaiting_navigation",{tourId:t,stepId:_,targetRoute:b.route});return}await m(b)},m=async _=>{if(!u){e.publishEvent("tour.step_started",{tourId:t,stepId:_.id,stepIndex:r.findIndex(b=>b.id===_.id),totalSteps:r.length});try{d=await e.applyAction(_.action)}catch(b){console.error(`[Tour] Failed to execute step "${_.id}":`,b),e.publishEvent("tour.step_failed",{tourId:t,stepId:_.id,error:String(b)});return}if(_.onAction&&e.subscribeEvent){h=e.subscribeEvent("action.modal_cta_clicked",R=>{let w=R?.actionId;if(w&&_.onAction){let E=_.onAction[w];E&&f(E)}});let b=e.subscribeEvent("action.tooltip_cta_clicked",R=>{let w=R?.actionId;if(w&&_.onAction){let E=_.onAction[w];E&&f(E)}}),x=h;h=()=>{x(),b()}}}};g=(()=>{let _=Xi(),b=()=>{let w=Xi();w!==_&&(_=w,e.publishEvent("tour.route_changed",{tourId:t,newRoute:w}))};if(e.subscribeNavigation)return e.subscribeNavigation(()=>b());window.addEventListener("popstate",b);let x=history.pushState.bind(history),R=history.replaceState.bind(history);return history.pushState=(...w)=>{x(...w),queueMicrotask(b)},history.replaceState=(...w)=>{R(...w),queueMicrotask(b)},()=>{window.removeEventListener("popstate",b),history.pushState=x,history.replaceState=R}})(),a?e.publishEvent("tour.resumed",{tourId:t,stepId:o.currentStepId}):e.publishEvent("tour.started",{tourId:t,totalSteps:r.length,startStepId:o.currentStepId}),await m(c);let k=async()=>{u=!0,Yo.delete(t),await v(),g&&g(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return Yo.set(t,{cleanup:k}),{cleanup:k}};var At={white:"#ffffff",black:"#000000"},ie={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},S={0:"#07080a",1:"#0f1318",2:"#0e1114",3:"#1c222a",4:"#2b333f",5:"#394454",6:"#475569",7:"#677384",8:"#87919f",9:"#a8afba",10:"#cbd0d7",11:"#e8eaee",12:"#f6f7f9"},be={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Be={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},Te={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},Ze={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},Ji={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},Ye={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},Qi={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"};var at={primary:S[10],secondary:S[9],tertiary:S[8]},OT={primary:S[2],secondary:S[0]},Ac={primary:S[4],secondary:S[3]},Xo={primary:{text:At.white,icon:At.white,border:ie[3],backgroundDefault:ie[3],backgroundHover:ie[2]},neutral:{text:S[10],textHover:At.white,icon:S[10],iconHover:At.white,border:S[4],background:S[2]},link:{text:At.white,icon:At.white,hover:ie[5]},error:{text:Te[5],hover:Te[6]},success:{text:be[5],hover:be[6]}},NT={slateGrey:{content:S[10],pillOutline:S[10],borderPrimary:S[5],borderSecondary:S[5],background:S[3]},brand:{content:ie[9],pillOutline:ie[9],borderPrimary:ie[6],borderSecondary:ie[6],background:ie[0]},red:{content:Te[8],pillOutline:Te[4],borderPrimary:Te[2],borderSecondary:Te[2],background:Te[0]},yellow:{content:Be[8],pillOutline:Be[4],borderPrimary:Be[2],borderSecondary:Be[2],background:Be[0]},green:{content:be[8],pillOutline:be[4],borderPrimary:be[2],borderSecondary:be[2],background:be[0]},purple:{content:Ye[8],pillOutline:Ye[4],borderPrimary:Ye[2],borderSecondary:Ye[2],background:Ye[0]},blue:{content:Ze[8],pillOutline:Ze[4],borderPrimary:Ze[2],borderSecondary:Ze[2],background:Ze[0]},orange:{content:Ji[8],pillOutline:Ji[4],borderPrimary:Ji[2],borderSecondary:Ji[2],background:Ji[0]},pink:{content:Qi[8],pillOutline:Qi[4],borderPrimary:Qi[2],borderSecondary:Qi[2],background:Qi[0]}},LT={green:{content:be[8],border:be[2],background:be[0]},yellow:{content:Be[8],border:Be[2],background:Be[0]},red:{content:Te[8],border:Te[2],background:Te[0]}},FT={green:{content:be[1],background:be[9]},yellow:{content:Be[1],background:Be[9]},red:{content:Te[1],background:Te[9]}},DT={content:S[10],border:S[4],background:S[3]},HT={backgroundDefault:S[2],backgroundHover:S[1],selected:S[3]},BT={background:S[2],icon:S[10],borderDefault:S[4],borderSelected:ie[3],textLabel:S[9],textPlaceholder:S[8],textHint:S[8]},VT={backgroundDefault:S[2],backgroundDisabled:S[0],textLabel:S[9],textPlaceholder:S[8],textHint:S[8],textError:Te[5],iconDefault:S[9],iconPlaceholder:S[10],iconError:Te[5],borderDefault:S[4],borderSelected:ie[3],borderError:Te[5]},WT={handleDefault:At.white,handleDisabled:S[10],off:{backgroundDefault:S[4],backgroundHover:S[5],backgroundDisabled:S[4]},on:{backgroundDefault:be[3],backgroundHover:be[2],backgroundDisabled:S[4]}},jT={off:{backgroundDefault:"#00000000",backgroundHover:S[5],backgroundDisabled:S[2],border:S[6]},on:{backgroundDefault:be[0],backgroundHover:be[1],backgroundDisabled:S[2],border:be[3]}},UT={content:S[10],background:S[4]},zT={background:S[4],active:be[3]},qT={background:S[1],content:S[9],border:S[4]},ZT={backgroundDefault:S[1],backgroundHover:S[3],backgroundActive:S[4],border:S[4],contentPrimary:S[10],contentSecondary:S[9],contentTertiary:S[8]},GT={background:S[1],content:S[9],border:S[4]},KT={activeBackground:S[3],activeContent:ie[5],inactiveContent:S[9],border:S[4]},YT={header:{textDefault:S[9],textHover:S[8],backgroundDefault:S[1]},border:S[4],cell:{textPrimary:S[10],textSecondary:S[9],backgroundDefault:S[2],backgroundHover:S[1]}},XT={textPrimaryDefault:S[10],textPrimaryHover:S[10],textSecondaryDefault:S[8],textSecondaryHover:S[9],iconPrimary:S[10],iconSecondary:S[8]},JT={background:be[1],active:be[5]},QT={textDefault:S[10],textSelected:At.white,textDisabled:S[7],backgroundDefault:S[2],backgroundMiddle:S[3],backgroundSelected:ie[3],border:S[4]},eI=S[9];var iI={size:56,inset:12,background:At.black,color:At.white,border:`2px solid ${ie[3]}`,shadowOpen:"0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.08)",shadowClosed:"0 4px 24px rgba(0,0,0,0.6)"};var Of=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function Nf(n,e,t){let r=t?.paddingPx??12,i=t?.radiusPx??12,s=Math.min(Math.max(t?.scrimOpacity??.55,0),1),o=t?.ringColor??`var(--syntro-ring, ${Ze[5]})`,a=t?.blocking??!1,l=t?.onClickOutside??!0,c=t?.onEsc??!0,u=getComputedStyle(document.documentElement),d=u.getPropertyValue("--syntro-spotlight-backdrop").trim(),h=u.getPropertyValue("--syntro-ring").trim(),g=document.createElement("div");g.className="syntro-spotlight-scrim";let v=a||l;Object.assign(g.style,{position:"fixed",inset:"0",zIndex:"2147483646",pointerEvents:v?"auto":"none",background:d||`rgba(2, 6, 23, ${s})`,transition:"opacity 220ms ease",opacity:"0"}),e.appendChild(g),requestAnimationFrame(()=>g.style.opacity="1");let f=document.createElement("div");f.className="syntro-spotlight-ring",Object.assign(f.style,{position:"fixed",pointerEvents:"none",borderRadius:`${i}px`,border:`2px solid ${o||h||Ze[5]}`,boxShadow:"0 0 0 4px rgba(255,255,255,0.35)",zIndex:"2147483647",transition:"all 220ms cubic-bezier(0.16,1,0.3,1)"}),e.appendChild(f);let m=[];if(!Of)for(let $=0;$<4;$++){let P=document.createElement("div");P.style.position="fixed",P.style.background="inherit",m.push(P),g.appendChild(P)}let y=$=>{g.style.clipPath=$,g.style.webkitClipPath=$},k=()=>{if(!n.isConnected){E.destroy();return}let $=n.getBoundingClientRect(),P=$.left-r,M=$.top-r,G=$.width+r*2,L=$.height+r*2;if(Object.assign(f.style,{left:`${P}px`,top:`${M}px`,width:`${G}px`,height:`${L}px`}),Of){let N=window.innerWidth,z=window.innerHeight,H=Math.min(i,G/2,L/2),oe=`M 0 0 L ${N} 0 L ${N} ${z} L 0 ${z} Z`,A=`M ${P+H} ${M} A ${H} ${H} 0 0 0 ${P} ${M+H} L ${P} ${M+L-H} A ${H} ${H} 0 0 0 ${P+H} ${M+L} L ${P+G-H} ${M+L} A ${H} ${H} 0 0 0 ${P+G} ${M+L-H} L ${P+G} ${M+H} A ${H} ${H} 0 0 0 ${P+G-H} ${M} L ${P+H} ${M} Z`;y(`path('${oe} ${A}')`)}else{let[N,z,H,oe]=m;Object.assign(N.style,{left:"0px",top:"0px",width:"100vw",height:`${M}px`}),Object.assign(H.style,{left:"0px",top:`${M+L}px`,width:"100vw",height:`${Math.max(0,window.innerHeight-(M+L))}px`}),Object.assign(oe.style,{left:"0px",top:`${M}px`,width:`${P}px`,height:`${L}px`}),Object.assign(z.style,{left:`${P+G}px`,top:`${M}px`,width:`${Math.max(0,window.innerWidth-(P+G))}px`,height:`${L}px`})}},_=new ResizeObserver(()=>requestAnimationFrame(k));_.observe(n);let b=()=>requestAnimationFrame(k),x=()=>requestAnimationFrame(k);window.addEventListener("scroll",b,!0),window.addEventListener("resize",x);let R=$=>{$.key==="Escape"&&c&&(t?.onDismiss?.(),E.destroy())};c&&window.addEventListener("keydown",R);let w=$=>{a?($.preventDefault(),$.stopPropagation()):l&&(t?.onDismiss?.(),E.destroy())};g.addEventListener("click",w);let E={destroy(){_.disconnect(),window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",x),c&&window.removeEventListener("keydown",R),g.removeEventListener("click",w),g.style.pointerEvents="none",g.style.opacity="0",setTimeout(()=>{try{g.remove()}catch{}try{f.remove()}catch{}},220)}};return k(),E}var wx=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button","svg","path","circle","line","polyline","polygon","rect","g"]);function lt(n){if(typeof window.Sanitizer=="function")try{let a=new window.Sanitizer({}).sanitizeToFragment(n),l=document.createElement("div");return l.append(a),l.innerHTML}catch{}let t=document.createElement("template");t.innerHTML=n;let r=t.content,i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,null),s=[];for(;i.nextNode();){let o=i.currentNode,a=o.tagName.toLowerCase();if(!wx.has(a)){s.push(o);continue}for(let l of Array.from(o.attributes)){let c=l.name.toLowerCase(),u=l.value.trim().toLowerCase(),d=c.startsWith("on"),h=(c==="href"||c==="src")&&u.startsWith("javascript:");(d||h)&&o.removeAttribute(l.name)}}for(let o of s){for(;o.firstChild;)o.parentNode?.insertBefore(o.firstChild,o);o.remove()}return t.innerHTML}var Kn={bg:"var(--sc-overlay-background, #ffffff)",title:"var(--sc-overlay-title-color, var(--sc-overlay-text-color, #111827))",text:"var(--sc-overlay-text-color, #4b5563)",accent:"var(--sc-color-primary, #4f46e5)",radius:"var(--sc-border-radius, 12px)"},Rc=async(n,e)=>{let{content:t,size:r="md",blocking:i=!1,scrim:s,dismiss:o,ctaButtons:a}=n,l=document.createElement("div");l.className="syntro-modal-scrim",l.style.cssText=`
|
|
2
2
|
position: fixed;
|
|
3
3
|
inset: 0;
|
|
4
4
|
background: rgba(0, 0, 0, ${s?.opacity??.6});
|
|
@@ -19,7 +19,7 @@ var K0=Object.create;var Zo=Object.defineProperty;var Y0=Object.getOwnPropertyDe
|
|
|
19
19
|
opacity: 0;
|
|
20
20
|
transition: opacity 200ms ease-out, transform 200ms ease-out;
|
|
21
21
|
padding: 24px;
|
|
22
|
-
`;let d="";if(t.title&&(d+=`<h2 class="syntro-modal-title" style="margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: ${Kn.title};">${
|
|
22
|
+
`;let d="";if(t.title&&(d+=`<h2 class="syntro-modal-title" style="margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: ${Kn.title};">${lt(t.title)}</h2>`),d+=`<div class="syntro-modal-body" style="color: ${Kn.text}; line-height: 1.5;">${lt(t.body)}</div>`,o?.closeButton!==!1&&(d+=`
|
|
23
23
|
<button class="syntro-modal-close" data-syntro-action="dismiss" style="
|
|
24
24
|
position: absolute;
|
|
25
25
|
top: 16px;
|
|
@@ -35,10 +35,10 @@ var K0=Object.create;var Zo=Object.defineProperty;var Y0=Object.getOwnPropertyDe
|
|
|
35
35
|
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
|
|
36
36
|
</svg>
|
|
37
37
|
</button>
|
|
38
|
-
`),a&&a.length>0){d+='<div class="syntro-modal-actions" style="display: flex; gap: 12px; margin-top: 24px; justify-content: flex-end;">';for(let
|
|
38
|
+
`),a&&a.length>0){d+='<div class="syntro-modal-actions" style="display: flex; gap: 12px; margin-top: 24px; justify-content: flex-end;">';for(let x of a){let R=x.primary??!1;d+=`
|
|
39
39
|
<button
|
|
40
|
-
class="syntro-modal-btn ${
|
|
41
|
-
data-syntro-action="${
|
|
40
|
+
class="syntro-modal-btn ${R?"syntro-modal-btn-primary":""}"
|
|
41
|
+
data-syntro-action="${lt(x.actionId)}"
|
|
42
42
|
style="
|
|
43
43
|
padding: 10px 20px;
|
|
44
44
|
border-radius: 8px;
|
|
@@ -46,14 +46,14 @@ var K0=Object.create;var Zo=Object.defineProperty;var Y0=Object.getOwnPropertyDe
|
|
|
46
46
|
font-weight: 500;
|
|
47
47
|
cursor: pointer;
|
|
48
48
|
transition: background 150ms ease;
|
|
49
|
-
${
|
|
49
|
+
${R?`background: ${Kn.accent}; color: white; border: none;`:`background: transparent; color: ${Kn.accent}; border: 1px solid currentColor; opacity: 0.7;`}
|
|
50
50
|
"
|
|
51
51
|
>
|
|
52
|
-
${
|
|
52
|
+
${lt(x.label)}
|
|
53
53
|
</button>
|
|
54
|
-
`}d+="</div>"}c.innerHTML=d,e.overlayRoot.appendChild(c);let h=null,g=c.querySelectorAll("[data-syntro-action]"),v=w=>{let x=w.currentTarget.getAttribute("data-syntro-action");x&&(h=x,e.publishEvent("action.modal_cta_clicked",{actionId:x}),b.destroy())};g.forEach(w=>w.addEventListener("click",v));let f=w=>{w.key==="Escape"&&o?.onEsc!==!1&&b.destroy()};window.addEventListener("keydown",f);let m=()=>{i||b.destroy()};l.addEventListener("click",m);let y=[];i&&Array.from(document.body.children).forEach(w=>{w!==e.overlayRoot&&w.getAttribute("inert")===null&&!w.querySelector("[data-syntro-editor-panel]")&&!w.hasAttribute("data-syntro-editor-panel")&&(w.setAttribute("inert",""),y.push(w))});let k;o?.timeoutMs&&(k=setTimeout(()=>{b.destroy()},o.timeoutMs));let _=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');_.length>0&&requestAnimationFrame(()=>_[0].focus()),requestAnimationFrame(()=>{l.style.opacity="1",c.style.opacity="1",c.style.transform="translate(-50%, -50%) scale(1)"}),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:modal",size:r,blocking:i});let b={destroy(){k&&clearTimeout(k),window.removeEventListener("keydown",f),l.removeEventListener("click",m),g.forEach(w=>w.removeEventListener("click",v)),y.forEach(w=>w.removeAttribute("inert")),c.style.pointerEvents="none",l.style.pointerEvents="none",c.style.opacity="0",c.style.transform="translate(-50%, -50%) scale(0.95)",l.style.opacity="0",setTimeout(()=>{try{c.remove()}catch{}try{l.remove()}catch{}},200),e.publishEvent("action.modal_dismissed",{actionClicked:h})}};return{cleanup:()=>{b.destroy()}}};var Pf=["top","right","bottom","left"];var _n=Math.min,Gt=Math.max,es=Math.round,ts=Math.floor,At=n=>({x:n,y:n}),yx={left:"right",right:"left",bottom:"top",top:"bottom"},bx={start:"end",end:"start"};function Qo(n,e,t){return Gt(n,_n(e,t))}function Yn(n,e){return typeof n=="function"?n(e):n}function xn(n){return n.split("-")[0]}function jr(n){return n.split("-")[1]}function Ec(n){return n==="x"?"y":"x"}function Jo(n){return n==="y"?"height":"width"}var _x=new Set(["top","bottom"]);function Kt(n){return _x.has(xn(n))?"y":"x"}function ea(n){return Ec(Kt(n))}function Of(n,e,t){t===void 0&&(t=!1);let r=jr(n),i=ea(n),s=Jo(i),o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Ji(o)),[o,Ji(o)]}function Nf(n){let e=Ji(n);return[Xo(n),e,Xo(e)]}function Xo(n){return n.replace(/start|end/g,e=>bx[e])}var $f=["left","right"],Mf=["right","left"],xx=["top","bottom"],wx=["bottom","top"];function kx(n,e,t){switch(n){case"top":case"bottom":return t?e?Mf:$f:e?$f:Mf;case"left":case"right":return e?xx:wx;default:return[]}}function Lf(n,e,t,r){let i=jr(n),s=kx(xn(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Xo)))),s}function Ji(n){return n.replace(/left|right|bottom|top/g,e=>yx[e])}function Sx(n){return{top:0,right:0,bottom:0,left:0,...n}}function Cc(n){return typeof n!="number"?Sx(n):{top:n,right:n,bottom:n,left:n}}function Xn(n){let{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}function Ff(n,e,t){let{reference:r,floating:i}=n,s=Kt(e),o=ea(e),a=Jo(o),l=xn(e),c=s==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2,g;switch(l){case"top":g={x:u,y:r.y-i.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:d};break;case"left":g={x:r.x-i.width,y:d};break;default:g={x:r.x,y:r.y}}switch(jr(e)){case"start":g[o]-=h*(t&&c?-1:1);break;case"end":g[o]+=h*(t&&c?-1:1);break}return g}async function Bf(n,e){var t;e===void 0&&(e={});let{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:g=0}=Yn(e,n),v=Cc(g),m=a[h?d==="floating"?"reference":"floating":d],y=Xn(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(m)))==null||t?m:m.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),k=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),b=await(s.isElement==null?void 0:s.isElement(_))?await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1}:{x:1,y:1},w=Xn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:k,offsetParent:_,strategy:l}):k);return{top:(y.top-w.top+v.top)/b.y,bottom:(w.bottom-y.bottom+v.bottom)/b.y,left:(y.left-w.left+v.left)/b.x,right:(w.right-y.right+v.right)/b.x}}var Vf=async(n,e,t)=>{let{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e)),c=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:u,y:d}=Ff(c,r,l),h=r,g={},v=0;for(let m=0;m<a.length;m++){var f;let{name:y,fn:k}=a[m],{x:_,y:b,data:w,reset:E}=await k({x:u,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:g,rects:c,platform:{...o,detectOverflow:(f=o.detectOverflow)!=null?f:Bf},elements:{reference:n,floating:e}});u=_??u,d=b??d,g={...g,[y]:{...g[y],...w}},E&&v<=50&&(v++,typeof E=="object"&&(E.placement&&(h=E.placement),E.rects&&(c=E.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):E.rects),{x:u,y:d}=Ff(c,h,l)),m=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:g}},Wf=n=>({name:"arrow",options:n,async fn(e){let{x:t,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Yn(n,e)||{};if(c==null)return{};let d=Cc(u),h={x:t,y:r},g=ea(i),v=Jo(g),f=await o.getDimensions(c),m=g==="y",y=m?"top":"left",k=m?"bottom":"right",_=m?"clientHeight":"clientWidth",b=s.reference[v]+s.reference[g]-h[g]-s.floating[v],w=h[g]-s.reference[g],E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c)),x=E?E[_]:0;(!x||!await(o.isElement==null?void 0:o.isElement(E)))&&(x=a.floating[_]||s.floating[v]);let R=b/2-w/2,I=x/2-f[v]/2-1,O=_n(d[y],I),P=_n(d[k],I),G=O,L=x-f[v]-P,F=x/2-f[v]/2+R,Z=Qo(G,F,L),A=!l.arrow&&jr(i)!=null&&F!==Z&&s.reference[v]/2-(F<G?O:P)-f[v]/2<0,H=A?F<G?F-G:F-L:0;return{[g]:h[g]+H,data:{[g]:Z,centerOffset:F-Z-H,...A&&{alignmentOffset:H}},reset:A}}});var jf=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;let{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:f=!0,...m}=Yn(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};let y=xn(i),k=Kt(a),_=xn(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(_||!f?[Ji(a)]:Nf(a)),E=v!=="none";!h&&E&&w.push(...Lf(a,f,v,b));let x=[a,...w],R=await l.detectOverflow(e,m),I=[],O=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&I.push(R[y]),d){let F=Of(i,o,b);I.push(R[F[0]],R[F[1]])}if(O=[...O,{placement:i,overflows:I}],!I.every(F=>F<=0)){var P,G;let F=(((P=s.flip)==null?void 0:P.index)||0)+1,Z=x[F];if(Z&&(!(d==="alignment"?k!==Kt(Z):!1)||O.every(M=>Kt(M.placement)===k?M.overflows[0]>0:!0)))return{data:{index:F,overflows:O},reset:{placement:Z}};let A=(G=O.filter(H=>H.overflows[0]<=0).sort((H,M)=>H.overflows[1]-M.overflows[1])[0])==null?void 0:G.placement;if(!A)switch(g){case"bestFit":{var L;let H=(L=O.filter(M=>{if(E){let V=Kt(M.placement);return V===k||V==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(V=>V>0).reduce((V,de)=>V+de,0)]).sort((M,V)=>M[1]-V[1])[0])==null?void 0:L[0];H&&(A=H);break}case"initialPlacement":A=a;break}if(i!==A)return{reset:{placement:A}}}return{}}}};function Df(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function Hf(n){return Pf.some(e=>n[e]>=0)}var Uf=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){let{rects:t,platform:r}=e,{strategy:i="referenceHidden",...s}=Yn(n,e);switch(i){case"referenceHidden":{let o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=Df(o,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Hf(a)}}}case"escaped":{let o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=Df(o,t.floating);return{data:{escapedOffsets:a,escaped:Hf(a)}}}default:return{}}}}};var Ex=new Set(["left","top"]);async function Cx(n,e){let{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=xn(t),a=jr(t),l=Kt(t)==="y",c=Ex.has(o)?-1:1,u=s&&l?-1:1,d=Yn(e,n),{mainAxis:h,crossAxis:g,alignmentAxis:v}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*u,y:h*c}:{x:h*c,y:g*u}}var zf=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;let{x:i,y:s,placement:o,middlewareData:a}=e,l=await Cx(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},qf=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){let{x:t,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:k,y:_}=y;return{x:k,y:_}}},...c}=Yn(n,e),u={x:t,y:r},d=await s.detectOverflow(e,c),h=Kt(xn(i)),g=Ec(h),v=u[g],f=u[h];if(o){let y=g==="y"?"top":"left",k=g==="y"?"bottom":"right",_=v+d[y],b=v-d[k];v=Qo(_,v,b)}if(a){let y=h==="y"?"top":"left",k=h==="y"?"bottom":"right",_=f+d[y],b=f-d[k];f=Qo(_,f,b)}let m=l.fn({...e,[g]:v,[h]:f});return{...m,data:{x:m.x-t,y:m.y-r,enabled:{[g]:o,[h]:a}}}}}};function ta(){return typeof window<"u"}function Qn(n){return Gf(n)?(n.nodeName||"").toLowerCase():"#document"}function nt(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Rt(n){var e;return(e=(Gf(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Gf(n){return ta()?n instanceof Node||n instanceof nt(n).Node:!1}function ft(n){return ta()?n instanceof Element||n instanceof nt(n).Element:!1}function Tt(n){return ta()?n instanceof HTMLElement||n instanceof nt(n).HTMLElement:!1}function Zf(n){return!ta()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof nt(n).ShadowRoot}var Ax=new Set(["inline","contents"]);function zr(n){let{overflow:e,overflowX:t,overflowY:r,display:i}=gt(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!Ax.has(i)}var Rx=new Set(["table","td","th"]);function Kf(n){return Rx.has(Qn(n))}var Tx=[":popover-open",":modal"];function ns(n){return Tx.some(e=>{try{return n.matches(e)}catch{return!1}})}var Ix=["transform","translate","scale","rotate","perspective"],$x=["transform","translate","scale","rotate","perspective","filter"],Mx=["paint","layout","strict","content"];function na(n){let e=ra(),t=ft(n)?gt(n):n;return Ix.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||$x.some(r=>(t.willChange||"").includes(r))||Mx.some(r=>(t.contain||"").includes(r))}function Yf(n){let e=Yt(n);for(;Tt(e)&&!Jn(e);){if(na(e))return e;if(ns(e))return null;e=Yt(e)}return null}function ra(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var Px=new Set(["html","body","#document"]);function Jn(n){return Px.has(Qn(n))}function gt(n){return nt(n).getComputedStyle(n)}function rs(n){return ft(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Yt(n){if(Qn(n)==="html")return n;let e=n.assignedSlot||n.parentNode||Zf(n)&&n.host||Rt(n);return Zf(e)?e.host:e}function Xf(n){let e=Yt(n);return Jn(e)?n.ownerDocument?n.ownerDocument.body:n.body:Tt(e)&&zr(e)?e:Xf(e)}function Ur(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);let i=Xf(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=nt(i);if(s){let a=ia(o);return e.concat(o,o.visualViewport||[],zr(i)?i:[],a&&t?Ur(a):[])}return e.concat(i,Ur(i,[],t))}function ia(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function tg(n){let e=gt(n),t=parseFloat(e.width)||0,r=parseFloat(e.height)||0,i=Tt(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,a=es(t)!==s||es(r)!==o;return a&&(t=s,r=o),{width:t,height:r,$:a}}function Rc(n){return ft(n)?n:n.contextElement}function qr(n){let e=Rc(n);if(!Tt(e))return At(1);let t=e.getBoundingClientRect(),{width:r,height:i,$:s}=tg(e),o=(s?es(t.width):t.width)/r,a=(s?es(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var Ox=At(0);function ng(n){let e=nt(n);return!ra()||!e.visualViewport?Ox:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Nx(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==nt(n)?!1:e}function er(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);let i=n.getBoundingClientRect(),s=Rc(n),o=At(1);e&&(r?ft(r)&&(o=qr(r)):o=qr(n));let a=Nx(s,t,r)?ng(s):At(0),l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s){let h=nt(s),g=r&&ft(r)?nt(r):r,v=h,f=ia(v);for(;f&&r&&g!==v;){let m=qr(f),y=f.getBoundingClientRect(),k=gt(f),_=y.left+(f.clientLeft+parseFloat(k.paddingLeft))*m.x,b=y.top+(f.clientTop+parseFloat(k.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,d*=m.y,l+=_,c+=b,v=nt(f),f=ia(v)}}return Xn({width:u,height:d,x:l,y:c})}function sa(n,e){let t=rs(n).scrollLeft;return e?e.left+t:er(Rt(n)).left+t}function rg(n,e){let t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-sa(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function Lx(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n,s=i==="fixed",o=Rt(r),a=e?ns(e.floating):!1;if(r===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=At(1),u=At(0),d=Tt(r);if((d||!d&&!s)&&((Qn(r)!=="body"||zr(o))&&(l=rs(r)),Tt(r))){let g=er(r);c=qr(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}let h=o&&!d&&!s?rg(o,l):At(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:t.y*c.y-l.scrollTop*c.y+u.y+h.y}}function Fx(n){return Array.from(n.getClientRects())}function Dx(n){let e=Rt(n),t=rs(n),r=n.ownerDocument.body,i=Gt(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Gt(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),o=-t.scrollLeft+sa(n),a=-t.scrollTop;return gt(r).direction==="rtl"&&(o+=Gt(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}var Qf=25;function Hx(n,e){let t=nt(n),r=Rt(n),i=t.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;let u=ra();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=sa(r);if(c<=0){let u=r.ownerDocument,d=u.body,h=getComputedStyle(d),g=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(r.clientWidth-d.clientWidth-g);v<=Qf&&(s-=v)}else c<=Qf&&(s+=c);return{width:s,height:o,x:a,y:l}}var Bx=new Set(["absolute","fixed"]);function Vx(n,e){let t=er(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=Tt(n)?qr(n):At(1),o=n.clientWidth*s.x,a=n.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function Jf(n,e,t){let r;if(e==="viewport")r=Hx(n,t);else if(e==="document")r=Dx(Rt(n));else if(ft(e))r=Vx(e,t);else{let i=ng(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Xn(r)}function ig(n,e){let t=Yt(n);return t===e||!ft(t)||Jn(t)?!1:gt(t).position==="fixed"||ig(t,e)}function Wx(n,e){let t=e.get(n);if(t)return t;let r=Ur(n,[],!1).filter(a=>ft(a)&&Qn(a)!=="body"),i=null,s=gt(n).position==="fixed",o=s?Yt(n):n;for(;ft(o)&&!Jn(o);){let a=gt(o),l=na(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&Bx.has(i.position)||zr(o)&&!l&&ig(n,o))?r=r.filter(u=>u!==o):i=a,o=Yt(o)}return e.set(n,r),r}function jx(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n,o=[...t==="clippingAncestors"?ns(e)?[]:Wx(e,this._c):[].concat(t),r],a=o[0],l=o.reduce((c,u)=>{let d=Jf(e,u,i);return c.top=Gt(d.top,c.top),c.right=_n(d.right,c.right),c.bottom=_n(d.bottom,c.bottom),c.left=Gt(d.left,c.left),c},Jf(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Ux(n){let{width:e,height:t}=tg(n);return{width:e,height:t}}function zx(n,e,t){let r=Tt(e),i=Rt(e),s=t==="fixed",o=er(n,!0,s,e),a={scrollLeft:0,scrollTop:0},l=At(0);function c(){l.x=sa(i)}if(r||!r&&!s)if((Qn(e)!=="body"||zr(i))&&(a=rs(e)),r){let g=er(e,!0,s,e);l.x=g.x+e.clientLeft,l.y=g.y+e.clientTop}else i&&c();s&&!r&&i&&c();let u=i&&!r&&!s?rg(i,a):At(0),d=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:d,y:h,width:o.width,height:o.height}}function Ac(n){return gt(n).position==="static"}function eg(n,e){if(!Tt(n)||gt(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Rt(n)===t&&(t=t.ownerDocument.body),t}function sg(n,e){let t=nt(n);if(ns(n))return t;if(!Tt(n)){let i=Yt(n);for(;i&&!Jn(i);){if(ft(i)&&!Ac(i))return i;i=Yt(i)}return t}let r=eg(n,e);for(;r&&Kf(r)&&Ac(r);)r=eg(r,e);return r&&Jn(r)&&Ac(r)&&!na(r)?t:r||Yf(n)||t}var qx=async function(n){let e=this.getOffsetParent||sg,t=this.getDimensions,r=await t(n.floating);return{reference:zx(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zx(n){return gt(n).direction==="rtl"}var Gx={convertOffsetParentRelativeRectToViewportRelativeRect:Lx,getDocumentElement:Rt,getClippingRect:jx,getOffsetParent:sg,getElementRects:qx,getClientRects:Fx,getDimensions:Ux,getScale:qr,isElement:ft,isRTL:Zx};function og(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function Kx(n,e){let t=null,r,i=Rt(n);function s(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();let c=n.getBoundingClientRect(),{left:u,top:d,width:h,height:g}=c;if(a||e(),!h||!g)return;let v=ts(d),f=ts(i.clientWidth-(u+h)),m=ts(i.clientHeight-(d+g)),y=ts(u),_={rootMargin:-v+"px "+-f+"px "+-m+"px "+-y+"px",threshold:Gt(0,_n(1,l))||1},b=!0;function w(E){let x=E[0].intersectionRatio;if(x!==l){if(!b)return o();x?o(!1,x):r=setTimeout(()=>{o(!1,1e-7)},1e3)}x===1&&!og(c,n.getBoundingClientRect())&&o(),b=!1}try{t=new IntersectionObserver(w,{..._,root:i.ownerDocument})}catch{t=new IntersectionObserver(w,_)}t.observe(n)}return o(!0),s}function Zr(n,e,t,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Rc(n),u=i||s?[...c?Ur(c):[],...Ur(e)]:[];u.forEach(y=>{i&&y.addEventListener("scroll",t,{passive:!0}),s&&y.addEventListener("resize",t)});let d=c&&a?Kx(c,t):null,h=-1,g=null;o&&(g=new ResizeObserver(y=>{let[k]=y;k&&k.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var _;(_=g)==null||_.observe(e)})),t()}),c&&!l&&g.observe(c),g.observe(e));let v,f=l?er(n):null;l&&m();function m(){let y=er(n);f&&!og(f,y)&&t(),f=y,v=requestAnimationFrame(m)}return t(),()=>{var y;u.forEach(k=>{i&&k.removeEventListener("scroll",t),s&&k.removeEventListener("resize",t)}),d?.(),(y=g)==null||y.disconnect(),g=null,l&&cancelAnimationFrame(v)}}var Gr=zf;var Kr=qf,Yr=jf;var oa=Uf,aa=Wf;var Xr=(n,e,t)=>{let r=new Map,i={platform:Gx,...t},s={...i.platform,_c:r};return Vf(n,e,{...i,platform:s})};function Yx(n){let e=n.getBoundingClientRect(),t=window.innerWidth,r=window.innerHeight;if(!(e.width>t*.8||e.height>r*.8))return n;let s=Math.max(e.left,0),o=Math.max(e.top,0),a=Math.min(e.right,t),l=Math.min(e.bottom,r),c=(s+a)/2,u=(o+l)/2;return{getBoundingClientRect(){return{width:0,height:0,x:c,y:u,top:u,left:c,right:c,bottom:u}}}}function ag(n,e,t){if(!t.trigger||t.trigger==="immediate"){let f=n.getBoundingClientRect();f.width>window.innerWidth*.8||f.height>window.innerHeight*.8||n.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}let r=document.createElement("div");if(r.className="syntro-tooltip",r.setAttribute("role","tooltip"),r.innerHTML=at(t.html),!t.trigger||t.trigger==="immediate"){let f=document.createElement("button");f.className="syntro-tooltip-close",f.setAttribute("aria-label","Close"),f.textContent="\xD7",Object.assign(f.style,{position:"absolute",top:"4px",right:"4px",background:"none",border:"none",color:"inherit",fontSize:"16px",lineHeight:"1",cursor:"pointer",opacity:"0.6",padding:"2px 4px"}),f.addEventListener("mouseenter",()=>{f.style.opacity="1"}),f.addEventListener("mouseleave",()=>{f.style.opacity="0.6"}),f.addEventListener("click",()=>v.destroy()),r.style.position="relative",r.appendChild(f)}let i=r.querySelectorAll("[data-syntro-action]"),s=f=>{let y=f.currentTarget.getAttribute("data-syntro-action");y&&t.onAction&&t.onAction(y)};i.forEach(f=>f.addEventListener("click",s));let o=document.createElement("div");o.className="syntro-tooltip-arrow",r.appendChild(o),e.appendChild(r);let a=[Gr(t.offsetPx??8),Yr(),Kr({padding:8}),oa(),aa({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=Zr(n,r,async()=>{if(!n.isConnected){v.destroy();return}let f=Yx(n),m=await Xr(f,r,{placement:l,strategy:"fixed",middleware:a}),{x:y,y:k,strategy:_,middlewareData:b,placement:w}=m;if(Object.assign(r.style,{left:`${y}px`,top:`${k}px`,position:_}),b.arrow){let{x:E,y:x}=b.arrow,R=w.split("-")[0],I={top:"bottom",right:"left",bottom:"top",left:"right"};Object.assign(o.style,{left:E!=null?`${E}px`:"",top:x!=null?`${x}px`:"",right:"",bottom:"",[I[R]]:"-4px"});let O={top:"0deg",right:"90deg",bottom:"180deg",left:"270deg"};o.style.transform=`rotate(${O[R]||"0deg"})`}}),u=f=>{f.key==="Escape"&&v.destroy()};window.addEventListener("keydown",u);let d=[];if(t.blocking){Array.from(document.body.children).forEach(m=>{m!==e&&m.getAttribute("inert")===null&&(m.setAttribute("inert",""),d.push(m.id||m.tagName))});let f=Array.from(r.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(f.length>0){let m=f[0],y=f[f.length-1],k=_=>{_.key==="Tab"&&(_.shiftKey?document.activeElement===m&&(y.focus(),_.preventDefault()):document.activeElement===y&&(m.focus(),_.preventDefault()))};r.addEventListener("keydown",k),requestAnimationFrame(()=>m.focus())}}let g=(()=>{if(t.trigger==="hover"){let f=null,m=()=>{f&&(clearTimeout(f),f=null),r.style.visibility="visible",r.style.opacity="1"},y=()=>{f=setTimeout(()=>{r.style.visibility="hidden",r.style.opacity="0",f=null},100)};return r.style.visibility="hidden",r.style.opacity="0",r.style.transition="opacity 200ms ease, visibility 200ms",n.addEventListener("mouseenter",m),n.addEventListener("mouseleave",y),r.addEventListener("mouseenter",m),r.addEventListener("mouseleave",y),n.addEventListener("focus",m),n.addEventListener("blur",y),()=>{f&&clearTimeout(f),n.removeEventListener("mouseenter",m),n.removeEventListener("mouseleave",y),r.removeEventListener("mouseenter",m),r.removeEventListener("mouseleave",y),n.removeEventListener("focus",m),n.removeEventListener("blur",y)}}if(t.trigger==="click"){let f=()=>{r.style.visibility==="visible"?v.destroy():(r.style.visibility="visible",r.style.opacity="1")};return r.style.visibility="hidden",r.style.opacity="0",r.style.transition="opacity 200ms ease, visibility 200ms",n.addEventListener("click",f),()=>n.removeEventListener("click",f)}return r.style.opacity="0",r.style.transition="opacity 200ms ease",requestAnimationFrame(()=>{r.style.opacity="1"}),()=>{}})(),v={el:r,destroy(){c(),g(),window.removeEventListener("keydown",u),i.forEach(f=>f.removeEventListener("click",s)),t.blocking&&Array.from(document.body.children).forEach(f=>{f!==e&&f.removeAttribute("inert")}),r.style.pointerEvents="none",r.style.opacity="0",setTimeout(()=>{try{r.remove()}catch{}},200)}};return v}var rw=Wr(Tc(),1),Qr=Wr(Ic(),1),iw=Wr($c(),1);var dg=Wr(Tc(),1);var la=globalThis,ca=la.ShadowRoot&&(la.ShadyCSS===void 0||la.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Mc=Symbol(),pg=new WeakMap,is=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Mc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ca&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=pg.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&pg.set(t,e))}return e}toString(){return this.cssText}},hg=n=>new is(typeof n=="string"?n:n+"",void 0,Mc),tr=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,s)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[s+1],n[0]);return new is(t,n,Mc)},fg=(n,e)=>{if(ca)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=la.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},Pc=ca?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return hg(t)})(n):n;var{is:sw,defineProperty:ow,getOwnPropertyDescriptor:aw,getOwnPropertyNames:lw,getOwnPropertySymbols:cw,getPrototypeOf:uw}=Object,wn=globalThis,gg=wn.trustedTypes,dw=gg?gg.emptyScript:"",pw=wn.reactiveElementPolyfillSupport,ss=(n,e)=>n,Oc={toAttribute(n,e){switch(e){case Boolean:n=n?dw:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},vg=(n,e)=>!sw(n,e),mg={attribute:!0,type:String,converter:Oc,reflect:!1,useDefault:!1,hasChanged:vg};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),wn.litPropertyMetadata??(wn.litPropertyMetadata=new WeakMap);var Xt=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=mg){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&ow(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:s}=aw(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){let a=i?.call(this);s?.call(this,o),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??mg}static _$Ei(){if(this.hasOwnProperty(ss("elementProperties")))return;let e=uw(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ss("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ss("properties"))){let t=this.properties,r=[...lw(t),...cw(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(Pc(i))}else e!==void 0&&t.push(Pc(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return fg(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let s=(r.converter?.toAttribute!==void 0?r.converter:Oc).toAttribute(t,r.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let s=r.getPropertyOptions(i),o=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Oc;this._$Em=i;let a=o.fromAttribute(t,s.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,r,i=!1,s){if(e!==void 0){let o=this.constructor;if(i===!1&&(s=this[e]),r??(r=o.getPropertyOptions(e)),!((r.hasChanged??vg)(s,t)||r.useDefault&&r.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:s},o){r&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??t??this[e]),s!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,s]of r){let{wrapped:o}=s,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,s,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};Xt.elementStyles=[],Xt.shadowRootOptions={mode:"open"},Xt[ss("elementProperties")]=new Map,Xt[ss("finalized")]=new Map,pw?.({ReactiveElement:Xt}),(wn.reactiveElementVersions??(wn.reactiveElementVersions=[])).push("2.1.2");var as=globalThis,yg=n=>n,ua=as.trustedTypes,bg=ua?ua.createPolicy("lit-html",{createHTML:n=>n}):void 0,Eg="$lit$",kn=`lit$${Math.random().toFixed(9).slice(2)}$`,Cg="?"+kn,hw=`<${Cg}>`,ir=document,ls=()=>ir.createComment(""),cs=n=>n===null||typeof n!="object"&&typeof n!="function",Vc=Array.isArray,fw=n=>Vc(n)||typeof n?.[Symbol.iterator]=="function",Nc=`[
|
|
55
|
-
\f\r]`,
|
|
56
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),wg=/'/g,kg=/"/g,Ag=/^(?:script|style|textarea|title)$/i,Wc=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),D=Wc(1),V2=Wc(2),W2=Wc(3),It=Symbol.for("lit-noChange"),Q=Symbol.for("lit-nothing"),Sg=new WeakMap,rr=ir.createTreeWalker(ir,129);function Rg(n,e){if(!Vc(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return bg!==void 0?bg.createHTML(e):e}var gw=(n,e)=>{let t=n.length-1,r=[],i,s=e===2?"<svg>":e===3?"<math>":"",o=os;for(let a=0;a<t;a++){let l=n[a],c,u,d=-1,h=0;for(;h<l.length&&(o.lastIndex=h,u=o.exec(l),u!==null);)h=o.lastIndex,o===os?u[1]==="!--"?o=_g:u[1]!==void 0?o=xg:u[2]!==void 0?(Ag.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=nr):u[3]!==void 0&&(o=nr):o===nr?u[0]===">"?(o=i??os,d=-1):u[1]===void 0?d=-2:(d=o.lastIndex-u[2].length,c=u[1],o=u[3]===void 0?nr:u[3]==='"'?kg:wg):o===kg||o===wg?o=nr:o===_g||o===xg?o=os:(o=nr,i=void 0);let g=o===nr&&n[a+1].startsWith("/>")?" ":"";s+=o===os?l+hw:d>=0?(r.push(c),l.slice(0,d)+Eg+l.slice(d)+kn+g):l+kn+(d===-2?a:g)}return[Rg(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},us=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0,a=e.length-1,l=this.parts,[c,u]=gw(e,t);if(this.el=n.createElement(c,r),rr.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=rr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(Eg)){let h=u[o++],g=i.getAttribute(d).split(kn),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:v[2],strings:g,ctor:v[1]==="."?Fc:v[1]==="?"?Dc:v[1]==="@"?Hc:ei}),i.removeAttribute(d)}else d.startsWith(kn)&&(l.push({type:6,index:s}),i.removeAttribute(d));if(Ag.test(i.tagName)){let d=i.textContent.split(kn),h=d.length-1;if(h>0){i.textContent=ua?ua.emptyScript:"";for(let g=0;g<h;g++)i.append(d[g],ls()),rr.nextNode(),l.push({type:2,index:++s});i.append(d[h],ls())}}}else if(i.nodeType===8)if(i.data===Cg)l.push({type:2,index:s});else{let d=-1;for(;(d=i.data.indexOf(kn,d+1))!==-1;)l.push({type:7,index:s}),d+=kn.length-1}s++}}static createElement(e,t){let r=ir.createElement("template");return r.innerHTML=e,r}};function Jr(n,e,t=n,r){if(e===It)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,s=cs(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=i:t._$Cl=i),i!==void 0&&(e=Jr(n,i._$AS(n,e.values),i,r)),e}var Lc=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??ir).importNode(t,!0);rr.currentNode=i;let s=rr.nextNode(),o=0,a=0,l=r[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new ds(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new Bc(s,this,e)),this._$AV.push(c),l=r[++a]}o!==l?.index&&(s=rr.nextNode(),o++)}return rr.currentNode=ir,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},ds=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=Q,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Jr(this,e,t),cs(e)?e===Q||e==null||e===""?(this._$AH!==Q&&this._$AR(),this._$AH=Q):e!==this._$AH&&e!==It&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):fw(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Q&&cs(this._$AH)?this._$AA.nextSibling.data=e:this.T(ir.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=us.createElement(Rg(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let s=new Lc(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=Sg.get(e.strings);return t===void 0&&Sg.set(e.strings,t=new us(e)),t}k(e){Vc(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let s of e)i===t.length?t.push(r=new n(this.O(ls()),this.O(ls()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=yg(e).nextSibling;yg(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ei=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=Q,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Q}_$AI(e,t=this,r,i){let s=this.strings,o=!1;if(s===void 0)e=Jr(this,e,t,0),o=!cs(e)||e!==this._$AH&&e!==It,o&&(this._$AH=e);else{let a=e,l,c;for(e=s[0],l=0;l<s.length-1;l++)c=Jr(this,a[r+l],t,l),c===It&&(c=this._$AH[l]),o||(o=!cs(c)||c!==this._$AH[l]),c===Q?e=Q:e!==Q&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===Q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Fc=class extends ei{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Q?void 0:e}},Dc=class extends ei{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Q)}},Hc=class extends ei{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=Jr(this,e,t,0)??Q)===It)return;let r=this._$AH,i=e===Q&&r!==Q||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==Q&&(r===Q||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Bc=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Jr(this,e)}};var mw=as.litHtmlPolyfillSupport;mw?.(us,ds),(as.litHtmlVersions??(as.litHtmlVersions=[])).push("3.3.2");var Tg=(n,e,t)=>{let r=t?.renderBefore??e,i=r._$litPart$;if(i===void 0){let s=t?.renderBefore??null;r._$litPart$=i=new ds(e.insertBefore(ls(),s),s,void 0,t??{})}return i._$AI(n),i};var ps=globalThis,he=class extends Xt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;let e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Tg(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return It}};he._$litElement$=!0,he.finalized=!0,ps.litElementHydrateSupport?.({LitElement:he});var vw=ps.litElementPolyfillSupport;vw?.({LitElement:he});(ps.litElementVersions??(ps.litElementVersions=[])).push("4.2.2");var da={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},pa=n=>(...e)=>({_$litDirective$:n,values:e}),ti=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var Ig="important",yw=" !"+Ig,T=pa(class extends ti{constructor(n){if(super(n),n.type!==da.ATTRIBUTE||n.name!=="style"||n.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];return r==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(n,[e]){let{style:t}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let r of this.ft)e[r]==null&&(this.ft.delete(r),r.includes("-")?t.removeProperty(r):t[r]=null);for(let r in e){let i=e[r];if(i!=null){this.ft.add(r);let s=typeof i=="string"&&i.endsWith(yw);r.includes("-")||s?t.setProperty(r,s?i.slice(0,-11):i,s?Ig:""):t[r]=i}}return It}});var Sn=function(n,e,t,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(n,t):i?i.value=t:e.set(n,t),t},Ne=function(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)},hs,fs,ni,Qt,gs,ha,ri,$g="#1969fe",bw="#24ad32",_w="#0e1114",jc="#677384",xw="#a8afba",Mg="#f6f7f9",ww="#ffffff";function Pg(n){let e=document.createElement("div");e.setAttribute("data-testid","workflow-toast"),Object.assign(e.style,{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483646",padding:"12px 16px",borderRadius:"8px",backgroundColor:`var(--se-color-bg-surface, ${ww})`,color:`var(--se-color-text-primary, ${_w})`,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",maxWidth:"320px",fontFamily:"var(--se-font-family, system-ui, sans-serif)",fontSize:"14px",lineHeight:"1.4",transition:"opacity 0.3s ease"});let t=document.createElement("div");if(t.style.fontWeight="600",t.textContent=n.title,e.appendChild(t),n.body){let s=document.createElement("div");s.style.marginTop="4px",s.style.fontSize="13px",s.style.color="var(--se-color-text-secondary, #666)",s.textContent=n.body,e.appendChild(s)}document.body.appendChild(e);let r,i=setTimeout(()=>{e.style.opacity="0",r=setTimeout(()=>{e.remove()},300)},4e3);return()=>{clearTimeout(i),clearTimeout(r),e.remove()}}function kw(n){let e=new Map;for(let t of n){let r=t.action;if(r.kind==="overlays:tour"&&r.workflow&&r.tourId){let i=r.workflow,o=(r.steps||[]).map(a=>({id:a.id,title:i.stepTitles?.[a.id]||a.id}));e.set(r.tourId,{meta:i,steps:o})}}return e}var Og="syntro-workflow-tracker",fa=class extends he{constructor(){super(...arguments),this.runtimeRef=null,this._workflowEntries=[],this._actionVersion=0,hs.set(this,null),fs.set(this,null),ni.set(this,[]),Qt.set(this,new Set),gs.set(this,{}),ha.set(this,!1),ri.set(this,new Map)}createRenderRoot(){return this}get _stateNs(){return this.runtimeRef?.state?.user?.ns?.("workflows")??null}_rescanWorkflows(){let e=this.runtimeRef?.actions?.getActive?.()??[],t=kw(e);if(Sn(this,ri,t,"f"),t.size===0)return;let r=this._stateNs,i=r?.get("dismissed")??[],s=r?.get("completed")??{};this._workflowEntries=(()=>{let o=new Set(this._workflowEntries.map(l=>l.tourId)),a=[];for(let[l,{meta:c,steps:u}]of t){if(o.has(l))continue;let d="active";i.includes(l)?d="dismissed":s[l]&&(d="completed"),a.push({tourId:l,meta:c,steps:u,currentStepId:null,completedSteps:[],status:d,completedAt:s[l]||void 0})}return a.length>0?[...this._workflowEntries,...a]:this._workflowEntries})();for(let[o,{meta:a}]of t){let l=r?.get("dismissed")??[],c=r?.get("completed")??{};if(!Ne(this,Qt,"f").has(o)&&a.notification&&!l.includes(o)&&!c[o]){Ne(this,Qt,"f").add(o),r?.set("notified",[...Ne(this,Qt,"f")]);let u=Pg(a.notification);Ne(this,ni,"f").push(u)}}}connectedCallback(){super.connectedCallback(),this._initSubscriptions()}disconnectedCallback(){super.disconnectedCallback(),this._teardownSubscriptions();for(let e of Ne(this,ni,"f"))e();Sn(this,ni,[],"f")}updated(e){e.has("runtimeRef")&&(this._teardownSubscriptions(),this._initSubscriptions()),e.has("_actionVersion")&&this._rescanWorkflows()}_initSubscriptions(){if(this.runtimeRef?.events?.subscribe){if(!Ne(this,ha,"f")&&this._stateNs){let e=this._stateNs.get("notified")??[];for(let r of e)Ne(this,Qt,"f").add(r);let t=this._stateNs.get("completed")??{};Sn(this,gs,{...t},"f"),Sn(this,ha,!0,"f")}Sn(this,hs,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1}),"f"),Sn(this,fs,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},e=>{this._handleTourEvent(e)}),"f"),this._rescanWorkflows()}}_teardownSubscriptions(){Ne(this,hs,"f")?.call(this),Sn(this,hs,null,"f"),Ne(this,fs,"f")?.call(this),Sn(this,fs,null,"f")}_handleTourEvent(e){let t=e.props?.tourId;if(!t)return;if(!Ne(this,ri,"f").has(t)&&e.name==="tour.started"){this._actionVersion+=1;return}if(!Ne(this,ri,"f").has(t))return;let r=this._stateNs;this._workflowEntries=this._workflowEntries.map(i=>{if(i.tourId!==t)return i;switch(e.name){case"tour.started":{let s=e.props?.startStepId||i.steps[0]?.id||null;if(!Ne(this,Qt,"f").has(t)){Ne(this,Qt,"f").add(t),r?.set("notified",[...Ne(this,Qt,"f")]);let a=Ne(this,ri,"f").get(t);if(a?.meta.notification){let l=Pg(a.meta.notification);Ne(this,ni,"f").push(l)}}let o=this._workflowEntries.filter(a=>a.status==="active"||a.tourId===t).map(a=>a.tourId);return o.includes(t)||o.push(t),r?.set("active",[...new Set(o)]),{...i,status:"active",currentStepId:s,completedSteps:i.status==="active"?i.completedSteps:[]}}case"tour.step_started":{let s=e.props?.stepId;return{...i,currentStepId:s||i.currentStepId}}case"tour.step_changed":{let s=e.props?.previousStepId,o=e.props?.nextStepId,a=s&&!i.completedSteps.includes(s)?[...i.completedSteps,s]:i.completedSteps;return{...i,currentStepId:o||i.currentStepId,completedSteps:a}}case"tour.completed":{let s=Date.now();return Ne(this,gs,"f")[t]=s,r?.set("completed",{...Ne(this,gs,"f")}),{...i,status:"completed",currentStepId:null,completedSteps:i.steps.map(o=>o.id),completedAt:s}}case"tour.paused":return i;default:return i}})}_handleStepClick(e,t){this.runtimeRef?.events?.publish("workflow:jump_to_step",{tourId:e,stepId:t}),this.dispatchEvent(new CustomEvent("workflow-step-click",{bubbles:!0,detail:{tourId:e,stepId:t}}))}_handleDismiss(e){this._workflowEntries=this._workflowEntries.map(r=>r.tourId===e?{...r,status:"dismissed"}:r);let t=this._workflowEntries.filter(r=>r.status==="dismissed").map(r=>r.tourId);this._stateNs?.set("dismissed",t),this.dispatchEvent(new CustomEvent("workflow-dismissed",{bubbles:!0,detail:{tourId:e}}))}_renderProgressBar(e,t){let r=t>0?Math.round(e/t*100):0,i={width:"100%",height:"6px",borderRadius:"9999px",background:"rgba(255,255,255,0.08)",overflow:"hidden"},s={height:"100%",borderRadius:"9999px",background:`var(--se-color-primary, ${$g})`,transition:"width 0.3s ease",width:`${r}%`};return D`
|
|
54
|
+
`}d+="</div>"}c.innerHTML=d,e.overlayRoot.appendChild(c);let h=null,g=c.querySelectorAll("[data-syntro-action]"),v=x=>{let w=x.currentTarget.getAttribute("data-syntro-action");w&&(h=w,e.publishEvent("action.modal_cta_clicked",{actionId:w}),b.destroy())};g.forEach(x=>x.addEventListener("click",v));let f=x=>{x.key==="Escape"&&o?.onEsc!==!1&&b.destroy()};window.addEventListener("keydown",f);let m=()=>{i||b.destroy()};l.addEventListener("click",m);let y=[];i&&Array.from(document.body.children).forEach(x=>{x!==e.overlayRoot&&x.getAttribute("inert")===null&&!x.querySelector("[data-syntro-editor-panel]")&&!x.hasAttribute("data-syntro-editor-panel")&&(x.setAttribute("inert",""),y.push(x))});let k;o?.timeoutMs&&(k=setTimeout(()=>{b.destroy()},o.timeoutMs));let _=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');_.length>0&&requestAnimationFrame(()=>_[0].focus()),requestAnimationFrame(()=>{l.style.opacity="1",c.style.opacity="1",c.style.transform="translate(-50%, -50%) scale(1)"}),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:modal",size:r,blocking:i});let b={destroy(){k&&clearTimeout(k),window.removeEventListener("keydown",f),l.removeEventListener("click",m),g.forEach(x=>x.removeEventListener("click",v)),y.forEach(x=>x.removeAttribute("inert")),c.style.pointerEvents="none",l.style.pointerEvents="none",c.style.opacity="0",c.style.transform="translate(-50%, -50%) scale(0.95)",l.style.opacity="0",setTimeout(()=>{try{c.remove()}catch{}try{l.remove()}catch{}},200),e.publishEvent("action.modal_dismissed",{actionClicked:h})}};return{cleanup:()=>{b.destroy()}}};var Df=["top","right","bottom","left"];var _n=Math.min,Yt=Math.max,ts=Math.round,ns=Math.floor,Rt=n=>({x:n,y:n}),kx={left:"right",right:"left",bottom:"top",top:"bottom"},Sx={start:"end",end:"start"};function Qo(n,e,t){return Yt(n,_n(e,t))}function Yn(n,e){return typeof n=="function"?n(e):n}function xn(n){return n.split("-")[0]}function jr(n){return n.split("-")[1]}function Tc(n){return n==="x"?"y":"x"}function ea(n){return n==="y"?"height":"width"}var Ex=new Set(["top","bottom"]);function Xt(n){return Ex.has(xn(n))?"y":"x"}function ta(n){return Tc(Xt(n))}function Hf(n,e,t){t===void 0&&(t=!1);let r=jr(n),i=ta(n),s=ea(i),o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=es(o)),[o,es(o)]}function Bf(n){let e=es(n);return[Jo(n),e,Jo(e)]}function Jo(n){return n.replace(/start|end/g,e=>Sx[e])}var Lf=["left","right"],Ff=["right","left"],Cx=["top","bottom"],Ax=["bottom","top"];function Rx(n,e,t){switch(n){case"top":case"bottom":return t?e?Ff:Lf:e?Lf:Ff;case"left":case"right":return e?Cx:Ax;default:return[]}}function Vf(n,e,t,r){let i=jr(n),s=Rx(xn(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Jo)))),s}function es(n){return n.replace(/left|right|bottom|top/g,e=>kx[e])}function Tx(n){return{top:0,right:0,bottom:0,left:0,...n}}function Ic(n){return typeof n!="number"?Tx(n):{top:n,right:n,bottom:n,left:n}}function Xn(n){let{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}function Wf(n,e,t){let{reference:r,floating:i}=n,s=Xt(e),o=ta(e),a=ea(o),l=xn(e),c=s==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2,g;switch(l){case"top":g={x:u,y:r.y-i.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:d};break;case"left":g={x:r.x-i.width,y:d};break;default:g={x:r.x,y:r.y}}switch(jr(e)){case"start":g[o]-=h*(t&&c?-1:1);break;case"end":g[o]+=h*(t&&c?-1:1);break}return g}async function zf(n,e){var t;e===void 0&&(e={});let{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:g=0}=Yn(e,n),v=Ic(g),m=a[h?d==="floating"?"reference":"floating":d],y=Xn(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(m)))==null||t?m:m.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),k=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),b=await(s.isElement==null?void 0:s.isElement(_))?await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1}:{x:1,y:1},x=Xn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:k,offsetParent:_,strategy:l}):k);return{top:(y.top-x.top+v.top)/b.y,bottom:(x.bottom-y.bottom+v.bottom)/b.y,left:(y.left-x.left+v.left)/b.x,right:(x.right-y.right+v.right)/b.x}}var qf=async(n,e,t)=>{let{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e)),c=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:u,y:d}=Wf(c,r,l),h=r,g={},v=0;for(let m=0;m<a.length;m++){var f;let{name:y,fn:k}=a[m],{x:_,y:b,data:x,reset:R}=await k({x:u,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:g,rects:c,platform:{...o,detectOverflow:(f=o.detectOverflow)!=null?f:zf},elements:{reference:n,floating:e}});u=_??u,d=b??d,g={...g,[y]:{...g[y],...x}},R&&v<=50&&(v++,typeof R=="object"&&(R.placement&&(h=R.placement),R.rects&&(c=R.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):R.rects),{x:u,y:d}=Wf(c,h,l)),m=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:g}},Zf=n=>({name:"arrow",options:n,async fn(e){let{x:t,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Yn(n,e)||{};if(c==null)return{};let d=Ic(u),h={x:t,y:r},g=ta(i),v=ea(g),f=await o.getDimensions(c),m=g==="y",y=m?"top":"left",k=m?"bottom":"right",_=m?"clientHeight":"clientWidth",b=s.reference[v]+s.reference[g]-h[g]-s.floating[v],x=h[g]-s.reference[g],R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c)),w=R?R[_]:0;(!w||!await(o.isElement==null?void 0:o.isElement(R)))&&(w=a.floating[_]||s.floating[v]);let E=b/2-x/2,$=w/2-f[v]/2-1,P=_n(d[y],$),M=_n(d[k],$),G=P,L=w-f[v]-M,N=w/2-f[v]/2+E,z=Qo(G,N,L),H=!l.arrow&&jr(i)!=null&&N!==z&&s.reference[v]/2-(N<G?P:M)-f[v]/2<0,oe=H?N<G?N-G:N-L:0;return{[g]:h[g]+oe,data:{[g]:z,centerOffset:N-z-oe,...H&&{alignmentOffset:oe}},reset:H}}});var Gf=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;let{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:f=!0,...m}=Yn(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};let y=xn(i),k=Xt(a),_=xn(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),x=h||(_||!f?[es(a)]:Bf(a)),R=v!=="none";!h&&R&&x.push(...Vf(a,f,v,b));let w=[a,...x],E=await l.detectOverflow(e,m),$=[],P=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&$.push(E[y]),d){let N=Hf(i,o,b);$.push(E[N[0]],E[N[1]])}if(P=[...P,{placement:i,overflows:$}],!$.every(N=>N<=0)){var M,G;let N=(((M=s.flip)==null?void 0:M.index)||0)+1,z=w[N];if(z&&(!(d==="alignment"?k!==Xt(z):!1)||P.every(A=>Xt(A.placement)===k?A.overflows[0]>0:!0)))return{data:{index:N,overflows:P},reset:{placement:z}};let H=(G=P.filter(oe=>oe.overflows[0]<=0).sort((oe,A)=>oe.overflows[1]-A.overflows[1])[0])==null?void 0:G.placement;if(!H)switch(g){case"bestFit":{var L;let oe=(L=P.filter(A=>{if(R){let F=Xt(A.placement);return F===k||F==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(F=>F>0).reduce((F,X)=>F+X,0)]).sort((A,F)=>A[1]-F[1])[0])==null?void 0:L[0];oe&&(H=oe);break}case"initialPlacement":H=a;break}if(i!==H)return{reset:{placement:H}}}return{}}}};function jf(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function Uf(n){return Df.some(e=>n[e]>=0)}var Kf=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){let{rects:t,platform:r}=e,{strategy:i="referenceHidden",...s}=Yn(n,e);switch(i){case"referenceHidden":{let o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=jf(o,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Uf(a)}}}case"escaped":{let o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=jf(o,t.floating);return{data:{escapedOffsets:a,escaped:Uf(a)}}}default:return{}}}}};var Ix=new Set(["left","top"]);async function $x(n,e){let{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=xn(t),a=jr(t),l=Xt(t)==="y",c=Ix.has(o)?-1:1,u=s&&l?-1:1,d=Yn(e,n),{mainAxis:h,crossAxis:g,alignmentAxis:v}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*u,y:h*c}:{x:h*c,y:g*u}}var Yf=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;let{x:i,y:s,placement:o,middlewareData:a}=e,l=await $x(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},Xf=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){let{x:t,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:k,y:_}=y;return{x:k,y:_}}},...c}=Yn(n,e),u={x:t,y:r},d=await s.detectOverflow(e,c),h=Xt(xn(i)),g=Tc(h),v=u[g],f=u[h];if(o){let y=g==="y"?"top":"left",k=g==="y"?"bottom":"right",_=v+d[y],b=v-d[k];v=Qo(_,v,b)}if(a){let y=h==="y"?"top":"left",k=h==="y"?"bottom":"right",_=f+d[y],b=f-d[k];f=Qo(_,f,b)}let m=l.fn({...e,[g]:v,[h]:f});return{...m,data:{x:m.x-t,y:m.y-r,enabled:{[g]:o,[h]:a}}}}}};function na(){return typeof window<"u"}function Jn(n){return Qf(n)?(n.nodeName||"").toLowerCase():"#document"}function rt(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Tt(n){var e;return(e=(Qf(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Qf(n){return na()?n instanceof Node||n instanceof rt(n).Node:!1}function ht(n){return na()?n instanceof Element||n instanceof rt(n).Element:!1}function It(n){return na()?n instanceof HTMLElement||n instanceof rt(n).HTMLElement:!1}function Jf(n){return!na()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof rt(n).ShadowRoot}var Mx=new Set(["inline","contents"]);function zr(n){let{overflow:e,overflowX:t,overflowY:r,display:i}=ft(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!Mx.has(i)}var Px=new Set(["table","td","th"]);function eg(n){return Px.has(Jn(n))}var Ox=[":popover-open",":modal"];function rs(n){return Ox.some(e=>{try{return n.matches(e)}catch{return!1}})}var Nx=["transform","translate","scale","rotate","perspective"],Lx=["transform","translate","scale","rotate","perspective","filter"],Fx=["paint","layout","strict","content"];function ra(n){let e=ia(),t=ht(n)?ft(n):n;return Nx.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Lx.some(r=>(t.willChange||"").includes(r))||Fx.some(r=>(t.contain||"").includes(r))}function tg(n){let e=Jt(n);for(;It(e)&&!Qn(e);){if(ra(e))return e;if(rs(e))return null;e=Jt(e)}return null}function ia(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var Dx=new Set(["html","body","#document"]);function Qn(n){return Dx.has(Jn(n))}function ft(n){return rt(n).getComputedStyle(n)}function is(n){return ht(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Jt(n){if(Jn(n)==="html")return n;let e=n.assignedSlot||n.parentNode||Jf(n)&&n.host||Tt(n);return Jf(e)?e.host:e}function ng(n){let e=Jt(n);return Qn(e)?n.ownerDocument?n.ownerDocument.body:n.body:It(e)&&zr(e)?e:ng(e)}function Ur(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);let i=ng(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=rt(i);if(s){let a=sa(o);return e.concat(o,o.visualViewport||[],zr(i)?i:[],a&&t?Ur(a):[])}return e.concat(i,Ur(i,[],t))}function sa(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function og(n){let e=ft(n),t=parseFloat(e.width)||0,r=parseFloat(e.height)||0,i=It(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,a=ts(t)!==s||ts(r)!==o;return a&&(t=s,r=o),{width:t,height:r,$:a}}function Mc(n){return ht(n)?n:n.contextElement}function qr(n){let e=Mc(n);if(!It(e))return Rt(1);let t=e.getBoundingClientRect(),{width:r,height:i,$:s}=og(e),o=(s?ts(t.width):t.width)/r,a=(s?ts(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var Hx=Rt(0);function ag(n){let e=rt(n);return!ia()||!e.visualViewport?Hx:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Bx(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==rt(n)?!1:e}function er(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);let i=n.getBoundingClientRect(),s=Mc(n),o=Rt(1);e&&(r?ht(r)&&(o=qr(r)):o=qr(n));let a=Bx(s,t,r)?ag(s):Rt(0),l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s){let h=rt(s),g=r&&ht(r)?rt(r):r,v=h,f=sa(v);for(;f&&r&&g!==v;){let m=qr(f),y=f.getBoundingClientRect(),k=ft(f),_=y.left+(f.clientLeft+parseFloat(k.paddingLeft))*m.x,b=y.top+(f.clientTop+parseFloat(k.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,d*=m.y,l+=_,c+=b,v=rt(f),f=sa(v)}}return Xn({width:u,height:d,x:l,y:c})}function oa(n,e){let t=is(n).scrollLeft;return e?e.left+t:er(Tt(n)).left+t}function lg(n,e){let t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-oa(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function Vx(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n,s=i==="fixed",o=Tt(r),a=e?rs(e.floating):!1;if(r===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=Rt(1),u=Rt(0),d=It(r);if((d||!d&&!s)&&((Jn(r)!=="body"||zr(o))&&(l=is(r)),It(r))){let g=er(r);c=qr(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}let h=o&&!d&&!s?lg(o,l):Rt(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:t.y*c.y-l.scrollTop*c.y+u.y+h.y}}function Wx(n){return Array.from(n.getClientRects())}function jx(n){let e=Tt(n),t=is(n),r=n.ownerDocument.body,i=Yt(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Yt(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),o=-t.scrollLeft+oa(n),a=-t.scrollTop;return ft(r).direction==="rtl"&&(o+=Yt(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}var rg=25;function Ux(n,e){let t=rt(n),r=Tt(n),i=t.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;let u=ia();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=oa(r);if(c<=0){let u=r.ownerDocument,d=u.body,h=getComputedStyle(d),g=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(r.clientWidth-d.clientWidth-g);v<=rg&&(s-=v)}else c<=rg&&(s+=c);return{width:s,height:o,x:a,y:l}}var zx=new Set(["absolute","fixed"]);function qx(n,e){let t=er(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=It(n)?qr(n):Rt(1),o=n.clientWidth*s.x,a=n.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function ig(n,e,t){let r;if(e==="viewport")r=Ux(n,t);else if(e==="document")r=jx(Tt(n));else if(ht(e))r=qx(e,t);else{let i=ag(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Xn(r)}function cg(n,e){let t=Jt(n);return t===e||!ht(t)||Qn(t)?!1:ft(t).position==="fixed"||cg(t,e)}function Zx(n,e){let t=e.get(n);if(t)return t;let r=Ur(n,[],!1).filter(a=>ht(a)&&Jn(a)!=="body"),i=null,s=ft(n).position==="fixed",o=s?Jt(n):n;for(;ht(o)&&!Qn(o);){let a=ft(o),l=ra(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&zx.has(i.position)||zr(o)&&!l&&cg(n,o))?r=r.filter(u=>u!==o):i=a,o=Jt(o)}return e.set(n,r),r}function Gx(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n,o=[...t==="clippingAncestors"?rs(e)?[]:Zx(e,this._c):[].concat(t),r],a=o[0],l=o.reduce((c,u)=>{let d=ig(e,u,i);return c.top=Yt(d.top,c.top),c.right=_n(d.right,c.right),c.bottom=_n(d.bottom,c.bottom),c.left=Yt(d.left,c.left),c},ig(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Kx(n){let{width:e,height:t}=og(n);return{width:e,height:t}}function Yx(n,e,t){let r=It(e),i=Tt(e),s=t==="fixed",o=er(n,!0,s,e),a={scrollLeft:0,scrollTop:0},l=Rt(0);function c(){l.x=oa(i)}if(r||!r&&!s)if((Jn(e)!=="body"||zr(i))&&(a=is(e)),r){let g=er(e,!0,s,e);l.x=g.x+e.clientLeft,l.y=g.y+e.clientTop}else i&&c();s&&!r&&i&&c();let u=i&&!r&&!s?lg(i,a):Rt(0),d=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:d,y:h,width:o.width,height:o.height}}function $c(n){return ft(n).position==="static"}function sg(n,e){if(!It(n)||ft(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Tt(n)===t&&(t=t.ownerDocument.body),t}function ug(n,e){let t=rt(n);if(rs(n))return t;if(!It(n)){let i=Jt(n);for(;i&&!Qn(i);){if(ht(i)&&!$c(i))return i;i=Jt(i)}return t}let r=sg(n,e);for(;r&&eg(r)&&$c(r);)r=sg(r,e);return r&&Qn(r)&&$c(r)&&!ra(r)?t:r||tg(n)||t}var Xx=async function(n){let e=this.getOffsetParent||ug,t=this.getDimensions,r=await t(n.floating);return{reference:Yx(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jx(n){return ft(n).direction==="rtl"}var Qx={convertOffsetParentRelativeRectToViewportRelativeRect:Vx,getDocumentElement:Tt,getClippingRect:Gx,getOffsetParent:ug,getElementRects:Xx,getClientRects:Wx,getDimensions:Kx,getScale:qr,isElement:ht,isRTL:Jx};function dg(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function ew(n,e){let t=null,r,i=Tt(n);function s(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();let c=n.getBoundingClientRect(),{left:u,top:d,width:h,height:g}=c;if(a||e(),!h||!g)return;let v=ns(d),f=ns(i.clientWidth-(u+h)),m=ns(i.clientHeight-(d+g)),y=ns(u),_={rootMargin:-v+"px "+-f+"px "+-m+"px "+-y+"px",threshold:Yt(0,_n(1,l))||1},b=!0;function x(R){let w=R[0].intersectionRatio;if(w!==l){if(!b)return o();w?o(!1,w):r=setTimeout(()=>{o(!1,1e-7)},1e3)}w===1&&!dg(c,n.getBoundingClientRect())&&o(),b=!1}try{t=new IntersectionObserver(x,{..._,root:i.ownerDocument})}catch{t=new IntersectionObserver(x,_)}t.observe(n)}return o(!0),s}function Zr(n,e,t,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Mc(n),u=i||s?[...c?Ur(c):[],...Ur(e)]:[];u.forEach(y=>{i&&y.addEventListener("scroll",t,{passive:!0}),s&&y.addEventListener("resize",t)});let d=c&&a?ew(c,t):null,h=-1,g=null;o&&(g=new ResizeObserver(y=>{let[k]=y;k&&k.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var _;(_=g)==null||_.observe(e)})),t()}),c&&!l&&g.observe(c),g.observe(e));let v,f=l?er(n):null;l&&m();function m(){let y=er(n);f&&!dg(f,y)&&t(),f=y,v=requestAnimationFrame(m)}return t(),()=>{var y;u.forEach(k=>{i&&k.removeEventListener("scroll",t),s&&k.removeEventListener("resize",t)}),d?.(),(y=g)==null||y.disconnect(),g=null,l&&cancelAnimationFrame(v)}}var Gr=Yf;var Kr=Xf,Yr=Gf;var aa=Kf,la=Zf;var Xr=(n,e,t)=>{let r=new Map,i={platform:Qx,...t},s={...i.platform,_c:r};return qf(n,e,{...i,platform:s})};function tw(n){let e=n.getBoundingClientRect(),t=window.innerWidth,r=window.innerHeight;if(!(e.width>t*.8||e.height>r*.8))return n;let s=Math.max(e.left,0),o=Math.max(e.top,0),a=Math.min(e.right,t),l=Math.min(e.bottom,r),c=(s+a)/2,u=(o+l)/2;return{getBoundingClientRect(){return{width:0,height:0,x:c,y:u,top:u,left:c,right:c,bottom:u}}}}function pg(n,e,t){if(!t.trigger||t.trigger==="immediate"){let f=n.getBoundingClientRect();f.width>window.innerWidth*.8||f.height>window.innerHeight*.8||n.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}let r=document.createElement("div");if(r.className="syntro-tooltip",r.setAttribute("role","tooltip"),r.innerHTML=lt(t.html),!t.trigger||t.trigger==="immediate"){let f=document.createElement("button");f.className="syntro-tooltip-close",f.setAttribute("aria-label","Close"),f.textContent="\xD7",Object.assign(f.style,{position:"absolute",top:"4px",right:"4px",background:"none",border:"none",color:"inherit",fontSize:"16px",lineHeight:"1",cursor:"pointer",opacity:"0.6",padding:"2px 4px"}),f.addEventListener("mouseenter",()=>{f.style.opacity="1"}),f.addEventListener("mouseleave",()=>{f.style.opacity="0.6"}),f.addEventListener("click",()=>v.destroy()),r.style.position="relative",r.appendChild(f)}let i=r.querySelectorAll("[data-syntro-action]"),s=f=>{let y=f.currentTarget.getAttribute("data-syntro-action");y&&t.onAction&&t.onAction(y)};i.forEach(f=>f.addEventListener("click",s));let o=document.createElement("div");o.className="syntro-tooltip-arrow",r.appendChild(o),e.appendChild(r);let a=[Gr(t.offsetPx??8),Yr(),Kr({padding:8}),aa(),la({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=Zr(n,r,async()=>{if(!n.isConnected){v.destroy();return}let f=tw(n),m=await Xr(f,r,{placement:l,strategy:"fixed",middleware:a}),{x:y,y:k,strategy:_,middlewareData:b,placement:x}=m;if(Object.assign(r.style,{left:`${y}px`,top:`${k}px`,position:_}),b.arrow){let{x:R,y:w}=b.arrow,E=x.split("-")[0],$={top:"bottom",right:"left",bottom:"top",left:"right"};Object.assign(o.style,{left:R!=null?`${R}px`:"",top:w!=null?`${w}px`:"",right:"",bottom:"",[$[E]]:"-4px"});let P={top:"0deg",right:"90deg",bottom:"180deg",left:"270deg"};o.style.transform=`rotate(${P[E]||"0deg"})`}}),u=f=>{f.key==="Escape"&&v.destroy()};window.addEventListener("keydown",u);let d=[];if(t.blocking){Array.from(document.body.children).forEach(m=>{m!==e&&m.getAttribute("inert")===null&&(m.setAttribute("inert",""),d.push(m.id||m.tagName))});let f=Array.from(r.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(f.length>0){let m=f[0],y=f[f.length-1],k=_=>{_.key==="Tab"&&(_.shiftKey?document.activeElement===m&&(y.focus(),_.preventDefault()):document.activeElement===y&&(m.focus(),_.preventDefault()))};r.addEventListener("keydown",k),requestAnimationFrame(()=>m.focus())}}let g=(()=>{if(t.trigger==="hover"){let f=null,m=()=>{f&&(clearTimeout(f),f=null),r.style.visibility="visible",r.style.opacity="1"},y=()=>{f=setTimeout(()=>{r.style.visibility="hidden",r.style.opacity="0",f=null},100)};return r.style.visibility="hidden",r.style.opacity="0",r.style.transition="opacity 200ms ease, visibility 200ms",n.addEventListener("mouseenter",m),n.addEventListener("mouseleave",y),r.addEventListener("mouseenter",m),r.addEventListener("mouseleave",y),n.addEventListener("focus",m),n.addEventListener("blur",y),()=>{f&&clearTimeout(f),n.removeEventListener("mouseenter",m),n.removeEventListener("mouseleave",y),r.removeEventListener("mouseenter",m),r.removeEventListener("mouseleave",y),n.removeEventListener("focus",m),n.removeEventListener("blur",y)}}if(t.trigger==="click"){let f=()=>{r.style.visibility==="visible"?v.destroy():(r.style.visibility="visible",r.style.opacity="1")};return r.style.visibility="hidden",r.style.opacity="0",r.style.transition="opacity 200ms ease, visibility 200ms",n.addEventListener("click",f),()=>n.removeEventListener("click",f)}return r.style.opacity="0",r.style.transition="opacity 200ms ease",requestAnimationFrame(()=>{r.style.opacity="1"}),()=>{}})(),v={el:r,destroy(){c(),g(),window.removeEventListener("keydown",u),i.forEach(f=>f.removeEventListener("click",s)),t.blocking&&Array.from(document.body.children).forEach(f=>{f!==e&&f.removeAttribute("inert")}),r.style.pointerEvents="none",r.style.opacity="0",setTimeout(()=>{try{r.remove()}catch{}},200)}};return v}var lw=Wr(Pc(),1),Jr=Wr(Oc(),1),cw=Wr(Nc(),1);var mg=Wr(Pc(),1);var ca=globalThis,ua=ca.ShadowRoot&&(ca.ShadyCSS===void 0||ca.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Lc=Symbol(),vg=new WeakMap,ss=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Lc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ua&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=vg.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&vg.set(t,e))}return e}toString(){return this.cssText}},yg=n=>new ss(typeof n=="string"?n:n+"",void 0,Lc),tr=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,s)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[s+1],n[0]);return new ss(t,n,Lc)},bg=(n,e)=>{if(ua)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=ca.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},Fc=ua?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return yg(t)})(n):n;var{is:uw,defineProperty:dw,getOwnPropertyDescriptor:pw,getOwnPropertyNames:hw,getOwnPropertySymbols:fw,getPrototypeOf:gw}=Object,wn=globalThis,_g=wn.trustedTypes,mw=_g?_g.emptyScript:"",vw=wn.reactiveElementPolyfillSupport,os=(n,e)=>n,Dc={toAttribute(n,e){switch(e){case Boolean:n=n?mw:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},wg=(n,e)=>!uw(n,e),xg={attribute:!0,type:String,converter:Dc,reflect:!1,useDefault:!1,hasChanged:wg};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),wn.litPropertyMetadata??(wn.litPropertyMetadata=new WeakMap);var Qt=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=xg){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&dw(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:s}=pw(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){let a=i?.call(this);s?.call(this,o),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??xg}static _$Ei(){if(this.hasOwnProperty(os("elementProperties")))return;let e=gw(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(os("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(os("properties"))){let t=this.properties,r=[...hw(t),...fw(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(Fc(i))}else e!==void 0&&t.push(Fc(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return bg(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let s=(r.converter?.toAttribute!==void 0?r.converter:Dc).toAttribute(t,r.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let s=r.getPropertyOptions(i),o=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Dc;this._$Em=i;let a=o.fromAttribute(t,s.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,r,i=!1,s){if(e!==void 0){let o=this.constructor;if(i===!1&&(s=this[e]),r??(r=o.getPropertyOptions(e)),!((r.hasChanged??wg)(s,t)||r.useDefault&&r.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:s},o){r&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??t??this[e]),s!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,s]of r){let{wrapped:o}=s,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,s,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};Qt.elementStyles=[],Qt.shadowRootOptions={mode:"open"},Qt[os("elementProperties")]=new Map,Qt[os("finalized")]=new Map,vw?.({ReactiveElement:Qt}),(wn.reactiveElementVersions??(wn.reactiveElementVersions=[])).push("2.1.2");var ls=globalThis,kg=n=>n,da=ls.trustedTypes,Sg=da?da.createPolicy("lit-html",{createHTML:n=>n}):void 0,Ig="$lit$",kn=`lit$${Math.random().toFixed(9).slice(2)}$`,$g="?"+kn,yw=`<${$g}>`,ir=document,cs=()=>ir.createComment(""),us=n=>n===null||typeof n!="object"&&typeof n!="function",zc=Array.isArray,bw=n=>zc(n)||typeof n?.[Symbol.iterator]=="function",Hc=`[
|
|
55
|
+
\f\r]`,as=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Eg=/-->/g,Cg=/>/g,nr=RegExp(`>|${Hc}(?:([^\\s"'>=/]+)(${Hc}*=${Hc}*(?:[^
|
|
56
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ag=/'/g,Rg=/"/g,Mg=/^(?:script|style|textarea|title)$/i,qc=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),D=qc(1),KI=qc(2),YI=qc(3),$t=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),Tg=new WeakMap,rr=ir.createTreeWalker(ir,129);function Pg(n,e){if(!zc(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Sg!==void 0?Sg.createHTML(e):e}var _w=(n,e)=>{let t=n.length-1,r=[],i,s=e===2?"<svg>":e===3?"<math>":"",o=as;for(let a=0;a<t;a++){let l=n[a],c,u,d=-1,h=0;for(;h<l.length&&(o.lastIndex=h,u=o.exec(l),u!==null);)h=o.lastIndex,o===as?u[1]==="!--"?o=Eg:u[1]!==void 0?o=Cg:u[2]!==void 0?(Mg.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=nr):u[3]!==void 0&&(o=nr):o===nr?u[0]===">"?(o=i??as,d=-1):u[1]===void 0?d=-2:(d=o.lastIndex-u[2].length,c=u[1],o=u[3]===void 0?nr:u[3]==='"'?Rg:Ag):o===Rg||o===Ag?o=nr:o===Eg||o===Cg?o=as:(o=nr,i=void 0);let g=o===nr&&n[a+1].startsWith("/>")?" ":"";s+=o===as?l+yw:d>=0?(r.push(c),l.slice(0,d)+Ig+l.slice(d)+kn+g):l+kn+(d===-2?a:g)}return[Pg(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},ds=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0,a=e.length-1,l=this.parts,[c,u]=_w(e,t);if(this.el=n.createElement(c,r),rr.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=rr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(Ig)){let h=u[o++],g=i.getAttribute(d).split(kn),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:v[2],strings:g,ctor:v[1]==="."?Vc:v[1]==="?"?Wc:v[1]==="@"?jc:ei}),i.removeAttribute(d)}else d.startsWith(kn)&&(l.push({type:6,index:s}),i.removeAttribute(d));if(Mg.test(i.tagName)){let d=i.textContent.split(kn),h=d.length-1;if(h>0){i.textContent=da?da.emptyScript:"";for(let g=0;g<h;g++)i.append(d[g],cs()),rr.nextNode(),l.push({type:2,index:++s});i.append(d[h],cs())}}}else if(i.nodeType===8)if(i.data===$g)l.push({type:2,index:s});else{let d=-1;for(;(d=i.data.indexOf(kn,d+1))!==-1;)l.push({type:7,index:s}),d+=kn.length-1}s++}}static createElement(e,t){let r=ir.createElement("template");return r.innerHTML=e,r}};function Qr(n,e,t=n,r){if(e===$t)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,s=us(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=i:t._$Cl=i),i!==void 0&&(e=Qr(n,i._$AS(n,e.values),i,r)),e}var Bc=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??ir).importNode(t,!0);rr.currentNode=i;let s=rr.nextNode(),o=0,a=0,l=r[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new ps(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new Uc(s,this,e)),this._$AV.push(c),l=r[++a]}o!==l?.index&&(s=rr.nextNode(),o++)}return rr.currentNode=ir,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},ps=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=J,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Qr(this,e,t),us(e)?e===J||e==null||e===""?(this._$AH!==J&&this._$AR(),this._$AH=J):e!==this._$AH&&e!==$t&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):bw(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==J&&us(this._$AH)?this._$AA.nextSibling.data=e:this.T(ir.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=ds.createElement(Pg(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let s=new Bc(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=Tg.get(e.strings);return t===void 0&&Tg.set(e.strings,t=new ds(e)),t}k(e){zc(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let s of e)i===t.length?t.push(r=new n(this.O(cs()),this.O(cs()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=kg(e).nextSibling;kg(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ei=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=J,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=J}_$AI(e,t=this,r,i){let s=this.strings,o=!1;if(s===void 0)e=Qr(this,e,t,0),o=!us(e)||e!==this._$AH&&e!==$t,o&&(this._$AH=e);else{let a=e,l,c;for(e=s[0],l=0;l<s.length-1;l++)c=Qr(this,a[r+l],t,l),c===$t&&(c=this._$AH[l]),o||(o=!us(c)||c!==this._$AH[l]),c===J?e=J:e!==J&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===J?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Vc=class extends ei{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===J?void 0:e}},Wc=class extends ei{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==J)}},jc=class extends ei{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=Qr(this,e,t,0)??J)===$t)return;let r=this._$AH,i=e===J&&r!==J||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==J&&(r===J||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Uc=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Qr(this,e)}};var xw=ls.litHtmlPolyfillSupport;xw?.(ds,ps),(ls.litHtmlVersions??(ls.litHtmlVersions=[])).push("3.3.2");var Og=(n,e,t)=>{let r=t?.renderBefore??e,i=r._$litPart$;if(i===void 0){let s=t?.renderBefore??null;r._$litPart$=i=new ps(e.insertBefore(cs(),s),s,void 0,t??{})}return i._$AI(n),i};var hs=globalThis,ge=class extends Qt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;let e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Og(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return $t}};ge._$litElement$=!0,ge.finalized=!0,hs.litElementHydrateSupport?.({LitElement:ge});var ww=hs.litElementPolyfillSupport;ww?.({LitElement:ge});(hs.litElementVersions??(hs.litElementVersions=[])).push("4.2.2");var pa={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ha=n=>(...e)=>({_$litDirective$:n,values:e}),ti=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var Ng="important",kw=" !"+Ng,T=ha(class extends ti{constructor(n){if(super(n),n.type!==pa.ATTRIBUTE||n.name!=="style"||n.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];return r==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(n,[e]){let{style:t}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let r of this.ft)e[r]==null&&(this.ft.delete(r),r.includes("-")?t.removeProperty(r):t[r]=null);for(let r in e){let i=e[r];if(i!=null){this.ft.add(r);let s=typeof i=="string"&&i.endsWith(kw);r.includes("-")||s?t.setProperty(r,s?i.slice(0,-11):i,s?Ng:""):t[r]=i}}return $t}});var Sn=function(n,e,t,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(n,t):i?i.value=t:e.set(n,t),t},Fe=function(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)},fs,gs,ni,en,ms,fa,ri,Lg="#1969fe",Sw="#24ad32",Ew="#0e1114",Zc="#677384",Cw="#a8afba",Fg="#f6f7f9",Aw="#ffffff";function Dg(n){let e=document.createElement("div");e.setAttribute("data-testid","workflow-toast"),Object.assign(e.style,{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483646",padding:"12px 16px",borderRadius:"8px",backgroundColor:`var(--se-color-bg-surface, ${Aw})`,color:`var(--se-color-text-primary, ${Ew})`,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",maxWidth:"320px",fontFamily:"var(--se-font-family, system-ui, sans-serif)",fontSize:"14px",lineHeight:"1.4",transition:"opacity 0.3s ease"});let t=document.createElement("div");if(t.style.fontWeight="600",t.textContent=n.title,e.appendChild(t),n.body){let s=document.createElement("div");s.style.marginTop="4px",s.style.fontSize="13px",s.style.color="var(--se-color-text-secondary, #666)",s.textContent=n.body,e.appendChild(s)}document.body.appendChild(e);let r,i=setTimeout(()=>{e.style.opacity="0",r=setTimeout(()=>{e.remove()},300)},4e3);return()=>{clearTimeout(i),clearTimeout(r),e.remove()}}function Rw(n){let e=new Map;for(let t of n){let r=t.action;if(r.kind==="overlays:tour"&&r.workflow&&r.tourId){let i=r.workflow,o=(r.steps||[]).map(a=>({id:a.id,title:i.stepTitles?.[a.id]||a.id}));e.set(r.tourId,{meta:i,steps:o})}}return e}var Hg="syntro-workflow-tracker",ga=class extends ge{constructor(){super(...arguments),this.runtimeRef=null,this._workflowEntries=[],this._actionVersion=0,fs.set(this,null),gs.set(this,null),ni.set(this,[]),en.set(this,new Set),ms.set(this,{}),fa.set(this,!1),ri.set(this,new Map)}createRenderRoot(){return this}get _stateNs(){return this.runtimeRef?.state?.user?.ns?.("workflows")??null}_rescanWorkflows(){let e=this.runtimeRef?.actions?.getActive?.()??[],t=Rw(e);if(Sn(this,ri,t,"f"),t.size===0)return;let r=this._stateNs,i=r?.get("dismissed")??[],s=r?.get("completed")??{};this._workflowEntries=(()=>{let o=new Set(this._workflowEntries.map(l=>l.tourId)),a=[];for(let[l,{meta:c,steps:u}]of t){if(o.has(l))continue;let d="active";i.includes(l)?d="dismissed":s[l]&&(d="completed"),a.push({tourId:l,meta:c,steps:u,currentStepId:null,completedSteps:[],status:d,completedAt:s[l]||void 0})}return a.length>0?[...this._workflowEntries,...a]:this._workflowEntries})();for(let[o,{meta:a}]of t){let l=r?.get("dismissed")??[],c=r?.get("completed")??{};if(!Fe(this,en,"f").has(o)&&a.notification&&!l.includes(o)&&!c[o]){Fe(this,en,"f").add(o),r?.set("notified",[...Fe(this,en,"f")]);let u=Dg(a.notification);Fe(this,ni,"f").push(u)}}}connectedCallback(){super.connectedCallback(),this._initSubscriptions()}disconnectedCallback(){super.disconnectedCallback(),this._teardownSubscriptions();for(let e of Fe(this,ni,"f"))e();Sn(this,ni,[],"f")}updated(e){e.has("runtimeRef")&&(this._teardownSubscriptions(),this._initSubscriptions()),e.has("_actionVersion")&&this._rescanWorkflows()}_initSubscriptions(){if(this.runtimeRef?.events?.subscribe){if(!Fe(this,fa,"f")&&this._stateNs){let e=this._stateNs.get("notified")??[];for(let r of e)Fe(this,en,"f").add(r);let t=this._stateNs.get("completed")??{};Sn(this,ms,{...t},"f"),Sn(this,fa,!0,"f")}Sn(this,fs,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1}),"f"),Sn(this,gs,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},e=>{this._handleTourEvent(e)}),"f"),this._rescanWorkflows()}}_teardownSubscriptions(){Fe(this,fs,"f")?.call(this),Sn(this,fs,null,"f"),Fe(this,gs,"f")?.call(this),Sn(this,gs,null,"f")}_handleTourEvent(e){let t=e.props?.tourId;if(!t)return;if(!Fe(this,ri,"f").has(t)&&e.name==="tour.started"){this._actionVersion+=1;return}if(!Fe(this,ri,"f").has(t))return;let r=this._stateNs;this._workflowEntries=this._workflowEntries.map(i=>{if(i.tourId!==t)return i;switch(e.name){case"tour.started":{let s=e.props?.startStepId||i.steps[0]?.id||null;if(!Fe(this,en,"f").has(t)){Fe(this,en,"f").add(t),r?.set("notified",[...Fe(this,en,"f")]);let a=Fe(this,ri,"f").get(t);if(a?.meta.notification){let l=Dg(a.meta.notification);Fe(this,ni,"f").push(l)}}let o=this._workflowEntries.filter(a=>a.status==="active"||a.tourId===t).map(a=>a.tourId);return o.includes(t)||o.push(t),r?.set("active",[...new Set(o)]),{...i,status:"active",currentStepId:s,completedSteps:i.status==="active"?i.completedSteps:[]}}case"tour.step_started":{let s=e.props?.stepId;return{...i,currentStepId:s||i.currentStepId}}case"tour.step_changed":{let s=e.props?.previousStepId,o=e.props?.nextStepId,a=s&&!i.completedSteps.includes(s)?[...i.completedSteps,s]:i.completedSteps;return{...i,currentStepId:o||i.currentStepId,completedSteps:a}}case"tour.completed":{let s=Date.now();return Fe(this,ms,"f")[t]=s,r?.set("completed",{...Fe(this,ms,"f")}),{...i,status:"completed",currentStepId:null,completedSteps:i.steps.map(o=>o.id),completedAt:s}}case"tour.paused":return i;default:return i}})}_handleStepClick(e,t){this.runtimeRef?.events?.publish("workflow:jump_to_step",{tourId:e,stepId:t}),this.dispatchEvent(new CustomEvent("workflow-step-click",{bubbles:!0,detail:{tourId:e,stepId:t}}))}_handleDismiss(e){this._workflowEntries=this._workflowEntries.map(r=>r.tourId===e?{...r,status:"dismissed"}:r);let t=this._workflowEntries.filter(r=>r.status==="dismissed").map(r=>r.tourId);this._stateNs?.set("dismissed",t),this.dispatchEvent(new CustomEvent("workflow-dismissed",{bubbles:!0,detail:{tourId:e}}))}_renderProgressBar(e,t){let r=t>0?Math.round(e/t*100):0,i={width:"100%",height:"6px",borderRadius:"9999px",background:"rgba(255,255,255,0.08)",overflow:"hidden"},s={height:"100%",borderRadius:"9999px",background:`var(--se-color-primary, ${Lg})`,transition:"width 0.3s ease",width:`${r}%`};return D`
|
|
57
57
|
<div style=${T(i)}>
|
|
58
58
|
<div
|
|
59
59
|
role="progressbar"
|
|
@@ -63,24 +63,24 @@ var K0=Object.create;var Zo=Object.defineProperty;var Y0=Object.getOwnPropertyDe
|
|
|
63
63
|
style=${T(s)}
|
|
64
64
|
></div>
|
|
65
65
|
</div>
|
|
66
|
-
`}_renderStepItem(e,t,r,i){let s={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"6px 8px",borderRadius:"4px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontSize:"12px",lineHeight:"1.4",color:r?`var(--se-color-text-primary, ${
|
|
66
|
+
`}_renderStepItem(e,t,r,i){let s={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"6px 8px",borderRadius:"4px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontSize:"12px",lineHeight:"1.4",color:r?`var(--se-color-text-primary, ${Fg})`:`var(--se-color-text-secondary, ${Cw})`,fontWeight:r?"600":"400"},o={flexShrink:"0",width:"16px",textAlign:"center"},a={display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",background:r?`var(--se-color-primary, ${Lg})`:"rgba(255,255,255,0.12)"},l={color:`var(--se-color-success, ${Sw})`},c={flex:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},u=t?D`<span role="img" aria-label="completed" style=${T(l)}>✓</span>`:r?D`<span style=${T(a)}></span>`:D`<span style=${T(a)}></span>`;return D`
|
|
67
67
|
<button
|
|
68
68
|
type="button"
|
|
69
69
|
data-testid=${`step-${e.id}`}
|
|
70
|
-
data-current=${r?"true":
|
|
71
|
-
data-completed=${t?"true":
|
|
72
|
-
aria-current=${r?"step":
|
|
70
|
+
data-current=${r?"true":J}
|
|
71
|
+
data-completed=${t?"true":J}
|
|
72
|
+
aria-current=${r?"step":J}
|
|
73
73
|
style=${T(s)}
|
|
74
74
|
@click=${()=>this._handleStepClick(i,e.id)}
|
|
75
75
|
>
|
|
76
76
|
<span style=${T(o)}>${u}</span>
|
|
77
77
|
<span style=${T(c)}>${e.title}</span>
|
|
78
78
|
</button>
|
|
79
|
-
`}_renderWorkflowCard(e){let t=e.completedSteps.length,r=e.steps.length,i={padding:"12px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.02)"},s={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},o={flex:"1",fontSize:"13px",fontWeight:"600",color:`var(--se-color-text-primary, ${
|
|
79
|
+
`}_renderWorkflowCard(e){let t=e.completedSteps.length,r=e.steps.length,i={padding:"12px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.02)"},s={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},o={flex:"1",fontSize:"13px",fontWeight:"600",color:`var(--se-color-text-primary, ${Fg})`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},a={flexShrink:"0",padding:"2px 6px",border:"none",borderRadius:"4px",background:"transparent",color:`var(--se-color-text-tertiary, ${Zc})`,fontSize:"12px",cursor:"pointer",lineHeight:"1"},l={marginBottom:"8px"},c={fontSize:"10px",color:`var(--se-color-text-tertiary, ${Zc})`,marginTop:"4px"},u={display:"flex",flexDirection:"column"};return D`
|
|
80
80
|
<div style=${T(i)}>
|
|
81
81
|
<!-- Header: icon + title + dismiss -->
|
|
82
82
|
<div style=${T(s)}>
|
|
83
|
-
${e.meta.icon?D`<span data-testid="workflow-icon" style="flex-shrink:0;font-size:14px">${e.meta.icon}</span>`:
|
|
83
|
+
${e.meta.icon?D`<span data-testid="workflow-icon" style="flex-shrink:0;font-size:14px">${e.meta.icon}</span>`:J}
|
|
84
84
|
<span style=${T(o)}>${e.meta.title}</span>
|
|
85
85
|
<button
|
|
86
86
|
type="button"
|
|
@@ -104,11 +104,11 @@ var K0=Object.create;var Zo=Object.defineProperty;var Y0=Object.getOwnPropertyDe
|
|
|
104
104
|
${e.steps.map(d=>this._renderStepItem(d,e.completedSteps.includes(d.id),e.currentStepId===d.id,e.tourId))}
|
|
105
105
|
</div>
|
|
106
106
|
</div>
|
|
107
|
-
`}render(){let e=this._workflowEntries.filter(r=>r.status==="active");if(e.length===0){let r={display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 0",fontSize:"12px",color:`var(--se-color-text-tertiary, ${
|
|
107
|
+
`}render(){let e=this._workflowEntries.filter(r=>r.status==="active");if(e.length===0){let r={display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 0",fontSize:"12px",color:`var(--se-color-text-tertiary, ${Zc})`};return D`<div style=${T(r)}>No active workflows</div>`}return D`
|
|
108
108
|
<div style=${T({display:"flex",flexDirection:"column",gap:"8px"})}>
|
|
109
109
|
${e.map(r=>this._renderWorkflowCard(r))}
|
|
110
110
|
</div>
|
|
111
|
-
`}};
|
|
111
|
+
`}};fs=new WeakMap,gs=new WeakMap,ni=new WeakMap,en=new WeakMap,ms=new WeakMap,fa=new WeakMap,ri=new WeakMap;ga.properties={runtimeRef:{attribute:!1},_workflowEntries:{state:!0},_actionVersion:{state:!0}};typeof window<"u"&&!customElements.get(Hg)&&customElements.define(Hg,ga);var Bg=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};if(t.getAttribute("data-syntro-highlight-dismissed"))return{cleanup:()=>{}};t.getAttribute("data-syntro-highlight")&&e.overlayRoot.querySelectorAll(".syntro-spotlight-scrim, .syntro-spotlight-ring").forEach(a=>a.remove()),t.setAttribute("data-syntro-highlight","true");let i=n.style?.color;if(!i)try{let o=getComputedStyle(e.overlayRoot).getPropertyValue("--sc-color-primary")?.trim();o&&(i=o)}catch{}let s=Nf(t,e.overlayRoot,{paddingPx:n.style?.paddingPx??12,radiusPx:n.style?.radiusPx??12,scrimOpacity:n.style?.scrimOpacity??.55,ringColor:i,blocking:n.blocking??!1,onClickOutside:n.onClickOutside??!0,onEsc:n.onEsc??!0,onDismiss:()=>{t.setAttribute("data-syntro-highlight-dismissed","true")}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:highlight",anchorId:n.anchorId}),{cleanup:()=>{s.destroy(),t.removeAttribute("data-syntro-highlight"),t.removeAttribute("data-syntro-highlight-dismissed")}}},Vg=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=n.duration??4e3;await new Promise(f=>requestAnimationFrame(f));let i=f=>({r:parseInt(f.slice(1,3),16),g:parseInt(f.slice(3,5),16),b:parseInt(f.slice(5,7),16)}),o={r:79,g:70,b:229},a=null;try{let f=getComputedStyle(e.overlayRoot),m=f.getPropertyValue("--sc-color-primary")?.trim(),y=f.getPropertyValue("--sc-color-primary-hover")?.trim();m?.startsWith("#")&&m.length>=7&&(o=i(m)),y?.startsWith("#")&&y.length>=7&&(a=i(y))}catch{}let l=document.querySelector("[data-syntro-pulse-styles]");l&&l.remove();let c=document.createElement("style");c.setAttribute("data-syntro-pulse-styles","");let{r:u,g:d,b:h}=o;if(a){let{r:f,g:m,b:y}=a;c.textContent=`
|
|
112
112
|
@keyframes syntro-pulse-anim {
|
|
113
113
|
0%, 100% {
|
|
114
114
|
box-shadow: 0 0 0 0 rgba(${u}, ${d}, ${h}, 0.35);
|
|
@@ -132,38 +132,38 @@ var K0=Object.create;var Zo=Object.defineProperty;var Y0=Object.getOwnPropertyDe
|
|
|
132
132
|
box-shadow: 0 0 0 12px rgba(${u}, ${d}, ${h}, 0);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
`;document.head.appendChild(c);let g=t.style.animation;t.style.animation="syntro-pulse-anim 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite",t.setAttribute("data-syntro-pulse","true");let v=setTimeout(()=>{t.style.animation=g,t.removeAttribute("data-syntro-pulse")},r);return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:pulse",anchorId:n.anchorId,duration:r}),{cleanup:()=>{clearTimeout(v),t.isConnected&&(t.style.animation=g,t.removeAttribute("data-syntro-pulse"))}}},
|
|
135
|
+
`;document.head.appendChild(c);let g=t.style.animation;t.style.animation="syntro-pulse-anim 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite",t.setAttribute("data-syntro-pulse","true");let v=setTimeout(()=>{t.style.animation=g,t.removeAttribute("data-syntro-pulse")},r);return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:pulse",anchorId:n.anchorId,duration:r}),{cleanup:()=>{clearTimeout(v),t.isConnected&&(t.style.animation=g,t.removeAttribute("data-syntro-pulse"))}}},Wg=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r="#4f46e5";try{let a=getComputedStyle(e.overlayRoot).getPropertyValue("--sc-color-primary")?.trim();a?.startsWith("#")&&a.length>=7&&(r=a)}catch{}let i=document.createElement("div");i.textContent=n.content,i.setAttribute("data-syntro-badge",n.anchorId.selector),Object.assign(i.style,{position:"absolute",padding:"2px 6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",color:"white",background:r,borderRadius:"9999px",pointerEvents:"none",zIndex:"2147483646",whiteSpace:"nowrap"});let s=n.position??"top-right",o=t.style.position;switch(getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.appendChild(i),s){case"top-left":Object.assign(i.style,{top:"-8px",left:"-8px"});break;case"top-right":Object.assign(i.style,{top:"-8px",right:"-8px"});break;case"bottom-left":Object.assign(i.style,{bottom:"-8px",left:"-8px"});break;case"bottom-right":Object.assign(i.style,{bottom:"-8px",right:"-8px"});break}return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:badge",anchorId:n.anchorId,content:n.content,position:s}),{cleanup:()=>{try{i.remove()}catch{}t.isConnected&&o!==void 0&&(t.style.position=o)},updateFn:a=>{"content"in a&&typeof a.content=="string"&&(i.textContent=a.content)}}},jg=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let{content:r}=n,i="";if(r.title&&(i+=`<div class="syntro-tt-title">${lt(r.title)}</div>`),i+=`<div class="syntro-tt-body">${lt(r.body)}</div>`,r.ctaButtons&&r.ctaButtons.length>0){i+='<div class="syntro-tt-actions">';for(let o of r.ctaButtons){let a=o.primary??!1;i+=`
|
|
136
136
|
<button
|
|
137
137
|
class="syntro-tt-btn ${a?"syntro-tt-btn-primary":""}"
|
|
138
|
-
data-syntro-action="${
|
|
138
|
+
data-syntro-action="${lt(o.actionId)}"
|
|
139
139
|
>
|
|
140
|
-
${
|
|
140
|
+
${lt(o.label)}
|
|
141
141
|
</button>
|
|
142
142
|
`}i+="</div>"}else r.cta&&(i+=`<div class="syntro-tt-actions">
|
|
143
143
|
<button class="syntro-tt-btn syntro-tt-btn-primary" data-syntro-action="cta">
|
|
144
|
-
${
|
|
144
|
+
${lt(r.cta.label)}
|
|
145
145
|
</button>
|
|
146
|
-
</div>`);let s=
|
|
146
|
+
</div>`);let s=pg(t,e.overlayRoot,{html:i,placement:n.placement??"top",trigger:n.trigger??"immediate",onAction:o=>{if(o==="dismiss"){s.destroy();return}if(o==="cta"&&r.cta)e.publishEvent("action.cta_clicked",{anchorId:n.anchorId,ctaLabel:r.cta.label});else if(r.ctaButtons){let a=r.ctaButtons.find(l=>l.actionId===o);a&&e.publishEvent("action.tooltip_cta_clicked",{anchorId:n.anchorId,actionId:o,label:a.label})}s.destroy()}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:tooltip",anchorId:n.anchorId,trigger:n.trigger??"immediate"}),{cleanup:()=>{s.destroy()}}},Ug=[{kind:"overlays:highlight",executor:Bg},{kind:"overlays:pulse",executor:Vg},{kind:"overlays:badge",executor:Wg},{kind:"overlays:tooltip",executor:jg},{kind:"overlays:modal",executor:Rc},{kind:"overlays:tour",executor:Cc},{kind:"overlays:celebrate",executor:Pf}];function Gc(n){let{appId:e,runtime:t,isBuiltIn:r=!1}=n,i=`app:${e}:`,s=[],o=[],a=t.state.ns(`app:${e}`);return{appId:e,state:{get:c=>a.get(c),set:(c,u)=>a.set(c,u),remove:c=>a.remove(c)},telemetry:t.telemetry?{emit:(c,u)=>{t.events.publish(c,{...u,_appId:e})},getSessionId:()=>t.telemetry?.getSessionId?.()}:void 0,surfaces:{mount:(c,u,d)=>{let h=t.surfaces.mount(c,u,{...d,adaptiveId:e});return{unmount:()=>h.unmount(),update:g=>h.update(g)}},canMount:(c,u)=>t.surfaces.canMount(c,u)},events:{subscribe:c=>t.events.subscribe(u=>{c(u)}),publish:(c,u)=>{t.events.publish(c,{...u,_appId:e})}},registerAction:c=>{t.executors.register(c.kind,c.executor,c.schema,e,r),s.push(c.kind)},registerWidget:c=>{t.widgets.register(c.id,c.component,e,c.metadata),o.push(c.id)}}}function Kc(n,e){e.executors.unregisterBySource(n),e.widgets.unregisterBySource(n)}var Tw=new Set(["overlays:highlight","overlays:pulse","overlays:badge","overlays:tooltip","overlays:modal","content:insertHtml","content:setText","content:setAttr","content:addClass","content:removeClass","content:setStyle","core:mountWidget","core:wait","core:sequence","core:parallel","overlays:tour"]),Iw=new Set(["adaptive-chatbot","adaptive-content","adaptive-faq","adaptive-gamification","adaptive-nav","adaptive-overlays"]),$w={faq:"adaptive-faq",nav:"adaptive-nav",gamification:"adaptive-gamification",chatbot:"adaptive-chatbot",overlays:"adaptive-overlays",content:"adaptive-content"};function zg(n){return $w[n]??n}function qg(n){return Tw.has(n)}function Zg(n){if(qg(n))return null;let e=n.indexOf(":");return e===-1?null:zg(n.slice(0,e))}function Yc(n){let e=n.indexOf(":");return e===-1?null:zg(n.slice(0,e))}function Xc(n){let{cdnBase:e,registry:t,timeout:r=1e4,onLoadStart:i,onLoadEnd:s}=n,o=new Map,a=new Set,l=new Map;function c(f){return`${e}/adaptives/${f}/index.js`}async function u(f){if(t.has(f))return{appId:f,success:!0,manifest:t.get(f)?.manifest};if(l.has(f))return l.get(f);if(o.has(f))return o.get(f);let m=(async()=>{i?.(f);try{let y=c(f);if(a.has(y)){let x=t.get(f);if(x)return s?.(f,!0),{appId:f,success:!0,manifest:x.manifest}}let k=new Promise((x,R)=>{setTimeout(()=>R(new Error(`Timeout loading app: ${f}`)),r)}),_=d(y,f);await Promise.race([_,k]),a.add(y);let b=t.get(f);if(!b)throw new Error(`App ${f} did not register after loading`);return s?.(f,!0),{appId:f,success:!0,manifest:b.manifest}}catch(y){let k=y instanceof Error?y.message:String(y);s?.(f,!1,k);let _={appId:f,success:!1,error:k};return l.set(f,_),_}finally{o.delete(f)}})();return o.set(f,m),m}async function d(f,m){if(typeof window<"u"){try{let y=await import(f);y.manifest?t.register(y.manifest):y.default?.manifest?t.register(y.default.manifest):y.default&&t.register(y.default);return}catch{}return new Promise((y,k)=>{let _=document.createElement("script");_.src=f,_.async=!0,_.onload=()=>{t.get(m)?y():k(new Error(`App ${m} did not self-register`))},_.onerror=()=>{k(new Error(`Failed to load app script: ${f}`))},document.head.appendChild(_)})}throw new Error("Dynamic app loading not supported in SSR")}function h(f){let m=new Set;if(f.apps)for(let y of f.apps)m.add(y);if(f.actions)for(let y of f.actions){let k=Zg(y.kind);if(k&&m.add(k),y.kind==="core:mountWidget"){let _=y.widget?.widgetId;if(_){let b=Yc(_);b&&m.add(b)}}}if(f.tiles){for(let y of f.tiles)if(y.widget){let k=Yc(y.widget);k&&m.add(k)}}for(let y of Iw)m.delete(y);return Array.from(m)}async function g(f){let m=h(f);return m.length===0?[]:await Promise.all(m.map(k=>u(k)))}async function v(f){return Promise.all(f.map(m=>u(m)))}return{loadApp:u,loadAppsForConfig:g,preloadApps:v,getRequiredApps:h,getAppUrl:c}}var vs=class{constructor(){this.apps=new Map;this.eventListeners=new Set;this.runtime=null}bind(e){this.runtime=e}async unbind(){for(let[e,t]of this.apps)t.state==="active"&&await this.deactivate(e);this.runtime=null}register(e){if(!e.id||typeof e.id!="string")throw new Error("App manifest must have an 'id' property");if(!e.version||typeof e.version!="string")throw new Error("App manifest must have a 'version' property");if(!e.name||typeof e.name!="string")throw new Error("App manifest must have a 'name' property");if(this.apps.has(e.id)){if(this.apps.get(e.id).state==="active")throw new Error(`Cannot re-register active app: ${e.id}`);console.warn(`[AppRegistry] Overriding existing app registration: ${e.id}`)}let t={manifest:e,state:"registered",registeredAt:Date.now()};return this.apps.set(e.id,t),this.emit({type:"app:registered",appId:e.id,manifest:e}),t}async activate(e){let t=this.apps.get(e);if(!t)throw new Error(`App not registered: ${e}`);if(t.state==="active"||t.state==="activating"){console.warn(`[AppRegistry] App already ${t.state}: ${e}`);return}if(!this.runtime)throw new Error("AppRegistry not bound to a runtime. Call bind() first.");if(t.manifest.dependencies)for(let r of t.manifest.dependencies){let i=this.apps.get(r);if(!i||i.state!=="active")throw new Error(`App ${e} depends on ${r}, which is not active`)}t.state="activating";try{let r=t.manifest.metadata?.isBuiltIn===!0,i=Gc({appId:e,runtime:this.runtime,isBuiltIn:r}),{runtime:s}=t.manifest,o=[];if(s){if(s.actions)for(let a of s.actions)i.registerAction(a);if(s.widgets)for(let a of s.widgets)i.registerWidget(a);if(s.events)for(let a of s.events){let l=this.runtime.events.subscribe(c=>{if(a.names.includes(c.name)){let u={appId:e,state:i.state,telemetry:i.telemetry,surfaces:i.surfaces};try{a.handler(c,u)}catch(d){console.error(`[AppRegistry] Event handler error in ${e}:`,d)}}});o.push(l)}}t.cleanup=async()=>{for(let a of o)try{await a()}catch(l){console.error(`[AppRegistry] Cleanup error in ${e}:`,l)}Kc(e,this.runtime)},t.state="active",t.activatedAt=Date.now(),this.emit({type:"app:activated",appId:e})}catch(r){throw t.state="error",t.error=String(r),this.emit({type:"app:error",appId:e,error:String(r)}),r}}async deactivate(e){let t=this.apps.get(e);if(!t)throw new Error(`App not registered: ${e}`);if(t.state!=="active"){console.warn(`[AppRegistry] App not active: ${e}`);return}for(let[r,i]of this.apps)if(i.state==="active"&&i.manifest.dependencies?.includes(e))throw new Error(`Cannot deactivate ${e}: app ${r} depends on it`);t.state="deactivating";try{t.cleanup&&(await t.cleanup(),t.cleanup=void 0),t.state="inactive",this.emit({type:"app:deactivated",appId:e})}catch(r){throw t.state="error",t.error=String(r),this.emit({type:"app:error",appId:e,error:String(r)}),r}}async unregister(e){let t=this.apps.get(e);t&&(t.state==="active"&&await this.deactivate(e),this.apps.delete(e),this.emit({type:"app:unregistered",appId:e}))}get(e){return this.apps.get(e)}has(e){return this.apps.has(e)}isActive(e){return this.apps.get(e)?.state==="active"}list(){return Array.from(this.apps.values())}listActive(){return Array.from(this.apps.values()).filter(e=>e.state==="active")}listEditable(){return Array.from(this.apps.values()).filter(e=>e.manifest.editor!==void 0)}subscribe(e){return this.eventListeners.add(e),()=>{this.eventListeners.delete(e)}}emit(e){for(let t of this.eventListeners)try{t(e)}catch(r){console.error("[AppRegistry] Event listener error:",r)}}async destroy(){await this.unbind(),this.apps.clear(),this.eventListeners.clear()}},ys=new vs;var Gg=/```json\s*\n([\s\S]*?)```/g;function Kg(n){let e=[],t=n,r=[],i;for(Gg.lastIndex=0;(i=Gg.exec(n))!==null;)r.push({fullMatch:i[0],json:i[1],index:i.index});for(let s=r.length-1;s>=0;s--){let{fullMatch:o,json:a}=r[s],l;try{l=JSON.parse(a)}catch{continue}typeof l=="object"&&l!==null&&"kind"in l&&typeof l.kind=="string"&&(e.unshift(l),t=t.replace(o,""))}return t=t.replace(/\n{3,}/g,`
|
|
147
147
|
|
|
148
|
-
`).trim(),{displayText:t,actions:e}}var
|
|
149
|
-
<div style=${T(
|
|
148
|
+
`).trim(),{displayText:t,actions:e}}var bs=class extends Error{constructor(e){super(e),this.name="AuthError"}};function Mw(){let n=document.cookie.match(/stytch_session_jwt=([^;]*)/);if(!n||!n[1])throw new bs("No authentication token found");let e=localStorage.getItem("syntrologie_workspace_id");if(!e)throw new bs("No workspace ID found");return{Authorization:`Bearer ${n[1]}`,"X-Workspace-Id":e}}async function Yg(n,e){let t=Mw(),r=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",...t},body:JSON.stringify(e)});if(!r.ok)throw r.status===401?new bs("Session expired or unauthorized"):new Error(`Chat request failed: ${r.status} ${r.statusText}`);return r.json()}var em="#6a59ce",tm="#ffffff",Pw="#cbd0d7",Ow="#f6f7f9",nm="#87919f",Nw="#ff2524",Lw=0;function Jc(){return`msg-${Date.now()}-${++Lw}`}var Fw={display:"flex",flexDirection:"column",height:"100%",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px",touchAction:"none"},Dw={flex:"1",overflowY:"auto",padding:"12px",display:"flex",flexDirection:"column",gap:"8px"},Xg={maxWidth:"85%",padding:"8px 12px",borderRadius:"12px",lineHeight:"1.5",wordBreak:"break-word"},Hw={alignSelf:"flex-end",backgroundColor:`var(--sc-color-primary, ${em})`,color:`var(--sc-color-primary-text, ${tm})`,borderBottomRightRadius:"4px"},Bw={alignSelf:"flex-start",backgroundColor:"var(--sc-chat-assistant-bubble-bg, rgba(255, 255, 255, 0.08))",color:`var(--sc-content-text-color, ${Pw})`,borderBottomLeftRadius:"4px"},Vw={alignSelf:"flex-start",padding:"8px 16px",backgroundColor:"var(--sc-chat-loading-bg, rgba(255, 255, 255, 0.05))",borderRadius:"12px",color:`var(--sc-content-text-secondary-color, ${nm})`,fontSize:"13px"},Ww={padding:"8px 12px",backgroundColor:"var(--sc-color-error-bg, rgba(239, 68, 68, 0.1))",color:`var(--sc-color-error, ${Nw})`,fontSize:"13px",borderRadius:"8px",margin:"0 12px"},jw={display:"flex",gap:"8px",padding:"12px",borderTop:"1px solid var(--sc-content-border-color, rgba(255, 255, 255, 0.06))"},Uw={flex:"1",padding:"8px 12px",borderRadius:"8px",border:"1px solid var(--sc-content-border-color, rgba(255, 255, 255, 0.1))",backgroundColor:"var(--sc-chat-input-bg, rgba(0, 0, 0, 0.2))",color:`var(--sc-content-heading-color, ${Ow})`,fontSize:"14px",outline:"none",fontFamily:"inherit"},Jg={padding:"8px 16px",borderRadius:"8px",border:"none",backgroundColor:`var(--sc-color-primary, ${em})`,color:`var(--sc-color-primary-text, ${tm})`,fontWeight:"600",fontSize:"13px",cursor:"pointer",whiteSpace:"nowrap"},zw={opacity:"0.5",cursor:"not-allowed"},gt,_s,sr,ii,rm,va,im,ma=class extends ge{constructor(){super(...arguments);ee(this,ii);this.config=void 0;this.runtime=void 0;this.tileId="chatbot-widget";this._messages=[];this._isLoading=!1;this._error=null;ee(this,gt,null);ee(this,_s,null);ee(this,sr,null);ee(this,va,t=>{t.preventDefault();let r=I(this,_s)??this.querySelector("[data-chat-input]");if(!r||!r.value.trim()||this._isLoading)return;let i=r.value;r.value="",te(this,ii,im).call(this,i)})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),I(this,gt)?.isApplied()&&(I(this,gt).revertAll().catch(t=>{console.error("[ChatAssistantElement] Failed to revert actions on disconnect:",t)}),Z(this,gt,null))}firstUpdated(){Z(this,_s,this.querySelector("[data-chat-input]")),Z(this,sr,this.querySelector("[data-message-list]"))}updated(t){(t.has("_messages")||t.has("_isLoading"))&&I(this,sr)&&(I(this,sr).scrollTop=I(this,sr).scrollHeight),t.has("config")&&this.config?.greeting&&this._messages.length===0&&(this._messages=[{id:Jc(),role:"assistant",text:this.config.greeting,timestamp:Date.now()}])}render(){return D`
|
|
149
|
+
<div style=${T(Fw)} data-testid="chat-assistant">
|
|
150
150
|
<!-- Message list -->
|
|
151
|
-
<div style=${T(
|
|
152
|
-
${this._messages.map(t=>te(this,ii,
|
|
153
|
-
${this._isLoading?D`<div style=${T(
|
|
151
|
+
<div style=${T(Dw)} data-message-list>
|
|
152
|
+
${this._messages.map(t=>te(this,ii,rm).call(this,t))}
|
|
153
|
+
${this._isLoading?D`<div style=${T(Vw)}>Thinking...</div>`:J}
|
|
154
154
|
</div>
|
|
155
155
|
|
|
156
156
|
<!-- Error banner -->
|
|
157
|
-
${this._error?D`<div style=${T(
|
|
157
|
+
${this._error?D`<div style=${T(Ww)}>${this._error}</div>`:J}
|
|
158
158
|
|
|
159
159
|
<!-- Composer -->
|
|
160
160
|
<form
|
|
161
|
-
style=${T(
|
|
162
|
-
@submit=${
|
|
161
|
+
style=${T(jw)}
|
|
162
|
+
@submit=${I(this,va)}
|
|
163
163
|
>
|
|
164
164
|
<input
|
|
165
165
|
data-chat-input
|
|
166
|
-
style=${T(
|
|
166
|
+
style=${T(Uw)}
|
|
167
167
|
placeholder="Ask anything..."
|
|
168
168
|
?disabled=${this._isLoading}
|
|
169
169
|
data-testid="chat-input"
|
|
@@ -171,19 +171,19 @@ var K0=Object.create;var Zo=Object.defineProperty;var Y0=Object.getOwnPropertyDe
|
|
|
171
171
|
<button
|
|
172
172
|
type="submit"
|
|
173
173
|
?disabled=${this._isLoading}
|
|
174
|
-
style=${T(this._isLoading?{...
|
|
174
|
+
style=${T(this._isLoading?{...Jg,...zw}:Jg)}
|
|
175
175
|
data-testid="chat-send"
|
|
176
176
|
>
|
|
177
177
|
Send
|
|
178
178
|
</button>
|
|
179
179
|
</form>
|
|
180
180
|
</div>
|
|
181
|
-
`}clearMessages(){this._messages=[],this._error=null,$(this,mt)?.isApplied()&&($(this,mt).revertAll().catch(t=>{console.error("[ChatAssistantElement] Failed to revert actions on clear:",t)}),K(this,mt,null)),sessionStorage.removeItem(`syntro:chatbot:history:${this.tileId}`)}};mt=new WeakMap,bs=new WeakMap,sr=new WeakMap,ii=new WeakSet,Qg=function(t){let i=t.role==="user"?{...qg,...Ow}:{...qg,...Nw};return D`<div style=${T(i)}>${t.text}</div>`},ma=new WeakMap,Jg=async function(t){let r=t.trim();if(!r||!this.config||!this.runtime)return;this._error=null;let i={id:Gc(),role:"user",text:r,timestamp:Date.now()};this._messages=[...this._messages,i],this._isLoading=!0,this.dispatchEvent(new CustomEvent("chat-message-sent",{detail:{text:r},bubbles:!0}));try{let s=this.config.maxHistory??20,o=[...this._messages].slice(-s).map(d=>({role:d.role,content:d.text})),a=await zg(this.config.backendUrl,{message:r,history:o,mlflow_run_id:this.config.mlflowRunId}),{displayText:l,actions:c}=Ug(a.response),u={id:Gc(),role:"assistant",text:l,timestamp:Date.now()};this._messages=[...this._messages,u],c.length>0&&($(this,mt)?.isApplied()&&await $(this,mt).revertAll(),K(this,mt,await this.runtime.actions.applyBatch(c)),this.runtime.events.publish("chatbot.actions_applied",{count:c.length,kinds:c.map(d=>d.kind),tileId:this.tileId})),this.dispatchEvent(new CustomEvent("chat-response-received",{detail:{text:l,actions:c},bubbles:!0}))}catch(s){let o=s instanceof Error?s.message:"An unexpected error occurred";this._error=o}finally{this._isLoading=!1}},ga.properties={config:{attribute:!1},runtime:{attribute:!1},tileId:{type:String},_messages:{state:!0},_isLoading:{state:!0},_error:{state:!0}};var Gg="syntro-chat-assistant",Vw=()=>{typeof window>"u"||customElements.get(Gg)||customElements.define(Gg,ga)},em={mount(n,e){let{config:t,runtime:r,tileId:i="chatbot-widget"}=e??{};if(!t||!r)return n.innerHTML=`<div style="padding: 16px; color: var(--sc-content-text-secondary-color, ${Xg});">Chat widget requires config and runtime.</div>`,()=>{n.innerHTML=""};Vw();let s=document.createElement("syntro-chat-assistant");return s.config=t,s.runtime=r,s.tileId=i,s.style.cssText="display:flex;flex-direction:column;height:100%;width:100%;",n.appendChild(s),()=>{s.remove()}}};var tm={id:"adaptive-chatbot",version:"1.0.0",name:"Chat Assistant",description:"AI chat assistant with action execution capabilities",executors:[],widgets:[{id:"adaptive-chatbot:assistant",component:em,metadata:{name:"Chat Assistant",description:"AI-powered chat assistant that can execute DOM actions",icon:"\u{1F4AC}"}}]};function nm(n,e,t){if(e){let r=n.getState().items.find(i=>i.config.id===e);if(r)return r}if(t){let r=n.findByQuestion(t);if(r)return r}throw new Error("FAQ item not found")}async function Ww(n,e,t){let r=nm(t,n.itemId,n.itemQuestion),{id:i}=r.config;n.expand!==!1&&t.expand(i);let s=document.querySelector(`[data-faq-item-id="${i}"]`);return s&&s.scrollIntoView({behavior:n.behavior??"smooth"}),e.publishEvent("faq:scroll_to",{itemId:i}),{cleanup:()=>{}}}async function jw(n,e,t){let r=nm(t,n.itemId,n.itemQuestion),{id:i}=r.config,s=n.state??"toggle",o;switch(s){case"open":t.expand(i),o="open";break;case"closed":t.collapse(i),o="closed";break;default:{let a=t.getState().expandedItems.has(i);t.toggle(i),o=a?"closed":"open";break}}return e.publishEvent("faq:toggle",{itemId:i,newState:o}),{cleanup:()=>{}}}async function Uw(n,e,t){switch(n.operation){case"add":{let r=n.items??[],i=n.position==="prepend"?"prepend":"append";t.addItems(r,i);break}case"remove":{if(!n.itemId)throw new Error("FAQ item not found");if(!t.getState().items.some(i=>i.config.id===n.itemId))throw new Error("FAQ item not found");t.removeItem(n.itemId);break}case"reorder":{let r=n.order??[];t.reorderItems(r);break}case"replace":{let r=n.items??[];t.replaceItems(r);break}}return e.publishEvent("faq:update",{operation:n.operation}),{cleanup:()=>{}}}var rm=[{kind:"faq:scroll_to",executor:Ww},{kind:"faq:toggle_item",executor:jw},{kind:"faq:update",executor:Uw}];var _s=class extends ti{constructor(e){if(super(e),this.it=Q,e.type!==da.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Q||e==null)return this._t=void 0,this.it=e;if(e===It)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};_s.directiveName="unsafeHTML",_s.resultType=1;var va=pa(_s);function Qc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var lr=Qc();function um(n){lr=n}var or={exec:()=>null};function pe(n,e=""){let t=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Ye.caret,"$1"),t=t.replace(i,o),r},getRegex:()=>new RegExp(t,e)};return r}var zw=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ye={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},qw=/^(?:[ \t]*(?:\n|$))+/,Zw=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Gw=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ss=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Kw=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Jc=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,dm=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,pm=pe(dm).replace(/bull/g,Jc).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Yw=pe(dm).replace(/bull/g,Jc).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),eu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Xw=/^[^\n]+/,tu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Qw=pe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",tu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Jw=pe(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Jc).getRegex(),ka="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",nu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ek=pe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",nu).replace("tag",ka).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),hm=pe(eu).replace("hr",Ss).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ka).getRegex(),tk=pe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",hm).getRegex(),ru={blockquote:tk,code:Zw,def:Qw,fences:Gw,heading:Kw,hr:Ss,html:ek,lheading:pm,list:Jw,newline:qw,paragraph:hm,table:or,text:Xw},im=pe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ss).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ka).getRegex(),nk={...ru,lheading:Yw,table:im,paragraph:pe(eu).replace("hr",Ss).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",im).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ka).getRegex()},rk={...ru,html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",nu).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:or,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:pe(eu).replace("hr",Ss).replace("heading",` *#{1,6} *[^
|
|
182
|
-
]`).replace("lheading",
|
|
181
|
+
`}clearMessages(){this._messages=[],this._error=null,I(this,gt)?.isApplied()&&(I(this,gt).revertAll().catch(t=>{console.error("[ChatAssistantElement] Failed to revert actions on clear:",t)}),Z(this,gt,null)),sessionStorage.removeItem(`syntro:chatbot:history:${this.tileId}`)}};gt=new WeakMap,_s=new WeakMap,sr=new WeakMap,ii=new WeakSet,rm=function(t){let i=t.role==="user"?{...Xg,...Hw}:{...Xg,...Bw};return D`<div style=${T(i)}>${t.text}</div>`},va=new WeakMap,im=async function(t){let r=t.trim();if(!r||!this.config||!this.runtime)return;this._error=null;let i={id:Jc(),role:"user",text:r,timestamp:Date.now()};this._messages=[...this._messages,i],this._isLoading=!0,this.dispatchEvent(new CustomEvent("chat-message-sent",{detail:{text:r},bubbles:!0}));try{let s=this.config.maxHistory??20,o=[...this._messages].slice(-s).map(d=>({role:d.role,content:d.text})),a=await Yg(this.config.backendUrl,{message:r,history:o,mlflow_run_id:this.config.mlflowRunId}),{displayText:l,actions:c}=Kg(a.response),u={id:Jc(),role:"assistant",text:l,timestamp:Date.now()};this._messages=[...this._messages,u],c.length>0&&(I(this,gt)?.isApplied()&&await I(this,gt).revertAll(),Z(this,gt,await this.runtime.actions.applyBatch(c)),this.runtime.events.publish("chatbot.actions_applied",{count:c.length,kinds:c.map(d=>d.kind),tileId:this.tileId})),this.dispatchEvent(new CustomEvent("chat-response-received",{detail:{text:l,actions:c},bubbles:!0}))}catch(s){let o=s instanceof Error?s.message:"An unexpected error occurred";this._error=o}finally{this._isLoading=!1}},ma.properties={config:{attribute:!1},runtime:{attribute:!1},tileId:{type:String},_messages:{state:!0},_isLoading:{state:!0},_error:{state:!0}};var Qg="syntro-chat-assistant",qw=()=>{typeof window>"u"||customElements.get(Qg)||customElements.define(Qg,ma)},sm={mount(n,e){let{config:t,runtime:r,tileId:i="chatbot-widget"}=e??{};if(!t||!r)return n.innerHTML=`<div style="padding: 16px; color: var(--sc-content-text-secondary-color, ${nm});">Chat widget requires config and runtime.</div>`,()=>{n.innerHTML=""};qw();let s=document.createElement("syntro-chat-assistant");return s.config=t,s.runtime=r,s.tileId=i,s.style.cssText="display:flex;flex-direction:column;height:100%;width:100%;",n.appendChild(s),()=>{s.remove()}}};var om={id:"adaptive-chatbot",version:"1.0.0",name:"Chat Assistant",description:"AI chat assistant with action execution capabilities",executors:[],widgets:[{id:"adaptive-chatbot:assistant",component:sm,metadata:{name:"Chat Assistant",description:"AI-powered chat assistant that can execute DOM actions",icon:"\u{1F4AC}"}}]};function am(n,e,t){if(e){let r=n.getState().items.find(i=>i.config.id===e);if(r)return r}if(t){let r=n.findByQuestion(t);if(r)return r}throw new Error("FAQ item not found")}async function Zw(n,e,t){let r=am(t,n.itemId,n.itemQuestion),{id:i}=r.config;n.expand!==!1&&t.expand(i);let s=document.querySelector(`[data-faq-item-id="${i}"]`);return s&&s.scrollIntoView({behavior:n.behavior??"smooth"}),e.publishEvent("faq:scroll_to",{itemId:i}),{cleanup:()=>{}}}async function Gw(n,e,t){let r=am(t,n.itemId,n.itemQuestion),{id:i}=r.config,s=n.state??"toggle",o;switch(s){case"open":t.expand(i),o="open";break;case"closed":t.collapse(i),o="closed";break;default:{let a=t.getState().expandedItems.has(i);t.toggle(i),o=a?"closed":"open";break}}return e.publishEvent("faq:toggle",{itemId:i,newState:o}),{cleanup:()=>{}}}async function Kw(n,e,t){switch(n.operation){case"add":{let r=n.items??[],i=n.position==="prepend"?"prepend":"append";t.addItems(r,i);break}case"remove":{if(!n.itemId)throw new Error("FAQ item not found");if(!t.getState().items.some(i=>i.config.id===n.itemId))throw new Error("FAQ item not found");t.removeItem(n.itemId);break}case"reorder":{let r=n.order??[];t.reorderItems(r);break}case"replace":{let r=n.items??[];t.replaceItems(r);break}}return e.publishEvent("faq:update",{operation:n.operation}),{cleanup:()=>{}}}var lm=[{kind:"faq:scroll_to",executor:Zw},{kind:"faq:toggle_item",executor:Gw},{kind:"faq:update",executor:Kw}];var xs=class extends ti{constructor(e){if(super(e),this.it=J,e.type!==pa.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===J||e==null)return this._t=void 0,this.it=e;if(e===$t)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};xs.directiveName="unsafeHTML",xs.resultType=1;var ya=ha(xs);function nu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var lr=nu();function gm(n){lr=n}var or={exec:()=>null};function he(n,e=""){let t=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Xe.caret,"$1"),t=t.replace(i,o),r},getRegex:()=>new RegExp(t,e)};return r}var Yw=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Xe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},Xw=/^(?:[ \t]*(?:\n|$))+/,Jw=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Qw=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Es=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ek=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ru=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,mm=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,vm=he(mm).replace(/bull/g,ru).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),tk=he(mm).replace(/bull/g,ru).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),iu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,nk=/^[^\n]+/,su=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,rk=he(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",su).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ik=he(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ru).getRegex(),Sa="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ou=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sk=he("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ou).replace("tag",Sa).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ym=he(iu).replace("hr",Es).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Sa).getRegex(),ok=he(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ym).getRegex(),au={blockquote:ok,code:Jw,def:rk,fences:Qw,heading:ek,hr:Es,html:sk,lheading:vm,list:ik,newline:Xw,paragraph:ym,table:or,text:nk},cm=he("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Es).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Sa).getRegex(),ak={...au,lheading:tk,table:cm,paragraph:he(iu).replace("hr",Es).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",cm).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Sa).getRegex()},lk={...au,html:he(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ou).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:or,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:he(iu).replace("hr",Es).replace("heading",` *#{1,6} *[^
|
|
182
|
+
]`).replace("lheading",vm).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ck=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,uk=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,bm=/^( {2,}|\\)\n(?!\s*$)/,dk=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ea=/[\p{P}\p{S}]/u,lu=/[\s\p{P}\p{S}]/u,_m=/[^\s\p{P}\p{S}]/u,pk=he(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,lu).getRegex(),xm=/(?!~)[\p{P}\p{S}]/u,hk=/(?!~)[\s\p{P}\p{S}]/u,fk=/(?:[^\s\p{P}\p{S}]|~)/u,wm=/(?![*_])[\p{P}\p{S}]/u,gk=/(?![*_])[\s\p{P}\p{S}]/u,mk=/(?:[^\s\p{P}\p{S}]|[*_])/u,vk=he(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Yw?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),km=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,yk=he(km,"u").replace(/punct/g,Ea).getRegex(),bk=he(km,"u").replace(/punct/g,xm).getRegex(),Sm="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",_k=he(Sm,"gu").replace(/notPunctSpace/g,_m).replace(/punctSpace/g,lu).replace(/punct/g,Ea).getRegex(),xk=he(Sm,"gu").replace(/notPunctSpace/g,fk).replace(/punctSpace/g,hk).replace(/punct/g,xm).getRegex(),wk=he("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_m).replace(/punctSpace/g,lu).replace(/punct/g,Ea).getRegex(),kk=he(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,wm).getRegex(),Sk="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ek=he(Sk,"gu").replace(/notPunctSpace/g,mk).replace(/punctSpace/g,gk).replace(/punct/g,wm).getRegex(),Ck=he(/\\(punct)/,"gu").replace(/punct/g,Ea).getRegex(),Ak=he(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Rk=he(ou).replace("(?:-->|$)","-->").getRegex(),Tk=he("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Rk).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),xa=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Ik=he(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",xa).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Em=he(/^!?\[(label)\]\[(ref)\]/).replace("label",xa).replace("ref",su).getRegex(),Cm=he(/^!?\[(ref)\](?:\[\])?/).replace("ref",su).getRegex(),$k=he("reflink|nolink(?!\\()","g").replace("reflink",Em).replace("nolink",Cm).getRegex(),um=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,cu={_backpedal:or,anyPunctuation:Ck,autolink:Ak,blockSkip:vk,br:bm,code:uk,del:or,delLDelim:or,delRDelim:or,emStrongLDelim:yk,emStrongRDelimAst:_k,emStrongRDelimUnd:wk,escape:ck,link:Ik,nolink:Cm,punctuation:pk,reflink:Em,reflinkSearch:$k,tag:Tk,text:dk,url:or},Mk={...cu,link:he(/^!?\[(label)\]\((.*?)\)/).replace("label",xa).getRegex(),reflink:he(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",xa).getRegex()},Qc={...cu,emStrongRDelimAst:xk,emStrongLDelim:bk,delLDelim:kk,delRDelim:Ek,url:he(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",um).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:he(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",um).getRegex()},Pk={...Qc,br:he(bm).replace("{2,}","*").getRegex(),text:he(Qc.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ba={normal:au,gfm:ak,pedantic:lk},ws={normal:cu,gfm:Qc,breaks:Pk,pedantic:Mk},Ok={"&":"&","<":"<",">":">",'"':""","'":"'"},dm=n=>Ok[n];function Bt(n,e){if(e){if(Xe.escapeTest.test(n))return n.replace(Xe.escapeReplace,dm)}else if(Xe.escapeTestNoEncode.test(n))return n.replace(Xe.escapeReplaceNoEncode,dm);return n}function pm(n){try{n=encodeURI(n).replace(Xe.percentDecode,"%")}catch{return null}return n}function hm(n,e){let t=n.replace(Xe.findPipe,(s,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=t.split(Xe.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Xe.slashPipe,"|");return r}function ks(n,e,t){let r=n.length;if(r===0)return"";let i=0;for(;i<r;){let s=n.charAt(r-i-1);if(s===e&&!t)i++;else if(s!==e&&t)i++;else break}return n.slice(0,r-i)}function Nk(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===e[0])t++;else if(n[r]===e[1]&&(t--,t<0))return r;return t>0?-2:-1}function Lk(n,e=0){let t=e,r="";for(let i of n)if(i===" "){let s=4-t%4;r+=" ".repeat(s),t+=s}else r+=i,t++;return r}function fm(n,e,t,r,i){let s=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function Fk(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
|
|
183
183
|
`).map(s=>{let o=s.match(t.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
|
|
184
|
-
`)}var
|
|
185
|
-
`)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=
|
|
186
|
-
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=
|
|
184
|
+
`)}var wa=class{constructor(n){ve(this,"options");ve(this,"rules");ve(this,"lexer");this.options=n||lr}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:ks(t,`
|
|
185
|
+
`)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=Fk(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let r=ks(t,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(t=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:ks(e[0],`
|
|
186
|
+
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=ks(e[0],`
|
|
187
187
|
`).split(`
|
|
188
188
|
`),r="",i="",s=[];for(;t.length>0;){let o=!1,a=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))a.push(t[l]),o=!0;else if(!o)a.push(t[l]);else break;t=t.slice(l);let c=a.join(`
|
|
189
189
|
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
@@ -194,17 +194,17 @@ ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
194
194
|
`),f=this.blockquote(v);s[s.length-1]=f,r=r.substring(0,r.length-g.raw.length)+f.raw,i=i.substring(0,i.length-g.text.length)+f.text;break}else if(h?.type==="list"){let g=h,v=g.raw+`
|
|
195
195
|
`+t.join(`
|
|
196
196
|
`),f=this.list(v);s[s.length-1]=f,r=r.substring(0,r.length-h.raw.length)+f.raw,i=i.substring(0,i.length-g.raw.length)+f.raw,t=v.substring(s.at(-1).raw.length).split(`
|
|
197
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),r=t.length>1,i={type:"list",raw:"",ordered:r,start:r?+t.slice(0,-1):"",loose:!1,items:[]};t=r?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=r?t:"[*+-]");let s=this.rules.other.listItemRegex(t),o=!1;for(;n;){let l=!1,c="",u="";if(!(e=s.exec(n))||this.rules.block.hr.test(n))break;c=e[0],n=n.substring(c.length);let d
|
|
197
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),r=t.length>1,i={type:"list",raw:"",ordered:r,start:r?+t.slice(0,-1):"",loose:!1,items:[]};t=r?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=r?t:"[*+-]");let s=this.rules.other.listItemRegex(t),o=!1;for(;n;){let l=!1,c="",u="";if(!(e=s.exec(n))||this.rules.block.hr.test(n))break;c=e[0],n=n.substring(c.length);let d=Lk(e[2].split(`
|
|
198
198
|
`,1)[0],e[1].length),h=n.split(`
|
|
199
199
|
`,1)[0],g=!d.trim(),v=0;if(this.options.pedantic?(v=2,u=d.trimStart()):g?v=e[1].length+1:(v=d.search(this.rules.other.nonSpaceChar),v=v>4?1:v,u=d.slice(v),v+=e[1].length),g&&this.rules.other.blankLine.test(h)&&(c+=h+`
|
|
200
|
-
`,n=n.substring(h.length+1),l=!0),!l){let f=this.rules.other.nextBulletRegex(v),m=this.rules.other.hrRegex(v),y=this.rules.other.fencesBeginRegex(v),k=this.rules.other.headingBeginRegex(v),_=this.rules.other.htmlBeginRegex(v),b=this.rules.other.blockquoteBeginRegex(v);for(;n;){let
|
|
201
|
-
`,1)[0],
|
|
202
|
-
`+
|
|
203
|
-
`+h}g=!h.trim(),c+=
|
|
204
|
-
`,n=n.substring(
|
|
205
|
-
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<t.length;o++)s.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:s.align[o]});for(let o of i)s.rows.push(
|
|
206
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=
|
|
207
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){for(this.options.pedantic&&(e=e.replace(
|
|
200
|
+
`,n=n.substring(h.length+1),l=!0),!l){let f=this.rules.other.nextBulletRegex(v),m=this.rules.other.hrRegex(v),y=this.rules.other.fencesBeginRegex(v),k=this.rules.other.headingBeginRegex(v),_=this.rules.other.htmlBeginRegex(v),b=this.rules.other.blockquoteBeginRegex(v);for(;n;){let x=n.split(`
|
|
201
|
+
`,1)[0],R;if(h=x,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),R=h):R=h.replace(this.rules.other.tabCharGlobal," "),y.test(h)||k.test(h)||_.test(h)||b.test(h)||f.test(h)||m.test(h))break;if(R.search(this.rules.other.nonSpaceChar)>=v||!h.trim())u+=`
|
|
202
|
+
`+R.slice(v);else{if(g||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(d)||k.test(d)||m.test(d))break;u+=`
|
|
203
|
+
`+h}g=!h.trim(),c+=x+`
|
|
204
|
+
`,n=n.substring(x.length+1),d=R.slice(v)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),i.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),i.raw+=c}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let c=this.rules.other.listTaskCheckbox.exec(l.raw);if(c){let u={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};l.checked=u.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=u.raw+l.tokens[0].raw,l.tokens[0].text=u.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(u)):l.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):l.tokens.unshift(u)}}if(!i.loose){let c=l.tokens.filter(d=>d.type==="space"),u=c.length>0&&c.some(d=>this.rules.other.anyLine.test(d.raw));i.loose=u}}if(i.loose)for(let l of i.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return i}}html(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:i}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=hm(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
205
|
+
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<t.length;o++)s.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:s.align[o]});for(let o of i)s.rows.push(hm(o,s.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[l]})));return s}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
206
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=ks(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=Nk(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r=r.slice(1):r=r.slice(1,-1)),fm(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let r=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return fm(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||r[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,a=i,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(r=c.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(o=[...s].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...r[0]][0].length,d=n.slice(0,i+r.index+u+o);if(Math.min(i,o)%2){let g=d.slice(1,-1);return{type:"em",raw:d,text:g,tokens:this.lexer.inlineTokens(g)}}let h=d.slice(2,-2);return{type:"strong",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,a=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*n.length+i);(r=l.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(o=[...s].length,o!==i))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...r[0]][0].length,u=n.slice(0,i+r.index+c+o),d=u.slice(i,-i);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,r;return e[2]==="@"?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,r;if(e[2]==="@")t=e[0],r="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Mt=class eu{constructor(e){ve(this,"tokens");ve(this,"options");ve(this,"state");ve(this,"inlineQueue");ve(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||lr,this.options.tokenizer=this.options.tokenizer||new wa,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Xe,block:ba.normal,inline:ws.normal};this.options.pedantic?(t.block=ba.pedantic,t.inline=ws.pedantic):this.options.gfm&&(t.block=ba.gfm,this.options.breaks?t.inline=ws.breaks:t.inline=ws.gfm),this.tokenizer.rules=t}static get rules(){return{block:ba,inline:ws}}static lex(e,t){return new eu(t).lex(e)}static lexInline(e,t){return new eu(t).inlineTokens(e)}lex(e){e=e.replace(Xe.carriageReturn,`
|
|
207
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){for(this.options.pedantic&&(e=e.replace(Xe.tabCharGlobal," ").replace(Xe.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let o=t.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
|
|
208
208
|
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
209
209
|
`)?"":`
|
|
210
210
|
`)+i.raw,o.text+=`
|
|
@@ -217,9 +217,9 @@ ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
217
217
|
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(i),r=s.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
218
218
|
`)?"":`
|
|
219
219
|
`)+i.raw,o.text+=`
|
|
220
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(i);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r=e,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let l;if(this.options.extensions?.inline?.some(u=>(l=u.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let u=t.at(-1);l.type==="text"&&u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,r,a)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e,r,a)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let c=e;if(this.options.extensions?.startInline){let u=1/0,d=e.slice(1),h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},d),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(l=this.tokenizer.inlineText(c)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),o=!0;let u=t.at(-1);u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):t.push(l);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}},
|
|
221
|
-
`;return r?'<pre><code class="language-'+
|
|
222
|
-
`:"<pre><code>"+(t?i:
|
|
220
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(i);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r=e,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let l;if(this.options.extensions?.inline?.some(u=>(l=u.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let u=t.at(-1);l.type==="text"&&u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,r,a)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e,r,a)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let c=e;if(this.options.extensions?.startInline){let u=1/0,d=e.slice(1),h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},d),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(l=this.tokenizer.inlineText(c)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),o=!0;let u=t.at(-1);u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):t.push(l);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}},ka=class{constructor(n){ve(this,"options");ve(this,"parser");this.options=n||lr}space(n){return""}code({text:n,lang:e,escaped:t}){let r=(e||"").match(Xe.notSpaceStart)?.[0],i=n.replace(Xe.endingNewline,"")+`
|
|
221
|
+
`;return r?'<pre><code class="language-'+Bt(r)+'">'+(t?i:Bt(i,!0))+`</code></pre>
|
|
222
|
+
`:"<pre><code>"+(t?i:Bt(i,!0))+`</code></pre>
|
|
223
223
|
`}blockquote({tokens:n}){return`<blockquote>
|
|
224
224
|
${this.parser.parse(n)}</blockquote>
|
|
225
225
|
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
@@ -235,24 +235,24 @@ ${this.parser.parse(n)}</blockquote>
|
|
|
235
235
|
`}tablerow({text:n}){return`<tr>
|
|
236
236
|
${n}</tr>
|
|
237
237
|
`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
238
|
-
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${
|
|
239
|
-
Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+
|
|
238
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${Bt(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let r=this.parser.parseInline(t),i=pm(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return e&&(s+=' title="'+Bt(e)+'"'),s+=">"+r+"</a>",s}image({href:n,title:e,text:t,tokens:r}){r&&(t=this.parser.parseInline(r,this.parser.textRenderer));let i=pm(n);if(i===null)return Bt(t);n=i;let s=`<img src="${n}" alt="${Bt(t)}"`;return e&&(s+=` title="${Bt(e)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Bt(n.text)}},uu=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},Pt=class tu{constructor(e){ve(this,"options");ve(this,"renderer");ve(this,"textRenderer");this.options=e||lr,this.options.renderer=this.options.renderer||new ka,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new uu}static parse(e,t){return new tu(t).parse(e)}static parseInline(e,t){return new tu(t).parseInline(e)}parse(e){let t="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let s=i;switch(s.type){case"space":{t+=this.renderer.space(s);break}case"hr":{t+=this.renderer.hr(s);break}case"heading":{t+=this.renderer.heading(s);break}case"code":{t+=this.renderer.code(s);break}case"table":{t+=this.renderer.table(s);break}case"blockquote":{t+=this.renderer.blockquote(s);break}case"list":{t+=this.renderer.list(s);break}case"checkbox":{t+=this.renderer.checkbox(s);break}case"html":{t+=this.renderer.html(s);break}case"def":{t+=this.renderer.def(s);break}case"paragraph":{t+=this.renderer.paragraph(s);break}case"text":{t+=this.renderer.text(s);break}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){let r="";for(let i=0;i<e.length;i++){let s=e[i];if(this.options.extensions?.renderers?.[s.type]){let a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=a||"";continue}}let o=s;switch(o.type){case"escape":{r+=t.text(o);break}case"html":{r+=t.html(o);break}case"link":{r+=t.link(o);break}case"image":{r+=t.image(o);break}case"checkbox":{r+=t.checkbox(o);break}case"strong":{r+=t.strong(o);break}case"em":{r+=t.em(o);break}case"codespan":{r+=t.codespan(o);break}case"br":{r+=t.br(o);break}case"del":{r+=t.del(o);break}case"text":{r+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},_a,Ss=(_a=class{constructor(n){ve(this,"options");ve(this,"block");this.options=n||lr}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?Mt.lex:Mt.lexInline}provideParser(){return this.block?Pt.parse:Pt.parseInline}},ve(_a,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ve(_a,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),_a),du=class{constructor(...n){ve(this,"defaults",nu());ve(this,"options",this.setOptions);ve(this,"parse",this.parseMarkdown(!0));ve(this,"parseInline",this.parseMarkdown(!1));ve(this,"Parser",Pt);ve(this,"Renderer",ka);ve(this,"TextRenderer",uu);ve(this,"Lexer",Mt);ve(this,"Tokenizer",wa);ve(this,"Hooks",Ss);this.use(...n)}walkTokens(n,e){let t=[];for(let r of n)switch(t=t.concat(e.call(this,r)),r.type){case"table":{let i=r;for(let s of i.header)t=t.concat(this.walkTokens(s.tokens,e));for(let s of i.rows)for(let o of s)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=r;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{let o=i[s].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),t.renderer){let i=this.defaults.renderer||new ka(this.defaults);for(let s in t.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=t.renderer[o],l=i[o];i[o]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u||""}}r.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new wa(this.defaults);for(let s in t.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=t.tokenizer[o],l=i[o];i[o]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}r.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Ss;for(let s in t.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=t.hooks[o],l=i[o];Ss.passThroughHooks.has(s)?i[o]=c=>{if(this.defaults.async&&Ss.passThroughHooksRespectAsync.has(s))return(async()=>{let d=await a.call(i,c);return l.call(i,d)})();let u=a.call(i,c);return l.call(i,u)}:i[o]=(...c)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(i,c);return d===!1&&(d=await l.apply(i,c)),d})();let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}r.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,s=t.walkTokens;r.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return Mt.lex(n,e??this.defaults)}parser(n,e){return Pt.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let r={...t},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer():n?Mt.lex:Mt.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let c=await(i.hooks?await i.hooks.provideParser():n?Pt.parse:Pt.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(c):c})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer():n?Mt.lex:Mt.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():n?Pt.parse:Pt.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(n,e){return t=>{if(t.message+=`
|
|
239
|
+
Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+Bt(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},ar=new du;function ye(n,e){return ar.parse(n,e)}ye.options=ye.setOptions=function(n){return ar.setOptions(n),ye.defaults=ar.defaults,gm(ye.defaults),ye};ye.getDefaults=nu;ye.defaults=lr;ye.use=function(...n){return ar.use(...n),ye.defaults=ar.defaults,gm(ye.defaults),ye};ye.walkTokens=function(n,e){return ar.walkTokens(n,e)};ye.parseInline=ar.parseInline;ye.Parser=Pt;ye.parser=Pt.parse;ye.Renderer=ka;ye.TextRenderer=uu;ye.Lexer=Mt;ye.lexer=Mt.lex;ye.Tokenizer=wa;ye.Hooks=Ss;ye.parse=ye;var r$=ye.options,i$=ye.setOptions,s$=ye.use,o$=ye.walkTokens,a$=ye.parseInline;var l$=Pt.parse,c$=Mt.lex;var Ve={container:{fontFamily:"var(--sc-font-family, system-ui, -apple-system, sans-serif)",maxWidth:"800px",margin:"0 auto"},searchWrapper:{marginBottom:"8px"},searchInput:{width:"100%",padding:"12px 16px",borderRadius:"8px",fontSize:"14px",outline:"none",transition:"border-color 0.15s ease",backgroundColor:"var(--sc-content-search-background)",color:"var(--sc-content-search-color)"},accordion:{display:"flex",flexDirection:"column",gap:"var(--sc-content-item-gap, 6px)"},item:{borderRadius:"var(--sc-content-border-radius, 8px)",overflow:"hidden",transition:"box-shadow 0.15s ease"},question:{width:"100%",padding:"var(--sc-content-item-padding, 12px 16px)",display:"flex",alignItems:"center",justifyContent:"space-between",border:"none",cursor:"pointer",fontSize:"var(--sc-content-item-font-size, 15px)",fontWeight:500,textAlign:"left",transition:"background-color 0.15s ease"},chevron:{fontSize:"20px",transition:"transform 0.2s ease",color:"var(--sc-content-chevron-color, currentColor)"},answer:{padding:"var(--sc-content-body-padding, 0 16px 12px 16px)",fontSize:"var(--sc-content-body-font-size, 14px)",lineHeight:1.6,overflow:"hidden",transition:"max-height 0.2s ease, padding 0.2s ease"},category:{display:"inline-block",fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",padding:"4px 8px",borderRadius:"4px",marginBottom:"8px"},categoryHeader:{fontSize:"var(--sc-content-category-font-size, 12px)",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",padding:"var(--sc-content-category-padding, 8px 4px 4px 4px)",marginTop:"var(--sc-content-category-gap, 4px)"},feedback:{display:"flex",alignItems:"center",gap:"8px",marginTop:"12px",paddingTop:"10px",borderTop:"1px solid rgba(0, 0, 0, 0.08)",fontSize:"13px"},feedbackButton:{background:"none",border:"1px solid transparent",cursor:"pointer",fontSize:"16px",padding:"4px 8px",borderRadius:"4px",transition:"background-color 0.15s ease, border-color 0.15s ease"},feedbackButtonSelected:{borderColor:"rgba(0, 0, 0, 0.2)",backgroundColor:"rgba(0, 0, 0, 0.04)"},emptyState:{textAlign:"center",padding:"48px 24px",fontSize:"14px"},noResults:{textAlign:"center",padding:"32px 16px",fontSize:"14px"}},Ca={light:{container:{backgroundColor:"transparent",color:"inherit"},searchInput:{border:`1px solid ${S[11]}`},item:{backgroundColor:"var(--sc-content-background)",borderTop:"var(--sc-content-border)",borderRight:"var(--sc-content-border)",borderBottom:"var(--sc-content-border)",borderLeft:"var(--sc-content-border)"},itemExpanded:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.08)"},question:{backgroundColor:"transparent",color:"var(--sc-content-text-color)"},questionHover:{backgroundColor:"var(--sc-content-background-hover)"},answer:{color:"var(--sc-content-text-secondary-color)"},category:{backgroundColor:Ye[8],color:Ye[2]},categoryHeader:{color:S[7]},emptyState:{color:S[8]},feedbackPrompt:{color:S[7]}},dark:{container:{backgroundColor:"transparent",color:"inherit"},searchInput:{border:`1px solid ${S[5]}`},item:{backgroundColor:"var(--sc-content-background)",borderTop:"var(--sc-content-border)",borderRight:"var(--sc-content-border)",borderBottom:"var(--sc-content-border)",borderLeft:"var(--sc-content-border)"},itemExpanded:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"},question:{backgroundColor:"transparent",color:"var(--sc-content-text-color)"},questionHover:{backgroundColor:"var(--sc-content-background-hover)"},answer:{color:"var(--sc-content-text-secondary-color)"},category:{backgroundColor:Ye[0],color:Ye[6]},categoryHeader:{color:S[8]},emptyState:{color:S[7]},feedbackPrompt:{color:S[8]}}};var Am=new du({async:!1,gfm:!0,breaks:!0});function Dk(n){return typeof n=="string"?n:n.type==="rich"?n.html:n.content}function Hk(n){return typeof n=="string"?Am.parse(n):n.type==="rich"?n.html:Am.parse(n.content)}function Bk(n){return n?n===!0?{style:"thumbs"}:n:null}function Vk(n){return n.prompt??"Was this helpful?"}function Wk(n){return n&&n!=="auto"?n:typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var Aa=class extends ge{constructor(){super(...arguments);this.faqConfig={expandBehavior:"single",searchable:!1,theme:"auto",actions:[]};this.runtime=null;this.instanceId="faq-widget";this._expandedIds=new Set;this._highlightId=null;this._searchQuery="";this._feedbackState=new Map;this._hoveredId=null;this._unsubContext=null;this._unsubAccumulator=null;this._unsubCta=null;this._unsubDeepLink=null;this._unsubSessionMetrics=null;this._highlightTimer=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._subscribeAll()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeAll(),this._highlightTimer!==null&&(clearTimeout(this._highlightTimer),this._highlightTimer=null)}updated(t){t.has("runtime")&&(this._unsubscribeAll(),this._subscribeAll())}_subscribeAll(){if(this.runtime){if(this._unsubContext=this.runtime.context.subscribe(()=>{this.requestUpdate()}),this.runtime.accumulator?.subscribe&&(this._unsubAccumulator=this.runtime.accumulator.subscribe(()=>{this.requestUpdate()})),this.runtime.sessionMetrics?.subscribe&&(this._unsubSessionMetrics=this.runtime.sessionMetrics.subscribe(()=>{this.requestUpdate()})),this.runtime.events.subscribe){if(this.runtime.events.getRecent){let r=this.runtime.events.getRecent({patterns:["^action\\.tooltip_cta_clicked$","^action\\.modal_cta_clicked$"]},10).filter(i=>{let s=i.props?.actionId;return typeof s=="string"&&s.startsWith("faq:open:")}).pop();if(r&&Date.now()-r.ts<1e4){let i=r.props.actionId.replace("faq:open:","");this._expandedIds=new Set([i]),requestAnimationFrame(()=>{let s=document.querySelector(`[data-faq-item-id="${i}"]`);s&&s.scrollIntoView({behavior:"smooth",block:"center"})})}}this._unsubCta=this.runtime.events.subscribe({patterns:["^action\\.tooltip_cta_clicked$","^action\\.modal_cta_clicked$"]},t=>{let r=t.props?.actionId;if(typeof r!="string"||!r.startsWith("faq:open:"))return;let i=r.replace("faq:open:","");this._expandedIds=new Set([i]),requestAnimationFrame(()=>{let s=document.querySelector(`[data-faq-item-id="${i}"]`);s&&s.scrollIntoView({behavior:"smooth",block:"center"})}),this.runtime?.events.publish("canvas.requestOpen")})}if(this.runtime.events.subscribe){let t=r=>{let i=r.props?.tileId,s=r.props?.itemId;i===this.instanceId&&s&&(this._expandedIds=new Set([s]),this._highlightId=s,this._highlightTimer!==null&&clearTimeout(this._highlightTimer),this._highlightTimer=setTimeout(()=>{this._highlightId=null,this._highlightTimer=null},1500),requestAnimationFrame(()=>{let o=document.querySelector(`[data-faq-item-id="${s}"]`);o&&o.scrollIntoView({behavior:"smooth",block:"center"})}))};if(this.runtime.events.getRecent){let i=this.runtime.events.getRecent({names:["notification.deep_link"]},5).filter(s=>s.props?.tileId===this.instanceId&&s.props?.itemId).pop();i&&Date.now()-i.ts<1e4&&t(i)}this._unsubDeepLink=this.runtime.events.subscribe({names:["notification.deep_link"]},t)}}}_unsubscribeAll(){this._unsubContext?.(),this._unsubAccumulator?.(),this._unsubSessionMetrics?.(),this._unsubCta?.(),this._unsubDeepLink?.(),this._unsubContext=null,this._unsubAccumulator=null,this._unsubSessionMetrics=null,this._unsubCta=null,this._unsubDeepLink=null}_handleToggle(t){let r=this._expandedIds,i;this.faqConfig.expandBehavior==="single"?i=r.has(t)?new Set:new Set([t]):(i=new Set(r),r.has(t)?i.delete(t):i.add(t));let s=!r.has(t);this._expandedIds=i,this.runtime?.events.publish("faq:toggled",{instanceId:this.instanceId,questionId:t,expanded:s,timestamp:Date.now()})}_handleFeedback(t,r,i){let s=new Map(this._feedbackState);s.set(t,i),this._feedbackState=s,this.runtime?.events.publish("faq:feedback",{itemId:t,question:r,value:i})}_visibleQuestions(){return(this.faqConfig.actions??[]).filter(t=>!t.triggerWhen||!this.runtime?!0:this.runtime.evaluateSync(t.triggerWhen).value)}_orderedQuestions(t){return this.faqConfig.ordering==="priority"?[...t].sort((r,i)=>(i.config.priority??0)-(r.config.priority??0)):t}_filteredQuestions(t){let r=this._searchQuery.trim().toLowerCase();return!this.faqConfig.searchable||!r?t:t.filter(i=>i.config.question.toLowerCase().includes(r)||Dk(i.config.answer).toLowerCase().includes(r)||i.config.category?.toLowerCase().includes(r))}_categoryGroups(t){let r=new Map;for(let i of t){let s=i.config.category;r.has(s)||r.set(s,[]),r.get(s).push(i)}return r}_renderAnswer(t){let r=Hk(t);return D`<div style="margin:0" data-faq-markdown="">${ya(r)}</div>`}_renderFeedback(t,r,i,s){let o=Ca[s],a={...Ve.feedback,...o.feedbackPrompt};return D`
|
|
240
240
|
<div style=${T(a)}>
|
|
241
|
-
<span>${
|
|
241
|
+
<span>${Vk(r)}</span>
|
|
242
242
|
<button
|
|
243
243
|
type="button"
|
|
244
|
-
style=${T({...
|
|
244
|
+
style=${T({...Ve.feedbackButton,...i==="up"?Ve.feedbackButtonSelected:{}})}
|
|
245
245
|
aria-label="Thumbs up"
|
|
246
246
|
@click=${()=>this._handleFeedback(t.config.id,t.config.question,"up")}
|
|
247
247
|
>\uD83D\uDC4D</button>
|
|
248
248
|
<button
|
|
249
249
|
type="button"
|
|
250
|
-
style=${T({...
|
|
250
|
+
style=${T({...Ve.feedbackButton,...i==="down"?Ve.feedbackButtonSelected:{}})}
|
|
251
251
|
aria-label="Thumbs down"
|
|
252
252
|
@click=${()=>this._handleFeedback(t.config.id,t.config.question,"down")}
|
|
253
253
|
>\uD83D\uDC4E</button>
|
|
254
254
|
</div>
|
|
255
|
-
`}_renderItem(t,r,i,s){let o=
|
|
255
|
+
`}_renderItem(t,r,i,s){let o=Ca[i],a=this._expandedIds.has(t.config.id),l=this._highlightId===t.config.id,c=this._hoveredId===t.config.id,u={...Ve.item,...o.item,...a?o.itemExpanded:{},...l?{boxShadow:`0 0 0 2px ${Ye[4]}, 0 0 12px rgba(106, 89, 206, 0.4)`,transition:"box-shadow 0.3s ease"}:{},...r?{}:{borderBottom:"var(--sc-content-item-divider, none)"}},d={...Ve.question,...o.question,...c?o.questionHover:{}},h={...Ve.chevron,transform:a?"rotate(90deg)":"rotate(0deg)"},g={...Ve.answer,...o.answer,maxHeight:a?"500px":"0",paddingBottom:a?"16px":"0"};return D`
|
|
256
256
|
<div
|
|
257
257
|
style=${T(u)}
|
|
258
258
|
data-faq-item-id=${t.config.id}
|
|
@@ -274,10 +274,10 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
274
274
|
aria-hidden=${!a}
|
|
275
275
|
>
|
|
276
276
|
${this._renderAnswer(t.config.answer)}
|
|
277
|
-
${a&&s?this._renderFeedback(t,s,this._feedbackState.get(t.config.id),i):
|
|
277
|
+
${a&&s?this._renderFeedback(t,s,this._feedbackState.get(t.config.id),i):J}
|
|
278
278
|
</div>
|
|
279
279
|
</div>
|
|
280
|
-
`}_renderItems(t,r,i){return t.map((s,o)=>this._renderItem(s,o===t.length-1,r,i))}render(){let t=
|
|
280
|
+
`}_renderItems(t,r,i){return t.map((s,o)=>this._renderItem(s,o===t.length-1,r,i))}render(){let t=Wk(this.faqConfig.theme),r=Ca[t],i=Bk(this.faqConfig.feedback),s=this._visibleQuestions(),o=this._orderedQuestions(s),a=this._filteredQuestions(o),c=a.some(v=>v.config.category)?this._categoryGroups(a):null,u={...Ve.container,...r.container},d={...Ve.emptyState,...r.emptyState},h={...Ve.categoryHeader,...r.categoryHeader},g={...Ve.searchInput,...r.searchInput};return s.length===0?D`
|
|
281
281
|
<div
|
|
282
282
|
style=${T(u)}
|
|
283
283
|
data-adaptive-id=${this.instanceId}
|
|
@@ -295,7 +295,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
295
295
|
data-adaptive-type="adaptive-faq"
|
|
296
296
|
>
|
|
297
297
|
${this.faqConfig.searchable?D`
|
|
298
|
-
<div style=${T(
|
|
298
|
+
<div style=${T(Ve.searchWrapper)}>
|
|
299
299
|
<style>
|
|
300
300
|
[data-adaptive-id="${this.instanceId}"] input::placeholder {
|
|
301
301
|
color: var(--sc-content-search-color, inherit);
|
|
@@ -310,9 +310,9 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
310
310
|
@input=${v=>{this._searchQuery=v.target.value}}
|
|
311
311
|
/>
|
|
312
312
|
</div>
|
|
313
|
-
`:
|
|
313
|
+
`:J}
|
|
314
314
|
|
|
315
|
-
<div style=${T(
|
|
315
|
+
<div style=${T(Ve.accordion)}>
|
|
316
316
|
${c?Array.from(c.entries()).map(([v,f])=>D`
|
|
317
317
|
${v?D`
|
|
318
318
|
<div
|
|
@@ -321,20 +321,20 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
321
321
|
>
|
|
322
322
|
${v}
|
|
323
323
|
</div>
|
|
324
|
-
`:
|
|
324
|
+
`:J}
|
|
325
325
|
${this._renderItems(f,t,i)}
|
|
326
326
|
`):this._renderItems(a,t,i)}
|
|
327
327
|
</div>
|
|
328
328
|
|
|
329
329
|
${this.faqConfig.searchable&&a.length===0&&this._searchQuery?D`
|
|
330
330
|
<div
|
|
331
|
-
style=${T({...
|
|
331
|
+
style=${T({...Ve.noResults,...r.emptyState})}
|
|
332
332
|
>
|
|
333
333
|
No questions found matching "${this._searchQuery}"
|
|
334
334
|
</div>
|
|
335
|
-
`:
|
|
335
|
+
`:J}
|
|
336
336
|
</div>
|
|
337
|
-
`}};
|
|
337
|
+
`}};Aa.properties={faqConfig:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_highlightId:{state:!0},_searchQuery:{state:!0},_feedbackState:{state:!0},_hoveredId:{state:!0}};customElements.get("syntro-faq-accordion")||customElements.define("syntro-faq-accordion",Aa);var jk={mount(n,e){let{runtime:t,instanceId:r="faq-widget",...i}=e??{expandBehavior:"single",searchable:!1,theme:"auto",actions:[]},s=document.createElement("syntro-faq-accordion");return Object.assign(s,{faqConfig:i,runtime:t??null,instanceId:r}),n.appendChild(s),()=>s.remove()}},Rm={id:"adaptive-faq",version:"2.0.0",name:"FAQ Accordion",description:"Collapsible Q&A accordion with actions, rich content, feedback, and personalization",executors:lm,widgets:[{id:"adaptive-faq:accordion",component:jk,metadata:{name:"FAQ Accordion",description:"Collapsible Q&A accordion with search, categories, and feedback",icon:"\u2753",subtitle:"Curated just for you."}}],notifyWatchers(n){return(n.actions??[]).filter(t=>t.notify&&t.triggerWhen).map(t=>({id:`faq:${t.config.id}`,strategy:t.triggerWhen,eventName:"faq:question_revealed",eventProps:{questionId:t.config.id,question:t.config.question,title:t.notify.title,body:t.notify.body,icon:t.notify.icon}}))}};var Uk=async(n,e)=>{let{badgeId:t}=n;return e.publishEvent("gamification.badge_awarded",{badgeId:t,awardedAt:Date.now()}),{cleanup:()=>{}}},zk=async(n,e)=>{let{points:t,reason:r}=n;return e.publishEvent("gamification.points_added",{points:t,reason:r,timestamp:Date.now()}),{cleanup:()=>{}}},qk={names:["page_view","button_click"],handler:(n,e)=>{console.log("[Gamification] Event received for badge trigger check")}},Zk=[{kind:"gamification:awardBadge",executor:Uk},{kind:"gamification:addPoints",executor:zk}],Gk=[qk],Tm={id:"adaptive-gamification",version:"1.0.0",name:"Gamification",description:"Badges, rewards, points, and engagement mechanics",executors:Zk,eventHandlers:Gk};var si=Wr(Oc(),1),Kk=Wr(Nc(),1);var P$={light:{container:{backgroundColor:"transparent",color:"inherit"},item:{backgroundColor:"var(--sc-content-background)",border:"var(--sc-content-border)"},itemExpanded:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.08)"},header:{backgroundColor:"transparent",color:"var(--sc-content-text-color)"},headerHover:{backgroundColor:"var(--sc-content-background-hover)"},body:{color:"var(--sc-content-text-secondary-color)"},linkButton:{backgroundColor:`var(--sc-color-primary, ${Ye[4]})`,color:"#ffffff"},categoryHeader:{color:S[7]},emptyState:{color:S[8]}},dark:{container:{backgroundColor:"transparent",color:"inherit"},item:{backgroundColor:"var(--sc-content-background)",border:"var(--sc-content-border)"},itemExpanded:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"},header:{backgroundColor:"transparent",color:"var(--sc-content-text-color)"},headerHover:{backgroundColor:"var(--sc-content-background-hover)"},body:{color:"var(--sc-content-text-secondary-color)"},linkButton:{backgroundColor:`var(--sc-color-primary, ${Ye[4]})`,color:"#ffffff"},categoryHeader:{color:S[8]},emptyState:{color:S[7]}}};function pu(n){if(typeof window>"u")return!1;let e=window;try{let t=e.next?.router;if(t?.push)return t.push(n),!0}catch{}try{if(e.$nuxt?.$router?.push)return e.$nuxt.$router.push(n),!0}catch{}return e.ng||e.getAllAngularRootElements||document.querySelector("[ng-version]")||e.__SVELTEKIT_DATA__||document.body?.hasAttribute("data-sveltekit")||document.querySelector("[data-astro-transition-fallback]")?(window.location.href=n,!0):!1}var Yk="#6a59ce",Im="#677384",$m="#87919f",Xk={"\u{1F4B5}":'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="12" x="2" y="6" rx="2"/><circle cx="12" cy="12" r="2"/><path d="M6 12h.01M18 12h.01"/></svg>',"\u{1F3DB}\uFE0F":'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" x2="21" y1="22" y2="22"/><line x1="6" x2="6" y1="18" y2="11"/><line x1="10" x2="10" y1="18" y2="11"/><line x1="14" x2="14" y1="18" y2="11"/><line x1="18" x2="18" y1="18" y2="11"/><polygon points="12 2 20 7 4 7"/></svg>',"\u23ED\uFE0F":'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 4 15 12 5 20 5 4"/><line x1="19" x2="19" y1="5" y2="19"/></svg>',"\u27A1\uFE0F":'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>',"\u{1F4A1}":'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/></svg>',"\u{1F4B0}":'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="12" x="2" y="6" rx="2"/><circle cx="12" cy="12" r="2"/><path d="M6 12h.01M18 12h.01"/></svg>',"\u{1F4CB}":'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M12 11h4"/><path d="M12 16h4"/><path d="M8 11h.01"/><path d="M8 16h.01"/></svg>',"\u2705":'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/></svg>',"\u26A0\uFE0F":'<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>'};function Jk(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Qk(n){return Xk[n]??Jk(n)}function Mm(n){if(typeof window>"u")return!1;let e=window.location.pathname;return n.some(t=>{let r=t.split("?")[0].split("#")[0];return r.endsWith("/**")?e.startsWith(r.slice(0,-3)):e===r})}function eS(n){let e=[{boxShadow:"0 0 0 0 rgba(13, 148, 136, 0.5)"},{boxShadow:"0 0 0 8px rgba(13, 148, 136, 0)"}];n.animate(e,{duration:600,iterations:3,easing:"ease-out"})}function tS(n){return n==="dark"?"dark":n==="light"?"light":typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var oi,ai,_e,fu,gu,Om,mu,Nm,Lm,Fm,Cs,vu,Ra=class extends ge{constructor(){super(...arguments);ee(this,_e);this.config={expandBehavior:"single",theme:"auto",actions:[]};this.runtime=void 0;this.instanceId="nav-widget";this._expandedIds=new Set;this._renderTick=0;this._hoveredId=null;ee(this,oi,null);ee(this,ai,null)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),te(this,_e,fu).call(this)}disconnectedCallback(){super.disconnectedCallback(),te(this,_e,gu).call(this)}updated(t){t.has("runtime")&&(te(this,_e,gu).call(this),te(this,_e,fu).call(this))}render(){let t=te(this,_e,Om).call(this),r=te(this,_e,mu).call(this),i=T({fontFamily:"var(--sc-font-family, system-ui, -apple-system, sans-serif)",maxWidth:"100%",overflow:"hidden",backgroundColor:"transparent",color:"inherit"}),s=T({display:"flex",flexDirection:"column",gap:"var(--sc-content-item-gap, 6px)"}),o=T({fontSize:"var(--sc-content-category-font-size, 12px)",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em",padding:"var(--sc-content-category-padding, 8px 4px 4px 4px)",color:r==="dark"?$m:Im}),a=T({fontSize:"13px",padding:"16px",textAlign:"center",color:r==="dark"?Im:$m});if(t.length===0)return D`
|
|
338
338
|
<div
|
|
339
339
|
style=${i}
|
|
340
340
|
data-adaptive-id=${this.instanceId}
|
|
@@ -353,42 +353,42 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
353
353
|
>
|
|
354
354
|
<div style=${s}>
|
|
355
355
|
${c?Array.from(l.entries()).map(([u,d])=>D`
|
|
356
|
-
${u?D`<div style=${o} data-category-header=${u}>${u}</div>`:
|
|
357
|
-
${d.map((h,g)=>te(this,
|
|
358
|
-
`):t.map((u,d)=>te(this,
|
|
356
|
+
${u?D`<div style=${o} data-category-header=${u}>${u}</div>`:J}
|
|
357
|
+
${d.map((h,g)=>te(this,_e,vu).call(this,h,g,d.length))}
|
|
358
|
+
`):t.map((u,d)=>te(this,_e,vu).call(this,u,d,t.length))}
|
|
359
359
|
</div>
|
|
360
360
|
</div>
|
|
361
|
-
`}};oi=new WeakMap,ai=new WeakMap,
|
|
361
|
+
`}};oi=new WeakMap,ai=new WeakMap,_e=new WeakSet,fu=function(){this.runtime&&(Z(this,oi,this.runtime.context.subscribe(()=>{this._renderTick+=1})),this.runtime.accumulator?.subscribe&&Z(this,ai,this.runtime.accumulator.subscribe(()=>{this._renderTick+=1})))},gu=function(){var t,r;(t=I(this,oi))==null||t.call(this),Z(this,oi,null),(r=I(this,ai))==null||r.call(this),Z(this,ai,null)},Om=function(){return this._renderTick,this.runtime?this.config.actions.filter(t=>{if(!t.triggerWhen)return!0;try{return this.runtime.evaluateSync(t.triggerWhen).value}catch{return!1}}):this.config.actions},mu=function(){return tS(this.config.theme)},Nm=function(t){let r=this._expandedIds.has(t),i;if(this.config.expandBehavior==="single"){for(let s of this._expandedIds)s!==t&&te(this,_e,Cs).call(this,"nav:toggled",{tipId:s,expanded:!1});i=r?new Set:new Set([t])}else i=new Set(this._expandedIds),r?i.delete(t):i.add(t);te(this,_e,Cs).call(this,"nav:toggled",{tipId:t,expanded:!r}),this._expandedIds=i},Lm=function(t,r){let i=t.trim().toLowerCase();if(!(i.startsWith("javascript:")||i.startsWith("data:")))if(te(this,_e,Cs).call(this,"nav:tip_clicked",{href:t,external:r}),this.dispatchEvent(new CustomEvent("nav-tip-clicked",{bubbles:!0,detail:{href:t,external:r,instanceId:this.instanceId}})),r)window.open(t,"_blank","noopener,noreferrer");else{let s=new URL(t,window.location.origin);s.search=window.location.search,pu(s.toString())||(window.history.pushState(null,"",s.toString()),window.dispatchEvent(new PopStateEvent("popstate")))}},Fm=function(t){let r=document.querySelector(t.selector);r instanceof HTMLElement&&(te(this,_e,Cs).call(this,"nav:tip_focused",{selector:t.selector,route:t.route}),this.dispatchEvent(new CustomEvent("nav-tip-focused",{bubbles:!0,detail:{selector:t.selector,instanceId:this.instanceId}})),r.scrollIntoView({behavior:"smooth",block:"center"}),eS(r),setTimeout(()=>r.focus(),400))},Cs=function(t,r){this.runtime?.events.publish(t,{instanceId:this.instanceId,timestamp:Date.now(),...r})},vu=function(t,r,i){let{id:s,title:o,description:a,href:l,icon:c,external:u,anchor:d,category:h}=t.config,g=this._expandedIds.has(s),v=r===i-1,f=this._hoveredId===s,m=te(this,_e,mu).call(this),y=d?Array.isArray(d.route)?d.route[0]:d.route:l,k=d?Mm(Array.isArray(d.route)?d.route:[d.route]):y?Mm([y]):!1,_=d?.selector&&d.selector!=="*",b=k&&_,x=!!y||b,R=b?"Focus \u2192":u?"Go \u2197":"Go \u2192",w=T({borderRadius:"var(--sc-content-border-radius, 8px)",overflow:"hidden",transition:"box-shadow 0.2s ease",backgroundColor:"var(--sc-content-background)",border:"var(--sc-content-border)",...g?{boxShadow:m==="dark"?"0 4px 12px rgba(0, 0, 0, 0.15)":"0 4px 12px rgba(0, 0, 0, 0.08)"}:{},...v?{}:{borderBottom:"var(--sc-content-item-divider, none)"}}),E=T({display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"var(--sc-content-item-padding, 12px 16px)",border:"none",cursor:"pointer",fontSize:"var(--sc-content-item-font-size, 15px)",fontWeight:"500",fontFamily:"inherit",textAlign:"left",transition:"background-color 0.15s ease",backgroundColor:f?"var(--sc-content-background-hover)":"transparent",color:"var(--sc-content-text-color)"}),$=T({fontSize:"20px",transition:"transform 0.2s ease",marginLeft:"auto",flexShrink:"0",color:"var(--sc-content-chevron-color, currentColor)",transform:g?"rotate(90deg)":"rotate(0deg)"}),P=T({overflow:"hidden",transition:"max-height 0.25s ease, padding-bottom 0.25s ease",padding:"var(--sc-content-body-padding, 0 16px 12px 16px)",color:"var(--sc-content-text-secondary-color)",maxHeight:g?"500px":"0",paddingBottom:g?"16px":"0"}),M=T({fontSize:"var(--sc-content-body-font-size, 14px)",lineHeight:"1.5",margin:"0"}),G=T({display:"inline-flex",alignItems:"center",gap:"4px",marginTop:"10px",padding:"6px 12px",borderRadius:"6px",textDecoration:"none",fontSize:"13px",fontWeight:"500",cursor:"pointer",border:"none",transition:"background-color 0.15s ease",backgroundColor:`var(--sc-color-primary, ${Yk})`,color:"#ffffff"}),L=T({fontSize:"16px",flexShrink:"0"}),N=z=>{z.preventDefault(),z.stopPropagation(),b&&d?te(this,_e,Fm).call(this,d):y&&te(this,_e,Lm).call(this,y,u??!1)};return D`
|
|
362
362
|
<div
|
|
363
|
-
style=${
|
|
363
|
+
style=${w}
|
|
364
364
|
data-nav-tip-id=${s}
|
|
365
365
|
>
|
|
366
366
|
<button
|
|
367
367
|
type="button"
|
|
368
|
-
style=${
|
|
368
|
+
style=${E}
|
|
369
369
|
aria-expanded=${g}
|
|
370
|
-
@click=${()=>te(this,
|
|
370
|
+
@click=${()=>te(this,_e,Nm).call(this,s)}
|
|
371
371
|
@mouseenter=${()=>{this._hoveredId=s}}
|
|
372
372
|
@mouseleave=${()=>{this._hoveredId=null}}
|
|
373
373
|
>
|
|
374
|
-
${c?D`<span style=${L}>${
|
|
374
|
+
${c?D`<span style=${L}>${ya(Qk(c))}</span>`:J}
|
|
375
375
|
<span>${o}</span>
|
|
376
|
-
<span style=${
|
|
376
|
+
<span style=${$}>${"\u203A"}</span>
|
|
377
377
|
</button>
|
|
378
|
-
<div style=${
|
|
379
|
-
<p style=${
|
|
380
|
-
${
|
|
378
|
+
<div style=${P} aria-hidden=${!g}>
|
|
379
|
+
<p style=${M}>${a}</p>
|
|
380
|
+
${x?D`
|
|
381
381
|
<a
|
|
382
382
|
href=${y||"#"}
|
|
383
383
|
style=${G}
|
|
384
|
-
target=${u?"_blank":
|
|
385
|
-
rel=${u?"noopener noreferrer":
|
|
386
|
-
@click=${
|
|
387
|
-
>${
|
|
388
|
-
`:
|
|
384
|
+
target=${u?"_blank":J}
|
|
385
|
+
rel=${u?"noopener noreferrer":J}
|
|
386
|
+
@click=${N}
|
|
387
|
+
>${R}</a>
|
|
388
|
+
`:J}
|
|
389
389
|
</div>
|
|
390
390
|
</div>
|
|
391
|
-
`},Aa.properties={config:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_renderTick:{state:!0},_hoveredId:{state:!0}};var Rm="syntro-nav-tips";function cu(){typeof window>"u"||customElements.get(Rm)||customElements.define(Rm,Aa)}var Xk=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);return t?(t.scrollIntoView({behavior:n.behavior??"smooth",block:n.block??"center",inline:n.inline??"nearest"}),e.publishEvent("action.applied",{id:e.generateId(),kind:"navigation:scrollTo",anchorId:n.anchorId,behavior:n.behavior??"smooth"}),{cleanup:()=>{}}):(console.error(`[adaptive-nav] Anchor not found for scrollTo, skipping: ${n.anchorId.selector}`),{cleanup:()=>{}})};function Qk(n){if(typeof window>"u")return!1;let e=window;try{let t=e.next?.router;if(t?.push)return t.push(n),!0}catch{}try{if(e.$nuxt?.$router?.push)return e.$nuxt.$router.push(n),!0}catch{}return e.ng||e.getAllAngularRootElements||document.querySelector("[ng-version]")||e.__SVELTEKIT_DATA__||document.body?.hasAttribute("data-sveltekit")||document.querySelector("[data-astro-transition-fallback]")?(window.location.href=n,!0):!1}function Jk(n){try{return new URL(n,window.location.origin).origin===window.location.origin}catch{return!1}}var eS=async(n,e)=>{let t=n.url.trim();if(t.toLowerCase().startsWith("javascript:"))throw new Error("javascript: URLs are not allowed");let r=n.target??"_self";return e.publishEvent("action.applied",{id:e.generateId(),kind:"navigation:navigate",url:n.url,target:r}),r==="_blank"?window.open(t,"_blank","noopener,noreferrer"):!n.forceFullNavigation&&Jk(t)?Qk(t)||(window.history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate"))):window.location.href=t,{cleanup:()=>{}}},tS={mount(n,e){cu();let t=document.createElement("syntro-nav-tips"),{runtime:r,instanceId:i="nav-widget",...s}=e??{expandBehavior:"single",theme:"auto",actions:[]};return Object.assign(t,{config:s,runtime:r,instanceId:i}),n.appendChild(t),()=>t.remove()}},nS=[{kind:"navigation:scrollTo",executor:Xk},{kind:"navigation:navigate",executor:eS}],Pm={id:"adaptive-nav",version:"2.0.0",name:"Navigation Tips",description:"Navigation actions and accordion-based tips with per-item conditional visibility",executors:nS,widgets:[{id:"adaptive-nav:tips",component:tS,metadata:{name:"Navigation Tips",description:"Accordion of contextual navigation tips with per-item visibility",icon:"\u{1F9ED}"}}],notifyWatchers(n){return(n.actions??[]).filter(t=>t.notify&&t.triggerWhen).map(t=>({id:`nav:${t.config.id}`,strategy:t.triggerWhen,eventName:"nav:tip_revealed",eventProps:{tipId:t.config.id,title:t.notify.title,body:t.notify.body,icon:t.notify.icon}}))}};var rS={light:50,medium:100,heavy:200},iS=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],Om={init(n,e,t){let r=rS[t.intensity],i=t.colors.length>0?t.colors:iS,s=[];for(let o=0;o<r;o++)s.push({x:Math.random()*n,y:Math.random()*-e*.3,vx:(Math.random()-.5)*4,vy:Math.random()*2+1,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.2,size:Math.random()*6+4,color:i[Math.floor(Math.random()*i.length)],opacity:1,shape:Math.random()>.5?"rect":"circle"});return s},update(n,e,t){let r=!1;for(let i of n)i.vy+=.15,i.vx*=.99,i.x+=i.vx,i.y+=i.vy,i.rotation+=i.rotationSpeed,i.y>0&&i.opacity>0&&i.y>500&&(i.opacity-=.02,i.opacity<0&&(i.opacity=0)),i.opacity>.01&&(r=!0);return r},render(n,e){for(let t of e)t.opacity<.01||(n.save(),n.globalAlpha=t.opacity,n.fillStyle=t.color,n.translate(t.x,t.y),n.rotate(t.rotation),t.shape==="circle"?(n.beginPath(),n.arc(0,0,t.size/2,0,Math.PI*2),n.fill()):n.fillRect(-t.size/2,-t.size/2,t.size,t.size*.6),n.restore())}};var sS={light:20,medium:40,heavy:80},oS="\u{1F389}",Nm={init(n,e,t){let r=sS[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:oS,s=[];for(let o=0;o<r;o++)s.push({x:Math.random()*n,y:Math.random()*-200,vx:0,vy:Math.random()*1.5+1,rotation:0,rotationSpeed:0,size:Math.random()*12+16,color:"#000000",opacity:1,shape:"emoji",emoji:i,data:{wobblePhase:Math.random()*Math.PI*2,wobbleAmp:Math.random()*1.5+.5,originX:0}});for(let o of s)o.data&&(o.data.originX=o.x);return s},update(n,e,t){let r=!1;for(let i of n){i.y+=i.vy;let s=i.data?.wobblePhase??0,o=i.data?.wobbleAmp??1,a=i.data?.originX??i.x;i.x=a+Math.sin(t*.003+s)*o*20,i.y>600&&(i.opacity-=.02,i.opacity<0&&(i.opacity=0)),i.opacity>.01&&(r=!0)}return r},render(n,e){for(let t of e)t.opacity<.01||!t.emoji||(n.save(),n.globalAlpha=t.opacity,n.font=`${t.size}px serif`,n.textAlign="center",n.textBaseline="middle",n.fillText(t.emoji,t.x,t.y),n.restore())}};var aS={light:20,medium:40,heavy:80},lS={light:3,medium:4,heavy:5},Lm={init(n,e,t){let r=aS[t.intensity],i=lS[t.intensity],s=t.colors.length>0?t.colors:["#ff4444","#44ff44","#4444ff"],o=[];for(let a=0;a<i;a++){let l=Math.random()*n*.8+n*.1,c=Math.random()*e*.6,u=s[Math.floor(Math.random()*s.length)];for(let d=0;d<r;d++){let h=Math.PI*2*d/r+(Math.random()-.5)*.3,g=Math.random()*3+2;o.push({x:l,y:c,vx:Math.cos(h)*g,vy:Math.sin(h)*g,rotation:0,rotationSpeed:0,size:Math.random()*3+2,color:u,opacity:1,shape:"circle",data:{centerX:l,centerY:c}})}}return o},update(n,e,t){let r=!1;for(let i of n)i.vx*=.97,i.vy*=.97,i.vy+=.03,i.x+=i.vx,i.y+=i.vy,i.opacity-=.008,i.opacity<0&&(i.opacity=0),i.opacity>.01&&(r=!0);return r},render(n,e){for(let t of e)t.opacity<.01||(n.save(),n.globalAlpha=t.opacity,n.fillStyle=t.color,n.shadowBlur=12,n.shadowColor=t.color,n.beginPath(),n.arc(t.x,t.y,t.size,0,Math.PI*2),n.fill(),n.restore())}};var cS={light:30,medium:60,heavy:120},Fm={init(n,e,t){let r=cS[t.intensity],i=t.colors.length>0?t.colors:["#ffd700","#ffffff","#fffacd"],s=[];for(let o=0;o<r;o++)s.push({x:Math.random()*n,y:Math.random()*e,vx:(Math.random()-.5)*.3,vy:-(Math.random()*.5+.2),rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.1,size:Math.random()*4+2,color:i[Math.floor(Math.random()*i.length)],opacity:Math.random()*.5+.5,shape:"circle",data:{phase:Math.random()*Math.PI*2,baseOpacity:Math.random()*.5+.5}});return s},update(n,e,t){let r=!1;for(let i of n){i.x+=i.vx,i.y+=i.vy,i.rotation+=i.rotationSpeed,i.data&&(i.data.baseOpacity=(i.data.baseOpacity??1)-.001,i.data.baseOpacity<0&&(i.data.baseOpacity=0));let s=i.data?.phase??0,o=i.data?.baseOpacity??1;if(o<=.01)i.opacity=0;else{let a=Math.sin(t*.005+s)*.4+.6;i.opacity=o*a}i.opacity>.01&&(r=!0)}return r},render(n,e){for(let t of e){if(t.opacity<.01)continue;n.save(),n.globalAlpha=t.opacity,n.fillStyle=t.color,n.translate(t.x,t.y),n.rotate(t.rotation);let r=t.size;n.beginPath(),n.moveTo(0,-r),n.lineTo(r*.3,-r*.3),n.lineTo(r,0),n.lineTo(r*.3,r*.3),n.lineTo(0,r),n.lineTo(-r*.3,r*.3),n.lineTo(-r,0),n.lineTo(-r*.3,-r*.3),n.closePath(),n.fill(),n.restore()}}};var Ra=class{constructor(){this.canvas=null;this.ctx=null;this.rafId=null;this.particles=[];this.startTime=0;this.lastFrame=0;this.duration=0;this.effect=null;this.container=null}start(e,t,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;this.container=e,this.effect=t,this.duration=r.duration;let s=document.createElement("canvas");s.setAttribute("data-syntro-celebrate",""),Object.assign(s.style,{position:"fixed",inset:"0",pointerEvents:"none",zIndex:"2147483646"});let o=window.devicePixelRatio||1,a=window.innerWidth,l=window.innerHeight;s.width=a*o,s.height=l*o,s.style.width=`${a}px`,s.style.height=`${l}px`;let c=s.getContext("2d");c&&(c.scale(o,o),this.canvas=s,this.ctx=c,e.appendChild(s),this.particles=t.init(a,l,r),this.startTime=performance.now(),this.lastFrame=this.startTime,this.tick=this.tick.bind(this),this.rafId=requestAnimationFrame(this.tick))}stop(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas&&this.container&&(this.canvas.remove(),this.canvas=null),this.ctx=null,this.effect=null,this.container=null,this.particles=[]}tick(e){if(!this.ctx||!this.canvas||!this.effect)return;let t=e-this.startTime,r=e-this.lastFrame;if(this.lastFrame=e,t>=this.duration){this.stop();return}let i=this.canvas.width/(window.devicePixelRatio||1),s=this.canvas.height/(window.devicePixelRatio||1);if(this.ctx.clearRect(0,0,i,s),!this.effect.update(this.particles,r,t)){this.stop();return}this.effect.render(this.ctx,this.particles),this.rafId=requestAnimationFrame(this.tick)}};var uS=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function dS(n,e){return[n,e,`${n}cc`,`${e}cc`,"#ffffff",`${n}80`]}function pS(n){try{let e=getComputedStyle(n),t=e.getPropertyValue("--sc-color-primary")?.trim(),r=e.getPropertyValue("--sc-color-primary-hover")?.trim();if(t?.startsWith("#")&&t.length>=7)return dS(t,r||t)}catch{}return null}var Dm=new Map([["confetti",Om],["fireworks",Lm],["sparkles",Fm],["emoji-rain",Nm]]),Hm=async(n,e)=>{let t=Dm.get(n.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${n.effect}". Available: ${[...Dm.keys()].join(", ")}`),{cleanup:()=>{}};let r=n.colors??pS(e.overlayRoot)??uS,i={duration:n.duration??3e3,intensity:n.intensity??"medium",colors:r,props:n.props},s=new Ra;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:n.effect}),{cleanup:()=>{s.stop()}}};var gu="syntro_active_tour",Ta=new Map;function hS(n){try{let e=localStorage.getItem(gu);if(!e)return null;let t=JSON.parse(e);return t.tourId!==n?null:t}catch{return null}}function fu(n){try{localStorage.setItem(gu,JSON.stringify(n))}catch{}}function fS(){try{localStorage.removeItem(gu)}catch{}}function Cs(){return window.location.pathname}function gS(n){if(!n.route)return!0;let e=Cs();return n.route.includes("*")?new RegExp(`^${n.route.replace(/\*/g,".*")}$`).test(e):e===n.route}var Bm=async(n,e)=>{let{tourId:t,steps:r,startStep:i,autoStart:s=!0}=n;if(r.length===0)throw new Error(`Tour "${t}" has no steps`);if(Ta.has(t))return{cleanup:async()=>{let _=Ta.get(t);_&&await _.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=hS(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||r[0].id,startedAt:Date.now()},fu(o));let l=r.findIndex(_=>_.id===o.currentStepId);if(l===-1){let _=i||r[0].id;l=r.findIndex(b=>b.id===_),l===-1&&(l=0),o.currentStepId=r[l].id,fu(o)}let c=r[l];if(!gS(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:Cs()}),{cleanup:()=>{}};let u=!1,d=null,h=null,g=null,v=async()=>{h&&(h(),h=null),d?.isApplied()&&(await d.revert(),d=null)},f=async _=>{if(u)return;if(await v(),_==="end"){fS(),e.publishEvent("tour.completed",{tourId:t,totalSteps:r.length}),u=!0;return}let b=r.find(w=>w.id===_);if(!b){console.error(`[Tour] Step "${_}" not found`);return}if(o.currentStepId=_,fu(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:_}),b.route&&b.route!==Cs()){e.publishEvent("tour.awaiting_navigation",{tourId:t,stepId:_,targetRoute:b.route});return}await m(b)},m=async _=>{if(!u){e.publishEvent("tour.step_started",{tourId:t,stepId:_.id,stepIndex:r.findIndex(b=>b.id===_.id),totalSteps:r.length});try{d=await e.applyAction(_.action)}catch(b){console.error(`[Tour] Failed to execute step "${_.id}":`,b),e.publishEvent("tour.step_failed",{tourId:t,stepId:_.id,error:String(b)});return}if(_.onAction&&e.subscribeEvent){h=e.subscribeEvent("action.modal_cta_clicked",E=>{let x=E?.actionId;if(x&&_.onAction){let R=_.onAction[x];R&&f(R)}});let b=e.subscribeEvent("action.tooltip_cta_clicked",E=>{let x=E?.actionId;if(x&&_.onAction){let R=_.onAction[x];R&&f(R)}}),w=h;h=()=>{w(),b()}}}};g=(()=>{let _=Cs(),b=()=>{let x=Cs();x!==_&&(_=x,e.publishEvent("tour.route_changed",{tourId:t,newRoute:x}))};if(e.subscribeNavigation)return e.subscribeNavigation(()=>b());window.addEventListener("popstate",b);let w=history.pushState.bind(history),E=history.replaceState.bind(history);return history.pushState=(...x)=>{w(...x),queueMicrotask(b)},history.replaceState=(...x)=>{E(...x),queueMicrotask(b)},()=>{window.removeEventListener("popstate",b),history.pushState=w,history.replaceState=E}})(),a?e.publishEvent("tour.resumed",{tourId:t,stepId:o.currentStepId}):e.publishEvent("tour.started",{tourId:t,totalSteps:r.length,startStepId:o.currentStepId}),await m(c);let k=async()=>{u=!0,Ta.delete(t),await v(),g&&g(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return Ta.set(t,{cleanup:k}),{cleanup:k}};var Vm=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function Wm(n,e,t){let r=t?.paddingPx??12,i=t?.radiusPx??12,s=Math.min(Math.max(t?.scrimOpacity??.55,0),1),o=t?.ringColor??`var(--syntro-ring, ${qe[5]})`,a=t?.blocking??!1,l=t?.onClickOutside??!0,c=t?.onEsc??!0,u=getComputedStyle(document.documentElement),d=u.getPropertyValue("--syntro-spotlight-backdrop").trim(),h=u.getPropertyValue("--syntro-ring").trim(),g=document.createElement("div");g.className="syntro-spotlight-scrim";let v=a||l;Object.assign(g.style,{position:"fixed",inset:"0",zIndex:"2147483646",pointerEvents:v?"auto":"none",background:d||`rgba(2, 6, 23, ${s})`,transition:"opacity 220ms ease",opacity:"0"}),e.appendChild(g),requestAnimationFrame(()=>g.style.opacity="1");let f=document.createElement("div");f.className="syntro-spotlight-ring",Object.assign(f.style,{position:"fixed",pointerEvents:"none",borderRadius:`${i}px`,border:`2px solid ${o||h||qe[5]}`,boxShadow:"0 0 0 4px rgba(255,255,255,0.35)",zIndex:"2147483647",transition:"all 220ms cubic-bezier(0.16,1,0.3,1)"}),e.appendChild(f);let m=[];if(!Vm)for(let I=0;I<4;I++){let O=document.createElement("div");O.style.position="fixed",O.style.background="inherit",m.push(O),g.appendChild(O)}let y=I=>{g.style.clipPath=I,g.style.webkitClipPath=I},k=()=>{if(!n.isConnected){R.destroy();return}let I=n.getBoundingClientRect(),O=I.left-r,P=I.top-r,G=I.width+r*2,L=I.height+r*2;if(Object.assign(f.style,{left:`${O}px`,top:`${P}px`,width:`${G}px`,height:`${L}px`}),Vm){let F=window.innerWidth,Z=window.innerHeight,A=Math.min(i,G/2,L/2),H=`M 0 0 L ${F} 0 L ${F} ${Z} L 0 ${Z} Z`,M=`M ${O+A} ${P} A ${A} ${A} 0 0 0 ${O} ${P+A} L ${O} ${P+L-A} A ${A} ${A} 0 0 0 ${O+A} ${P+L} L ${O+G-A} ${P+L} A ${A} ${A} 0 0 0 ${O+G} ${P+L-A} L ${O+G} ${P+A} A ${A} ${A} 0 0 0 ${O+G-A} ${P} L ${O+A} ${P} Z`;y(`path('${H} ${M}')`)}else{let[F,Z,A,H]=m;Object.assign(F.style,{left:"0px",top:"0px",width:"100vw",height:`${P}px`}),Object.assign(A.style,{left:"0px",top:`${P+L}px`,width:"100vw",height:`${Math.max(0,window.innerHeight-(P+L))}px`}),Object.assign(H.style,{left:"0px",top:`${P}px`,width:`${O}px`,height:`${L}px`}),Object.assign(Z.style,{left:`${O+G}px`,top:`${P}px`,width:`${Math.max(0,window.innerWidth-(O+G))}px`,height:`${L}px`})}},_=new ResizeObserver(()=>requestAnimationFrame(k));_.observe(n);let b=()=>requestAnimationFrame(k),w=()=>requestAnimationFrame(k);window.addEventListener("scroll",b,!0),window.addEventListener("resize",w);let E=I=>{I.key==="Escape"&&c&&(t?.onDismiss?.(),R.destroy())};c&&window.addEventListener("keydown",E);let x=I=>{a?(I.preventDefault(),I.stopPropagation()):l&&(t?.onDismiss?.(),R.destroy())};g.addEventListener("click",x);let R={destroy(){_.disconnect(),window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",w),c&&window.removeEventListener("keydown",E),g.removeEventListener("click",x),g.style.pointerEvents="none",g.style.opacity="0",setTimeout(()=>{try{g.remove()}catch{}try{f.remove()}catch{}},220)}};return k(),R}var mS=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button","svg","path","circle","line","polyline","polygon","rect","g"]);function lt(n){if(typeof window.Sanitizer=="function")try{let a=new window.Sanitizer({}).sanitizeToFragment(n),l=document.createElement("div");return l.append(a),l.innerHTML}catch{}let t=document.createElement("template");t.innerHTML=n;let r=t.content,i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,null),s=[];for(;i.nextNode();){let o=i.currentNode,a=o.tagName.toLowerCase();if(!mS.has(a)){s.push(o);continue}for(let l of Array.from(o.attributes)){let c=l.name.toLowerCase(),u=l.value.trim().toLowerCase(),d=c.startsWith("on"),h=(c==="href"||c==="src")&&u.startsWith("javascript:");(d||h)&&o.removeAttribute(l.name)}}for(let o of s){for(;o.firstChild;)o.parentNode?.insertBefore(o.firstChild,o);o.remove()}return t.innerHTML}var cr={bg:"var(--sc-overlay-background, #ffffff)",title:"var(--sc-overlay-title-color, var(--sc-overlay-text-color, #111827))",text:"var(--sc-overlay-text-color, #4b5563)",accent:"var(--sc-color-primary, #4f46e5)",radius:"var(--sc-border-radius, 12px)"},jm=async(n,e)=>{let{content:t,size:r="md",blocking:i=!1,scrim:s,dismiss:o,ctaButtons:a}=n,l=document.createElement("div");l.className="syntro-modal-scrim",l.style.cssText=`
|
|
391
|
+
`},Ra.properties={config:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_renderTick:{state:!0},_hoveredId:{state:!0}};var Pm="syntro-nav-tips";function hu(){typeof window>"u"||customElements.get(Pm)||customElements.define(Pm,Ra)}var nS=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);return t?(t.scrollIntoView({behavior:n.behavior??"smooth",block:n.block??"center",inline:n.inline??"nearest"}),e.publishEvent("action.applied",{id:e.generateId(),kind:"navigation:scrollTo",anchorId:n.anchorId,behavior:n.behavior??"smooth"}),{cleanup:()=>{}}):(console.error(`[adaptive-nav] Anchor not found for scrollTo, skipping: ${n.anchorId.selector}`),{cleanup:()=>{}})};function rS(n){if(typeof window>"u")return!1;let e=window;try{let t=e.next?.router;if(t?.push)return t.push(n),!0}catch{}try{if(e.$nuxt?.$router?.push)return e.$nuxt.$router.push(n),!0}catch{}return e.ng||e.getAllAngularRootElements||document.querySelector("[ng-version]")||e.__SVELTEKIT_DATA__||document.body?.hasAttribute("data-sveltekit")||document.querySelector("[data-astro-transition-fallback]")?(window.location.href=n,!0):!1}function iS(n){try{return new URL(n,window.location.origin).origin===window.location.origin}catch{return!1}}var sS=async(n,e)=>{let t=n.url.trim();if(t.toLowerCase().startsWith("javascript:"))throw new Error("javascript: URLs are not allowed");let r=n.target??"_self";return e.publishEvent("action.applied",{id:e.generateId(),kind:"navigation:navigate",url:n.url,target:r}),r==="_blank"?window.open(t,"_blank","noopener,noreferrer"):!n.forceFullNavigation&&iS(t)?rS(t)||(window.history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate"))):window.location.href=t,{cleanup:()=>{}}},oS={mount(n,e){hu();let t=document.createElement("syntro-nav-tips"),{runtime:r,instanceId:i="nav-widget",...s}=e??{expandBehavior:"single",theme:"auto",actions:[]};return Object.assign(t,{config:s,runtime:r,instanceId:i}),n.appendChild(t),()=>t.remove()}},aS=[{kind:"navigation:scrollTo",executor:nS},{kind:"navigation:navigate",executor:sS}],Dm={id:"adaptive-nav",version:"2.0.0",name:"Navigation Tips",description:"Navigation actions and accordion-based tips with per-item conditional visibility",executors:aS,widgets:[{id:"adaptive-nav:tips",component:oS,metadata:{name:"Navigation Tips",description:"Accordion of contextual navigation tips with per-item visibility",icon:"\u{1F9ED}"}}],notifyWatchers(n){return(n.actions??[]).filter(t=>t.notify&&t.triggerWhen).map(t=>({id:`nav:${t.config.id}`,strategy:t.triggerWhen,eventName:"nav:tip_revealed",eventProps:{tipId:t.config.id,title:t.notify.title,body:t.notify.body,icon:t.notify.icon}}))}};var lS={light:50,medium:100,heavy:200},cS=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],Hm={init(n,e,t){let r=lS[t.intensity],i=t.colors.length>0?t.colors:cS,s=[];for(let o=0;o<r;o++)s.push({x:Math.random()*n,y:Math.random()*-e*.3,vx:(Math.random()-.5)*4,vy:Math.random()*2+1,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.2,size:Math.random()*6+4,color:i[Math.floor(Math.random()*i.length)],opacity:1,shape:Math.random()>.5?"rect":"circle"});return s},update(n,e,t){let r=!1;for(let i of n)i.vy+=.15,i.vx*=.99,i.x+=i.vx,i.y+=i.vy,i.rotation+=i.rotationSpeed,i.y>0&&i.opacity>0&&i.y>500&&(i.opacity-=.02,i.opacity<0&&(i.opacity=0)),i.opacity>.01&&(r=!0);return r},render(n,e){for(let t of e)t.opacity<.01||(n.save(),n.globalAlpha=t.opacity,n.fillStyle=t.color,n.translate(t.x,t.y),n.rotate(t.rotation),t.shape==="circle"?(n.beginPath(),n.arc(0,0,t.size/2,0,Math.PI*2),n.fill()):n.fillRect(-t.size/2,-t.size/2,t.size,t.size*.6),n.restore())}};var uS={light:20,medium:40,heavy:80},dS="\u{1F389}",Bm={init(n,e,t){let r=uS[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:dS,s=[];for(let o=0;o<r;o++)s.push({x:Math.random()*n,y:Math.random()*-200,vx:0,vy:Math.random()*1.5+1,rotation:0,rotationSpeed:0,size:Math.random()*12+16,color:"#000000",opacity:1,shape:"emoji",emoji:i,data:{wobblePhase:Math.random()*Math.PI*2,wobbleAmp:Math.random()*1.5+.5,originX:0}});for(let o of s)o.data&&(o.data.originX=o.x);return s},update(n,e,t){let r=!1;for(let i of n){i.y+=i.vy;let s=i.data?.wobblePhase??0,o=i.data?.wobbleAmp??1,a=i.data?.originX??i.x;i.x=a+Math.sin(t*.003+s)*o*20,i.y>600&&(i.opacity-=.02,i.opacity<0&&(i.opacity=0)),i.opacity>.01&&(r=!0)}return r},render(n,e){for(let t of e)t.opacity<.01||!t.emoji||(n.save(),n.globalAlpha=t.opacity,n.font=`${t.size}px serif`,n.textAlign="center",n.textBaseline="middle",n.fillText(t.emoji,t.x,t.y),n.restore())}};var pS={light:20,medium:40,heavy:80},hS={light:3,medium:4,heavy:5},Vm={init(n,e,t){let r=pS[t.intensity],i=hS[t.intensity],s=t.colors.length>0?t.colors:["#ff4444","#44ff44","#4444ff"],o=[];for(let a=0;a<i;a++){let l=Math.random()*n*.8+n*.1,c=Math.random()*e*.6,u=s[Math.floor(Math.random()*s.length)];for(let d=0;d<r;d++){let h=Math.PI*2*d/r+(Math.random()-.5)*.3,g=Math.random()*3+2;o.push({x:l,y:c,vx:Math.cos(h)*g,vy:Math.sin(h)*g,rotation:0,rotationSpeed:0,size:Math.random()*3+2,color:u,opacity:1,shape:"circle",data:{centerX:l,centerY:c}})}}return o},update(n,e,t){let r=!1;for(let i of n)i.vx*=.97,i.vy*=.97,i.vy+=.03,i.x+=i.vx,i.y+=i.vy,i.opacity-=.008,i.opacity<0&&(i.opacity=0),i.opacity>.01&&(r=!0);return r},render(n,e){for(let t of e)t.opacity<.01||(n.save(),n.globalAlpha=t.opacity,n.fillStyle=t.color,n.shadowBlur=12,n.shadowColor=t.color,n.beginPath(),n.arc(t.x,t.y,t.size,0,Math.PI*2),n.fill(),n.restore())}};var fS={light:30,medium:60,heavy:120},Wm={init(n,e,t){let r=fS[t.intensity],i=t.colors.length>0?t.colors:["#ffd700","#ffffff","#fffacd"],s=[];for(let o=0;o<r;o++)s.push({x:Math.random()*n,y:Math.random()*e,vx:(Math.random()-.5)*.3,vy:-(Math.random()*.5+.2),rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.1,size:Math.random()*4+2,color:i[Math.floor(Math.random()*i.length)],opacity:Math.random()*.5+.5,shape:"circle",data:{phase:Math.random()*Math.PI*2,baseOpacity:Math.random()*.5+.5}});return s},update(n,e,t){let r=!1;for(let i of n){i.x+=i.vx,i.y+=i.vy,i.rotation+=i.rotationSpeed,i.data&&(i.data.baseOpacity=(i.data.baseOpacity??1)-.001,i.data.baseOpacity<0&&(i.data.baseOpacity=0));let s=i.data?.phase??0,o=i.data?.baseOpacity??1;if(o<=.01)i.opacity=0;else{let a=Math.sin(t*.005+s)*.4+.6;i.opacity=o*a}i.opacity>.01&&(r=!0)}return r},render(n,e){for(let t of e){if(t.opacity<.01)continue;n.save(),n.globalAlpha=t.opacity,n.fillStyle=t.color,n.translate(t.x,t.y),n.rotate(t.rotation);let r=t.size;n.beginPath(),n.moveTo(0,-r),n.lineTo(r*.3,-r*.3),n.lineTo(r,0),n.lineTo(r*.3,r*.3),n.lineTo(0,r),n.lineTo(-r*.3,r*.3),n.lineTo(-r,0),n.lineTo(-r*.3,-r*.3),n.closePath(),n.fill(),n.restore()}}};var Ta=class{constructor(){this.canvas=null;this.ctx=null;this.rafId=null;this.particles=[];this.startTime=0;this.lastFrame=0;this.duration=0;this.effect=null;this.container=null}start(e,t,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;this.container=e,this.effect=t,this.duration=r.duration;let s=document.createElement("canvas");s.setAttribute("data-syntro-celebrate",""),Object.assign(s.style,{position:"fixed",inset:"0",pointerEvents:"none",zIndex:"2147483646"});let o=window.devicePixelRatio||1,a=window.innerWidth,l=window.innerHeight;s.width=a*o,s.height=l*o,s.style.width=`${a}px`,s.style.height=`${l}px`;let c=s.getContext("2d");c&&(c.scale(o,o),this.canvas=s,this.ctx=c,e.appendChild(s),this.particles=t.init(a,l,r),this.startTime=performance.now(),this.lastFrame=this.startTime,this.tick=this.tick.bind(this),this.rafId=requestAnimationFrame(this.tick))}stop(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas&&this.container&&(this.canvas.remove(),this.canvas=null),this.ctx=null,this.effect=null,this.container=null,this.particles=[]}tick(e){if(!this.ctx||!this.canvas||!this.effect)return;let t=e-this.startTime,r=e-this.lastFrame;if(this.lastFrame=e,t>=this.duration){this.stop();return}let i=this.canvas.width/(window.devicePixelRatio||1),s=this.canvas.height/(window.devicePixelRatio||1);if(this.ctx.clearRect(0,0,i,s),!this.effect.update(this.particles,r,t)){this.stop();return}this.effect.render(this.ctx,this.particles),this.rafId=requestAnimationFrame(this.tick)}};var gS=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function mS(n,e){return[n,e,`${n}cc`,`${e}cc`,"#ffffff",`${n}80`]}function vS(n){try{let e=getComputedStyle(n),t=e.getPropertyValue("--sc-color-primary")?.trim(),r=e.getPropertyValue("--sc-color-primary-hover")?.trim();if(t?.startsWith("#")&&t.length>=7)return mS(t,r||t)}catch{}return null}var jm=new Map([["confetti",Hm],["fireworks",Vm],["sparkles",Wm],["emoji-rain",Bm]]),Um=async(n,e)=>{let t=jm.get(n.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${n.effect}". Available: ${[...jm.keys()].join(", ")}`),{cleanup:()=>{}};let r=n.colors??vS(e.overlayRoot)??gS,i={duration:n.duration??3e3,intensity:n.intensity??"medium",colors:r,props:n.props},s=new Ta;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:n.effect}),{cleanup:()=>{s.stop()}}};var bu="syntro_active_tour",Ia=new Map;function yS(n){try{let e=localStorage.getItem(bu);if(!e)return null;let t=JSON.parse(e);return t.tourId!==n?null:t}catch{return null}}function yu(n){try{localStorage.setItem(bu,JSON.stringify(n))}catch{}}function bS(){try{localStorage.removeItem(bu)}catch{}}function As(){return window.location.pathname}function _S(n){if(!n.route)return!0;let e=As();return n.route.includes("*")?new RegExp(`^${n.route.replace(/\*/g,".*")}$`).test(e):e===n.route}var zm=async(n,e)=>{let{tourId:t,steps:r,startStep:i,autoStart:s=!0}=n;if(r.length===0)throw new Error(`Tour "${t}" has no steps`);if(Ia.has(t))return{cleanup:async()=>{let _=Ia.get(t);_&&await _.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=yS(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||r[0].id,startedAt:Date.now()},yu(o));let l=r.findIndex(_=>_.id===o.currentStepId);if(l===-1){let _=i||r[0].id;l=r.findIndex(b=>b.id===_),l===-1&&(l=0),o.currentStepId=r[l].id,yu(o)}let c=r[l];if(!_S(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:As()}),{cleanup:()=>{}};let u=!1,d=null,h=null,g=null,v=async()=>{h&&(h(),h=null),d?.isApplied()&&(await d.revert(),d=null)},f=async _=>{if(u)return;if(await v(),_==="end"){bS(),e.publishEvent("tour.completed",{tourId:t,totalSteps:r.length}),u=!0;return}let b=r.find(x=>x.id===_);if(!b){console.error(`[Tour] Step "${_}" not found`);return}if(o.currentStepId=_,yu(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:_}),b.route&&b.route!==As()){e.publishEvent("tour.awaiting_navigation",{tourId:t,stepId:_,targetRoute:b.route});return}await m(b)},m=async _=>{if(!u){e.publishEvent("tour.step_started",{tourId:t,stepId:_.id,stepIndex:r.findIndex(b=>b.id===_.id),totalSteps:r.length});try{d=await e.applyAction(_.action)}catch(b){console.error(`[Tour] Failed to execute step "${_.id}":`,b),e.publishEvent("tour.step_failed",{tourId:t,stepId:_.id,error:String(b)});return}if(_.onAction&&e.subscribeEvent){h=e.subscribeEvent("action.modal_cta_clicked",R=>{let w=R?.actionId;if(w&&_.onAction){let E=_.onAction[w];E&&f(E)}});let b=e.subscribeEvent("action.tooltip_cta_clicked",R=>{let w=R?.actionId;if(w&&_.onAction){let E=_.onAction[w];E&&f(E)}}),x=h;h=()=>{x(),b()}}}};g=(()=>{let _=As(),b=()=>{let w=As();w!==_&&(_=w,e.publishEvent("tour.route_changed",{tourId:t,newRoute:w}))};if(e.subscribeNavigation)return e.subscribeNavigation(()=>b());window.addEventListener("popstate",b);let x=history.pushState.bind(history),R=history.replaceState.bind(history);return history.pushState=(...w)=>{x(...w),queueMicrotask(b)},history.replaceState=(...w)=>{R(...w),queueMicrotask(b)},()=>{window.removeEventListener("popstate",b),history.pushState=x,history.replaceState=R}})(),a?e.publishEvent("tour.resumed",{tourId:t,stepId:o.currentStepId}):e.publishEvent("tour.started",{tourId:t,totalSteps:r.length,startStepId:o.currentStepId}),await m(c);let k=async()=>{u=!0,Ia.delete(t),await v(),g&&g(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return Ia.set(t,{cleanup:k}),{cleanup:k}};var qm=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function Zm(n,e,t){let r=t?.paddingPx??12,i=t?.radiusPx??12,s=Math.min(Math.max(t?.scrimOpacity??.55,0),1),o=t?.ringColor??`var(--syntro-ring, ${Ze[5]})`,a=t?.blocking??!1,l=t?.onClickOutside??!0,c=t?.onEsc??!0,u=getComputedStyle(document.documentElement),d=u.getPropertyValue("--syntro-spotlight-backdrop").trim(),h=u.getPropertyValue("--syntro-ring").trim(),g=document.createElement("div");g.className="syntro-spotlight-scrim";let v=a||l;Object.assign(g.style,{position:"fixed",inset:"0",zIndex:"2147483646",pointerEvents:v?"auto":"none",background:d||`rgba(2, 6, 23, ${s})`,transition:"opacity 220ms ease",opacity:"0"}),e.appendChild(g),requestAnimationFrame(()=>g.style.opacity="1");let f=document.createElement("div");f.className="syntro-spotlight-ring",Object.assign(f.style,{position:"fixed",pointerEvents:"none",borderRadius:`${i}px`,border:`2px solid ${o||h||Ze[5]}`,boxShadow:"0 0 0 4px rgba(255,255,255,0.35)",zIndex:"2147483647",transition:"all 220ms cubic-bezier(0.16,1,0.3,1)"}),e.appendChild(f);let m=[];if(!qm)for(let $=0;$<4;$++){let P=document.createElement("div");P.style.position="fixed",P.style.background="inherit",m.push(P),g.appendChild(P)}let y=$=>{g.style.clipPath=$,g.style.webkitClipPath=$},k=()=>{if(!n.isConnected){E.destroy();return}let $=n.getBoundingClientRect(),P=$.left-r,M=$.top-r,G=$.width+r*2,L=$.height+r*2;if(Object.assign(f.style,{left:`${P}px`,top:`${M}px`,width:`${G}px`,height:`${L}px`}),qm){let N=window.innerWidth,z=window.innerHeight,H=Math.min(i,G/2,L/2),oe=`M 0 0 L ${N} 0 L ${N} ${z} L 0 ${z} Z`,A=`M ${P+H} ${M} A ${H} ${H} 0 0 0 ${P} ${M+H} L ${P} ${M+L-H} A ${H} ${H} 0 0 0 ${P+H} ${M+L} L ${P+G-H} ${M+L} A ${H} ${H} 0 0 0 ${P+G} ${M+L-H} L ${P+G} ${M+H} A ${H} ${H} 0 0 0 ${P+G-H} ${M} L ${P+H} ${M} Z`;y(`path('${oe} ${A}')`)}else{let[N,z,H,oe]=m;Object.assign(N.style,{left:"0px",top:"0px",width:"100vw",height:`${M}px`}),Object.assign(H.style,{left:"0px",top:`${M+L}px`,width:"100vw",height:`${Math.max(0,window.innerHeight-(M+L))}px`}),Object.assign(oe.style,{left:"0px",top:`${M}px`,width:`${P}px`,height:`${L}px`}),Object.assign(z.style,{left:`${P+G}px`,top:`${M}px`,width:`${Math.max(0,window.innerWidth-(P+G))}px`,height:`${L}px`})}},_=new ResizeObserver(()=>requestAnimationFrame(k));_.observe(n);let b=()=>requestAnimationFrame(k),x=()=>requestAnimationFrame(k);window.addEventListener("scroll",b,!0),window.addEventListener("resize",x);let R=$=>{$.key==="Escape"&&c&&(t?.onDismiss?.(),E.destroy())};c&&window.addEventListener("keydown",R);let w=$=>{a?($.preventDefault(),$.stopPropagation()):l&&(t?.onDismiss?.(),E.destroy())};g.addEventListener("click",w);let E={destroy(){_.disconnect(),window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",x),c&&window.removeEventListener("keydown",R),g.removeEventListener("click",w),g.style.pointerEvents="none",g.style.opacity="0",setTimeout(()=>{try{g.remove()}catch{}try{f.remove()}catch{}},220)}};return k(),E}var xS=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button","svg","path","circle","line","polyline","polygon","rect","g"]);function ct(n){if(typeof window.Sanitizer=="function")try{let a=new window.Sanitizer({}).sanitizeToFragment(n),l=document.createElement("div");return l.append(a),l.innerHTML}catch{}let t=document.createElement("template");t.innerHTML=n;let r=t.content,i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,null),s=[];for(;i.nextNode();){let o=i.currentNode,a=o.tagName.toLowerCase();if(!xS.has(a)){s.push(o);continue}for(let l of Array.from(o.attributes)){let c=l.name.toLowerCase(),u=l.value.trim().toLowerCase(),d=c.startsWith("on"),h=(c==="href"||c==="src")&&u.startsWith("javascript:");(d||h)&&o.removeAttribute(l.name)}}for(let o of s){for(;o.firstChild;)o.parentNode?.insertBefore(o.firstChild,o);o.remove()}return t.innerHTML}var cr={bg:"var(--sc-overlay-background, #ffffff)",title:"var(--sc-overlay-title-color, var(--sc-overlay-text-color, #111827))",text:"var(--sc-overlay-text-color, #4b5563)",accent:"var(--sc-color-primary, #4f46e5)",radius:"var(--sc-border-radius, 12px)"},Gm=async(n,e)=>{let{content:t,size:r="md",blocking:i=!1,scrim:s,dismiss:o,ctaButtons:a}=n,l=document.createElement("div");l.className="syntro-modal-scrim",l.style.cssText=`
|
|
392
392
|
position: fixed;
|
|
393
393
|
inset: 0;
|
|
394
394
|
background: rgba(0, 0, 0, ${s?.opacity??.6});
|
|
@@ -409,7 +409,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
409
409
|
opacity: 0;
|
|
410
410
|
transition: opacity 200ms ease-out, transform 200ms ease-out;
|
|
411
411
|
padding: 24px;
|
|
412
|
-
`;let d="";if(t.title&&(d+=`<h2 class="syntro-modal-title" style="margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: ${cr.title};">${
|
|
412
|
+
`;let d="";if(t.title&&(d+=`<h2 class="syntro-modal-title" style="margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: ${cr.title};">${ct(t.title)}</h2>`),d+=`<div class="syntro-modal-body" style="color: ${cr.text}; line-height: 1.5;">${ct(t.body)}</div>`,o?.closeButton!==!1&&(d+=`
|
|
413
413
|
<button class="syntro-modal-close" data-syntro-action="dismiss" style="
|
|
414
414
|
position: absolute;
|
|
415
415
|
top: 16px;
|
|
@@ -425,10 +425,10 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
425
425
|
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
|
|
426
426
|
</svg>
|
|
427
427
|
</button>
|
|
428
|
-
`),a&&a.length>0){d+='<div class="syntro-modal-actions" style="display: flex; gap: 12px; margin-top: 24px; justify-content: flex-end;">';for(let
|
|
428
|
+
`),a&&a.length>0){d+='<div class="syntro-modal-actions" style="display: flex; gap: 12px; margin-top: 24px; justify-content: flex-end;">';for(let x of a){let R=x.primary??!1;d+=`
|
|
429
429
|
<button
|
|
430
|
-
class="syntro-modal-btn ${
|
|
431
|
-
data-syntro-action="${
|
|
430
|
+
class="syntro-modal-btn ${R?"syntro-modal-btn-primary":""}"
|
|
431
|
+
data-syntro-action="${ct(x.actionId)}"
|
|
432
432
|
style="
|
|
433
433
|
padding: 10px 20px;
|
|
434
434
|
border-radius: 8px;
|
|
@@ -436,12 +436,12 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
436
436
|
font-weight: 500;
|
|
437
437
|
cursor: pointer;
|
|
438
438
|
transition: background 150ms ease;
|
|
439
|
-
${
|
|
439
|
+
${R?`background: ${cr.accent}; color: white; border: none;`:`background: transparent; color: ${cr.accent}; border: 1px solid currentColor; opacity: 0.7;`}
|
|
440
440
|
"
|
|
441
441
|
>
|
|
442
|
-
${
|
|
442
|
+
${ct(x.label)}
|
|
443
443
|
</button>
|
|
444
|
-
`}d+="</div>"}c.innerHTML=d,e.overlayRoot.appendChild(c);let h=null,g=c.querySelectorAll("[data-syntro-action]"),v=w=>{let x=w.currentTarget.getAttribute("data-syntro-action");x&&(h=x,e.publishEvent("action.modal_cta_clicked",{actionId:x}),b.destroy())};g.forEach(w=>w.addEventListener("click",v));let f=w=>{w.key==="Escape"&&o?.onEsc!==!1&&b.destroy()};window.addEventListener("keydown",f);let m=()=>{i||b.destroy()};l.addEventListener("click",m);let y=[];i&&Array.from(document.body.children).forEach(w=>{w!==e.overlayRoot&&w.getAttribute("inert")===null&&!w.querySelector("[data-syntro-editor-panel]")&&!w.hasAttribute("data-syntro-editor-panel")&&(w.setAttribute("inert",""),y.push(w))});let k;o?.timeoutMs&&(k=setTimeout(()=>{b.destroy()},o.timeoutMs));let _=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');_.length>0&&requestAnimationFrame(()=>_[0].focus()),requestAnimationFrame(()=>{l.style.opacity="1",c.style.opacity="1",c.style.transform="translate(-50%, -50%) scale(1)"}),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:modal",size:r,blocking:i});let b={destroy(){k&&clearTimeout(k),window.removeEventListener("keydown",f),l.removeEventListener("click",m),g.forEach(w=>w.removeEventListener("click",v)),y.forEach(w=>w.removeAttribute("inert")),c.style.pointerEvents="none",l.style.pointerEvents="none",c.style.opacity="0",c.style.transform="translate(-50%, -50%) scale(0.95)",l.style.opacity="0",setTimeout(()=>{try{c.remove()}catch{}try{l.remove()}catch{}},200),e.publishEvent("action.modal_dismissed",{actionClicked:h})}};return{cleanup:()=>{b.destroy()}}};function vS(n){let e=n.getBoundingClientRect(),t=window.innerWidth,r=window.innerHeight;if(!(e.width>t*.8||e.height>r*.8))return n;let s=Math.max(e.left,0),o=Math.max(e.top,0),a=Math.min(e.right,t),l=Math.min(e.bottom,r),c=(s+a)/2,u=(o+l)/2;return{getBoundingClientRect(){return{width:0,height:0,x:c,y:u,top:u,left:c,right:c,bottom:u}}}}function Um(n,e,t){if(!t.trigger||t.trigger==="immediate"){let f=n.getBoundingClientRect();f.width>window.innerWidth*.8||f.height>window.innerHeight*.8||n.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}let r=document.createElement("div");if(r.className="syntro-tooltip",r.setAttribute("role","tooltip"),r.innerHTML=lt(t.html),!t.trigger||t.trigger==="immediate"){let f=document.createElement("button");f.className="syntro-tooltip-close",f.setAttribute("aria-label","Close"),f.textContent="\xD7",Object.assign(f.style,{position:"absolute",top:"4px",right:"4px",background:"none",border:"none",color:"inherit",fontSize:"16px",lineHeight:"1",cursor:"pointer",opacity:"0.6",padding:"2px 4px"}),f.addEventListener("mouseenter",()=>{f.style.opacity="1"}),f.addEventListener("mouseleave",()=>{f.style.opacity="0.6"}),f.addEventListener("click",()=>v.destroy()),r.style.position="relative",r.appendChild(f)}let i=r.querySelectorAll("[data-syntro-action]"),s=f=>{let y=f.currentTarget.getAttribute("data-syntro-action");y&&t.onAction&&t.onAction(y)};i.forEach(f=>f.addEventListener("click",s));let o=document.createElement("div");o.className="syntro-tooltip-arrow",r.appendChild(o),e.appendChild(r);let a=[Gr(t.offsetPx??8),Yr(),Kr({padding:8}),oa(),aa({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=Zr(n,r,async()=>{if(!n.isConnected){v.destroy();return}let f=vS(n),m=await Xr(f,r,{placement:l,strategy:"fixed",middleware:a}),{x:y,y:k,strategy:_,middlewareData:b,placement:w}=m;if(Object.assign(r.style,{left:`${y}px`,top:`${k}px`,position:_}),b.arrow){let{x:E,y:x}=b.arrow,R=w.split("-")[0],I={top:"bottom",right:"left",bottom:"top",left:"right"};Object.assign(o.style,{left:E!=null?`${E}px`:"",top:x!=null?`${x}px`:"",right:"",bottom:"",[I[R]]:"-4px"});let O={top:"0deg",right:"90deg",bottom:"180deg",left:"270deg"};o.style.transform=`rotate(${O[R]||"0deg"})`}}),u=f=>{f.key==="Escape"&&v.destroy()};window.addEventListener("keydown",u);let d=[];if(t.blocking){Array.from(document.body.children).forEach(m=>{m!==e&&m.getAttribute("inert")===null&&(m.setAttribute("inert",""),d.push(m.id||m.tagName))});let f=Array.from(r.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(f.length>0){let m=f[0],y=f[f.length-1],k=_=>{_.key==="Tab"&&(_.shiftKey?document.activeElement===m&&(y.focus(),_.preventDefault()):document.activeElement===y&&(m.focus(),_.preventDefault()))};r.addEventListener("keydown",k),requestAnimationFrame(()=>m.focus())}}let g=(()=>{if(t.trigger==="hover"){let f=null,m=()=>{f&&(clearTimeout(f),f=null),r.style.visibility="visible",r.style.opacity="1"},y=()=>{f=setTimeout(()=>{r.style.visibility="hidden",r.style.opacity="0",f=null},100)};return r.style.visibility="hidden",r.style.opacity="0",r.style.transition="opacity 200ms ease, visibility 200ms",n.addEventListener("mouseenter",m),n.addEventListener("mouseleave",y),r.addEventListener("mouseenter",m),r.addEventListener("mouseleave",y),n.addEventListener("focus",m),n.addEventListener("blur",y),()=>{f&&clearTimeout(f),n.removeEventListener("mouseenter",m),n.removeEventListener("mouseleave",y),r.removeEventListener("mouseenter",m),r.removeEventListener("mouseleave",y),n.removeEventListener("focus",m),n.removeEventListener("blur",y)}}if(t.trigger==="click"){let f=()=>{r.style.visibility==="visible"?v.destroy():(r.style.visibility="visible",r.style.opacity="1")};return r.style.visibility="hidden",r.style.opacity="0",r.style.transition="opacity 200ms ease, visibility 200ms",n.addEventListener("click",f),()=>n.removeEventListener("click",f)}return r.style.opacity="0",r.style.transition="opacity 200ms ease",requestAnimationFrame(()=>{r.style.opacity="1"}),()=>{}})(),v={el:r,destroy(){c(),g(),window.removeEventListener("keydown",u),i.forEach(f=>f.removeEventListener("click",s)),t.blocking&&Array.from(document.body.children).forEach(f=>{f!==e&&f.removeAttribute("inert")}),r.style.pointerEvents="none",r.style.opacity="0",setTimeout(()=>{try{r.remove()}catch{}},200)}};return v}var zm="#1969fe",yS="#24ad32",bS="#0e1114",mu="#677384",_S="#a8afba",qm="#f6f7f9",xS="#ffffff";function Zm(n){let e=document.createElement("div");e.setAttribute("data-testid","workflow-toast"),Object.assign(e.style,{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483646",padding:"12px 16px",borderRadius:"8px",backgroundColor:`var(--se-color-bg-surface, ${xS})`,color:`var(--se-color-text-primary, ${bS})`,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",maxWidth:"320px",fontFamily:"var(--se-font-family, system-ui, sans-serif)",fontSize:"14px",lineHeight:"1.4",transition:"opacity 0.3s ease"});let t=document.createElement("div");if(t.style.fontWeight="600",t.textContent=n.title,e.appendChild(t),n.body){let s=document.createElement("div");s.style.marginTop="4px",s.style.fontSize="13px",s.style.color="var(--se-color-text-secondary, #666)",s.textContent=n.body,e.appendChild(s)}document.body.appendChild(e);let r,i=setTimeout(()=>{e.style.opacity="0",r=setTimeout(()=>{e.remove()},300)},4e3);return()=>{clearTimeout(i),clearTimeout(r),e.remove()}}function wS(n){let e=new Map;for(let t of n){let r=t.action;if(r.kind==="overlays:tour"&&r.workflow&&r.tourId){let i=r.workflow,o=(r.steps||[]).map(a=>({id:a.id,title:i.stepTitles?.[a.id]||a.id}));e.set(r.tourId,{meta:i,steps:o})}}return e}var li="syntro-workflow-tracker",ci,ui,ur,Ht,di,Rs,dr,As=class extends he{constructor(){super(...arguments);this.runtimeRef=null;this._workflowEntries=[];this._actionVersion=0;ee(this,ci,null);ee(this,ui,null);ee(this,ur,[]);ee(this,Ht,new Set);ee(this,di,{});ee(this,Rs,!1);ee(this,dr,new Map)}createRenderRoot(){return this}get _stateNs(){return this.runtimeRef?.state?.user?.ns?.("workflows")??null}_rescanWorkflows(){let t=this.runtimeRef?.actions?.getActive?.()??[],r=wS(t);if(K(this,dr,r),r.size===0)return;let i=this._stateNs,s=i?.get("dismissed")??[],o=i?.get("completed")??{};this._workflowEntries=(()=>{let a=new Set(this._workflowEntries.map(c=>c.tourId)),l=[];for(let[c,{meta:u,steps:d}]of r){if(a.has(c))continue;let h="active";s.includes(c)?h="dismissed":o[c]&&(h="completed"),l.push({tourId:c,meta:u,steps:d,currentStepId:null,completedSteps:[],status:h,completedAt:o[c]||void 0})}return l.length>0?[...this._workflowEntries,...l]:this._workflowEntries})();for(let[a,{meta:l}]of r){let c=i?.get("dismissed")??[],u=i?.get("completed")??{};if(!$(this,Ht).has(a)&&l.notification&&!c.includes(a)&&!u[a]){$(this,Ht).add(a),i?.set("notified",[...$(this,Ht)]);let d=Zm(l.notification);$(this,ur).push(d)}}}connectedCallback(){super.connectedCallback(),this._initSubscriptions()}disconnectedCallback(){super.disconnectedCallback(),this._teardownSubscriptions();for(let t of $(this,ur))t();K(this,ur,[])}updated(t){t.has("runtimeRef")&&(this._teardownSubscriptions(),this._initSubscriptions()),t.has("_actionVersion")&&this._rescanWorkflows()}_initSubscriptions(){if(this.runtimeRef?.events?.subscribe){if(!$(this,Rs)&&this._stateNs){let t=this._stateNs.get("notified")??[];for(let i of t)$(this,Ht).add(i);let r=this._stateNs.get("completed")??{};K(this,di,{...r}),K(this,Rs,!0)}K(this,ci,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1})),K(this,ui,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},t=>{this._handleTourEvent(t)})),this._rescanWorkflows()}}_teardownSubscriptions(){var t,r;(t=$(this,ci))==null||t.call(this),K(this,ci,null),(r=$(this,ui))==null||r.call(this),K(this,ui,null)}_handleTourEvent(t){let r=t.props?.tourId;if(!r)return;if(!$(this,dr).has(r)&&t.name==="tour.started"){this._actionVersion+=1;return}if(!$(this,dr).has(r))return;let i=this._stateNs;this._workflowEntries=this._workflowEntries.map(s=>{if(s.tourId!==r)return s;switch(t.name){case"tour.started":{let o=t.props?.startStepId||s.steps[0]?.id||null;if(!$(this,Ht).has(r)){$(this,Ht).add(r),i?.set("notified",[...$(this,Ht)]);let l=$(this,dr).get(r);if(l?.meta.notification){let c=Zm(l.meta.notification);$(this,ur).push(c)}}let a=this._workflowEntries.filter(l=>l.status==="active"||l.tourId===r).map(l=>l.tourId);return a.includes(r)||a.push(r),i?.set("active",[...new Set(a)]),{...s,status:"active",currentStepId:o,completedSteps:s.status==="active"?s.completedSteps:[]}}case"tour.step_started":{let o=t.props?.stepId;return{...s,currentStepId:o||s.currentStepId}}case"tour.step_changed":{let o=t.props?.previousStepId,a=t.props?.nextStepId,l=o&&!s.completedSteps.includes(o)?[...s.completedSteps,o]:s.completedSteps;return{...s,currentStepId:a||s.currentStepId,completedSteps:l}}case"tour.completed":{let o=Date.now();return $(this,di)[r]=o,i?.set("completed",{...$(this,di)}),{...s,status:"completed",currentStepId:null,completedSteps:s.steps.map(a=>a.id),completedAt:o}}case"tour.paused":return s;default:return s}})}_handleStepClick(t,r){this.runtimeRef?.events?.publish("workflow:jump_to_step",{tourId:t,stepId:r}),this.dispatchEvent(new CustomEvent("workflow-step-click",{bubbles:!0,detail:{tourId:t,stepId:r}}))}_handleDismiss(t){this._workflowEntries=this._workflowEntries.map(i=>i.tourId===t?{...i,status:"dismissed"}:i);let r=this._workflowEntries.filter(i=>i.status==="dismissed").map(i=>i.tourId);this._stateNs?.set("dismissed",r),this.dispatchEvent(new CustomEvent("workflow-dismissed",{bubbles:!0,detail:{tourId:t}}))}_renderProgressBar(t,r){let i=r>0?Math.round(t/r*100):0,s={width:"100%",height:"6px",borderRadius:"9999px",background:"rgba(255,255,255,0.08)",overflow:"hidden"},o={height:"100%",borderRadius:"9999px",background:`var(--se-color-primary, ${zm})`,transition:"width 0.3s ease",width:`${i}%`};return D`
|
|
444
|
+
`}d+="</div>"}c.innerHTML=d,e.overlayRoot.appendChild(c);let h=null,g=c.querySelectorAll("[data-syntro-action]"),v=x=>{let w=x.currentTarget.getAttribute("data-syntro-action");w&&(h=w,e.publishEvent("action.modal_cta_clicked",{actionId:w}),b.destroy())};g.forEach(x=>x.addEventListener("click",v));let f=x=>{x.key==="Escape"&&o?.onEsc!==!1&&b.destroy()};window.addEventListener("keydown",f);let m=()=>{i||b.destroy()};l.addEventListener("click",m);let y=[];i&&Array.from(document.body.children).forEach(x=>{x!==e.overlayRoot&&x.getAttribute("inert")===null&&!x.querySelector("[data-syntro-editor-panel]")&&!x.hasAttribute("data-syntro-editor-panel")&&(x.setAttribute("inert",""),y.push(x))});let k;o?.timeoutMs&&(k=setTimeout(()=>{b.destroy()},o.timeoutMs));let _=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');_.length>0&&requestAnimationFrame(()=>_[0].focus()),requestAnimationFrame(()=>{l.style.opacity="1",c.style.opacity="1",c.style.transform="translate(-50%, -50%) scale(1)"}),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:modal",size:r,blocking:i});let b={destroy(){k&&clearTimeout(k),window.removeEventListener("keydown",f),l.removeEventListener("click",m),g.forEach(x=>x.removeEventListener("click",v)),y.forEach(x=>x.removeAttribute("inert")),c.style.pointerEvents="none",l.style.pointerEvents="none",c.style.opacity="0",c.style.transform="translate(-50%, -50%) scale(0.95)",l.style.opacity="0",setTimeout(()=>{try{c.remove()}catch{}try{l.remove()}catch{}},200),e.publishEvent("action.modal_dismissed",{actionClicked:h})}};return{cleanup:()=>{b.destroy()}}};function wS(n){let e=n.getBoundingClientRect(),t=window.innerWidth,r=window.innerHeight;if(!(e.width>t*.8||e.height>r*.8))return n;let s=Math.max(e.left,0),o=Math.max(e.top,0),a=Math.min(e.right,t),l=Math.min(e.bottom,r),c=(s+a)/2,u=(o+l)/2;return{getBoundingClientRect(){return{width:0,height:0,x:c,y:u,top:u,left:c,right:c,bottom:u}}}}function Km(n,e,t){if(!t.trigger||t.trigger==="immediate"){let f=n.getBoundingClientRect();f.width>window.innerWidth*.8||f.height>window.innerHeight*.8||n.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}let r=document.createElement("div");if(r.className="syntro-tooltip",r.setAttribute("role","tooltip"),r.innerHTML=ct(t.html),!t.trigger||t.trigger==="immediate"){let f=document.createElement("button");f.className="syntro-tooltip-close",f.setAttribute("aria-label","Close"),f.textContent="\xD7",Object.assign(f.style,{position:"absolute",top:"4px",right:"4px",background:"none",border:"none",color:"inherit",fontSize:"16px",lineHeight:"1",cursor:"pointer",opacity:"0.6",padding:"2px 4px"}),f.addEventListener("mouseenter",()=>{f.style.opacity="1"}),f.addEventListener("mouseleave",()=>{f.style.opacity="0.6"}),f.addEventListener("click",()=>v.destroy()),r.style.position="relative",r.appendChild(f)}let i=r.querySelectorAll("[data-syntro-action]"),s=f=>{let y=f.currentTarget.getAttribute("data-syntro-action");y&&t.onAction&&t.onAction(y)};i.forEach(f=>f.addEventListener("click",s));let o=document.createElement("div");o.className="syntro-tooltip-arrow",r.appendChild(o),e.appendChild(r);let a=[Gr(t.offsetPx??8),Yr(),Kr({padding:8}),aa(),la({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=Zr(n,r,async()=>{if(!n.isConnected){v.destroy();return}let f=wS(n),m=await Xr(f,r,{placement:l,strategy:"fixed",middleware:a}),{x:y,y:k,strategy:_,middlewareData:b,placement:x}=m;if(Object.assign(r.style,{left:`${y}px`,top:`${k}px`,position:_}),b.arrow){let{x:R,y:w}=b.arrow,E=x.split("-")[0],$={top:"bottom",right:"left",bottom:"top",left:"right"};Object.assign(o.style,{left:R!=null?`${R}px`:"",top:w!=null?`${w}px`:"",right:"",bottom:"",[$[E]]:"-4px"});let P={top:"0deg",right:"90deg",bottom:"180deg",left:"270deg"};o.style.transform=`rotate(${P[E]||"0deg"})`}}),u=f=>{f.key==="Escape"&&v.destroy()};window.addEventListener("keydown",u);let d=[];if(t.blocking){Array.from(document.body.children).forEach(m=>{m!==e&&m.getAttribute("inert")===null&&(m.setAttribute("inert",""),d.push(m.id||m.tagName))});let f=Array.from(r.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(f.length>0){let m=f[0],y=f[f.length-1],k=_=>{_.key==="Tab"&&(_.shiftKey?document.activeElement===m&&(y.focus(),_.preventDefault()):document.activeElement===y&&(m.focus(),_.preventDefault()))};r.addEventListener("keydown",k),requestAnimationFrame(()=>m.focus())}}let g=(()=>{if(t.trigger==="hover"){let f=null,m=()=>{f&&(clearTimeout(f),f=null),r.style.visibility="visible",r.style.opacity="1"},y=()=>{f=setTimeout(()=>{r.style.visibility="hidden",r.style.opacity="0",f=null},100)};return r.style.visibility="hidden",r.style.opacity="0",r.style.transition="opacity 200ms ease, visibility 200ms",n.addEventListener("mouseenter",m),n.addEventListener("mouseleave",y),r.addEventListener("mouseenter",m),r.addEventListener("mouseleave",y),n.addEventListener("focus",m),n.addEventListener("blur",y),()=>{f&&clearTimeout(f),n.removeEventListener("mouseenter",m),n.removeEventListener("mouseleave",y),r.removeEventListener("mouseenter",m),r.removeEventListener("mouseleave",y),n.removeEventListener("focus",m),n.removeEventListener("blur",y)}}if(t.trigger==="click"){let f=()=>{r.style.visibility==="visible"?v.destroy():(r.style.visibility="visible",r.style.opacity="1")};return r.style.visibility="hidden",r.style.opacity="0",r.style.transition="opacity 200ms ease, visibility 200ms",n.addEventListener("click",f),()=>n.removeEventListener("click",f)}return r.style.opacity="0",r.style.transition="opacity 200ms ease",requestAnimationFrame(()=>{r.style.opacity="1"}),()=>{}})(),v={el:r,destroy(){c(),g(),window.removeEventListener("keydown",u),i.forEach(f=>f.removeEventListener("click",s)),t.blocking&&Array.from(document.body.children).forEach(f=>{f!==e&&f.removeAttribute("inert")}),r.style.pointerEvents="none",r.style.opacity="0",setTimeout(()=>{try{r.remove()}catch{}},200)}};return v}var Ym="#1969fe",kS="#24ad32",SS="#0e1114",_u="#677384",ES="#a8afba",Xm="#f6f7f9",CS="#ffffff";function Jm(n){let e=document.createElement("div");e.setAttribute("data-testid","workflow-toast"),Object.assign(e.style,{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483646",padding:"12px 16px",borderRadius:"8px",backgroundColor:`var(--se-color-bg-surface, ${CS})`,color:`var(--se-color-text-primary, ${SS})`,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",maxWidth:"320px",fontFamily:"var(--se-font-family, system-ui, sans-serif)",fontSize:"14px",lineHeight:"1.4",transition:"opacity 0.3s ease"});let t=document.createElement("div");if(t.style.fontWeight="600",t.textContent=n.title,e.appendChild(t),n.body){let s=document.createElement("div");s.style.marginTop="4px",s.style.fontSize="13px",s.style.color="var(--se-color-text-secondary, #666)",s.textContent=n.body,e.appendChild(s)}document.body.appendChild(e);let r,i=setTimeout(()=>{e.style.opacity="0",r=setTimeout(()=>{e.remove()},300)},4e3);return()=>{clearTimeout(i),clearTimeout(r),e.remove()}}function AS(n){let e=new Map;for(let t of n){let r=t.action;if(r.kind==="overlays:tour"&&r.workflow&&r.tourId){let i=r.workflow,o=(r.steps||[]).map(a=>({id:a.id,title:i.stepTitles?.[a.id]||a.id}));e.set(r.tourId,{meta:i,steps:o})}}return e}var li="syntro-workflow-tracker",ci,ui,ur,Vt,di,Ts,dr,Rs=class extends ge{constructor(){super(...arguments);this.runtimeRef=null;this._workflowEntries=[];this._actionVersion=0;ee(this,ci,null);ee(this,ui,null);ee(this,ur,[]);ee(this,Vt,new Set);ee(this,di,{});ee(this,Ts,!1);ee(this,dr,new Map)}createRenderRoot(){return this}get _stateNs(){return this.runtimeRef?.state?.user?.ns?.("workflows")??null}_rescanWorkflows(){let t=this.runtimeRef?.actions?.getActive?.()??[],r=AS(t);if(Z(this,dr,r),r.size===0)return;let i=this._stateNs,s=i?.get("dismissed")??[],o=i?.get("completed")??{};this._workflowEntries=(()=>{let a=new Set(this._workflowEntries.map(c=>c.tourId)),l=[];for(let[c,{meta:u,steps:d}]of r){if(a.has(c))continue;let h="active";s.includes(c)?h="dismissed":o[c]&&(h="completed"),l.push({tourId:c,meta:u,steps:d,currentStepId:null,completedSteps:[],status:h,completedAt:o[c]||void 0})}return l.length>0?[...this._workflowEntries,...l]:this._workflowEntries})();for(let[a,{meta:l}]of r){let c=i?.get("dismissed")??[],u=i?.get("completed")??{};if(!I(this,Vt).has(a)&&l.notification&&!c.includes(a)&&!u[a]){I(this,Vt).add(a),i?.set("notified",[...I(this,Vt)]);let d=Jm(l.notification);I(this,ur).push(d)}}}connectedCallback(){super.connectedCallback(),this._initSubscriptions()}disconnectedCallback(){super.disconnectedCallback(),this._teardownSubscriptions();for(let t of I(this,ur))t();Z(this,ur,[])}updated(t){t.has("runtimeRef")&&(this._teardownSubscriptions(),this._initSubscriptions()),t.has("_actionVersion")&&this._rescanWorkflows()}_initSubscriptions(){if(this.runtimeRef?.events?.subscribe){if(!I(this,Ts)&&this._stateNs){let t=this._stateNs.get("notified")??[];for(let i of t)I(this,Vt).add(i);let r=this._stateNs.get("completed")??{};Z(this,di,{...r}),Z(this,Ts,!0)}Z(this,ci,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1})),Z(this,ui,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},t=>{this._handleTourEvent(t)})),this._rescanWorkflows()}}_teardownSubscriptions(){var t,r;(t=I(this,ci))==null||t.call(this),Z(this,ci,null),(r=I(this,ui))==null||r.call(this),Z(this,ui,null)}_handleTourEvent(t){let r=t.props?.tourId;if(!r)return;if(!I(this,dr).has(r)&&t.name==="tour.started"){this._actionVersion+=1;return}if(!I(this,dr).has(r))return;let i=this._stateNs;this._workflowEntries=this._workflowEntries.map(s=>{if(s.tourId!==r)return s;switch(t.name){case"tour.started":{let o=t.props?.startStepId||s.steps[0]?.id||null;if(!I(this,Vt).has(r)){I(this,Vt).add(r),i?.set("notified",[...I(this,Vt)]);let l=I(this,dr).get(r);if(l?.meta.notification){let c=Jm(l.meta.notification);I(this,ur).push(c)}}let a=this._workflowEntries.filter(l=>l.status==="active"||l.tourId===r).map(l=>l.tourId);return a.includes(r)||a.push(r),i?.set("active",[...new Set(a)]),{...s,status:"active",currentStepId:o,completedSteps:s.status==="active"?s.completedSteps:[]}}case"tour.step_started":{let o=t.props?.stepId;return{...s,currentStepId:o||s.currentStepId}}case"tour.step_changed":{let o=t.props?.previousStepId,a=t.props?.nextStepId,l=o&&!s.completedSteps.includes(o)?[...s.completedSteps,o]:s.completedSteps;return{...s,currentStepId:a||s.currentStepId,completedSteps:l}}case"tour.completed":{let o=Date.now();return I(this,di)[r]=o,i?.set("completed",{...I(this,di)}),{...s,status:"completed",currentStepId:null,completedSteps:s.steps.map(a=>a.id),completedAt:o}}case"tour.paused":return s;default:return s}})}_handleStepClick(t,r){this.runtimeRef?.events?.publish("workflow:jump_to_step",{tourId:t,stepId:r}),this.dispatchEvent(new CustomEvent("workflow-step-click",{bubbles:!0,detail:{tourId:t,stepId:r}}))}_handleDismiss(t){this._workflowEntries=this._workflowEntries.map(i=>i.tourId===t?{...i,status:"dismissed"}:i);let r=this._workflowEntries.filter(i=>i.status==="dismissed").map(i=>i.tourId);this._stateNs?.set("dismissed",r),this.dispatchEvent(new CustomEvent("workflow-dismissed",{bubbles:!0,detail:{tourId:t}}))}_renderProgressBar(t,r){let i=r>0?Math.round(t/r*100):0,s={width:"100%",height:"6px",borderRadius:"9999px",background:"rgba(255,255,255,0.08)",overflow:"hidden"},o={height:"100%",borderRadius:"9999px",background:`var(--se-color-primary, ${Ym})`,transition:"width 0.3s ease",width:`${i}%`};return D`
|
|
445
445
|
<div style=${T(s)}>
|
|
446
446
|
<div
|
|
447
447
|
role="progressbar"
|
|
@@ -451,24 +451,24 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
451
451
|
style=${T(o)}
|
|
452
452
|
></div>
|
|
453
453
|
</div>
|
|
454
|
-
`}_renderStepItem(t,r,i,s){let o={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"6px 8px",borderRadius:"4px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontSize:"12px",lineHeight:"1.4",color:i?`var(--se-color-text-primary, ${
|
|
454
|
+
`}_renderStepItem(t,r,i,s){let o={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"6px 8px",borderRadius:"4px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontSize:"12px",lineHeight:"1.4",color:i?`var(--se-color-text-primary, ${Xm})`:`var(--se-color-text-secondary, ${ES})`,fontWeight:i?"600":"400"},a={flexShrink:"0",width:"16px",textAlign:"center"},l={display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",background:i?`var(--se-color-primary, ${Ym})`:"rgba(255,255,255,0.12)"},c={color:`var(--se-color-success, ${kS})`},u={flex:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},d=r?D`<span role="img" aria-label="completed" style=${T(c)}>✓</span>`:i?D`<span style=${T(l)}></span>`:D`<span style=${T(l)}></span>`;return D`
|
|
455
455
|
<button
|
|
456
456
|
type="button"
|
|
457
457
|
data-testid=${`step-${t.id}`}
|
|
458
|
-
data-current=${i?"true":
|
|
459
|
-
data-completed=${r?"true":
|
|
460
|
-
aria-current=${i?"step":
|
|
458
|
+
data-current=${i?"true":J}
|
|
459
|
+
data-completed=${r?"true":J}
|
|
460
|
+
aria-current=${i?"step":J}
|
|
461
461
|
style=${T(o)}
|
|
462
462
|
@click=${()=>this._handleStepClick(s,t.id)}
|
|
463
463
|
>
|
|
464
464
|
<span style=${T(a)}>${d}</span>
|
|
465
465
|
<span style=${T(u)}>${t.title}</span>
|
|
466
466
|
</button>
|
|
467
|
-
`}_renderWorkflowCard(t){let r=t.completedSteps.length,i=t.steps.length,s={padding:"12px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.02)"},o={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},a={flex:"1",fontSize:"13px",fontWeight:"600",color:`var(--se-color-text-primary, ${
|
|
467
|
+
`}_renderWorkflowCard(t){let r=t.completedSteps.length,i=t.steps.length,s={padding:"12px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.02)"},o={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},a={flex:"1",fontSize:"13px",fontWeight:"600",color:`var(--se-color-text-primary, ${Xm})`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},l={flexShrink:"0",padding:"2px 6px",border:"none",borderRadius:"4px",background:"transparent",color:`var(--se-color-text-tertiary, ${_u})`,fontSize:"12px",cursor:"pointer",lineHeight:"1"},c={marginBottom:"8px"},u={fontSize:"10px",color:`var(--se-color-text-tertiary, ${_u})`,marginTop:"4px"},d={display:"flex",flexDirection:"column"};return D`
|
|
468
468
|
<div style=${T(s)}>
|
|
469
469
|
<!-- Header: icon + title + dismiss -->
|
|
470
470
|
<div style=${T(o)}>
|
|
471
|
-
${t.meta.icon?D`<span data-testid="workflow-icon" style="flex-shrink:0;font-size:14px">${t.meta.icon}</span>`:
|
|
471
|
+
${t.meta.icon?D`<span data-testid="workflow-icon" style="flex-shrink:0;font-size:14px">${t.meta.icon}</span>`:J}
|
|
472
472
|
<span style=${T(a)}>${t.meta.title}</span>
|
|
473
473
|
<button
|
|
474
474
|
type="button"
|
|
@@ -492,11 +492,11 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
492
492
|
${t.steps.map(h=>this._renderStepItem(h,t.completedSteps.includes(h.id),t.currentStepId===h.id,t.tourId))}
|
|
493
493
|
</div>
|
|
494
494
|
</div>
|
|
495
|
-
`}render(){let t=this._workflowEntries.filter(i=>i.status==="active");if(t.length===0){let i={display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 0",fontSize:"12px",color:`var(--se-color-text-tertiary, ${
|
|
495
|
+
`}render(){let t=this._workflowEntries.filter(i=>i.status==="active");if(t.length===0){let i={display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 0",fontSize:"12px",color:`var(--se-color-text-tertiary, ${_u})`};return D`<div style=${T(i)}>No active workflows</div>`}return D`
|
|
496
496
|
<div style=${T({display:"flex",flexDirection:"column",gap:"8px"})}>
|
|
497
497
|
${t.map(i=>this._renderWorkflowCard(i))}
|
|
498
498
|
</div>
|
|
499
|
-
`}};ci=new WeakMap,ui=new WeakMap,ur=new WeakMap,
|
|
499
|
+
`}};ci=new WeakMap,ui=new WeakMap,ur=new WeakMap,Vt=new WeakMap,di=new WeakMap,Ts=new WeakMap,dr=new WeakMap,Rs.properties={runtimeRef:{attribute:!1},_workflowEntries:{state:!0},_actionVersion:{state:!0}};typeof window<"u"&&!customElements.get(li)&&customElements.define(li,Rs);var Qm={mount(n,e){let t=e?.runtime??null;typeof window<"u"&&!customElements.get(li)&&customElements.define(li,Rs);let r=document.createElement(li);return r.runtimeRef=t,n.appendChild(r),()=>{r.remove()}},update(n,e){let t=n.querySelector(li);if(!t)return;let r=e?.runtime??null;t.runtimeRef=r}};var RS=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};if(t.getAttribute("data-syntro-highlight-dismissed"))return{cleanup:()=>{}};t.getAttribute("data-syntro-highlight")&&e.overlayRoot.querySelectorAll(".syntro-spotlight-scrim, .syntro-spotlight-ring").forEach(a=>a.remove()),t.setAttribute("data-syntro-highlight","true");let i=n.style?.color;if(!i)try{let o=getComputedStyle(e.overlayRoot).getPropertyValue("--sc-color-primary")?.trim();o&&(i=o)}catch{}let s=Zm(t,e.overlayRoot,{paddingPx:n.style?.paddingPx??12,radiusPx:n.style?.radiusPx??12,scrimOpacity:n.style?.scrimOpacity??.55,ringColor:i,blocking:n.blocking??!1,onClickOutside:n.onClickOutside??!0,onEsc:n.onEsc??!0,onDismiss:()=>{t.setAttribute("data-syntro-highlight-dismissed","true")}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:highlight",anchorId:n.anchorId}),{cleanup:()=>{s.destroy(),t.removeAttribute("data-syntro-highlight"),t.removeAttribute("data-syntro-highlight-dismissed")}}},TS=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r=n.duration??4e3;await new Promise(f=>requestAnimationFrame(f));let i=f=>({r:parseInt(f.slice(1,3),16),g:parseInt(f.slice(3,5),16),b:parseInt(f.slice(5,7),16)}),o={r:79,g:70,b:229},a=null;try{let f=getComputedStyle(e.overlayRoot),m=f.getPropertyValue("--sc-color-primary")?.trim(),y=f.getPropertyValue("--sc-color-primary-hover")?.trim();m?.startsWith("#")&&m.length>=7&&(o=i(m)),y?.startsWith("#")&&y.length>=7&&(a=i(y))}catch{}let l=document.querySelector("[data-syntro-pulse-styles]");l&&l.remove();let c=document.createElement("style");c.setAttribute("data-syntro-pulse-styles","");let{r:u,g:d,b:h}=o;if(a){let{r:f,g:m,b:y}=a;c.textContent=`
|
|
500
500
|
@keyframes syntro-pulse-anim {
|
|
501
501
|
0%, 100% {
|
|
502
502
|
box-shadow: 0 0 0 0 rgba(${u}, ${d}, ${h}, 0.35);
|
|
@@ -520,18 +520,18 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
520
520
|
box-shadow: 0 0 0 12px rgba(${u}, ${d}, ${h}, 0);
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
|
-
`;document.head.appendChild(c);let g=t.style.animation;t.style.animation="syntro-pulse-anim 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite",t.setAttribute("data-syntro-pulse","true");let v=setTimeout(()=>{t.style.animation=g,t.removeAttribute("data-syntro-pulse")},r);return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:pulse",anchorId:n.anchorId,duration:r}),{cleanup:()=>{clearTimeout(v),t.isConnected&&(t.style.animation=g,t.removeAttribute("data-syntro-pulse"))}}},
|
|
523
|
+
`;document.head.appendChild(c);let g=t.style.animation;t.style.animation="syntro-pulse-anim 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite",t.setAttribute("data-syntro-pulse","true");let v=setTimeout(()=>{t.style.animation=g,t.removeAttribute("data-syntro-pulse")},r);return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:pulse",anchorId:n.anchorId,duration:r}),{cleanup:()=>{clearTimeout(v),t.isConnected&&(t.style.animation=g,t.removeAttribute("data-syntro-pulse"))}}},IS=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let r="#4f46e5";try{let a=getComputedStyle(e.overlayRoot).getPropertyValue("--sc-color-primary")?.trim();a?.startsWith("#")&&a.length>=7&&(r=a)}catch{}let i=document.createElement("div");i.textContent=n.content,i.setAttribute("data-syntro-badge",n.anchorId.selector),Object.assign(i.style,{position:"absolute",padding:"2px 6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",color:"white",background:r,borderRadius:"9999px",pointerEvents:"none",zIndex:"2147483646",whiteSpace:"nowrap"});let s=n.position??"top-right",o=t.style.position;switch(getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.appendChild(i),s){case"top-left":Object.assign(i.style,{top:"-8px",left:"-8px"});break;case"top-right":Object.assign(i.style,{top:"-8px",right:"-8px"});break;case"bottom-left":Object.assign(i.style,{bottom:"-8px",left:"-8px"});break;case"bottom-right":Object.assign(i.style,{bottom:"-8px",right:"-8px"});break}return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:badge",anchorId:n.anchorId,content:n.content,position:s}),{cleanup:()=>{try{i.remove()}catch{}t.isConnected&&o!==void 0&&(t.style.position=o)},updateFn:a=>{"content"in a&&typeof a.content=="string"&&(i.textContent=a.content)}}},$S=async(n,e)=>{let t=e.resolveAnchor(n.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(n.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${n.anchorId.selector}`),{cleanup:()=>{}};let{content:r}=n,i="";if(r.title&&(i+=`<div class="syntro-tt-title">${ct(r.title)}</div>`),i+=`<div class="syntro-tt-body">${ct(r.body)}</div>`,r.ctaButtons&&r.ctaButtons.length>0){i+='<div class="syntro-tt-actions">';for(let o of r.ctaButtons){let a=o.primary??!1;i+=`
|
|
524
524
|
<button
|
|
525
525
|
class="syntro-tt-btn ${a?"syntro-tt-btn-primary":""}"
|
|
526
|
-
data-syntro-action="${
|
|
526
|
+
data-syntro-action="${ct(o.actionId)}"
|
|
527
527
|
>
|
|
528
|
-
${
|
|
528
|
+
${ct(o.label)}
|
|
529
529
|
</button>
|
|
530
530
|
`}i+="</div>"}else r.cta&&(i+=`<div class="syntro-tt-actions">
|
|
531
531
|
<button class="syntro-tt-btn syntro-tt-btn-primary" data-syntro-action="cta">
|
|
532
|
-
${
|
|
532
|
+
${ct(r.cta.label)}
|
|
533
533
|
</button>
|
|
534
|
-
</div>`);let s=Um(t,e.overlayRoot,{html:i,placement:n.placement??"top",trigger:n.trigger??"immediate",onAction:o=>{if(o==="dismiss"){s.destroy();return}if(o==="cta"&&r.cta)e.publishEvent("action.cta_clicked",{anchorId:n.anchorId,ctaLabel:r.cta.label});else if(r.ctaButtons){let a=r.ctaButtons.find(l=>l.actionId===o);a&&e.publishEvent("action.tooltip_cta_clicked",{anchorId:n.anchorId,actionId:o,label:a.label})}s.destroy()}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:tooltip",anchorId:n.anchorId,trigger:n.trigger??"immediate"}),{cleanup:()=>{s.destroy()}}},AS=[{kind:"overlays:highlight",executor:kS},{kind:"overlays:pulse",executor:SS},{kind:"overlays:badge",executor:ES},{kind:"overlays:tooltip",executor:CS},{kind:"overlays:modal",executor:jm},{kind:"overlays:tour",executor:Bm},{kind:"overlays:celebrate",executor:Hm}],Km={id:"adaptive-overlays",version:"1.0.0",name:"Overlays",description:"Tooltips, highlights, badges, modals, celebrations, visual overlays, and workflow tracking",executors:AS,widgets:[{id:"adaptive-overlays:workflow-tracker",component:Gm,metadata:{name:"Workflow Tracker",icon:"\u{1F4CB}",description:"Tracks multi-step workflow progress across tours"}}]};var RS=[tm,bc,km,Sm,Pm,Km],TS=RS.map(n=>({id:n.id,version:n.version,name:n.name,description:n.description,runtime:{actions:(n.executors||[]).map(({kind:e,executor:t})=>({kind:e,executor:t})),widgets:n.widgets,notifyWatchers:n.notifyWatchers,events:n.eventHandlers},editor:void 0,metadata:{isBuiltIn:!0}}));function Ym(n){let e=0;for(let t of TS)n.has(t.id)||(n.register(t),e++);console.log("[Syntro Runtime] Registered",e,"built-in runtime modules (Lit)")}var pr=class extends Event{constructor(e,t,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=r,this.subscribe=i??!1}};var Ia=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let r=t||!Object.is(e,this.o);this.o=e,r&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:r}]of this.subscriptions)t(this.o,r)},e!==void 0&&(this.value=e)}addCallback(e,t,r){if(!r)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:i}=this.subscriptions.get(e);e(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var vu=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},pi=class extends Ia{constructor(e,t,r){super(t.context!==void 0?t.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[o,{consumerHost:a}]of this.subscriptions)s.has(o)||(s.add(o),a.dispatchEvent(new pr(this.context,a,o,!0)));i.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new vu(this.context,this.host))}};var Te="1.0.0",Se={UI_CLICK:"ui.click",UI_SCROLL:"ui.scroll",UI_INPUT:"ui.input",UI_CHANGE:"ui.change",UI_SUBMIT:"ui.submit",NAV_PAGE_VIEW:"nav.page_view",NAV_PAGE_LEAVE:"nav.page_leave",UI_HESITATE:"ui.hesitate",UI_RAGE_CLICK:"ui.rage_click",UI_SCROLL_THRASH:"ui.scroll_thrash",UI_FOCUS_BOUNCE:"ui.focus_bounce",UI_IDLE:"ui.idle",UI_HOVER:"ui.hover"},Xe={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,Drag:12},Ts={MouseUp:0,MouseDown:1,Click:2,ContextMenu:3,DblClick:4,Focus:5,Blur:6,TouchStart:7,TouchEnd:9},yu={hesitationMs:3e3,hesitationRadiusPx:10,rageClickCount:3,rageClickWindowMs:1e3,rageClickRadiusPx:30,scrollThrashReversals:3,scrollThrashWindowMs:2e3,focusBounceMaxInputs:0,idleMs:5e3,hoverSampleMs:100};var $a=class{constructor(e,t){this.config=e,this.emit=t,this.focused=new Map}ingest(e){if(e.type!==3)return;let t=e.timestamp;if(e.data.source===Xe.MouseInteraction){let r=e.data.id??0;if(e.data.type===Ts.Focus)this.focused.set(r,{id:r,focusTs:t,inputCount:0});else if(e.data.type===Ts.Blur){let i=this.focused.get(r);i&&i.inputCount<=this.config.focusBounceMaxInputs&&this.emit({ts:t,name:Se.UI_FOCUS_BOUNCE,source:"rrweb",schemaVersion:Te,props:{elementId:r,duration_ms:t-i.focusTs}}),this.focused.delete(r)}}else if(e.data.source===Xe.Input){let r=e.data.id??0,i=this.focused.get(r);i&&i.inputCount++}}};var Ma=class{constructor(e,t){this.config=e,this.emit=t,this.anchorX=0,this.anchorY=0,this.anchorTs=0,this.emitted=!1,this.hasPosition=!1}ingest(e){if(e.type!==3||e.data.source!==Xe.MouseMove)return;let t=e.data.positions;if(!t||t.length===0)return;let r=t[t.length-1],i=e.timestamp+(r.timeOffset??0);if(!this.hasPosition){this.anchorX=r.x,this.anchorY=r.y,this.anchorTs=i,this.hasPosition=!0,this.emitted=!1;return}let s=r.x-this.anchorX,o=r.y-this.anchorY;Math.sqrt(s*s+o*o)>this.config.hesitationRadiusPx&&(this.anchorX=r.x,this.anchorY=r.y,this.anchorTs=i,this.emitted=!1)}tick(e){if(!this.hasPosition||this.emitted)return;let t=e-this.anchorTs;t>=this.config.hesitationMs&&(this.emit({ts:e,name:Se.UI_HESITATE,source:"rrweb",schemaVersion:Te,props:{x:this.anchorX,y:this.anchorY,duration_ms:t}}),this.emitted=!0)}};var Pa=class{constructor(e,t,r){this.config=e,this.emit=t,this.elementResolver=r,this.currentElement=null,this.hoverStartTs=null,this.lastX=0,this.lastY=0,this.lastSampleTs=-1/0}ingest(e){if(e.type!==3||e.data.source!==Xe.MouseMove)return;let t=e.data.positions;if(!t||t.length===0)return;let r=t[t.length-1];this.lastX=r.x,this.lastY=r.y}tick(e){if(!this.elementResolver||e-this.lastSampleTs<this.config.hoverSampleMs)return;this.lastSampleTs=e;let t=this.elementResolver(this.lastX,this.lastY),r=t?Xm(t):null,i=this.currentElement?Xm(this.currentElement):null;r!==i&&(this.currentElement&&this.hoverStartTs!==null&&this.emit({ts:e,name:Se.UI_HOVER,source:"rrweb",schemaVersion:Te,props:{x:this.lastX,y:this.lastY,duration_ms:e-this.hoverStartTs,element:this.currentElement}}),this.currentElement=t,this.hoverStartTs=e)}};function Xm(n){return`${n.tag_name??""}|${n.attr__id??""}|${(n.classes??[]).join(",")}`}var Oa=class{constructor(e,t){this.config=e,this.emit=t,this.lastActivityTs=null,this.emitted=!1}ingest(e){if(e.type!==3)return;let t=e.data.source;(t===Xe.MouseMove||t===Xe.MouseInteraction||t===Xe.Scroll)&&(this.lastActivityTs=e.timestamp,this.emitted=!1)}tick(e){this.lastActivityTs===null||this.emitted||e-this.lastActivityTs>=this.config.idleMs&&(this.emit({ts:e,name:Se.UI_IDLE,source:"rrweb",schemaVersion:Te,props:{idle_ms:e-this.lastActivityTs}}),this.emitted=!0)}};var Na=class{constructor(e,t){this.config=e,this.emit=t,this.clicks=[]}ingest(e){if(e.type!==3||e.data.source!==Xe.MouseInteraction||e.data.type!==Ts.Click)return;let t=e.data.x??0,r=e.data.y??0,i=e.timestamp,s=i-this.config.rageClickWindowMs;this.clicks=this.clicks.filter(a=>a.ts>=s),this.clicks.push({ts:i,x:t,y:r});let o=this.clicks.filter(a=>{let l=a.x-t,c=a.y-r;return Math.sqrt(l*l+c*c)<=this.config.rageClickRadiusPx});o.length>=this.config.rageClickCount&&(this.emit({ts:i,name:Se.UI_RAGE_CLICK,source:"rrweb",schemaVersion:Te,props:{x:t,y:r,clickCount:o.length,duration_ms:i-o[0].ts}}),this.clicks=[])}};var La=class{constructor(e,t){this.config=e,this.emit=t,this.lastY=null,this.lastDirection=null,this.reversals=[]}ingest(e){if(e.type!==3||e.data.source!==Xe.Scroll)return;let t=e.data.y??0,r=e.timestamp;if(this.lastY!==null){let i=t>this.lastY?"down":t<this.lastY?"up":this.lastDirection;if(i&&i!==this.lastDirection){let s=r-this.config.scrollThrashWindowMs;this.reversals=this.reversals.filter(o=>o>s),this.reversals.push(r),this.reversals.length>=this.config.scrollThrashReversals&&(this.emit({ts:r,name:Se.UI_SCROLL_THRASH,source:"rrweb",schemaVersion:Te,props:{reversals:this.reversals.length,duration_ms:r-this.reversals[0]}}),this.reversals=[])}this.lastDirection=i}this.lastY=t}};var Qm={$click:Se.UI_CLICK,$scroll:Se.UI_SCROLL,$input:Se.UI_INPUT,$change:Se.UI_CHANGE,$submit:Se.UI_SUBMIT,$pageview:Se.NAV_PAGE_VIEW,$pageleave:Se.NAV_PAGE_LEAVE,$session_start:"session.start",$identify:"user.identify"};function MS(n){let e=n.event;if(typeof e!="string")return"posthog.unknown";if(Qm[e])return Qm[e];if(e==="$autocapture"){let t=n.properties?.$tag_name,r=n.properties?.$event_type;return r==="submit"?Se.UI_SUBMIT:r==="change"?Se.UI_CHANGE:t==="input"||t==="textarea"?Se.UI_INPUT:Se.UI_CLICK}return e.startsWith("$")?e.replace("$","posthog."):`posthog.${e}`}var Jm=new Set(["a","button","input","select","textarea"]);function PS(n){if(n)return n.split(";").map(e=>{let t={},r=e.indexOf(":"),i=r>=0?e.slice(0,r):e,s=r>=0?e.slice(r+1):"",o=i.indexOf(".");if(o>=0?(t.tag_name=i.slice(0,o),t.attr__class=i.slice(o+1).replace(/\./g," ")):t.tag_name=i,!/^[a-zA-Z][a-zA-Z0-9-]*$/.test(String(t.tag_name??"")))return null;let a=/([\w$]+)="([^"]*)"/g,l;for(;(l=a.exec(s))!==null;){let[,c,u]=l;c==="nth-child"||c==="nth-of-type"||(t[c]=u)}return t.text&&(t.$el_text=t.text,delete t.text),t}).filter(e=>e!==null)}function OS(n,e){if(e&&Jm.has(e)||!n)return e;for(let t of n){let r=t.tag_name;if(r&&Jm.has(r))return r}return e}function NS(n){let e={},t=n.properties||{},r=t.$elements??(typeof t.$elements_chain=="string"?PS(t.$elements_chain):void 0),i=t.$tag_name??r?.[0]?.tag_name,s=n.event==="$autocapture"||n.event==="$click";return e.tagName=s?OS(r,i):i,t.$el_text&&(e.elementText=t.$el_text),r&&(e.elements=r),s&&!r&&console.warn(`[PostHogNormalizer] $autocapture click has no element chain. PostHog may have changed wire format. Properties: $elements=${!!t.$elements}, $elements_chain=${typeof t.$elements_chain}`),t.$current_url&&(e.url=t.$current_url),t.$pathname&&(e.pathname=t.$pathname),t.$host&&(e.host=t.$host),t.$viewport_width&&(e.viewportWidth=t.$viewport_width),t.$viewport_height&&(e.viewportHeight=t.$viewport_height),t.$session_id&&(e.sessionId=t.$session_id),t.$scroll_depth&&(e.scrollDepth=t.$scroll_depth),t.$scroll_percentage&&(e.scrollPercentage=t.$scroll_percentage),e.originalEvent=n.event,e}function Is(n){let e;return typeof n.timestamp=="number"?e=n.timestamp:typeof n.timestamp=="string"?e=new Date(n.timestamp).getTime():e=Date.now(),{ts:e,name:MS(n),source:"posthog",props:NS(n),schemaVersion:Te}}function $s(n){let e=n.event;return!(typeof e!="string"||["$feature_flag_called","$feature_flags","$groups","$groupidentify","$set","$set_once","$unset","$create_alias","$capture_metrics","$performance_event","$web_vitals","$exception","$dead_click","$heatmap"].includes(e))}function ev(n){return(e,t)=>{if(typeof e!="string")return;let r={event:e,properties:t,timestamp:Date.now()};if($s(r)){let i=Is(r);n(i)}}}function bu(n){let e={...yu,...n?.config},t=[];function r(d){for(let h of t)h(d)}let i=new Ma(e,r),s=new Na(e,r),o=new La(e,r),a=new $a(e,r),l=new Oa(e,r),c=new Pa(e,r,n?.elementResolver),u=[];return{ingest(d){if(d.kind==="posthog"){let{kind:h,...g}=d;$s(g)&&r(Is(g))}else d.kind==="rrweb"&&(i.ingest(d),s.ingest(d),o.ingest(d),a.ingest(d),l.ingest(d),c.ingest(d))},onEvent(d){t.push(d)},tick(d){i.tick(d),l.tick(d),c.tick(d)},enrichClickAttributes(d,h){u.push({ts:d,elements:h});let g=d-500;for(;u.length>0&&u[0].ts<g;)u.shift()}}}var Be={UI_CLICK:"ui.click",UI_SCROLL:"ui.scroll",UI_INPUT:"ui.input",UI_CHANGE:"ui.change",UI_SUBMIT:"ui.submit",NAV_PAGE_VIEW:"nav.page_view",NAV_PAGE_LEAVE:"nav.page_leave",CANVAS_OPENED:"canvas.opened",CANVAS_CLOSED:"canvas.closed",TILE_VIEWED:"tile.viewed",TILE_EXPANDED:"tile.expanded",TILE_COLLAPSED:"tile.collapsed",TILE_ACTION:"tile.action",OVERLAY_STARTED:"overlay.started",OVERLAY_COMPLETED:"overlay.completed",OVERLAY_DISMISSED:"overlay.dismissed",OVERLAY_STEP_VIEWED:"overlay.step_viewed",BEHAVIOR_RAGE_CLICK:"behavior.rage_click",BEHAVIOR_HESITATION:"behavior.hesitation",BEHAVIOR_CONFUSION:"behavior.confusion",ACTION_APPLIED:"action.applied",ACTION_REVERTED:"action.reverted",ACTION_FAILED:"action.failed",ACTION_CTA_CLICKED:"action.cta_clicked",NOTIFICATION_SHOWN:"notification.shown",NOTIFICATION_CLICKED:"notification.clicked",NOTIFICATION_DISMISSED:"notification.dismissed",NOTIFICATION_DEEP_LINK:"notification.deep_link",SURFACE_MOUNTED:"surface.mounted",SURFACE_UNMOUNTED:"surface.unmounted"};var _u=3;var xu=3e4;var FS=0;function wu(n,e){return n.replace(/\{\{props\.(\w+)\}\}/g,(t,r)=>!e||!(r in e)?t:String(e[r]))}function DS(n,e){if(n===e)return!0;try{return new RegExp(e).test(n)}catch{return!1}}function tv(n,e){for(let t of e){let r=t.notifications;if(!(!r||r.length===0))for(let i of r){if(!DS(n.name,i.on))continue;let s=Date.now(),o=i.ttl??8e3;return{notification:{id:`notif-${++FS}-${s}`,title:wu(i.title,n.props),body:i.body?wu(i.body,n.props):void 0,icon:i.icon,tileId:t.id,itemId:i.deepLink?.itemId?wu(i.deepLink.itemId,n.props):void 0,expiresAt:s+o,createdAt:s,ttl:o},rule:i}}}return null}var Ms=class{constructor(e,t,r){this._notifications=[];this._cooldownMap=new Map;this._timerIds=new Map;this._unsubscribe=null;this.host=e,this.eventBus=t,this.tiles=r,e.addController(this)}get notifications(){return this._notifications}setTiles(e){this.tiles=e}setEventBus(e){this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=null),this.eventBus=e,this.eventBus&&this.hostConnected()}hostConnected(){this.eventBus&&(this._unsubscribe=this.eventBus.subscribe(e=>{let t=tv(e,this.tiles);if(!t)return;let{notification:r,rule:i}=t,s=r.itemId?`${r.tileId}:${e.name}:${r.itemId}`:`${r.tileId}:${e.name}`,o=this._cooldownMap.get(s),a=Date.now(),l=i.cooldown??3e4;if(o!==void 0&&a-o<l||(this._cooldownMap.set(s,a),r.itemId&&this._notifications.some(d=>d.tileId===r.tileId&&d.itemId===r.itemId)))return;let c=[...this._notifications,r];if(c.length>3){let u=c.shift(),d=this._timerIds.get(u.id);d&&(clearTimeout(d),this._timerIds.delete(u.id))}this._notifications=c,this.host.requestUpdate(),this.eventBus.publish(Be.NOTIFICATION_SHOWN,{notificationId:r.id,tileId:r.tileId,itemId:r.itemId,title:r.title}),this._scheduleDismiss(r)}))}hostDisconnected(){this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=null);for(let e of this._timerIds.values())clearTimeout(e);this._timerIds.clear()}dismiss(e){let t=this._notifications.find(i=>i.id===e);t&&this._publishDismissed(t),this._notifications=this._notifications.filter(i=>i.id!==e);let r=this._timerIds.get(e);r&&(clearTimeout(r),this._timerIds.delete(e)),this.host.requestUpdate()}_publishDismissed(e){this.eventBus?.publish(Be.NOTIFICATION_DISMISSED,{notificationId:e.id,tileId:e.tileId,itemId:e.itemId})}_scheduleDismiss(e){let t=setTimeout(()=>{this._notifications=this._notifications.filter(r=>r.id!==e.id),this._timerIds.delete(e.id),this._publishDismissed(e),this.host.requestUpdate()},e.ttl);this._timerIds.set(e.id,t)}};function Pt(n,e){return{ts:Date.now(),name:n,source:"canvas",props:e,schemaVersion:Te}}function HS(n){return Pt(Be.CANVAS_OPENED,{surface:n})}function BS(n){return Pt(Be.CANVAS_CLOSED,{surface:n})}function VS(n,e){return Pt(Be.TILE_VIEWED,{tileId:n,surface:e})}function WS(n,e){return Pt(Be.TILE_EXPANDED,{tileId:n,surface:e})}function jS(n,e){return Pt(Be.TILE_COLLAPSED,{tileId:n,surface:e})}function US(n,e,t){return Pt(Be.TILE_ACTION,{tileId:n,actionId:e,surface:t})}function zS(n,e){return Pt(Be.OVERLAY_STARTED,{recipeId:n,recipeName:e})}function qS(n,e){return Pt(Be.OVERLAY_COMPLETED,{recipeId:n,recipeName:e})}function ZS(n,e,t){return Pt(Be.OVERLAY_DISMISSED,{recipeId:n,recipeName:e,stepIndex:t})}function GS(n,e,t){return Pt(Be.OVERLAY_STEP_VIEWED,{recipeId:n,stepIndex:e,stepTitle:t})}function KS(n,e){let t=n.startsWith("canvas.")?n:`canvas.${n}`;return Pt(t,e)}var Ps={canvasOpened:HS,canvasClosed:BS,tileViewed:VS,tileExpanded:WS,tileCollapsed:jS,tileAction:US,overlayStarted:zS,overlayCompleted:qS,overlayDismissed:ZS,overlayStepViewed:GS,custom:KS};function YS(n,e){let t=[];for(let r of n){let i=r.widget.split(":")[0],o=e.get(i)?.manifest.runtime?.notifyWatchers;o&&t.push(...o(r.props??{}))}return t}var Fa=class extends he{constructor(){super();this.isOpen=!1;this.tiles=[];this.isLoading=!1;this.error=void 0;this.canvasTitle=void 0;this.displayMode="standard";this.runtimeRef=null;this.telemetry=null;this.themeConfig={};this.launcherAnimate=!1;this._notifyPrevState=new Map;this._notifyUnsub=null;this._notifyUnsubMetrics=null;this._notifications=new Ms(this,null,[])}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._syncNotificationsController(),this._startNotifyWatcher()}disconnectedCallback(){super.disconnectedCallback(),this._stopNotifyWatcher()}updated(t){(t.has("runtimeRef")||t.has("tiles"))&&(this._syncNotificationsController(),this._restartNotifyWatcher()),t.has("isOpen")&&this.isOpen&&this._trackTilesViewed()}_syncNotificationsController(){this._notifications.setEventBus(this.runtimeRef?.events??null),this._notifications.setTiles(this.tiles)}_startNotifyWatcher(){let t=this.runtimeRef;if(!t?.events||!t.apps)return;let r=YS(this.tiles,t.apps);if(r.length===0)return;let i=t.state.ns("notified");for(let o of r)if(!this._notifyPrevState.has(o.id)){let a=t.evaluateSync(o.strategy);this._notifyPrevState.set(o.id,a.value),a.value&&!i.has(o.id)&&(i.set(o.id,!0),t.events.publish(o.eventName,o.eventProps))}let s=()=>{for(let o of r){let a=t.evaluateSync(o.strategy),l=this._notifyPrevState.get(o.id)??!1;this._notifyPrevState.set(o.id,a.value),!l&&a.value?(i.set(o.id,!0),t.events.publish(o.eventName,o.eventProps)):l&&!a.value&&i.remove(o.id)}};this._notifyUnsub=t.events.subscribe(s),this._notifyUnsubMetrics=t.sessionMetrics?.subscribe(s)??null}_stopNotifyWatcher(){this._notifyUnsub&&(this._notifyUnsub(),this._notifyUnsub=null),this._notifyUnsubMetrics&&(this._notifyUnsubMetrics(),this._notifyUnsubMetrics=null),this._notifyPrevState.clear()}_restartNotifyWatcher(){this._stopNotifyWatcher(),this._startNotifyWatcher()}_trackTilesViewed(){for(let t of this.tiles)if(this.telemetry?.trackRectangleViewed(t.id,"overlay"),this.runtimeRef){let r=Ps.tileViewed(t.id,"overlay");this.runtimeRef.events.publish(r.name,r.props,r.source)}}_toggle(){let t=!this.isOpen;if(t?this.telemetry?.trackCanvasOpened("overlay"):this.telemetry?.trackCanvasClosed("overlay"),this.runtimeRef){let r=t?Ps.canvasOpened("overlay"):Ps.canvasClosed("overlay");this.runtimeRef.events.publish(r.name,r.props,r.source)}this.dispatchEvent(new CustomEvent("canvas-toggle",{bubbles:!0,composed:!0,detail:{isOpen:t}}))}_handleNotificationClick(t){let r=t.detail?.notification;r&&(this.runtimeRef&&this.runtimeRef.events.publish(Be.NOTIFICATION_CLICKED,{notificationId:r.id,tileId:r.tileId,itemId:r.itemId}),this.isOpen||this._toggle(),this.runtimeRef&&r.tileId&&this.runtimeRef.events.publish(Be.NOTIFICATION_DEEP_LINK,{tileId:r.tileId,itemId:r.itemId}),this._notifications.dismiss(r.id))}_handleNotificationDismiss(t){let r=t.detail?.id;r&&this._notifications.dismiss(r)}_onLauncherToggle(){this._toggle()}_onDrawerClose(){this.isOpen&&this._toggle()}render(){let t=this._notifications.notifications,r=this.themeConfig?.canvas?.position==="left"?"left":"right";return D`
|
|
534
|
+
</div>`);let s=Km(t,e.overlayRoot,{html:i,placement:n.placement??"top",trigger:n.trigger??"immediate",onAction:o=>{if(o==="dismiss"){s.destroy();return}if(o==="cta"&&r.cta)e.publishEvent("action.cta_clicked",{anchorId:n.anchorId,ctaLabel:r.cta.label});else if(r.ctaButtons){let a=r.ctaButtons.find(l=>l.actionId===o);a&&e.publishEvent("action.tooltip_cta_clicked",{anchorId:n.anchorId,actionId:o,label:a.label})}s.destroy()}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:tooltip",anchorId:n.anchorId,trigger:n.trigger??"immediate"}),{cleanup:()=>{s.destroy()}}},MS=[{kind:"overlays:highlight",executor:RS},{kind:"overlays:pulse",executor:TS},{kind:"overlays:badge",executor:IS},{kind:"overlays:tooltip",executor:$S},{kind:"overlays:modal",executor:Gm},{kind:"overlays:tour",executor:zm},{kind:"overlays:celebrate",executor:Um}],ev={id:"adaptive-overlays",version:"1.0.0",name:"Overlays",description:"Tooltips, highlights, badges, modals, celebrations, visual overlays, and workflow tracking",executors:MS,widgets:[{id:"adaptive-overlays:workflow-tracker",component:Qm,metadata:{name:"Workflow Tracker",icon:"\u{1F4CB}",description:"Tracks multi-step workflow progress across tours"}}]};var PS=[om,kc,Rm,Tm,Dm,ev],OS=PS.map(n=>({id:n.id,version:n.version,name:n.name,description:n.description,runtime:{actions:(n.executors||[]).map(({kind:e,executor:t})=>({kind:e,executor:t})),widgets:n.widgets,notifyWatchers:n.notifyWatchers,events:n.eventHandlers},editor:void 0,metadata:{isBuiltIn:!0}}));function tv(n){let e=0;for(let t of OS)n.has(t.id)||(n.register(t),e++);console.log("[Syntro Runtime] Registered",e,"built-in runtime modules (Lit)")}var pr=class extends Event{constructor(e,t,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=r,this.subscribe=i??!1}};var $a=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let r=t||!Object.is(e,this.o);this.o=e,r&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:r}]of this.subscriptions)t(this.o,r)},e!==void 0&&(this.value=e)}addCallback(e,t,r){if(!r)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:i}=this.subscriptions.get(e);e(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var xu=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},pi=class extends $a{constructor(e,t,r){super(t.context!==void 0?t.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[o,{consumerHost:a}]of this.subscriptions)s.has(o)||(s.add(o),a.dispatchEvent(new pr(this.context,a,o,!0)));i.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new xu(this.context,this.host))}};var $e="1.0.0",Ee={UI_CLICK:"ui.click",UI_SCROLL:"ui.scroll",UI_INPUT:"ui.input",UI_CHANGE:"ui.change",UI_SUBMIT:"ui.submit",NAV_PAGE_VIEW:"nav.page_view",NAV_PAGE_LEAVE:"nav.page_leave",UI_HESITATE:"ui.hesitate",UI_RAGE_CLICK:"ui.rage_click",UI_SCROLL_THRASH:"ui.scroll_thrash",UI_FOCUS_BOUNCE:"ui.focus_bounce",UI_IDLE:"ui.idle",UI_HOVER:"ui.hover"},Je={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,Drag:12},Is={MouseUp:0,MouseDown:1,Click:2,ContextMenu:3,DblClick:4,Focus:5,Blur:6,TouchStart:7,TouchEnd:9},wu={hesitationMs:3e3,hesitationRadiusPx:10,rageClickCount:3,rageClickWindowMs:1e3,rageClickRadiusPx:30,scrollThrashReversals:3,scrollThrashWindowMs:2e3,focusBounceMaxInputs:0,idleMs:5e3,hoverSampleMs:100};var Ma=class{constructor(e,t){this.config=e,this.emit=t,this.focused=new Map}ingest(e){if(e.type!==3)return;let t=e.timestamp;if(e.data.source===Je.MouseInteraction){let r=e.data.id??0;if(e.data.type===Is.Focus)this.focused.set(r,{id:r,focusTs:t,inputCount:0});else if(e.data.type===Is.Blur){let i=this.focused.get(r);i&&i.inputCount<=this.config.focusBounceMaxInputs&&this.emit({ts:t,name:Ee.UI_FOCUS_BOUNCE,source:"rrweb",schemaVersion:$e,props:{elementId:r,duration_ms:t-i.focusTs}}),this.focused.delete(r)}}else if(e.data.source===Je.Input){let r=e.data.id??0,i=this.focused.get(r);i&&i.inputCount++}}};var Pa=class{constructor(e,t){this.config=e,this.emit=t,this.anchorX=0,this.anchorY=0,this.anchorTs=0,this.emitted=!1,this.hasPosition=!1}ingest(e){if(e.type!==3||e.data.source!==Je.MouseMove)return;let t=e.data.positions;if(!t||t.length===0)return;let r=t[t.length-1],i=e.timestamp+(r.timeOffset??0);if(!this.hasPosition){this.anchorX=r.x,this.anchorY=r.y,this.anchorTs=i,this.hasPosition=!0,this.emitted=!1;return}let s=r.x-this.anchorX,o=r.y-this.anchorY;Math.sqrt(s*s+o*o)>this.config.hesitationRadiusPx&&(this.anchorX=r.x,this.anchorY=r.y,this.anchorTs=i,this.emitted=!1)}tick(e){if(!this.hasPosition||this.emitted)return;let t=e-this.anchorTs;t>=this.config.hesitationMs&&(this.emit({ts:e,name:Ee.UI_HESITATE,source:"rrweb",schemaVersion:$e,props:{x:this.anchorX,y:this.anchorY,duration_ms:t}}),this.emitted=!0)}};var Oa=class{constructor(e,t,r){this.config=e,this.emit=t,this.elementResolver=r,this.currentElement=null,this.hoverStartTs=null,this.lastX=0,this.lastY=0,this.lastSampleTs=-1/0}ingest(e){if(e.type!==3||e.data.source!==Je.MouseMove)return;let t=e.data.positions;if(!t||t.length===0)return;let r=t[t.length-1];this.lastX=r.x,this.lastY=r.y}tick(e){if(!this.elementResolver||e-this.lastSampleTs<this.config.hoverSampleMs)return;this.lastSampleTs=e;let t=this.elementResolver(this.lastX,this.lastY),r=t?nv(t):null,i=this.currentElement?nv(this.currentElement):null;r!==i&&(this.currentElement&&this.hoverStartTs!==null&&this.emit({ts:e,name:Ee.UI_HOVER,source:"rrweb",schemaVersion:$e,props:{x:this.lastX,y:this.lastY,duration_ms:e-this.hoverStartTs,element:this.currentElement}}),this.currentElement=t,this.hoverStartTs=e)}};function nv(n){return`${n.tag_name??""}|${n.attr__id??""}|${(n.classes??[]).join(",")}`}var Na=class{constructor(e,t){this.config=e,this.emit=t,this.lastActivityTs=null,this.emitted=!1}ingest(e){if(e.type!==3)return;let t=e.data.source;(t===Je.MouseMove||t===Je.MouseInteraction||t===Je.Scroll)&&(this.lastActivityTs=e.timestamp,this.emitted=!1)}tick(e){this.lastActivityTs===null||this.emitted||e-this.lastActivityTs>=this.config.idleMs&&(this.emit({ts:e,name:Ee.UI_IDLE,source:"rrweb",schemaVersion:$e,props:{idle_ms:e-this.lastActivityTs}}),this.emitted=!0)}};var La=class{constructor(e,t){this.config=e,this.emit=t,this.clicks=[]}ingest(e){if(e.type!==3||e.data.source!==Je.MouseInteraction||e.data.type!==Is.Click)return;let t=e.data.x??0,r=e.data.y??0,i=e.timestamp,s=i-this.config.rageClickWindowMs;this.clicks=this.clicks.filter(a=>a.ts>=s),this.clicks.push({ts:i,x:t,y:r});let o=this.clicks.filter(a=>{let l=a.x-t,c=a.y-r;return Math.sqrt(l*l+c*c)<=this.config.rageClickRadiusPx});o.length>=this.config.rageClickCount&&(this.emit({ts:i,name:Ee.UI_RAGE_CLICK,source:"rrweb",schemaVersion:$e,props:{x:t,y:r,clickCount:o.length,duration_ms:i-o[0].ts}}),this.clicks=[])}};var Fa=class{constructor(e,t){this.config=e,this.emit=t,this.lastY=null,this.lastDirection=null,this.reversals=[]}ingest(e){if(e.type!==3||e.data.source!==Je.Scroll)return;let t=e.data.y??0,r=e.timestamp;if(this.lastY!==null){let i=t>this.lastY?"down":t<this.lastY?"up":this.lastDirection;if(i&&i!==this.lastDirection){let s=r-this.config.scrollThrashWindowMs;this.reversals=this.reversals.filter(o=>o>s),this.reversals.push(r),this.reversals.length>=this.config.scrollThrashReversals&&(this.emit({ts:r,name:Ee.UI_SCROLL_THRASH,source:"rrweb",schemaVersion:$e,props:{reversals:this.reversals.length,duration_ms:r-this.reversals[0]}}),this.reversals=[])}this.lastDirection=i}this.lastY=t}};var rv={$click:Ee.UI_CLICK,$scroll:Ee.UI_SCROLL,$input:Ee.UI_INPUT,$change:Ee.UI_CHANGE,$submit:Ee.UI_SUBMIT,$pageview:Ee.NAV_PAGE_VIEW,$pageleave:Ee.NAV_PAGE_LEAVE,$session_start:"session.start",$identify:"user.identify"};function FS(n){let e=n.event;if(typeof e!="string")return"posthog.unknown";if(rv[e])return rv[e];if(e==="$autocapture"){let t=n.properties?.$tag_name,r=n.properties?.$event_type;return r==="submit"?Ee.UI_SUBMIT:r==="change"?Ee.UI_CHANGE:t==="input"||t==="textarea"?Ee.UI_INPUT:Ee.UI_CLICK}return e.startsWith("$")?e.replace("$","posthog."):`posthog.${e}`}var iv=new Set(["a","button","input","select","textarea"]);function DS(n){if(n)return n.split(";").map(e=>{let t={},r=e.indexOf(":"),i=r>=0?e.slice(0,r):e,s=r>=0?e.slice(r+1):"",o=i.indexOf(".");if(o>=0?(t.tag_name=i.slice(0,o),t.attr__class=i.slice(o+1).replace(/\./g," ")):t.tag_name=i,!/^[a-zA-Z][a-zA-Z0-9-]*$/.test(String(t.tag_name??"")))return null;let a=/([\w$]+)="([^"]*)"/g,l;for(;(l=a.exec(s))!==null;){let[,c,u]=l;c==="nth-child"||c==="nth-of-type"||(t[c]=u)}return t.text&&(t.$el_text=t.text,delete t.text),t}).filter(e=>e!==null)}function HS(n,e){if(e&&iv.has(e)||!n)return e;for(let t of n){let r=t.tag_name;if(r&&iv.has(r))return r}return e}function BS(n){let e={},t=n.properties||{},r=t.$elements??(typeof t.$elements_chain=="string"?DS(t.$elements_chain):void 0),i=t.$tag_name??r?.[0]?.tag_name,s=n.event==="$autocapture"||n.event==="$click";return e.tagName=s?HS(r,i):i,t.$el_text&&(e.elementText=t.$el_text),r&&(e.elements=r),s&&!r&&console.warn(`[PostHogNormalizer] $autocapture click has no element chain. PostHog may have changed wire format. Properties: $elements=${!!t.$elements}, $elements_chain=${typeof t.$elements_chain}`),t.$current_url&&(e.url=t.$current_url),t.$pathname&&(e.pathname=t.$pathname),t.$host&&(e.host=t.$host),t.$viewport_width&&(e.viewportWidth=t.$viewport_width),t.$viewport_height&&(e.viewportHeight=t.$viewport_height),t.$session_id&&(e.sessionId=t.$session_id),t.$scroll_depth&&(e.scrollDepth=t.$scroll_depth),t.$scroll_percentage&&(e.scrollPercentage=t.$scroll_percentage),e.originalEvent=n.event,e}function $s(n){let e;return typeof n.timestamp=="number"?e=n.timestamp:typeof n.timestamp=="string"?e=new Date(n.timestamp).getTime():e=Date.now(),{ts:e,name:FS(n),source:"posthog",props:BS(n),schemaVersion:$e}}function Ms(n){let e=n.event;return!(typeof e!="string"||["$feature_flag_called","$feature_flags","$groups","$groupidentify","$set","$set_once","$unset","$create_alias","$capture_metrics","$performance_event","$web_vitals","$exception","$dead_click","$heatmap"].includes(e))}function sv(n){return(e,t)=>{if(typeof e!="string")return;let r={event:e,properties:t,timestamp:Date.now()};if(Ms(r)){let i=$s(r);n(i)}}}function ku(n){let e={...wu,...n?.config},t=[];function r(d){for(let h of t)h(d)}let i=new Pa(e,r),s=new La(e,r),o=new Fa(e,r),a=new Ma(e,r),l=new Na(e,r),c=new Oa(e,r,n?.elementResolver),u=[];return{ingest(d){if(d.kind==="posthog"){let{kind:h,...g}=d;Ms(g)&&r($s(g))}else d.kind==="rrweb"&&(i.ingest(d),s.ingest(d),o.ingest(d),a.ingest(d),l.ingest(d),c.ingest(d))},onEvent(d){t.push(d)},tick(d){i.tick(d),l.tick(d),c.tick(d)},enrichClickAttributes(d,h){u.push({ts:d,elements:h});let g=d-500;for(;u.length>0&&u[0].ts<g;)u.shift()}}}var We={UI_CLICK:"ui.click",UI_SCROLL:"ui.scroll",UI_INPUT:"ui.input",UI_CHANGE:"ui.change",UI_SUBMIT:"ui.submit",NAV_PAGE_VIEW:"nav.page_view",NAV_PAGE_LEAVE:"nav.page_leave",CANVAS_OPENED:"canvas.opened",CANVAS_CLOSED:"canvas.closed",TILE_VIEWED:"tile.viewed",TILE_EXPANDED:"tile.expanded",TILE_COLLAPSED:"tile.collapsed",TILE_ACTION:"tile.action",OVERLAY_STARTED:"overlay.started",OVERLAY_COMPLETED:"overlay.completed",OVERLAY_DISMISSED:"overlay.dismissed",OVERLAY_STEP_VIEWED:"overlay.step_viewed",BEHAVIOR_RAGE_CLICK:"behavior.rage_click",BEHAVIOR_HESITATION:"behavior.hesitation",BEHAVIOR_CONFUSION:"behavior.confusion",ACTION_APPLIED:"action.applied",ACTION_REVERTED:"action.reverted",ACTION_FAILED:"action.failed",ACTION_CTA_CLICKED:"action.cta_clicked",NOTIFICATION_SHOWN:"notification.shown",NOTIFICATION_CLICKED:"notification.clicked",NOTIFICATION_DISMISSED:"notification.dismissed",NOTIFICATION_DEEP_LINK:"notification.deep_link",SURFACE_MOUNTED:"surface.mounted",SURFACE_UNMOUNTED:"surface.unmounted"};var Su=3;var Eu=3e4;var WS=0;function Cu(n,e){return n.replace(/\{\{props\.(\w+)\}\}/g,(t,r)=>!e||!(r in e)?t:String(e[r]))}function jS(n,e){if(n===e)return!0;try{return new RegExp(e).test(n)}catch{return!1}}function ov(n,e){for(let t of e){let r=t.notifications;if(!(!r||r.length===0))for(let i of r){if(!jS(n.name,i.on))continue;let s=Date.now(),o=i.ttl??8e3;return{notification:{id:`notif-${++WS}-${s}`,title:Cu(i.title,n.props),body:i.body?Cu(i.body,n.props):void 0,icon:i.icon,tileId:t.id,itemId:i.deepLink?.itemId?Cu(i.deepLink.itemId,n.props):void 0,expiresAt:s+o,createdAt:s,ttl:o},rule:i}}}return null}var Ps=class{constructor(e,t,r){this._notifications=[];this._cooldownMap=new Map;this._timerIds=new Map;this._unsubscribe=null;this.host=e,this.eventBus=t,this.tiles=r,e.addController(this)}get notifications(){return this._notifications}setTiles(e){this.tiles=e}setEventBus(e){this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=null),this.eventBus=e,this.eventBus&&this.hostConnected()}hostConnected(){this.eventBus&&(this._unsubscribe=this.eventBus.subscribe(e=>{let t=ov(e,this.tiles);if(!t)return;let{notification:r,rule:i}=t,s=r.itemId?`${r.tileId}:${e.name}:${r.itemId}`:`${r.tileId}:${e.name}`,o=this._cooldownMap.get(s),a=Date.now(),l=i.cooldown??3e4;if(o!==void 0&&a-o<l||(this._cooldownMap.set(s,a),r.itemId&&this._notifications.some(d=>d.tileId===r.tileId&&d.itemId===r.itemId)))return;let c=[...this._notifications,r];if(c.length>3){let u=c.shift(),d=this._timerIds.get(u.id);d&&(clearTimeout(d),this._timerIds.delete(u.id))}this._notifications=c,this.host.requestUpdate(),this.eventBus.publish(We.NOTIFICATION_SHOWN,{notificationId:r.id,tileId:r.tileId,itemId:r.itemId,title:r.title}),this._scheduleDismiss(r)}))}hostDisconnected(){this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=null);for(let e of this._timerIds.values())clearTimeout(e);this._timerIds.clear()}dismiss(e){let t=this._notifications.find(i=>i.id===e);t&&this._publishDismissed(t),this._notifications=this._notifications.filter(i=>i.id!==e);let r=this._timerIds.get(e);r&&(clearTimeout(r),this._timerIds.delete(e)),this.host.requestUpdate()}_publishDismissed(e){this.eventBus?.publish(We.NOTIFICATION_DISMISSED,{notificationId:e.id,tileId:e.tileId,itemId:e.itemId})}_scheduleDismiss(e){let t=setTimeout(()=>{this._notifications=this._notifications.filter(r=>r.id!==e.id),this._timerIds.delete(e.id),this._publishDismissed(e),this.host.requestUpdate()},e.ttl);this._timerIds.set(e.id,t)}};function Ot(n,e){return{ts:Date.now(),name:n,source:"canvas",props:e,schemaVersion:$e}}function US(n){return Ot(We.CANVAS_OPENED,{surface:n})}function zS(n){return Ot(We.CANVAS_CLOSED,{surface:n})}function qS(n,e){return Ot(We.TILE_VIEWED,{tileId:n,surface:e})}function ZS(n,e){return Ot(We.TILE_EXPANDED,{tileId:n,surface:e})}function GS(n,e){return Ot(We.TILE_COLLAPSED,{tileId:n,surface:e})}function KS(n,e,t){return Ot(We.TILE_ACTION,{tileId:n,actionId:e,surface:t})}function YS(n,e){return Ot(We.OVERLAY_STARTED,{recipeId:n,recipeName:e})}function XS(n,e){return Ot(We.OVERLAY_COMPLETED,{recipeId:n,recipeName:e})}function JS(n,e,t){return Ot(We.OVERLAY_DISMISSED,{recipeId:n,recipeName:e,stepIndex:t})}function QS(n,e,t){return Ot(We.OVERLAY_STEP_VIEWED,{recipeId:n,stepIndex:e,stepTitle:t})}function eE(n,e){let t=n.startsWith("canvas.")?n:`canvas.${n}`;return Ot(t,e)}var Os={canvasOpened:US,canvasClosed:zS,tileViewed:qS,tileExpanded:ZS,tileCollapsed:GS,tileAction:KS,overlayStarted:YS,overlayCompleted:XS,overlayDismissed:JS,overlayStepViewed:QS,custom:eE};function tE(n,e){let t=[];for(let r of n){let i=r.widget.split(":")[0],o=e.get(i)?.manifest.runtime?.notifyWatchers;o&&t.push(...o(r.props??{}))}return t}var Da=class extends ge{constructor(){super();this.isOpen=!1;this.tiles=[];this.isLoading=!1;this.error=void 0;this.canvasTitle=void 0;this.displayMode="standard";this.runtimeRef=null;this.telemetry=null;this.themeConfig={};this.launcherAnimate=!1;this._notifyPrevState=new Map;this._notifyUnsub=null;this._notifyUnsubMetrics=null;this._notifications=new Ps(this,null,[])}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._syncNotificationsController(),this._startNotifyWatcher()}disconnectedCallback(){super.disconnectedCallback(),this._stopNotifyWatcher()}updated(t){(t.has("runtimeRef")||t.has("tiles"))&&(this._syncNotificationsController(),this._restartNotifyWatcher()),t.has("isOpen")&&this.isOpen&&this._trackTilesViewed()}_syncNotificationsController(){this._notifications.setEventBus(this.runtimeRef?.events??null),this._notifications.setTiles(this.tiles)}_startNotifyWatcher(){let t=this.runtimeRef;if(!t?.events||!t.apps)return;let r=tE(this.tiles,t.apps);if(r.length===0)return;let i=t.state.ns("notified");for(let o of r)if(!this._notifyPrevState.has(o.id)){let a=t.evaluateSync(o.strategy);this._notifyPrevState.set(o.id,a.value),a.value&&!i.has(o.id)&&(i.set(o.id,!0),t.events.publish(o.eventName,o.eventProps))}let s=()=>{for(let o of r){let a=t.evaluateSync(o.strategy),l=this._notifyPrevState.get(o.id)??!1;this._notifyPrevState.set(o.id,a.value),!l&&a.value?(i.set(o.id,!0),t.events.publish(o.eventName,o.eventProps)):l&&!a.value&&i.remove(o.id)}};this._notifyUnsub=t.events.subscribe(s),this._notifyUnsubMetrics=t.sessionMetrics?.subscribe(s)??null}_stopNotifyWatcher(){this._notifyUnsub&&(this._notifyUnsub(),this._notifyUnsub=null),this._notifyUnsubMetrics&&(this._notifyUnsubMetrics(),this._notifyUnsubMetrics=null),this._notifyPrevState.clear()}_restartNotifyWatcher(){this._stopNotifyWatcher(),this._startNotifyWatcher()}_trackTilesViewed(){for(let t of this.tiles)if(this.telemetry?.trackRectangleViewed(t.id,"overlay"),this.runtimeRef){let r=Os.tileViewed(t.id,"overlay");this.runtimeRef.events.publish(r.name,r.props,r.source)}}_toggle(){let t=!this.isOpen;if(t?this.telemetry?.trackCanvasOpened("overlay"):this.telemetry?.trackCanvasClosed("overlay"),this.runtimeRef){let r=t?Os.canvasOpened("overlay"):Os.canvasClosed("overlay");this.runtimeRef.events.publish(r.name,r.props,r.source)}this.dispatchEvent(new CustomEvent("canvas-toggle",{bubbles:!0,composed:!0,detail:{isOpen:t}}))}_handleNotificationClick(t){let r=t.detail?.notification;r&&(this.runtimeRef&&this.runtimeRef.events.publish(We.NOTIFICATION_CLICKED,{notificationId:r.id,tileId:r.tileId,itemId:r.itemId}),this.isOpen||this._toggle(),this.runtimeRef&&r.tileId&&this.runtimeRef.events.publish(We.NOTIFICATION_DEEP_LINK,{tileId:r.tileId,itemId:r.itemId}),this._notifications.dismiss(r.id))}_handleNotificationDismiss(t){let r=t.detail?.id;r&&this._notifications.dismiss(r)}_onLauncherToggle(){this._toggle()}_onDrawerClose(){this.isOpen&&this._toggle()}render(){let t=this._notifications.notifications,r=this.themeConfig?.canvas?.position==="left"?"left":"right";return D`
|
|
535
535
|
<div data-shadow-canvas-id="overlay-launcher" style="position:fixed;inset:0;pointer-events:none;z-index:2147483647">
|
|
536
536
|
${t.length>0?D`<syntro-toast-stack
|
|
537
537
|
data-testid="notification-toast-stack"
|
|
@@ -539,7 +539,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
539
539
|
.position=${r}
|
|
540
540
|
@notification-click=${this._handleNotificationClick}
|
|
541
541
|
@notification-dismiss=${this._handleNotificationDismiss}
|
|
542
|
-
></syntro-toast-stack>`:
|
|
542
|
+
></syntro-toast-stack>`:J}
|
|
543
543
|
<syntro-launcher
|
|
544
544
|
.isOpen=${this.isOpen}
|
|
545
545
|
.notifications=${t}
|
|
@@ -561,10 +561,10 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
561
561
|
.themeConfig=${this.themeConfig}
|
|
562
562
|
@drawer-close=${this._onDrawerClose}
|
|
563
563
|
></syntro-drawer>
|
|
564
|
-
`}};Fa.properties={isOpen:{type:Boolean},tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},canvasTitle:{type:String},displayMode:{type:String},runtimeRef:{attribute:!1},telemetry:{attribute:!1},themeConfig:{attribute:!1},launcherAnimate:{type:Boolean}};customElements.define("syntro-canvas-overlay",Fa);function Da(n,e,t="merge"){return t==="first-match"?XS(n,e):QS(n,e)}function XS(n,e){for(let t of e){let r=n.getFeatureValue?.(t,null);if(!r||typeof r!="object")continue;let i=r,s=i.tiles&&i.tiles.length>0,o=i.actions&&i.actions.length>0;if(s||o)return nv([i])}return null}function QS(n,e){let t=[];for(let r of e){let i=n.getFeatureValue?.(r,null);if(!i||typeof i!="object")continue;let s=i,o=s.tiles&&s.tiles.length>0,a=s.actions&&s.actions.length>0;(o||a)&&t.push(s)}return t.length===0?null:nv(t)}function nv(n){let e=[],t=[],r,i,s,o,a,l,c;for(let u of n)u.tiles&&e.push(...u.tiles),u.actions&&t.push(...u.actions),r??(r=u.fetchedAt),i??(i=u.schemaVersion),s??(s=u.configVersion),o??(o=u.canvasTitle),a??(a=u.theme),l??(l=u.launcher),c??(c=u.meta);return{tiles:e,actions:t,fetchedAt:r??new Date().toISOString(),...i&&{schemaVersion:i},...s&&{configVersion:s},...o&&{canvasTitle:o},...a&&{theme:a},...l&&{launcher:l},...c&&{meta:c}}}var ku=!1;function rv(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function Su(n){if(rv()){ku=!0;return}ku=n??!1}function JS(){return rv()?!0:ku}function X(n,e,t){JS()&&(t!==void 0?console.log(`[${n}]`,e,t):console.log(`[${n}]`,e))}function ct(n,e,t){t!==void 0?console.warn(`[${n}]`,e,t):console.warn(`[${n}]`,e)}function Ha(n,e,t){t!==void 0?console.error(`[${n}]`,e,t):console.error(`[${n}]`,e)}var Eu="2.15.0";var En="2.0";var eE=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function tE(n){try{let e=new URL(n),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(console.warn("[SmartCanvas] Config URI must use HTTPS:",n),!1):eE.some(i=>e.hostname===i)?!0:(console.warn("[SmartCanvas] Config URI host not in allowlist:",e.hostname),!1)}catch{return console.warn("[SmartCanvas] Invalid config URI:",n),!1}}function nE(n){if(typeof window>"u")return!1;try{return new URL(n).origin===window.location.origin}catch{return!1}}var iv="syntro_config_cache",rE=1440*60*1e3;function sv(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function iE(n,e){if(sv())try{let t={config:n,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(iv,JSON.stringify(t))}catch{}}function sE(n){if(!sv())return null;try{let e=localStorage.getItem(iv);if(!e)return null;let t=JSON.parse(e);return!t.config||typeof t.timestamp!="number"||!t.sdkVersion||t.sdkVersion!==n||Date.now()-t.timestamp>rE?null:t.config}catch{return null}}var Cu=({configUri:n,experiments:e,featureKey:t})=>{if(n)return n;if(e&&t){let r=e.getFeatureValue?.(t,null);if(r)return r}};function oE(n,e,t){if(e){let r=n.getFeatureValue?.(e,null);if(r&&typeof r=="object"){let i=r.variant_flags;if(i&&i.length>0)return i}}if(n.getAllFeatures){let r=n.getAllFeatures();return t?Object.keys(r).filter(i=>i.startsWith(t)):Object.keys(r)}return[]}var hi=({configUri:n,experiments:e,featureKey:t,credentials:r,configFeatureKey:i,manifestKey:s,variantFlagPrefix:o,sdkVersion:a})=>async()=>{if(e&&i){let u=e.getFeatureValue?.(i,null);if(u&&typeof u=="object")return X("SmartCanvas Config","Resolved config directly from feature flag",u),u}if(e&&(s||o||e.getAllFeatures)){let u=oE(e,s,o);if(u.length>0){let d=Da(e,u);if(d)return X("SmartCanvas Config","Resolved config from variant flags",d),d}}let l=Cu({configUri:n,experiments:e,featureKey:t});if(!l)return X("SmartCanvas Config","No config available \u2014 returning empty config"),{tiles:[],actions:[],fetchedAt:new Date().toISOString()};if(!tE(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=r??(nE(l)?"include":"omit");try{let u=await fetch(l,{credentials:c,headers:{"X-SDK-Version":Eu,"X-SDK-Schema-Version":En}});if(!u.ok)throw new Error(`SmartCanvas: failed to fetch config (${u.status})`);let d=await u.json();return X("SmartCanvas Config","Fetched config from URI",d),a&&iE(d,a),d}catch(u){if(a){let d=sE(a);if(d)return X("SmartCanvas Config","Serving config from offline cache"),d}throw u}};var Au=class{constructor(e){this.listeners=new Set;let t=e?.open??!1;if(e?.open===void 0)try{let r=sessionStorage?.getItem("syntro:editor:panel-open");r!==null&&(t=JSON.parse(r))}catch{}this.state={open:t}}getState(){return this.state}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOpen(e){if(this.state.open!==e){this.state={...this.state,open:e};try{sessionStorage?.setItem("syntro:editor:panel-open",JSON.stringify(e))}catch{}this.emit()}}toggle(){this.setOpen(!this.state.open)}emit(){for(let e of this.listeners)e(this.state)}},ov=n=>new Au(n);function se(n,e){return`${n}${Math.round(e*255).toString(16).padStart(2,"0")}`}var YP={colorPrimary:ie[3],colorPrimaryHover:ie[4],colorPrimaryMuted:ie[0],colorBackground:se(S[1],.95),colorBackgroundElevated:se(S[3],.95),colorBackgroundSubtle:se(S[0],.2),colorSurface:se(S[4],.8),colorSurfaceHover:se(S[5],.8),colorText:ot.primary,colorTextSecondary:ot.secondary,colorTextMuted:ot.tertiary,colorTextInverse:S[1],colorBorder:kc.primary,colorBorderSubtle:kc.secondary,colorSuccess:ye[4],colorSuccessMuted:ye[0],colorWarning:De[4],colorWarningMuted:De[0],colorError:Ae[4],colorErrorMuted:Ae[0],colorInfo:qe[4],colorInfoMuted:qe[0],colorNotification:ie[4],colorNotificationMuted:se(ie[4],.4),glassBackground:se(S[1],.6),glassBackgroundHover:se(S[1],.7),glassBorder:"rgba(255, 255, 255, 0.08)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.2)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.3)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.4)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.5)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"},XP={colorPrimary:ie[3],colorPrimaryHover:ie[2],colorPrimaryMuted:se(ie[5],.1),colorBackground:se(S[12],.95),colorBackgroundElevated:se(S[11],.95),colorBackgroundSubtle:se(S[0],.02),colorSurface:se(S[11],.6),colorSurfaceHover:se(S[10],.6),colorText:S[1],colorTextSecondary:S[6],colorTextMuted:S[8],colorTextInverse:S[12],colorBorder:se(S[0],.12),colorBorderSubtle:se(S[0],.06),colorSuccess:ye[4],colorSuccessMuted:se(ye[4],.12),colorWarning:De[4],colorWarningMuted:se(De[4],.12),colorError:Ae[4],colorErrorMuted:se(Ae[4],.12),colorInfo:qe[4],colorInfoMuted:se(qe[4],.12),colorNotification:ie[3],colorNotificationMuted:se(ie[3],.4),glassBackground:se(S[12],.7),glassBackgroundHover:se(S[12],.8),glassBorder:"rgba(0, 0, 0, 0.06)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.08)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.12)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.16)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.2)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"};function aE(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var av={mode:"dark",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:ie[3],colorPrimaryHover:ie[4],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:se(S[1],.6),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%"},launcher:{background:Yo.primary.backgroundDefault,backgroundHover:Yo.primary.backgroundHover,color:Yo.primary.icon,size:"56px",shadow:`0 8px 32px ${se(S[0],.6)}`,borderRadius:"9999px"},tile:{background:se(S[1],.6),backgroundHover:se(S[1],.7),border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.3)",titleColor:ot.primary,textColor:ot.secondary,iconBackground:`linear-gradient(135deg, ${ie[3]} 0%, ${ie[3]}cc 100%)`,iconShadow:`0 2px 8px ${ie[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:se(S[1],.6),textColor:ot.primary,titleColor:ot.primary,arrowColor:se(S[1],.6),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${ie[3]}`},notification:{background:se(S[0],.95),textColor:ot.primary,textSecondaryColor:ot.secondary,border:`1px solid ${S[5]}`,borderRadius:"12px",successColor:ye[4],warningColor:De[4],errorColor:Ae[4],iconBackground:se(ie[3],.15),progressGradient:`linear-gradient(90deg, ${ie[3]}, ${ie[4]})`},content:{background:se(S[3],.8),backgroundHover:se(S[5],.6),border:`1px solid ${se(S[5],.5)}`,borderRadius:"8px",textColor:ot.primary,textSecondaryColor:ot.secondary,itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:se(S[3],.8),searchColor:ot.primary,chevronColor:"currentColor"}},lv={mode:"light",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:ie[3],colorPrimaryHover:ie[2],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:se(S[12],.7),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%"},launcher:{background:ie[3],backgroundHover:ie[2],color:"#ffffff",size:"56px",shadow:"0 8px 32px rgba(0, 0, 0, 0.15)",borderRadius:"9999px"},tile:{background:se(S[12],.7),backgroundHover:se(S[12],.8),border:"1px solid rgba(0, 0, 0, 0.06)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.12)",titleColor:S[1],textColor:S[6],iconBackground:`linear-gradient(135deg, ${ie[3]} 0%, ${ie[3]}cc 100%)`,iconShadow:`0 2px 8px ${ie[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:se(S[12],.7),textColor:S[1],titleColor:S[1],arrowColor:se(S[12],.7),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${ie[3]}`},notification:{background:se(S[12],.95),textColor:S[1],textSecondaryColor:S[6],border:`1px solid ${se(S[0],.12)}`,borderRadius:"12px",successColor:ye[4],warningColor:De[4],errorColor:Ae[4],iconBackground:se(ie[3],.1),progressGradient:`linear-gradient(90deg, ${ie[3]}, ${ie[2]})`},content:{background:se(S[12],.8),backgroundHover:se(S[11],.6),border:`1px solid ${S[11]}`,borderRadius:"8px",textColor:S[1],textSecondaryColor:S[6],itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:S[12],searchColor:S[1],chevronColor:"currentColor"}};function cv(n){let e=n.mode==="light"?lv:av;return{mode:n.mode??e.mode,fontFamily:n.fontFamily??e.fontFamily,colorPrimary:n.colorPrimary??e.colorPrimary,colorPrimaryHover:n.colorPrimaryHover??e.colorPrimaryHover,borderRadius:n.borderRadius??e.borderRadius,canvas:{...e.canvas,...n.canvas},launcher:{...e.launcher,...n.launcher},tile:{...e.tile,...n.tile},overlay:{...e.overlay,...n.overlay},notification:{...e.notification,...n.notification},content:{...e.content,...n.content}}}function uv(n,e){let t=e.mode??n.mode??"dark",r=t==="light"?lv:av;return{mode:t,fontFamily:e.fontFamily??n.fontFamily??r.fontFamily,colorPrimary:e.colorPrimary??n.colorPrimary??r.colorPrimary,colorPrimaryHover:e.colorPrimaryHover??n.colorPrimaryHover??r.colorPrimaryHover,borderRadius:e.borderRadius??n.borderRadius??r.borderRadius,canvas:{...r.canvas,...n.canvas,...e.canvas},launcher:{...r.launcher,...n.launcher,...e.launcher},tile:{...r.tile,...n.tile,...e.tile},overlay:{...r.overlay,...n.overlay,...e.overlay},notification:{...r.notification,...n.notification,...e.notification},content:{...r.content,...n.content,...e.content}}}var lE=["canvas","launcher","tile","overlay","notification","content"];function dv(n){let e={};n.fontFamily&&(e["--sc-font-family"]=n.fontFamily),n.colorPrimary&&(e["--sc-color-primary"]=n.colorPrimary),n.colorPrimaryHover&&(e["--sc-color-primary-hover"]=n.colorPrimaryHover),n.borderRadius&&(e["--sc-border-radius"]=n.borderRadius);for(let t of lE){let r=n[t];if(r)for(let[i,s]of Object.entries(r))s!==void 0&&(e[`--sc-${t}-${aE(i)}`]=s)}return e}var Cn,hr,fr,Jt,en,Ru,Ba,Os=class{constructor(e,t,r){ee(this,en);ee(this,Cn);ee(this,hr);ee(this,fr);ee(this,Jt);K(this,Cn,e),K(this,hr,t??{}),K(this,fr,r),K(this,Jt,te(this,en,Ru).call(this)),e.addController(this)}get config(){return $(this,Jt).config}get mode(){return $(this,Jt).mode}get cssVariables(){return $(this,Jt).cssVariables}hostConnected(){te(this,en,Ba).call(this)}hostDisconnected(){}hostUpdated(){te(this,en,Ba).call(this)}setThemeConfig(e,t){K(this,hr,e),K(this,fr,t),K(this,Jt,te(this,en,Ru).call(this)),te(this,en,Ba).call(this),$(this,Cn).requestUpdate()}};Cn=new WeakMap,hr=new WeakMap,fr=new WeakMap,Jt=new WeakMap,en=new WeakSet,Ru=function(){let e=$(this,fr)?uv($(this,fr),$(this,hr)):cv($(this,hr)),t=dv(e);return{config:e,mode:e.mode,cssVariables:t}},Ba=function(){let e=$(this,Cn).shadowRoot??("renderRoot"in $(this,Cn)?$(this,Cn).renderRoot:null);if(!e||!(e instanceof ShadowRoot))return;let t=e.querySelector("#sc-theme-vars");t||(t=document.createElement("style"),t.id="sc-theme-vars",e.insertBefore(t,e.firstChild));let r=Object.entries($(this,Jt).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
|
|
564
|
+
`}};Da.properties={isOpen:{type:Boolean},tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},canvasTitle:{type:String},displayMode:{type:String},runtimeRef:{attribute:!1},telemetry:{attribute:!1},themeConfig:{attribute:!1},launcherAnimate:{type:Boolean}};customElements.define("syntro-canvas-overlay",Da);function Ha(n,e,t="merge"){return t==="first-match"?nE(n,e):rE(n,e)}function nE(n,e){for(let t of e){let r=n.getFeatureValue?.(t,null);if(!r||typeof r!="object")continue;let i=r,s=i.tiles&&i.tiles.length>0,o=i.actions&&i.actions.length>0;if(s||o)return av([i])}return null}function rE(n,e){let t=[];for(let r of e){let i=n.getFeatureValue?.(r,null);if(!i||typeof i!="object")continue;let s=i,o=s.tiles&&s.tiles.length>0,a=s.actions&&s.actions.length>0;(o||a)&&t.push(s)}return t.length===0?null:av(t)}function av(n){let e=[],t=[],r,i,s,o,a,l,c;for(let u of n)u.tiles&&e.push(...u.tiles),u.actions&&t.push(...u.actions),r??(r=u.fetchedAt),i??(i=u.schemaVersion),s??(s=u.configVersion),o??(o=u.canvasTitle),a??(a=u.theme),l??(l=u.launcher),c??(c=u.meta);return{tiles:e,actions:t,fetchedAt:r??new Date().toISOString(),...i&&{schemaVersion:i},...s&&{configVersion:s},...o&&{canvasTitle:o},...a&&{theme:a},...l&&{launcher:l},...c&&{meta:c}}}var Au=!1;function lv(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function Ru(n){if(lv()){Au=!0;return}Au=n??!1}function iE(){return lv()?!0:Au}function K(n,e,t){iE()&&(t!==void 0?console.log(`[${n}]`,e,t):console.log(`[${n}]`,e))}function Qe(n,e,t){t!==void 0?console.warn(`[${n}]`,e,t):console.warn(`[${n}]`,e)}function Ba(n,e,t){t!==void 0?console.error(`[${n}]`,e,t):console.error(`[${n}]`,e)}var Tu="2.16.0";var En="2.0";var sE=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function oE(n){try{let e=new URL(n),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(console.warn("[SmartCanvas] Config URI must use HTTPS:",n),!1):sE.some(i=>e.hostname===i)?!0:(console.warn("[SmartCanvas] Config URI host not in allowlist:",e.hostname),!1)}catch{return console.warn("[SmartCanvas] Invalid config URI:",n),!1}}function aE(n){if(typeof window>"u")return!1;try{return new URL(n).origin===window.location.origin}catch{return!1}}var cv="syntro_config_cache",lE=1440*60*1e3;function uv(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function cE(n,e){if(uv())try{let t={config:n,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(cv,JSON.stringify(t))}catch{}}function uE(n){if(!uv())return null;try{let e=localStorage.getItem(cv);if(!e)return null;let t=JSON.parse(e);return!t.config||typeof t.timestamp!="number"||!t.sdkVersion||t.sdkVersion!==n||Date.now()-t.timestamp>lE?null:t.config}catch{return null}}var Iu=({configUri:n,experiments:e,featureKey:t})=>{if(n)return n;if(e&&t){let r=e.getFeatureValue?.(t,null);if(r)return r}};function dE(n,e,t){if(e){let r=n.getFeatureValue?.(e,null);if(r&&typeof r=="object"){let i=r.variant_flags;if(i&&i.length>0)return i}}if(n.getAllFeatures){let r=n.getAllFeatures();return t?Object.keys(r).filter(i=>i.startsWith(t)):Object.keys(r)}return[]}var hi=({configUri:n,experiments:e,featureKey:t,credentials:r,configFeatureKey:i,manifestKey:s,variantFlagPrefix:o,sdkVersion:a})=>async()=>{if(e&&i){let u=e.getFeatureValue?.(i,null);if(u&&typeof u=="object")return K("SmartCanvas Config","Resolved config directly from feature flag",u),u}if(e&&(s||o||e.getAllFeatures)){let u=dE(e,s,o);if(u.length>0){let d=Ha(e,u);if(d)return K("SmartCanvas Config","Resolved config from variant flags",d),d}}let l=Iu({configUri:n,experiments:e,featureKey:t});if(!l)return K("SmartCanvas Config","No config available \u2014 returning empty config"),{tiles:[],actions:[],fetchedAt:new Date().toISOString()};if(!oE(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=r??(aE(l)?"include":"omit");try{let u=await fetch(l,{credentials:c,headers:{"X-SDK-Version":Tu,"X-SDK-Schema-Version":En}});if(!u.ok)throw new Error(`SmartCanvas: failed to fetch config (${u.status})`);let d=await u.json();return K("SmartCanvas Config","Fetched config from URI",d),a&&cE(d,a),d}catch(u){if(a){let d=uE(a);if(d)return K("SmartCanvas Config","Serving config from offline cache"),d}throw u}};var $u=class{constructor(e){this.listeners=new Set;let t=e?.open??!1;if(e?.open===void 0)try{let r=sessionStorage?.getItem("syntro:editor:panel-open");r!==null&&(t=JSON.parse(r))}catch{}this.state={open:t}}getState(){return this.state}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOpen(e){if(this.state.open!==e){this.state={...this.state,open:e};try{sessionStorage?.setItem("syntro:editor:panel-open",JSON.stringify(e))}catch{}this.emit()}}toggle(){this.setOpen(!this.state.open)}emit(){for(let e of this.listeners)e(this.state)}},dv=n=>new $u(n);function se(n,e){return`${n}${Math.round(e*255).toString(16).padStart(2,"0")}`}var iO={colorPrimary:ie[3],colorPrimaryHover:ie[4],colorPrimaryMuted:ie[0],colorBackground:se(S[1],.95),colorBackgroundElevated:se(S[3],.95),colorBackgroundSubtle:se(S[0],.2),colorSurface:se(S[4],.8),colorSurfaceHover:se(S[5],.8),colorText:at.primary,colorTextSecondary:at.secondary,colorTextMuted:at.tertiary,colorTextInverse:S[1],colorBorder:Ac.primary,colorBorderSubtle:Ac.secondary,colorSuccess:be[4],colorSuccessMuted:be[0],colorWarning:Be[4],colorWarningMuted:Be[0],colorError:Te[4],colorErrorMuted:Te[0],colorInfo:Ze[4],colorInfoMuted:Ze[0],colorNotification:ie[4],colorNotificationMuted:se(ie[4],.4),glassBackground:se(S[1],.6),glassBackgroundHover:se(S[1],.7),glassBorder:"rgba(255, 255, 255, 0.08)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.2)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.3)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.4)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.5)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"},sO={colorPrimary:ie[3],colorPrimaryHover:ie[2],colorPrimaryMuted:se(ie[5],.1),colorBackground:se(S[12],.95),colorBackgroundElevated:se(S[11],.95),colorBackgroundSubtle:se(S[0],.02),colorSurface:se(S[11],.6),colorSurfaceHover:se(S[10],.6),colorText:S[1],colorTextSecondary:S[6],colorTextMuted:S[8],colorTextInverse:S[12],colorBorder:se(S[0],.12),colorBorderSubtle:se(S[0],.06),colorSuccess:be[4],colorSuccessMuted:se(be[4],.12),colorWarning:Be[4],colorWarningMuted:se(Be[4],.12),colorError:Te[4],colorErrorMuted:se(Te[4],.12),colorInfo:Ze[4],colorInfoMuted:se(Ze[4],.12),colorNotification:ie[3],colorNotificationMuted:se(ie[3],.4),glassBackground:se(S[12],.7),glassBackgroundHover:se(S[12],.8),glassBorder:"rgba(0, 0, 0, 0.06)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.08)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.12)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.16)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.2)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"};function pE(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var pv={mode:"dark",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:ie[3],colorPrimaryHover:ie[4],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:se(S[1],.6),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%"},launcher:{background:Xo.primary.backgroundDefault,backgroundHover:Xo.primary.backgroundHover,color:Xo.primary.icon,size:"56px",shadow:`0 8px 32px ${se(S[0],.6)}`,borderRadius:"9999px"},tile:{background:se(S[1],.6),backgroundHover:se(S[1],.7),border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.3)",titleColor:at.primary,textColor:at.secondary,iconBackground:`linear-gradient(135deg, ${ie[3]} 0%, ${ie[3]}cc 100%)`,iconShadow:`0 2px 8px ${ie[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:se(S[1],.6),textColor:at.primary,titleColor:at.primary,arrowColor:se(S[1],.6),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${ie[3]}`},notification:{background:se(S[0],.95),textColor:at.primary,textSecondaryColor:at.secondary,border:`1px solid ${S[5]}`,borderRadius:"12px",successColor:be[4],warningColor:Be[4],errorColor:Te[4],iconBackground:se(ie[3],.15),progressGradient:`linear-gradient(90deg, ${ie[3]}, ${ie[4]})`},content:{background:se(S[3],.8),backgroundHover:se(S[5],.6),border:`1px solid ${se(S[5],.5)}`,borderRadius:"8px",textColor:at.primary,textSecondaryColor:at.secondary,itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:se(S[3],.8),searchColor:at.primary,chevronColor:"currentColor"}},hv={mode:"light",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:ie[3],colorPrimaryHover:ie[2],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:se(S[12],.7),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%"},launcher:{background:ie[3],backgroundHover:ie[2],color:"#ffffff",size:"56px",shadow:"0 8px 32px rgba(0, 0, 0, 0.15)",borderRadius:"9999px"},tile:{background:se(S[12],.7),backgroundHover:se(S[12],.8),border:"1px solid rgba(0, 0, 0, 0.06)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.12)",titleColor:S[1],textColor:S[6],iconBackground:`linear-gradient(135deg, ${ie[3]} 0%, ${ie[3]}cc 100%)`,iconShadow:`0 2px 8px ${ie[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:se(S[12],.7),textColor:S[1],titleColor:S[1],arrowColor:se(S[12],.7),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${ie[3]}`},notification:{background:se(S[12],.95),textColor:S[1],textSecondaryColor:S[6],border:`1px solid ${se(S[0],.12)}`,borderRadius:"12px",successColor:be[4],warningColor:Be[4],errorColor:Te[4],iconBackground:se(ie[3],.1),progressGradient:`linear-gradient(90deg, ${ie[3]}, ${ie[2]})`},content:{background:se(S[12],.8),backgroundHover:se(S[11],.6),border:`1px solid ${S[11]}`,borderRadius:"8px",textColor:S[1],textSecondaryColor:S[6],itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:S[12],searchColor:S[1],chevronColor:"currentColor"}};function fv(n){let e=n.mode==="light"?hv:pv;return{mode:n.mode??e.mode,fontFamily:n.fontFamily??e.fontFamily,colorPrimary:n.colorPrimary??e.colorPrimary,colorPrimaryHover:n.colorPrimaryHover??e.colorPrimaryHover,borderRadius:n.borderRadius??e.borderRadius,canvas:{...e.canvas,...n.canvas},launcher:{...e.launcher,...n.launcher},tile:{...e.tile,...n.tile},overlay:{...e.overlay,...n.overlay},notification:{...e.notification,...n.notification},content:{...e.content,...n.content}}}function gv(n,e){let t=e.mode??n.mode??"dark",r=t==="light"?hv:pv;return{mode:t,fontFamily:e.fontFamily??n.fontFamily??r.fontFamily,colorPrimary:e.colorPrimary??n.colorPrimary??r.colorPrimary,colorPrimaryHover:e.colorPrimaryHover??n.colorPrimaryHover??r.colorPrimaryHover,borderRadius:e.borderRadius??n.borderRadius??r.borderRadius,canvas:{...r.canvas,...n.canvas,...e.canvas},launcher:{...r.launcher,...n.launcher,...e.launcher},tile:{...r.tile,...n.tile,...e.tile},overlay:{...r.overlay,...n.overlay,...e.overlay},notification:{...r.notification,...n.notification,...e.notification},content:{...r.content,...n.content,...e.content}}}var hE=["canvas","launcher","tile","overlay","notification","content"];function mv(n){let e={};n.fontFamily&&(e["--sc-font-family"]=n.fontFamily),n.colorPrimary&&(e["--sc-color-primary"]=n.colorPrimary),n.colorPrimaryHover&&(e["--sc-color-primary-hover"]=n.colorPrimaryHover),n.borderRadius&&(e["--sc-border-radius"]=n.borderRadius);for(let t of hE){let r=n[t];if(r)for(let[i,s]of Object.entries(r))s!==void 0&&(e[`--sc-${t}-${pE(i)}`]=s)}return e}var Cn,hr,fr,tn,nn,Mu,Va,Ns=class{constructor(e,t,r){ee(this,nn);ee(this,Cn);ee(this,hr);ee(this,fr);ee(this,tn);Z(this,Cn,e),Z(this,hr,t??{}),Z(this,fr,r),Z(this,tn,te(this,nn,Mu).call(this)),e.addController(this)}get config(){return I(this,tn).config}get mode(){return I(this,tn).mode}get cssVariables(){return I(this,tn).cssVariables}hostConnected(){te(this,nn,Va).call(this)}hostDisconnected(){}hostUpdated(){te(this,nn,Va).call(this)}setThemeConfig(e,t){Z(this,hr,e),Z(this,fr,t),Z(this,tn,te(this,nn,Mu).call(this)),te(this,nn,Va).call(this),I(this,Cn).requestUpdate()}};Cn=new WeakMap,hr=new WeakMap,fr=new WeakMap,tn=new WeakMap,nn=new WeakSet,Mu=function(){let e=I(this,fr)?gv(I(this,fr),I(this,hr)):fv(I(this,hr)),t=mv(e);return{config:e,mode:e.mode,cssVariables:t}},Va=function(){let e=I(this,Cn).shadowRoot??("renderRoot"in I(this,Cn)?I(this,Cn).renderRoot:null);if(!e||!(e instanceof ShadowRoot))return;let t=e.querySelector("#sc-theme-vars");t||(t=document.createElement("style"),t.id="sc-theme-vars",e.insertBefore(t,e.firstChild));let r=Object.entries(I(this,tn).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
|
|
565
565
|
`);t.textContent=`:host {
|
|
566
566
|
${r}
|
|
567
|
-
}`};var
|
|
567
|
+
}`};var fE=new Set(["tag_name","$el_text"]);function gE(n){return fE.has(n)||n.startsWith("attr__")}function vv(n,e){return n.equals!==void 0?e===n.equals:n.contains!==void 0?typeof e=="string"&&e.includes(n.contains):!1}function mE(n){let{events:e,match:t}=n;return r=>{if(!e.includes(r.name))return!1;if(t){for(let[i,s]of Object.entries(t))if(gE(i)){let o=r.props?.elements;if(!o||!o.some(l=>vv(s,l[i])))return!1}else if(!vv(s,r.props?.[i]))return!1}return!0}}function yv(n,e){for(let t of n.rules)for(let r of t.conditions)if(r.type==="event_count"&&r.key){let i=r.counter,s=i?mE(i):()=>!0,o=typeof r.withinMs=="number";e.register(r.key,s,o)}}function fi(n,e,t){for(let r of n){let i=r.props;if(!i)continue;let s=i.actions;if(s)for(let o of s)o.triggerWhen?.type==="rules"&&yv(o.triggerWhen,e)}if(t)for(let r of t){let i=r;i.triggerWhen?.type==="rules"&&yv(i.triggerWhen,e)}}var An,gi,Ls,Pu,Wa=class extends ge{constructor(){super(...arguments);ee(this,Ls);this.component=null;this.props={};ee(this,An,null);ee(this,gi,null)}createRenderRoot(){return this}render(){return D`<div></div>`}firstUpdated(){Z(this,gi,this.querySelector("div")),te(this,Ls,Pu).call(this)}updated(t){te(this,Ls,Pu).call(this)}disconnectedCallback(){super.disconnectedCallback(),I(this,An)?.unmount(),Z(this,An,null)}};An=new WeakMap,gi=new WeakMap,Ls=new WeakSet,Pu=function(){if(!I(this,gi)||!this.component)return;let t=window.SynOS;if(!t?.React||!t?.ReactDOM?.createRoot)return;let r=t.React,{createRoot:i}=t.ReactDOM;I(this,An)||Z(this,An,i(I(this,gi))),I(this,An).render(r.createElement(this.component,this.props))},Wa.properties={component:{attribute:!1},props:{attribute:!1}};customElements.define("react-bridge",Wa);var vE="syntro-runtime",bv="smart-canvas",_v=n=>[...n].sort((e,t)=>(t.priority??0)-(e.priority??0));function xv(n){let e=typeof window<"u"?window.SynOS?.interventionTracker:null;if(e)for(let t of n)e.trackTriggered(t.id,t.widget??"unknown")}var et,vi,Nt,mt,Lt,gr,Fs,Ds,Hs,mr,vr,Rn,Tn,In,yr,$n,yi,bi,Bs,xe,wv,kv,_i,Ou,Sv,Nu,Lu,Fu,Ev,Du,ja,Cv,mi=class extends ge{constructor(){super();ee(this,xe);this.fetcher=void 0;this.configUri=void 0;this.configUriFeatureKey=void 0;this.configFeatureKey=void 0;this.fetchCredentials="include";this.experiments=void 0;this.telemetry=void 0;this.runtime=void 0;this.launcherLabel=void 0;this.initialBatchHandle=null;this.workspaceTheme=void 0;this._tiles=[];this._configActions=[];this._isLoading=!0;this._error=void 0;this._theme=void 0;this._launcher=void 0;this._canvasTitle=void 0;this._displayMode="standard";this._isOpen=!1;this._pageUrl=typeof window<"u"?window.location.href:"/";ee(this,et);ee(this,vi,null);ee(this,Nt,null);ee(this,mt,null);ee(this,Lt,null);ee(this,gr);ee(this,Fs,0);ee(this,Ds,null);ee(this,Hs,"[]");ee(this,mr,null);ee(this,vr,null);ee(this,Rn,null);ee(this,Tn,null);ee(this,In,null);ee(this,yr,()=>{this._pageUrl=window.location.href});ee(this,$n,null);ee(this,yi,null);ee(this,bi);ee(this,Bs);ee(this,_i,0);ee(this,ja,t=>{I(this,et).toggle()});Z(this,et,dv()),Z(this,gr,!1),Z(this,bi,new Ns(this)),Z(this,Bs,new pi(this,{context:vE,initialValue:null}))}connectedCallback(){super.connectedCallback(),this.style.setProperty("font-family","inherit"),Z(this,vi,I(this,et).subscribe(t=>{this._isOpen=t.open})),this._isOpen=I(this,et).getState().open,Z(this,Nt,document.createElement("div")),I(this,Nt).id="overlayContainer",Object.assign(I(this,Nt).style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),this.shadowRoot.appendChild(I(this,Nt)),Z(this,mt,document.createElement("div")),I(this,mt).id="portalRoot",this.shadowRoot.appendChild(I(this,mt)),te(this,xe,Nu).call(this),te(this,xe,Du).call(this),te(this,xe,Fu).call(this)}disconnectedCallback(){var t,r,i,s,o;super.disconnectedCallback(),(t=I(this,vi))==null||t.call(this),Z(this,vi,null),(r=I(this,vr))==null||r.call(this),Z(this,vr,null),(i=I(this,Rn))==null||i.call(this),Z(this,Rn,null),(s=I(this,Tn))==null||s.call(this),Z(this,Tn,null),(o=I(this,In))==null||o.call(this),Z(this,In,null),te(this,xe,Lu).call(this),I(this,Lt)&&(I(this,Lt).revertAll().catch(a=>{console.error("[SmartCanvasElementLit] Failed to revert actions on disconnect:",a)}),Z(this,Lt,null)),I(this,$n)?.unmount(),Z(this,$n,null),I(this,Nt)?.remove(),Z(this,Nt,null),I(this,mt)?.remove(),Z(this,mt,null)}updated(t){var i;t.has("runtime")&&(I(this,Bs).setValue(this.runtime??null),te(this,xe,Ev).call(this),te(this,xe,Fu).call(this),te(this,xe,Du).call(this),te(this,xe,Lu).call(this),te(this,xe,Nu).call(this));let r=t.has("runtime")||t.has("fetcher")||t.has("configUri")||t.has("configUriFeatureKey")||t.has("configFeatureKey")||t.has("fetchCredentials")||t.has("experiments");if(r&&(te(this,xe,wv).call(this),(i=I(this,vr))==null||i.call(this),this.experiments?.onFeaturesChanged&&Z(this,vr,this.experiments.onFeaturesChanged(()=>this._loadConfig()))),(r||t.has("_pageUrl"))&&this._loadConfig(),(t.has("_theme")||t.has("workspaceTheme"))&&I(this,bi).setThemeConfig(this._theme??{},this.workspaceTheme),(t.has("_configActions")||t.has("_pageUrl"))&&te(this,xe,Sv).call(this),t.has("_tiles")||t.has("_isLoading")||t.has("_error")){let s=this._tiles.length>0&&!this._error;!this._isLoading&&!s&&I(this,et).getState().open&&I(this,et).setOpen(!1)}t.has("initialBatchHandle")&&this.initialBatchHandle&&(Z(this,Lt,this.initialBatchHandle),Z(this,gr,!0))}render(){let t=this._tiles.length>0&&!this._error;return this._isLoading||t?D`
|
|
568
568
|
<syntro-canvas-overlay
|
|
569
569
|
.isOpen=${this._isOpen}
|
|
570
570
|
.tiles=${this._tiles}
|
|
@@ -574,11 +574,11 @@ ${r}
|
|
|
574
574
|
.displayMode=${this._displayMode}
|
|
575
575
|
.runtimeRef=${this.runtime??null}
|
|
576
576
|
.telemetry=${this.telemetry??null}
|
|
577
|
-
.themeConfig=${
|
|
577
|
+
.themeConfig=${I(this,bi).config}
|
|
578
578
|
?launcherAnimate=${!!this._launcher?.animate}
|
|
579
|
-
@canvas-toggle=${
|
|
579
|
+
@canvas-toggle=${I(this,ja)}
|
|
580
580
|
></syntro-canvas-overlay>
|
|
581
|
-
`:
|
|
581
|
+
`:J}open(){I(this,et).setOpen(!0)}close(){I(this,et).setOpen(!1)}toggle(){I(this,et).toggle()}setOverrideFetcher(t){this.fetcher=t}getMountNode(){return this.renderRoot}getController(){return I(this,et)}getPortalRoot(){return I(this,mt)}getOverlayContainer(){return I(this,Nt)}getShadowRoot(){return this.shadowRoot}mountReactApp(t){Z(this,yi,t),te(this,xe,Cv).call(this)}mountLitApp(t){t.fetcher!==void 0&&(this.fetcher=t.fetcher),t.configUri!==void 0&&(this.configUri=t.configUri),t.configUriFeatureKey!==void 0&&(this.configUriFeatureKey=t.configUriFeatureKey),t.configFeatureKey!==void 0&&(this.configFeatureKey=t.configFeatureKey),t.fetchCredentials!==void 0&&(this.fetchCredentials=t.fetchCredentials),t.experiments!==void 0&&(this.experiments=t.experiments),t.telemetry!==void 0&&(this.telemetry=t.telemetry),t.runtime!==void 0&&(this.runtime=t.runtime),t.launcherLabel!==void 0&&(this.launcherLabel=t.launcherLabel),t.initialBatchHandle!==void 0&&(this.initialBatchHandle=t.initialBatchHandle),t.workspaceTheme!==void 0&&(this.workspaceTheme=t.workspaceTheme)}async _loadConfig(){if(!I(this,mr))return;let t=++_c(this,_i)._;try{this._isLoading=!0,this._error=void 0;let r=await I(this,mr).call(this);if(t!==I(this,_i))return;K("SmartCanvas Config","Raw config response",r),Z(this,Ds,r);let i=r.tiles||[];if(i.length>0&&this.runtime?.accumulator&&fi(i,this.runtime.accumulator,r.actions),this.runtime){if(i=await this.runtime.filterTiles(i),t!==I(this,_i))return;this.experiments&&(i=i.filter(l=>this.experiments.shouldRenderRectangle(l)))}else this.experiments&&(i=i.filter(l=>this.experiments.shouldRenderRectangle(l)));xv(i),K("SmartCanvas Config",`Tile count after filtering: ${i.length}`);let s=r.actions||[],o=JSON.stringify(s),a=o!==I(this,Hs);a&&Z(this,Hs,o),this._tiles=_v(i),a&&(this._configActions=s),this._isLoading=!1,this._canvasTitle=r.canvasTitle,this._theme=r.theme,this._launcher=r.launcher}catch(r){let i=r instanceof Error?r.message:"Unknown error";console.error("[SmartCanvas Config] Failed to fetch/filter config:",i,r),this._isLoading=!1,this._error=i}}};et=new WeakMap,vi=new WeakMap,Nt=new WeakMap,mt=new WeakMap,Lt=new WeakMap,gr=new WeakMap,Fs=new WeakMap,Ds=new WeakMap,Hs=new WeakMap,mr=new WeakMap,vr=new WeakMap,Rn=new WeakMap,Tn=new WeakMap,In=new WeakMap,yr=new WeakMap,$n=new WeakMap,yi=new WeakMap,bi=new WeakMap,Bs=new WeakMap,xe=new WeakSet,wv=function(){if(this.fetcher)Z(this,mr,this.fetcher);else{let t=te(this,xe,kv).call(this);Z(this,mr,hi(t))}},kv=function(){return{configUri:this.configUri,experiments:this.experiments,featureKey:this.configUriFeatureKey,configFeatureKey:this.configFeatureKey,credentials:this.fetchCredentials}},_i=new WeakMap,Ou=async function(){let t=I(this,Ds);if(!t||!this.runtime)return;let r=t.tiles||[];r=await this.runtime.filterTiles(r),this.experiments&&(r=r.filter(i=>this.experiments.shouldRenderRectangle(i))),xv(r),this._tiles=_v(r)},Sv=async function(){if(!this.runtime?.actions)return;if(I(this,gr)){this._configActions.length>0&&Z(this,gr,!1);return}let t=++_c(this,Fs)._,r=()=>t!==I(this,Fs);if(I(this,Lt)){try{await I(this,Lt).revertAll()}catch(i){console.error("[SmartCanvasElementLit] Failed to revert actions:",i)}Z(this,Lt,null)}if(!r()&&this._configActions.length>0)try{let i=await this.runtime.actions.applyBatch(this._configActions);r()?await i.revertAll():Z(this,Lt,i)}catch(i){r()||console.error("[SmartCanvasElementLit] Failed to apply actions:",i)}},Nu=function(){this.runtime||typeof window>"u"||(window.addEventListener("popstate",I(this,yr)),window.addEventListener("hashchange",I(this,yr)))},Lu=function(){typeof window>"u"||(window.removeEventListener("popstate",I(this,yr)),window.removeEventListener("hashchange",I(this,yr)))},Fu=function(){this.runtime&&(this.runtime.accumulator&&Z(this,Rn,this.runtime.accumulator.subscribe(()=>{te(this,xe,Ou).call(this)})),this.runtime.context&&Z(this,Tn,this.runtime.context.subscribe(t=>{let r=t.page?.url;r&&r!==this._pageUrl&&(this._pageUrl=r),te(this,xe,Ou).call(this)})))},Ev=function(){var t,r;(t=I(this,Rn))==null||t.call(this),Z(this,Rn,null),(r=I(this,Tn))==null||r.call(this),Z(this,Tn,null)},Du=function(){var t;(t=I(this,In))==null||t.call(this),Z(this,In,null),this.runtime&&Z(this,In,this.runtime.events.subscribe({names:["canvas.requestOpen"]},()=>I(this,et).setOpen(!0)))},ja=new WeakMap,Cv=function(){if(!this.isConnected||!I(this,yi)||!I(this,mt))return;let t=window.SynOS;if(!t?.React||!t?.ReactDOM?.createRoot){console.warn("[SmartCanvasElementLit] mountReactApp() called but SynOS.React/ReactDOM not available. Use mountLitApp() for the Lit-native path.");return}let r=t.React,{createRoot:i}=t.ReactDOM;I(this,$n)||Z(this,$n,i(I(this,mt)));let s=t.SmartCanvasApp,o=t.ShadowRootProvider;if(s&&o){let a={shadowRoot:this.shadowRoot,portalRoot:I(this,mt),overlayContainer:I(this,Nt)},l={...I(this,yi),controller:I(this,et),canvasHost:this};I(this,$n).render(r.createElement(o,a,r.createElement(s,l)))}},mi.shadowRootOptions={mode:"open",delegatesFocus:!0},mi.styles=tr`
|
|
582
582
|
:host {
|
|
583
583
|
font: inherit;
|
|
584
584
|
color: inherit;
|
|
@@ -594,7 +594,7 @@ ${r}
|
|
|
594
594
|
*::after {
|
|
595
595
|
box-sizing: border-box;
|
|
596
596
|
}
|
|
597
|
-
`,mi.properties={fetcher:{attribute:!1},configUri:{type:String},configUriFeatureKey:{type:String},configFeatureKey:{type:String},fetchCredentials:{type:String},experiments:{attribute:!1},telemetry:{attribute:!1},runtime:{attribute:!1},launcherLabel:{type:String},initialBatchHandle:{attribute:!1},workspaceTheme:{attribute:!1},_tiles:{state:!0},_configActions:{state:!0},_isLoading:{state:!0},_error:{state:!0},_theme:{state:!0},_launcher:{state:!0},_canvasTitle:{state:!0},_displayMode:{state:!0},_isOpen:{state:!0},_pageUrl:{state:!0}};var
|
|
597
|
+
`,mi.properties={fetcher:{attribute:!1},configUri:{type:String},configUriFeatureKey:{type:String},configFeatureKey:{type:String},fetchCredentials:{type:String},experiments:{attribute:!1},telemetry:{attribute:!1},runtime:{attribute:!1},launcherLabel:{type:String},initialBatchHandle:{attribute:!1},workspaceTheme:{attribute:!1},_tiles:{state:!0},_configActions:{state:!0},_isLoading:{state:!0},_error:{state:!0},_theme:{state:!0},_launcher:{state:!0},_canvasTitle:{state:!0},_displayMode:{state:!0},_isOpen:{state:!0},_pageUrl:{state:!0}};var Ua=()=>{typeof window>"u"||customElements.get(bv)||customElements.define(bv,mi)};var za=class extends ge{constructor(){super(...arguments);this.isOpen=!1;this.tiles=[];this.isLoading=!1;this.error=void 0;this.canvasTitle=void 0;this.displayMode="standard";this.runtimeRef=null;this.telemetry=null;this.themeConfig={canvas:{}};this._containerEl=null;this._resizeObserver=null;this._onDocumentMousedown=t=>{if(!this.isOpen)return;let r=t.composedPath();r.some(s=>s instanceof HTMLElement&&s.closest?.('[data-shadow-canvas-id="overlay-launcher"]')!=null)||this._containerEl&&!r.includes(this._containerEl)&&this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0}))}}createRenderRoot(){return this}get _canvas(){return this.themeConfig?.canvas??{}}get _isRight(){return(this._canvas.position??"right")==="right"}get _isPush(){return this._canvas.layout==="push"}get _isFocused(){return this.displayMode==="focused"}get _canvasBorder(){return this._canvas.border??"none"}get _duration(){return this._canvas.transitionDuration??"300ms"}get _easing(){return this._canvas.transitionEasing??"cubic-bezier(0.16, 1, 0.3, 1)"}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._onDocumentMousedown)}updated(t){if(this._containerEl=this.querySelector('[data-shadow-canvas-id="overlay-container"]')??null,this._isPush){let r=document.documentElement,i=this._isRight?"marginRight":"marginLeft";if(r.style.transition=`${i} ${this._duration} ${this._easing}`,this.isOpen){let s=this._containerEl?.offsetWidth??380;r.style[i]=`${s}px`}else r.style[i]="0px"}if((t.has("isOpen")||t.has("themeConfig"))&&(this._teardownResizeObserver(),this._isPush&&this.isOpen&&this._containerEl)){let r=this._isRight?"marginRight":"marginLeft";this._resizeObserver=new ResizeObserver(([i])=>{document.documentElement.style[r]=`${i.contentRect.width}px`}),this._resizeObserver.observe(this._containerEl)}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._onDocumentMousedown),this._teardownResizeObserver(),this._cleanupPushMargin()}_teardownResizeObserver(){this._resizeObserver?.disconnect(),this._resizeObserver=null}_cleanupPushMargin(){if(this._isPush){let t=document.documentElement,r=this._isRight?"marginRight":"marginLeft";t.style[r]="",t.style.transition=""}}render(){let t=this._isFocused,r=this._isRight,i=this._canvasBorder,s=this._duration,o=this._easing,a=2147483600,l=this._canvas.blur??"blur(24px)",c=t&&l!=="none"?`${l} saturate(1.2)`:l,u={};if(!t&&(!i||i==="none")){let m=this._canvas.transitionFade??"6%",y=r?`linear-gradient(to right, transparent, black ${m})`:`linear-gradient(to left, transparent, black ${m})`;u={maskImage:y,WebkitMaskImage:y}}let d={display:"flex",flexDirection:"column",width:t?"40vw":this._canvas.width??"380px",minWidth:"320px",height:"100%",maxHeight:"100%",pointerEvents:"auto",opacity:this.isOpen?"1":"0",transition:this.isOpen?`transform ${s} ${o}, opacity ${s} ease-out`:`transform ${s} ${o}, opacity ${s} ease-in`,color:"var(--sc-overlay-text-color)",background:"var(--sc-canvas-background)",backdropFilter:c,WebkitBackdropFilter:c,...u,border:i,borderRadius:"var(--sc-overlay-border-radius, 0)",boxShadow:"none",transform:this.isOpen?"translateX(0)":r?"translateX(120%)":"translateX(-120%)"},h={position:"absolute",inset:"0",display:"flex",flexDirection:r?"row-reverse":"row",alignItems:"stretch",pointerEvents:"none",padding:"0"},g={position:"fixed",inset:"0",pointerEvents:"none",zIndex:String(a)},v={flex:"1",overflowY:"auto",padding:t?"0":"1rem"},f={display:"flex",flexDirection:"column",gap:"0.75rem",width:"100%"};return D`
|
|
598
598
|
<div data-shadow-canvas-id="overlay-root" style=${T(g)}>
|
|
599
599
|
<div style=${T(h)}>
|
|
600
600
|
<div data-shadow-canvas-id="overlay-container" style=${T(d)}>
|
|
@@ -604,7 +604,7 @@ ${r}
|
|
|
604
604
|
<p style=${T({margin:"0",fontSize:"0.7rem",textTransform:"uppercase",letterSpacing:"0.5em",color:"var(--sc-notification-text-secondary-color)"})}>
|
|
605
605
|
${this.canvasTitle}
|
|
606
606
|
</p>
|
|
607
|
-
</header>`:
|
|
607
|
+
</header>`:J}
|
|
608
608
|
|
|
609
609
|
<div style=${T(v)}>
|
|
610
610
|
${this.isLoading?D`<div style=${T({color:"var(--sc-overlay-text-color)",padding:t?"1rem":"0"})}>Loading...</div>`:this.error?D`<div style=${T({color:"var(--sc-notification-error-color)",padding:t?"1rem":"0"})}>Failed to load: ${this.error}</div>`:t?this.tiles.length>0?D`<syntro-tile-card
|
|
@@ -612,7 +612,7 @@ ${r}
|
|
|
612
612
|
.surface=${"overlay"}
|
|
613
613
|
.runtimeRef=${this.runtimeRef}
|
|
614
614
|
style=${T({width:"100%",height:"100%"})}
|
|
615
|
-
></syntro-tile-card>`:
|
|
615
|
+
></syntro-tile-card>`:J:D`
|
|
616
616
|
<div style=${T(f)}>
|
|
617
617
|
${this.tiles.map(m=>D`
|
|
618
618
|
<syntro-tile-card
|
|
@@ -630,7 +630,7 @@ ${r}
|
|
|
630
630
|
<div style=${T({flex:"1 1 auto"})}></div>
|
|
631
631
|
</div>
|
|
632
632
|
</div>
|
|
633
|
-
`}};
|
|
633
|
+
`}};za.properties={isOpen:{type:Boolean},tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},canvasTitle:{type:String},displayMode:{type:String},runtimeRef:{attribute:!1},telemetry:{attribute:!1},themeConfig:{attribute:!1}};customElements.define("syntro-drawer",za);var yE="#6a59ce",bE="#887ad8",_E="#ffffff",qa=class extends ge{constructor(){super(...arguments);this.isOpen=!1;this.launcherAnimate=!1;this.notificationCount=0;this.position="right";this.launcherIcon=null;this.colorPrimary=yE;this.colorPrimaryHover=bE;this.launcherConfig={};this._launcherPos=null;this._hovered=!1;this._drag=null;this._styleEl=null;this._onPointerDown=t=>{let r=t.currentTarget,i=r.getBoundingClientRect();this._drag={startX:t.clientX,startY:t.clientY,startElX:i.left,startElY:i.top,dragged:!1},r.setPointerCapture(t.pointerId)};this._onPointerMove=t=>{let r=this._drag;if(!r)return;let i=t.clientX-r.startX,s=t.clientY-r.startY;(Math.abs(i)>5||Math.abs(s)>5)&&(r.dragged=!0),r.dragged&&(this._launcherPos={x:r.startElX+i,y:r.startElY+s})};this._onPointerUp=t=>{let r=this._drag;this._drag=null,r&&!r.dragged&&this.dispatchEvent(new CustomEvent("launcher-toggle",{bubbles:!0,composed:!0}))};this._onMouseEnter=t=>{this._drag?.dragged||(this._hovered=!0,t.currentTarget.style.backgroundColor=this.launcherConfig.backgroundHover??"var(--sc-launcher-background-hover)")};this._onMouseLeave=t=>{this._drag?.dragged||(this._hovered=!1,t.currentTarget.style.backgroundColor=this.launcherConfig.background??"var(--sc-launcher-background)")}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._ensureDynamicStyles()}updated(t){(t.has("colorPrimary")||t.has("colorPrimaryHover"))&&this._ensureDynamicStyles()}disconnectedCallback(){super.disconnectedCallback(),this._styleEl&&(this._styleEl.remove(),this._styleEl=null)}_ensureDynamicStyles(){let t=`
|
|
634
634
|
@keyframes syntro-launcher-pulse {
|
|
635
635
|
0%, 100% {
|
|
636
636
|
box-shadow: 0 20px 45px rgba(0,0,0,0.35), 0 0 0 0 ${this.colorPrimary}66;
|
|
@@ -676,7 +676,7 @@ ${r}
|
|
|
676
676
|
@mouseleave=${this._onMouseLeave}
|
|
677
677
|
>
|
|
678
678
|
${this._renderIcon()}
|
|
679
|
-
${o?this._renderBadge():
|
|
679
|
+
${o?this._renderBadge():J}
|
|
680
680
|
</button>
|
|
681
681
|
`}_renderIcon(){let t="transition: transform 200ms ease;";return this.isOpen?D`
|
|
682
682
|
<svg
|
|
@@ -725,10 +725,10 @@ ${r}
|
|
|
725
725
|
<!-- Layer 3: Bouncing count badge -->
|
|
726
726
|
<span
|
|
727
727
|
class="syntro-badge-bounce"
|
|
728
|
-
style=${T({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",borderRadius:"9999px",background:this.colorPrimaryHover,color:
|
|
728
|
+
style=${T({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",borderRadius:"9999px",background:this.colorPrimaryHover,color:_E,fontSize:"11px",fontWeight:"700"})}
|
|
729
729
|
>${r}</span>
|
|
730
730
|
</div>
|
|
731
|
-
`}};
|
|
731
|
+
`}};qa.properties={isOpen:{type:Boolean},launcherAnimate:{type:Boolean},notificationCount:{type:Number},position:{type:String},launcherIcon:{attribute:!1},colorPrimary:{type:String},colorPrimaryHover:{type:String},launcherConfig:{attribute:!1},_launcherPos:{state:!0},_hovered:{state:!0}};customElements.define("syntro-launcher",qa);var xE={"\u2753":['<circle cx="12" cy="12" r="10"/>','<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/>','<path d="M12 17h.01"/>'],"\u{1F9ED}":['<circle cx="12" cy="12" r="10"/>','<polygon points="16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76"/>'],"\u{1F4DD}":['<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/>','<polyline points="14 2 14 8 20 8"/>','<line x1="16" y1="13" x2="8" y2="13"/>','<line x1="16" y1="17" x2="8" y2="17"/>','<line x1="10" y1="9" x2="8" y2="9"/>'],"\u{1F3AF}":['<polygon points="12 2 2 7 12 12 22 7 12 2"/>','<polyline points="2 17 12 22 22 17"/>','<polyline points="2 12 12 17 22 12"/>'],"\u{1F3C6}":['<path d="M6 9H4.5a2.5 2.5 0 0 1 0-5H6"/>','<path d="M18 9h1.5a2.5 2.5 0 0 0 0-5H18"/>','<path d="M4 22h16"/>','<path d="M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22"/>','<path d="M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22"/>','<path d="M18 2H6v7a6 6 0 0 0 12 0V2Z"/>'],"\u2728":['<path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/>','<path d="M5 3v4"/>','<path d="M19 17v4"/>','<path d="M3 5h4"/>','<path d="M17 19h4"/>'],"\u{1F4AC}":['<path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/>'],"\u{1F3AE}":['<line x1="6" y1="11" x2="10" y2="11"/>','<line x1="8" y1="9" x2="8" y2="13"/>','<line x1="15" y1="12" x2="15.01" y2="12"/>','<line x1="18" y1="10" x2="18.01" y2="10"/>','<path d="M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z"/>'],"\u{1F4A1}":['<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/>','<path d="M9 18h6"/>','<path d="M10 22h4"/>'],"\u{1F4B0}":['<rect x="2" y="6" width="20" height="12" rx="2"/>','<circle cx="12" cy="12" r="2"/>','<path d="M6 12h.01M18 12h.01"/>'],"\u{1F4CB}":['<rect x="8" y="2" width="8" height="4" rx="1" ry="1"/>','<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>','<path d="M12 11h4"/>','<path d="M12 16h4"/>','<path d="M8 11h.01"/>','<path d="M8 16h.01"/>'],"\u2705":['<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>','<polyline points="22 4 12 14.01 9 11.01"/>'],"\u26A0\uFE0F":['<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/>','<line x1="12" y1="9" x2="12" y2="13"/>','<line x1="12" y1="17" x2="12.01" y2="17"/>'],"\u{1F4B5}":['<rect x="2" y="6" width="20" height="12" rx="2"/>','<circle cx="12" cy="12" r="2"/>','<path d="M6 12h.01M18 12h.01"/>'],"\u{1F3DB}\uFE0F":['<line x1="3" y1="22" x2="21" y2="22"/>','<line x1="6" y1="18" x2="6" y2="11"/>','<line x1="10" y1="18" x2="10" y2="11"/>','<line x1="14" y1="18" x2="14" y2="11"/>','<line x1="18" y1="18" x2="18" y2="11"/>','<polygon points="12 2 20 7 4 7"/>','<line x1="2" y1="18" x2="22" y2="18"/>'],"\u23ED\uFE0F":['<polygon points="5 4 15 12 5 20 5 4"/>','<line x1="19" y1="5" x2="19" y2="19"/>'],"\u27A1\uFE0F":['<line x1="5" y1="12" x2="19" y2="12"/>','<polyline points="12 5 19 12 12 19"/>'],"\u23F1\uFE0F":['<line x1="10" y1="2" x2="14" y2="2"/>','<line x1="12" y1="14" x2="12" y2="8"/>','<circle cx="12" cy="14" r="8"/>'],"\u{1F4D6}":['<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/>','<path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/>'],"\u{1F514}":['<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/>','<path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>']};function wE(n,e,t="currentColor"){let r=xE[n];if(!r)return D`<span style=${T({fontSize:`${e}px`,lineHeight:"1"})}>${n}</span>`;let i=r.join(""),s=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${e}" viewBox="0 0 24 24" fill="none" stroke="${t}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${i}</svg>`,o=document.createElement("span");return o.style.display="flex",o.innerHTML=s,D`${o}`}var kE=[":toggled",":clicked",":feedback",":navigate",":expanded",":collapsed",":dismissed",":submitted",":interacted",":tip_clicked",":tip_focused"],Za=class extends ge{constructor(){super(...arguments);this.config=null;this.surface="overlay";this.runtimeRef=null;this._hovered=!1;this._widgetHandle=null;this._widgetContainer=null;this._mountedWidgetId=null;this._registryUnsub=null;this._eventBusUnsub=null;this._intersectionObserver=null;this._prevPropsJson=null;this._onMouseEnter=()=>{this._hovered=!0};this._onMouseLeave=()=>{this._hovered=!1}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._setupEventBusSubscription(),this._setupRegistrySubscription(),this.updateComplete.then(()=>{this._mountWidgetIfReady(),this._setupIntersectionObserver()})}updated(t){(t.has("runtimeRef")||t.has("config"))&&(t.has("runtimeRef")&&(this._teardownSubscriptions(),this._setupEventBusSubscription(),this._setupRegistrySubscription()),(this.config?.widget??null)!==this._mountedWidgetId?(this._unmountWidget(),this._mountWidgetIfReady()):this._forwardPropUpdates())}disconnectedCallback(){super.disconnectedCallback(),this._unmountWidget(),this._teardownSubscriptions(),this._intersectionObserver?.disconnect(),this._intersectionObserver=null}_mountWidgetIfReady(){if(this._mountedWidgetId)return;let t=this.runtimeRef?.widgets,r=this.config?.widget;if(!t||!r||!t.has(r))return;let i=this.querySelector("[data-widget-mount-parent]");if(!i)return;let s=document.createElement("div");s.style.width="100%",s.style.minHeight="40px",i.appendChild(s);let o={...this.config?.props,instanceId:this.config?.id},a=t.mount(r,s,o);this._widgetContainer=s,this._widgetHandle=a,this._mountedWidgetId=r,this._prevPropsJson=JSON.stringify(o)}_unmountWidget(){this._widgetHandle&&(this._widgetHandle.unmount(),this._widgetHandle=null),this._widgetContainer&&(this._widgetContainer.remove(),this._widgetContainer=null),this._mountedWidgetId=null,this._prevPropsJson=null}_forwardPropUpdates(){if(!this._widgetHandle||!this.config)return;let t={...this.config.props,instanceId:this.config.id},r=JSON.stringify(t);r!==this._prevPropsJson&&(this._prevPropsJson=r,this._widgetHandle.update(t))}_setupRegistrySubscription(){let t=this.runtimeRef?.widgets,r=this.config?.widget;!t||!r||t.has(r)&&this._mountedWidgetId===r||(this._registryUnsub=t.subscribe(i=>{i.type==="registered"&&i.widgetId===r&&(this.requestUpdate(),queueMicrotask(()=>{this._mountedWidgetId||this._mountWidgetIfReady()}))}))}_setupIntersectionObserver(){let t=typeof window<"u"?window.SynOS?.interventionTracker:null;if(!t||!this.config)return;let r=this.querySelector("article");r&&(this._intersectionObserver=new IntersectionObserver(([i])=>{i.isIntersecting&&(t.trackSeen(this.config.id,this.config.widget??"unknown"),this._intersectionObserver?.disconnect())},{threshold:.5}),this._intersectionObserver.observe(r))}_setupEventBusSubscription(){let t=typeof window<"u"?window.SynOS?.interventionTracker:null;!this.runtimeRef?.events||!t||!this.config||(this._eventBusUnsub=this.runtimeRef.events.subscribe(r=>{kE.some(i=>r.name?.includes(i))&&r.props?.instanceId===this.config.id&&t.trackInteracted(this.config.id,this.config.widget??"unknown",r.name)}))}_teardownSubscriptions(){this._registryUnsub?.(),this._registryUnsub=null,this._eventBusUnsub?.(),this._eventBusUnsub=null}get _registration(){let t=this.config?.widget;if(!(!t||!this.runtimeRef?.widgets))return this.runtimeRef.widgets.getRegistration?.(t)}get _resolvedIcon(){return this.config?.icon?this.config.icon:this._registration?.metadata?.icon??"+"}get _resolvedSubtitle(){return this.config?.subtitle?this.config.subtitle:this._registration?.metadata?.subtitle}render(){if(!this.config)return J;let{title:t,widget:r}=this.config,i=this._resolvedSubtitle,s=this._resolvedIcon,o=i?36:24,l=this.runtimeRef?.widgets?.has(r)??!1,c={display:"flex",flexDirection:"column",borderRadius:"var(--sc-tile-border-radius)",background:this._hovered?"var(--sc-tile-background-hover)":"var(--sc-tile-background)",backdropFilter:"blur(16px) saturate(1.2)",WebkitBackdropFilter:"blur(16px) saturate(1.2)",border:"var(--sc-tile-border)",boxShadow:"var(--sc-tile-shadow)",color:"var(--sc-tile-title-color)",fontFamily:"var(--sc-font-family)",overflow:"hidden",cursor:"default",transition:"all 0.25s ease",transform:this._hovered?"scale(1.01)":"scale(1)"},u={display:"flex",alignItems:"center",gap:"var(--sc-tile-gap, 0.25rem)",padding:"var(--sc-tile-header-padding, 0.375rem 0.75rem)",minHeight:"44px"},d={display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0"},h={fontSize:"1.14rem",fontWeight:"600",color:"var(--sc-tile-title-color)",margin:"0.125rem 0 0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},g={fontSize:"0.8rem",fontWeight:"400",color:"var(--sc-tile-text-color)",margin:"0.125rem 0 0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},v={padding:"var(--sc-tile-body-padding, 0 0.75rem 0.5rem)",borderTop:"1px solid rgba(255, 255, 255, 0.06)"},f={paddingTop:"var(--sc-tile-gap, 0.25rem)"},m={padding:"0.75rem",fontSize:"0.8rem",color:"var(--sc-tile-text-color)",fontStyle:"italic"};return D`
|
|
732
732
|
<article
|
|
733
733
|
data-shadow-canvas-id=${`tile-${this.config.id}`}
|
|
734
734
|
style=${T(c)}
|
|
@@ -738,13 +738,13 @@ ${r}
|
|
|
738
738
|
<!-- Header -->
|
|
739
739
|
<div style=${T(u)}>
|
|
740
740
|
<div style=${T(d)}>
|
|
741
|
-
${
|
|
741
|
+
${wE(s,o)}
|
|
742
742
|
</div>
|
|
743
743
|
<div style=${T({flex:"1",minWidth:"0"})}>
|
|
744
744
|
<h3 style=${T(h)}>
|
|
745
745
|
${t??r}
|
|
746
746
|
</h3>
|
|
747
|
-
${i?D`<p style=${T(g)}>${i}</p>`:
|
|
747
|
+
${i?D`<p style=${T(g)}>${i}</p>`:J}
|
|
748
748
|
</div>
|
|
749
749
|
</div>
|
|
750
750
|
|
|
@@ -757,7 +757,7 @@ ${r}
|
|
|
757
757
|
</div>
|
|
758
758
|
</div>
|
|
759
759
|
</article>
|
|
760
|
-
`}};
|
|
760
|
+
`}};Za.properties={config:{attribute:!1},surface:{type:String},runtimeRef:{attribute:!1},_hovered:{state:!0}};customElements.define("syntro-tile-card",Za);var Vs=class extends ge{constructor(){super(...arguments);this.tiles=[];this.intervalMs=7e3;this.telemetry=null;this.runtimeRef=null;this._index=0;this._ordered=[];this._intervalId=null;this._canvasOpenedTracked=!1}connectedCallback(){super.connectedCallback(),this._syncOrdered(),this._trackCanvasOpened(),this._trackRectangleViewed(),this._startInterval()}disconnectedCallback(){super.disconnectedCallback(),this._stopInterval(),this._canvasOpenedTracked=!1}updated(t){let r=!1;t.has("tiles")&&(this._syncOrdered(),this._index=0,r=!0),t.has("intervalMs")&&(r=!0),r&&(this._stopInterval(),this._startInterval()),(t.has("_index")||t.has("tiles"))&&this._trackRectangleViewed(),t.has("telemetry")&&!this._canvasOpenedTracked&&this._trackCanvasOpened()}_syncOrdered(){this._ordered=[...this.tiles].sort((t,r)=>(t.priority??0)-(r.priority??0))}_trackCanvasOpened(){this._canvasOpenedTracked||this.telemetry&&(this.telemetry.trackCanvasOpened("wheel"),this._canvasOpenedTracked=!0)}_trackRectangleViewed(){let t=this._ordered[this._index];t&&this.telemetry?.trackRectangleViewed(t.id,"wheel")}_startInterval(){this._ordered.length<=1||(this._intervalId=setInterval(()=>{this._index=(this._index+1)%this._ordered.length},this.intervalMs))}_stopInterval(){this._intervalId!==null&&(clearInterval(this._intervalId),this._intervalId=null)}_goTo(t){this._stopInterval(),this._index=t,this._startInterval()}render(){if(!this._ordered.length)return J;let t=T({transform:`translateX(-${this._index*100}%)`,width:`${this._ordered.length*100}%`}),r=T({width:`${100/this._ordered.length}%`});return D`
|
|
761
761
|
<div class="wheel-root" data-shadow-canvas-id="wheel">
|
|
762
762
|
<div class="slide-track" style=${t}>
|
|
763
763
|
${this._ordered.map(i=>D`
|
|
@@ -785,7 +785,7 @@ ${r}
|
|
|
785
785
|
`)}
|
|
786
786
|
</div>
|
|
787
787
|
</div>
|
|
788
|
-
`}};
|
|
788
|
+
`}};Vs.styles=tr`
|
|
789
789
|
:host {
|
|
790
790
|
display: block;
|
|
791
791
|
}
|
|
@@ -825,23 +825,23 @@ ${r}
|
|
|
825
825
|
cursor: pointer;
|
|
826
826
|
padding: 0;
|
|
827
827
|
}
|
|
828
|
-
`,
|
|
828
|
+
`,Vs.properties={tiles:{type:Array},intervalMs:{type:Number},telemetry:{type:Object},runtimeRef:{type:Object},_index:{type:Number,state:!0}};customElements.define("syntro-tile-wheel",Vs);var SE={"\u2753":'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',"\u{1F9ED}":'<circle cx="12" cy="12" r="10"/><polygon points="16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76"/>',"\u{1F4DD}":'<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><line x1="10" y1="9" x2="8" y2="9"/>',"\u{1F3AF}":'<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>',"\u{1F3C6}":'<path d="M6 9H4.5a2.5 2.5 0 0 1 0-5H6"/><path d="M18 9h1.5a2.5 2.5 0 0 0 0-5H18"/><path d="M4 22h16"/><path d="M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22"/><path d="M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22"/><path d="M18 2H6v7a6 6 0 0 0 12 0V2z"/>',"\u2728":'<path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/><path d="M5 3v4"/><path d="M19 17v4"/><path d="M3 5h4"/><path d="M17 19h4"/>',"\u{1F4AC}":'<path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/>',"\u{1F3AE}":'<line x1="6" y1="12" x2="10" y2="12"/><line x1="8" y1="10" x2="8" y2="14"/><line x1="15" y1="13" x2="15.01" y2="13"/><line x1="18" y1="11" x2="18.01" y2="11"/><rect width="20" height="12" x="2" y="6" rx="2"/>',"\u{1F4A1}":'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',"\u{1F4B0}":'<line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/>',"\u{1F4CB}":'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M12 11h4"/><path d="M12 16h4"/><path d="M8 11h.01"/><path d="M8 16h.01"/>',"\u2705":'<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/>',"\u26A0\uFE0F":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/>',"\u{1F4B5}":'<line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/>',"\u{1F3DB}\uFE0F":'<line x1="3" y1="22" x2="21" y2="22"/><line x1="6" y1="18" x2="6" y2="11"/><line x1="10" y1="18" x2="10" y2="11"/><line x1="14" y1="18" x2="14" y2="11"/><line x1="18" y1="18" x2="18" y2="11"/><polygon points="12 2 20 7 4 7"/>',"\u23ED\uFE0F":'<polygon points="5 4 15 12 5 20 5 4"/><line x1="19" y1="5" x2="19" y2="19"/>',"\u27A1\uFE0F":'<line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/>',"\u23F1\uFE0F":'<path d="M10 2h4"/><path d="M12 14v-4"/><path d="M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6"/><path d="M9 17H4v5"/>',"\u{1F4D6}":'<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/>',"\u{1F514}":'<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>'};function EE(n,e){let t=SE[n];return t?`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`:`<span style="line-height:1;">${n}</span>`}var vt,Av,Rv,Tv,Iv,$v,Ws=class extends ge{constructor(){super(...arguments);ee(this,vt);this.notifications=[];this.position="right"}render(){if(this.notifications.length===0)return D``;let t=T({position:"fixed",bottom:"6rem",[this.position==="right"?"right":"left"]:"2.5rem",display:"flex",flexDirection:"column",gap:"8px",zIndex:"2147483648",pointerEvents:"auto",width:"280px"});return D`
|
|
829
829
|
<div
|
|
830
830
|
data-testid="notification-toast-stack"
|
|
831
831
|
style=${t}
|
|
832
832
|
>
|
|
833
|
-
${this.notifications.map(r=>te(this,
|
|
833
|
+
${this.notifications.map(r=>te(this,vt,$v).call(this,r))}
|
|
834
834
|
</div>
|
|
835
|
-
`}};
|
|
835
|
+
`}};vt=new WeakSet,Av=function(t,r){r.stopPropagation(),this.dispatchEvent(new CustomEvent("notification-dismiss",{detail:{id:t},bubbles:!0,composed:!0}))},Rv=function(t){this.dispatchEvent(new CustomEvent("notification-click",{detail:{notification:t},bubbles:!0,composed:!0}))},Tv=function(t){let r=t.currentTarget;r.style.transform="translateY(-1px)";let i=r.querySelector(".syntro-toast-progress");i&&i.classList.add("paused")},Iv=function(t){let r=t.currentTarget;r.style.transform="translateY(0)";let i=r.querySelector(".syntro-toast-progress");i&&i.classList.remove("paused")},$v=function(t){let r=T({background:"var(--sc-notification-background)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:"var(--sc-notification-border)",borderRadius:"var(--sc-notification-border-radius)",overflow:"hidden",cursor:"pointer",transition:"transform 0.15s ease"}),i=T({display:"flex",alignItems:"flex-start",gap:"10px",padding:"10px 12px"}),s=T({width:"28px",height:"28px",borderRadius:"8px",background:"var(--sc-notification-icon-background)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",fontSize:"14px",color:"var(--sc-notification-text-color)"}),o=T({flex:"1",minWidth:"0"}),a=T({fontSize:"13px",fontWeight:"600",color:"var(--sc-notification-text-color)",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),l=T({fontSize:"12px",color:"var(--sc-notification-text-secondary-color)",lineHeight:"1.3",marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),c=T({background:"none",border:"none",color:"var(--sc-notification-text-secondary-color)",cursor:"pointer",padding:"2px",fontSize:"14px",lineHeight:"1",flexShrink:"0"}),u=T({height:"2px",background:"rgba(0, 0, 0, 0.08)"}),d=T({height:"100%",background:"var(--sc-notification-progress-gradient)",animationDuration:`${t.ttl}ms`}),h=EE(t.icon??"\u{1F514}",14);return D`
|
|
836
836
|
<div
|
|
837
837
|
class="syntro-toast-enter"
|
|
838
838
|
style=${r}
|
|
839
|
-
@mouseenter=${te(this,
|
|
840
|
-
@mouseleave=${te(this,
|
|
839
|
+
@mouseenter=${te(this,vt,Tv)}
|
|
840
|
+
@mouseleave=${te(this,vt,Iv)}
|
|
841
841
|
>
|
|
842
842
|
<div
|
|
843
843
|
style=${i}
|
|
844
|
-
@click=${()=>te(this,
|
|
844
|
+
@click=${()=>te(this,vt,Rv).call(this,t)}
|
|
845
845
|
>
|
|
846
846
|
<div
|
|
847
847
|
style=${s}
|
|
@@ -857,7 +857,7 @@ ${r}
|
|
|
857
857
|
type="button"
|
|
858
858
|
aria-label="Dismiss notification"
|
|
859
859
|
style=${c}
|
|
860
|
-
@click=${g=>te(this,
|
|
860
|
+
@click=${g=>te(this,vt,Av).call(this,t.id,g)}
|
|
861
861
|
>×</button>
|
|
862
862
|
</div>
|
|
863
863
|
|
|
@@ -868,7 +868,7 @@ ${r}
|
|
|
868
868
|
></div>
|
|
869
869
|
</div>
|
|
870
870
|
</div>
|
|
871
|
-
`},
|
|
871
|
+
`},Ws.properties={notifications:{attribute:!1},position:{type:String}},Ws.styles=tr`
|
|
872
872
|
@keyframes syntro-toast-slide-in {
|
|
873
873
|
from { opacity: 0; transform: translateY(12px); }
|
|
874
874
|
to { opacity: 1; transform: translateY(0); }
|
|
@@ -886,15 +886,15 @@ ${r}
|
|
|
886
886
|
.syntro-toast-progress.paused {
|
|
887
887
|
animation-play-state: paused;
|
|
888
888
|
}
|
|
889
|
-
`;customElements.define("syntro-toast-stack",Vs);var Nu=async(n,e)=>{let t=[];if(e.applyAction)for(let r of n.actions){let i=await e.applyAction(r);t.push(i)}return{cleanup:async()=>{for(let r=t.length-1;r>=0;r--)try{await t[r].revert()}catch{}}}},Lu=async(n,e)=>{let t=[];if(e.applyAction){let r=n.actions.map(i=>e.applyAction(i));if(n.waitFor==="any"){let i=await Promise.race(r);t.push(i);let s=await Promise.allSettled(r);for(let o of s)o.status==="fulfilled"&&o.value!==i&&t.push(o.value)}else{let i=await Promise.all(r);t.push(...i)}}return{cleanup:async()=>{for(let r of t)try{await r.revert()}catch{}}}},Fu=async(n,e)=>{let t,r,i=!1,s={cleanup:()=>{i=!0,r&&clearTimeout(r),t&&t()}};return n.event&&e.subscribeEvent?await new Promise(o=>{t=e.subscribeEvent(n.event,()=>{i||o()}),n.durationMs!==void 0&&(r=setTimeout(()=>{i||o()},n.durationMs))}):n.durationMs!==void 0&&await new Promise(o=>{r=setTimeout(()=>{i||o()},n.durationMs)}),s};var Za=class{constructor(){this.executors=new Map;for(let{kind:e,executor:t}of yc)this.registerCore(e,t);for(let{kind:e,executor:t}of Hg)this.registerCore(e,t);this.registerCore("core:mountWidget",async()=>{throw new Error("core:mountWidget must be handled by ActionEngine")}),this.registerCore("core:sequence",Nu),this.registerCore("core:parallel",Lu),this.registerCore("core:wait",Fu)}registerCore(e,t,r){this.executors.set(e,{kind:e,executor:t,schema:r,source:"core",isBuiltIn:!0})}register(e,t,r,i="custom",s=!1){if(this.executors.has(e)){if(this.executors.get(e).isBuiltIn)return;console.warn(`[ExecutorRegistry] Overriding executor for kind: ${e} (source: ${i})`)}console.log(`[ExecutorRegistry] Registered executor: ${e} (source: ${i})`),this.executors.set(e,{kind:e,executor:t,schema:r,source:i,isBuiltIn:s})}unregister(e){let t=this.executors.get(e);return t?t.isBuiltIn?(console.warn(`[ExecutorRegistry] Cannot unregister built-in executor: ${e}`),!1):(this.executors.delete(e),!0):!1}unregisterBySource(e){for(let[t,r]of this.executors.entries())r.source===e&&this.executors.delete(t)}get(e){return this.executors.get(e)?.executor}getRegistration(e){return this.executors.get(e)}has(e){return this.executors.has(e)}validate(e){let t=[];if(!e||typeof e!="object")return t.push({code:"INVALID_ACTION",message:"Action must be an object"}),{valid:!1,errors:t,warnings:[]};let{kind:r}=e;if(!r||typeof r!="string")return t.push({code:"MISSING_KIND",message:"Action must have a 'kind' property"}),{valid:!1,errors:t,warnings:[]};let i=this.executors.get(r);if(!i)return t.push({code:"UNKNOWN_KIND",message:`Unknown action kind: ${r}`,field:"kind"}),{valid:!1,errors:t,warnings:[]};if(i.schema){let s=i.schema.safeParse(e);if(!s.success){for(let o of s.error.issues)t.push({code:"SCHEMA_VALIDATION_ERROR",message:o.message,field:o.path.join(".")});return{valid:!1,errors:t,warnings:[]}}}return{valid:!0,errors:[],warnings:[]}}list(){return Array.from(this.executors.keys())}listRegistrations(){return Array.from(this.executors.values())}getBuiltInKinds(){return Array.from(this.executors.entries()).filter(([,e])=>e.isBuiltIn).map(([e])=>e)}getCustomKinds(){return Array.from(this.executors.entries()).filter(([,e])=>!e.isBuiltIn).map(([e])=>e)}},tn=new Za;function xE(n){return tn.get(n)}function Du(n){return tn.has(n)}function Hu(n,e,t){!n.content||typeof n.content!="string"?e.push({code:"MISSING_CONTENT",message:"Badge action requires 'content' property",field:"content"}):n.content.length>100&&t.push({code:"LONG_BADGE_CONTENT",message:"Badge content is quite long",suggestion:"Keep badge content short (under 100 characters)"})}function Bu(n,e,t){if(!n.content||typeof n.content!="object"){e.push({code:"MISSING_CONTENT",message:"Tooltip action requires 'content' object",field:"content"});return}(!n.content.body||typeof n.content.body!="string")&&e.push({code:"MISSING_BODY",message:"Tooltip content requires 'body' property",field:"content.body"})}function Vu(n,e,t){!n.html||typeof n.html!="string"?e.push({code:"MISSING_HTML",message:"insertHtml action requires 'html' property",field:"html"}):n.html.length>Ga&&e.push({code:"HTML_TOO_LONG",message:`HTML content exceeds maximum length of ${Ga}`,field:"html"});let r=["before","after","prepend","append","replace"];(!n.position||!r.includes(n.position))&&e.push({code:"INVALID_POSITION",message:`Position must be one of: ${r.join(", ")}`,field:"position"})}function Wu(n,e,t){(n.text===void 0||n.text===null)&&e.push({code:"MISSING_TEXT",message:"setText action requires 'text' property",field:"text"})}function ju(n,e,t){!n.attr||typeof n.attr!="string"?e.push({code:"MISSING_ATTR",message:"setAttr action requires 'attr' property",field:"attr"}):(Ju.has(n.attr.toLowerCase())||n.attr.toLowerCase().startsWith("on"))&&e.push({code:"DANGEROUS_ATTR",message:`Event handler attributes are not allowed: ${n.attr}`,field:"attr"}),(n.value===void 0||n.value===null)&&e.push({code:"MISSING_VALUE",message:"setAttr action requires 'value' property",field:"value"})}function Uu(n,e,t){!n.className||typeof n.className!="string"?e.push({code:"MISSING_CLASS_NAME",message:"Class action requires 'className' property",field:"className"}):/^[a-zA-Z_-][a-zA-Z0-9_-]*$/.test(n.className)||t.push({code:"INVALID_CLASS_NAME",message:"Class name contains unusual characters",suggestion:"Use alphanumeric characters, hyphens, and underscores"})}function zu(n,e,t){if(!n.styles||typeof n.styles!="object")e.push({code:"MISSING_STYLES",message:"setStyle action requires 'styles' object",field:"styles"});else{let r=Object.keys(n.styles).length;r>Ka&&e.push({code:"TOO_MANY_STYLES",message:`Too many styles (${r}). Maximum is ${Ka}`,field:"styles"});for(let[i,s]of Object.entries(n.styles))typeof s=="string"&&s.includes("expression(")&&e.push({code:"DANGEROUS_STYLE",message:`Style expressions are not allowed: ${i}`,field:`styles.${i}`})}}function qu(n,e,t){(!n.slot||typeof n.slot!="string")&&e.push({code:"MISSING_SLOT",message:"mountWidget action requires 'slot' property",field:"slot"}),!n.widget||typeof n.widget!="object"?e.push({code:"MISSING_WIDGET",message:"mountWidget action requires 'widget' object",field:"widget"}):(!n.widget.widgetId||typeof n.widget.widgetId!="string")&&e.push({code:"MISSING_WIDGET_ID",message:"Widget must have a 'widgetId' property",field:"widget.widgetId"})}function Zu(n,e,t){n.durationMs===void 0&&!n.event&&e.push({code:"MISSING_WAIT_CONFIG",message:"wait action requires either 'durationMs' or 'event' property"}),n.durationMs!==void 0&&n.durationMs<0&&e.push({code:"INVALID_DURATION",message:"durationMs must be a positive number",field:"durationMs"}),n.event!==void 0&&typeof n.event!="string"&&e.push({code:"INVALID_EVENT",message:"event must be a string",field:"event"})}function Gu(n,e,t){if(!n.actions||!Array.isArray(n.actions)){e.push({code:"MISSING_ACTIONS",message:"sequence action requires 'actions' array",field:"actions"});return}n.actions.length===0&&t.push({code:"EMPTY_SEQUENCE",message:"sequence has no actions",suggestion:"Add at least one action to the sequence"});for(let r=0;r<n.actions.length;r++){let i=Bt(n.actions[r]);for(let s of i.errors)e.push({...s,field:`actions[${r}]${s.field?`.${s.field}`:""}`});for(let s of i.warnings)t.push(s)}}function Ku(n,e,t){if(!n.actions||!Array.isArray(n.actions)){e.push({code:"MISSING_ACTIONS",message:"parallel action requires 'actions' array",field:"actions"});return}n.actions.length===0&&t.push({code:"EMPTY_PARALLEL",message:"parallel has no actions",suggestion:"Add at least one action to the parallel group"}),n.waitFor&&!["all","any"].includes(n.waitFor)&&e.push({code:"INVALID_WAIT_FOR",message:"waitFor must be 'all' or 'any'",field:"waitFor"});for(let r=0;r<n.actions.length;r++){let i=Bt(n.actions[r]);for(let s of i.errors)e.push({...s,field:`actions[${r}]${s.field?`.${s.field}`:""}`});for(let s of i.warnings)t.push(s)}}function Yu(n,e,t){if(!n.url||typeof n.url!="string")e.push({code:"MISSING_URL",message:"navigate action requires 'url' property",field:"url"});else{let r=n.url.trim().toLowerCase();r.startsWith("javascript:")&&e.push({code:"DANGEROUS_URL",message:"javascript: URLs are not allowed",field:"url"}),r.startsWith("data:")&&t.push({code:"DATA_URL",message:"data: URLs may have limited support",suggestion:"Consider using a regular URL instead"})}}function Xu(n,e,t){if(!n.content||typeof n.content!="object"){e.push({code:"MISSING_CONTENT",message:"Modal action requires 'content' object",field:"content"});return}if((!n.content.body||typeof n.content.body!="string")&&e.push({code:"MISSING_BODY",message:"Modal content requires 'body' property",field:"content.body"}),n.size&&!["sm","md","lg"].includes(n.size)&&e.push({code:"INVALID_SIZE",message:"Modal size must be 'sm', 'md', or 'lg'",field:"size"}),n.ctaButtons)if(!Array.isArray(n.ctaButtons))e.push({code:"INVALID_CTA_BUTTONS",message:"ctaButtons must be an array",field:"ctaButtons"});else for(let r=0;r<n.ctaButtons.length;r++){let i=n.ctaButtons[r];(!i.label||typeof i.label!="string")&&e.push({code:"MISSING_BUTTON_LABEL",message:`CTA button at index ${r} requires 'label' property`,field:`ctaButtons[${r}].label`}),(!i.actionId||typeof i.actionId!="string")&&e.push({code:"MISSING_BUTTON_ACTION_ID",message:`CTA button at index ${r} requires 'actionId' property`,field:`ctaButtons[${r}].actionId`})}}function Qu(n,e,t){if((!n.tourId||typeof n.tourId!="string")&&e.push({code:"MISSING_TOUR_ID",message:"Tour action requires 'tourId' property",field:"tourId"}),!n.steps||!Array.isArray(n.steps)){e.push({code:"MISSING_STEPS",message:"Tour action requires 'steps' array",field:"steps"});return}n.steps.length===0&&e.push({code:"EMPTY_STEPS",message:"Tour must have at least one step",field:"steps"});let r=new Set;for(let i=0;i<n.steps.length;i++){let s=n.steps[i];if(!s.id||typeof s.id!="string"?e.push({code:"MISSING_STEP_ID",message:`Step at index ${i} requires 'id' property`,field:`steps[${i}].id`}):(r.has(s.id)&&e.push({code:"DUPLICATE_STEP_ID",message:`Duplicate step ID: ${s.id}`,field:`steps[${i}].id`}),r.add(s.id)),!s.action)e.push({code:"MISSING_STEP_ACTION",message:`Step at index ${i} requires 'action' property`,field:`steps[${i}].action`});else{let o=Bt(s.action);for(let a of o.errors)e.push({...a,field:`steps[${i}].action${a.field?`.${a.field}`:""}`});for(let a of o.warnings)t.push(a)}if(s.onAction)for(let[o,a]of Object.entries(s.onAction))a!=="end"&&!n.steps.some(l=>l.id===a)&&t.push({code:"UNKNOWN_TARGET_STEP",message:`Step "${s.id}" references unknown target step: ${a}`,suggestion:`Make sure step "${a}" exists in the tour`})}}var Ju=new Set(["onclick","onerror","onload","onmouseover","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"]),Ga=5e4,Ka=50;function Bt(n){let e=[],t=[];if(!n||typeof n!="object")return e.push({code:"INVALID_ACTION",message:"Action must be an object"}),{valid:!1,errors:e,warnings:t};let{kind:r}=n;if(!r||typeof r!="string")return e.push({code:"MISSING_KIND",message:"Action must have a 'kind' property"}),{valid:!1,errors:e,warnings:t};if(!Du(r)&&r!=="core:mountWidget"){let i=tn.list();return console.error(`[ActionValidation] Unknown action kind: "${r}". Registered kinds (${i.length}): [${i.join(", ")}]. This usually means the app that provides "${r}" hasn't been activated yet, or the executor was never registered in ExecutorRegistry.`),e.push({code:"UNKNOWN_KIND",message:`Unknown action kind: ${r}`,field:"kind"}),{valid:!1,errors:e,warnings:t}}switch(r){case"overlays:highlight":case"overlays:pulse":case"navigation:scrollTo":nn(n,e,t);break;case"overlays:badge":nn(n,e,t),Hu(n,e,t);break;case"overlays:tooltip":nn(n,e,t),Bu(n,e,t);break;case"overlays:modal":Xu(n,e,t);break;case"content:insertHtml":nn(n,e,t),Vu(n,e,t);break;case"content:setText":nn(n,e,t),Wu(n,e,t);break;case"content:setAttr":nn(n,e,t),ju(n,e,t);break;case"content:addClass":case"content:removeClass":nn(n,e,t),Uu(n,e,t);break;case"content:setStyle":nn(n,e,t),zu(n,e,t);break;case"core:mountWidget":qu(n,e,t);break;case"core:wait":Zu(n,e,t);break;case"core:sequence":Gu(n,e,t);break;case"core:parallel":Ku(n,e,t);break;case"overlays:tour":Qu(n,e,t);break;case"navigation:navigate":Yu(n,e,t);break}return{valid:e.length===0,errors:e,warnings:t}}function nn(n,e,t){let r=n.anchorId;if(!r||typeof r!="object"){e.push({code:"MISSING_ANCHOR_ID",message:"Action requires an 'anchorId' object with a 'selector' string",field:"anchorId"});return}if(!r.selector||typeof r.selector!="string"?e.push({code:"MISSING_ANCHOR_SELECTOR",message:"anchorId requires a 'selector' string",field:"anchorId.selector"}):r.selector.length>200&&t.push({code:"LONG_ANCHOR_ID",message:"Anchor selector is unusually long",suggestion:"Consider using a shorter, more descriptive selector"}),r.route===void 0||r.route===null)e.push({code:"MISSING_ANCHOR_ROUTE",message:`anchorId requires a 'route' (string or array of strings). Use "**" for all routes.`,field:"anchorId.route"});else{let i=Array.isArray(r.route)?r.route:[r.route];for(let s of i)if(typeof s!="string"){e.push({code:"INVALID_ANCHOR_ROUTE",message:"anchorId.route must be a string or array of strings",field:"anchorId.route"});break}}}function Ya(n){let e=[],t=[];if(!Array.isArray(n))return console.error("[ActionValidation] validateActions called with non-array:",typeof n),e.push({code:"INVALID_ACTIONS",message:"Actions must be an array"}),{valid:!1,errors:e,warnings:t};for(let r=0;r<n.length;r++){let i=Bt(n[r]);if(!i.valid){let s=n[r];console.error(`[ActionValidation] Action [${r}] failed validation:`,`kind="${s?.kind??"undefined"}"`,i.errors.map(o=>`${o.code}: ${o.message}`).join("; "),s)}for(let s of i.errors)e.push({...s,field:s.field?`[${r}].${s.field}`:`[${r}]`});for(let s of i.warnings)t.push({...s,suggestion:s.suggestion?`Action ${r}: ${s.suggestion}`:void 0})}return e.length>0&&console.error(`[ActionValidation] Batch validation failed: ${e.length} error(s) in ${n.length} action(s).`,e.map(r=>`${r.field??"?"}: ${r.message}`).join(" | ")),{valid:e.length===0,errors:e,warnings:t}}var wE=0;function ed(n){let{overlayRoot:e,eventBus:t,surfaces:r,anchorResolver:i,waitForAnchor:s,adaptiveId:o,executorRegistry:a=tn,subscribeNavigation:l,runtime:c}=n,u=new Map,d=new Map;function h(){return`action-${++wE}`}function g(x,R){t&&t.publish(x,R)}function v(){return{overlayRoot:e,resolveAnchor:i,waitForAnchor:s,generateId:h,publishEvent:g,adaptiveId:o,applyAction:k,subscribeEvent:t?(x,R)=>t.subscribe({names:[x]},I=>R(I.props)):void 0,subscribeNavigation:l}}async function f(x,R){if(!r)throw new Error("Surfaces provider required for core:mountWidget actions");let I=r.mount(x.slot,{type:"widget",widgetId:x.widget.widgetId,config:x.widget.props},{priority:x.widget.priority});return R.publishEvent("action.applied",{id:R.generateId(),kind:"core:mountWidget",slot:x.slot,widgetId:x.widget.widgetId}),{cleanup:()=>{I.unmount()},updateFn:O=>{if("widget"in O&&O.widget){let P=O.widget;P.props&&I.update({type:"widget",widgetId:x.widget.widgetId,config:P.props})}}}}async function m(x,R){if(x.kind==="core:mountWidget")return f(x,R);let I=a.get(x.kind);if(!I){let O="list"in a?a.list():"(list unavailable)";throw console.error(`[ActionEngine] No executor for kind="${x.kind}".`,`Registered: [${O}]`),new Error(`No executor for action kind: ${x.kind}`)}return I(x,R)}function y(x,R,I,O){if(!c)return;let P=[],G=!1,L=async()=>{if(G)return;let F=u.get(x);if(F){G=!0;try{let A=c.evaluateSync(I).value;if(F.state==="applied"&&!A){try{await F.cleanup()}catch(H){console.error(`[ActionEngine] Error reverting conditional action ${x}:`,H)}F.state="deferred",F.cleanup=()=>{},F.updateFn=void 0,g("action.deferred",{id:x,kind:R.kind})}else if(F.state==="deferred"&&A)try{let H=v(),M=await m(R,H);F.state="applied",F.cleanup=M.cleanup,F.updateFn=M.updateFn,F.appliedTs=Date.now()}catch(H){console.error(`[ActionEngine] Error applying deferred action ${x}:`,H),F.state="failed"}}finally{G=!1}}};c.context&&P.push(c.context.subscribe(L)),c.accumulator&&P.push(c.accumulator.subscribe(L)),c.sessionMetrics&&P.push(c.sessionMetrics.subscribe(L)),c.events&&P.push(c.events.subscribe(L)),d.set(x,P)}async function k(x){let R=Bt(x);if(!R.valid){let Z=R.errors.map(A=>A.message).join("; ");throw console.error(`[ActionEngine] Validation failed for action kind="${x?.kind}":`,Z,x),new Error(`Action validation failed: ${Z}`)}let I=h(),O=x.triggerWhen;if(O&&c&&!c.evaluateSync(O).value){let A={id:I,action:x,adaptiveId:o,appliedTs:Date.now(),state:"deferred",cleanup:()=>{}};u.set(I,A);let H={id:I,action:x,async revert(){let M=u.get(I);if(!M)return;let V=d.get(I);if(V){for(let de of V)de();d.delete(I)}M.state="reverted",u.delete(I)},isApplied(){return u.get(I)?.state==="applied"},async update(M){let V=u.get(I);if(!V||V.state!=="applied")throw new Error("Cannot update action that is not applied");if(V.updateFn)await V.updateFn(M);else throw new Error(`Action kind ${x.kind} does not support updates`)},getState(){return u.get(I)?.state??"reverted"}};return y(I,x,O,H),H}let P=v(),G=await m(x,P),L={id:I,action:x,adaptiveId:o,appliedTs:Date.now(),state:"applied",cleanup:G.cleanup,updateFn:G.updateFn};u.set(I,L);let F={id:I,action:x,async revert(){let Z=u.get(I);if(!Z||Z.state!=="applied")return;let A=d.get(I);if(A){for(let H of A)H();d.delete(I)}try{await Z.cleanup(),Z.state="reverted",g("action.reverted",{id:I,kind:x.kind})}catch(H){console.warn(`[ActionEngine] Cleanup error for ${x.kind} (${I}), ignoring:`,H),Z.state="reverted",g("action.reverted",{id:I,kind:x.kind})}finally{u.delete(I)}},isApplied(){return u.get(I)?.state==="applied"},async update(Z){let A=u.get(I);if(!A||A.state!=="applied")throw new Error("Cannot update action that is not applied");if(A.updateFn)await A.updateFn(Z);else throw new Error(`Action kind ${x.kind} does not support updates`)},getState(){return u.get(I)?.state??"reverted"}};return O&&c&&y(I,x,O,F),F}async function _(x){console.log(`[ActionEngine] applyBatch: ${x.length} action(s)`,x.map(L=>L.kind).join(", "));let R=Ya(x);if(!R.valid){let L=R.errors.map(F=>F.message).join("; ");throw console.error(`[ActionEngine] Batch validation FAILED for ${x.length} action(s):`,L,`
|
|
890
|
-
Actions:`,
|
|
891
|
-
`)),new Error(`Batch validation failed: ${L}`)}let I=h(),O=[],P=[];try{let L=await Promise.allSettled(x.map(Z=>k(Z))),F=[];for(let Z of L)Z.status==="fulfilled"?(O.push(Z.value),P.push(Z.value)):F.push(Z.reason instanceof Error?Z.reason:new Error(String(Z.reason)));if(F.length>0&&P.length===0)throw F[0];F.length>0&&console.warn(`[ActionEngine] ${F.length}/${x.length} action(s) failed in batch:`,F.map(Z=>Z.message).join("; "))}catch(L){console.error(`[ActionEngine] Batch apply FAILED. Successfully applied: ${P.length}. Rolling back...`,L);for(let F of P)try{await F.revert()}catch{}throw L}return{id:I,handles:O,async revertAll(){for(let L=O.length-1;L>=0;L--)try{await O[L].revert()}catch(F){console.error(`[ActionEngine] Error reverting action ${O[L].id}:`,F)}},isApplied(){return O.every(L=>L.isApplied())}}}function b(x){return Bt(x)}function w(){return Array.from(u.values()).map(x=>({id:x.id,action:x.action,adaptiveId:x.adaptiveId,appliedTs:x.appliedTs,state:x.state}))}async function E(){for(let R of d.values())for(let I of R)try{I()}catch{}d.clear();let x=[];for(let R of u.values())if(R.state==="applied")try{let I=R.cleanup();I&&typeof I.then=="function"&&x.push(I.catch(O=>{console.error("[ActionEngine] Error during async cleanup:",O)}))}catch(I){console.error("[ActionEngine] Error during cleanup:",I)}u.clear(),x.length>0&&await Promise.all(x)}return{apply:k,applyBatch:_,validate:b,getActive:w,destroy:E}}var p={};tx(p,{BRAND:()=>GE,DIRTY:()=>br,EMPTY_PATH:()=>CE,INVALID:()=>ne,NEVER:()=>M1,OK:()=>Ze,ParseStatus:()=>Ve,Schema:()=>ae,ZodAny:()=>On,ZodArray:()=>an,ZodBigInt:()=>xr,ZodBoolean:()=>wr,ZodBranded:()=>js,ZodCatch:()=>Pr,ZodDate:()=>kr,ZodDefault:()=>Mr,ZodDiscriminatedUnion:()=>Ja,ZodEffects:()=>xt,ZodEnum:()=>Ir,ZodError:()=>rt,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>tl,ZodIntersection:()=>Ar,ZodIssueCode:()=>N,ZodLazy:()=>Rr,ZodLiteral:()=>Tr,ZodMap:()=>Ci,ZodNaN:()=>Ri,ZodNativeEnum:()=>$r,ZodNever:()=>Lt,ZodNull:()=>Er,ZodNullable:()=>jt,ZodNumber:()=>_r,ZodObject:()=>it,ZodOptional:()=>bt,ZodParsedType:()=>q,ZodPipeline:()=>Us,ZodPromise:()=>Nn,ZodReadonly:()=>Or,ZodRecord:()=>el,ZodSchema:()=>ae,ZodSet:()=>Ai,ZodString:()=>Pn,ZodSymbol:()=>Si,ZodTransformer:()=>xt,ZodTuple:()=>Wt,ZodType:()=>ae,ZodUndefined:()=>Sr,ZodUnion:()=>Cr,ZodUnknown:()=>on,ZodVoid:()=>Ei,addIssueToContext:()=>B,any:()=>r1,array:()=>a1,bigint:()=>QE,boolean:()=>Fv,coerce:()=>$1,custom:()=>Ov,date:()=>JE,datetimeRegex:()=>Mv,defaultErrorMap:()=>rn,discriminatedUnion:()=>d1,effect:()=>k1,enum:()=>_1,function:()=>v1,getErrorMap:()=>xi,getParsedType:()=>Vt,instanceof:()=>YE,intersection:()=>p1,isAborted:()=>Xa,isAsync:()=>wi,isDirty:()=>Qa,isValid:()=>Mn,late:()=>KE,lazy:()=>y1,literal:()=>b1,makeIssue:()=>Ws,map:()=>g1,nan:()=>XE,nativeEnum:()=>x1,never:()=>s1,null:()=>n1,nullable:()=>E1,number:()=>Lv,object:()=>l1,objectUtil:()=>td,oboolean:()=>I1,onumber:()=>T1,optional:()=>S1,ostring:()=>R1,pipeline:()=>A1,preprocess:()=>C1,promise:()=>w1,quotelessJson:()=>kE,record:()=>f1,set:()=>m1,setErrorMap:()=>EE,strictObject:()=>c1,string:()=>Nv,symbol:()=>e1,transformer:()=>k1,tuple:()=>h1,undefined:()=>t1,union:()=>u1,unknown:()=>i1,util:()=>le,void:()=>o1});var le;(function(n){n.assertEqual=i=>{};function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{let s={};for(let o of i)s[o]=o;return s},n.getValidEnumValues=i=>{let s=n.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of s)o[a]=i[a];return n.objectValues(o)},n.objectValues=i=>n.objectKeys(i).map(function(s){return i[s]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},n.find=(i,s)=>{for(let o of i)if(s(o))return o},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}n.joinValues=r,n.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(le||(le={}));var td;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(td||(td={}));var q=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Vt=n=>{switch(typeof n){case"undefined":return q.undefined;case"string":return q.string;case"number":return Number.isNaN(n)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(n)?q.array:n===null?q.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?q.promise:typeof Map<"u"&&n instanceof Map?q.map:typeof Set<"u"&&n instanceof Set?q.set:typeof Date<"u"&&n instanceof Date?q.date:q.object;default:return q.unknown}};var N=le.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),kE=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),rt=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(s){return s.message},r={_errors:[]},i=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let a=r,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];t[s]=t[s]||[],t[s].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};rt.create=n=>new rt(n);var SE=(n,e)=>{let t;switch(n.code){case N.invalid_type:n.received===q.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case N.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,le.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:t=`Unrecognized key(s) in object: ${le.joinValues(n.keys,", ")}`;break;case N.invalid_union:t="Invalid input";break;case N.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${le.joinValues(n.options)}`;break;case N.invalid_enum_value:t=`Invalid enum value. Expected ${le.joinValues(n.options)}, received '${n.received}'`;break;case N.invalid_arguments:t="Invalid function arguments";break;case N.invalid_return_type:t="Invalid function return type";break;case N.invalid_date:t="Invalid date";break;case N.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:le.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case N.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case N.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case N.custom:t="Invalid input";break;case N.invalid_intersection_types:t="Intersection results could not be merged";break;case N.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case N.not_finite:t="Number must be finite";break;default:t=e.defaultError,le.assertNever(n)}return{message:t}},rn=SE;var Av=rn;function EE(n){Av=n}function xi(){return Av}var Ws=n=>{let{data:e,path:t,errorMaps:r,issueData:i}=n,s=[...t,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)a=c(o,{data:e,defaultError:a}).message;return{...i,path:s,message:a}},CE=[];function B(n,e){let t=xi(),r=Ws({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===rn?void 0:rn].filter(i=>!!i)});n.common.issues.push(r)}var Ve=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let i of t){if(i.status==="aborted")return ne;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let i of t){let s=await i.key,o=await i.value;r.push({key:s,value:o})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return ne;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}},ne=Object.freeze({status:"aborted"}),br=n=>({status:"dirty",value:n}),Ze=n=>({status:"valid",value:n}),Xa=n=>n.status==="aborted",Qa=n=>n.status==="dirty",Mn=n=>n.status==="valid",wi=n=>typeof Promise<"u"&&n instanceof Promise;var Y;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(Y||(Y={}));var _t=class{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Rv=(n,e)=>{if(Mn(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new rt(n.common.issues);return this._error=t,this._error}}};function oe(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:i}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,a)=>{let{message:l}=n;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??t??a.defaultError}},description:i}}var ae=class{get description(){return this._def.description}_getType(e){return Vt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Vt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ve,ctx:{common:e.parent.common,data:e.data,parsedType:Vt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(wi(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vt(e)},i=this._parseSync({data:e,path:r.path,parent:r});return Rv(r,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vt(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Mn(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Mn(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vt(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(wi(i)?i:Promise.resolve(i));return Rv(r,s)}refine(e,t){let r=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,s)=>{let o=e(i),a=()=>s.addIssue({code:N.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof t=="function"?t(r,i):t),!1))}_refinement(e){return new xt({schema:this,typeName:re.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return bt.create(this,this._def)}nullable(){return jt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return an.create(this)}promise(){return Nn.create(this,this._def)}or(e){return Cr.create([this,e],this._def)}and(e){return Ar.create(this,e,this._def)}transform(e){return new xt({...oe(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Mr({...oe(this._def),innerType:this,defaultValue:t,typeName:re.ZodDefault})}brand(){return new js({typeName:re.ZodBranded,type:this,...oe(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Pr({...oe(this._def),innerType:this,catchValue:t,typeName:re.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Us.create(this,e)}readonly(){return Or.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},AE=/^c[^\s-]{8,}$/i,RE=/^[0-9a-z]+$/,TE=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IE=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,$E=/^[a-z0-9_-]{21}$/i,ME=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,PE=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,OE=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,NE="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",nd,LE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,FE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,DE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,HE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,BE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,VE=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Iv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",WE=new RegExp(`^${Iv}$`);function $v(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function jE(n){return new RegExp(`^${$v(n)}$`)}function Mv(n){let e=`${Iv}T${$v(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function UE(n,e){return!!((e==="v4"||!e)&&LE.test(n)||(e==="v6"||!e)&&DE.test(n))}function zE(n,e){if(!ME.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function qE(n,e){return!!((e==="v4"||!e)&&FE.test(n)||(e==="v6"||!e)&&HE.test(n))}var Pn=class n extends ae{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let s=this._getOrReturnCtx(e);return B(s,{code:N.invalid_type,expected:q.string,received:s.parsedType}),ne}let r=new Ve,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:N.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:N.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,a=e.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(e,i),o?B(i,{code:N.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&B(i,{code:N.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")OE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"email",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")nd||(nd=new RegExp(NE,"u")),nd.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"emoji",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")IE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"uuid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")$E.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"nanoid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")AE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"cuid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")RE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"cuid2",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")TE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"ulid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),B(i,{validation:"url",code:N.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"regex",code:N.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),B(i,{code:N.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),B(i,{code:N.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),B(i,{code:N.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Mv(s).test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:N.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?WE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:N.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?jE(s).test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:N.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?PE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"duration",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?UE(e.data,s.version)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"ip",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?zE(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"jwt",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?qE(e.data,s.version)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"cidr",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?BE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"base64",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?VE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"base64url",code:N.invalid_string,message:s.message}),r.dirty()):le.assertNever(s);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(i=>e.test(i),{validation:t,code:N.invalid_string,...Y.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Y.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Y.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Y.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Y.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Y.errToObj(t)})}nonempty(e){return this.min(1,Y.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Pn.create=n=>new Pn({checks:[],typeName:re.ZodString,coerce:n?.coerce??!1,...oe(n)});function ZE(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=t>r?t:r,s=Number.parseInt(n.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return s%o/10**i}var _r=class n extends ae{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==q.number){let s=this._getOrReturnCtx(e);return B(s,{code:N.invalid_type,expected:q.number,received:s.parsedType}),ne}let r,i=new Ve;for(let s of this._def.checks)s.kind==="int"?le.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:N.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),B(r,{code:N.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),B(r,{code:N.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?ZE(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),B(r,{code:N.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:N.not_finite,message:s.message}),i.dirty()):le.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Y.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&le.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};_r.create=n=>new _r({checks:[],typeName:re.ZodNumber,coerce:n?.coerce||!1,...oe(n)});var xr=class n extends ae{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==q.bigint)return this._getInvalidInput(e);let r,i=new Ve;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),B(r,{code:N.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),B(r,{code:N.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),B(r,{code:N.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):le.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return B(t,{code:N.invalid_type,expected:q.bigint,received:t.parsedType}),ne}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Y.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};xr.create=n=>new xr({checks:[],typeName:re.ZodBigInt,coerce:n?.coerce??!1,...oe(n)});var wr=class extends ae{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let r=this._getOrReturnCtx(e);return B(r,{code:N.invalid_type,expected:q.boolean,received:r.parsedType}),ne}return Ze(e.data)}};wr.create=n=>new wr({typeName:re.ZodBoolean,coerce:n?.coerce||!1,...oe(n)});var kr=class n extends ae{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let s=this._getOrReturnCtx(e);return B(s,{code:N.invalid_type,expected:q.date,received:s.parsedType}),ne}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return B(s,{code:N.invalid_date}),ne}let r=new Ve,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:N.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:N.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):le.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};kr.create=n=>new kr({checks:[],coerce:n?.coerce||!1,typeName:re.ZodDate,...oe(n)});var Si=class extends ae{_parse(e){if(this._getType(e)!==q.symbol){let r=this._getOrReturnCtx(e);return B(r,{code:N.invalid_type,expected:q.symbol,received:r.parsedType}),ne}return Ze(e.data)}};Si.create=n=>new Si({typeName:re.ZodSymbol,...oe(n)});var Sr=class extends ae{_parse(e){if(this._getType(e)!==q.undefined){let r=this._getOrReturnCtx(e);return B(r,{code:N.invalid_type,expected:q.undefined,received:r.parsedType}),ne}return Ze(e.data)}};Sr.create=n=>new Sr({typeName:re.ZodUndefined,...oe(n)});var Er=class extends ae{_parse(e){if(this._getType(e)!==q.null){let r=this._getOrReturnCtx(e);return B(r,{code:N.invalid_type,expected:q.null,received:r.parsedType}),ne}return Ze(e.data)}};Er.create=n=>new Er({typeName:re.ZodNull,...oe(n)});var On=class extends ae{constructor(){super(...arguments),this._any=!0}_parse(e){return Ze(e.data)}};On.create=n=>new On({typeName:re.ZodAny,...oe(n)});var on=class extends ae{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ze(e.data)}};on.create=n=>new on({typeName:re.ZodUnknown,...oe(n)});var Lt=class extends ae{_parse(e){let t=this._getOrReturnCtx(e);return B(t,{code:N.invalid_type,expected:q.never,received:t.parsedType}),ne}};Lt.create=n=>new Lt({typeName:re.ZodNever,...oe(n)});var Ei=class extends ae{_parse(e){if(this._getType(e)!==q.undefined){let r=this._getOrReturnCtx(e);return B(r,{code:N.invalid_type,expected:q.void,received:r.parsedType}),ne}return Ze(e.data)}};Ei.create=n=>new Ei({typeName:re.ZodVoid,...oe(n)});var an=class n extends ae{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==q.array)return B(t,{code:N.invalid_type,expected:q.array,received:t.parsedType}),ne;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(o||a)&&(B(t,{code:o?N.too_big:N.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(B(t,{code:N.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(B(t,{code:N.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>i.type._parseAsync(new _t(t,o,t.path,a)))).then(o=>Ve.mergeArray(r,o));let s=[...t.data].map((o,a)=>i.type._parseSync(new _t(t,o,t.path,a)));return Ve.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:Y.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:Y.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:Y.toString(t)}})}nonempty(e){return this.min(1,e)}};an.create=(n,e)=>new an({type:n,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...oe(e)});function ki(n){if(n instanceof it){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=bt.create(ki(r))}return new it({...n._def,shape:()=>e})}else return n instanceof an?new an({...n._def,type:ki(n.element)}):n instanceof bt?bt.create(ki(n.unwrap())):n instanceof jt?jt.create(ki(n.unwrap())):n instanceof Wt?Wt.create(n.items.map(e=>ki(e))):n}var it=class n extends ae{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=le.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==q.object){let c=this._getOrReturnCtx(e);return B(c,{code:N.invalid_type,expected:q.object,received:c.parsedType}),ne}let{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Lt&&this._def.unknownKeys==="strip"))for(let c in i.data)o.includes(c)||a.push(c);let l=[];for(let c of o){let u=s[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new _t(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Lt){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(B(i,{code:N.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new _t(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,h=await u.value;c.push({key:d,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>Ve.mergeObjectSync(r,c)):Ve.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let i=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:Y.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:re.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of le.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of le.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return ki(this)}partial(e){let t={};for(let r of le.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of le.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof bt;)s=s._def.innerType;t[r]=s}return new n({...this._def,shape:()=>t})}keyof(){return Pv(le.objectKeys(this.shape))}};it.create=(n,e)=>new it({shape:()=>n,unknownKeys:"strip",catchall:Lt.create(),typeName:re.ZodObject,...oe(e)});it.strictCreate=(n,e)=>new it({shape:()=>n,unknownKeys:"strict",catchall:Lt.create(),typeName:re.ZodObject,...oe(e)});it.lazycreate=(n,e)=>new it({shape:n,unknownKeys:"strip",catchall:Lt.create(),typeName:re.ZodObject,...oe(e)});var Cr=class extends ae{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function i(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new rt(a.ctx.common.issues));return B(t,{code:N.invalid_union,unionErrors:o}),ne}if(t.common.async)return Promise.all(r.map(async s=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let s,o=[];for(let l of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(l=>new rt(l));return B(t,{code:N.invalid_union,unionErrors:a}),ne}}get options(){return this._def.options}};Cr.create=(n,e)=>new Cr({options:n,typeName:re.ZodUnion,...oe(e)});var sn=n=>n instanceof Rr?sn(n.schema):n instanceof xt?sn(n.innerType()):n instanceof Tr?[n.value]:n instanceof Ir?n.options:n instanceof $r?le.objectValues(n.enum):n instanceof Mr?sn(n._def.innerType):n instanceof Sr?[void 0]:n instanceof Er?[null]:n instanceof bt?[void 0,...sn(n.unwrap())]:n instanceof jt?[null,...sn(n.unwrap())]:n instanceof js||n instanceof Or?sn(n.unwrap()):n instanceof Pr?sn(n._def.innerType):[],Ja=class n extends ae{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.object)return B(t,{code:N.invalid_type,expected:q.object,received:t.parsedType}),ne;let r=this.discriminator,i=t.data[r],s=this.optionsMap.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(B(t,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ne)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let s of t){let o=sn(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,s)}}return new n({typeName:re.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...oe(r)})}};function rd(n,e){let t=Vt(n),r=Vt(e);if(n===e)return{valid:!0,data:n};if(t===q.object&&r===q.object){let i=le.objectKeys(e),s=le.objectKeys(n).filter(a=>i.indexOf(a)!==-1),o={...n,...e};for(let a of s){let l=rd(n[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===q.array&&r===q.array){if(n.length!==e.length)return{valid:!1};let i=[];for(let s=0;s<n.length;s++){let o=n[s],a=e[s],l=rd(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===q.date&&r===q.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Ar=class extends ae{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(s,o)=>{if(Xa(s)||Xa(o))return ne;let a=rd(s.value,o.value);return a.valid?((Qa(s)||Qa(o))&&t.dirty(),{status:t.value,value:a.data}):(B(r,{code:N.invalid_intersection_types}),ne)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Ar.create=(n,e,t)=>new Ar({left:n,right:e,typeName:re.ZodIntersection,...oe(t)});var Wt=class n extends ae{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.array)return B(r,{code:N.invalid_type,expected:q.array,received:r.parsedType}),ne;if(r.data.length<this._def.items.length)return B(r,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&r.data.length>this._def.items.length&&(B(r,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...r.data].map((o,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new _t(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>Ve.mergeArray(t,o)):Ve.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};Wt.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Wt({items:n,typeName:re.ZodTuple,rest:null,...oe(e)})};var el=class n extends ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.object)return B(r,{code:N.invalid_type,expected:q.object,received:r.parsedType}),ne;let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in r.data)i.push({key:s._parse(new _t(r,a,r.path,a)),value:o._parse(new _t(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Ve.mergeObjectAsync(t,i):Ve.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof ae?new n({keyType:e,valueType:t,typeName:re.ZodRecord,...oe(r)}):new n({keyType:Pn.create(),valueType:e,typeName:re.ZodRecord,...oe(t)})}},Ci=class extends ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.map)return B(r,{code:N.invalid_type,expected:q.map,received:r.parsedType}),ne;let i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new _t(r,a,r.path,[c,"key"])),value:s._parse(new _t(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ne;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ne;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}}}};Ci.create=(n,e,t)=>new Ci({valueType:e,keyType:n,typeName:re.ZodMap,...oe(t)});var Ai=class n extends ae{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.set)return B(r,{code:N.invalid_type,expected:q.set,received:r.parsedType}),ne;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(B(r,{code:N.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(B(r,{code:N.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let s=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return ne;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}let a=[...r.data.values()].map((l,c)=>s._parse(new _t(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new n({...this._def,minSize:{value:e,message:Y.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:Y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ai.create=(n,e)=>new Ai({valueType:n,minSize:null,maxSize:null,typeName:re.ZodSet,...oe(e)});var tl=class n extends ae{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.function)return B(t,{code:N.invalid_type,expected:q.function,received:t.parsedType}),ne;function r(a,l){return Ws({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,xi(),rn].filter(c=>!!c),issueData:{code:N.invalid_arguments,argumentsError:l}})}function i(a,l){return Ws({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,xi(),rn].filter(c=>!!c),issueData:{code:N.invalid_return_type,returnTypeError:l}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Nn){let a=this;return Ze(async function(...l){let c=new rt([]),u=await a._def.args.parseAsync(l,s).catch(g=>{throw c.addIssue(r(l,g)),c}),d=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(d,s).catch(g=>{throw c.addIssue(i(d,g)),c})})}else{let a=this;return Ze(function(...l){let c=a._def.args.safeParse(l,s);if(!c.success)throw new rt([r(l,c.error)]);let u=Reflect.apply(o,this,c.data),d=a._def.returns.safeParse(u,s);if(!d.success)throw new rt([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:Wt.create(e).rest(on.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||Wt.create([]).rest(on.create()),returns:t||on.create(),typeName:re.ZodFunction,...oe(r)})}},Rr=class extends ae{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Rr.create=(n,e)=>new Rr({getter:n,typeName:re.ZodLazy,...oe(e)});var Tr=class extends ae{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return B(t,{received:t.data,code:N.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:e.data}}get value(){return this._def.value}};Tr.create=(n,e)=>new Tr({value:n,typeName:re.ZodLiteral,...oe(e)});function Pv(n,e){return new Ir({values:n,typeName:re.ZodEnum,...oe(e)})}var Ir=class n extends ae{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return B(t,{expected:le.joinValues(r),received:t.parsedType,code:N.invalid_type}),ne}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return B(t,{received:t.data,code:N.invalid_enum_value,options:r}),ne}return Ze(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Ir.create=Pv;var $r=class extends ae{_parse(e){let t=le.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==q.string&&r.parsedType!==q.number){let i=le.objectValues(t);return B(r,{expected:le.joinValues(i),received:r.parsedType,code:N.invalid_type}),ne}if(this._cache||(this._cache=new Set(le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=le.objectValues(t);return B(r,{received:r.data,code:N.invalid_enum_value,options:i}),ne}return Ze(e.data)}get enum(){return this._def.values}};$r.create=(n,e)=>new $r({values:n,typeName:re.ZodNativeEnum,...oe(e)});var Nn=class extends ae{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.promise&&t.common.async===!1)return B(t,{code:N.invalid_type,expected:q.promise,received:t.parsedType}),ne;let r=t.parsedType===q.promise?t.data:Promise.resolve(t.data);return Ze(r.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Nn.create=(n,e)=>new Nn({type:n,typeName:re.ZodPromise,...oe(e)});var xt=class extends ae{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{B(r,o),o.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return ne;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?ne:l.status==="dirty"?br(l.value):t.value==="dirty"?br(l.value):l});{if(t.value==="aborted")return ne;let a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?ne:a.status==="dirty"?br(a.value):t.value==="dirty"?br(a.value):a}}if(i.type==="refinement"){let o=a=>{let l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ne:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?ne:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Mn(o))return ne;let a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Mn(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):ne);le.assertNever(i)}};xt.create=(n,e,t)=>new xt({schema:n,typeName:re.ZodEffects,effect:e,...oe(t)});xt.createWithPreprocess=(n,e,t)=>new xt({schema:e,effect:{type:"preprocess",transform:n},typeName:re.ZodEffects,...oe(t)});var bt=class extends ae{_parse(e){return this._getType(e)===q.undefined?Ze(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};bt.create=(n,e)=>new bt({innerType:n,typeName:re.ZodOptional,...oe(e)});var jt=class extends ae{_parse(e){return this._getType(e)===q.null?Ze(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};jt.create=(n,e)=>new jt({innerType:n,typeName:re.ZodNullable,...oe(e)});var Mr=class extends ae{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===q.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Mr.create=(n,e)=>new Mr({innerType:n,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...oe(e)});var Pr=class extends ae{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return wi(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new rt(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new rt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Pr.create=(n,e)=>new Pr({innerType:n,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...oe(e)});var Ri=class extends ae{_parse(e){if(this._getType(e)!==q.nan){let r=this._getOrReturnCtx(e);return B(r,{code:N.invalid_type,expected:q.nan,received:r.parsedType}),ne}return{status:"valid",value:e.data}}};Ri.create=n=>new Ri({typeName:re.ZodNaN,...oe(n)});var GE=Symbol("zod_brand"),js=class extends ae{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Us=class n extends ae{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ne:s.status==="dirty"?(t.dirty(),br(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ne:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:re.ZodPipeline})}},Or=class extends ae{_parse(e){let t=this._def.innerType._parse(e),r=i=>(Mn(i)&&(i.value=Object.freeze(i.value)),i);return wi(t)?t.then(i=>r(i)):r(t)}unwrap(){return this._def.innerType}};Or.create=(n,e)=>new Or({innerType:n,typeName:re.ZodReadonly,...oe(e)});function Tv(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Ov(n,e={},t){return n?On.create().superRefine((r,i)=>{let s=n(r);if(s instanceof Promise)return s.then(o=>{if(!o){let a=Tv(e,r),l=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!s){let o=Tv(e,r),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):On.create()}var KE={object:it.lazycreate},re;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(re||(re={}));var YE=(n,e={message:`Input not instance of ${n.name}`})=>Ov(t=>t instanceof n,e),Nv=Pn.create,Lv=_r.create,XE=Ri.create,QE=xr.create,Fv=wr.create,JE=kr.create,e1=Si.create,t1=Sr.create,n1=Er.create,r1=On.create,i1=on.create,s1=Lt.create,o1=Ei.create,a1=an.create,l1=it.create,c1=it.strictCreate,u1=Cr.create,d1=Ja.create,p1=Ar.create,h1=Wt.create,f1=el.create,g1=Ci.create,m1=Ai.create,v1=tl.create,y1=Rr.create,b1=Tr.create,_1=Ir.create,x1=$r.create,w1=Nn.create,k1=xt.create,S1=bt.create,E1=jt.create,C1=xt.createWithPreprocess,A1=Us.create,R1=()=>Nv().optional(),T1=()=>Lv().optional(),I1=()=>Fv().optional(),$1={string:(n=>Pn.create({...n,coerce:!0})),number:(n=>_r.create({...n,coerce:!0})),boolean:(n=>wr.create({...n,coerce:!0})),bigint:(n=>xr.create({...n,coerce:!0})),date:(n=>kr.create({...n,coerce:!0}))};var M1=ne;var P1=p.object({selector:p.string(),route:p.union([p.string(),p.array(p.string())])}).strict(),Dv=["ui.click","ui.scroll","ui.input","ui.change","ui.submit","ui.hover","ui.idle","ui.scroll_thrash","ui.focus_bounce","nav.page_view","nav.page_leave","behavior.rage_click","behavior.hesitation","behavior.confusion"],Hv=p.enum(Dv).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),Bv=["time_on_page","page_views","scroll_depth"],Vv=p.enum(Bv).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");var id=p.object({type:p.literal("page_url"),url:p.string().describe('URL path to match (e.g. "/pricing", "/dashboard")')}).describe('Fires when the current page URL matches. Use for page-specific actions. Example: {"type": "page_url", "url": "/pricing"}'),sd=p.object({type:p.literal("route"),routeId:p.string().describe("Named route ID from the route filter")}).describe("Fires when the current route matches a named route ID."),od=p.object({type:p.literal("anchor_visible"),anchorId:p.string().describe("CSS selector of the anchor element"),state:p.enum(["visible","present","absent"]).describe('"visible" = in viewport, "present" = in DOM, "absent" = not in DOM')}).describe(`Fires based on a DOM element's visibility state. Example: {"type": "anchor_visible", "anchorId": "#cta-button", "state": "visible"}`),ad=p.object({type:p.literal("event_occurred"),eventName:p.string().describe('Event name (e.g. "ui.click", "$pageview")'),withinMs:p.number().optional().describe("Time window in ms. Omit = any time this session.")}).describe('Fires when a specific event has occurred during this session. Example: {"type": "event_occurred", "eventName": "ui.click", "withinMs": 5000}'),ld=p.object({type:p.literal("state_equals"),key:p.string().describe("Key in the SDK persistent state store (localStorage). Only valid for keys the host app explicitly sets via syntro.state.set()."),value:p.unknown().describe("Expected value to match against")}).describe("Checks the SDK persistent state store (localStorage). ONLY for host-app state set via syntro.state.set() \u2014 NOT for user attributes like region, device, or UTM params (those are handled by segment targeting). Do NOT use this for targeting. If you do not know the valid state keys, do not use this condition type."),cd=p.object({type:p.literal("viewport"),minWidth:p.number().optional().describe("Minimum viewport width in pixels"),maxWidth:p.number().optional().describe("Maximum viewport width in pixels"),minHeight:p.number().optional().describe("Minimum viewport height in pixels"),maxHeight:p.number().optional().describe("Maximum viewport height in pixels")}).describe('Fires based on viewport (screen) size. Use for responsive behavior. Example: {"type": "viewport", "minWidth": 768} \u2014 fires on tablet and larger.'),ud=p.object({type:p.literal("session_metric"),key:Vv,operator:p.enum(["gte","lte","eq","gt","lt"]),threshold:p.number().describe("Numeric threshold to compare against")}).describe('Fires when a session metric crosses a threshold. Valid keys: "time_on_page" (seconds), "page_views" (count), "scroll_depth" (0-100). Example: {"type": "session_metric", "key": "time_on_page", "operator": "gte", "threshold": 30}'),dd=p.object({type:p.literal("dismissed"),key:p.string().describe("Dismissal key (usually a tile or action ID)"),inverted:p.boolean().optional().describe("When true, fires if NOT dismissed (default behavior)")}).describe("Checks if an item has been dismissed by the user. Use with inverted: true to show only if not dismissed."),pd=p.object({type:p.literal("cooldown_active"),key:p.string().describe("Cooldown key"),inverted:p.boolean().optional().describe("When true, fires if cooldown is NOT active")}).describe("Checks if a cooldown timer is currently active. Use to prevent showing the same intervention too frequently."),hd=p.object({type:p.literal("frequency_limit"),key:p.string().describe("Frequency counter key"),limit:p.number().describe("Maximum allowed count"),inverted:p.boolean().optional().describe("When true, fires if limit NOT reached")}).describe("Checks if a frequency limit has been reached. Use to cap how many times an action fires per session."),zs=p.object({equals:p.union([p.string(),p.number(),p.boolean()]).optional(),contains:p.string().optional()}).describe("Match operator for counter filters. Exactly one of equals or contains must be specified."),qs=p.object({events:p.array(Hv).min(1).describe("Event names to count. Use values from the countable events enum."),match:p.record(p.string(),zs).optional().describe("Property filters. Keys are event prop names or element-chain fields (tag_name, $el_text, attr__*). All entries AND together.")}).describe("Defines what events to count. Registered as an accumulator predicate at config-load time."),fd=p.object({type:p.literal("event_count"),key:p.string().describe("Unique key for this counter (used for accumulator registration)"),operator:p.enum(["gte","lte","eq","gt","lt"]),count:p.number().int().min(0).describe("Target count threshold"),withinMs:p.number().positive().optional().describe("Time window in ms. Omit = count across entire session."),counter:qs.optional().describe("Inline counter definition. Defines what events to count.")}).describe('Fires when accumulated event count crosses a threshold. Most powerful trigger type. Example: {"type": "event_count", "key": "pricing-clicks", "operator": "gte", "count": 3, "counter": {"events": ["ui.click"], "match": {"attr__data-cta": {"contains": "pricing"}}}}'),Ln=p.discriminatedUnion("type",[id,sd,od,ad,ld,cd,ud,dd,pd,hd,fd]),Zs=p.object({conditions:p.array(Ln).describe("Array of conditions \u2014 ALL must match (AND logic) for this rule to fire."),value:p.unknown().describe("Value returned when all conditions match. For triggerWhen: true = fire the action.")}).describe("A single rule. ALL conditions must match (AND logic). Rules in a strategy are evaluated top-to-bottom \u2014 first rule where all conditions match wins and returns its value."),Gs=p.object({type:p.literal("rules"),rules:p.array(Zs).describe("Ordered list of rules. Evaluated top-to-bottom \u2014 first match wins."),default:p.unknown().describe("Fallback value when no rule matches. For triggerWhen: false = do not fire by default.")}).describe("Rule-based strategy. Evaluates rules top-to-bottom. First rule where ALL conditions match returns its value. If no rule matches, returns default. For triggerWhen: set value=true on matching rules, default=false."),Ks=p.object({type:p.literal("score"),field:p.string(),threshold:p.number(),above:p.unknown(),below:p.unknown()}).describe("Score-based strategy. Compares a field value against a threshold."),Ys=p.object({type:p.literal("model"),modelId:p.string(),inputs:p.array(p.string()),outputMapping:p.record(p.string(),p.unknown()),default:p.unknown()}).describe("ML model strategy. Sends inputs to a model and maps outputs."),Xs=p.object({type:p.literal("external"),endpoint:p.string(),method:p.enum(["GET","POST"]).optional(),default:p.unknown(),timeoutMs:p.number().optional()}).describe("External API strategy. Calls an endpoint to determine the value."),Qs=p.discriminatedUnion("type",[Gs,Ks,Ys,Xs]),nl=Qs.nullable().optional();var O1=p.object({events:p.array(p.string()),urlContains:p.string().optional(),props:p.record(p.union([p.string(),p.number(),p.boolean()])).optional()}),N1=p.object({title:p.string().optional(),body:p.string().optional(),icon:p.string().optional()}).nullable().optional();var Wv=p.object({include:p.array(p.string()).optional().describe("URL patterns where this tile appears. Supports *, **, :param wildcards. Use sparingly \u2014 mostly to isolate to specific webapp functionality. Omit to appear on all routes."),exclude:p.array(p.string()).optional().describe("URL patterns where this tile should NOT appear. Evaluated before include.")}),rl=p.object({routes:Wv,onlyIfPopulated:p.boolean().optional().describe("When true, tile is hidden if none of its props.actions[] have an active triggerWhen. Useful for tiles with all-deferred FAQ questions or nav tips. Default: false.")});function PN(n){return Ln.safeParse(n)}function ON(n){return Qs.safeParse(n)}function NN(n){return rl.safeParse(n)}var LN=[{defName:"matchOp",schema:zs},{defName:"counterDef",schema:qs},{defName:"activationConfig",schema:rl},{defName:"routeFilter",schema:Wv},{defName:"ruleStrategy",schema:Gs},{defName:"scoreStrategy",schema:Ks},{defName:"modelStrategy",schema:Ys},{defName:"externalStrategy",schema:Xs},{defName:"rule",schema:Zs},{defName:"condition",schema:Ln}];var gd=p.object({tileId:p.string(),itemId:p.string().optional()}).strict(),L1=p.object({on:p.string(),title:p.string(),body:p.string().optional(),icon:p.string().optional(),ttl:p.number().optional(),cooldown:p.number().optional(),deepLink:gd.optional()}).strict(),F1=p.object({id:p.string(),title:p.string().optional(),subtitle:p.string().optional(),icon:p.string().optional(),priority:p.number().optional(),widget:p.string(),props:p.record(p.unknown()).optional(),activation:rl.optional(),notifications:p.array(L1).optional()}).strict(),D1=p.object({position:p.enum(["left","right"]).optional(),layout:p.enum(["overlay","push"]).optional(),background:p.string().optional(),blur:p.string().optional(),border:p.string().optional(),width:p.string().optional(),transitionDuration:p.string().optional(),transitionEasing:p.string().optional(),transitionFade:p.string().optional()}),H1=p.object({background:p.string().optional(),backgroundHover:p.string().optional(),color:p.string().optional(),size:p.string().optional(),shadow:p.string().optional(),borderRadius:p.string().optional(),icon:p.string().optional()}),B1=p.object({background:p.string().optional(),backgroundHover:p.string().optional(),border:p.string().optional(),borderRadius:p.string().optional(),shadow:p.string().optional(),titleColor:p.string().optional(),textColor:p.string().optional(),iconBackground:p.string().optional(),iconShadow:p.string().optional(),headerPadding:p.string().optional(),bodyPadding:p.string().optional(),gap:p.string().optional()}),V1=p.object({background:p.string().optional(),textColor:p.string().optional(),titleColor:p.string().optional(),arrowColor:p.string().optional(),arrowSize:p.string().optional(),border:p.string().optional(),borderRadius:p.string().optional(),scrimOpacity:p.string().optional(),highlightRing:p.string().optional()}),W1=p.object({background:p.string().optional(),textColor:p.string().optional(),textSecondaryColor:p.string().optional(),border:p.string().optional(),borderRadius:p.string().optional(),successColor:p.string().optional(),warningColor:p.string().optional(),errorColor:p.string().optional(),iconBackground:p.string().optional(),progressGradient:p.string().optional()}),j1=p.object({background:p.string().optional(),backgroundHover:p.string().optional(),border:p.string().optional(),borderRadius:p.string().optional(),textColor:p.string().optional(),textSecondaryColor:p.string().optional(),itemDivider:p.string().optional(),itemGap:p.string().optional(),itemPadding:p.string().optional(),itemFontSize:p.string().optional(),bodyPadding:p.string().optional(),bodyFontSize:p.string().optional(),categoryPadding:p.string().optional(),categoryGap:p.string().optional(),categoryFontSize:p.string().optional(),searchBackground:p.string().optional(),searchColor:p.string().optional(),chevronColor:p.string().optional()}),U1=p.object({mode:p.enum(["dark","light"]).optional(),fontFamily:p.string().optional(),colorPrimary:p.string().optional(),colorPrimaryHover:p.string().optional(),borderRadius:p.string().optional(),canvas:D1.optional(),launcher:H1.optional(),tile:B1.optional(),overlay:V1.optional(),notification:W1.optional(),content:j1.optional()}).strict(),z1=p.object({enabled:p.boolean().optional(),label:p.string().optional(),position:p.string().optional(),animate:p.boolean().optional(),animationStyle:p.enum(["pulse","bounce","glow"]).optional(),notificationCount:p.number().optional()}).strict(),VN=p.object({schemaVersion:p.string().optional(),fetchedAt:p.string().datetime(),configVersion:p.string().optional(),canvasTitle:p.string().optional(),tiles:p.array(F1),actions:p.array(p.any()),theme:U1.optional(),launcher:z1.optional(),meta:p.object({verificationSteps:p.array(p.union([p.string(),p.object({text:p.string(),check:Ln.optional()})])).optional()}).passthrough().optional()}).strict();var Le={triggerWhen:nl},wt=p.object({selector:p.string(),route:p.union([p.string(),p.array(p.string())])}).strict(),jv=p.object({color:p.string().optional(),scrimOpacity:p.number().min(0).max(1).optional(),paddingPx:p.number().optional(),radiusPx:p.number().optional()}).strict(),Uv=p.enum(["top-left","top-right","bottom-left","bottom-right"]),zv=p.enum(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"]),vd=p.object({label:p.string(),actionId:p.string(),primary:p.boolean().optional()}).strict(),qv=p.object({title:p.string().optional(),body:p.string(),ctaButtons:p.array(vd).optional()}).strict(),Zv=p.object({title:p.string().optional(),body:p.string()}).strict(),Gv=p.enum(["before","after","prepend","append","replace"]),Kv=p.enum(["immediate","hover","click"]),Yv=p.object({widgetId:p.string(),props:p.record(p.unknown()).optional(),priority:p.number().optional()}).strict(),Xv=p.object({id:p.string(),action:p.any(),route:p.string().optional(),onAction:p.record(p.string()).optional()}).passthrough(),Qv=p.enum(["auto","smooth","instant"]),md=p.enum(["start","center","end","nearest"]),Jv=p.object({kind:p.literal("content:setText"),anchorId:wt,text:p.string(),label:p.string().optional()}).extend(Le).strict(),ey=p.object({kind:p.literal("content:setAttr"),anchorId:wt,attr:p.string(),value:p.string(),label:p.string().optional()}).extend(Le).strict(),ty=p.object({kind:p.literal("content:addClass"),anchorId:wt,className:p.string(),label:p.string().optional()}).extend(Le).strict(),ny=p.object({kind:p.literal("content:removeClass"),anchorId:wt,className:p.string(),label:p.string().optional()}).extend(Le).strict(),ry=p.object({kind:p.literal("content:setStyle"),anchorId:wt,styles:p.record(p.string()),label:p.string().optional()}).extend(Le).strict(),iy=p.object({kind:p.literal("content:insertHtml"),anchorId:wt,html:p.string(),position:Gv,deepLink:gd.optional(),label:p.string().optional()}).extend(Le).strict(),sy=p.object({kind:p.literal("overlays:highlight"),anchorId:wt,style:jv.optional(),duration:p.number().optional(),label:p.string().optional()}).extend(Le).strict(),oy=p.object({kind:p.literal("overlays:pulse"),anchorId:wt,duration:p.number().optional(),label:p.string().optional()}).extend(Le).strict(),ay=p.object({kind:p.literal("overlays:badge"),anchorId:wt,content:p.string(),position:Uv.optional(),label:p.string().optional()}).extend(Le).strict(),ly=p.object({kind:p.literal("overlays:tooltip"),anchorId:wt,content:qv,trigger:Kv.optional(),placement:zv.optional(),waitFor:p.string().optional(),label:p.string().optional()}).extend(Le).strict(),cy=p.object({kind:p.literal("overlays:modal"),content:Zv,size:p.enum(["sm","md","lg"]).optional(),blocking:p.boolean().optional(),scrim:p.object({opacity:p.number().min(0).max(1).optional()}).strict().optional(),dismiss:p.object({onEsc:p.boolean().optional(),closeButton:p.boolean().optional(),timeoutMs:p.number().min(0).optional()}).strict().optional(),ctaButtons:p.array(vd).optional(),waitFor:p.string().optional(),label:p.string().optional()}).extend(Le).strict(),uy=p.object({kind:p.literal("navigation:scrollTo"),anchorId:wt,behavior:Qv.optional(),block:md.optional(),inline:md.optional(),label:p.string().optional()}).extend(Le).strict(),dy=p.object({kind:p.literal("navigation:navigate"),url:p.string(),target:p.enum(["_self","_blank"]).optional(),label:p.string().optional()}).extend(Le).strict(),py=p.object({kind:p.literal("core:mountWidget"),slot:p.string(),widget:Yv,label:p.string().optional()}).extend(Le).strict(),hy=p.object({kind:p.literal("core:wait"),durationMs:p.number().min(0).optional(),event:p.string().optional(),label:p.string().optional()}).extend(Le).strict(),fy=p.object({kind:p.literal("core:sequence"),actions:p.array(p.any()),label:p.string().optional()}).extend(Le).strict(),gy=p.object({kind:p.literal("core:parallel"),actions:p.array(p.any()),waitFor:p.enum(["all","any"]).optional(),label:p.string().optional()}).extend(Le).strict(),my=p.object({kind:p.literal("overlays:tour"),tourId:p.string(),steps:p.array(Xv).min(1),startStep:p.string().optional(),autoStart:p.boolean().optional(),label:p.string().optional()}).extend(Le).passthrough(),q1=[{defName:"setText",schema:Jv},{defName:"setAttr",schema:ey},{defName:"addClass",schema:ty},{defName:"removeClass",schema:ny},{defName:"setStyle",schema:ry},{defName:"insertHtml",schema:iy},{defName:"highlight",schema:sy},{defName:"pulse",schema:oy},{defName:"badge",schema:ay},{defName:"tooltip",schema:ly},{defName:"modal",schema:cy},{defName:"scrollTo",schema:uy},{defName:"navigate",schema:dy},{defName:"mountWidget",schema:py},{defName:"wait",schema:hy},{defName:"sequence",schema:fy},{defName:"parallel",schema:gy},{defName:"tour",schema:my}];function yd(n){let e=n?.root??(typeof document<"u"?document.body:null),t=n?.defaultTimeoutMs??5e3,r=new Map,i=new Map,s=null,o=!1;function a(m){if(!e)return null;try{return e.matches(m)?e:e.querySelector(m)}catch{return null}}function l(){for(let[m,y]of r){let k=a(m);if(k){for(let _ of y)clearTimeout(_.timer),_.resolve(k);r.delete(m)}}for(let[m,y]of i){let k=a(m);if(k){for(let _ of y)_.cancelled||_.cb(k);i.delete(m)}}r.size===0&&i.size===0&&u()}function c(){s||o||typeof MutationObserver>"u"||!e||(s=new MutationObserver(()=>{l()}),s.observe(e,{childList:!0,subtree:!0}))}function u(){s&&(s.disconnect(),s=null)}function d(m,y){let k=r.get(m);k&&(k.delete(y),k.size===0&&r.delete(m)),r.size===0&&i.size===0&&u()}function h(m,y){if(o)return Promise.reject(new Error("AnchorResolver destroyed"));let k=a(m);if(k)return Promise.resolve(k);let _=y??t;return new Promise((b,w)=>{let E={resolve:b,reject:w,timer:setTimeout(()=>{d(m,E),w(new Error(`waitFor("${m}") timed out after ${_}ms`))},_)},x=r.get(m);x||(x=new Set,r.set(m,x)),x.add(E),c()})}function g(m,y){if(o)return()=>{};let k=a(m);if(k)return y(k),()=>{};let _={cb:y,cancelled:!1},b=i.get(m);return b||(b=new Set,i.set(m,b)),b.add(_),c(),()=>{_.cancelled=!0;let w=i.get(m);w&&(w.delete(_),w.size===0&&i.delete(m)),r.size===0&&i.size===0&&u()}}function v(){let m=0;for(let y of r.values())m+=y.size;return m}function f(){o=!0,u();let m=new Error("AnchorResolver destroyed");for(let y of r.values())for(let k of y)clearTimeout(k.timer),k.reject(m);r.clear(),i.clear()}return{resolve:a,waitFor:h,onAppear:g,pendingCount:v,destroy:f}}var vy={timeout:300,className:"sc-anti-flicker",style:"opacity: 0 !important",hostLoadingSelector:"",waitForHostReady:""};function yy(n={}){let{timeout:e,className:t,style:r,hostLoadingSelector:i,waitForHostReady:s}={...vy,...n};if(i&&document.querySelector(i))return()=>{};let o=document.createElement("style");o.textContent=`.${t} { ${r} }`,document.head.appendChild(o),document.documentElement.classList.add(t);let a=!1,l=()=>{a||(a=!0,clearTimeout(u),document.documentElement.classList.remove(t),o.remove(),s&&c&&document.removeEventListener(s,c))},c;s&&(c=()=>l(),document.addEventListener(s,c));let u=setTimeout(()=>{l()},e);return()=>{l()}}function Z1(n={}){let{className:e,style:t}={...vy,...n};return`
|
|
889
|
+
`;customElements.define("syntro-toast-stack",Ws);var Hu=async(n,e)=>{let t=[];if(e.applyAction)for(let r of n.actions){let i=await e.applyAction(r);t.push(i)}return{cleanup:async()=>{for(let r=t.length-1;r>=0;r--)try{await t[r].revert()}catch{}}}},Bu=async(n,e)=>{let t=[];if(e.applyAction){let r=n.actions.map(i=>e.applyAction(i));if(n.waitFor==="any"){let i=await Promise.race(r);t.push(i);let s=await Promise.allSettled(r);for(let o of s)o.status==="fulfilled"&&o.value!==i&&t.push(o.value)}else{let i=await Promise.all(r);t.push(...i)}}return{cleanup:async()=>{for(let r of t)try{await r.revert()}catch{}}}},Vu=async(n,e)=>{let t,r,i=!1,s={cleanup:()=>{i=!0,r&&clearTimeout(r),t&&t()}};return n.event&&e.subscribeEvent?await new Promise(o=>{t=e.subscribeEvent(n.event,()=>{i||o()}),n.durationMs!==void 0&&(r=setTimeout(()=>{i||o()},n.durationMs))}):n.durationMs!==void 0&&await new Promise(o=>{r=setTimeout(()=>{i||o()},n.durationMs)}),s};var Ga=class{constructor(){this.executors=new Map;for(let{kind:e,executor:t}of wc)this.registerCore(e,t);for(let{kind:e,executor:t}of Ug)this.registerCore(e,t);this.registerCore("core:mountWidget",async()=>{throw new Error("core:mountWidget must be handled by ActionEngine")}),this.registerCore("core:sequence",Hu),this.registerCore("core:parallel",Bu),this.registerCore("core:wait",Vu)}registerCore(e,t,r){this.executors.set(e,{kind:e,executor:t,schema:r,source:"core",isBuiltIn:!0})}register(e,t,r,i="custom",s=!1){if(this.executors.has(e)){if(this.executors.get(e).isBuiltIn)return;console.warn(`[ExecutorRegistry] Overriding executor for kind: ${e} (source: ${i})`)}console.log(`[ExecutorRegistry] Registered executor: ${e} (source: ${i})`),this.executors.set(e,{kind:e,executor:t,schema:r,source:i,isBuiltIn:s})}unregister(e){let t=this.executors.get(e);return t?t.isBuiltIn?(console.warn(`[ExecutorRegistry] Cannot unregister built-in executor: ${e}`),!1):(this.executors.delete(e),!0):!1}unregisterBySource(e){for(let[t,r]of this.executors.entries())r.source===e&&this.executors.delete(t)}get(e){return this.executors.get(e)?.executor}getRegistration(e){return this.executors.get(e)}has(e){return this.executors.has(e)}validate(e){let t=[];if(!e||typeof e!="object")return t.push({code:"INVALID_ACTION",message:"Action must be an object"}),{valid:!1,errors:t,warnings:[]};let{kind:r}=e;if(!r||typeof r!="string")return t.push({code:"MISSING_KIND",message:"Action must have a 'kind' property"}),{valid:!1,errors:t,warnings:[]};let i=this.executors.get(r);if(!i)return t.push({code:"UNKNOWN_KIND",message:`Unknown action kind: ${r}`,field:"kind"}),{valid:!1,errors:t,warnings:[]};if(i.schema){let s=i.schema.safeParse(e);if(!s.success){for(let o of s.error.issues)t.push({code:"SCHEMA_VALIDATION_ERROR",message:o.message,field:o.path.join(".")});return{valid:!1,errors:t,warnings:[]}}}return{valid:!0,errors:[],warnings:[]}}list(){return Array.from(this.executors.keys())}listRegistrations(){return Array.from(this.executors.values())}getBuiltInKinds(){return Array.from(this.executors.entries()).filter(([,e])=>e.isBuiltIn).map(([e])=>e)}getCustomKinds(){return Array.from(this.executors.entries()).filter(([,e])=>!e.isBuiltIn).map(([e])=>e)}},rn=new Ga;function CE(n){return rn.get(n)}function Wu(n){return rn.has(n)}function ju(n,e,t){!n.content||typeof n.content!="string"?e.push({code:"MISSING_CONTENT",message:"Badge action requires 'content' property",field:"content"}):n.content.length>100&&t.push({code:"LONG_BADGE_CONTENT",message:"Badge content is quite long",suggestion:"Keep badge content short (under 100 characters)"})}function Uu(n,e,t){if(!n.content||typeof n.content!="object"){e.push({code:"MISSING_CONTENT",message:"Tooltip action requires 'content' object",field:"content"});return}(!n.content.body||typeof n.content.body!="string")&&e.push({code:"MISSING_BODY",message:"Tooltip content requires 'body' property",field:"content.body"})}function zu(n,e,t){!n.html||typeof n.html!="string"?e.push({code:"MISSING_HTML",message:"insertHtml action requires 'html' property",field:"html"}):n.html.length>Ka&&e.push({code:"HTML_TOO_LONG",message:`HTML content exceeds maximum length of ${Ka}`,field:"html"});let r=["before","after","prepend","append","replace"];(!n.position||!r.includes(n.position))&&e.push({code:"INVALID_POSITION",message:`Position must be one of: ${r.join(", ")}`,field:"position"})}function qu(n,e,t){(n.text===void 0||n.text===null)&&e.push({code:"MISSING_TEXT",message:"setText action requires 'text' property",field:"text"})}function Zu(n,e,t){!n.attr||typeof n.attr!="string"?e.push({code:"MISSING_ATTR",message:"setAttr action requires 'attr' property",field:"attr"}):(rd.has(n.attr.toLowerCase())||n.attr.toLowerCase().startsWith("on"))&&e.push({code:"DANGEROUS_ATTR",message:`Event handler attributes are not allowed: ${n.attr}`,field:"attr"}),(n.value===void 0||n.value===null)&&e.push({code:"MISSING_VALUE",message:"setAttr action requires 'value' property",field:"value"})}function Gu(n,e,t){!n.className||typeof n.className!="string"?e.push({code:"MISSING_CLASS_NAME",message:"Class action requires 'className' property",field:"className"}):/^[a-zA-Z_-][a-zA-Z0-9_-]*$/.test(n.className)||t.push({code:"INVALID_CLASS_NAME",message:"Class name contains unusual characters",suggestion:"Use alphanumeric characters, hyphens, and underscores"})}function Ku(n,e,t){if(!n.styles||typeof n.styles!="object")e.push({code:"MISSING_STYLES",message:"setStyle action requires 'styles' object",field:"styles"});else{let r=Object.keys(n.styles).length;r>Ya&&e.push({code:"TOO_MANY_STYLES",message:`Too many styles (${r}). Maximum is ${Ya}`,field:"styles"});for(let[i,s]of Object.entries(n.styles))typeof s=="string"&&s.includes("expression(")&&e.push({code:"DANGEROUS_STYLE",message:`Style expressions are not allowed: ${i}`,field:`styles.${i}`})}}function Yu(n,e,t){(!n.slot||typeof n.slot!="string")&&e.push({code:"MISSING_SLOT",message:"mountWidget action requires 'slot' property",field:"slot"}),!n.widget||typeof n.widget!="object"?e.push({code:"MISSING_WIDGET",message:"mountWidget action requires 'widget' object",field:"widget"}):(!n.widget.widgetId||typeof n.widget.widgetId!="string")&&e.push({code:"MISSING_WIDGET_ID",message:"Widget must have a 'widgetId' property",field:"widget.widgetId"})}function Xu(n,e,t){n.durationMs===void 0&&!n.event&&e.push({code:"MISSING_WAIT_CONFIG",message:"wait action requires either 'durationMs' or 'event' property"}),n.durationMs!==void 0&&n.durationMs<0&&e.push({code:"INVALID_DURATION",message:"durationMs must be a positive number",field:"durationMs"}),n.event!==void 0&&typeof n.event!="string"&&e.push({code:"INVALID_EVENT",message:"event must be a string",field:"event"})}function Ju(n,e,t){if(!n.actions||!Array.isArray(n.actions)){e.push({code:"MISSING_ACTIONS",message:"sequence action requires 'actions' array",field:"actions"});return}n.actions.length===0&&t.push({code:"EMPTY_SEQUENCE",message:"sequence has no actions",suggestion:"Add at least one action to the sequence"});for(let r=0;r<n.actions.length;r++){let i=Wt(n.actions[r]);for(let s of i.errors)e.push({...s,field:`actions[${r}]${s.field?`.${s.field}`:""}`});for(let s of i.warnings)t.push(s)}}function Qu(n,e,t){if(!n.actions||!Array.isArray(n.actions)){e.push({code:"MISSING_ACTIONS",message:"parallel action requires 'actions' array",field:"actions"});return}n.actions.length===0&&t.push({code:"EMPTY_PARALLEL",message:"parallel has no actions",suggestion:"Add at least one action to the parallel group"}),n.waitFor&&!["all","any"].includes(n.waitFor)&&e.push({code:"INVALID_WAIT_FOR",message:"waitFor must be 'all' or 'any'",field:"waitFor"});for(let r=0;r<n.actions.length;r++){let i=Wt(n.actions[r]);for(let s of i.errors)e.push({...s,field:`actions[${r}]${s.field?`.${s.field}`:""}`});for(let s of i.warnings)t.push(s)}}function ed(n,e,t){if(!n.url||typeof n.url!="string")e.push({code:"MISSING_URL",message:"navigate action requires 'url' property",field:"url"});else{let r=n.url.trim().toLowerCase();r.startsWith("javascript:")&&e.push({code:"DANGEROUS_URL",message:"javascript: URLs are not allowed",field:"url"}),r.startsWith("data:")&&t.push({code:"DATA_URL",message:"data: URLs may have limited support",suggestion:"Consider using a regular URL instead"})}}function td(n,e,t){if(!n.content||typeof n.content!="object"){e.push({code:"MISSING_CONTENT",message:"Modal action requires 'content' object",field:"content"});return}if((!n.content.body||typeof n.content.body!="string")&&e.push({code:"MISSING_BODY",message:"Modal content requires 'body' property",field:"content.body"}),n.size&&!["sm","md","lg"].includes(n.size)&&e.push({code:"INVALID_SIZE",message:"Modal size must be 'sm', 'md', or 'lg'",field:"size"}),n.ctaButtons)if(!Array.isArray(n.ctaButtons))e.push({code:"INVALID_CTA_BUTTONS",message:"ctaButtons must be an array",field:"ctaButtons"});else for(let r=0;r<n.ctaButtons.length;r++){let i=n.ctaButtons[r];(!i.label||typeof i.label!="string")&&e.push({code:"MISSING_BUTTON_LABEL",message:`CTA button at index ${r} requires 'label' property`,field:`ctaButtons[${r}].label`}),(!i.actionId||typeof i.actionId!="string")&&e.push({code:"MISSING_BUTTON_ACTION_ID",message:`CTA button at index ${r} requires 'actionId' property`,field:`ctaButtons[${r}].actionId`})}}function nd(n,e,t){if((!n.tourId||typeof n.tourId!="string")&&e.push({code:"MISSING_TOUR_ID",message:"Tour action requires 'tourId' property",field:"tourId"}),!n.steps||!Array.isArray(n.steps)){e.push({code:"MISSING_STEPS",message:"Tour action requires 'steps' array",field:"steps"});return}n.steps.length===0&&e.push({code:"EMPTY_STEPS",message:"Tour must have at least one step",field:"steps"});let r=new Set;for(let i=0;i<n.steps.length;i++){let s=n.steps[i];if(!s.id||typeof s.id!="string"?e.push({code:"MISSING_STEP_ID",message:`Step at index ${i} requires 'id' property`,field:`steps[${i}].id`}):(r.has(s.id)&&e.push({code:"DUPLICATE_STEP_ID",message:`Duplicate step ID: ${s.id}`,field:`steps[${i}].id`}),r.add(s.id)),!s.action)e.push({code:"MISSING_STEP_ACTION",message:`Step at index ${i} requires 'action' property`,field:`steps[${i}].action`});else{let o=Wt(s.action);for(let a of o.errors)e.push({...a,field:`steps[${i}].action${a.field?`.${a.field}`:""}`});for(let a of o.warnings)t.push(a)}if(s.onAction)for(let[o,a]of Object.entries(s.onAction))a!=="end"&&!n.steps.some(l=>l.id===a)&&t.push({code:"UNKNOWN_TARGET_STEP",message:`Step "${s.id}" references unknown target step: ${a}`,suggestion:`Make sure step "${a}" exists in the tour`})}}var rd=new Set(["onclick","onerror","onload","onmouseover","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"]),Ka=5e4,Ya=50;function Wt(n){let e=[],t=[];if(!n||typeof n!="object")return e.push({code:"INVALID_ACTION",message:"Action must be an object"}),{valid:!1,errors:e,warnings:t};let{kind:r}=n;if(!r||typeof r!="string")return e.push({code:"MISSING_KIND",message:"Action must have a 'kind' property"}),{valid:!1,errors:e,warnings:t};if(!Wu(r)&&r!=="core:mountWidget"){let i=rn.list();return console.error(`[ActionValidation] Unknown action kind: "${r}". Registered kinds (${i.length}): [${i.join(", ")}]. This usually means the app that provides "${r}" hasn't been activated yet, or the executor was never registered in ExecutorRegistry.`),e.push({code:"UNKNOWN_KIND",message:`Unknown action kind: ${r}`,field:"kind"}),{valid:!1,errors:e,warnings:t}}switch(r){case"overlays:highlight":case"overlays:pulse":case"navigation:scrollTo":sn(n,e,t);break;case"overlays:badge":sn(n,e,t),ju(n,e,t);break;case"overlays:tooltip":sn(n,e,t),Uu(n,e,t);break;case"overlays:modal":td(n,e,t);break;case"content:insertHtml":sn(n,e,t),zu(n,e,t);break;case"content:setText":sn(n,e,t),qu(n,e,t);break;case"content:setAttr":sn(n,e,t),Zu(n,e,t);break;case"content:addClass":case"content:removeClass":sn(n,e,t),Gu(n,e,t);break;case"content:setStyle":sn(n,e,t),Ku(n,e,t);break;case"core:mountWidget":Yu(n,e,t);break;case"core:wait":Xu(n,e,t);break;case"core:sequence":Ju(n,e,t);break;case"core:parallel":Qu(n,e,t);break;case"overlays:tour":nd(n,e,t);break;case"navigation:navigate":ed(n,e,t);break}return{valid:e.length===0,errors:e,warnings:t}}function sn(n,e,t){let r=n.anchorId;if(!r||typeof r!="object"){e.push({code:"MISSING_ANCHOR_ID",message:"Action requires an 'anchorId' object with a 'selector' string",field:"anchorId"});return}if(!r.selector||typeof r.selector!="string"?e.push({code:"MISSING_ANCHOR_SELECTOR",message:"anchorId requires a 'selector' string",field:"anchorId.selector"}):r.selector.length>200&&t.push({code:"LONG_ANCHOR_ID",message:"Anchor selector is unusually long",suggestion:"Consider using a shorter, more descriptive selector"}),r.route===void 0||r.route===null)e.push({code:"MISSING_ANCHOR_ROUTE",message:`anchorId requires a 'route' (string or array of strings). Use "**" for all routes.`,field:"anchorId.route"});else{let i=Array.isArray(r.route)?r.route:[r.route];for(let s of i)if(typeof s!="string"){e.push({code:"INVALID_ANCHOR_ROUTE",message:"anchorId.route must be a string or array of strings",field:"anchorId.route"});break}}}function Xa(n){let e=[],t=[];if(!Array.isArray(n))return console.error("[ActionValidation] validateActions called with non-array:",typeof n),e.push({code:"INVALID_ACTIONS",message:"Actions must be an array"}),{valid:!1,errors:e,warnings:t};for(let r=0;r<n.length;r++){let i=Wt(n[r]);if(!i.valid){let s=n[r];console.error(`[ActionValidation] Action [${r}] failed validation:`,`kind="${s?.kind??"undefined"}"`,i.errors.map(o=>`${o.code}: ${o.message}`).join("; "),s)}for(let s of i.errors)e.push({...s,field:s.field?`[${r}].${s.field}`:`[${r}]`});for(let s of i.warnings)t.push({...s,suggestion:s.suggestion?`Action ${r}: ${s.suggestion}`:void 0})}return e.length>0&&console.error(`[ActionValidation] Batch validation failed: ${e.length} error(s) in ${n.length} action(s).`,e.map(r=>`${r.field??"?"}: ${r.message}`).join(" | ")),{valid:e.length===0,errors:e,warnings:t}}var AE=0;function id(n){let{overlayRoot:e,eventBus:t,surfaces:r,anchorResolver:i,waitForAnchor:s,adaptiveId:o,executorRegistry:a=rn,subscribeNavigation:l,runtime:c}=n,u=new Map,d=new Map;function h(){return`action-${++AE}`}function g(w,E){t&&t.publish(w,E)}function v(){return{overlayRoot:e,resolveAnchor:i,waitForAnchor:s,generateId:h,publishEvent:g,adaptiveId:o,applyAction:k,subscribeEvent:t?(w,E)=>t.subscribe({names:[w]},$=>E($.props)):void 0,subscribeNavigation:l}}async function f(w,E){if(!r)throw new Error("Surfaces provider required for core:mountWidget actions");let $=r.mount(w.slot,{type:"widget",widgetId:w.widget.widgetId,config:w.widget.props},{priority:w.widget.priority});return E.publishEvent("action.applied",{id:E.generateId(),kind:"core:mountWidget",slot:w.slot,widgetId:w.widget.widgetId}),{cleanup:()=>{$.unmount()},updateFn:P=>{if("widget"in P&&P.widget){let M=P.widget;M.props&&$.update({type:"widget",widgetId:w.widget.widgetId,config:M.props})}}}}async function m(w,E){if(w.kind==="core:mountWidget")return f(w,E);let $=a.get(w.kind);if(!$){let P="list"in a?a.list():"(list unavailable)";throw console.error(`[ActionEngine] No executor for kind="${w.kind}".`,`Registered: [${P}]`),new Error(`No executor for action kind: ${w.kind}`)}return $(w,E)}function y(w,E,$,P){if(!c)return;let M=[],G=!1,L=async()=>{if(G)return;let N=u.get(w);if(N){G=!0;try{let H=c.evaluateSync($).value;if(N.state==="applied"&&!H){try{await N.cleanup()}catch(oe){console.error(`[ActionEngine] Error reverting conditional action ${w}:`,oe)}N.state="deferred",N.cleanup=()=>{},N.updateFn=void 0,g("action.deferred",{id:w,kind:E.kind})}else if(N.state==="deferred"&&H)try{let oe=v(),A=await m(E,oe);N.state="applied",N.cleanup=A.cleanup,N.updateFn=A.updateFn,N.appliedTs=Date.now()}catch(oe){console.error(`[ActionEngine] Error applying deferred action ${w}:`,oe),N.state="failed"}}finally{G=!1}}};c.context&&M.push(c.context.subscribe(L)),c.accumulator&&M.push(c.accumulator.subscribe(L)),c.sessionMetrics&&M.push(c.sessionMetrics.subscribe(L)),c.events&&M.push(c.events.subscribe(L)),d.set(w,M)}async function k(w){let E=Wt(w);if(!E.valid){let z=E.errors.map(H=>H.message).join("; ");throw console.error(`[ActionEngine] Validation failed for action kind="${w?.kind}":`,z,w),new Error(`Action validation failed: ${z}`)}let $=h(),P=w.triggerWhen;if(P&&c&&!c.evaluateSync(P).value){let H={id:$,action:w,adaptiveId:o,appliedTs:Date.now(),state:"deferred",cleanup:()=>{}};u.set($,H);let oe={id:$,action:w,async revert(){let A=u.get($);if(!A)return;let F=d.get($);if(F){for(let X of F)X();d.delete($)}A.state="reverted",u.delete($)},isApplied(){return u.get($)?.state==="applied"},async update(A){let F=u.get($);if(!F||F.state!=="applied")throw new Error("Cannot update action that is not applied");if(F.updateFn)await F.updateFn(A);else throw new Error(`Action kind ${w.kind} does not support updates`)},getState(){return u.get($)?.state??"reverted"}};return y($,w,P,oe),oe}let M=v(),G=await m(w,M),L={id:$,action:w,adaptiveId:o,appliedTs:Date.now(),state:"applied",cleanup:G.cleanup,updateFn:G.updateFn};u.set($,L);let N={id:$,action:w,async revert(){let z=u.get($);if(!z||z.state!=="applied")return;let H=d.get($);if(H){for(let oe of H)oe();d.delete($)}try{await z.cleanup(),z.state="reverted",g("action.reverted",{id:$,kind:w.kind})}catch(oe){console.warn(`[ActionEngine] Cleanup error for ${w.kind} (${$}), ignoring:`,oe),z.state="reverted",g("action.reverted",{id:$,kind:w.kind})}finally{u.delete($)}},isApplied(){return u.get($)?.state==="applied"},async update(z){let H=u.get($);if(!H||H.state!=="applied")throw new Error("Cannot update action that is not applied");if(H.updateFn)await H.updateFn(z);else throw new Error(`Action kind ${w.kind} does not support updates`)},getState(){return u.get($)?.state??"reverted"}};return P&&c&&y($,w,P,N),N}async function _(w){console.log(`[ActionEngine] applyBatch: ${w.length} action(s)`,w.map(L=>L.kind).join(", "));let E=Xa(w);if(!E.valid){let L=E.errors.map(N=>N.message).join("; ");throw console.error(`[ActionEngine] Batch validation FAILED for ${w.length} action(s):`,L,`
|
|
890
|
+
Actions:`,w.map((N,z)=>` [${z}] ${N.kind} ${N.anchorId?`anchor="${N.anchorId.selector}"`:""} ${N.label?`label="${N.label}"`:""}`).join(`
|
|
891
|
+
`)),new Error(`Batch validation failed: ${L}`)}let $=h(),P=[],M=[];try{let L=await Promise.allSettled(w.map(z=>k(z))),N=[];for(let z of L)z.status==="fulfilled"?(P.push(z.value),M.push(z.value)):N.push(z.reason instanceof Error?z.reason:new Error(String(z.reason)));if(N.length>0&&M.length===0)throw N[0];N.length>0&&console.warn(`[ActionEngine] ${N.length}/${w.length} action(s) failed in batch:`,N.map(z=>z.message).join("; "))}catch(L){console.error(`[ActionEngine] Batch apply FAILED. Successfully applied: ${M.length}. Rolling back...`,L);for(let N of M)try{await N.revert()}catch{}throw L}return{id:$,handles:P,async revertAll(){for(let L=P.length-1;L>=0;L--)try{await P[L].revert()}catch(N){console.error(`[ActionEngine] Error reverting action ${P[L].id}:`,N)}},isApplied(){return P.every(L=>L.isApplied())}}}function b(w){return Wt(w)}function x(){return Array.from(u.values()).map(w=>({id:w.id,action:w.action,adaptiveId:w.adaptiveId,appliedTs:w.appliedTs,state:w.state}))}async function R(){for(let E of d.values())for(let $ of E)try{$()}catch{}d.clear();let w=[];for(let E of u.values())if(E.state==="applied")try{let $=E.cleanup();$&&typeof $.then=="function"&&w.push($.catch(P=>{console.error("[ActionEngine] Error during async cleanup:",P)}))}catch($){console.error("[ActionEngine] Error during cleanup:",$)}u.clear(),w.length>0&&await Promise.all(w)}return{apply:k,applyBatch:_,validate:b,getActive:x,destroy:R}}var p={};ox(p,{BRAND:()=>QE,DIRTY:()=>br,EMPTY_PATH:()=>$E,INVALID:()=>ne,NEVER:()=>F1,OK:()=>Ge,ParseStatus:()=>je,Schema:()=>le,ZodAny:()=>On,ZodArray:()=>cn,ZodBigInt:()=>xr,ZodBoolean:()=>wr,ZodBranded:()=>Us,ZodCatch:()=>Pr,ZodDate:()=>kr,ZodDefault:()=>Mr,ZodDiscriminatedUnion:()=>el,ZodEffects:()=>_t,ZodEnum:()=>Ir,ZodError:()=>it,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>nl,ZodIntersection:()=>Ar,ZodIssueCode:()=>O,ZodLazy:()=>Rr,ZodLiteral:()=>Tr,ZodMap:()=>Ci,ZodNaN:()=>Ri,ZodNativeEnum:()=>$r,ZodNever:()=>Ft,ZodNull:()=>Er,ZodNullable:()=>zt,ZodNumber:()=>_r,ZodObject:()=>st,ZodOptional:()=>yt,ZodParsedType:()=>q,ZodPipeline:()=>zs,ZodPromise:()=>Nn,ZodReadonly:()=>Or,ZodRecord:()=>tl,ZodSchema:()=>le,ZodSet:()=>Ai,ZodString:()=>Pn,ZodSymbol:()=>Si,ZodTransformer:()=>_t,ZodTuple:()=>Ut,ZodType:()=>le,ZodUndefined:()=>Sr,ZodUnion:()=>Cr,ZodUnknown:()=>ln,ZodVoid:()=>Ei,addIssueToContext:()=>B,any:()=>l1,array:()=>p1,bigint:()=>r1,boolean:()=>Wv,coerce:()=>L1,custom:()=>Hv,date:()=>i1,datetimeRegex:()=>Fv,defaultErrorMap:()=>on,discriminatedUnion:()=>m1,effect:()=>R1,enum:()=>E1,function:()=>w1,getErrorMap:()=>xi,getParsedType:()=>jt,instanceof:()=>t1,intersection:()=>v1,isAborted:()=>Ja,isAsync:()=>wi,isDirty:()=>Qa,isValid:()=>Mn,late:()=>e1,lazy:()=>k1,literal:()=>S1,makeIssue:()=>js,map:()=>_1,nan:()=>n1,nativeEnum:()=>C1,never:()=>u1,null:()=>a1,nullable:()=>I1,number:()=>Vv,object:()=>h1,objectUtil:()=>sd,oboolean:()=>N1,onumber:()=>O1,optional:()=>T1,ostring:()=>P1,pipeline:()=>M1,preprocess:()=>$1,promise:()=>A1,quotelessJson:()=>RE,record:()=>b1,set:()=>x1,setErrorMap:()=>IE,strictObject:()=>f1,string:()=>Bv,symbol:()=>s1,transformer:()=>R1,tuple:()=>y1,undefined:()=>o1,union:()=>g1,unknown:()=>c1,util:()=>ce,void:()=>d1});var ce;(function(n){n.assertEqual=i=>{};function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{let s={};for(let o of i)s[o]=o;return s},n.getValidEnumValues=i=>{let s=n.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of s)o[a]=i[a];return n.objectValues(o)},n.objectValues=i=>n.objectKeys(i).map(function(s){return i[s]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},n.find=(i,s)=>{for(let o of i)if(s(o))return o},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}n.joinValues=r,n.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(ce||(ce={}));var sd;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(sd||(sd={}));var q=ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),jt=n=>{switch(typeof n){case"undefined":return q.undefined;case"string":return q.string;case"number":return Number.isNaN(n)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(n)?q.array:n===null?q.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?q.promise:typeof Map<"u"&&n instanceof Map?q.map:typeof Set<"u"&&n instanceof Set?q.set:typeof Date<"u"&&n instanceof Date?q.date:q.object;default:return q.unknown}};var O=ce.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),RE=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),it=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(s){return s.message},r={_errors:[]},i=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let a=r,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];t[s]=t[s]||[],t[s].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};it.create=n=>new it(n);var TE=(n,e)=>{let t;switch(n.code){case O.invalid_type:n.received===q.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case O.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,ce.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:t=`Unrecognized key(s) in object: ${ce.joinValues(n.keys,", ")}`;break;case O.invalid_union:t="Invalid input";break;case O.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ce.joinValues(n.options)}`;break;case O.invalid_enum_value:t=`Invalid enum value. Expected ${ce.joinValues(n.options)}, received '${n.received}'`;break;case O.invalid_arguments:t="Invalid function arguments";break;case O.invalid_return_type:t="Invalid function return type";break;case O.invalid_date:t="Invalid date";break;case O.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:ce.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case O.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case O.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case O.custom:t="Invalid input";break;case O.invalid_intersection_types:t="Intersection results could not be merged";break;case O.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case O.not_finite:t="Number must be finite";break;default:t=e.defaultError,ce.assertNever(n)}return{message:t}},on=TE;var Mv=on;function IE(n){Mv=n}function xi(){return Mv}var js=n=>{let{data:e,path:t,errorMaps:r,issueData:i}=n,s=[...t,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)a=c(o,{data:e,defaultError:a}).message;return{...i,path:s,message:a}},$E=[];function B(n,e){let t=xi(),r=js({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===on?void 0:on].filter(i=>!!i)});n.common.issues.push(r)}var je=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let i of t){if(i.status==="aborted")return ne;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let i of t){let s=await i.key,o=await i.value;r.push({key:s,value:o})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return ne;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}},ne=Object.freeze({status:"aborted"}),br=n=>({status:"dirty",value:n}),Ge=n=>({status:"valid",value:n}),Ja=n=>n.status==="aborted",Qa=n=>n.status==="dirty",Mn=n=>n.status==="valid",wi=n=>typeof Promise<"u"&&n instanceof Promise;var Y;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(Y||(Y={}));var bt=class{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Pv=(n,e)=>{if(Mn(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new it(n.common.issues);return this._error=t,this._error}}};function ae(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:i}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,a)=>{let{message:l}=n;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??t??a.defaultError}},description:i}}var le=class{get description(){return this._def.description}_getType(e){return jt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:jt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new je,ctx:{common:e.parent.common,data:e.data,parsedType:jt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(wi(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jt(e)},i=this._parseSync({data:e,path:r.path,parent:r});return Pv(r,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jt(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Mn(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Mn(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jt(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(wi(i)?i:Promise.resolve(i));return Pv(r,s)}refine(e,t){let r=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,s)=>{let o=e(i),a=()=>s.addIssue({code:O.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof t=="function"?t(r,i):t),!1))}_refinement(e){return new _t({schema:this,typeName:re.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return yt.create(this,this._def)}nullable(){return zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return cn.create(this)}promise(){return Nn.create(this,this._def)}or(e){return Cr.create([this,e],this._def)}and(e){return Ar.create(this,e,this._def)}transform(e){return new _t({...ae(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Mr({...ae(this._def),innerType:this,defaultValue:t,typeName:re.ZodDefault})}brand(){return new Us({typeName:re.ZodBranded,type:this,...ae(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Pr({...ae(this._def),innerType:this,catchValue:t,typeName:re.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return zs.create(this,e)}readonly(){return Or.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ME=/^c[^\s-]{8,}$/i,PE=/^[0-9a-z]+$/,OE=/^[0-9A-HJKMNP-TV-Z]{26}$/i,NE=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,LE=/^[a-z0-9_-]{21}$/i,FE=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,DE=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,HE=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,BE="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",od,VE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,WE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,jE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,UE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,zE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qE=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Nv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ZE=new RegExp(`^${Nv}$`);function Lv(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function GE(n){return new RegExp(`^${Lv(n)}$`)}function Fv(n){let e=`${Nv}T${Lv(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function KE(n,e){return!!((e==="v4"||!e)&&VE.test(n)||(e==="v6"||!e)&&jE.test(n))}function YE(n,e){if(!FE.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function XE(n,e){return!!((e==="v4"||!e)&&WE.test(n)||(e==="v6"||!e)&&UE.test(n))}var Pn=class n extends le{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let s=this._getOrReturnCtx(e);return B(s,{code:O.invalid_type,expected:q.string,received:s.parsedType}),ne}let r=new je,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:O.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:O.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,a=e.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(e,i),o?B(i,{code:O.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&B(i,{code:O.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")HE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"email",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")od||(od=new RegExp(BE,"u")),od.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"emoji",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")NE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"uuid",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")LE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"nanoid",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")ME.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"cuid",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")PE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"cuid2",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")OE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"ulid",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),B(i,{validation:"url",code:O.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"regex",code:O.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),B(i,{code:O.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),B(i,{code:O.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),B(i,{code:O.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Fv(s).test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:O.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?ZE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:O.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?GE(s).test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:O.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?DE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"duration",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?KE(e.data,s.version)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"ip",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?YE(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"jwt",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?XE(e.data,s.version)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"cidr",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?zE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"base64",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?qE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"base64url",code:O.invalid_string,message:s.message}),r.dirty()):ce.assertNever(s);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(i=>e.test(i),{validation:t,code:O.invalid_string,...Y.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Y.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Y.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Y.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Y.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Y.errToObj(t)})}nonempty(e){return this.min(1,Y.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Pn.create=n=>new Pn({checks:[],typeName:re.ZodString,coerce:n?.coerce??!1,...ae(n)});function JE(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=t>r?t:r,s=Number.parseInt(n.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return s%o/10**i}var _r=class n extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==q.number){let s=this._getOrReturnCtx(e);return B(s,{code:O.invalid_type,expected:q.number,received:s.parsedType}),ne}let r,i=new je;for(let s of this._def.checks)s.kind==="int"?ce.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:O.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),B(r,{code:O.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),B(r,{code:O.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?JE(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),B(r,{code:O.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:O.not_finite,message:s.message}),i.dirty()):ce.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Y.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ce.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};_r.create=n=>new _r({checks:[],typeName:re.ZodNumber,coerce:n?.coerce||!1,...ae(n)});var xr=class n extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==q.bigint)return this._getInvalidInput(e);let r,i=new je;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),B(r,{code:O.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),B(r,{code:O.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),B(r,{code:O.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):ce.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:q.bigint,received:t.parsedType}),ne}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Y.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};xr.create=n=>new xr({checks:[],typeName:re.ZodBigInt,coerce:n?.coerce??!1,...ae(n)});var wr=class extends le{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let r=this._getOrReturnCtx(e);return B(r,{code:O.invalid_type,expected:q.boolean,received:r.parsedType}),ne}return Ge(e.data)}};wr.create=n=>new wr({typeName:re.ZodBoolean,coerce:n?.coerce||!1,...ae(n)});var kr=class n extends le{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let s=this._getOrReturnCtx(e);return B(s,{code:O.invalid_type,expected:q.date,received:s.parsedType}),ne}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return B(s,{code:O.invalid_date}),ne}let r=new je,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:O.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:O.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):ce.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};kr.create=n=>new kr({checks:[],coerce:n?.coerce||!1,typeName:re.ZodDate,...ae(n)});var Si=class extends le{_parse(e){if(this._getType(e)!==q.symbol){let r=this._getOrReturnCtx(e);return B(r,{code:O.invalid_type,expected:q.symbol,received:r.parsedType}),ne}return Ge(e.data)}};Si.create=n=>new Si({typeName:re.ZodSymbol,...ae(n)});var Sr=class extends le{_parse(e){if(this._getType(e)!==q.undefined){let r=this._getOrReturnCtx(e);return B(r,{code:O.invalid_type,expected:q.undefined,received:r.parsedType}),ne}return Ge(e.data)}};Sr.create=n=>new Sr({typeName:re.ZodUndefined,...ae(n)});var Er=class extends le{_parse(e){if(this._getType(e)!==q.null){let r=this._getOrReturnCtx(e);return B(r,{code:O.invalid_type,expected:q.null,received:r.parsedType}),ne}return Ge(e.data)}};Er.create=n=>new Er({typeName:re.ZodNull,...ae(n)});var On=class extends le{constructor(){super(...arguments),this._any=!0}_parse(e){return Ge(e.data)}};On.create=n=>new On({typeName:re.ZodAny,...ae(n)});var ln=class extends le{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ge(e.data)}};ln.create=n=>new ln({typeName:re.ZodUnknown,...ae(n)});var Ft=class extends le{_parse(e){let t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:q.never,received:t.parsedType}),ne}};Ft.create=n=>new Ft({typeName:re.ZodNever,...ae(n)});var Ei=class extends le{_parse(e){if(this._getType(e)!==q.undefined){let r=this._getOrReturnCtx(e);return B(r,{code:O.invalid_type,expected:q.void,received:r.parsedType}),ne}return Ge(e.data)}};Ei.create=n=>new Ei({typeName:re.ZodVoid,...ae(n)});var cn=class n extends le{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==q.array)return B(t,{code:O.invalid_type,expected:q.array,received:t.parsedType}),ne;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(o||a)&&(B(t,{code:o?O.too_big:O.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(B(t,{code:O.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(B(t,{code:O.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>i.type._parseAsync(new bt(t,o,t.path,a)))).then(o=>je.mergeArray(r,o));let s=[...t.data].map((o,a)=>i.type._parseSync(new bt(t,o,t.path,a)));return je.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:Y.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:Y.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:Y.toString(t)}})}nonempty(e){return this.min(1,e)}};cn.create=(n,e)=>new cn({type:n,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...ae(e)});function ki(n){if(n instanceof st){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=yt.create(ki(r))}return new st({...n._def,shape:()=>e})}else return n instanceof cn?new cn({...n._def,type:ki(n.element)}):n instanceof yt?yt.create(ki(n.unwrap())):n instanceof zt?zt.create(ki(n.unwrap())):n instanceof Ut?Ut.create(n.items.map(e=>ki(e))):n}var st=class n extends le{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=ce.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==q.object){let c=this._getOrReturnCtx(e);return B(c,{code:O.invalid_type,expected:q.object,received:c.parsedType}),ne}let{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ft&&this._def.unknownKeys==="strip"))for(let c in i.data)o.includes(c)||a.push(c);let l=[];for(let c of o){let u=s[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new bt(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ft){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(B(i,{code:O.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new bt(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,h=await u.value;c.push({key:d,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>je.mergeObjectSync(r,c)):je.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let i=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:Y.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:re.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of ce.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of ce.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return ki(this)}partial(e){let t={};for(let r of ce.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of ce.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof yt;)s=s._def.innerType;t[r]=s}return new n({...this._def,shape:()=>t})}keyof(){return Dv(ce.objectKeys(this.shape))}};st.create=(n,e)=>new st({shape:()=>n,unknownKeys:"strip",catchall:Ft.create(),typeName:re.ZodObject,...ae(e)});st.strictCreate=(n,e)=>new st({shape:()=>n,unknownKeys:"strict",catchall:Ft.create(),typeName:re.ZodObject,...ae(e)});st.lazycreate=(n,e)=>new st({shape:n,unknownKeys:"strip",catchall:Ft.create(),typeName:re.ZodObject,...ae(e)});var Cr=class extends le{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function i(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new it(a.ctx.common.issues));return B(t,{code:O.invalid_union,unionErrors:o}),ne}if(t.common.async)return Promise.all(r.map(async s=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let s,o=[];for(let l of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(l=>new it(l));return B(t,{code:O.invalid_union,unionErrors:a}),ne}}get options(){return this._def.options}};Cr.create=(n,e)=>new Cr({options:n,typeName:re.ZodUnion,...ae(e)});var an=n=>n instanceof Rr?an(n.schema):n instanceof _t?an(n.innerType()):n instanceof Tr?[n.value]:n instanceof Ir?n.options:n instanceof $r?ce.objectValues(n.enum):n instanceof Mr?an(n._def.innerType):n instanceof Sr?[void 0]:n instanceof Er?[null]:n instanceof yt?[void 0,...an(n.unwrap())]:n instanceof zt?[null,...an(n.unwrap())]:n instanceof Us||n instanceof Or?an(n.unwrap()):n instanceof Pr?an(n._def.innerType):[],el=class n extends le{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.object)return B(t,{code:O.invalid_type,expected:q.object,received:t.parsedType}),ne;let r=this.discriminator,i=t.data[r],s=this.optionsMap.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(B(t,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ne)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let s of t){let o=an(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,s)}}return new n({typeName:re.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...ae(r)})}};function ad(n,e){let t=jt(n),r=jt(e);if(n===e)return{valid:!0,data:n};if(t===q.object&&r===q.object){let i=ce.objectKeys(e),s=ce.objectKeys(n).filter(a=>i.indexOf(a)!==-1),o={...n,...e};for(let a of s){let l=ad(n[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===q.array&&r===q.array){if(n.length!==e.length)return{valid:!1};let i=[];for(let s=0;s<n.length;s++){let o=n[s],a=e[s],l=ad(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===q.date&&r===q.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Ar=class extends le{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(s,o)=>{if(Ja(s)||Ja(o))return ne;let a=ad(s.value,o.value);return a.valid?((Qa(s)||Qa(o))&&t.dirty(),{status:t.value,value:a.data}):(B(r,{code:O.invalid_intersection_types}),ne)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Ar.create=(n,e,t)=>new Ar({left:n,right:e,typeName:re.ZodIntersection,...ae(t)});var Ut=class n extends le{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.array)return B(r,{code:O.invalid_type,expected:q.array,received:r.parsedType}),ne;if(r.data.length<this._def.items.length)return B(r,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&r.data.length>this._def.items.length&&(B(r,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...r.data].map((o,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new bt(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>je.mergeArray(t,o)):je.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};Ut.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ut({items:n,typeName:re.ZodTuple,rest:null,...ae(e)})};var tl=class n extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.object)return B(r,{code:O.invalid_type,expected:q.object,received:r.parsedType}),ne;let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in r.data)i.push({key:s._parse(new bt(r,a,r.path,a)),value:o._parse(new bt(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?je.mergeObjectAsync(t,i):je.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof le?new n({keyType:e,valueType:t,typeName:re.ZodRecord,...ae(r)}):new n({keyType:Pn.create(),valueType:e,typeName:re.ZodRecord,...ae(t)})}},Ci=class extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.map)return B(r,{code:O.invalid_type,expected:q.map,received:r.parsedType}),ne;let i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new bt(r,a,r.path,[c,"key"])),value:s._parse(new bt(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ne;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ne;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}}}};Ci.create=(n,e,t)=>new Ci({valueType:e,keyType:n,typeName:re.ZodMap,...ae(t)});var Ai=class n extends le{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.set)return B(r,{code:O.invalid_type,expected:q.set,received:r.parsedType}),ne;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(B(r,{code:O.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(B(r,{code:O.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let s=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return ne;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}let a=[...r.data.values()].map((l,c)=>s._parse(new bt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new n({...this._def,minSize:{value:e,message:Y.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:Y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ai.create=(n,e)=>new Ai({valueType:n,minSize:null,maxSize:null,typeName:re.ZodSet,...ae(e)});var nl=class n extends le{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.function)return B(t,{code:O.invalid_type,expected:q.function,received:t.parsedType}),ne;function r(a,l){return js({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,xi(),on].filter(c=>!!c),issueData:{code:O.invalid_arguments,argumentsError:l}})}function i(a,l){return js({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,xi(),on].filter(c=>!!c),issueData:{code:O.invalid_return_type,returnTypeError:l}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Nn){let a=this;return Ge(async function(...l){let c=new it([]),u=await a._def.args.parseAsync(l,s).catch(g=>{throw c.addIssue(r(l,g)),c}),d=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(d,s).catch(g=>{throw c.addIssue(i(d,g)),c})})}else{let a=this;return Ge(function(...l){let c=a._def.args.safeParse(l,s);if(!c.success)throw new it([r(l,c.error)]);let u=Reflect.apply(o,this,c.data),d=a._def.returns.safeParse(u,s);if(!d.success)throw new it([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:Ut.create(e).rest(ln.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||Ut.create([]).rest(ln.create()),returns:t||ln.create(),typeName:re.ZodFunction,...ae(r)})}},Rr=class extends le{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Rr.create=(n,e)=>new Rr({getter:n,typeName:re.ZodLazy,...ae(e)});var Tr=class extends le{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return B(t,{received:t.data,code:O.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:e.data}}get value(){return this._def.value}};Tr.create=(n,e)=>new Tr({value:n,typeName:re.ZodLiteral,...ae(e)});function Dv(n,e){return new Ir({values:n,typeName:re.ZodEnum,...ae(e)})}var Ir=class n extends le{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return B(t,{expected:ce.joinValues(r),received:t.parsedType,code:O.invalid_type}),ne}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return B(t,{received:t.data,code:O.invalid_enum_value,options:r}),ne}return Ge(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Ir.create=Dv;var $r=class extends le{_parse(e){let t=ce.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==q.string&&r.parsedType!==q.number){let i=ce.objectValues(t);return B(r,{expected:ce.joinValues(i),received:r.parsedType,code:O.invalid_type}),ne}if(this._cache||(this._cache=new Set(ce.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ce.objectValues(t);return B(r,{received:r.data,code:O.invalid_enum_value,options:i}),ne}return Ge(e.data)}get enum(){return this._def.values}};$r.create=(n,e)=>new $r({values:n,typeName:re.ZodNativeEnum,...ae(e)});var Nn=class extends le{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.promise&&t.common.async===!1)return B(t,{code:O.invalid_type,expected:q.promise,received:t.parsedType}),ne;let r=t.parsedType===q.promise?t.data:Promise.resolve(t.data);return Ge(r.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Nn.create=(n,e)=>new Nn({type:n,typeName:re.ZodPromise,...ae(e)});var _t=class extends le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{B(r,o),o.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return ne;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?ne:l.status==="dirty"?br(l.value):t.value==="dirty"?br(l.value):l});{if(t.value==="aborted")return ne;let a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?ne:a.status==="dirty"?br(a.value):t.value==="dirty"?br(a.value):a}}if(i.type==="refinement"){let o=a=>{let l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ne:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?ne:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Mn(o))return ne;let a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Mn(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):ne);ce.assertNever(i)}};_t.create=(n,e,t)=>new _t({schema:n,typeName:re.ZodEffects,effect:e,...ae(t)});_t.createWithPreprocess=(n,e,t)=>new _t({schema:e,effect:{type:"preprocess",transform:n},typeName:re.ZodEffects,...ae(t)});var yt=class extends le{_parse(e){return this._getType(e)===q.undefined?Ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yt.create=(n,e)=>new yt({innerType:n,typeName:re.ZodOptional,...ae(e)});var zt=class extends le{_parse(e){return this._getType(e)===q.null?Ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};zt.create=(n,e)=>new zt({innerType:n,typeName:re.ZodNullable,...ae(e)});var Mr=class extends le{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===q.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Mr.create=(n,e)=>new Mr({innerType:n,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ae(e)});var Pr=class extends le{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return wi(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new it(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new it(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Pr.create=(n,e)=>new Pr({innerType:n,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ae(e)});var Ri=class extends le{_parse(e){if(this._getType(e)!==q.nan){let r=this._getOrReturnCtx(e);return B(r,{code:O.invalid_type,expected:q.nan,received:r.parsedType}),ne}return{status:"valid",value:e.data}}};Ri.create=n=>new Ri({typeName:re.ZodNaN,...ae(n)});var QE=Symbol("zod_brand"),Us=class extends le{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},zs=class n extends le{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ne:s.status==="dirty"?(t.dirty(),br(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ne:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:re.ZodPipeline})}},Or=class extends le{_parse(e){let t=this._def.innerType._parse(e),r=i=>(Mn(i)&&(i.value=Object.freeze(i.value)),i);return wi(t)?t.then(i=>r(i)):r(t)}unwrap(){return this._def.innerType}};Or.create=(n,e)=>new Or({innerType:n,typeName:re.ZodReadonly,...ae(e)});function Ov(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Hv(n,e={},t){return n?On.create().superRefine((r,i)=>{let s=n(r);if(s instanceof Promise)return s.then(o=>{if(!o){let a=Ov(e,r),l=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!s){let o=Ov(e,r),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):On.create()}var e1={object:st.lazycreate},re;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(re||(re={}));var t1=(n,e={message:`Input not instance of ${n.name}`})=>Hv(t=>t instanceof n,e),Bv=Pn.create,Vv=_r.create,n1=Ri.create,r1=xr.create,Wv=wr.create,i1=kr.create,s1=Si.create,o1=Sr.create,a1=Er.create,l1=On.create,c1=ln.create,u1=Ft.create,d1=Ei.create,p1=cn.create,h1=st.create,f1=st.strictCreate,g1=Cr.create,m1=el.create,v1=Ar.create,y1=Ut.create,b1=tl.create,_1=Ci.create,x1=Ai.create,w1=nl.create,k1=Rr.create,S1=Tr.create,E1=Ir.create,C1=$r.create,A1=Nn.create,R1=_t.create,T1=yt.create,I1=zt.create,$1=_t.createWithPreprocess,M1=zs.create,P1=()=>Bv().optional(),O1=()=>Vv().optional(),N1=()=>Wv().optional(),L1={string:(n=>Pn.create({...n,coerce:!0})),number:(n=>_r.create({...n,coerce:!0})),boolean:(n=>wr.create({...n,coerce:!0})),bigint:(n=>xr.create({...n,coerce:!0})),date:(n=>kr.create({...n,coerce:!0}))};var F1=ne;var D1=p.object({selector:p.string(),route:p.union([p.string(),p.array(p.string())])}).strict(),jv=["ui.click","ui.scroll","ui.input","ui.change","ui.submit","ui.hover","ui.idle","ui.scroll_thrash","ui.focus_bounce","nav.page_view","nav.page_leave","behavior.rage_click","behavior.hesitation","behavior.confusion"],Uv=p.enum(jv).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),zv=["time_on_page","page_views","scroll_depth"],qv=p.enum(zv).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");var ld=p.object({type:p.literal("page_url"),url:p.string().describe('URL path to match (e.g. "/pricing", "/dashboard")')}).describe('Fires when the current page URL matches. Use for page-specific actions. Example: {"type": "page_url", "url": "/pricing"}'),cd=p.object({type:p.literal("route"),routeId:p.string().describe("Named route ID from the route filter")}).describe("Fires when the current route matches a named route ID."),ud=p.object({type:p.literal("anchor_visible"),anchorId:p.string().describe("CSS selector of the anchor element"),state:p.enum(["visible","present","absent"]).describe('"visible" = in viewport, "present" = in DOM, "absent" = not in DOM')}).describe(`Fires based on a DOM element's visibility state. Example: {"type": "anchor_visible", "anchorId": "#cta-button", "state": "visible"}`),dd=p.object({type:p.literal("event_occurred"),eventName:p.string().describe('Event name (e.g. "ui.click", "$pageview")'),withinMs:p.number().optional().describe("Time window in ms. Omit = any time this session.")}).describe('Fires when a specific event has occurred during this session. Example: {"type": "event_occurred", "eventName": "ui.click", "withinMs": 5000}'),pd=p.object({type:p.literal("state_equals"),key:p.string().describe("Key in the SDK persistent state store (localStorage). Only valid for keys the host app explicitly sets via syntro.state.set()."),value:p.unknown().describe("Expected value to match against")}).describe("Checks the SDK persistent state store (localStorage). ONLY for host-app state set via syntro.state.set() \u2014 NOT for user attributes like region, device, or UTM params (those are handled by segment targeting). Do NOT use this for targeting. If you do not know the valid state keys, do not use this condition type."),hd=p.object({type:p.literal("viewport"),minWidth:p.number().optional().describe("Minimum viewport width in pixels"),maxWidth:p.number().optional().describe("Maximum viewport width in pixels"),minHeight:p.number().optional().describe("Minimum viewport height in pixels"),maxHeight:p.number().optional().describe("Maximum viewport height in pixels")}).describe('Fires based on viewport (screen) size. Use for responsive behavior. Example: {"type": "viewport", "minWidth": 768} \u2014 fires on tablet and larger.'),fd=p.object({type:p.literal("session_metric"),key:qv,operator:p.enum(["gte","lte","eq","gt","lt"]),threshold:p.number().describe("Numeric threshold to compare against")}).describe('Fires when a session metric crosses a threshold. Valid keys: "time_on_page" (seconds), "page_views" (count), "scroll_depth" (0-100). Example: {"type": "session_metric", "key": "time_on_page", "operator": "gte", "threshold": 30}'),gd=p.object({type:p.literal("dismissed"),key:p.string().describe("Dismissal key (usually a tile or action ID)"),inverted:p.boolean().optional().describe("When true, fires if NOT dismissed (default behavior)")}).describe("Checks if an item has been dismissed by the user. Use with inverted: true to show only if not dismissed."),md=p.object({type:p.literal("cooldown_active"),key:p.string().describe("Cooldown key"),inverted:p.boolean().optional().describe("When true, fires if cooldown is NOT active")}).describe("Checks if a cooldown timer is currently active. Use to prevent showing the same intervention too frequently."),vd=p.object({type:p.literal("frequency_limit"),key:p.string().describe("Frequency counter key"),limit:p.number().describe("Maximum allowed count"),inverted:p.boolean().optional().describe("When true, fires if limit NOT reached")}).describe("Checks if a frequency limit has been reached. Use to cap how many times an action fires per session."),qs=p.object({equals:p.union([p.string(),p.number(),p.boolean()]).optional(),contains:p.string().optional()}).describe("Match operator for counter filters. Exactly one of equals or contains must be specified."),Zs=p.object({events:p.array(Uv).min(1).describe("Event names to count. Use values from the countable events enum."),match:p.record(p.string(),qs).optional().describe("Property filters. Keys are event prop names or element-chain fields (tag_name, $el_text, attr__*). All entries AND together.")}).describe("Defines what events to count. Registered as an accumulator predicate at config-load time."),yd=p.object({type:p.literal("event_count"),key:p.string().describe("Unique key for this counter (used for accumulator registration)"),operator:p.enum(["gte","lte","eq","gt","lt"]),count:p.number().int().min(0).describe("Target count threshold"),withinMs:p.number().positive().optional().describe("Time window in ms. Omit = count across entire session."),counter:Zs.optional().describe("Inline counter definition. Defines what events to count.")}).describe('Fires when accumulated event count crosses a threshold. Most powerful trigger type. Example: {"type": "event_count", "key": "pricing-clicks", "operator": "gte", "count": 3, "counter": {"events": ["ui.click"], "match": {"attr__data-cta": {"contains": "pricing"}}}}'),Ln=p.discriminatedUnion("type",[ld,cd,ud,dd,pd,hd,fd,gd,md,vd,yd]),Gs=p.object({conditions:p.array(Ln).describe("Array of conditions \u2014 ALL must match (AND logic) for this rule to fire."),value:p.unknown().describe("Value returned when all conditions match. For triggerWhen: true = fire the action.")}).describe("A single rule. ALL conditions must match (AND logic). Rules in a strategy are evaluated top-to-bottom \u2014 first rule where all conditions match wins and returns its value."),Ks=p.object({type:p.literal("rules"),rules:p.array(Gs).describe("Ordered list of rules. Evaluated top-to-bottom \u2014 first match wins."),default:p.unknown().describe("Fallback value when no rule matches. For triggerWhen: false = do not fire by default.")}).describe("Rule-based strategy. Evaluates rules top-to-bottom. First rule where ALL conditions match returns its value. If no rule matches, returns default. For triggerWhen: set value=true on matching rules, default=false."),Ys=p.object({type:p.literal("score"),field:p.string(),threshold:p.number(),above:p.unknown(),below:p.unknown()}).describe("Score-based strategy. Compares a field value against a threshold."),Xs=p.object({type:p.literal("model"),modelId:p.string(),inputs:p.array(p.string()),outputMapping:p.record(p.string(),p.unknown()),default:p.unknown()}).describe("ML model strategy. Sends inputs to a model and maps outputs."),Js=p.object({type:p.literal("external"),endpoint:p.string(),method:p.enum(["GET","POST"]).optional(),default:p.unknown(),timeoutMs:p.number().optional()}).describe("External API strategy. Calls an endpoint to determine the value."),Qs=p.discriminatedUnion("type",[Ks,Ys,Xs,Js]),rl=Qs.nullable().optional();var H1=p.object({events:p.array(p.string()),urlContains:p.string().optional(),props:p.record(p.union([p.string(),p.number(),p.boolean()])).optional()}),B1=p.object({title:p.string().optional(),body:p.string().optional(),icon:p.string().optional()}).nullable().optional();var Zv=p.object({include:p.array(p.string()).optional().describe("URL patterns where this tile appears. Supports *, **, :param wildcards. Use sparingly \u2014 mostly to isolate to specific webapp functionality. Omit to appear on all routes."),exclude:p.array(p.string()).optional().describe("URL patterns where this tile should NOT appear. Evaluated before include.")}),il=p.object({routes:Zv,onlyIfPopulated:p.boolean().optional().describe("When true, tile is hidden if none of its props.actions[] have an active triggerWhen. Useful for tiles with all-deferred FAQ questions or nav tips. Default: false.")});function VN(n){return Ln.safeParse(n)}function WN(n){return Qs.safeParse(n)}function jN(n){return il.safeParse(n)}var UN=[{defName:"matchOp",schema:qs},{defName:"counterDef",schema:Zs},{defName:"activationConfig",schema:il},{defName:"routeFilter",schema:Zv},{defName:"ruleStrategy",schema:Ks},{defName:"scoreStrategy",schema:Ys},{defName:"modelStrategy",schema:Xs},{defName:"externalStrategy",schema:Js},{defName:"rule",schema:Gs},{defName:"condition",schema:Ln}];var bd=p.object({tileId:p.string(),itemId:p.string().optional()}).strict(),V1=p.object({on:p.string(),title:p.string(),body:p.string().optional(),icon:p.string().optional(),ttl:p.number().optional(),cooldown:p.number().optional(),deepLink:bd.optional()}).strict(),W1=p.object({id:p.string(),title:p.string().optional(),subtitle:p.string().optional(),icon:p.string().optional(),priority:p.number().optional(),widget:p.string(),props:p.record(p.unknown()).optional(),activation:il.optional(),notifications:p.array(V1).optional()}).strict(),j1=p.object({position:p.enum(["left","right"]).optional(),layout:p.enum(["overlay","push"]).optional(),background:p.string().optional(),blur:p.string().optional(),border:p.string().optional(),width:p.string().optional(),transitionDuration:p.string().optional(),transitionEasing:p.string().optional(),transitionFade:p.string().optional()}),U1=p.object({background:p.string().optional(),backgroundHover:p.string().optional(),color:p.string().optional(),size:p.string().optional(),shadow:p.string().optional(),borderRadius:p.string().optional(),icon:p.string().optional()}),z1=p.object({background:p.string().optional(),backgroundHover:p.string().optional(),border:p.string().optional(),borderRadius:p.string().optional(),shadow:p.string().optional(),titleColor:p.string().optional(),textColor:p.string().optional(),iconBackground:p.string().optional(),iconShadow:p.string().optional(),headerPadding:p.string().optional(),bodyPadding:p.string().optional(),gap:p.string().optional()}),q1=p.object({background:p.string().optional(),textColor:p.string().optional(),titleColor:p.string().optional(),arrowColor:p.string().optional(),arrowSize:p.string().optional(),border:p.string().optional(),borderRadius:p.string().optional(),scrimOpacity:p.string().optional(),highlightRing:p.string().optional()}),Z1=p.object({background:p.string().optional(),textColor:p.string().optional(),textSecondaryColor:p.string().optional(),border:p.string().optional(),borderRadius:p.string().optional(),successColor:p.string().optional(),warningColor:p.string().optional(),errorColor:p.string().optional(),iconBackground:p.string().optional(),progressGradient:p.string().optional()}),G1=p.object({background:p.string().optional(),backgroundHover:p.string().optional(),border:p.string().optional(),borderRadius:p.string().optional(),textColor:p.string().optional(),textSecondaryColor:p.string().optional(),itemDivider:p.string().optional(),itemGap:p.string().optional(),itemPadding:p.string().optional(),itemFontSize:p.string().optional(),bodyPadding:p.string().optional(),bodyFontSize:p.string().optional(),categoryPadding:p.string().optional(),categoryGap:p.string().optional(),categoryFontSize:p.string().optional(),searchBackground:p.string().optional(),searchColor:p.string().optional(),chevronColor:p.string().optional()}),K1=p.object({mode:p.enum(["dark","light"]).optional(),fontFamily:p.string().optional(),colorPrimary:p.string().optional(),colorPrimaryHover:p.string().optional(),borderRadius:p.string().optional(),canvas:j1.optional(),launcher:U1.optional(),tile:z1.optional(),overlay:q1.optional(),notification:Z1.optional(),content:G1.optional()}).strict(),Y1=p.object({enabled:p.boolean().optional(),label:p.string().optional(),position:p.string().optional(),animate:p.boolean().optional(),animationStyle:p.enum(["pulse","bounce","glow"]).optional(),notificationCount:p.number().optional()}).strict(),KN=p.object({schemaVersion:p.string().optional(),fetchedAt:p.string().datetime(),configVersion:p.string().optional(),canvasTitle:p.string().optional(),tiles:p.array(W1),actions:p.array(p.any()),theme:K1.optional(),launcher:Y1.optional(),meta:p.object({verificationSteps:p.array(p.union([p.string(),p.object({text:p.string(),check:Ln.optional()})])).optional()}).passthrough().optional()}).strict();var De={triggerWhen:rl},xt=p.object({selector:p.string(),route:p.union([p.string(),p.array(p.string())])}).strict(),Gv=p.object({color:p.string().optional(),scrimOpacity:p.number().min(0).max(1).optional(),paddingPx:p.number().optional(),radiusPx:p.number().optional()}).strict(),Kv=p.enum(["top-left","top-right","bottom-left","bottom-right"]),Yv=p.enum(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"]),xd=p.object({label:p.string(),actionId:p.string(),primary:p.boolean().optional()}).strict(),Xv=p.object({title:p.string().optional(),body:p.string(),ctaButtons:p.array(xd).optional()}).strict(),Jv=p.object({title:p.string().optional(),body:p.string()}).strict(),Qv=p.enum(["before","after","prepend","append","replace"]),ey=p.enum(["immediate","hover","click"]),ty=p.object({widgetId:p.string(),props:p.record(p.unknown()).optional(),priority:p.number().optional()}).strict(),ny=p.object({id:p.string(),action:p.any(),route:p.string().optional(),onAction:p.record(p.string()).optional()}).passthrough(),ry=p.enum(["auto","smooth","instant"]),_d=p.enum(["start","center","end","nearest"]),iy=p.object({kind:p.literal("content:setText"),anchorId:xt,text:p.string(),label:p.string().optional()}).extend(De).strict(),sy=p.object({kind:p.literal("content:setAttr"),anchorId:xt,attr:p.string(),value:p.string(),label:p.string().optional()}).extend(De).strict(),oy=p.object({kind:p.literal("content:addClass"),anchorId:xt,className:p.string(),label:p.string().optional()}).extend(De).strict(),ay=p.object({kind:p.literal("content:removeClass"),anchorId:xt,className:p.string(),label:p.string().optional()}).extend(De).strict(),ly=p.object({kind:p.literal("content:setStyle"),anchorId:xt,styles:p.record(p.string()),label:p.string().optional()}).extend(De).strict(),cy=p.object({kind:p.literal("content:insertHtml"),anchorId:xt,html:p.string(),position:Qv,deepLink:bd.optional(),label:p.string().optional()}).extend(De).strict(),uy=p.object({kind:p.literal("overlays:highlight"),anchorId:xt,style:Gv.optional(),duration:p.number().optional(),label:p.string().optional()}).extend(De).strict(),dy=p.object({kind:p.literal("overlays:pulse"),anchorId:xt,duration:p.number().optional(),label:p.string().optional()}).extend(De).strict(),py=p.object({kind:p.literal("overlays:badge"),anchorId:xt,content:p.string(),position:Kv.optional(),label:p.string().optional()}).extend(De).strict(),hy=p.object({kind:p.literal("overlays:tooltip"),anchorId:xt,content:Xv,trigger:ey.optional(),placement:Yv.optional(),waitFor:p.string().optional(),label:p.string().optional()}).extend(De).strict(),fy=p.object({kind:p.literal("overlays:modal"),content:Jv,size:p.enum(["sm","md","lg"]).optional(),blocking:p.boolean().optional(),scrim:p.object({opacity:p.number().min(0).max(1).optional()}).strict().optional(),dismiss:p.object({onEsc:p.boolean().optional(),closeButton:p.boolean().optional(),timeoutMs:p.number().min(0).optional()}).strict().optional(),ctaButtons:p.array(xd).optional(),waitFor:p.string().optional(),label:p.string().optional()}).extend(De).strict(),gy=p.object({kind:p.literal("navigation:scrollTo"),anchorId:xt,behavior:ry.optional(),block:_d.optional(),inline:_d.optional(),label:p.string().optional()}).extend(De).strict(),my=p.object({kind:p.literal("navigation:navigate"),url:p.string(),target:p.enum(["_self","_blank"]).optional(),label:p.string().optional()}).extend(De).strict(),vy=p.object({kind:p.literal("core:mountWidget"),slot:p.string(),widget:ty,label:p.string().optional()}).extend(De).strict(),yy=p.object({kind:p.literal("core:wait"),durationMs:p.number().min(0).optional(),event:p.string().optional(),label:p.string().optional()}).extend(De).strict(),by=p.object({kind:p.literal("core:sequence"),actions:p.array(p.any()),label:p.string().optional()}).extend(De).strict(),_y=p.object({kind:p.literal("core:parallel"),actions:p.array(p.any()),waitFor:p.enum(["all","any"]).optional(),label:p.string().optional()}).extend(De).strict(),xy=p.object({kind:p.literal("overlays:tour"),tourId:p.string(),steps:p.array(ny).min(1),startStep:p.string().optional(),autoStart:p.boolean().optional(),label:p.string().optional()}).extend(De).passthrough(),X1=[{defName:"setText",schema:iy},{defName:"setAttr",schema:sy},{defName:"addClass",schema:oy},{defName:"removeClass",schema:ay},{defName:"setStyle",schema:ly},{defName:"insertHtml",schema:cy},{defName:"highlight",schema:uy},{defName:"pulse",schema:dy},{defName:"badge",schema:py},{defName:"tooltip",schema:hy},{defName:"modal",schema:fy},{defName:"scrollTo",schema:gy},{defName:"navigate",schema:my},{defName:"mountWidget",schema:vy},{defName:"wait",schema:yy},{defName:"sequence",schema:by},{defName:"parallel",schema:_y},{defName:"tour",schema:xy}];function wd(n){let e=n?.root??(typeof document<"u"?document.body:null),t=n?.defaultTimeoutMs??5e3,r=new Map,i=new Map,s=null,o=!1;function a(m){if(!e)return null;try{return e.matches(m)?e:e.querySelector(m)}catch{return null}}function l(){for(let[m,y]of r){let k=a(m);if(k){for(let _ of y)clearTimeout(_.timer),_.resolve(k);r.delete(m)}}for(let[m,y]of i){let k=a(m);if(k){for(let _ of y)_.cancelled||_.cb(k);i.delete(m)}}r.size===0&&i.size===0&&u()}function c(){s||o||typeof MutationObserver>"u"||!e||(s=new MutationObserver(()=>{l()}),s.observe(e,{childList:!0,subtree:!0}))}function u(){s&&(s.disconnect(),s=null)}function d(m,y){let k=r.get(m);k&&(k.delete(y),k.size===0&&r.delete(m)),r.size===0&&i.size===0&&u()}function h(m,y){if(o)return Promise.reject(new Error("AnchorResolver destroyed"));let k=a(m);if(k)return Promise.resolve(k);let _=y??t;return new Promise((b,x)=>{let R={resolve:b,reject:x,timer:setTimeout(()=>{d(m,R),x(new Error(`waitFor("${m}") timed out after ${_}ms`))},_)},w=r.get(m);w||(w=new Set,r.set(m,w)),w.add(R),c()})}function g(m,y){if(o)return()=>{};let k=a(m);if(k)return y(k),()=>{};let _={cb:y,cancelled:!1},b=i.get(m);return b||(b=new Set,i.set(m,b)),b.add(_),c(),()=>{_.cancelled=!0;let x=i.get(m);x&&(x.delete(_),x.size===0&&i.delete(m)),r.size===0&&i.size===0&&u()}}function v(){let m=0;for(let y of r.values())m+=y.size;return m}function f(){o=!0,u();let m=new Error("AnchorResolver destroyed");for(let y of r.values())for(let k of y)clearTimeout(k.timer),k.reject(m);r.clear(),i.clear()}return{resolve:a,waitFor:h,onAppear:g,pendingCount:v,destroy:f}}var wy={timeout:300,className:"sc-anti-flicker",style:"opacity: 0 !important",hostLoadingSelector:"",waitForHostReady:""};function ky(n={}){let{timeout:e,className:t,style:r,hostLoadingSelector:i,waitForHostReady:s}={...wy,...n};if(i&&document.querySelector(i))return()=>{};let o=document.createElement("style");o.textContent=`.${t} { ${r} }`,document.head.appendChild(o),document.documentElement.classList.add(t);let a=!1,l=()=>{a||(a=!0,clearTimeout(u),document.documentElement.classList.remove(t),o.remove(),s&&c&&document.removeEventListener(s,c))},c;s&&(c=()=>l(),document.addEventListener(s,c));let u=setTimeout(()=>{l()},e);return()=>{l()}}function J1(n={}){let{className:e,style:t}={...wy,...n};return`
|
|
892
892
|
(function() {
|
|
893
893
|
var s = document.createElement('style');
|
|
894
894
|
s.textContent = '.${e} { ${t} }';
|
|
895
895
|
document.head.appendChild(s);
|
|
896
896
|
document.documentElement.className += ' ${e}';
|
|
897
|
-
})();`}var
|
|
897
|
+
})();`}var Q1=["cdn.syntrologie.com","api.syntrologie.com","dev-api.syntrologie.com","localhost","127.0.0.1",".syntrologie.com"];function Sy(n){if(typeof window>"u")return null;let t=new URLSearchParams(window.location.search).get(n);if(!t)return null;try{let r=t.replace(/-/g,"+").replace(/_/g,"/");return JSON.parse(atob(r))}catch(r){return Qe("Syntro Runtime",`Failed to decode ${n}:`,r),null}}var kd="__syntro_rt_editor_source",Sd="__syntro_rt_editor_conf";function sl(n,e){try{sessionStorage.setItem(n,JSON.stringify(e))}catch{}}function Ey(n){try{let e=sessionStorage.getItem(n);return e?JSON.parse(e):null}catch{return null}}var Fn,Dn;function to(){if(Fn==null){let n=typeof window<"u"?window.__SYNTRO_EDITOR_PARAMS__:null;if(n?.token)Fn={token:n.token,api_base:n.apiBase||""},sl(kd,Fn),console.log(`[DIAG] getEditorSource: from __SYNTRO_EDITOR_PARAMS__ (token=${Fn.token.slice(0,15)}...)`);else{let e=Sy("editor_source");if(e)Fn=e,sl(kd,e);else{let t=Ey(kd);t?.token&&(Fn=t,console.log(`[DIAG] getEditorSource: restored from sessionStorage (token=${t.token.slice(0,15)}...)`))}console.log(`[DIAG] getEditorSource: from URL param \u2192 ${e?`token=${e.token?.slice(0,15)}...`:"NULL"}`),!e&&typeof window<"u"&&console.log(`[DIAG] getEditorSource: URL search = ${window.location.search.slice(0,200)}`)}}return Fn??null}function ol(){if(Dn==null){let n=typeof window<"u"?window.__SYNTRO_EDITOR_PARAMS__:null;if(n?.mode)Dn={mode:n.mode,audit_session_id:n.auditSessionId,syntro_token:n.syntroToken,workspace_id:n.workspaceId},sl(Sd,Dn),console.log(`[DIAG] getEditorConf: from __SYNTRO_EDITOR_PARAMS__ (mode=${Dn.mode})`);else{let e=Sy("editor_conf");if(e)Dn=e,sl(Sd,e);else{let t=Ey(Sd);t?.mode&&(Dn=t,console.log(`[DIAG] getEditorConf: restored from sessionStorage (mode=${t.mode})`))}console.log(`[DIAG] getEditorConf: from URL param \u2192 ${e?`mode=${e.mode}`:"NULL"}`)}}return Dn??null}function eC(n){K("Syntro Runtime","Validating editor URL:",n);try{if(n.startsWith("/"))return K("Syntro Runtime","\u2713 Relative URL allowed (same-origin):",n),!0;let e=new URL(n),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(Qe("Syntro Runtime","\u274C Editor URL must use HTTPS:",n),!1):Q1.some(i=>i.startsWith(".")?e.hostname.endsWith(i)||e.hostname===i.slice(1):e.hostname===i)?(K("Syntro Runtime","\u2713 Editor URL validated"),!0):(Qe("Syntro Runtime","\u274C Editor URL host not in allowlist:",e.hostname),!1)}catch(e){return Qe("Syntro Runtime",`\u274C Invalid editor URL: ${n}`,e),!1}}var al=()=>{let n=ol();return!to()?.token||!n?.mode?null:n.mode};function tC(){return to()?.token??null}function nC(){return to()?.api_base??null}var eo=null,Cy=async n=>{if(K("Syntro Runtime","====== LOAD EDITOR SDK ======"),typeof window>"u"){K("Syntro Runtime","Not in browser - skipping editor SDK load");return}if(window.SyntroEditor){K("Syntro Runtime","Editor SDK already loaded (window.SyntroEditor exists)");return}if(eo)return K("Syntro Runtime","Editor SDK load already in progress, waiting..."),eo;let e=typeof n=="string"?{editorUrl:n}:n??{};if(e.editorUrl==="skip"){K("Syntro Runtime",'editorUrl="skip" \u2014 deferring to caller'),K("Syntro Runtime","================================");return}let t=nC(),i=(t?`${t}/api/editor/sdk/editor-sdk.js`:null)||e.editorUrl;if(!i){Qe("Syntro Runtime","\u274C No editor SDK URL available (no api_base, no editorUrl option)"),K("Syntro Runtime","================================");return}let s=tC(),o=s?`${i}?token=${encodeURIComponent(s)}`:i;if(K("Syntro Runtime","Editor URL:",o),K("Syntro Runtime","Options:",{hasIntegrity:!!e.integrity,hasEditorUrl:!!i,hasApiBase:!!t,tokenPrefix:s?`${s.slice(0,10)}...`:"none"}),!eC(i)){console.error("[Syntro Runtime] \u274C BLOCKED: Editor from untrusted URL:",i),K("Syntro Runtime","================================");return}return K("Syntro Runtime","\u2713 URL validated, injecting script tag..."),eo=new Promise((a,l)=>{let c=document.createElement("script");c.src=o,c.async=!0,e.integrity&&(c.integrity=e.integrity,c.crossOrigin="anonymous",K("Syntro Runtime","SRI integrity check enabled")),c.onload=()=>{K("Syntro Runtime","\u2713 Editor SDK script loaded successfully"),K("Syntro Runtime","================================"),a()},c.onerror=u=>{console.error("[Syntro Runtime] \u274C Failed to load Editor SDK:",u),console.error("[Syntro Runtime] URL attempted:",o),K("Syntro Runtime","================================"),eo=null,l(u)},document.head.appendChild(c),K("Syntro Runtime","Script tag appended to <head>")}),eo};var qt=null;function Ry(n){qt&&qt!==n?n.appendChild(qt):qt=n;let e=n.getRootNode();e instanceof ShadowRoot&&rC(e)}function Ty(){return qt||(qt=document.createElement("div"),qt.id="syntro-overlays",Object.assign(qt.style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),document.body.appendChild(qt)),qt}var Ay=!1;function rC(n){if(Ay)return;let e=`
|
|
898
898
|
:host {
|
|
899
899
|
--syntro-surface: var(--sc-overlay-background, #0f1318);
|
|
900
900
|
--syntro-fg: var(--sc-overlay-text-color, #cbd0d7);
|
|
@@ -1156,10 +1156,10 @@ Actions:`,x.map((F,Z)=>` [${Z}] ${F.kind} ${F.anchorId?`anchor="${F.anchorId.se
|
|
|
1156
1156
|
.syntro-modal-btn-primary:hover {
|
|
1157
1157
|
background: var(--syntro-accent-hover, #d44844);
|
|
1158
1158
|
}
|
|
1159
|
-
`,t=document.createElement("style");t.setAttribute("data-syntro","base-overlay"),t.textContent=e,n.appendChild(t),wy=!0}var xd=async(n={})=>{if(typeof window>"u"||typeof document>"u")throw new Error("SmartCanvas can only be created in a browser-like environment");let e=null;if(n.antiFlicker){let m=typeof n.antiFlicker=="object"?n.antiFlicker:{};e=yy(m)}let t=null,r=null,i=null,{runtime:s}=n;async function o(m){!s?.actions||m.length===0||(i?.isApplied()&&await i.revertAll(),i=await s.actions.applyBatch(m))}async function a(){i?.isApplied()&&(await i.revertAll(),i=null)}if(n.fetcher)try{r=n.fetcher,console.log("[SmartCanvas] Fetching initial config...");let m=await n.fetcher();t=m,console.log("[SmartCanvas] Config fetched:",`tiles=${m.tiles?.length??0},`,`actions=${m.actions?.length??0},`,`theme=${m.theme?.mode??"default"}`),m.actions?.length&&console.log("[SmartCanvas] Actions to apply:",m.actions.map((y,k)=>`[${k}] ${y.kind}${y.anchorId?` anchor="${y.anchorId.selector}"`:""}${y.label?` "${y.label}"`:""}`).join(", ")),m.actions&&m.actions.length>0&&s?.actions&&(await o(m.actions),console.log("[SmartCanvas] Initial actions applied successfully")),m.tiles&&s?.accumulator&&fi(m.tiles,s.accumulator,m.actions)}catch(m){console.error("[SmartCanvas] Error fetching/applying initial config:",m)}e&&e();let l=ol();ja();let c=document.createElement("smart-canvas");if(n.tokens)for(let[m,y]of Object.entries(n.tokens))c.style.setProperty(m,y);let u=n.integrations?.experiments,d=n.integrations?.telemetry,h=n.fetcher??hi({configUri:n.configUri,experiments:u,featureKey:n.configUriFeatureKey,credentials:n.fetchCredentials});r||(r=h);let g={fetcher:h,configUri:n.configUri,configUriFeatureKey:n.configUriFeatureKey,fetchCredentials:n.fetchCredentials,experiments:u,telemetry:d,runtime:s,initialBatchHandle:i,workspaceTheme:n.workspaceTheme};c.mountLitApp(g),n.defaultOpen&&c.open();let v=()=>{let m=n.target??document.body;if(m){m.appendChild(c);let y=c.getOverlayContainer();y&&ky(y)}};document.body?v():document.addEventListener("DOMContentLoaded",v,{once:!0}),(l||n.editorUrl)&&(console.log(`[SmartCanvas] Loading editor SDK for ${l??"config"} mode`),xy(n.editorUrl).catch(console.error));let f={el:c,open:()=>c.open(),close:()=>c.close(),destroy:()=>{a(),c.remove()},setTokens:m=>{for(let[y,k]of Object.entries(m))c.style.setProperty(y,k)},getConfig:async()=>{if(r)try{let m=await r();return t=m,m}catch(m){console.error("[SmartCanvas] Error fetching config:",m)}return t??{tiles:[],actions:[],fetchedAt:""}},setEnabled:async m=>{m?t&&await o(t.actions):await a()},setOverrideFetcher:m=>{r=m,c.setOverrideFetcher(m),s?.accumulator&&m().then(y=>{y?.tiles&&fi(y.tiles,s.accumulator,y.actions)}).catch(()=>{})},registerTelemetryProperties:m=>{d?.register?.(m)},getSessionId:()=>d?.getSessionId?.(),startSessionRecording:()=>{d?.startSessionRecording?.()},track:(m,y)=>d?.track?(d.track(m,y),!0):!1,runtime:s};if(typeof window<"u"){let m=window.SynOS;m&&(m.handle=f)}return f};typeof window<"u"&&(window.SmartCanvas={async create(n){return xd(n)}});var wd="syn_";function to(n){if(!n.startsWith(wd))throw new Error("Invalid Syntro token: must start with 'syn_'");let t=n.slice(wd.length).replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),i=JSON.parse(r);if(i.v!==1)throw new Error(`Unsupported token version: ${i.v}`);return i}function kd(n){let e=JSON.stringify(n),t=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return wd+t}function kt(n){if(typeof process<"u"&&process.env)return process.env[n];try{let e=(0,eval)("import.meta");if(e?.env)return e.env[n]}catch{}}var Cy="syntro_segment_attributes";function Ay(){if(typeof window>"u")return{};try{let n=localStorage.getItem(Cy);if(n){let e=JSON.parse(n);return X("Syntro Bootstrap","Loaded cached segment attributes:",e),e}}catch(n){ct("Syntro Bootstrap","Failed to load cached segment attributes:",n)}return{}}function Ry(n){if(!(typeof window>"u"))try{localStorage.setItem(Cy,JSON.stringify(n)),X("Syntro Bootstrap","Cached segment attributes:",n)}catch(e){ct("Syntro Bootstrap","Failed to cache segment attributes:",e)}}function Ty(n){if(!n)return{};let e={};for(let[t,r]of Object.entries(n))t.startsWith("in_segment_")&&(e[t]=r===!0);return e}function Sd(){if(typeof window>"u")return{};let n={};try{let e=new URLSearchParams(window.location.search);for(let t of["utm_source","utm_medium","utm_campaign","utm_content","utm_term"]){let r=e.get(t);r&&(n[t]=r)}}catch{}try{navigator.language&&(n.browser_language=navigator.language),navigator.languages?.length&&(n.browser_languages=[...navigator.languages])}catch{}try{let e=window.innerWidth;n.device_type=e<768?"mobile":e<1024?"tablet":"desktop"}catch{}try{if(document.referrer){n.referrer=document.referrer;try{n.referrer_hostname=new URL(document.referrer).hostname}catch{}}}catch{}try{let e=navigator.userAgent;e.includes("Edg/")?n.browser="Edge":e.includes("OPR/")||e.includes("Opera")?n.browser="Opera":e.includes("Chrome/")&&!e.includes("Chromium")?n.browser="Chrome":e.includes("Safari/")&&!e.includes("Chrome")?n.browser="Safari":e.includes("Firefox/")&&(n.browser="Firefox"),e.includes("Windows")?n.os="Windows":e.includes("iPhone")||e.includes("iPad")?n.os="iOS":e.includes("Mac OS X")||e.includes("Macintosh")?n.os="macOS":e.includes("Android")?n.os="Android":e.includes("Linux")&&(n.os="Linux")}catch{}try{n.page_url=window.location.href,n.page_path=window.location.pathname,n.page_host=window.location.hostname,window.location.search&&(n.page_query=window.location.search)}catch{}try{let e=window.Telegram?.WebApp;e?(n.surface_type="telegram",n.surface_host=e.platform||"unknown"):(n.surface_type="web",n.surface_host="web")}catch{n.surface_type="web",n.surface_host="web"}return n}var Ey="syntro_geo",Iy="https://geo.syntrologie.com";async function Ed(n){if(typeof window>"u")return{};try{let e=localStorage.getItem(Ey);if(e){let t=JSON.parse(e);return X("Syntro Bootstrap","Geo: using cached data:",t),t}}catch{}try{let e=await fetch(n,{signal:AbortSignal.timeout(2e3)});if(e.ok){let t=await e.json(),r={};for(let[i,s]of Object.entries(t))typeof s=="string"&&s&&(r[i]=s);try{localStorage.setItem(Ey,JSON.stringify(r))}catch{}return X("Syntro Bootstrap","Geo: fetched from worker:",r),r}}catch{}return{}}var $y="app:",J1="syntro:",eC=/^[a-z][a-z0-9_]*$/;function Cd(n){if(!n)return{valid:!1,reason:"Event name cannot be empty"};if(n.startsWith(J1))return{valid:!1,reason:'"syntro:" prefix is reserved for internal SDK events'};if(!n.startsWith($y))return{valid:!1,reason:`Custom events must start with "app:" prefix. Got: "${n}"`};let e=n.slice($y.length).split(":");if(e.length<2)return{valid:!1,reason:`Event name must have at least 2 segments after "app:" (app:{category}:{action}). Got: "${n}"`};for(let t of e)if(!eC.test(t))return{valid:!1,reason:`Segment "${t}" must be lowercase alphanumeric + underscores. Got: "${n}"`};return{valid:!0}}function tC(n){return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||n===null}function My(n,e,t=0){if(t>=e)return!1;for(let r of Object.values(n))if(r!==null&&typeof r=="object"&&!Array.isArray(r)&&!My(r,e,t+1))return!1;return!0}function Ad(n){if(n===void 0)return{valid:!0};if(n===null||typeof n!="object"||Array.isArray(n))return{valid:!1,reason:"Props must be a plain object"};if(!My(n,2))return{valid:!1,reason:"Props nesting depth exceeds 2 levels"};let e=[];for(let[t,r]of Object.entries(n))r!==null&&typeof r=="object"||tC(r)||e.push(t);return e.length>0?{valid:!0,stripped:e}:{valid:!0}}function al(n,e){return e?!(e.names&&e.names.length>0&&!e.names.includes(n.name)||e.patterns&&e.patterns.length>0&&!e.patterns.some(r=>{try{return new RegExp(r).test(n.name)}catch{return!1}})||e.sources&&e.sources.length>0&&!e.sources.includes(n.source)):!0}var ll=class{constructor(e={}){this.subscriptions=new Set;this.history=[];this.maxHistorySize=e.maxHistorySize??100,this.debug=e.debug??!1,this.emitHistory=e.history??null,this.posthogCapture=e.posthogCapture??null,this.testMode=e.testMode??!1}subscribe(e,t){let r,i;typeof e=="function"?(r=void 0,i=e):(r=e,i=t);let s={filter:r,callback:i};return this.subscriptions.add(s),()=>{this.subscriptions.delete(s)}}publish(e,t,r="canvas"){let i={ts:Date.now(),name:e,source:r,props:t,schemaVersion:Te};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let t of this.subscriptions)if(al(e,t.filter))try{t.callback(e)}catch(r){console.error("[EventBus] Subscriber error:",r)}}emit(e,t){let r=Cd(e);if(!r.valid)return console.warn(`[EventBus] emit() rejected: ${r.reason}`),this.debug?{delivered:!1,matchedRules:[],posthogCaptured:!1,listenersNotified:0}:void 0;let i=Ad(t);if(!i.valid)return console.warn(`[EventBus] emit() rejected props: ${i.reason}`),this.debug?{delivered:!1,matchedRules:[],posthogCaptured:!1,listenersNotified:0}:void 0;let s={ts:Date.now(),name:e,source:"custom",props:t,schemaVersion:Te};this.history.push(s),this.history.length>this.maxHistorySize&&this.history.shift();let o=0;for(let l of this.subscriptions)if(al(s,l.filter))try{l.callback(s),o++}catch(c){console.error("[EventBus] Subscriber error:",c),o++}let a=!1;if(this.posthogCapture&&!this.testMode)try{this.posthogCapture(e,t),a=!0}catch(l){console.error("[EventBus] PostHog capture error:",l)}if(this.emitHistory&&this.emitHistory.record({name:e,props:t,source:"custom",timestamp:s.ts,matchedRules:[]}),this.debug)return console.debug("[EventBus] emit()",{name:e,props:t,listenersNotified:o,posthogCaptured:a}),{delivered:!0,matchedRules:[],posthogCaptured:a,listenersNotified:o}}setPosthogCapture(e){this.posthogCapture=e}getRecent(e,t){let r=this.history;return e&&(r=r.filter(i=>al(i,e))),t&&t>0&&(r=r.slice(-t)),r}hasRecentEvent(e,t,r){let i=Date.now()-t;return this.history.some(s=>s.name===e&&s.ts>=i&&(r===void 0||s.source===r))}countRecentEvents(e,t){let r=this.history.filter(i=>al(i,e));if(t!==void 0){let i=Date.now()-t;r=r.filter(s=>s.ts>=i)}return r.length}clearHistory(){this.history=[]}getSubscriberCount(){return this.subscriptions.size}};function no(n={}){return new ll(n)}var ro=class{constructor(e=100){this.entries=[];this.maxSize=e}record(e){this.entries.push(e),this.maxSize>0&&this.entries.length>this.maxSize&&this.entries.shift()}getAll(){return[...this.entries]}clear(){this.entries=[]}};var Oy={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function Ny(){return Oy}function Rd(n){let e=2166136261,t=n.length;for(let r=0;r<t;r++)e^=n.charCodeAt(r),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0}function io(n,e,t){return t===2?Rd(Rd(n+e)+"")%1e4/1e4:t===1?Rd(e+n)%1e3/1e3:null}function nC(n){return n<=0?[]:new Array(n).fill(1/n)}function cl(n,e){return n>=e[0]&&n<e[1]}function Ly(n,e){let t=io("__"+e[0],n,1);return t===null?!1:t>=e[1]&&t<e[2]}function Fy(n,e){for(let t=0;t<e.length;t++)if(cl(n,e[t]))return t;return-1}function Id(n){try{let e=n.replace(/([^\\])\//g,"$1\\/");return new RegExp(e)}catch(e){console.error(e);return}}function ul(n,e){if(!e.length)return!1;let t=!1,r=!1;for(let i=0;i<e.length;i++){let s=sC(n,e[i].type,e[i].pattern);if(e[i].include===!1){if(s)return!1}else t=!0,s&&(r=!0)}return r||!t}function rC(n,e,t){try{let r=e.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return t&&(r="\\/?"+r.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+r+"$","i").test(n)}catch{return!1}}function iC(n,e){try{let t=new URL(e.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),r=[[n.host,t.host,!1],[n.pathname,t.pathname,!0]];return t.hash&&r.push([n.hash,t.hash,!1]),t.searchParams.forEach((i,s)=>{r.push([n.searchParams.get(s)||"",i,!1])}),!r.some(i=>!rC(i[0],i[1],i[2]))}catch{return!1}}function sC(n,e,t){try{let r=new URL(n,"https://_");if(e==="regex"){let i=Id(t);return i?i.test(r.href)||i.test(r.href.substring(r.origin.length)):!1}else if(e==="simple")return iC(r,t);return!1}catch{return!1}}function Dy(n,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);let r=nC(n);t=t||r,t.length!==n&&(t=r);let i=t.reduce((o,a)=>a+o,0);(i<.99||i>1.01)&&(t=r);let s=0;return t.map(o=>{let a=s;return s+=o,[a,a+e*o]})}function Hy(n,e,t){if(!e)return null;let r=e.split("?")[1];if(!r)return null;let i=r.replace(/#.*/,"").split("&").map(s=>s.split("=",2)).filter(([s])=>s===n).map(([,s])=>parseInt(s));return i.length>0&&i[0]>=0&&i[0]<t?i[0]:null}function By(n){try{return n()}catch(e){return console.error(e),!1}}var Td=n=>Uint8Array.from(atob(n),e=>e.charCodeAt(0));async function Nr(n,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||Oy.SubtleCrypto,!t)throw new Error("No SubtleCrypto implementation found");try{let r=await t.importKey("raw",Td(e),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=n.split("."),o=await t.decrypt({name:"AES-CBC",iv:Td(i)},r,Td(s));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function so(n){return typeof n=="string"?n:JSON.stringify(n)}function ut(n){typeof n=="number"&&(n=n+""),(!n||typeof n!="string")&&(n="0");let e=n.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return e.length===3&&e.push("~"),e.map(t=>t.match(/^[0-9]+$/)?t.padStart(5," "):t).join("-")}function Vy(){let n;try{n="1.6.4"}catch{n=""}return n}function Wy(n,e){let t,r;try{t=new URL(n),r=new URL(e)}catch(i){return console.error(`Unable to merge query strings: ${i}`),e}return t.searchParams.forEach((i,s)=>{r.searchParams.has(s)||r.searchParams.set(s,i)}),r.toString()}function Py(n){return typeof n=="object"&&n!==null}function dl(n){return n.urlPatterns&&n.variations.some(e=>Py(e)&&"urlRedirect"in e)?"redirect":n.variations.some(e=>Py(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function pl(n,e){return new Promise(t=>{let r=!1,i,s=o=>{r||(r=!0,i&&clearTimeout(i),t(o||null))};e&&(i=setTimeout(()=>s(),e)),n.then(o=>s(o)).catch(()=>s())})}var Ge={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},zt=Ny(),Ti={fetchFeaturesCall:({host:n,clientKey:e,headers:t})=>zt.fetch(`${n}/api/features/${e}`,{headers:t}),fetchRemoteEvalCall:({host:n,clientKey:e,payload:t,headers:r})=>{let i={method:"POST",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(t)};return zt.fetch(`${n}/api/eval/${e}`,i)},eventSourceCall:({host:n,clientKey:e,headers:t})=>t?new zt.EventSource(`${n}/sub/${e}`,{headers:t}):new zt.EventSource(`${n}/sub/${e}`),startIdleListener:()=>{let n;if(!(typeof window<"u"&&typeof document<"u"))return;let t=()=>{document.visibilityState==="visible"?(window.clearTimeout(n),lC()):document.visibilityState==="hidden"&&(n=window.setTimeout(aC,Ge.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(zt.localStorage=globalThis.localStorage)}catch{}var Ii=new Map,jy=!1,ln=new Map,hl=new Map,$i=new Map,Mi=new Set;function zy(n){Object.assign(Ge,n),Ge.backgroundSync||Ld()}async function qy({instance:n,timeout:e,skipCache:t,allowStale:r,backgroundSync:i}){return i||(Ge.backgroundSync=!1),cC({instance:n,allowStale:r,timeout:e,skipCache:t})}function oC(n){let e=oo(n),t=Ii.get(e)||new Set;t.add(n),Ii.set(e,t)}function Zy(n){Ii.forEach(e=>e.delete(n))}function aC(){$i.forEach(n=>{n&&(n.state="idle",Od(n))})}function lC(){$i.forEach(n=>{n&&n.state==="idle"&&Nd(n)})}async function Uy(){try{if(!zt.localStorage)return;await zt.localStorage.setItem(Ge.cacheKey,JSON.stringify(Array.from(ln.entries())))}catch{}}async function cC({instance:n,allowStale:e,timeout:t,skipCache:r}){let i=oo(n),s=Md(n),o=new Date,a=new Date(o.getTime()-Ge.maxAge+Ge.staleTTL);await uC();let l=!Ge.disableCache&&!r?ln.get(s):void 0;return l&&(e||l.staleAt>o)&&l.staleAt>a?(l.sse&&Mi.add(i),l.staleAt<o?$d(n):Pd(n),{data:l.data,success:!0,source:"cache"}):await pl($d(n),t)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function oo(n){let[e,t]=n.getApiInfo();return`${e}||${t}`}function Md(n){let e=oo(n);if(!("isRemoteEval"in n)||!n.isRemoteEval())return e;let t=n.getAttributes(),r=n.getCacheKeyAttributes()||Object.keys(n.getAttributes()),i={};r.forEach(a=>{i[a]=t[a]});let s=n.getForcedVariations(),o=n.getUrl();return`${e}||${JSON.stringify({ca:i,fv:s,url:o})}`}async function uC(){if(!jy){jy=!0;try{if(zt.localStorage){let n=await zt.localStorage.getItem(Ge.cacheKey);if(!Ge.disableCache&&n){let e=JSON.parse(n);e&&Array.isArray(e)&&e.forEach(([t,r])=>{ln.set(t,{...r,staleAt:new Date(r.staleAt)})}),Gy()}}}catch{}if(!Ge.disableIdleStreams){let n=Ti.startIdleListener();n&&(Ti.stopIdleListener=n)}}}function Gy(){let n=Array.from(ln.entries()).map(([t,r])=>({key:t,staleAt:r.staleAt.getTime()})).sort((t,r)=>t.staleAt-r.staleAt),e=Math.min(Math.max(0,ln.size-Ge.maxEntries),ln.size);for(let t=0;t<e;t++)ln.delete(n[t].key)}function Ky(n,e,t){let r=t.dateUpdated||"",i=new Date(Date.now()+Ge.staleTTL),s=Ge.disableCache?void 0:ln.get(e);if(s&&r&&s.version===r){s.staleAt=i,Uy();return}Ge.disableCache||(ln.set(e,{data:t,version:r,staleAt:i,sse:Mi.has(n)}),Gy()),Uy();let o=Ii.get(n);o&&o.forEach(a=>dC(a,t))}async function dC(n,e){await n.setPayload(e||n.getPayload())}async function $d(n){let{apiHost:e,apiRequestHeaders:t}=n.getApiHosts(),r=n.getClientKey(),i="isRemoteEval"in n&&n.isRemoteEval(),s=oo(n),o=Md(n),a=hl.get(o);return a||(a=(i?Ti.fetchRemoteEvalCall({host:e,clientKey:r,payload:{attributes:n.getAttributes(),forcedVariations:n.getForcedVariations(),forcedFeatures:Array.from(n.getForcedFeatures().entries()),url:n.getUrl()},headers:t}):Ti.fetchFeaturesCall({host:e,clientKey:r,headers:t})).then(c=>{if(!c.ok)throw new Error(`HTTP error: ${c.status}`);return c.headers.get("x-sse-support")==="enabled"&&Mi.add(s),c.json()}).then(c=>(Ky(s,o,c),Pd(n),hl.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(hl.delete(o),{data:null,source:"error",success:!1,error:c})),hl.set(o,a)),a}function Pd(n,e=!1){let t=oo(n),r=Md(n),{streamingHost:i,streamingHostRequestHeaders:s}=n.getApiHosts(),o=n.getClientKey();if(e&&Mi.add(t),Ge.backgroundSync&&Mi.has(t)&&zt.EventSource){if($i.has(t))return;let a={src:null,host:i,clientKey:o,headers:s,cb:l=>{try{if(l.type==="features-updated"){let c=Ii.get(t);c&&c.forEach(u=>{$d(u)})}else if(l.type==="features"){let c=JSON.parse(l.data);Ky(t,r,c)}a.errors=0}catch{Yy(a)}},errors:0,state:"active"};$i.set(t,a),Nd(a)}}function Yy(n){if(n.state!=="idle"&&(n.errors++,n.errors>3||n.src&&n.src.readyState===2)){let e=Math.pow(3,n.errors-3)*(1e3+Math.random()*1e3);Od(n),setTimeout(()=>{["idle","active"].includes(n.state)||Nd(n)},Math.min(e,3e5))}}function Od(n){n.src&&(n.src.onopen=null,n.src.onerror=null,n.src.close(),n.src=null,n.state==="active"&&(n.state="disabled"))}function Nd(n){n.src=Ti.eventSourceCall({host:n.host,clientKey:n.clientKey,headers:n.headers}),n.state="active",n.src.addEventListener("features",n.cb),n.src.addEventListener("features-updated",n.cb),n.src.onerror=()=>Yy(n),n.src.onopen=()=>{n.errors=0}}function pC(n,e){Od(n),$i.delete(e)}function Ld(){Mi.clear(),$i.forEach(pC),Ii.clear(),Ti.stopIdleListener()}function fl(n,e){if(e.streaming){if(!n.getClientKey())throw new Error("Must specify clientKey to enable streaming");e.payload&&Pd(n,!0),oC(n)}}var hC=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,Hd={revert:function(){}},yl=new Map,Bd=new Set;function fC(n){return n==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[n]}}function bl(n){var e=yl.get(n);return e||(e={element:n,attributes:{}},yl.set(n,e)),e}function _l(n,e,t,r,i){var s=t(n),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:n,_positionTimeout:null,observer:new MutationObserver(function(){if(!(e==="position"&&o._positionTimeout)){e==="position"&&(o._positionTimeout=setTimeout(function(){o._positionTimeout=null},1e3));var a=t(n);e==="position"&&a.parentNode===o.virtualValue.parentNode&&a.insertBeforeNode===o.virtualValue.insertBeforeNode||a!==o.virtualValue&&(o.originalValue=a,i(o))}}),mutationRunner:i,setValue:r,getCurrentValue:t};return e==="position"&&n.parentNode?o.observer.observe(n.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(n,fC(e)),o}function xl(n,e){var t=e.getCurrentValue(e.el);e.virtualValue=n,n&&typeof n!="string"?(!t||n.parentNode!==t.parentNode||n.insertBeforeNode!==t.insertBeforeNode)&&(e.isDirty=!0,Xy()):n!==t&&(e.isDirty=!0,Xy())}function gC(n){var e=n.originalValue;n.mutations.forEach(function(t){return e=t.mutate(e)}),xl(TC(e),n)}function mC(n){var e=new Set(n.originalValue.split(/\s+/).filter(Boolean));n.mutations.forEach(function(t){return t.mutate(e)}),xl(Array.from(e).filter(Boolean).join(" "),n)}function vC(n){var e=n.originalValue;n.mutations.forEach(function(t){return e=t.mutate(e)}),xl(e,n)}function yC(n){var e=n.parentSelector,t=n.insertBeforeSelector,r=document.querySelector(e);if(!r)return null;var i=t?document.querySelector(t):null;return t&&!i?null:{parentNode:r,insertBeforeNode:i}}function bC(n){var e=n.originalValue;n.mutations.forEach(function(t){var r=t.mutate(),i=yC(r);e=i||e}),xl(e,n)}var _C=function(e){return e.innerHTML},xC=function(e,t){return e.innerHTML=t};function Jy(n){var e=bl(n);return e.html||(e.html=_l(n,"html",_C,xC,gC)),e.html}var wC=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},kC=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function eb(n){var e=bl(n);return e.position||(e.position=_l(n,"position",wC,kC,bC)),e.position}var SC=function(e,t){return t?e.className=t:e.removeAttribute("class")},EC=function(e){return e.className};function tb(n){var e=bl(n);return e.classes||(e.classes=_l(n,"class",EC,SC,mC)),e.classes}var CC=function(e){return function(t){var r;return(r=t.getAttribute(e))!=null?r:null}},AC=function(e){return function(t,r){return r!==null?t.setAttribute(e,r):t.removeAttribute(e)}};function nb(n,e){var t=bl(n);return t.attributes[e]||(t.attributes[e]=_l(n,e,CC(e),AC(e),vC)),t.attributes[e]}function RC(n,e){var t=yl.get(n);if(t)if(e==="html"){var r,i;(r=t.html)==null||(i=r.observer)==null||i.disconnect(),delete t.html}else if(e==="class"){var s,o;(s=t.classes)==null||(o=s.observer)==null||o.disconnect(),delete t.classes}else if(e==="position"){var a,l;(a=t.position)==null||(l=a.observer)==null||l.disconnect(),delete t.position}else{var c,u,d;(c=t.attributes)==null||(u=c[e])==null||(d=u.observer)==null||d.disconnect(),delete t.attributes[e]}}var gl;function TC(n){return gl||(gl=document.createElement("div")),gl.innerHTML=n,gl.innerHTML}function ml(n,e,t){if(t.isDirty){t.isDirty=!1;var r=t.virtualValue;t.mutations.length||RC(n,e),t.setValue(n,r)}}function IC(n,e){n.html&&ml(e,"html",n.html),n.classes&&ml(e,"class",n.classes),n.position&&ml(e,"position",n.position),Object.keys(n.attributes).forEach(function(t){ml(e,t,n.attributes[t])})}function Xy(){yl.forEach(IC)}function $C(n,e){var t=null;n.kind==="html"?t=Jy(e):n.kind==="class"?t=tb(e):n.kind==="attribute"?t=nb(e,n.attribute):n.kind==="position"&&(t=eb(e)),t&&(t.mutations.push(n),t.mutationRunner(t))}function MC(n,e){var t=null;if(n.kind==="html"?t=Jy(e):n.kind==="class"?t=tb(e):n.kind==="attribute"?t=nb(e,n.attribute):n.kind==="position"&&(t=eb(e)),!!t){var r=t.mutations.indexOf(n);r!==-1&&t.mutations.splice(r,1),t.mutationRunner(t)}}function rb(n){if(!(n.kind==="position"&&n.elements.size===1)){var e=new Set(n.elements),t=document.querySelectorAll(n.selector);t.forEach(function(r){e.has(r)||(n.elements.add(r),$C(n,r))})}}function PC(n){n.elements.forEach(function(e){return MC(n,e)}),n.elements.clear(),Bd.delete(n)}function Qy(){Bd.forEach(rb)}var Fd;function OC(){typeof document>"u"||(Fd||(Fd=new MutationObserver(function(){Qy()})),Qy(),Fd.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}OC();function wl(n){return typeof document>"u"?Hd:(Bd.add(n),rb(n),{revert:function(){PC(n)}})}function Dd(n,e){return wl({kind:"html",elements:new Set,mutate:e,selector:n})}function ib(n,e){return wl({kind:"position",elements:new Set,mutate:e,selector:n})}function ao(n,e){return wl({kind:"class",elements:new Set,mutate:e,selector:n})}function vl(n,e,t){return hC.test(e)?e==="class"||e==="className"?ao(n,function(r){var i=t(Array.from(r).join(" "));r.clear(),i&&i.split(/\s+/g).filter(Boolean).forEach(function(s){return r.add(s)})}):wl({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:n}):Hd}function NC(n){var e=n.selector,t=n.action,r=n.value,i=n.attribute,s=n.parentSelector,o=n.insertBeforeSelector;if(i==="html"){if(t==="append")return Dd(e,function(a){return a+(r??"")});if(t==="set")return Dd(e,function(){return r??""})}else if(i==="class"){if(t==="append")return ao(e,function(a){r&&a.add(r)});if(t==="remove")return ao(e,function(a){r&&a.delete(r)});if(t==="set")return ao(e,function(a){a.clear(),r&&a.add(r)})}else if(i==="position"){if(t==="set"&&s)return ib(e,function(){return{insertBeforeSelector:o,parentSelector:s}})}else{if(t==="append")return vl(e,i,function(a){return a!==null?a+(r??""):r??""});if(t==="set")return vl(e,i,function(){return r??""});if(t==="remove")return vl(e,i,function(){return null})}return Hd}var LC={html:Dd,classes:ao,attribute:vl,position:ib,declarative:NC},sb=LC;var Vd={};function Hn(n,e,t){t=t||{};for(let[r,i]of Object.entries(e))switch(r){case"$or":if(!lb(n,i,t))return!1;break;case"$nor":if(lb(n,i,t))return!1;break;case"$and":if(!VC(n,i,t))return!1;break;case"$not":if(Hn(n,i,t))return!1;break;default:if(!lo(i,FC(n,r),t))return!1}return!0}function FC(n,e){let t=e.split("."),r=n;for(let i=0;i<t.length;i++)if(r&&typeof r=="object"&&t[i]in r)r=r[t[i]];else return null;return r}function ob(n,e=!1){let t=`${n}${e?"/i":""}`;return Vd[t]||(Vd[t]=new RegExp(n.replace(/([^\\])\//g,"$1\\/"),e?"i":void 0)),Vd[t]}function lo(n,e,t,r=!1){if(typeof n=="string")return r?String(e).toLowerCase()===n.toLowerCase():e+""===n;if(typeof n=="number")return e*1===n;if(typeof n=="boolean")return e!==null&&!!e===n;if(n===null)return e===null;if(Array.isArray(n)||!cb(n))return JSON.stringify(e)===JSON.stringify(n);for(let i in n)if(!BC(i,e,n[i],t))return!1;return!0}function cb(n){let e=Object.keys(n);return e.length>0&&e.filter(t=>t[0]==="$").length===e.length}function DC(n){if(n===null)return"null";if(Array.isArray(n))return"array";let e=typeof n;return["string","number","boolean","object","undefined"].includes(e)?e:"unknown"}function HC(n,e,t){if(!Array.isArray(n))return!1;let r=cb(e)?i=>lo(e,i,t):i=>Hn(i,e,t);for(let i=0;i<n.length;i++)if(n[i]&&r(n[i]))return!0;return!1}function Pi(n,e,t=!1){if(t){let r=i=>typeof i=="string"?i.toLowerCase():i;return Array.isArray(n)?n.some(i=>e.some(s=>r(i)===r(s))):e.some(i=>r(n)===r(i))}return Array.isArray(n)?n.some(r=>e.includes(r)):e.includes(n)}function ab(n,e,t,r=!1){if(!Array.isArray(n))return!1;for(let i=0;i<e.length;i++){let s=!1;for(let o=0;o<n.length;o++)if(lo(e[i],n[o],t,r)){s=!0;break}if(!s)return!1}return!0}function BC(n,e,t,r){switch(n){case"$veq":return ut(e)===ut(t);case"$vne":return ut(e)!==ut(t);case"$vgt":return ut(e)>ut(t);case"$vgte":return ut(e)>=ut(t);case"$vlt":return ut(e)<ut(t);case"$vlte":return ut(e)<=ut(t);case"$eq":return e===t;case"$ne":return e!==t;case"$lt":return e<t;case"$lte":return e<=t;case"$gt":return e>t;case"$gte":return e>=t;case"$exists":return t?e!=null:e==null;case"$in":return Array.isArray(t)?Pi(e,t):!1;case"$ini":return Array.isArray(t)?Pi(e,t,!0):!1;case"$inGroup":return Pi(e,r[t]||[]);case"$notInGroup":return!Pi(e,r[t]||[]);case"$nin":return Array.isArray(t)?!Pi(e,t):!1;case"$nini":return Array.isArray(t)?!Pi(e,t,!0):!1;case"$not":return!lo(t,e,r);case"$size":return Array.isArray(e)?lo(t,e.length,r):!1;case"$elemMatch":return HC(e,t,r);case"$all":return Array.isArray(t)?ab(e,t,r):!1;case"$alli":return Array.isArray(t)?ab(e,t,r,!0):!1;case"$regex":try{return ob(t).test(e)}catch{return!1}case"$regexi":try{return ob(t,!0).test(e)}catch{return!1}case"$type":return DC(e)===t;default:return console.error("Unknown operator: "+n),!1}}function lb(n,e,t){if(!e.length)return!0;for(let r=0;r<e.length;r++)if(Hn(n,e[r],t))return!0;return!1}function VC(n,e,t){for(let r=0;r<e.length;r++)if(!Hn(n,e[r],t))return!1;return!0}var WC="Feature Evaluated",jC="Experiment Viewed";function UC(n){let e=new Map;return n.global.forcedFeatureValues&&n.global.forcedFeatureValues.forEach((t,r)=>e.set(r,t)),n.user.forcedFeatureValues&&n.user.forcedFeatureValues.forEach((t,r)=>e.set(r,t)),e}function zC(n){return n.global.forcedVariations&&n.user.forcedVariations?{...n.global.forcedVariations,...n.user.forcedVariations}:n.global.forcedVariations?n.global.forcedVariations:n.user.forcedVariations?n.user.forcedVariations:{}}async function Oi(n){try{await n()}catch{}}function ub(n,e,t){if(n.user.trackedExperiments){let i=El(e,t);if(n.user.trackedExperiments.has(i))return[];n.user.trackedExperiments.add(i)}n.user.enableDevMode&&n.user.devLogs&&n.user.devLogs.push({experiment:e,result:t,timestamp:Date.now().toString(),logType:"experiment"});let r=[];if(n.global.trackingCallback){let i=n.global.trackingCallback;r.push(Oi(()=>i(e,t,n.user)))}if(n.user.trackingCallback){let i=n.user.trackingCallback;r.push(Oi(()=>i(e,t)))}if(n.global.eventLogger){let i=n.global.eventLogger;r.push(Oi(()=>i(jC,{experimentId:e.key,variationId:t.key,hashAttribute:t.hashAttribute,hashValue:t.hashValue},n.user)))}return r}function qC(n,e,t){if(n.user.trackedFeatureUsage){let r=JSON.stringify(t.value);if(n.user.trackedFeatureUsage[e]===r)return;n.user.trackedFeatureUsage[e]=r,n.user.enableDevMode&&n.user.devLogs&&n.user.devLogs.push({featureKey:e,result:t,timestamp:Date.now().toString(),logType:"feature"})}if(n.global.onFeatureUsage){let r=n.global.onFeatureUsage;Oi(()=>r(e,t,n.user))}if(n.user.onFeatureUsage){let r=n.user.onFeatureUsage;Oi(()=>r(e,t))}if(n.global.eventLogger){let r=n.global.eventLogger;Oi(()=>r(WC,{feature:e,source:t.source,value:t.value,ruleId:t.source==="defaultValue"?"$default":t.ruleId||"",variationId:t.experimentResult?t.experimentResult.key:""},n.user))}}function kl(n,e){if(e.stack.evaluatedFeatures.has(n))return Bn(e,n,null,"cyclicPrerequisite");e.stack.evaluatedFeatures.add(n),e.stack.id=n;let t=UC(e);if(t.has(n))return Bn(e,n,t.get(n),"override");if(!e.global.features||!e.global.features[n])return Bn(e,n,null,"unknownFeature");let r=e.global.features[n];if(r.rules){let i=new Set(e.stack.evaluatedFeatures);e:for(let s of r.rules){if(s.parentConditions)for(let l of s.parentConditions){e.stack.evaluatedFeatures=new Set(i);let c=kl(l.id,e);if(c.source==="cyclicPrerequisite")return Bn(e,n,null,"cyclicPrerequisite");let u={value:c.value};if(!Hn(u,l.condition||{})){if(l.gate)return Bn(e,n,null,"prerequisite");continue e}}if(s.filters&&hb(s.filters,e))continue;if("force"in s){if(s.condition&&!pb(s.condition,e)||!ZC(e,s.seed||n,s.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!s.disableStickyBucketing?s.fallbackAttribute:void 0,s.range,s.coverage,s.hashVersion))continue;return s.tracks&&s.tracks.forEach(l=>{!ub(e,l.experiment,l.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:l.experiment,result:l.result})}),Bn(e,n,s.force,"force",s.id)}if(!s.variations)continue;let o={variations:s.variations,key:s.key||n};"coverage"in s&&(o.coverage=s.coverage),s.weights&&(o.weights=s.weights),s.hashAttribute&&(o.hashAttribute=s.hashAttribute),s.fallbackAttribute&&(o.fallbackAttribute=s.fallbackAttribute),s.disableStickyBucketing&&(o.disableStickyBucketing=s.disableStickyBucketing),s.bucketVersion!==void 0&&(o.bucketVersion=s.bucketVersion),s.minBucketVersion!==void 0&&(o.minBucketVersion=s.minBucketVersion),s.namespace&&(o.namespace=s.namespace),s.meta&&(o.meta=s.meta),s.ranges&&(o.ranges=s.ranges),s.name&&(o.name=s.name),s.phase&&(o.phase=s.phase),s.seed&&(o.seed=s.seed),s.hashVersion&&(o.hashVersion=s.hashVersion),s.filters&&(o.filters=s.filters),s.condition&&(o.condition=s.condition);let{result:a}=Sl(o,n,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(o,a),a.inExperiment&&!a.passthrough)return Bn(e,n,a.value,"experiment",s.id,o,a)}}return Bn(e,n,r.defaultValue===void 0?null:r.defaultValue,"defaultValue")}function Sl(n,e,t){let r=n.key,i=n.variations.length;if(i<2)return{result:Ee(t,n,-1,!1,e)};if(t.global.enabled===!1||t.user.enabled===!1)return{result:Ee(t,n,-1,!1,e)};if(n=GC(n,t),n.urlPatterns&&!ul(t.user.url||"",n.urlPatterns))return{result:Ee(t,n,-1,!1,e)};let s=Hy(r,t.user.url||"",i);if(s!==null)return{result:Ee(t,n,s,!1,e)};let o=zC(t);if(r in o){let m=o[r];return{result:Ee(t,n,m,!1,e)}}if(n.status==="draft"||n.active===!1)return{result:Ee(t,n,-1,!1,e)};let{hashAttribute:a,hashValue:l}=Lr(t,n.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!n.disableStickyBucketing?n.fallbackAttribute:void 0);if(!l)return{result:Ee(t,n,-1,!1,e)};let c=-1,u=!1,d=!1;if(t.user.saveStickyBucketAssignmentDoc&&!n.disableStickyBucketing){let{variation:m,versionIsBlocked:y}=XC({ctx:t,expKey:n.key,expBucketVersion:n.bucketVersion,expHashAttribute:n.hashAttribute,expFallbackAttribute:n.fallbackAttribute,expMinBucketVersion:n.minBucketVersion,expMeta:n.meta});u=m>=0,c=m,d=!!y}if(!u){if(n.filters){if(hb(n.filters,t))return{result:Ee(t,n,-1,!1,e)}}else if(n.namespace&&!Ly(l,n.namespace))return{result:Ee(t,n,-1,!1,e)};if(n.include&&!By(n.include))return{result:Ee(t,n,-1,!1,e)};if(n.condition&&!pb(n.condition,t))return{result:Ee(t,n,-1,!1,e)};if(n.parentConditions){let m=new Set(t.stack.evaluatedFeatures);for(let y of n.parentConditions){t.stack.evaluatedFeatures=new Set(m);let k=kl(y.id,t);if(k.source==="cyclicPrerequisite")return{result:Ee(t,n,-1,!1,e)};let _={value:k.value};if(!Hn(_,y.condition||{}))return{result:Ee(t,n,-1,!1,e)}}}if(n.groups&&!YC(n.groups,t))return{result:Ee(t,n,-1,!1,e)}}if(n.url&&!KC(n.url,t))return{result:Ee(t,n,-1,!1,e)};let h=io(n.seed||r,l,n.hashVersion||1);if(h===null)return{result:Ee(t,n,-1,!1,e)};if(!u){let m=n.ranges||Dy(i,n.coverage===void 0?1:n.coverage,n.weights);c=Fy(h,m)}if(d)return{result:Ee(t,n,-1,!1,e,void 0,!0)};if(c<0)return{result:Ee(t,n,-1,!1,e)};if("force"in n)return{result:Ee(t,n,n.force===void 0?-1:n.force,!1,e)};if(t.global.qaMode||t.user.qaMode)return{result:Ee(t,n,-1,!1,e)};if(n.status==="stopped")return{result:Ee(t,n,-1,!1,e)};let g=Ee(t,n,c,!0,e,h,u);if(t.user.saveStickyBucketAssignmentDoc&&!n.disableStickyBucketing){let{changed:m,key:y,doc:k}=JC(t,a,so(l),{[Wd(n.key,n.bucketVersion)]:g.key});m&&(t.user.stickyBucketAssignmentDocs=t.user.stickyBucketAssignmentDocs||{},t.user.stickyBucketAssignmentDocs[y]=k,t.user.saveStickyBucketAssignmentDoc(k))}let v=ub(t,n,g);v.length===0&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:n,result:g});let f=v.length?v.length===1?v[0]:Promise.all(v).then(()=>{}):void 0;return"changeId"in n&&n.changeId&&t.global.recordChangeId&&t.global.recordChangeId(n.changeId),{result:g,trackingCall:f}}function Bn(n,e,t,r,i,s,o){let a={value:t,on:!!t,off:!t,source:r,ruleId:i||""};return s&&(a.experiment=s),o&&(a.experimentResult=o),r!=="override"&&qC(n,e,a),a}function db(n){return{...n.user.attributes,...n.user.attributeOverrides}}function pb(n,e){return Hn(db(e),n,e.global.savedGroups||{})}function hb(n,e){return n.some(t=>{let{hashValue:r}=Lr(e,t.attribute);if(!r)return!0;let i=io(t.seed,r,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>cl(i,s))})}function ZC(n,e,t,r,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;let{hashValue:a}=Lr(n,t,r);if(!a)return!1;let l=io(e,a,o||1);return l===null?!1:i?cl(l,i):s!==void 0?l<=s:!0}function Ee(n,e,t,r,i,s,o){let a=!0;(t<0||t>=e.variations.length)&&(t=0,a=!1);let{hashAttribute:l,hashValue:c}=Lr(n,e.hashAttribute,n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),u=e.meta?e.meta[t]:{},d={key:u.key||""+t,featureId:i,inExperiment:a,hashUsed:r,variationId:t,value:e.variations[t],hashAttribute:l,hashValue:c,stickyBucketUsed:!!o};return u.name&&(d.name=u.name),s!==void 0&&(d.bucket=s),u.passthrough&&(d.passthrough=u.passthrough),d}function GC(n,e){let t=n.key,r=e.global.overrides;return r&&r[t]&&(n=Object.assign({},n,r[t]),typeof n.url=="string"&&(n.url=Id(n.url))),n}function Lr(n,e,t){let r=e||"id",i="",s=db(n);return s[r]&&(i=s[r]),!i&&t&&(s[t]&&(i=s[t]),i&&(r=t)),{hashAttribute:r,hashValue:i}}function KC(n,e){let t=e.user.url;if(!t)return!1;let r=t.replace(/^https?:\/\//,"").replace(/^[^/]*\//,"/");return!!(n.test(t)||n.test(r))}function YC(n,e){let t=e.global.groups||{};for(let r=0;r<n.length;r++)if(t[n[r]])return!0;return!1}function XC({ctx:n,expKey:e,expBucketVersion:t,expHashAttribute:r,expFallbackAttribute:i,expMinBucketVersion:s,expMeta:o}){t=t||0,s=s||0,r=r||"id",o=o||[];let a=Wd(e,t),l=QC(n,r,i);if(s>0)for(let d=0;d<s;d++){let h=Wd(e,d);if(l[h]!==void 0)return{variation:-1,versionIsBlocked:!0}}let c=l[a];if(c===void 0)return{variation:-1};let u=o.findIndex(d=>d.key===c);return u<0?{variation:-1}:{variation:u}}function Wd(n,e){return e=e||0,`${n}__${e}`}function jd(n,e){return`${n}||${e}`}function QC(n,e,t){if(!n.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:r,hashValue:i}=Lr(n,e),s=jd(r,so(i)),{hashAttribute:o,hashValue:a}=Lr(n,t),l=a?jd(o,so(a)):null,c={};return l&&n.user.stickyBucketAssignmentDocs[l]&&Object.assign(c,n.user.stickyBucketAssignmentDocs[l].assignments||{}),n.user.stickyBucketAssignmentDocs[s]&&Object.assign(c,n.user.stickyBucketAssignmentDocs[s].assignments||{}),c}function JC(n,e,t,r){let i=jd(e,t),s=n.user.stickyBucketAssignmentDocs&&n.user.stickyBucketAssignmentDocs[i]?n.user.stickyBucketAssignmentDocs[i].assignments||{}:{},o={...s,...r},a=JSON.stringify(s)!==JSON.stringify(o);return{key:i,doc:{attributeName:e,attributeValue:t,assignments:o},changed:a}}function eA(n,e){let t=new Set,r=e&&e.features?e.features:n.global.features||{},i=e&&e.experiments?e.experiments:n.global.experiments||[];return Object.keys(r).forEach(s=>{let o=r[s];if(o.rules)for(let a of o.rules)a.variations&&(t.add(a.hashAttribute||"id"),a.fallbackAttribute&&t.add(a.fallbackAttribute))}),i.map(s=>{t.add(s.hashAttribute||"id"),s.fallbackAttribute&&t.add(s.fallbackAttribute)}),Array.from(t)}async function fb(n,e,t){let r=Ud(n,t);return e.getAllAssignments(r)}function Ud(n,e){let t={};return eA(n,e).forEach(i=>{let{hashValue:s}=Lr(n,i);t[i]=so(s)}),t}async function gb(n,e,t){if(n={...n},n.encryptedFeatures){try{n.features=JSON.parse(await Nr(n.encryptedFeatures,e,t))}catch(r){console.error(r)}delete n.encryptedFeatures}if(n.encryptedExperiments){try{n.experiments=JSON.parse(await Nr(n.encryptedExperiments,e,t))}catch(r){console.error(r)}delete n.encryptedExperiments}if(n.encryptedSavedGroups){try{n.savedGroups=JSON.parse(await Nr(n.encryptedSavedGroups,e,t))}catch(r){console.error(r)}delete n.encryptedSavedGroups}return n}function mb(n){let e=n.apiHost||"https://cdn.growthbook.io";return{apiHost:e.replace(/\/*$/,""),streamingHost:(n.streamingHost||e).replace(/\/*$/,""),apiRequestHeaders:n.apiHostRequestHeaders,streamingHostRequestHeaders:n.streamingHostRequestHeaders}}function El(n,e){return e.hashAttribute+e.hashValue+n.key+e.variationId}var Ni=typeof window<"u"&&typeof document<"u",tA=Vy(),co=class{constructor(e){if(e=e||{},this.version=tA,this._options=this.context=e,this._renderer=e.renderer||null,this._trackedExperiments=new Set,this._completedChangeIds=new Set,this._trackedFeatures={},this.debug=!!e.debug,this._subscriptions=new Set,this.ready=!1,this._assigned=new Map,this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._initialized=!1,this._redirectedUrl="",this._deferredTrackingCalls=new Map,this._autoExperimentsAllowed=!e.disableExperimentsOnLoad,this._destroyCallbacks=[],this.logs=[],this.log=this.log.bind(this),this._saveDeferredTrack=this._saveDeferredTrack.bind(this),this._onExperimentEval=this._onExperimentEval.bind(this),this._fireSubscriptions=this._fireSubscriptions.bind(this),this._recordChangedId=this._recordChangedId.bind(this),e.remoteEval){if(e.decryptionKey)throw new Error("Encryption is not available for remoteEval");if(!e.clientKey)throw new Error("Missing clientKey");let t=!1;try{t=!!new URL(e.apiHost||"").hostname.match(/growthbook\.io$/i)}catch{}if(t)throw new Error("Cannot use remoteEval on GrowthBook Cloud")}else if(e.cacheKeyAttributes)throw new Error("cacheKeyAttributes are only used for remoteEval");if(e.stickyBucketService){let t=e.stickyBucketService;this._saveStickyBucketAssignmentDoc=r=>t.saveAssignments(r)}if(e.plugins)for(let t of e.plugins)t(this);if(e.features&&(this.ready=!0),Ni&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event("gbloaded"))),e.experiments&&(this.ready=!0,this._updateAllAutoExperiments()),this._options.stickyBucketService&&this._options.stickyBucketAssignmentDocs)for(let t in this._options.stickyBucketAssignmentDocs){let r=this._options.stickyBucketAssignmentDocs[t];r&&this._options.stickyBucketService.saveAssignments(r).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;let t=await gb(e,this._options.decryptionKey);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._options.features=t.features),t.savedGroups&&(this._options.savedGroups=t.savedGroups),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;let t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw new Error("initSync does not support encrypted payloads");return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,t)),this._payload=t,this._decryptedPayload=t,t.features&&(this._options.features=t.features),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,fl(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&zy(e.cacheSettings),e.payload)return await this.setPayload(e.payload),fl(this,e),{success:!0,source:"init"};{let{data:t,...r}=await this._refresh({...e,allowStale:!0});return fl(this,e),await this.setPayload(t||{}),r}}async loadFeatures(e){e=e||{},await this.init({skipCache:e.skipCache,timeout:e.timeout,streaming:(this._options.backgroundSync??!0)&&(e.autoRefresh||this._options.subscribeToChanges)})}async refreshFeatures(e){let t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return mb(this._options)}getClientKey(){return this._options.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._options.remoteEval||!1}getCacheKeyAttributes(){return this._options.cacheKeyAttributes}async _refresh({timeout:e,skipCache:t,allowStale:r,streaming:i}){if(!this._options.clientKey)throw new Error("Missing clientKey");return qy({instance:this,timeout:e,skipCache:t||this._options.disableCache,allowStale:r,backgroundSync:i??this._options.backgroundSync??!0})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error("Failed to render",e)}}setFeatures(e){this._options.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,r){let i=await Nr(e,t||this._options.decryptionKey,r);this.setFeatures(JSON.parse(i))}setExperiments(e){this._options.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,r){let i=await Nr(e,t||this._options.decryptionKey,r);this.setExperiments(JSON.parse(i))}async setAttributes(e){if(this._options.attributes=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async updateAttributes(e){return this.setAttributes({...this._options.attributes,...e})}async setAttributeOverrides(e){if(this._options.attributeOverrides=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async setForcedVariations(e){if(this._options.forcedVariations=e||{},this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}setForcedFeatures(e){this._options.forcedFeatureValues=e,this._render()}async setURL(e){if(e!==this._options.url){if(this._options.url=e,this._redirectedUrl="",this._options.remoteEval){await this._refreshForRemoteEval(),this._updateAllAutoExperiments(!0);return}this._updateAllAutoExperiments(!0)}}getAttributes(){return{...this._options.attributes,...this._options.attributeOverrides}}getForcedVariations(){return this._options.forcedVariations||{}}getForcedFeatures(){return this._options.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._options.stickyBucketAssignmentDocs||{}}getUrl(){return this._options.url||""}getFeatures(){return this._options.features||{}}getExperiments(){return this._options.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}async _refreshForRemoteEval(){if(!this._options.remoteEval||!this._initialized)return;let e=await this._refresh({allowStale:!1});e.data&&await this.setPayload(e.data)}getAllResults(){return new Map(this._assigned)}onDestroy(e){this._destroyCallbacks.push(e)}isDestroyed(){return!!this._destroyed}destroy(e){e=e||{},this._destroyed=!0,this._destroyCallbacks.forEach(t=>{try{t()}catch(r){console.error(r)}}),this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._destroyCallbacks=[],this._payload=void 0,this._saveStickyBucketAssignmentDoc=void 0,Zy(this),e.destroyAllStreams&&Ld(),this.logs=[],Ni&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach(t=>{t.undo()}),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){if(this._options.forcedVariations=this._options.forcedVariations||{},this._options.forcedVariations[e]=t,this._options.remoteEval){this._refreshForRemoteEval();return}this._updateAllAutoExperiments(),this._render()}run(e){let{result:t}=Sl(e,null,this._getEvalContext());return this._onExperimentEval(e,t),t}triggerExperiment(e){return this._triggeredExpKeys.add(e),this._options.experiments?this._options.experiments.filter(r=>r.key===e).map(r=>this._runAutoExperiment(r)).filter(r=>r!==null):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_getEvalContext(){return{user:this._getUserContext(),global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getUserContext(){return{attributes:this._options.user?{...this._options.user,...this._options.attributes}:this._options.attributes,enableDevMode:this._options.enableDevMode,blockedChangeIds:this._options.blockedChangeIds,stickyBucketAssignmentDocs:this._options.stickyBucketAssignmentDocs,url:this._getContextUrl(),forcedVariations:this._options.forcedVariations,forcedFeatureValues:this._options.forcedFeatureValues,attributeOverrides:this._options.attributeOverrides,saveStickyBucketAssignmentDoc:this._saveStickyBucketAssignmentDoc,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage,devLogs:this.logs,trackedExperiments:this._trackedExperiments,trackedFeatureUsage:this._trackedFeatures}}_getGlobalContext(){return{features:this._options.features,experiments:this._options.experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,groups:this._options.groups,overrides:this._options.overrides,onExperimentEval:this._onExperimentEval,recordChangeId:this._recordChangedId,saveDeferredTrack:this._saveDeferredTrack,eventLogger:this._options.eventLogger}}_runAutoExperiment(e,t){let r=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!r)return null;let i=this._isAutoExperimentBlockedByContext(e),s,o;i?s=Ee(this._getEvalContext(),e,-1,!1,""):({result:s,trackingCall:o}=Sl(e,null,this._getEvalContext()),this._onExperimentEval(e,s));let a=JSON.stringify(s.value);if(!t&&s.inExperiment&&r&&r.valueHash===a)return s;if(r&&this._undoActiveAutoExperiment(e),s.inExperiment){let l=dl(e);if(l==="redirect"&&s.value.urlRedirect&&e.urlPatterns){let c=e.persistQueryString?Wy(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(ul(c,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),s;this._redirectedUrl=c;let{navigate:u,delay:d}=this._getNavigateFunction();if(u)if(Ni)Promise.all([...o?[pl(o,this._options.maxNavigateDelay??1e3)]:[],new Promise(h=>window.setTimeout(h,this._options.navigateDelay??d))]).then(()=>{try{u(c)}catch(h){console.error(h)}});else try{u(c)}catch(h){console.error(h)}}else if(l==="visual"){let c=this._options.applyDomChangesCallback?this._options.applyDomChangesCallback(s.value):this._applyDOMChanges(s.value);c&&this._activeAutoExperiments.set(e,{undo:c,valueHash:a})}}return s}_undoActiveAutoExperiment(e){let t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;let t=this._options.experiments||[],r=new Set(t);this._activeAutoExperiments.forEach((i,s)=>{r.has(s)||(i.undo(),this._activeAutoExperiments.delete(s))});for(let i of t){let s=this._runAutoExperiment(i,e);if(s&&s.inExperiment&&dl(i)==="redirect")break}}_onExperimentEval(e,t){let r=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,r)}_fireSubscriptions(e,t,r){(!r||r.result.inExperiment!==t.inExperiment||r.result.variationId!==t.variationId)&&this._subscriptions.forEach(i=>{try{i(e,t)}catch(s){console.error(s)}})}_recordChangedId(e){this._completedChangeIds.add(e)}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){let r=this.evalFeature(e).value;return r===null?t:r}feature(e){return this.evalFeature(e)}evalFeature(e){return kl(e,this._getEvalContext())}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(e){this._deferredTrackingCalls=new Map(e.filter(t=>t&&t.experiment&&t.result).map(t=>[El(t.experiment,t.result),t]))}async fireDeferredTrackingCalls(){if(!this._options.trackingCallback)return;let e=[];this._deferredTrackingCalls.forEach(t=>{!t||!t.experiment||!t.result?console.error("Invalid deferred tracking call",{call:t}):e.push(this._options.trackingCallback(t.experiment,t.result))}),this._deferredTrackingCalls.clear(),await Promise.all(e)}setTrackingCallback(e){this._options.trackingCallback=e,this.fireDeferredTrackingCalls()}setEventLogger(e){this._options.eventLogger=e}async logEvent(e,t){if(this._destroyed){console.error("Cannot log event to destroyed GrowthBook instance");return}if(this._options.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:"event"}),this._options.eventLogger)try{await this._options.eventLogger(e,t||{},this._getUserContext())}catch(r){console.error(r)}else console.error("No event logger configured")}_saveDeferredTrack(e){this._deferredTrackingCalls.set(El(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(Ni?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=dl(e);if(t==="visual"){if(this._options.disableVisualExperiments||this._options.disableJsInjection&&e.variations.some(r=>r.js))return!0}else if(t==="redirect"){if(this._options.disableUrlRedirectExperiments)return!0;try{let r=new URL(this._getContextUrl());for(let i of e.variations){if(!i||!i.urlRedirect)continue;let s=new URL(i.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments&&(s.protocol!==r.protocol||s.host!==r.host))return!0}}catch(r){return this.log("Error parsing current or redirect URL",{id:e.key,error:r}),!0}}else return!0;return!!(e.changeId&&(this._options.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:Ni?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!Ni)return;let t=[];if(e.css){let r=document.createElement("style");r.innerHTML=e.css,document.head.appendChild(r),t.push(()=>r.remove())}if(e.js){let r=document.createElement("script");r.innerHTML=e.js,this._options.jsInjectionNonce&&(r.nonce=this._options.jsInjectionNonce),document.head.appendChild(r),t.push(()=>r.remove())}return e.domMutations&&e.domMutations.forEach(r=>{t.push(sb.declarative(r).revert)}),()=>{t.forEach(r=>r())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),r=await fb(t,this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=r}}generateStickyBucketAssignmentDocsSync(e,t){if(!("getAllAssignmentsSync"in e)){console.error("generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync");return}let r=this._getEvalContext(),i=Ud(r,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}};var nA="https://experiment.syntrologie.com",zd=class{constructor(e={}){this.featureListeners=new Set;if(e.client)this.gb=e.client;else{let t=e.onExperimentViewed?(r,i)=>{e.onExperimentViewed(r.key,i.variationId,typeof i.value=="string"?i.value:`variation_${i.variationId}`)}:void 0;this.gb=new co({...e,apiHost:e.apiHost??nA,enableDevMode:e.enableDevMode??!0,trackingCallback:t}),e.autoInit&&this.gb.init({streaming:!0})}}get _internal(){return this.gb}async refreshFeatures(){await this.gb.loadFeatures()}setAttributes(e){this.gb.setAttributes({...this.gb.getAttributes(),...e})}setForcedVariations(e){this.gb.setForcedVariations(e)}getFeatureValue(e,t){return this.gb.getFeatureValue(e,t)}getAllFeatures(){let e=this.gb.getFeatures(),t={};for(let r of Object.keys(e))t[r]=this.gb.getFeatureValue(r,null);return t}shouldRenderRectangle(e){return!0}onFeaturesChanged(e){return this.featureListeners.add(e),this.featureListeners.size===1&&this.gb.setRenderer(()=>{for(let t of this.featureListeners)t()}),()=>{this.featureListeners.delete(e),this.featureListeners.size===0&&this.gb.setRenderer(null)}}};function qd(n={}){return new zd(n)}var vb={growthbook:n=>qd({...n,autoInit:!0})};function yb(n,e){let t=vb[n];if(!t)throw new Error(`Unknown experiment provider: ${n}. Supported: ${Object.keys(vb).join(", ")}`);return t(e)}var rA=["cdn.syntrologie.com","localhost","127.0.0.1"];function iA(n){try{let e=new URL(n),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(console.warn("[SmartCanvas] CDN URL must use HTTPS:",n),!1):rA.some(i=>e.hostname===i)?!0:(console.warn("[SmartCanvas] CDN host not in allowlist:",e.hostname),!1)}catch{return console.warn("[SmartCanvas] Invalid CDN URL:",n),!1}}var Zd=class{constructor(e){this.name="cdn";if(this.url=`${e.baseUrl}/${e.configId}.json`,this.integrity=e.integrity,!iA(this.url))throw new Error(`[SmartCanvas] CDN URL not allowed: ${this.url}`)}async fetch(){let e=performance.now(),t=await fetch(this.url,{credentials:"omit",cache:"default"});if(!t.ok)throw new Error(`[SmartCanvas] Failed to fetch config from CDN (${t.status})`);let r=await t.text();if(this.integrity){let l=await sA(r),c=this.integrity.replace("sha384-","");if(l!==c)throw new Error(`[SmartCanvas] Config integrity check failed. Expected ${c}, got ${l}`)}let i=JSON.parse(r),s=performance.now()-e,o=t.headers.get("cache-control"),a=t.headers.get("age");return{config:i,meta:{source:"cdn",fetchTimeMs:s,cached:o?.includes("public")??!1,cacheAge:a?parseInt(a,10):void 0}}}};async function sA(n){let t=new TextEncoder().encode(n),r=await crypto.subtle.digest("SHA-384",t),i=new Uint8Array(r);return btoa(String.fromCharCode(...i))}function bb(n){return new Zd(n)}var oA="syntro_exp",aA="syntro_var",Gd=class{constructor(e){this.name="experiments";this.client=e.client,this.featureKey=e.featureKey,this.manifestKey=e.manifestKey,this.variantFlagPrefix=e.variantFlagPrefix}async fetch(){let e=performance.now();if(typeof window<"u"){let i=new URLSearchParams(window.location.search),s=i.get(oA),o=i.get(aA);if(s&&o!==null&&this.client.setForcedVariations){let a=parseInt(o,10);Number.isNaN(a)||(console.log(`[SmartCanvas] Preview mode: forcing "${s}" to variation ${a}`),this.client.setForcedVariations({[s]:a}))}}if(this.manifestKey||this.variantFlagPrefix||this.client.getAllFeatures){let i=this.fetchMultiFlag();if(i){let s=performance.now()-e;return{config:i,meta:{source:"experiments",fetchTimeMs:s,cached:!0}}}}if(!this.featureKey)throw new Error("[SmartCanvas] No featureKey configured and no variant flags found. Ensure at least one config feature flag exists in your experiment platform.");let t=this.client.getFeatureValue?.(this.featureKey,null);if(!t||typeof t!="object")throw new Error(`[SmartCanvas] Feature "${this.featureKey}" not found or invalid. Ensure the feature is configured in your experiment platform.`);let r=performance.now()-e;return{config:t,meta:{source:"experiments",fetchTimeMs:r,cached:!0}}}fetchMultiFlag(){let e=this.getVariantFlagKeys();return!e||e.length===0?null:Da(this.client,e)}getVariantFlagKeys(){if(this.manifestKey){let e=this.client.getFeatureValue?.(this.manifestKey,null);if(e&&typeof e=="object"){let t=e.variant_flags;if(t&&t.length>0)return t}}if(this.client.getAllFeatures){let e=this.client.getAllFeatures();return this.variantFlagPrefix?Object.keys(e).filter(t=>t.startsWith(this.variantFlagPrefix)):Object.keys(e)}return[]}};function _b(n){return new Gd(n)}var lA="https://cdn.syntrologie.com/configs",xb={cdn:n=>{if(!n.configId)throw new Error("CDN fetcher requires 'configId' option");return bb({baseUrl:n.baseUrl??lA,configId:n.configId,integrity:n.integrity})},experiments:n=>{if(!n.featureKey)throw new Error("Experiments fetcher requires 'featureKey' option");return _b({featureKey:n.featureKey})}};function wb(n,e={}){let t=xb[n];if(!t)throw new Error(`Unknown config fetcher type: ${n}. Supported: ${Object.keys(xb).join(", ")}`);return t(e)}var kb="syntro_session_metrics",Cl=class{constructor(e={}){this.metrics=new Map;this.subscribers=new Set;this.experiments=e.experiments,this.attributePrefix=e.attributePrefix??"session_",this.onMetricChange=e.onMetricChange,this.loadFromStorage()}increment(e,t=1){let i=(this.metrics.get(e)??0)+t;return this.metrics.set(e,i),this.saveToStorage(),this.updateExperimentAttributes(e,i),this.onMetricChange?.(e,i),this.notifySubscribers(),i}set(e,t){this.metrics.set(e,t),this.saveToStorage(),this.updateExperimentAttributes(e,t),this.onMetricChange?.(e,t),this.notifySubscribers()}get(e){return this.metrics.get(e)??0}meetsThreshold(e,t){return this.get(e)>=t}getAll(){return Object.fromEntries(this.metrics)}reset(e){this.metrics.delete(e),this.saveToStorage(),this.updateExperimentAttributes(e,0),this.onMetricChange?.(e,0),this.notifySubscribers()}resetAll(){let e=Array.from(this.metrics.keys());this.metrics.clear(),this.saveToStorage();let t={};for(let r of e)t[`${this.attributePrefix}${r}`]=0,this.onMetricChange?.(r,0);this.experiments?.setAttributes?.(t),this.notifySubscribers()}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}destroy(){this.subscribers.clear()}setExperiments(e){this.experiments=e,this.syncAllToExperiments()}updateExperimentAttributes(e,t){if(!this.experiments?.setAttributes)return;let r=`${this.attributePrefix}${e}`;this.experiments.setAttributes({[r]:t})}syncAllToExperiments(){if(!this.experiments?.setAttributes)return;let e={};for(let[t,r]of this.metrics)e[`${this.attributePrefix}${t}`]=r;this.experiments.setAttributes(e)}notifySubscribers(){for(let e of this.subscribers)try{e()}catch{}}loadFromStorage(){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{let e=sessionStorage.getItem(kb);if(e){let t=JSON.parse(e);for(let[r,i]of Object.entries(t))this.metrics.set(r,i.count)}}catch(e){console.warn("[SessionMetricTracker] Failed to load from sessionStorage:",e)}}saveToStorage(){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{let e={};for(let[t,r]of this.metrics)e[t]={count:r,lastUpdated:Date.now()};sessionStorage.setItem(kb,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function Kd(n={}){return new Cl(n)}function cA(){let n=Date.now();return{page:{url:typeof window<"u"?window.location.href:"",title:typeof document<"u"?document.title:void 0},session:{sessionId:"",startTs:n,pageHistory:[]},viewport:{width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0}}}function Yd(n,e){if(!e)return;let t;try{t=new URL(n).pathname}catch{t=n}if(e.exclude){for(let r of e.exclude)if(Sb(t,r))return}if(e.include){for(let r of e.include)if(Sb(t,r))return r;return}return t}function Sb(n,e){let t=n.replace(/\/$/,"")||"/",r=e.replace(/\/$/,"")||"/";if(t===r)return!0;let i=r.replace(/:[^/]+/g,"[^/]+").replace(/\*/g,".*");return new RegExp(`^${i}$`).test(t)}var Al=class{constructor(e){this.listeners=new Set;this.cleanupFns=[];if(this.telemetry=e.telemetry,this.routes=e.routes,this.navigation=e.navigation,this.context=cA(),this.previousContext={...this.context},e.telemetry?.getSessionId){let t=e.telemetry.getSessionId();t&&(this.context.session.sessionId=t)}e.initialPageHistory&&(this.context.session.pageHistory=e.initialPageHistory),this.context.page.routeId=Yd(this.context.page.url,this.routes),this.addPageToHistory(this.context.page.url),typeof window<"u"&&this.setupBrowserListeners()}get(){return{...this.context}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setRoutes(e){this.routes=e;let t=Yd(this.context.page.url,this.routes);t!==this.context.page.routeId&&this.updateContext({page:{...this.context.page,routeId:t}})}setAnchors(e){this.updateContext({anchors:e})}setSessionId(e){e!==this.context.session.sessionId&&this.updateContext({session:{...this.context.session,sessionId:e}})}destroy(){for(let e of this.cleanupFns)e();this.cleanupFns=[],this.listeners.clear()}setupBrowserListeners(){let e,t=()=>{clearTimeout(e),e=setTimeout(()=>{this.updateViewport()},100)};window.addEventListener("resize",t),this.cleanupFns.push(()=>window.removeEventListener("resize",t));let r=this.navigation.subscribe(()=>this.updatePage());this.cleanupFns.push(r)}updateViewport(){let e={width:window.innerWidth,height:window.innerHeight};(e.width!==this.context.viewport.width||e.height!==this.context.viewport.height)&&this.updateContext({viewport:e})}updatePage(){let e=window.location.href,{title:t}=document,r=Yd(e,this.routes),i={url:e,title:t,routeId:r};(i.url!==this.context.page.url||i.title!==this.context.page.title||i.routeId!==this.context.page.routeId)&&(i.url!==this.context.page.url&&this.addPageToHistory(i.url),this.updateContext({page:i}))}addPageToHistory(e){let t={url:e,ts:Date.now()},r=[...this.context.session.pageHistory||[],t];r.length>50&&r.shift(),this.context.session.pageHistory=r}updateContext(e){this.previousContext={...this.context},this.context={...this.context,...e},this.notifyListeners()}notifyListeners(){for(let e of this.listeners)try{e(this.context,this.previousContext)}catch(t){console.error("[ContextManager] Listener error:",t)}}};function Xd(n){return new Al(n)}function Eb(n,e){let{context:t,state:r,events:i}=e;switch(n.type){case"page_url":{let{url:s}=n,o=t.page.url.split("?")[0].split("#")[0],a=s.replace(/\*\*/g,"\0GLOBSTAR\0").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\0GLOBSTAR\0/g,".*");return new RegExp(`^${a}$`).test(o)}case"route":return t.page.routeId===n.routeId;case"anchor_visible":{let s=t.anchors?.find(o=>o.anchorId===n.anchorId);switch(n.state){case"visible":return s?.visible===!0;case"present":return s?.present===!0;case"absent":return!s?.present;default:return!1}}case"event_occurred":{if(!i)return!1;let s=n.withinMs??6e4;return i.hasRecentEvent(n.eventName,s)}case"state_equals":return r?.getValue?r.getValue(n.key)===n.value:!1;case"viewport":{let{width:s,height:o}=t.viewport;return!(n.minWidth!==void 0&&s<n.minWidth||n.maxWidth!==void 0&&s>n.maxWidth||n.minHeight!==void 0&&o<n.minHeight||n.maxHeight!==void 0&&o>n.maxHeight)}case"session_metric":{let s=e.sessionMetrics?e.sessionMetrics.get(n.key):r?.getSessionMetric(n.key);if(s===void 0)return!1;let{operator:o,threshold:a}=n;switch(o){case"gte":return s>=a;case"lte":return s<=a;case"eq":return s===a;case"gt":return s>a;case"lt":return s<a;default:return!1}}case"dismissed":{if(!r)return n.inverted??!1;let s=r.isDismissed(n.key);return n.inverted?!s:s}case"cooldown_active":{if(!r)return n.inverted??!1;let s=r.isCooldownActive(n.key);return n.inverted?!s:s}case"frequency_limit":{if(!r)return n.inverted??!1;let o=r.getFrequencyCount(n.key)>=n.limit;return n.inverted?!o:o}case"event_count":{if(!e.accumulator)return!1;let s=n,o=e.accumulator.getCount(s.key,s.withinMs);switch(s.operator){case"gte":return o>=s.count;case"lte":return o<=s.count;case"eq":return o===s.count;case"gt":return o>s.count;case"lt":return o<s.count;default:return!1}}default:return console.warn("[RuleStrategy] Unknown condition type:",n.type),!1}}function Cb(n,e){let t=[];for(let r of n.conditions){let i=Eb(r,e);if(t.push({condition:r,result:i}),!i)return{matched:!1,conditionResults:t}}return{matched:!0,conditionResults:t}}function Rl(n,e){for(let t=0;t<n.rules.length;t++){let r=n.rules[t],{matched:i,conditionResults:s}=Cb(r,e);if(i)return{value:r.value,isFallback:!1,matchInfo:{strategyType:"rules",matchedRuleIndex:t,evaluatedConditions:s}}}return{value:n.default,isFallback:!0,matchInfo:{strategyType:"rules"}}}function Tl(n,e){let{context:t}=e,r=t.augmented?.[n.field];return r===void 0||typeof r!="number"?{value:n.below,isFallback:!0,matchInfo:{strategyType:"score"}}:{value:r>=n.threshold?n.above:n.below,isFallback:!1,matchInfo:{strategyType:"score"}}}function Ab(n,e){let{state:t,events:r,sessionMetrics:i,accumulator:s}=e;return{context:n,state:t?{isDismissed:o=>t.dismissals.isDismissed(o),isCooldownActive:o=>t.cooldowns.isActive(o),getFrequencyCount:o=>t.frequency.count(o),getSessionMetric:o=>i?.get(o)??0,getValue:o=>t.session.get(o)??t.user.get(o)}:void 0,sessionMetrics:i?{get:o=>i.get(o)??0}:void 0,events:r?{hasRecentEvent:(o,a)=>r.hasRecentEvent(o,a)}:void 0,accumulator:s?{getCount:(o,a)=>s.getCount(o,a)}:void 0}}async function Rb(n,e,t={}){let r=Ab(e,t);switch(n.type){case"rules":return Rl(n,r);case"score":return Tl(n,r);case"model":return{value:n.default,isFallback:!0,matchInfo:{strategyType:"model"}};case"external":return{value:n.default,isFallback:!0,matchInfo:{strategyType:"external"}};default:return console.warn("[DecisionEngine] Unknown strategy type:",n.type),{value:void 0,isFallback:!0,matchInfo:{strategyType:n.type}}}}function Tb(n,e,t={}){let r=Ab(e,t);switch(n.type){case"rules":return Rl(n,r);case"score":return Tl(n,r);case"model":case"external":return{value:n.default,isFallback:!0,matchInfo:{strategyType:n.type}};default:return{value:void 0,isFallback:!0,matchInfo:{strategyType:n.type}}}}function Qd(n){return{evaluate:(e,t)=>Rb(e,t,n),evaluateSync:(e,t)=>Tb(e,t,n)}}function Jd(n){let{eventBus:e,stateStore:t}=n,r=new Map,i=new Set,s=null,o=t.ns("accumulator");function a(c){let u=!1;for(let d of r.values()){if(!d.predicate(c))continue;let h=o.get(d.stateKey)||{count:0};h.count++,d.needsTimestamps&&(h.timestamps||(h.timestamps=[]),h.timestamps.push(c.ts),h.timestamps.length>200&&(h.timestamps=h.timestamps.slice(-200))),o.set(d.stateKey,h),u=!0}if(u)for(let d of i)try{d()}catch(h){console.error("[EventAccumulator] Subscriber error:",h)}}function l(){s||r.size===0||(s=e.subscribe(a))}return{register(c,u,d=!1){let h=`ev:${c}`,g=r.get(h);if(g){d&&!g.needsTimestamps&&(g.needsTimestamps=!0);return}r.set(h,{stateKey:h,needsTimestamps:d,predicate:u}),l()},getCount(c,u){let d=`ev:${c}`,h=o.get(d);if(!h)return 0;if(u===void 0||!h.timestamps)return h.count;let g=Date.now()-u;return h.timestamps.filter(v=>v>=g).length},subscribe(c){return i.add(c),()=>{i.delete(c)}},destroy(){s&&(s(),s=null),r.clear(),i.clear()}}}var uo=class{constructor(){this.listeners=new Set;this.destroyed=!1;this.onPopState=()=>{this.notify(window.location.href,"popstate")};this.wasNative=this.isNativeFunction(history.pushState),this.capturedPushState=history.pushState,this.capturedReplaceState=history.replaceState,history.pushState=(...e)=>{this.capturedPushState.call(history,...e),queueMicrotask(()=>this.notify(window.location.href,"pushState"))},history.replaceState=(...e)=>{this.capturedReplaceState.call(history,...e),queueMicrotask(()=>this.notify(window.location.href,"replaceState"))},window.addEventListener("popstate",this.onPopState)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}diagnose(){return{isNative:this.wasNative,subscriberCount:this.listeners.size}}destroy(){this.destroyed||(this.destroyed=!0,history.pushState=this.capturedPushState,history.replaceState=this.capturedReplaceState,window.removeEventListener("popstate",this.onPopState),this.listeners.clear())}notify(e,t){if(!this.destroyed)for(let r of this.listeners)try{r(e,t)}catch{}}isNativeFunction(e){try{return Function.prototype.toString.call(e).includes("[native code]")}catch{return!1}}};var ep="cooldown:";function Ib(n){return{set(e,t){let r=ep+e,i=Date.now()+t;n.set(r,i)},isActive(e){return this.remaining(e)>0},remaining(e){let t=ep+e,r=n.get(t);if(r===void 0)return 0;let i=r-Date.now();return i<=0?(n.remove(t),0):i},clear(e){let t=ep+e;n.remove(t)}}}var po="dismissed:";function $b(n,e){return{mark(t,r=!1){let i=po+t;(r?e:n).set(i,!0)},isDismissed(t){let r=po+t;return n.has(r)||e.has(r)},clear(t){let r=po+t;n.remove(r),e.remove(r)},clearAll(){for(let t of n.keys())t.startsWith(po)&&n.remove(t);for(let t of e.keys())t.startsWith(po)&&e.remove(t)}}}var tp="freq:";function Mb(n){function e(t){let r=tp+t,i=n.get(r);if(i){if(i.resetAt&&Date.now()>=i.resetAt){n.remove(r);return}return i}}return{increment(t,r){let i=tp+t,s=e(t),o=(s?.count??0)+1,a={count:o,resetAt:s?.resetAt??(r?Date.now()+r:void 0)};return n.set(i,a),o},count(t){return e(t)?.count??0},reset(t){let r=tp+t;n.remove(r)},hasReachedLimit(t,r){return this.count(t)>=r}}}var uA="syntro";function np(n,e){let t=`${e}:`;return{get(r){if(n)try{let i=n.getItem(t+r);if(!i)return;let s=JSON.parse(i);if(s.expiresAt&&Date.now()>=s.expiresAt){n.removeItem(t+r);return}return s.value}catch{return}},set(r,i,s){if(n)try{let o={value:i,expiresAt:s?Date.now()+s:void 0};n.setItem(t+r,JSON.stringify(o))}catch(o){console.warn("[StateStore] Failed to save:",o)}},remove(r){n&&n.removeItem(t+r)},has(r){return n?this.get(r)!==void 0:!1},keys(){if(!n)return[];let r=[];for(let i=0;i<n.length;i++){let s=n.key(i);s?.startsWith(t)&&r.push(s.slice(t.length))}return r},clear(){if(!n)return;let r=this.keys();for(let i of r)n.removeItem(t+i)}}}function ho(n){let e=new Map,t=`${n}:`;return{get(r){let i=e.get(t+r);if(i){if(i.expiresAt&&Date.now()>=i.expiresAt){e.delete(t+r);return}return i.value}},set(r,i,s){e.set(t+r,{value:i,expiresAt:s?Date.now()+s:void 0})},remove(r){e.delete(t+r)},has(r){return this.get(r)!==void 0},keys(){let r=[];for(let i of e.keys())i.startsWith(t)&&r.push(i.slice(t.length));return r},clear(){for(let r of e.keys())r.startsWith(t)&&e.delete(r)}}}var Il=class{constructor(e={}){this.namespacedStorages=new Map;this.namespace=e.namespace??uA;let t=r=>typeof r=="object"&&r!==null&&typeof r.setItem=="function";typeof window<"u"?(this.session=t(window.sessionStorage)?np(window.sessionStorage,this.namespace):ho(this.namespace),this.user=t(window.localStorage)?np(window.localStorage,this.namespace):ho(this.namespace)):(this.session=ho(this.namespace),this.user=ho(this.namespace)),this.dismissals=$b(this.session,this.user),this.cooldowns=Ib(this.user),this.frequency=Mb(this.session)}ns(e){let t=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(t)){let r=typeof window<"u"&&typeof sessionStorage<"u"?np(sessionStorage,t):ho(t);this.namespacedStorages.set(t,r)}return this.namespacedStorages.get(t)}};function rp(n={}){return new Il(n)}function fo(n){return n.startsWith("inline:")?"inline":n.startsWith("adjacent:")?"adjacent":"static"}function $l(n){return n.startsWith("inline:")?n.slice(7):n.startsWith("adjacent:")?n.slice(9):null}var Pb={drawer_right:{position:"fixed",top:"0",right:"0",bottom:"0",width:"360px",maxWidth:"90vw"},drawer_left:{position:"fixed",top:"0",left:"0",bottom:"0",width:"360px",maxWidth:"90vw"},drawer_bottom:{position:"fixed",left:"0",right:"0",bottom:"0",maxHeight:"50vh"},overlay_center:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxWidth:"90vw",maxHeight:"90vh"},overlay_corner_br:{position:"fixed",bottom:"16px",right:"16px",maxWidth:"400px",maxHeight:"80vh"},overlay_corner_bl:{position:"fixed",bottom:"16px",left:"16px",maxWidth:"400px",maxHeight:"80vh"},toast_top:{position:"fixed",top:"16px",left:"50%",transform:"translateX(-50%)",maxWidth:"90vw"},toast_bottom:{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",maxWidth:"90vw"}},go={fade:[{opacity:0},{opacity:1}],slide:[{opacity:0,transform:"translateY(10px)"},{opacity:1,transform:"translateY(0)"}],scale:[{opacity:0,transform:"scale(0.95)"},{opacity:1,transform:"scale(1)"}],none:[]},Ob={duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"};function ip(n,e,t){let r=Pb[e];Object.assign(n.style,r),t&&(t.maxWidth&&(n.style.maxWidth=t.maxWidth),t.maxHeight&&(n.style.maxHeight=t.maxHeight),t.minWidth&&(n.style.minWidth=t.minWidth),t.minHeight&&(n.style.minHeight=t.minHeight))}function sp(n,e,t){let r=t.placement==="auto"?"bottom":t.placement,i=[Gr(t.offset?{mainAxis:t.offset.y,crossAxis:t.offset.x}:8)];return t.flip!==!1&&i.push(Yr()),t.shift!==!1&&i.push(Kr({padding:8})),n.style.position="absolute",n.style.zIndex="2147483646",Zr(e,n,async()=>{let{x:o,y:a,strategy:l}=await Xr(e,n,{placement:r,middleware:i});Object.assign(n.style,{position:l,left:`${o}px`,top:`${a}px`})})}function op(n,e,t="append"){return n.style.position="relative",n.style.display="inline-block",t==="prepend"?e.insertBefore(n,e.firstChild):e.appendChild(n),()=>{n.remove()}}function ap(n,e){return e==="none"||go[e].length===0?null:n.animate(go[e],Ob)}function lp(n,e){if(e==="none"||go[e].length===0)return Promise.resolve();let t=[...go[e]].reverse(),r=n.animate(t,Ob);return new Promise(i=>{r.onfinish=()=>i(),r.oncancel=()=>i()})}function cp(n,e){let t=document.createElement("div");return t.setAttribute("data-syntro-surface",n),t.setAttribute("data-syntro-mount-id",e),t.className="syntro-surface",Object.assign(t.style,{pointerEvents:"auto",boxSizing:"border-box",overflow:"auto"}),t}function up(n){switch(fo(n)){case"static":return n.startsWith("drawer")?2147483640:n.startsWith("overlay")?2147483642:n.startsWith("toast")?2147483644:2147483640;case"inline":return 1;case"adjacent":return 2147483638;default:return 2147483640}}function Nb(n){if(typeof window.Sanitizer=="function")try{let l=new window.Sanitizer({}).sanitizeToFragment(n),c=document.createElement("div");return c.append(l),c.innerHTML}catch{}let t=document.createElement("template");t.innerHTML=n;let r=t.content,i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,null),s=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button"]),o=[];for(;i.nextNode();){let a=i.currentNode,l=a.tagName.toLowerCase();if(!s.has(l)){o.push(a);continue}for(let c of Array.from(a.attributes)){let u=c.name.toLowerCase(),d=c.value.trim().toLowerCase(),h=u.startsWith("on"),g=(u==="href"||u==="src")&&d.startsWith("javascript:");(h||g)&&a.removeAttribute(c.name)}}for(let a of o){for(;a.firstChild;)a.parentNode?.insertBefore(a.firstChild,a);a.remove()}return t.innerHTML=(r.firstChild,t.innerHTML)}var dA=0;function dp(n){let{overlayRoot:e,eventBus:t,anchorResolver:r,defaultAnimation:i="fade",widgetRegistry:s}=n,o=new Map,a=new Map,l=new Map;function c(){return`mount-${++dA}`}function u(b,w){t&&t.publish(b,w)}function d(b){let w=l.get(b);if(w){let E=m(b);for(let x of w)try{x(E)}catch(R){console.error("[Surfaces] State callback error:",R)}}}let h=new Map;function g(b,w,E){switch(w.type){case"html":b.innerHTML=Nb(w.content);return;case"widget":{if(s?.has(w.widgetId)){let x=s.mount(w.widgetId,b,w.config);return E&&h.set(E,x),()=>{x.unmount(),E&&h.delete(E)}}console.warn(`[Surfaces] Widget not found: ${w.widgetId}`),b.innerHTML=`<div data-widget-id="${w.widgetId}" data-widget-missing="true">Widget: ${w.widgetId}</div>`;return}case"custom":return w.mount(b);case"react":b.innerHTML="<div data-react-component>React Component</div>";return;default:console.warn("[Surfaces] Unknown content type");return}}function v(b,w,E){let x=c(),R=fo(b),I=E?.priority??0,O=E?.animation??i,P=E?.exclusive??!0,G=o.get(b);if(G&&P){if(G.options.priority>I)throw new Error(`Slot ${b} is occupied by higher priority content (${G.options.priority} > ${I})`);f(G)}let L=cp(b,x);L.style.zIndex=String(up(b));let F;if(R==="static")ip(L,b,E?.constraints),e.appendChild(L);else if(R==="inline"){let M=$l(b);if(!M)throw new Error(`Invalid inline slot: ${b}`);if(!r)throw new Error("Anchor resolver required for inline slots");let V=r({selector:M,route:"**"});if(!V)throw new Error(`Anchor not found for inline slot: ${M}`);F=op(L,V)}else if(R==="adjacent"){let M=$l(b);if(!M)throw new Error(`Invalid adjacent slot: ${b}`);if(!r)throw new Error("Anchor resolver required for adjacent slots");let V=r({selector:M,route:"**"});if(!V)throw new Error(`Anchor not found for adjacent slot: ${M}`);e.appendChild(L),F=sp(L,V,E?.position??{placement:"bottom"})}let Z=g(L,w,x);ap(L,O);let A={id:x,slot:b,content:w,options:{priority:I,exclusive:P,animation:O,position:E?.position??{placement:"auto"},constraints:E?.constraints??{},adaptiveId:E?.adaptiveId,autoUnmountOnRouteChange:E?.autoUnmountOnRouteChange??!0},container:L,cleanup:()=>{F?.(),Z?.()},mountedAt:Date.now()};return o.set(b,A),a.set(b,(a.get(b)??0)+1),u("surface.mounted",{slot:b,id:x,adaptiveId:E?.adaptiveId}),d(b),{id:x,update(M){let V=o.get(b);if(!V||V.id!==x)throw new Error("Mount no longer active");let de=h.get(x);if(de){if(M.type==="widget"){de.update(M.config),V.content=M;return}de.unmount(),h.delete(x)}V.container.innerHTML="";let tt=g(V.container,M,x);if(V.content=M,tt){let ge=V.cleanup;V.cleanup=()=>{ge?.(),tt()}}},setOptions(M){let V=o.get(b);if(!V||V.id!==x)throw new Error("Mount no longer active");M.priority!==void 0&&(V.options.priority=M.priority),M.animation!==void 0&&(V.options.animation=M.animation),M.constraints&&R==="static"&&(M.constraints.maxWidth&&(V.container.style.maxWidth=M.constraints.maxWidth),M.constraints.maxHeight&&(V.container.style.maxHeight=M.constraints.maxHeight),M.constraints.minWidth&&(V.container.style.minWidth=M.constraints.minWidth),M.constraints.minHeight&&(V.container.style.minHeight=M.constraints.minHeight)),d(b)},async unmount(){let M=o.get(b);!M||M.id!==x||await f(M)},isMounted(){return o.get(b)?.id===x},getContainer(){let M=o.get(b);return M?.id===x?M.container:null}}}async function f(b){b.container.isConnected&&await lp(b.container,b.options.animation);try{b.cleanup?.()}catch(w){console.warn("[Surfaces] Cleanup error during unmount, ignoring:",w)}try{b.container.remove()}catch{}o.delete(b.slot),u("surface.unmounted",{slot:b.slot,id:b.id}),d(b.slot)}function m(b){let w=o.get(b);return{slot:b,occupied:!!w,currentPriority:w?.options.priority,currentAdaptiveId:w?.options.adaptiveId,mountCount:a.get(b)??0,currentMountId:w?.id}}function y(b,w){let E=l.get(b);return E||(E=new Set,l.set(b,E)),E.add(w),()=>{E?.delete(w),E?.size===0&&l.delete(b)}}function k(b,w){let E=o.get(b);return E?w!==void 0?w>=E.options.priority:!1:!0}function _(){for(let b of o.values())try{b.cleanup?.(),b.container.remove()}catch(w){console.error("[Surfaces] Error during cleanup:",w)}o.clear(),l.clear()}return{mount:v,getState:m,onStateChange:y,canMount:k,destroy:_}}var Ml=class{constructor(){this.widgets=new Map;this.mountedWidgets=new Map;this.mountIdCounter=0;this.listeners=new Set}bindRuntime(e){this.runtimeRef=e}register(e,t,r="custom",i){if(this.widgets.has(e)){if(this.widgets.get(e).source==="built-in")throw new Error(`Cannot override built-in widget: ${e}`);console.warn(`[WidgetRegistry] Overriding widget: ${e}`)}this.widgets.set(e,{id:e,widget:t,source:r,metadata:i}),this.notify({type:"registered",widgetId:e})}unregister(e){let t=this.widgets.get(e);return t?t.source==="built-in"?(console.warn(`[WidgetRegistry] Cannot unregister built-in widget: ${e}`),!1):(this.widgets.delete(e),this.notify({type:"unregistered",widgetId:e}),!0):!1}unregisterBySource(e){for(let[t,r]of this.widgets.entries())r.source===e&&this.widgets.delete(t)}get(e){return this.widgets.get(e)?.widget}getRegistration(e){return this.widgets.get(e)}has(e){return this.widgets.has(e)}mount(e,t,r){let i=this.widgets.get(e);if(!i)throw new Error(`Widget not found: ${e}`);let s=`widget-mount-${++this.mountIdCounter}`;t.setAttribute("data-widget-mount-id",s),t.setAttribute("data-widget-id",e);let o={...r,runtime:this.runtimeRef},a=i.widget.mount(t,o);return this.mountedWidgets.set(s,{cleanup:a??void 0,container:t}),{widgetId:e,container:t,unmount:()=>{let c=this.mountedWidgets.get(s);c&&(t.isConnected&&c.cleanup?.(),this.mountedWidgets.delete(s),t.removeAttribute("data-widget-mount-id"),t.removeAttribute("data-widget-id"),t.innerHTML="")},update:c=>{if(i.widget.update)i.widget.update(t,c);else{let u=this.mountedWidgets.get(s);if(u){u.cleanup?.(),t.innerHTML="";let d={...c,runtime:this.runtimeRef},h=i.widget.mount(t,d);u.cleanup=h??void 0}}}}}list(){return Array.from(this.widgets.keys())}listRegistrations(){return Array.from(this.widgets.values())}getBySource(e){return Array.from(this.widgets.values()).filter(t=>t.source===e)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(e){for(let t of this.listeners)try{t(e)}catch(r){console.error("[WidgetRegistry] Listener error:",r)}}destroy(){for(let[e,t]of this.mountedWidgets.entries())t.cleanup?.(),t.container.innerHTML="";this.mountedWidgets.clear()}},pp=new Ml;var Fb="2.0.0";function pA(n,e){if(!e)return!0;let t;try{t=new URL(n).pathname}catch{t=n}let r=t.replace(/\/$/,"")||"/";if(e.exclude){for(let i of e.exclude)if(hp(r,i))return!1}if(e.include&&e.include.length>0){for(let i of e.include)if(hp(r,i))return!0;return!1}return!0}function hp(n,e){let t=e.replace(/\/$/,"")||"/";if(n===t)return!0;let r=t.replace(/\*\*/g,"\0GLOBSTAR\0").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\0GLOBSTAR\0/g,".*").replace(/:[^/]+/g,"[^/]+");return new RegExp(`^${r}$`).test(n)}function Lb(n){let t=(typeof window<"u"?window.location.pathname:"/").replace(/\/$/,"")||"/";return(Array.isArray(n.route)?n.route:[n.route]).some(i=>{let s=i;if(/^https?:\/\//.test(s))try{s=new URL(s).pathname}catch{}return hp(t,s)})}function fp(n={}){let{telemetry:e,sessionMetrics:t,routes:r,mode:i="production",namespace:s}=n,o=n.widgets??pp,a=n.executors??tn,l=n.apps??vs,c=new uo,u=Xd({telemetry:e,routes:r,navigation:c}),d=n.events??no(),h=rp({namespace:s}),g=Jd({eventBus:d,stateStore:h}),v=Qd({state:h,events:d,sessionMetrics:t,accumulator:g}),f=Sy(),m=yd(),y=P=>Lb(P)?m.resolve(P.selector):null,k=async(P,G)=>{if(!Lb(P))return null;try{return await m.waitFor(P.selector,G)}catch{return null}},_=dp({overlayRoot:f,eventBus:d,anchorResolver:y,widgetRegistry:o}),b=ed({overlayRoot:f,eventBus:d,surfaces:_,anchorResolver:y,waitForAnchor:k,executorRegistry:a,subscribeNavigation:P=>c.subscribe(P),runtime:{evaluateSync:P=>v.evaluateSync(P,u.get()),context:u,accumulator:g,sessionMetrics:t,events:d?{subscribe:P=>d.subscribe(()=>P())}:void 0}}),w;if(t){let P=t;P.increment("page_views");let G=typeof window<"u"?window.location.pathname:"/";w=c.subscribe((L,F)=>{if(F!=="replaceState")try{let Z=new URL(L).pathname;Z!==G&&(G=Z,P.increment("page_views"),E=0,P.set("time_on_page",0),P.set("scroll_depth",0))}catch{}})}let E=0,x,R;if(t){let P=t;x=setInterval(()=>{E++},1e3),R=setInterval(()=>{P.set("time_on_page",E)},5e3)}let I;if(t&&d){let P=t;I=d.subscribe({names:["ui.scroll"]},G=>{let L=G.props?.scrollPercentage;typeof L=="number"&&L>P.get("scroll_depth")&&P.set("scroll_depth",L)})}let O={telemetry:e,context:u,events:d,state:h,sessionMetrics:t,actions:b,surfaces:_,widgets:o,executors:a,apps:l,accumulator:g,anchorResolver:m,navigation:c,version:Fb,mode:i,async evaluate(P){return v.evaluate(P,u.get())},evaluateSync(P){return v.evaluateSync(P,u.get())},async filterTiles(P){let G=u.get().page.url,L=[];for(let F of P){let Z=F.activation;if(!Z){L.push(F);continue}if(pA(G,Z.routes)){if(Z.onlyIfPopulated){let A=F.props?.actions??[];if(A.length>0&&!A.some(M=>M.triggerWhen?v.evaluateSync(M.triggerWhen,u.get()).value:!0))continue}L.push(F)}}return L},setRoutes(P){u.setRoutes(P)},destroy(){l.unbind().catch(P=>{console.error("[Runtime] Error unbinding apps registry:",P)}),w?.(),I?.(),x&&clearInterval(x),R&&clearInterval(R),m.destroy(),g.destroy(),c.destroy(),u.destroy(),b.destroy(),_.destroy()}};return l.bind(O),o.bindRuntime(O),O}var mo=class{constructor(e,t){this.seenSet=new Set;this.triggeredSet=new Set;this.telemetry=e,this.variantId=t}trackServed(e,t){this.telemetry.track?.("syntro_config_served",{variant_id:this.variantId,tiles:e,actions:t})}trackSeen(e,t){this.seenSet.has(e)||(this.seenSet.add(e),this.telemetry.track?.("syntro_intervention_seen",{variant_id:this.variantId,intervention_id:e,intervention_kind:t}))}trackTriggered(e,t){this.triggeredSet.has(e)||(this.triggeredSet.add(e),this.telemetry.track?.("syntro_intervention_triggered",{variant_id:this.variantId,intervention_id:e,intervention_kind:t}))}trackInteracted(e,t,r){this.telemetry.track?.("syntro_intervention_interacted",{variant_id:this.variantId,intervention_id:e,intervention_kind:t,interaction_type:r})}resetPage(){this.seenSet.clear(),this.triggeredSet.clear()}};function hA(){let n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let t=0;t<16;t++)e+=n[Math.floor(Math.random()*n.length)];return e}var gp=class{constructor(){this.sessionId=hA(),console.log(`[Syntro Telemetry] Using noop adapter (no telemetry configured). sessionId=${this.sessionId}`)}trackCanvasOpened(e){}trackCanvasClosed(e){}trackRectangleViewed(e,t){}trackAction(e,t,r){}register(e){}getSessionId(){return this.sessionId}startSessionRecording(){}trackExperiment(e,t,r){}setPersonProperties(e){}setPersonPropertiesOnce(e){}getDistinctId(){return"demo-user"}getAllFeatureFlags(){return{}}getSegmentFlags(){return{}}track(e,t){}};function mp(){return new gp}var C=typeof window<"u"?window:void 0,Ue=typeof globalThis<"u"?globalThis:C;typeof self>"u"&&(Ue.self=Ue),typeof File>"u"&&(Ue.File=function(){});var P_=Array.prototype,Db=P_.forEach,Hb=P_.indexOf,pt=Ue?.navigator,W=Ue?.document,je=Ue?.location,Op=Ue?.fetch,Np=Ue!=null&&Ue.XMLHttpRequest&&"withCredentials"in new Ue.XMLHttpRequest?Ue.XMLHttpRequest:void 0,Bb=Ue?.AbortController,st=pt?.userAgent,J=C??{},dn={DEBUG:!1,LIB_VERSION:"1.341.0"};function Vb(n,e,t,r,i,s,o){try{var a=n[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(r,i)}function Bi(n){return function(){var e=this,t=arguments;return new Promise((function(r,i){var s=n.apply(e,t);function o(l){Vb(s,r,i,o,a,"next",l)}function a(l){Vb(s,r,i,o,a,"throw",l)}o(void 0)}))}}function z(){return z=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},z.apply(null,arguments)}function O_(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var fA=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Wb=function(n,e){if(e===void 0&&(e=[]),!n)return!1;var t=n.toLowerCase();return fA.concat(e).some((r=>{var i=r.toLowerCase();return t.indexOf(i)!==-1}))},gA=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function ce(n,e){return n.indexOf(e)!==-1}var lc=function(n){return n.trim()},Lp=function(n){return n.replace(/^\$/,"")},mA=Array.isArray,N_=Object.prototype,L_=N_.hasOwnProperty,cc=N_.toString,fe=mA||function(n){return cc.call(n)==="[object Array]"},qn=n=>typeof n=="function",Pe=n=>n===Object(n)&&!fe(n),Vi=n=>{if(Pe(n)){for(var e in n)if(L_.call(n,e))return!1;return!0}return!1},j=n=>n===void 0,Oe=n=>cc.call(n)=="[object String]",Fp=n=>Oe(n)&&n.trim().length===0,Ft=n=>n===null,ue=n=>j(n)||Ft(n),vn=n=>cc.call(n)=="[object Number]"&&n==n,Di=n=>vn(n)&&n>0,mn=n=>cc.call(n)==="[object Boolean]",vA=n=>n instanceof FormData,yA=n=>ce(gA,n);function Dp(n){return n===null||typeof n!="object"}function Bl(n,e){return Object.prototype.toString.call(n)==="[object "+e+"]"}function F_(n){return!j(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(n,Event)}var bA=[!0,"true",1,"1","yes"],vp=n=>ce(bA,n),_A=[!1,"false",0,"0","no"];function Zt(n,e,t,r,i){return e>t&&(r.warn("min cannot be greater than max."),e=t),vn(n)?n>t?(r.warn(" cannot be greater than max: "+t+". Using max value instead."),t):n<e?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):n:(r.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+i),Zt(i||t,e,t,r))}var Hp=class{constructor(e){this.t={},this.i=e.i,this.o=Zt(e.bucketSize,0,100,e.h),this.m=Zt(e.refillRate,0,this.o,e.h),this.$=Zt(e.refillInterval,0,864e5,e.h)}S(e,t){var r=t-e.lastAccess,i=Math.floor(r/this.$);if(i>0){var s=i*this.m;e.tokens=Math.min(e.tokens+s,this.o),e.lastAccess=e.lastAccess+i*this.$}}consumeRateLimit(e){var t,r=Date.now(),i=String(e),s=this.t[i];return s?this.S(s,r):(s={tokens:this.o,lastAccess:r},this.t[i]=s),s.tokens===0||(s.tokens--,s.tokens===0&&((t=this.i)==null||t.call(this,e)),s.tokens===0)}stop(){this.t={}}},St="Mobile",Vl="iOS",gn="Android",Fo="Tablet",D_=gn+" "+Fo,H_="iPad",B_="Apple",V_=B_+" Watch",Do="Safari",zi="BlackBerry",W_="Samsung",j_=W_+"Browser",U_=W_+" Internet",Br="Chrome",xA=Br+" OS",z_=Br+" "+Vl,Zh="Internet Explorer",q_=Zh+" "+St,Gh="Opera",wA=Gh+" Mini",Kh="Edge",Z_="Microsoft "+Kh,ji="Firefox",G_=ji+" "+Vl,Ho="Nintendo",Bo="PlayStation",Ui="Xbox",K_=gn+" "+St,Y_=St+" "+Do,Co="Windows",Bp=Co+" Phone",jb="Nokia",Vp="Ouya",X_="Generic",kA=X_+" "+St.toLowerCase(),Q_=X_+" "+Fo.toLowerCase(),Wp="Konqueror",Je="(\\d+(\\.\\d+)?)",yp=new RegExp("Version/"+Je),SA=new RegExp(Ui,"i"),EA=new RegExp(Bo+" \\w+","i"),CA=new RegExp(Ho+" \\w+","i"),Yh=new RegExp(zi+"|PlayBook|BB10","i"),AA={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Pl,Ub,bp,RA=(n,e)=>e&&ce(e,B_)||(function(t){return ce(t,Do)&&!ce(t,Br)&&!ce(t,gn)})(n),J_=function(n,e){return e=e||"",ce(n," OPR/")&&ce(n,"Mini")?wA:ce(n," OPR/")?Gh:Yh.test(n)?zi:ce(n,"IE"+St)||ce(n,"WPDesktop")?q_:ce(n,j_)?U_:ce(n,Kh)||ce(n,"Edg/")?Z_:ce(n,"FBIOS")?"Facebook "+St:ce(n,"UCWEB")||ce(n,"UCBrowser")?"UC Browser":ce(n,"CriOS")?z_:ce(n,"CrMo")||ce(n,Br)?Br:ce(n,gn)&&ce(n,Do)?K_:ce(n,"FxiOS")?G_:ce(n.toLowerCase(),Wp.toLowerCase())?Wp:RA(n,e)?ce(n,St)?Y_:Do:ce(n,ji)?ji:ce(n,"MSIE")||ce(n,"Trident/")?Zh:ce(n,"Gecko")?ji:""},TA={[q_]:[new RegExp("rv:"+Je)],[Z_]:[new RegExp(Kh+"?\\/"+Je)],[Br]:[new RegExp("("+Br+"|CrMo)\\/"+Je)],[z_]:[new RegExp("CriOS\\/"+Je)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Je)],[Do]:[yp],[Y_]:[yp],[Gh]:[new RegExp("(Opera|OPR)\\/"+Je)],[ji]:[new RegExp(ji+"\\/"+Je)],[G_]:[new RegExp("FxiOS\\/"+Je)],[Wp]:[new RegExp("Konqueror[:/]?"+Je,"i")],[zi]:[new RegExp(zi+" "+Je),yp],[K_]:[new RegExp("android\\s"+Je,"i")],[U_]:[new RegExp(j_+"\\/"+Je)],[Zh]:[new RegExp("(rv:|MSIE )"+Je)],Mozilla:[new RegExp("rv:"+Je)]},IA=function(n,e){var t=J_(n,e),r=TA[t];if(j(r))return null;for(var i=0;i<r.length;i++){var s=r[i],o=n.match(s);if(o)return parseFloat(o[o.length-2])}return null},zb=[[new RegExp(Ui+"; "+Ui+" (.*?)[);]","i"),n=>[Ui,n&&n[1]||""]],[new RegExp(Ho,"i"),[Ho,""]],[new RegExp(Bo,"i"),[Bo,""]],[Yh,[zi,""]],[new RegExp(Co,"i"),(n,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Bp,""];if(new RegExp(St).test(e)&&!/IEMobile\b/.test(e))return[Co+" "+St,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var r=t[1],i=AA[r]||"";return/arm/i.test(e)&&(i="RT"),[Co,i]}return[Co,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,n=>{if(n&&n[3]){var e=[n[3],n[4],n[5]||"0"];return[Vl,e.join(".")]}return[Vl,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,n=>{var e="";return n&&n.length>=3&&(e=j(n[2])?n[3]:n[2]),["watchOS",e]}],[new RegExp("("+gn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+gn+")","i"),n=>{if(n&&n[2]){var e=[n[2],n[3],n[4]||"0"];return[gn,e.join(".")]}return[gn,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,n=>{var e=["Mac OS X",""];if(n&&n[1]){var t=[n[1],n[2],n[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[xA,""]],[/Linux|debian/i,["Linux",""]]],qb=function(n){return CA.test(n)?Ho:EA.test(n)?Bo:SA.test(n)?Ui:new RegExp(Vp,"i").test(n)?Vp:new RegExp("("+Bp+"|WPDesktop)","i").test(n)?Bp:/iPad/.test(n)?H_:/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(n)?V_:Yh.test(n)?zi:/(kobo)\s(ereader|touch)/i.test(n)?"Kobo":new RegExp(jb,"i").test(n)?jb:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(n)||/(kf[a-z]+)( bui|\)).+silk\//i.test(n)?"Kindle Fire":/(Android|ZTE)/i.test(n)?new RegExp(St).test(n)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(n)||/pixel[\daxl ]{1,6}/i.test(n)&&!/pixel c/i.test(n)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(n)||/lmy47v/i.test(n)&&!/QTAQZ3/i.test(n)?gn:D_:new RegExp("(pda|"+St+")","i").test(n)?kA:new RegExp(Fo,"i").test(n)&&!new RegExp(Fo+" pc","i").test(n)?Q_:""},$A=n=>n instanceof Error;function MA(n){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return bp&&t.length===Ub||(Ub=t.length,bp=t.reduce(((r,i)=>{Pl||(Pl={});var s=Pl[i];if(s)r[s[0]]=s[1];else for(var o=n(i),a=o.length-1;a>=0;a--){var l=o[a],c=l?.filename,u=e[i];if(c&&u){r[c]=u,Pl[i]=[c,u];break}}return r}),{})),bp}}var jp=class{constructor(e,t,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){t===void 0&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),s=this.buildParsingContext(),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var t=this;return Bi((function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&fe(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r,i;return e.cause!=null&&(r=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),z({},e,{cause:r,stack:i})}applyChunkIds(e,t){return e.map((r=>(r.filename&&t&&(r.chunk_id=t[r.filename]),r)))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Bi((function*(){var r=e;for(var i of t.modifiers)r=yield i(r);return r}))()}convertToExceptionList(e,t){var r,i,s,o={type:e.type,value:e.value,mechanism:{type:(r=t.type)!==null&&r!==void 0?r:"generic",handled:(i=t.handled)===null||i===void 0||i,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,z({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:MA(this.stackParser)}}buildCoercingContext(e,t,r){r===void 0&&(r=0);var i=(s,o)=>{if(o<=4){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(s,a)}};return z({},t,{syntheticException:r==0?t.syntheticException:void 0,mechanism:e,apply:s=>i(s,r),next:s=>i(s,r+1)})}},qi="?";function Up(n,e,t,r,i){var s={platform:n,filename:e,function:t==="<anonymous>"?qi:t,in_app:!0};return j(r)||(s.lineno=r),j(i)||(s.colno=i),s}var e0=(n,e)=>{var t=n.indexOf("safari-extension")!==-1,r=n.indexOf("safari-web-extension")!==-1;return t||r?[n.indexOf("@")!==-1?n.split("@")[0]:qi,t?"safari-extension:"+e:"safari-web-extension:"+e]:[n,e]},PA=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,OA=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,NA=/\((\S*)(?::(\d+))(?::(\d+))\)/,LA=(n,e)=>{var t=PA.exec(n);if(t){var[,r,i,s]=t;return Up(e,r,qi,+i,+s)}var o=OA.exec(n);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=NA.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=e0(o[1]||qi,o[2]);return Up(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},FA=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,DA=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,HA=(n,e)=>{var t=FA.exec(n);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var r=DA.exec(t[3]);r&&(t[1]=t[1]||"eval",t[3]=r[1],t[4]=r[2],t[5]="")}var i=t[3],s=t[1]||qi;return[s,i]=e0(s,i),Up(e,i,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Zb=/\(error: (.*)\)/,Gb=50;function BA(){return(function(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return function(i,s){s===void 0&&(s=0);for(var o=[],a=i.split(`
|
|
1160
|
-
`),l=s;l<a.length;l++){var c=a[l];if(!(c.length>1024)){var u=Zb.test(c)?c.replace(Zb,"$1"):c;if(!u.match(/\S*Error: /)){for(var d of t){var h=d(u,n);if(h){o.push(h);break}}if(o.length>=Gb)break}}}return(function(g){if(!g.length)return[];var v=Array.from(g);return v.reverse(),v.slice(0,Gb).map((f=>{return z({},f,{filename:f.filename||(m=v,m[m.length-1]||{}).filename,function:f.function||qi});var m}))})(o)}})("web:javascript",LA,HA)}var zp=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=Oe(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Bl(e,"DOMException")}isDOMError(e){return Bl(e,"DOMError")}},qp=class{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var r=e.message;return r.error&&typeof r.error.message=="string"?String(r.error.message):String(r)}getStack(e){return e.stacktrace||e.stack||void 0}},Zp=class{constructor(){}match(e){return Bl(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var r,i=t.apply(e.error);return i||{type:"ErrorEvent",value:e.message,stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},VA=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Gp=class{match(e){return typeof e=="string"}coerce(e,t){var r,[i,s]=this.getInfos(e);return{type:i??"Error",value:s??e,stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(VA);return i&&(t=i[1],r=i[2]),[t,r]}},WA=["fatal","error","warning","log","info","debug"];function t0(n,e){e===void 0&&(e=40);var t=Object.keys(n);if(t.sort(),!t.length)return"[object has no keys]";for(var r=t.length;r>0;r--){var i=t.slice(0,r).join(", ");if(!(i.length>e))return r===t.length||i.length<=e?i:i.slice(0,e)+"..."}return""}var Kp=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var r,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(r=t.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return F_(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+t0(e)}isSeverityLevel(e){return Oe(e)&&!Fp(e)&&WA.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];if($A(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Yp=class{match(e){return F_(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+t0(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},Xp=class{match(e){return Dp(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},Qp=class{match(e){return Bl(e,"PromiseRejectionEvent")}coerce(e,t){var r,i=this.getUnhandledRejectionReason(e);return Dp(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){if(Dp(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}},n0=function(n,e){var{debugEnabled:t}=e===void 0?{}:e,r={k:function(i){if(C&&(dn.DEBUG||J.POSTHOG_DEBUG||t)&&!j(C.console)&&C.console){for(var s=("__rrweb_original__"in C.console[i])?C.console[i].__rrweb_original__:C.console[i],o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];s(n,...a)}},info:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];r.k("log",...s)},warn:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];r.k("warn",...s)},error:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];r.k("error",...s)},critical:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];console.error(n,...s)},uninitializedWarning:i=>{r.error("You must initialize PostHog before calling "+i)},createLogger:(i,s)=>n0(n+" "+i,s)};return r},U=n0("[PostHog.js]"),Re=U.createLogger,jA=Re("[ExternalScriptsLoader]"),Kb=(n,e,t)=>{if(n.config.disable_external_dependency_loading)return jA.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var r=W?.querySelectorAll("script");if(r){for(var i,s=function(){if(r[o].src===e){var l=r[o];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)})),l.onerror=c=>t(c),{v:void 0})}},o=0;o<r.length;o++)if(i=s())return i.v}var a=()=>{if(!W)return t("document not found");var l=W.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=d=>{l.__posthog_loading_callback_fired=!0,t(void 0,d)},l.onerror=d=>t(d),n.config.prepare_external_dependency_script&&(l=n.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(n.config.external_scripts_inject_target==="head")W.head.appendChild(l);else{var c,u=W.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):W.body.appendChild(l)}};W!=null&&W.body?a():W?.addEventListener("DOMContentLoaded",a)};J.__PosthogExtensions__=J.__PosthogExtensions__||{},J.__PosthogExtensions__.loadExternalDependency=(n,e,t)=>{var r="/static/"+e+".js?v="+n.version;if(e==="remote-config"&&(r="/array/"+n.config.token+"/config.js"),e==="toolbar"){var i=3e5;r=r+"&t="+Math.floor(Date.now()/i)*i}var s=n.requestRouter.endpointFor("assets",r);Kb(n,s,t)},J.__PosthogExtensions__.loadSiteApp=(n,e,t)=>{var r=n.requestRouter.endpointFor("api",e);Kb(n,r,t)};var Wl={};function Zn(n,e,t){if(fe(n)){if(Db&&n.forEach===Db)n.forEach(e,t);else if("length"in n&&n.length===+n.length){for(var r=0,i=n.length;r<i;r++)if(r in n&&e.call(t,n[r],r)===Wl)return}}}function we(n,e,t){if(!ue(n)){if(fe(n))return Zn(n,e,t);if(vA(n)){for(var r of n.entries())if(e.call(t,r[1],r[0])===Wl)return}else for(var i in n)if(L_.call(n,i)&&e.call(t,n[i],i)===Wl)return}}var Ie=function(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return Zn(t,(function(i){for(var s in i)i[s]!==void 0&&(n[s]=i[s])})),n},Gi=function(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return Zn(t,(function(i){Zn(i,(function(s){n.push(s)}))})),n};function Dl(n){for(var e=Object.keys(n),t=e.length,r=new Array(t);t--;)r[t]=[e[t],n[e[t]]];return r}var Yb=function(n){try{return n()}catch{return}},UA=function(n){return function(){try{for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.apply(this,t)}catch(i){U.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),U.critical(i)}}},Xh=function(n){var e={};return we(n,(function(t,r){(Oe(t)&&t.length>0||vn(t))&&(e[r]=t)})),e};function zA(n,e){return t=n,r=s=>Oe(s)&&!Ft(e)?s.slice(0,e):s,i=new Set,(function s(o,a){return o!==Object(o)?r?r(o,a):o:i.has(o)?void 0:(i.add(o),fe(o)?(l=[],Zn(o,(c=>{l.push(s(c))}))):(l={},we(o,((c,u)=>{i.has(c)||(l[u]=s(c,u))}))),l);var l})(t);var t,r,i}var qA=["herokuapp.com","vercel.app","netlify.app"];function ZA(n){var e=n?.hostname;if(!Oe(e))return!1;var t=e.split(".").slice(-2).join(".");for(var r of qA)if(t===r)return!1;return!0}function r0(n,e){for(var t=0;t<n.length;t++)if(e(n[t]))return n[t]}function Me(n,e,t,r){var{capture:i=!1,passive:s=!0}=r??{};n?.addEventListener(e,t,{capture:i,passive:s})}var i0="$people_distinct_id",Ao="__alias",Ro="__timers",Xb="$autocapture_disabled_server_side",Jp="$heatmaps_enabled_server_side",Qb="$exception_capture_enabled_server_side",eh="$error_tracking_suppression_rules",Jb="$error_tracking_capture_extension_exceptions",e_="$web_vitals_enabled_server_side",s0="$dead_clicks_enabled_server_side",t_="$product_tours_enabled_server_side",n_="$web_vitals_allowed_metrics",_p="$session_recording_remote_config",jl="$sesid",o0="$session_is_sampled",Wi="$enabled_feature_flags",To="$early_access_features",th="$feature_flag_details",Io="$stored_person_properties",Hr="$stored_group_properties",nh="$surveys",Ul="$flag_call_reported",pn="$user_state",rh="$client_session_props",ih="$capture_rate_limit",sh="$initial_campaign_params",oh="$initial_referrer_info",zl="$initial_person_info",ql="$epp",a0="__POSTHOG_TOOLBAR__",vo="$posthog_cookieless",GA=[i0,Ao,"__cmpns",Ro,"$session_recording_enabled_server_side",Jp,jl,Wi,eh,pn,To,th,Hr,Io,nh,Ul,rh,ih,sh,oh,ql,zl,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function r_(n){return n instanceof Element&&(n.id===a0||!(n.closest==null||!n.closest(".toolbar-global-fade-container")))}function uc(n){return!!n&&n.nodeType===1}function Gn(n,e){return!!n&&!!n.tagName&&n.tagName.toLowerCase()===e.toLowerCase()}function l0(n){return!!n&&n.nodeType===3}function c0(n){return!!n&&n.nodeType===11}function Qh(n){return n?lc(n).split(/\s+/):[]}function i_(n){var e=C?.location.href;return!!(e&&n&&n.some((t=>e.match(t))))}function Zl(n){var e="";switch(typeof n.className){case"string":e=n.className;break;case"object":e=(n.className&&"baseVal"in n.className?n.className.baseVal:null)||n.getAttribute("class")||"";break;default:e=""}return Qh(e)}function u0(n){return ue(n)?null:lc(n).split(/(\s+)/).filter((e=>Vo(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function jo(n){var e="";return ah(n)&&!g0(n)&&n.childNodes&&n.childNodes.length&&we(n.childNodes,(function(t){var r;l0(t)&&t.textContent&&(e+=(r=u0(t.textContent))!==null&&r!==void 0?r:"")})),lc(e)}function d0(n){return j(n.target)?n.srcElement||null:(e=n.target)!=null&&e.shadowRoot?n.composedPath()[0]||null:n.target||null;var e}var Jh=["a","button","form","input","select","textarea","label"];function p0(n,e){if(j(e))return!0;var t,r=function(s){if(e.some((o=>s.matches(o))))return{v:!0}};for(var i of n)if(t=r(i))return t.v;return!1}function h0(n){var e=n.parentNode;return!(!e||!uc(e))&&e}var KA=["next","previous","prev",">","<"],s_=10,o_=[".ph-no-rageclick",".ph-no-capture"];function YA(n,e){if(!C||ef(n))return!1;var t,r,i;if(mn(e)?(t=!!e&&o_,r=void 0):(t=(i=e?.css_selector_ignorelist)!==null&&i!==void 0?i:o_,r=e?.content_ignorelist),t===!1)return!1;var{targetElementList:s}=f0(n,!1);return!(function(o,a){if(o===!1||j(o))return!1;var l;if(o===!0)l=KA;else{if(!fe(o))return!1;if(o.length>s_)return U.error("[PostHog] content_ignorelist array cannot exceed "+s_+" items. Use css_selector_ignorelist for more complex matching."),!1;l=o.map((c=>c.toLowerCase()))}return a.some((c=>{var{safeText:u,ariaLabel:d}=c;return l.some((h=>u.includes(h)||d.includes(h)))}))})(r,s.map((o=>{var a;return{safeText:jo(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!p0(s,t)}var ef=n=>!n||Gn(n,"html")||!uc(n),f0=(n,e)=>{if(!C||ef(n))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,r=[n],i=n;i.parentNode&&!Gn(i,"body");)if(c0(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var s=h0(i);if(!s)break;if(e||Jh.indexOf(s.tagName.toLowerCase())>-1)t=!0;else{var o=C.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(t=!0)}r.push(s),i=s}return{parentIsUsefulElement:t,targetElementList:r}};function XA(n,e,t,r,i){var s,o,a,l;if(t===void 0&&(t=void 0),!C||ef(n)||(s=t)!=null&&s.url_allowlist&&!i_(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&i_(t.url_ignorelist))return!1;if((a=t)!=null&&a.dom_event_allowlist){var c=t.dom_event_allowlist;if(c&&!c.some((v=>e.type===v)))return!1}var{parentIsUsefulElement:u,targetElementList:d}=f0(n,r);if(!(function(v,f){var m=f?.element_allowlist;if(j(m))return!0;var y,k=function(b){if(m.some((w=>b.tagName.toLowerCase()===w)))return{v:!0}};for(var _ of v)if(y=k(_))return y.v;return!1})(d,t)||!p0(d,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var h=C.getComputedStyle(n);if(h&&h.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var g=n.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(i||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(e.type)>=0;default:return u?(i||["click"]).indexOf(e.type)>=0:(i||["click"]).indexOf(e.type)>=0&&(Jh.indexOf(g)>-1||n.getAttribute("contenteditable")==="true")}}function ah(n){for(var e=n;e.parentNode&&!Gn(e,"body");e=e.parentNode){var t=Zl(e);if(ce(t,"ph-sensitive")||ce(t,"ph-no-capture"))return!1}if(ce(Zl(n),"ph-include"))return!0;var r=n.type||"";if(Oe(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=n.name||n.id||"";return!(Oe(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function g0(n){return!!(Gn(n,"input")&&!["button","checkbox","submit","reset"].includes(n.type)||Gn(n,"select")||Gn(n,"textarea")||n.getAttribute("contenteditable")==="true")}var m0="(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})",QA=new RegExp("^(?:"+m0+")$"),JA=new RegExp(m0),v0="\\d{3}-?\\d{2}-?\\d{4}",eR=new RegExp("^("+v0+")$"),tR=new RegExp("("+v0+")");function Vo(n,e){return e===void 0&&(e=!0),!(ue(n)||Oe(n)&&(n=lc(n),(e?QA:JA).test((n||"").replace(/[- ]/g,""))||(e?eR:tR).test(n)))}function y0(n){var e=jo(n);return Vo(e=(e+" "+b0(n)).trim())?e:""}function b0(n){var e="";return n&&n.childNodes&&n.childNodes.length&&we(n.childNodes,(function(t){var r;if(t&&((r=t.tagName)==null?void 0:r.toLowerCase())==="span")try{var i=jo(t);e=(e+" "+i).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+b0(t)).trim())}catch(s){U.error("[AutoCapture]",s)}})),e}function nR(n){return(function(e){var t=e.map((r=>{var i,s,o="";if(r.tag_name&&(o+=r.tag_name),r.attr_class)for(var a of(r.attr_class.sort(),r.attr_class))o+="."+a.replace(/"/g,"");var l=z({},r.text?{text:r.text}:{},{"nth-child":(i=r.nth_child)!==null&&i!==void 0?i:0,"nth-of-type":(s=r.nth_of_type)!==null&&s!==void 0?s:0},r.href?{href:r.href}:{},r.attr_id?{attr_id:r.attr_id}:{},r.attributes),c={};return Dl(l).sort(((u,d)=>{var[h]=u,[g]=d;return h.localeCompare(g)})).forEach((u=>{var[d,h]=u;return c[a_(d.toString())]=a_(h.toString())})),o+=":",o+=Dl(c).map((u=>{var[d,h]=u;return d+'="'+h+'"'})).join("")}));return t.join(";")})((function(e){return e.map((t=>{var r,i,s={text:(r=t.$el_text)==null?void 0:r.slice(0,400),tag_name:t.tag_name,href:(i=t.attr__href)==null?void 0:i.slice(0,2048),attr_class:rR(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Dl(t).filter((o=>{var[a]=o;return a.indexOf("attr__")===0})).forEach((o=>{var[a,l]=o;return s.attributes[a]=l})),s}))})(n))}function a_(n){return n.replace(/"|\\"/g,'\\"')}function rR(n){var e=n.attr__class;return e?fe(e)?e:Qh(e):void 0}var Gl=class{constructor(e){this.disabled=e===!1;var t=Pe(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&r-i.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}},Kl=n=>{var e=W?.createElement("a");return j(e)?null:(e.href=n,e)},iR=function(n,e){var t,r;e===void 0&&(e="&");var i=[];return we(n,(function(s,o){j(s)||j(o)||o==="undefined"||(t=encodeURIComponent((a=>a instanceof File)(s)?s.name:s.toString()),r=encodeURIComponent(o),i[i.length]=r+"="+t)})),i.join(e)},Yl=function(n,e){for(var t,r=((n.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<r.length;i++){var s=r[i].split("=");if(s[0]===e){t=s;break}}if(!fe(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{U.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Uo=function(n,e,t){if(!n||!e||!e.length)return n;for(var r=n.split("#"),i=r[0]||"",s=r[1],o=i.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),u=[],d=0;d<c.length;d++){var h=c[d].split("=");fe(h)&&(e.includes(h[0])?u.push(h[0]+"="+t):u.push(c[d]))}var g=l;return a!=null&&(g+="?"+u.join("&")),s!=null&&(g+="#"+s),g},Xl=function(n,e){var t=n.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},xp="$copy_autocapture",l_=Re("[AutoCapture]");function wp(n,e){return e.length>n?e.slice(0,n)+"...":e}function sR(n){if(n.previousElementSibling)return n.previousElementSibling;var e=n;do e=e.previousSibling;while(e&&!uc(e));return e}function oR(n,e,t,r){var i=n.tagName.toLowerCase(),s={tag_name:i};Jh.indexOf(i)>-1&&!t&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=wp(1024,y0(n)):s.$el_text=wp(1024,jo(n)));var o=Zl(n);o.length>0&&(s.classes=o.filter((function(u){return u!==""}))),we(n.attributes,(function(u){var d;if((!g0(n)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(r==null||!r.includes(u.name))&&!e&&Vo(u.value)&&(d=u.name,!Oe(d)||d.substring(0,10)!=="_ngcontent"&&d.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=Qh(h).join(" ")),s["attr__"+u.name]=wp(1024,h)}}));for(var a=1,l=1,c=n;c=sR(c);)a++,c.tagName===n.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function aR(n,e){for(var t,r,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[n],u=n;u.parentNode&&!Gn(u,"body");)c0(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var d,h=[],g={},v=!1,f=!1;if(we(c,(b=>{var w=ah(b);b.tagName.toLowerCase()==="a"&&(v=b.getAttribute("href"),v=w&&v&&Vo(v)&&v),ce(Zl(b),"ph-no-capture")&&(f=!0),h.push(oR(b,s,o,a));var E=(function(x){if(!ah(x))return{};var R={};return we(x.attributes,(function(I){if(I.name&&I.name.indexOf("data-ph-capture-attribute")===0){var O=I.name.replace("data-ph-capture-attribute-",""),P=I.value;O&&P&&Vo(P)&&(R[O]=P)}})),R})(b);Ie(g,E)})),f)return{props:{},explicitNoCapture:f};if(o||(n.tagName.toLowerCase()==="a"||n.tagName.toLowerCase()==="button"?h[0].$el_text=y0(n):h[0].$el_text=jo(n)),v){var m,y;h[0].attr__href=v;var k=(m=Kl(v))==null?void 0:m.host,_=C==null||(y=C.location)==null?void 0:y.host;k&&_&&k!==_&&(d=v)}return{props:Ie({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:nR(h)},(t=h[0])!=null&&t.$el_text?{$el_text:(r=h[0])==null?void 0:r.$el_text}:{},d&&i.type==="click"?{$external_click_url:d}:{},g)}}var lh=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Gl(e.config.rageclick),this.C=null}get R(){var e,t,r=Pe(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(e=r.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),r.url_ignorelist=(t=r.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),r}F(){if(this.isBrowserSupported()){if(C&&W){var e=r=>{r=r||C?.event;try{this.O(r)}catch(i){l_.error("Failed to capture event",i)}};if(Me(W,"submit",e,{capture:!0}),Me(W,"change",e,{capture:!0}),Me(W,"click",e,{capture:!0}),this.R.capture_copied_text){var t=r=>{r=r||C?.event,this.O(r,xp)};Me(W,"copy",t,{capture:!0}),Me(W,"cut",t,{capture:!0})}}}else l_.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Xb]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,r=[];return(t=this.C)==null||t.forEach((i=>{var s=W?.querySelectorAll(i);s?.forEach((o=>{e===o&&r.push(i)}))})),r}get isEnabled(){var e,t,r=(e=this.instance.persistence)==null?void 0:e.props[Xb],i=this.T;if(Ft(i)&&!mn(r)&&!this.instance.M())return!1;var s=(t=this.T)!==null&&t!==void 0?t:!!r;return!!this.instance.config.autocapture&&!s}O(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var r,i=d0(e);l0(i)&&(i=i.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&YA(i,this.instance.config.rageclick)&&this.O(e,"$rageclick");var s=t===xp;if(i&&XA(i,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=aR(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(a)return!1;var l=this.getElementSelectors(i);if(l&&l.length>0&&(o.$element_selectors=l),t===xp){var c,u=u0(C==null||(c=C.getSelection())==null?void 0:c.toString()),d=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=d}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return qn(W?.querySelectorAll)}};Math.trunc||(Math.trunc=function(n){return n<0?Math.ceil(n):Math.floor(n)}),Number.isInteger||(Number.isInteger=function(n){return vn(n)&&isFinite(n)&&Math.floor(n)===n});var c_="0123456789abcdef",ch=class n{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||e<0||t<0||r<0||i<0||e>0xffffffffffff||t>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new n(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+c_.charAt(this.bytes[t]>>>4)+c_.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new n(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var r=this.bytes[t]-e.bytes[t];if(r!==0)return Math.sign(r)}return 0}},uh=class{constructor(){this.A=0,this.j=0,this.D=new dh}generate(){var e=this.generateOrAbort();if(j(e)){this.A=0;var t=this.generateOrAbort();if(j(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.j++,this.j>4398046511103&&(this.A++,this.L())}return ch.fromFieldsV7(this.A,Math.trunc(this.j/Math.pow(2,30)),this.j&Math.pow(2,30)-1,this.D.nextUint32())}L(){this.j=1024*this.D.nextUint32()+(1023&this.D.nextUint32())}},u_,_0=n=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<n.length;e++)n[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return n};C&&!j(C.crypto)&&crypto.getRandomValues&&(_0=n=>crypto.getRandomValues(n));var dh=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(_0(this.N),this.U=0),this.N[this.U++]}},zn=()=>lR().toString(),lR=()=>(u_||(u_=new uh)).generate(),yo="",cR=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function uR(n,e){if(e){var t=(function(i,s){if(s===void 0&&(s=W),yo)return yo;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+zn();!yo&&a--;){var c=o.slice(a).join("."),u=l+"=1;domain=."+c+";path=/";s.cookie=u+";max-age=3",s.cookie.includes(l)&&(s.cookie=u+";max-age=0",yo=c)}return yo})(n);if(!t){var r=(i=>{var s=i.match(cR);return s?s[0]:""})(n);r!==t&&U.info("Warning: cookie subdomain discovery mismatch",r,t),t=r}return t?"; domain=."+t:""}return""}var qt={H:()=>!!W,B:function(n){U.error("cookieStore error: "+n)},q:function(n){if(W){try{for(var e=n+"=",t=W.cookie.split(";").filter((s=>s.length)),r=0;r<t.length;r++){for(var i=t[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}},W:function(n){var e;try{e=JSON.parse(qt.q(n))||{}}catch{}return e},G:function(n,e,t,r,i){if(W)try{var s="",o="",a=uR(W.location.hostname,r);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),s="; expires="+l.toUTCString()}i&&(o="; secure");var c=n+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&U.warn("cookieStore warning: large cookie, len="+c.length),W.cookie=c,c}catch{return}},V:function(n,e){if(W!=null&&W.cookie)try{qt.G(n,"",-1,e)}catch{return}}},kp=null,Ce={H:function(){if(!Ft(kp))return kp;var n=!0;if(j(C))n=!1;else try{var e="__mplssupport__";Ce.G(e,"xyz"),Ce.q(e)!=='"xyz"'&&(n=!1),Ce.V(e)}catch{n=!1}return n||U.error("localStorage unsupported; falling back to cookie store"),kp=n,n},B:function(n){U.error("localStorage error: "+n)},q:function(n){try{return C?.localStorage.getItem(n)}catch(e){Ce.B(e)}return null},W:function(n){try{return JSON.parse(Ce.q(n))||{}}catch{}return null},G:function(n,e){try{C?.localStorage.setItem(n,JSON.stringify(e))}catch(t){Ce.B(t)}},V:function(n){try{C?.localStorage.removeItem(n)}catch(e){Ce.B(e)}}},dR=["$device_id","distinct_id",jl,o0,ql,zl],Ol={},pR={H:function(){return!0},B:function(n){U.error("memoryStorage error: "+n)},q:function(n){return Ol[n]||null},W:function(n){return Ol[n]||null},G:function(n,e){Ol[n]=e},V:function(n){delete Ol[n]}},Fr=null,We={H:function(){if(!Ft(Fr))return Fr;if(Fr=!0,j(C))Fr=!1;else try{var n="__support__";We.G(n,"xyz"),We.q(n)!=='"xyz"'&&(Fr=!1),We.V(n)}catch{Fr=!1}return Fr},B:function(n){U.error("sessionStorage error: ",n)},q:function(n){try{return C?.sessionStorage.getItem(n)}catch(e){We.B(e)}return null},W:function(n){try{return JSON.parse(We.q(n))||null}catch{}return null},G:function(n,e){try{C?.sessionStorage.setItem(n,JSON.stringify(e))}catch(t){We.B(t)}},V:function(n){try{C?.sessionStorage.removeItem(n)}catch(e){We.B(e)}}},hn=(function(n){return n[n.PENDING=-1]="PENDING",n[n.DENIED=0]="DENIED",n[n.GRANTED=1]="GRANTED",n})({}),ph=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?hn.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===hn.DENIED||this.consent===hn.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===hn.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:r}=this._instance.config;return r||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return vp(e)?hn.GRANTED:ce(_A,e)?hn.DENIED:hn.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?Ce:qt;var t=e==="localStorage"?qt:Ce;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(vp(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!r0([pt?.doNotTrack,pt?.msDoNotTrack,J.doNotTrack],(e=>vp(e)))}},Nl=Re("[Dead Clicks]"),hR=()=>!0,fR=n=>{var e,t=!((e=n.instance.persistence)==null||!e.get_property(s0)),r=n.instance.config.capture_dead_clicks;return mn(r)?r:!!Pe(r)||t},Ql=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[s0]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,r;(t=J.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Nl.error("failed to load script",i):e()}))}et(){var e;if(W){if(!this.tt&&(e=J.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=Pe(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=J.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(W),Nl.info("starting...")}}else Nl.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Nl.info("stopping..."))}},bo=Re("[ExceptionAutocapture]"),hh=class{constructor(e){var t,r,i;this.rt=()=>{var s;if(C&&this.isEnabled&&(s=J.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=J.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=J.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=J.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=o(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=a(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=l(this.captureException.bind(this)))}catch(c){bo.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[Qb]),this.dt=new Hp({refillRate:(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10,refillInterval:1e4,h:bo}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Pe(e)?t=z({},t,e):(j(e)?this.ht:e)&&(t=z({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(bo.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,r;(t=J.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return bo.error("failed to load script",i);e()}))}ut(){var e,t,r;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(r=this.ot)==null||r.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[Qb]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var t,r,i=(t=e==null||(r=e.$exception_list)==null||(r=r[0])==null?void 0:r.type)!==null&&t!==void 0?t:"Exception";this.dt.consumeRateLimit(i)?bo.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}};function d_(n,e,t){try{if(!(e in n))return()=>{};var r=n[e],i=t(r);return qn(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),n[e]=i,()=>{n[e]=r}}catch{return()=>{}}}var fh=class{constructor(e){var t;this._instance=e,this.ct=(C==null||(t=C.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(U.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,U.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(C&&C.history){var r=this;(e=C.history.pushState)!=null&&e.__posthog_wrapped__||d_(C.history,"pushState",(i=>function(s,o,a){i.call(this,s,o,a),r._t("pushState")})),(t=C.history.replaceState)!=null&&t.__posthog_wrapped__||d_(C.history,"replaceState",(i=>function(s,o,a){i.call(this,s,o,a),r._t("replaceState")})),this.bt()}}_t(e){try{var t,r=C==null||(t=C.location)==null?void 0:t.pathname;if(!r)return;r!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=r}catch(i){U.error("Error capturing "+e+" pageview",i)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};Me(C,"popstate",e),this.ft=()=>{C&&C.removeEventListener("popstate",e)}}}},Sp=Re("[SegmentIntegration]");function gR(n,e){var t=n.config.segment;if(!t)return e();(function(r,i){var s=r.config.segment;if(!s)return i();var o=l=>{var c=()=>l.anonymousId()||zn();r.config.get_device_id=c,l.id()&&(r.register({distinct_id:l.id(),$device_id:c()}),r.persistence.set_property(pn,"identified")),i()},a=s.user();"then"in a&&qn(a.then)?a.then(o):o(a)})(n,(()=>{t.register((r=>{Promise&&Promise.resolve||Sp.warn("This browser does not have Promise support, and can not use the segment integration");var i=(s,o)=>{if(!o)return s;s.event.userId||s.event.anonymousId===r.get_distinct_id()||(Sp.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(Sp.info("UserId set, identifying with PostHog"),r.identify(s.event.userId));var a=r.calculateEventProperties(o,s.event.properties);return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:s=>i(s,s.event.event),page:s=>i(s,"$pageview"),identify:s=>i(s,"$identify"),screen:s=>i(s,"$screen")}})(n)).then((()=>{e()}))}))}var x0="posthog-js";function w0(n,e){var{organization:t,projectId:r,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,u,d,h;if(!(s==="*"||s.includes(a.level))||!n.__loaded)return a;a.tags||(a.tags={});var g=n.requestRouter.endpointFor("ui","/project/"+n.config.token+"/person/"+n.get_distinct_id());a.tags["PostHog Person URL"]=g,n.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=n.get_session_replay_url({withTimestamp:!0}));var v=((l=a.exception)==null?void 0:l.values)||[],f=v.map((y=>z({},y,{stacktrace:y.stacktrace?z({},y.stacktrace,{type:"raw",frames:(y.stacktrace.frames||[]).map((k=>z({},k,{platform:"web:javascript"})))}):void 0}))),m={$exception_message:((c=v[0])==null?void 0:c.value)||a.message,$exception_type:(u=v[0])==null?void 0:u.type,$exception_level:a.level,$exception_list:f,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((d=v[0])==null?void 0:d.value)||a.message,$sentry_exception_type:(h=v[0])==null?void 0:h.type,$sentry_tags:a.tags};return t&&r&&(m.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),o&&n.exceptions.sendExceptionEvent(m),a}}var gh=class{constructor(e,t,r,i,s,o){this.name=x0,this.setupOnce=function(a){a(w0(e,{organization:t,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},mR=C!=null&&C.location?Xl(C.location.hash,"__posthog")||Xl(location.hash,"state"):null,p_="_postHogToolbarParams",h_=Re("[Toolbar]"),Un=(function(n){return n[n.UNINITIALIZED=0]="UNINITIALIZED",n[n.LOADING=1]="LOADING",n[n.LOADED=2]="LOADED",n})(Un||{}),mh=class{constructor(e){this.instance=e}yt(e){J.ph_toolbar_state=e}wt(){var e;return(e=J.ph_toolbar_state)!==null&&e!==void 0?e:Un.UNINITIALIZED}maybeLoadToolbar(e,t,r){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),r===void 0&&(r=void 0),!C||!W)return!1;e=e??C.location,r=r??C.history;try{if(!t){try{C.localStorage.setItem("test","test"),C.localStorage.removeItem("test")}catch{return!1}t=C?.localStorage}var i,s=mR||Xl(e.hash,"__posthog")||Xl(e.hash,"state"),o=s?Yb((()=>JSON.parse(atob(decodeURIComponent(s)))))||Yb((()=>JSON.parse(decodeURIComponent(s)))):null;return o&&o.action==="ph_authorize"?((i=o).source="url",i&&Object.keys(i).length>0&&(o.desiredHash?e.hash=o.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(p_)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}xt(e){var t=J.ph_load_toolbar||J.ph_load_editor;!ue(t)&&qn(t)?t(e,this.instance):h_.warn("No toolbar load function found")}loadToolbar(e){var t=!(W==null||!W.getElementById(a0));if(!C||t)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=z({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(C.localStorage.setItem(p_,JSON.stringify(z({},i,{source:void 0}))),this.wt()===Un.LOADED)this.xt(i);else if(this.wt()===Un.UNINITIALIZED){var s;this.yt(Un.LOADING),(s=J.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return h_.error("[Toolbar] Failed to load",o),void this.yt(Un.UNINITIALIZED);this.yt(Un.LOADED),this.xt(i)})),Me(C,"turbolinks:load",(()=>{this.yt(Un.UNINITIALIZED),this.loadToolbar(i)}))}return!0}Et(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(e,t,r)}},vR=Re("[TracingHeaders]"),vh=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,r;j(this.$t)&&((t=J.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),j(this.St)&&((r=J.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null||r._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,r;(t=J.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return vR.error("failed to load script",i);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.$t)==null||e.call(this),(t=this.St)==null||t.call(this),this.$t=void 0,this.St=void 0)}},Ll="https?://(.*)",Ki=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],yR=Gi(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Ki),zo="<masked>",bR=["li_fat_id"];function k0(n,e,t){if(!W)return{};var r,i=e?Gi([],Ki,t||[]):[],s=S0(Uo(W.URL,i,zo),n),o=(r={},we(bR,(function(a){var l=qt.q(a);r[a]=l||null})),r);return Ie(o,s)}function S0(n,e){var t=yR.concat(e||[]),r={};return we(t,(function(i){var s=Yl(n,i);r[i]=s||null})),r}function E0(n){var e=(function(s){return s?s.search(Ll+"google.([^/?]*)")===0?"google":s.search(Ll+"bing.com")===0?"bing":s.search(Ll+"yahoo.com")===0?"yahoo":s.search(Ll+"duckduckgo.com")===0?"duckduckgo":null:null})(n),t=e!="yahoo"?"q":"p",r={};if(!Ft(e)){r.$search_engine=e;var i=W?Yl(W.referrer,t):"";i.length&&(r.ph_keyword=i)}return r}function f_(){return navigator.language||navigator.userLanguage}function C0(){return W?.referrer||"$direct"}function A0(n,e){var t=n?Gi([],Ki,e||[]):[],r=je?.href.substring(0,1e3);return{r:C0().substring(0,1e3),u:r?Uo(r,t,zo):void 0}}function R0(n){var e,{r:t,u:r}=n,i={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Kl(t))==null?void 0:e.host};if(r){i.$current_url=r;var s=Kl(r);i.$host=s?.host,i.$pathname=s?.pathname;var o=S0(r);Ie(i,o)}if(t){var a=E0(t);Ie(i,a)}return i}function T0(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function _R(){try{return new Date().getTimezoneOffset()}catch{return}}function xR(n,e){if(!st)return{};var t,r,i,s=n?Gi([],Ki,e||[]):[],[o,a]=(function(l){for(var c=0;c<zb.length;c++){var[u,d]=zb[c],h=u.exec(l),g=h&&(qn(d)?d(h,l):d);if(g)return g}return["",""]})(st);return Ie(Xh({$os:o,$os_version:a,$browser:J_(st,navigator.vendor),$device:qb(st),$device_type:(r=st,i=qb(r),i===H_||i===D_||i==="Kobo"||i==="Kindle Fire"||i===Q_?Fo:i===Ho||i===Ui||i===Bo||i===Vp?"Console":i===V_?"Wearable":i?St:"Desktop"),$timezone:T0(),$timezone_offset:_R()}),{$current_url:Uo(je?.href,s,zo),$host:je?.host,$pathname:je?.pathname,$raw_user_agent:st.length>1e3?st.substring(0,997)+"...":st,$browser_version:IA(st,navigator.vendor),$browser_language:f_(),$browser_language_prefix:(t=f_(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:C?.screen.height,$screen_width:C?.screen.width,$viewport_height:C?.innerHeight,$viewport_width:C?.innerWidth,$lib:"web",$lib_version:dn.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Vn=Re("[Web Vitals]"),g_=9e5,yh=class{constructor(e){var t;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((r,i)=>z({},r,{["$web_vitals_"+i.name+"_event"]:z({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=r=>{var i,s=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0);if(j(s))Vn.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ct();j(o)||(ue(r?.name)||ue(r?.value)?Vn.error("Invalid metric received",r):this.Rt&&r.value>=this.Rt?Vn.error("Ignoring metric with value >= "+this.Rt,r):(this.N.url!==o&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),j(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=j(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.N.metrics.push(z({},r,{$current_url:o,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{if(!this.P){var r,i,s,o,a=J.__PosthogExtensions__;j(a)||j(a.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:i,onFCP:s,onINP:o}=a.postHogWebVitalsCallbacks),r&&i&&s&&o?(this.allowedMetrics.indexOf("LCP")>-1&&r(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.It.bind(this)),this.P=!0):Vn.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[e_]),this.startIfEnabled()}get allowedMetrics(){var e,t,r=Pe(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return ue(r)?((t=this._instance.persistence)==null?void 0:t.props[n_])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Pe(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Pe(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=Pe(this._instance.config.capture_performance)&&vn(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:g_;return 0<e&&e<=6e4?g_:e}get isEnabled(){var e=je?.protocol;if(e!=="http:"&&e!=="https:")return Vn.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Pe(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:mn(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return mn(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Vn.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=Pe(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=Pe(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[e_]:t}),this._instance.persistence.register({[n_]:r})),this.kt=t,this.startIfEnabled()}it(e){var t,r;if((t=J.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var i=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,i,(s=>{s?Vn.error("failed to load script",s):e()}))}}Ct(){var e=C?C.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties,i=t?Gi([],Ki,r||[]):[];return Uo(e,i,zo)}Vn.error("Could not determine current URL")}},wR=Re("[Heatmaps]");function m_(n){return Pe(n)&&"clientX"in n&&"clientY"in n&&vn(n.clientX)&&vn(n.clientY)}var bh=class{constructor(e){var t;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!((t=this.instance.persistence)==null||!t.props[Jp]),this.rageclicks=new Gl(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return Pe(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return ue(this.instance.config.capture_heatmaps)?ue(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;wR.info("starting..."),this.Ot(),this.Mt()}else{var e;clearInterval((e=this.Ft)!==null&&e!==void 0?e:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Jp]:t}),this.kt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}jt(e){this.Dt(e.originalEvent,"deadclick")}Mt(){this.Ft&&clearInterval(this.Ft),this.Ft=(function(e){return e?.visibilityState==="visible"})(W)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){C&&W&&(this.Nt=this.Lt.bind(this),Me(C,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||C?.event),Me(W,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||C?.event),Me(W,"mousemove",this.zt,{capture:!0}),this.Bt=new Ql(this.instance,hR,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),Me(W,"visibilitychange",this.qt),this.P=!0)}At(){var e;C&&W&&(this.Nt&&C.removeEventListener("beforeunload",this.Nt),this.Ut&&W.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&W.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&W.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),(e=this.Bt)==null||e.stop(),this.P=!1)}Gt(e,t){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=(function(a,l,c){for(var u=a;u&&uc(u)&&!Gn(u,"body");){if(u===c)return!1;if(ce(l,C?.getComputedStyle(u).position))return!0;u=h0(u)}return!1})(d0(e),["fixed","sticky"],s);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:r),target_fixed:o,type:t}}Dt(e,t){var r;if(t===void 0&&(t="click"),!r_(e.target)&&m_(e)){var i=this.Gt(e,t);(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(z({},i,{type:"rageclick"})),this.Vt(i)}}Ht(e){!r_(e.target)&&m_(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>{this.Vt(this.Gt(e,"mousemove"))}),500))}Vt(e){if(C){var t=C.location.href,r=this.instance.config.mask_personal_data_properties,i=this.instance.config.custom_personal_data_properties,s=r?Gi([],Ki,i||[]):[],o=Uo(t,s,zo);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!Vi(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},Jl=class{constructor(e){this.Jt=(t,r,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(U.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Yt()}Yt(){var e;this.Xt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Jt)}destroy(){var e;(e=this.Xt)==null||e.call(this),this.Xt=void 0}doPageView(e,t){var r,i=this.Qt(e,t);return this.Kt={pathname:(r=C?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this.Qt(e,(t=this.Kt)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Kt)==null?void 0:e.pageViewId}}Qt(e,t){var r=this.Kt;if(!r)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:d}=s;if(!(j(o)||j(a)||j(l)||j(c)||j(u)||j(d))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d);var h=o<=1?1:Zt(a/o,0,1,U),g=o<=1?1:Zt(l/o,0,1,U),v=c<=1?1:Zt(u/c,0,1,U),f=c<=1?1:Zt(d/c,0,1,U);i=Ie(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:g,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:f})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}};var fn=(function(n){return n.GZipJS="gzip-js",n.Base64="base64",n})({}),Et=Uint8Array,et=Uint16Array,Zi=Uint32Array,tf=new Et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),nf=new Et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),v_=new Et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),I0=function(n,e){for(var t=new et(31),r=0;r<31;++r)t[r]=e+=1<<n[r-1];var i=new Zi(t[30]);for(r=1;r<30;++r)for(var s=t[r];s<t[r+1];++s)i[s]=s-t[r]<<5|r;return[t,i]},$0=I0(tf,2),kR=$0[0],_h=$0[1];kR[28]=258,_h[258]=28;for(xh=I0(nf,0)[1],ec=new et(32768),ke=0;ke<32768;++ke)Wn=(43690&ke)>>>1|(21845&ke)<<1,Wn=(61680&(Wn=(52428&Wn)>>>2|(13107&Wn)<<2))>>>4|(3855&Wn)<<4,ec[ke]=((65280&Wn)>>>8|(255&Wn)<<8)>>>1;var Wn,xh,ec,ke,Oo=function(n,e,t){for(var r=n.length,i=0,s=new et(e);i<r;++i)++s[n[i]-1];var o,a=new et(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;if(t){o=new et(1<<e);var l=15-e;for(i=0;i<r;++i)if(n[i])for(var c=i<<4|n[i],u=e-n[i],d=a[n[i]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)o[ec[d]>>>l]=c}else for(o=new et(r),i=0;i<r;++i)o[i]=ec[a[n[i]-1]++]>>>15-n[i];return o},Vr=new Et(288);for(ke=0;ke<144;++ke)Vr[ke]=8;for(ke=144;ke<256;++ke)Vr[ke]=9;for(ke=256;ke<280;++ke)Vr[ke]=7;for(ke=280;ke<288;++ke)Vr[ke]=8;var tc=new Et(32);for(ke=0;ke<32;++ke)tc[ke]=5;var SR=Oo(Vr,9,0),ER=Oo(tc,5,0),M0=function(n){return(n/8>>0)+(7&n&&1)},P0=function(n,e,t){(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof et?et:n instanceof Zi?Zi:Et)(t-e);return r.set(n.subarray(e,t)),r},cn=function(n,e,t){t<<=7&e;var r=e/8>>0;n[r]|=t,n[r+1]|=t>>>8},_o=function(n,e,t){t<<=7&e;var r=e/8>>0;n[r]|=t,n[r+1]|=t>>>8,n[r+2]|=t>>>16},Ep=function(n,e){for(var t=[],r=0;r<n.length;++r)n[r]&&t.push({s:r,f:n[r]});var i=t.length,s=t.slice();if(!i)return[new Et(0),0];if(i==1){var o=new Et(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(w,E){return w.f-E.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,u=1,d=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=t[t[c].f<t[d].f?c++:d++],l=t[c!=u&&t[c].f<t[d].f?c++:d++],t[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=s[0].s;for(r=1;r<i;++r)s[r].s>h&&(h=s[r].s);var g=new et(h+1),v=wh(t[u-1],g,0);if(v>e){r=0;var f=0,m=v-e,y=1<<m;for(s.sort((function(w,E){return g[E.s]-g[w.s]||w.f-E.f}));r<i;++r){var k=s[r].s;if(!(g[k]>e))break;f+=y-(1<<v-g[k]),g[k]=e}for(f>>>=m;f>0;){var _=s[r].s;g[_]<e?f-=1<<e-g[_]++-1:++r}for(;r>=0&&f;--r){var b=s[r].s;g[b]==e&&(--g[b],++f)}v=e}return[new Et(g),v]},wh=function(n,e,t){return n.s==-1?Math.max(wh(n.l,e,t+1),wh(n.r,e,t+1)):e[n.s]=t},y_=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new et(++e),r=0,i=n[0],s=1,o=function(l){t[r++]=l},a=1;a<=e;++a)if(n[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=n[a]}return[t.subarray(0,r),e]},xo=function(n,e){for(var t=0,r=0;r<e.length;++r)t+=n[r]*e[r];return t},kh=function(n,e,t){var r=t.length,i=M0(e+2);n[i]=255&r,n[i+1]=r>>>8,n[i+2]=255^n[i],n[i+3]=255^n[i+1];for(var s=0;s<r;++s)n[i+s+4]=t[s];return 8*(i+4+r)},b_=function(n,e,t,r,i,s,o,a,l,c,u){cn(e,u++,t),++i[256];for(var d=Ep(i,15),h=d[0],g=d[1],v=Ep(s,15),f=v[0],m=v[1],y=y_(h),k=y[0],_=y[1],b=y_(f),w=b[0],E=b[1],x=new et(19),R=0;R<k.length;++R)x[31&k[R]]++;for(R=0;R<w.length;++R)x[31&w[R]]++;for(var I=Ep(x,7),O=I[0],P=I[1],G=19;G>4&&!O[v_[G-1]];--G);var L,F,Z,A,H=c+5<<3,M=xo(i,Vr)+xo(s,tc)+o,V=xo(i,h)+xo(s,f)+o+14+3*G+xo(x,O)+(2*x[16]+3*x[17]+7*x[18]);if(H<=M&&H<=V)return kh(e,u,n.subarray(l,l+c));if(cn(e,u,1+(V<M)),u+=2,V<M){L=Oo(h,g,0),F=h,Z=Oo(f,m,0),A=f;var de=Oo(O,P,0);for(cn(e,u,_-257),cn(e,u+5,E-1),cn(e,u+10,G-4),u+=14,R=0;R<G;++R)cn(e,u+3*R,O[v_[R]]);u+=3*G;for(var tt=[k,w],ge=0;ge<2;++ge){var Fe=tt[ge];for(R=0;R<Fe.length;++R){var ze=31&Fe[R];cn(e,u,de[ze]),u+=O[ze],ze>15&&(cn(e,u,Fe[R]>>>5&127),u+=Fe[R]>>>12)}}}else L=SR,F=Vr,Z=ER,A=tc;for(R=0;R<a;++R)if(r[R]>255){ze=r[R]>>>18&31,_o(e,u,L[ze+257]),u+=F[ze+257],ze>7&&(cn(e,u,r[R]>>>23&31),u+=tf[ze]);var yn=31&r[R];_o(e,u,Z[yn]),u+=A[yn],yn>3&&(_o(e,u,r[R]>>>5&8191),u+=nf[yn])}else _o(e,u,L[r[R]]),u+=F[r[R]];return _o(e,u,L[256]),u+F[256]},CR=new Zi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),AR=(function(){for(var n=new Zi(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(1&t&&3988292384)^t>>>1;n[e]=t}return n})(),RR=function(n,e,t,r,i){return(function(s,o,a,l,c,u){var d=s.length,h=new Et(l+d+5*(1+Math.floor(d/7e3))+c),g=h.subarray(l,h.length-c),v=0;if(!o||d<8)for(var f=0;f<=d;f+=65535){var m=f+65535;m<d?v=kh(g,v,s.subarray(f,m)):(g[f]=u,v=kh(g,v,s.subarray(f,d)))}else{for(var y=CR[o-1],k=y>>>13,_=8191&y,b=(1<<a)-1,w=new et(32768),E=new et(b+1),x=Math.ceil(a/3),R=2*x,I=function(hc){return(s[hc]^s[hc+1]<<x^s[hc+2]<<R)&b},O=new Zi(25e3),P=new et(288),G=new et(32),L=0,F=0,Z=(f=0,0),A=0,H=0;f<d;++f){var M=I(f),V=32767&f,de=E[M];if(w[V]=de,E[M]=V,A<=f){var tt=d-f;if((L>7e3||Z>24576)&&tt>423){v=b_(s,g,0,O,P,G,F,Z,H,f-H,v),Z=L=F=0,H=f;for(var ge=0;ge<286;++ge)P[ge]=0;for(ge=0;ge<30;++ge)G[ge]=0}var Fe=2,ze=0,yn=_,ht=V-de&32767;if(tt>2&&M==I(f-ht))for(var $e=Math.min(k,tt)-1,dc=Math.min(32767,f),Z0=Math.min(258,tt);ht<=dc&&--yn&&V!=de;){if(s[f+Fe]==s[f+Fe-ht]){for(var bn=0;bn<Z0&&s[f+bn]==s[f+bn-ht];++bn);if(bn>Fe){if(Fe=bn,ze=ht,bn>$e)break;var G0=Math.min(ht,bn-2),uf=0;for(ge=0;ge<G0;++ge){var pc=f-ht+ge+32768&32767,df=pc-w[pc]+32768&32767;df>uf&&(uf=df,de=pc)}}}ht+=(V=de)-(de=w[V])+32768&32767}if(ze){O[Z++]=268435456|_h[Fe]<<18|xh[ze];var pf=31&_h[Fe],hf=31&xh[ze];F+=tf[pf]+nf[hf],++P[257+pf],++G[hf],A=f+Fe,++L}else O[Z++]=s[f],++P[s[f]]}}v=b_(s,g,u,O,P,G,F,Z,H,f-H,v)}return P0(h,0,l+M0(v)+c)})(n,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+e.mem,t,r,!0)},Cp=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8};function TR(n,e){e===void 0&&(e={});var t=(function(){var a=4294967295;return{p:function(l){for(var c=a,u=0;u<l.length;++u)c=AR[255&c^l[u]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),r=n.length;t.p(n);var i,s=RR(n,e,10+((i=e).filename&&i.filename.length+1||0),8),o=s.length;return(function(a,l){var c=l.filename;if(a[0]=31,a[1]=139,a[2]=8,a[8]=l.level<2?4:l.level==9?2:0,a[9]=3,l.mtime!=0&&Cp(a,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),c){a[3]=8;for(var u=0;u<=c.length;++u)a[u+10]=c.charCodeAt(u)}})(s,e),Cp(s,o-8,t.d()),Cp(s,o-4,r),s}var IR=function(n){var e,t,r,i,s="";for(e=t=0,r=(n=(n+"").replace(/\r\n/g,`
|
|
1159
|
+
`,t=document.createElement("style");t.setAttribute("data-syntro","base-overlay"),t.textContent=e,n.appendChild(t),Ay=!0}var Ed=async(n={})=>{if(typeof window>"u"||typeof document>"u")throw new Error("SmartCanvas can only be created in a browser-like environment");let e=null;if(n.antiFlicker){let m=typeof n.antiFlicker=="object"?n.antiFlicker:{};e=ky(m)}let t=null,r=null,i=null,{runtime:s}=n;async function o(m){!s?.actions||m.length===0||(i?.isApplied()&&await i.revertAll(),i=await s.actions.applyBatch(m))}async function a(){i?.isApplied()&&(await i.revertAll(),i=null)}if(n.fetcher)try{r=n.fetcher,console.log("[SmartCanvas] Fetching initial config...");let m=await n.fetcher();t=m,console.log("[SmartCanvas] Config fetched:",`tiles=${m.tiles?.length??0},`,`actions=${m.actions?.length??0},`,`theme=${m.theme?.mode??"default"}`),m.actions?.length&&console.log("[SmartCanvas] Actions to apply:",m.actions.map((y,k)=>`[${k}] ${y.kind}${y.anchorId?` anchor="${y.anchorId.selector}"`:""}${y.label?` "${y.label}"`:""}`).join(", ")),m.actions&&m.actions.length>0&&s?.actions&&(await o(m.actions),console.log("[SmartCanvas] Initial actions applied successfully")),m.tiles&&s?.accumulator&&fi(m.tiles,s.accumulator,m.actions)}catch(m){console.error("[SmartCanvas] Error fetching/applying initial config:",m)}e&&e();let l=al();Ua();let c=document.createElement("smart-canvas");if(n.tokens)for(let[m,y]of Object.entries(n.tokens))c.style.setProperty(m,y);let u=n.integrations?.experiments,d=n.integrations?.telemetry,h=n.fetcher??hi({configUri:n.configUri,experiments:u,featureKey:n.configUriFeatureKey,credentials:n.fetchCredentials});r||(r=h);let g={fetcher:h,configUri:n.configUri,configUriFeatureKey:n.configUriFeatureKey,fetchCredentials:n.fetchCredentials,experiments:u,telemetry:d,runtime:s,initialBatchHandle:i,workspaceTheme:n.workspaceTheme};c.mountLitApp(g),n.defaultOpen&&c.open();let v=()=>{let m=n.target??document.body;if(m){m.appendChild(c);let y=c.getOverlayContainer();y&&Ry(y)}};document.body?v():document.addEventListener("DOMContentLoaded",v,{once:!0}),(l||n.editorUrl)&&(console.log(`[SmartCanvas] Loading editor SDK for ${l??"config"} mode`),Cy(n.editorUrl).catch(console.error));let f={el:c,open:()=>c.open(),close:()=>c.close(),destroy:()=>{a(),c.remove()},setTokens:m=>{for(let[y,k]of Object.entries(m))c.style.setProperty(y,k)},getConfig:async()=>{if(r)try{let m=await r();return t=m,m}catch(m){console.error("[SmartCanvas] Error fetching config:",m)}return t??{tiles:[],actions:[],fetchedAt:""}},setEnabled:async m=>{m?t&&await o(t.actions):await a()},setOverrideFetcher:m=>{r=m,c.setOverrideFetcher(m),s?.accumulator&&m().then(y=>{y?.tiles&&fi(y.tiles,s.accumulator,y.actions)}).catch(()=>{})},registerTelemetryProperties:m=>{d?.register?.(m)},getSessionId:()=>d?.getSessionId?.(),startSessionRecording:()=>{d?.startSessionRecording?.()},track:(m,y)=>d?.track?(d.track(m,y),!0):!1,runtime:s};if(typeof window<"u"){let m=window.SynOS;m&&(m.handle=f)}return f};typeof window<"u"&&(window.SmartCanvas={async create(n){return Ed(n)}});var Cd="syn_";function no(n){if(!n.startsWith(Cd))throw new Error("Invalid Syntro token: must start with 'syn_'");let t=n.slice(Cd.length).replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),i=JSON.parse(r);if(i.v!==1)throw new Error(`Unsupported token version: ${i.v}`);return i}function Ad(n){let e=JSON.stringify(n),t=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return Cd+t}function wt(n){if(typeof process<"u"&&process.env)return process.env[n];if(typeof import.meta.env<"u"&&import.meta.env)return import.meta.env[n]}var $y="syntro_segment_attributes";function My(){if(typeof window>"u")return{};try{let n=localStorage.getItem($y);if(n){let e=JSON.parse(n);return K("Syntro Bootstrap","Loaded cached segment attributes:",e),e}}catch(n){Qe("Syntro Bootstrap","Failed to load cached segment attributes:",n)}return{}}function Py(n){if(!(typeof window>"u"))try{localStorage.setItem($y,JSON.stringify(n)),K("Syntro Bootstrap","Cached segment attributes:",n)}catch(e){Qe("Syntro Bootstrap","Failed to cache segment attributes:",e)}}function Oy(n){if(!n)return{};let e={};for(let[t,r]of Object.entries(n))t.startsWith("in_segment_")&&(e[t]=r===!0);return e}function Rd(){if(typeof window>"u")return{};let n={};try{let e=new URLSearchParams(window.location.search);for(let t of["utm_source","utm_medium","utm_campaign","utm_content","utm_term"]){let r=e.get(t);r&&(n[t]=r)}}catch{}try{navigator.language&&(n.browser_language=navigator.language),navigator.languages?.length&&(n.browser_languages=[...navigator.languages])}catch{}try{let e=window.innerWidth;n.device_type=e<768?"mobile":e<1024?"tablet":"desktop"}catch{}try{if(document.referrer){n.referrer=document.referrer;try{n.referrer_hostname=new URL(document.referrer).hostname}catch{}}}catch{}try{let e=navigator.userAgent;e.includes("Edg/")?n.browser="Edge":e.includes("OPR/")||e.includes("Opera")?n.browser="Opera":e.includes("Chrome/")&&!e.includes("Chromium")?n.browser="Chrome":e.includes("Safari/")&&!e.includes("Chrome")?n.browser="Safari":e.includes("Firefox/")&&(n.browser="Firefox"),e.includes("Windows")?n.os="Windows":e.includes("iPhone")||e.includes("iPad")?n.os="iOS":e.includes("Mac OS X")||e.includes("Macintosh")?n.os="macOS":e.includes("Android")?n.os="Android":e.includes("Linux")&&(n.os="Linux")}catch{}try{n.page_url=window.location.href,n.page_path=window.location.pathname,n.page_host=window.location.hostname,window.location.search&&(n.page_query=window.location.search)}catch{}try{let e=window.Telegram?.WebApp;e?(n.surface_type="telegram",n.surface_host=e.platform||"unknown"):(n.surface_type="web",n.surface_host="web")}catch{n.surface_type="web",n.surface_host="web"}return n}var Iy="syntro_geo",Ny="https://geo.syntrologie.com";async function Td(n){if(typeof window>"u")return{};try{let e=localStorage.getItem(Iy);if(e){let t=JSON.parse(e);return K("Syntro Bootstrap","Geo: using cached data:",t),t}}catch{}try{let e=await fetch(n,{signal:AbortSignal.timeout(2e3)});if(e.ok){let t=await e.json(),r={};for(let[i,s]of Object.entries(t))typeof s=="string"&&s&&(r[i]=s);try{localStorage.setItem(Iy,JSON.stringify(r))}catch{}return K("Syntro Bootstrap","Geo: fetched from worker:",r),r}}catch{}return{}}var Ly="app:",iC="syntro:",sC=/^[a-z][a-z0-9_]*$/;function Id(n){if(!n)return{valid:!1,reason:"Event name cannot be empty"};if(n.startsWith(iC))return{valid:!1,reason:'"syntro:" prefix is reserved for internal SDK events'};if(!n.startsWith(Ly))return{valid:!1,reason:`Custom events must start with "app:" prefix. Got: "${n}"`};let e=n.slice(Ly.length).split(":");if(e.length<2)return{valid:!1,reason:`Event name must have at least 2 segments after "app:" (app:{category}:{action}). Got: "${n}"`};for(let t of e)if(!sC.test(t))return{valid:!1,reason:`Segment "${t}" must be lowercase alphanumeric + underscores. Got: "${n}"`};return{valid:!0}}function oC(n){return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||n===null}function Fy(n,e,t=0){if(t>=e)return!1;for(let r of Object.values(n))if(r!==null&&typeof r=="object"&&!Array.isArray(r)&&!Fy(r,e,t+1))return!1;return!0}function $d(n){if(n===void 0)return{valid:!0};if(n===null||typeof n!="object"||Array.isArray(n))return{valid:!1,reason:"Props must be a plain object"};if(!Fy(n,2))return{valid:!1,reason:"Props nesting depth exceeds 2 levels"};let e=[];for(let[t,r]of Object.entries(n))r!==null&&typeof r=="object"||oC(r)||e.push(t);return e.length>0?{valid:!0,stripped:e}:{valid:!0}}function ll(n,e){return e?!(e.names&&e.names.length>0&&!e.names.includes(n.name)||e.patterns&&e.patterns.length>0&&!e.patterns.some(r=>{try{return new RegExp(r).test(n.name)}catch{return!1}})||e.sources&&e.sources.length>0&&!e.sources.includes(n.source)):!0}var cl=class{constructor(e={}){this.subscriptions=new Set;this.history=[];this.maxHistorySize=e.maxHistorySize??100,this.debug=e.debug??!1,this.emitHistory=e.history??null,this.posthogCapture=e.posthogCapture??null,this.testMode=e.testMode??!1}subscribe(e,t){let r,i;typeof e=="function"?(r=void 0,i=e):(r=e,i=t);let s={filter:r,callback:i};return this.subscriptions.add(s),()=>{this.subscriptions.delete(s)}}publish(e,t,r="canvas"){let i={ts:Date.now(),name:e,source:r,props:t,schemaVersion:$e};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let t of this.subscriptions)if(ll(e,t.filter))try{t.callback(e)}catch(r){console.error("[EventBus] Subscriber error:",r)}}emit(e,t){let r=Id(e);if(!r.valid)return console.warn(`[EventBus] emit() rejected: ${r.reason}`),this.debug?{delivered:!1,matchedRules:[],posthogCaptured:!1,listenersNotified:0}:void 0;let i=$d(t);if(!i.valid)return console.warn(`[EventBus] emit() rejected props: ${i.reason}`),this.debug?{delivered:!1,matchedRules:[],posthogCaptured:!1,listenersNotified:0}:void 0;let s={ts:Date.now(),name:e,source:"custom",props:t,schemaVersion:$e};this.history.push(s),this.history.length>this.maxHistorySize&&this.history.shift();let o=0;for(let l of this.subscriptions)if(ll(s,l.filter))try{l.callback(s),o++}catch(c){console.error("[EventBus] Subscriber error:",c),o++}let a=!1;if(this.posthogCapture&&!this.testMode)try{this.posthogCapture(e,t),a=!0}catch(l){console.error("[EventBus] PostHog capture error:",l)}if(this.emitHistory&&this.emitHistory.record({name:e,props:t,source:"custom",timestamp:s.ts,matchedRules:[]}),this.debug)return console.debug("[EventBus] emit()",{name:e,props:t,listenersNotified:o,posthogCaptured:a}),{delivered:!0,matchedRules:[],posthogCaptured:a,listenersNotified:o}}setPosthogCapture(e){this.posthogCapture=e}getRecent(e,t){let r=this.history;return e&&(r=r.filter(i=>ll(i,e))),t&&t>0&&(r=r.slice(-t)),r}hasRecentEvent(e,t,r){let i=Date.now()-t;return this.history.some(s=>s.name===e&&s.ts>=i&&(r===void 0||s.source===r))}countRecentEvents(e,t){let r=this.history.filter(i=>ll(i,e));if(t!==void 0){let i=Date.now()-t;r=r.filter(s=>s.ts>=i)}return r.length}clearHistory(){this.history=[]}getSubscriberCount(){return this.subscriptions.size}};function ro(n={}){return new cl(n)}var io=class{constructor(e=100){this.entries=[];this.maxSize=e}record(e){this.entries.push(e),this.maxSize>0&&this.entries.length>this.maxSize&&this.entries.shift()}getAll(){return[...this.entries]}clear(){this.entries=[]}};var Hy={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function By(){return Hy}function Md(n){let e=2166136261,t=n.length;for(let r=0;r<t;r++)e^=n.charCodeAt(r),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0}function so(n,e,t){return t===2?Md(Md(n+e)+"")%1e4/1e4:t===1?Md(e+n)%1e3/1e3:null}function aC(n){return n<=0?[]:new Array(n).fill(1/n)}function ul(n,e){return n>=e[0]&&n<e[1]}function Vy(n,e){let t=so("__"+e[0],n,1);return t===null?!1:t>=e[1]&&t<e[2]}function Wy(n,e){for(let t=0;t<e.length;t++)if(ul(n,e[t]))return t;return-1}function Od(n){try{let e=n.replace(/([^\\])\//g,"$1\\/");return new RegExp(e)}catch(e){console.error(e);return}}function dl(n,e){if(!e.length)return!1;let t=!1,r=!1;for(let i=0;i<e.length;i++){let s=uC(n,e[i].type,e[i].pattern);if(e[i].include===!1){if(s)return!1}else t=!0,s&&(r=!0)}return r||!t}function lC(n,e,t){try{let r=e.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return t&&(r="\\/?"+r.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+r+"$","i").test(n)}catch{return!1}}function cC(n,e){try{let t=new URL(e.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),r=[[n.host,t.host,!1],[n.pathname,t.pathname,!0]];return t.hash&&r.push([n.hash,t.hash,!1]),t.searchParams.forEach((i,s)=>{r.push([n.searchParams.get(s)||"",i,!1])}),!r.some(i=>!lC(i[0],i[1],i[2]))}catch{return!1}}function uC(n,e,t){try{let r=new URL(n,"https://_");if(e==="regex"){let i=Od(t);return i?i.test(r.href)||i.test(r.href.substring(r.origin.length)):!1}else if(e==="simple")return cC(r,t);return!1}catch{return!1}}function jy(n,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);let r=aC(n);t=t||r,t.length!==n&&(t=r);let i=t.reduce((o,a)=>a+o,0);(i<.99||i>1.01)&&(t=r);let s=0;return t.map(o=>{let a=s;return s+=o,[a,a+e*o]})}function Uy(n,e,t){if(!e)return null;let r=e.split("?")[1];if(!r)return null;let i=r.replace(/#.*/,"").split("&").map(s=>s.split("=",2)).filter(([s])=>s===n).map(([,s])=>parseInt(s));return i.length>0&&i[0]>=0&&i[0]<t?i[0]:null}function zy(n){try{return n()}catch(e){return console.error(e),!1}}var Pd=n=>Uint8Array.from(atob(n),e=>e.charCodeAt(0));async function Nr(n,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||Hy.SubtleCrypto,!t)throw new Error("No SubtleCrypto implementation found");try{let r=await t.importKey("raw",Pd(e),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=n.split("."),o=await t.decrypt({name:"AES-CBC",iv:Pd(i)},r,Pd(s));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function oo(n){return typeof n=="string"?n:JSON.stringify(n)}function ut(n){typeof n=="number"&&(n=n+""),(!n||typeof n!="string")&&(n="0");let e=n.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return e.length===3&&e.push("~"),e.map(t=>t.match(/^[0-9]+$/)?t.padStart(5," "):t).join("-")}function qy(){let n;try{n="1.6.4"}catch{n=""}return n}function Zy(n,e){let t,r;try{t=new URL(n),r=new URL(e)}catch(i){return console.error(`Unable to merge query strings: ${i}`),e}return t.searchParams.forEach((i,s)=>{r.searchParams.has(s)||r.searchParams.set(s,i)}),r.toString()}function Dy(n){return typeof n=="object"&&n!==null}function pl(n){return n.urlPatterns&&n.variations.some(e=>Dy(e)&&"urlRedirect"in e)?"redirect":n.variations.some(e=>Dy(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function hl(n,e){return new Promise(t=>{let r=!1,i,s=o=>{r||(r=!0,i&&clearTimeout(i),t(o||null))};e&&(i=setTimeout(()=>s(),e)),n.then(o=>s(o)).catch(()=>s())})}var Ke={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},Zt=By(),Ti={fetchFeaturesCall:({host:n,clientKey:e,headers:t})=>Zt.fetch(`${n}/api/features/${e}`,{headers:t}),fetchRemoteEvalCall:({host:n,clientKey:e,payload:t,headers:r})=>{let i={method:"POST",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(t)};return Zt.fetch(`${n}/api/eval/${e}`,i)},eventSourceCall:({host:n,clientKey:e,headers:t})=>t?new Zt.EventSource(`${n}/sub/${e}`,{headers:t}):new Zt.EventSource(`${n}/sub/${e}`),startIdleListener:()=>{let n;if(!(typeof window<"u"&&typeof document<"u"))return;let t=()=>{document.visibilityState==="visible"?(window.clearTimeout(n),hC()):document.visibilityState==="hidden"&&(n=window.setTimeout(pC,Ke.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(Zt.localStorage=globalThis.localStorage)}catch{}var Ii=new Map,Gy=!1,un=new Map,fl=new Map,$i=new Map,Mi=new Set;function Yy(n){Object.assign(Ke,n),Ke.backgroundSync||Bd()}async function Xy({instance:n,timeout:e,skipCache:t,allowStale:r,backgroundSync:i}){return i||(Ke.backgroundSync=!1),fC({instance:n,allowStale:r,timeout:e,skipCache:t})}function dC(n){let e=ao(n),t=Ii.get(e)||new Set;t.add(n),Ii.set(e,t)}function Jy(n){Ii.forEach(e=>e.delete(n))}function pC(){$i.forEach(n=>{n&&(n.state="idle",Dd(n))})}function hC(){$i.forEach(n=>{n&&n.state==="idle"&&Hd(n)})}async function Ky(){try{if(!Zt.localStorage)return;await Zt.localStorage.setItem(Ke.cacheKey,JSON.stringify(Array.from(un.entries())))}catch{}}async function fC({instance:n,allowStale:e,timeout:t,skipCache:r}){let i=ao(n),s=Ld(n),o=new Date,a=new Date(o.getTime()-Ke.maxAge+Ke.staleTTL);await gC();let l=!Ke.disableCache&&!r?un.get(s):void 0;return l&&(e||l.staleAt>o)&&l.staleAt>a?(l.sse&&Mi.add(i),l.staleAt<o?Nd(n):Fd(n),{data:l.data,success:!0,source:"cache"}):await hl(Nd(n),t)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function ao(n){let[e,t]=n.getApiInfo();return`${e}||${t}`}function Ld(n){let e=ao(n);if(!("isRemoteEval"in n)||!n.isRemoteEval())return e;let t=n.getAttributes(),r=n.getCacheKeyAttributes()||Object.keys(n.getAttributes()),i={};r.forEach(a=>{i[a]=t[a]});let s=n.getForcedVariations(),o=n.getUrl();return`${e}||${JSON.stringify({ca:i,fv:s,url:o})}`}async function gC(){if(!Gy){Gy=!0;try{if(Zt.localStorage){let n=await Zt.localStorage.getItem(Ke.cacheKey);if(!Ke.disableCache&&n){let e=JSON.parse(n);e&&Array.isArray(e)&&e.forEach(([t,r])=>{un.set(t,{...r,staleAt:new Date(r.staleAt)})}),Qy()}}}catch{}if(!Ke.disableIdleStreams){let n=Ti.startIdleListener();n&&(Ti.stopIdleListener=n)}}}function Qy(){let n=Array.from(un.entries()).map(([t,r])=>({key:t,staleAt:r.staleAt.getTime()})).sort((t,r)=>t.staleAt-r.staleAt),e=Math.min(Math.max(0,un.size-Ke.maxEntries),un.size);for(let t=0;t<e;t++)un.delete(n[t].key)}function eb(n,e,t){let r=t.dateUpdated||"",i=new Date(Date.now()+Ke.staleTTL),s=Ke.disableCache?void 0:un.get(e);if(s&&r&&s.version===r){s.staleAt=i,Ky();return}Ke.disableCache||(un.set(e,{data:t,version:r,staleAt:i,sse:Mi.has(n)}),Qy()),Ky();let o=Ii.get(n);o&&o.forEach(a=>mC(a,t))}async function mC(n,e){await n.setPayload(e||n.getPayload())}async function Nd(n){let{apiHost:e,apiRequestHeaders:t}=n.getApiHosts(),r=n.getClientKey(),i="isRemoteEval"in n&&n.isRemoteEval(),s=ao(n),o=Ld(n),a=fl.get(o);return a||(a=(i?Ti.fetchRemoteEvalCall({host:e,clientKey:r,payload:{attributes:n.getAttributes(),forcedVariations:n.getForcedVariations(),forcedFeatures:Array.from(n.getForcedFeatures().entries()),url:n.getUrl()},headers:t}):Ti.fetchFeaturesCall({host:e,clientKey:r,headers:t})).then(c=>{if(!c.ok)throw new Error(`HTTP error: ${c.status}`);return c.headers.get("x-sse-support")==="enabled"&&Mi.add(s),c.json()}).then(c=>(eb(s,o,c),Fd(n),fl.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(fl.delete(o),{data:null,source:"error",success:!1,error:c})),fl.set(o,a)),a}function Fd(n,e=!1){let t=ao(n),r=Ld(n),{streamingHost:i,streamingHostRequestHeaders:s}=n.getApiHosts(),o=n.getClientKey();if(e&&Mi.add(t),Ke.backgroundSync&&Mi.has(t)&&Zt.EventSource){if($i.has(t))return;let a={src:null,host:i,clientKey:o,headers:s,cb:l=>{try{if(l.type==="features-updated"){let c=Ii.get(t);c&&c.forEach(u=>{Nd(u)})}else if(l.type==="features"){let c=JSON.parse(l.data);eb(t,r,c)}a.errors=0}catch{tb(a)}},errors:0,state:"active"};$i.set(t,a),Hd(a)}}function tb(n){if(n.state!=="idle"&&(n.errors++,n.errors>3||n.src&&n.src.readyState===2)){let e=Math.pow(3,n.errors-3)*(1e3+Math.random()*1e3);Dd(n),setTimeout(()=>{["idle","active"].includes(n.state)||Hd(n)},Math.min(e,3e5))}}function Dd(n){n.src&&(n.src.onopen=null,n.src.onerror=null,n.src.close(),n.src=null,n.state==="active"&&(n.state="disabled"))}function Hd(n){n.src=Ti.eventSourceCall({host:n.host,clientKey:n.clientKey,headers:n.headers}),n.state="active",n.src.addEventListener("features",n.cb),n.src.addEventListener("features-updated",n.cb),n.src.onerror=()=>tb(n),n.src.onopen=()=>{n.errors=0}}function vC(n,e){Dd(n),$i.delete(e)}function Bd(){Mi.clear(),$i.forEach(vC),Ii.clear(),Ti.stopIdleListener()}function gl(n,e){if(e.streaming){if(!n.getClientKey())throw new Error("Must specify clientKey to enable streaming");e.payload&&Fd(n,!0),dC(n)}}var yC=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,jd={revert:function(){}},bl=new Map,Ud=new Set;function bC(n){return n==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[n]}}function _l(n){var e=bl.get(n);return e||(e={element:n,attributes:{}},bl.set(n,e)),e}function xl(n,e,t,r,i){var s=t(n),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:n,_positionTimeout:null,observer:new MutationObserver(function(){if(!(e==="position"&&o._positionTimeout)){e==="position"&&(o._positionTimeout=setTimeout(function(){o._positionTimeout=null},1e3));var a=t(n);e==="position"&&a.parentNode===o.virtualValue.parentNode&&a.insertBeforeNode===o.virtualValue.insertBeforeNode||a!==o.virtualValue&&(o.originalValue=a,i(o))}}),mutationRunner:i,setValue:r,getCurrentValue:t};return e==="position"&&n.parentNode?o.observer.observe(n.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(n,bC(e)),o}function wl(n,e){var t=e.getCurrentValue(e.el);e.virtualValue=n,n&&typeof n!="string"?(!t||n.parentNode!==t.parentNode||n.insertBeforeNode!==t.insertBeforeNode)&&(e.isDirty=!0,nb()):n!==t&&(e.isDirty=!0,nb())}function _C(n){var e=n.originalValue;n.mutations.forEach(function(t){return e=t.mutate(e)}),wl(OC(e),n)}function xC(n){var e=new Set(n.originalValue.split(/\s+/).filter(Boolean));n.mutations.forEach(function(t){return t.mutate(e)}),wl(Array.from(e).filter(Boolean).join(" "),n)}function wC(n){var e=n.originalValue;n.mutations.forEach(function(t){return e=t.mutate(e)}),wl(e,n)}function kC(n){var e=n.parentSelector,t=n.insertBeforeSelector,r=document.querySelector(e);if(!r)return null;var i=t?document.querySelector(t):null;return t&&!i?null:{parentNode:r,insertBeforeNode:i}}function SC(n){var e=n.originalValue;n.mutations.forEach(function(t){var r=t.mutate(),i=kC(r);e=i||e}),wl(e,n)}var EC=function(e){return e.innerHTML},CC=function(e,t){return e.innerHTML=t};function ib(n){var e=_l(n);return e.html||(e.html=xl(n,"html",EC,CC,_C)),e.html}var AC=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},RC=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function sb(n){var e=_l(n);return e.position||(e.position=xl(n,"position",AC,RC,SC)),e.position}var TC=function(e,t){return t?e.className=t:e.removeAttribute("class")},IC=function(e){return e.className};function ob(n){var e=_l(n);return e.classes||(e.classes=xl(n,"class",IC,TC,xC)),e.classes}var $C=function(e){return function(t){var r;return(r=t.getAttribute(e))!=null?r:null}},MC=function(e){return function(t,r){return r!==null?t.setAttribute(e,r):t.removeAttribute(e)}};function ab(n,e){var t=_l(n);return t.attributes[e]||(t.attributes[e]=xl(n,e,$C(e),MC(e),wC)),t.attributes[e]}function PC(n,e){var t=bl.get(n);if(t)if(e==="html"){var r,i;(r=t.html)==null||(i=r.observer)==null||i.disconnect(),delete t.html}else if(e==="class"){var s,o;(s=t.classes)==null||(o=s.observer)==null||o.disconnect(),delete t.classes}else if(e==="position"){var a,l;(a=t.position)==null||(l=a.observer)==null||l.disconnect(),delete t.position}else{var c,u,d;(c=t.attributes)==null||(u=c[e])==null||(d=u.observer)==null||d.disconnect(),delete t.attributes[e]}}var ml;function OC(n){return ml||(ml=document.createElement("div")),ml.innerHTML=n,ml.innerHTML}function vl(n,e,t){if(t.isDirty){t.isDirty=!1;var r=t.virtualValue;t.mutations.length||PC(n,e),t.setValue(n,r)}}function NC(n,e){n.html&&vl(e,"html",n.html),n.classes&&vl(e,"class",n.classes),n.position&&vl(e,"position",n.position),Object.keys(n.attributes).forEach(function(t){vl(e,t,n.attributes[t])})}function nb(){bl.forEach(NC)}function LC(n,e){var t=null;n.kind==="html"?t=ib(e):n.kind==="class"?t=ob(e):n.kind==="attribute"?t=ab(e,n.attribute):n.kind==="position"&&(t=sb(e)),t&&(t.mutations.push(n),t.mutationRunner(t))}function FC(n,e){var t=null;if(n.kind==="html"?t=ib(e):n.kind==="class"?t=ob(e):n.kind==="attribute"?t=ab(e,n.attribute):n.kind==="position"&&(t=sb(e)),!!t){var r=t.mutations.indexOf(n);r!==-1&&t.mutations.splice(r,1),t.mutationRunner(t)}}function lb(n){if(!(n.kind==="position"&&n.elements.size===1)){var e=new Set(n.elements),t=document.querySelectorAll(n.selector);t.forEach(function(r){e.has(r)||(n.elements.add(r),LC(n,r))})}}function DC(n){n.elements.forEach(function(e){return FC(n,e)}),n.elements.clear(),Ud.delete(n)}function rb(){Ud.forEach(lb)}var Vd;function HC(){typeof document>"u"||(Vd||(Vd=new MutationObserver(function(){rb()})),rb(),Vd.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}HC();function kl(n){return typeof document>"u"?jd:(Ud.add(n),lb(n),{revert:function(){DC(n)}})}function Wd(n,e){return kl({kind:"html",elements:new Set,mutate:e,selector:n})}function cb(n,e){return kl({kind:"position",elements:new Set,mutate:e,selector:n})}function lo(n,e){return kl({kind:"class",elements:new Set,mutate:e,selector:n})}function yl(n,e,t){return yC.test(e)?e==="class"||e==="className"?lo(n,function(r){var i=t(Array.from(r).join(" "));r.clear(),i&&i.split(/\s+/g).filter(Boolean).forEach(function(s){return r.add(s)})}):kl({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:n}):jd}function BC(n){var e=n.selector,t=n.action,r=n.value,i=n.attribute,s=n.parentSelector,o=n.insertBeforeSelector;if(i==="html"){if(t==="append")return Wd(e,function(a){return a+(r??"")});if(t==="set")return Wd(e,function(){return r??""})}else if(i==="class"){if(t==="append")return lo(e,function(a){r&&a.add(r)});if(t==="remove")return lo(e,function(a){r&&a.delete(r)});if(t==="set")return lo(e,function(a){a.clear(),r&&a.add(r)})}else if(i==="position"){if(t==="set"&&s)return cb(e,function(){return{insertBeforeSelector:o,parentSelector:s}})}else{if(t==="append")return yl(e,i,function(a){return a!==null?a+(r??""):r??""});if(t==="set")return yl(e,i,function(){return r??""});if(t==="remove")return yl(e,i,function(){return null})}return jd}var VC={html:Wd,classes:lo,attribute:yl,position:cb,declarative:BC},ub=VC;var zd={};function Hn(n,e,t){t=t||{};for(let[r,i]of Object.entries(e))switch(r){case"$or":if(!hb(n,i,t))return!1;break;case"$nor":if(hb(n,i,t))return!1;break;case"$and":if(!qC(n,i,t))return!1;break;case"$not":if(Hn(n,i,t))return!1;break;default:if(!co(i,WC(n,r),t))return!1}return!0}function WC(n,e){let t=e.split("."),r=n;for(let i=0;i<t.length;i++)if(r&&typeof r=="object"&&t[i]in r)r=r[t[i]];else return null;return r}function db(n,e=!1){let t=`${n}${e?"/i":""}`;return zd[t]||(zd[t]=new RegExp(n.replace(/([^\\])\//g,"$1\\/"),e?"i":void 0)),zd[t]}function co(n,e,t,r=!1){if(typeof n=="string")return r?String(e).toLowerCase()===n.toLowerCase():e+""===n;if(typeof n=="number")return e*1===n;if(typeof n=="boolean")return e!==null&&!!e===n;if(n===null)return e===null;if(Array.isArray(n)||!fb(n))return JSON.stringify(e)===JSON.stringify(n);for(let i in n)if(!zC(i,e,n[i],t))return!1;return!0}function fb(n){let e=Object.keys(n);return e.length>0&&e.filter(t=>t[0]==="$").length===e.length}function jC(n){if(n===null)return"null";if(Array.isArray(n))return"array";let e=typeof n;return["string","number","boolean","object","undefined"].includes(e)?e:"unknown"}function UC(n,e,t){if(!Array.isArray(n))return!1;let r=fb(e)?i=>co(e,i,t):i=>Hn(i,e,t);for(let i=0;i<n.length;i++)if(n[i]&&r(n[i]))return!0;return!1}function Pi(n,e,t=!1){if(t){let r=i=>typeof i=="string"?i.toLowerCase():i;return Array.isArray(n)?n.some(i=>e.some(s=>r(i)===r(s))):e.some(i=>r(n)===r(i))}return Array.isArray(n)?n.some(r=>e.includes(r)):e.includes(n)}function pb(n,e,t,r=!1){if(!Array.isArray(n))return!1;for(let i=0;i<e.length;i++){let s=!1;for(let o=0;o<n.length;o++)if(co(e[i],n[o],t,r)){s=!0;break}if(!s)return!1}return!0}function zC(n,e,t,r){switch(n){case"$veq":return ut(e)===ut(t);case"$vne":return ut(e)!==ut(t);case"$vgt":return ut(e)>ut(t);case"$vgte":return ut(e)>=ut(t);case"$vlt":return ut(e)<ut(t);case"$vlte":return ut(e)<=ut(t);case"$eq":return e===t;case"$ne":return e!==t;case"$lt":return e<t;case"$lte":return e<=t;case"$gt":return e>t;case"$gte":return e>=t;case"$exists":return t?e!=null:e==null;case"$in":return Array.isArray(t)?Pi(e,t):!1;case"$ini":return Array.isArray(t)?Pi(e,t,!0):!1;case"$inGroup":return Pi(e,r[t]||[]);case"$notInGroup":return!Pi(e,r[t]||[]);case"$nin":return Array.isArray(t)?!Pi(e,t):!1;case"$nini":return Array.isArray(t)?!Pi(e,t,!0):!1;case"$not":return!co(t,e,r);case"$size":return Array.isArray(e)?co(t,e.length,r):!1;case"$elemMatch":return UC(e,t,r);case"$all":return Array.isArray(t)?pb(e,t,r):!1;case"$alli":return Array.isArray(t)?pb(e,t,r,!0):!1;case"$regex":try{return db(t).test(e)}catch{return!1}case"$regexi":try{return db(t,!0).test(e)}catch{return!1}case"$type":return jC(e)===t;default:return console.error("Unknown operator: "+n),!1}}function hb(n,e,t){if(!e.length)return!0;for(let r=0;r<e.length;r++)if(Hn(n,e[r],t))return!0;return!1}function qC(n,e,t){for(let r=0;r<e.length;r++)if(!Hn(n,e[r],t))return!1;return!0}var ZC="Feature Evaluated",GC="Experiment Viewed";function KC(n){let e=new Map;return n.global.forcedFeatureValues&&n.global.forcedFeatureValues.forEach((t,r)=>e.set(r,t)),n.user.forcedFeatureValues&&n.user.forcedFeatureValues.forEach((t,r)=>e.set(r,t)),e}function YC(n){return n.global.forcedVariations&&n.user.forcedVariations?{...n.global.forcedVariations,...n.user.forcedVariations}:n.global.forcedVariations?n.global.forcedVariations:n.user.forcedVariations?n.user.forcedVariations:{}}async function Oi(n){try{await n()}catch{}}function gb(n,e,t){if(n.user.trackedExperiments){let i=Cl(e,t);if(n.user.trackedExperiments.has(i))return[];n.user.trackedExperiments.add(i)}n.user.enableDevMode&&n.user.devLogs&&n.user.devLogs.push({experiment:e,result:t,timestamp:Date.now().toString(),logType:"experiment"});let r=[];if(n.global.trackingCallback){let i=n.global.trackingCallback;r.push(Oi(()=>i(e,t,n.user)))}if(n.user.trackingCallback){let i=n.user.trackingCallback;r.push(Oi(()=>i(e,t)))}if(n.global.eventLogger){let i=n.global.eventLogger;r.push(Oi(()=>i(GC,{experimentId:e.key,variationId:t.key,hashAttribute:t.hashAttribute,hashValue:t.hashValue},n.user)))}return r}function XC(n,e,t){if(n.user.trackedFeatureUsage){let r=JSON.stringify(t.value);if(n.user.trackedFeatureUsage[e]===r)return;n.user.trackedFeatureUsage[e]=r,n.user.enableDevMode&&n.user.devLogs&&n.user.devLogs.push({featureKey:e,result:t,timestamp:Date.now().toString(),logType:"feature"})}if(n.global.onFeatureUsage){let r=n.global.onFeatureUsage;Oi(()=>r(e,t,n.user))}if(n.user.onFeatureUsage){let r=n.user.onFeatureUsage;Oi(()=>r(e,t))}if(n.global.eventLogger){let r=n.global.eventLogger;Oi(()=>r(ZC,{feature:e,source:t.source,value:t.value,ruleId:t.source==="defaultValue"?"$default":t.ruleId||"",variationId:t.experimentResult?t.experimentResult.key:""},n.user))}}function Sl(n,e){if(e.stack.evaluatedFeatures.has(n))return Bn(e,n,null,"cyclicPrerequisite");e.stack.evaluatedFeatures.add(n),e.stack.id=n;let t=KC(e);if(t.has(n))return Bn(e,n,t.get(n),"override");if(!e.global.features||!e.global.features[n])return Bn(e,n,null,"unknownFeature");let r=e.global.features[n];if(r.rules){let i=new Set(e.stack.evaluatedFeatures);e:for(let s of r.rules){if(s.parentConditions)for(let l of s.parentConditions){e.stack.evaluatedFeatures=new Set(i);let c=Sl(l.id,e);if(c.source==="cyclicPrerequisite")return Bn(e,n,null,"cyclicPrerequisite");let u={value:c.value};if(!Hn(u,l.condition||{})){if(l.gate)return Bn(e,n,null,"prerequisite");continue e}}if(s.filters&&yb(s.filters,e))continue;if("force"in s){if(s.condition&&!vb(s.condition,e)||!JC(e,s.seed||n,s.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!s.disableStickyBucketing?s.fallbackAttribute:void 0,s.range,s.coverage,s.hashVersion))continue;return s.tracks&&s.tracks.forEach(l=>{!gb(e,l.experiment,l.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:l.experiment,result:l.result})}),Bn(e,n,s.force,"force",s.id)}if(!s.variations)continue;let o={variations:s.variations,key:s.key||n};"coverage"in s&&(o.coverage=s.coverage),s.weights&&(o.weights=s.weights),s.hashAttribute&&(o.hashAttribute=s.hashAttribute),s.fallbackAttribute&&(o.fallbackAttribute=s.fallbackAttribute),s.disableStickyBucketing&&(o.disableStickyBucketing=s.disableStickyBucketing),s.bucketVersion!==void 0&&(o.bucketVersion=s.bucketVersion),s.minBucketVersion!==void 0&&(o.minBucketVersion=s.minBucketVersion),s.namespace&&(o.namespace=s.namespace),s.meta&&(o.meta=s.meta),s.ranges&&(o.ranges=s.ranges),s.name&&(o.name=s.name),s.phase&&(o.phase=s.phase),s.seed&&(o.seed=s.seed),s.hashVersion&&(o.hashVersion=s.hashVersion),s.filters&&(o.filters=s.filters),s.condition&&(o.condition=s.condition);let{result:a}=El(o,n,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(o,a),a.inExperiment&&!a.passthrough)return Bn(e,n,a.value,"experiment",s.id,o,a)}}return Bn(e,n,r.defaultValue===void 0?null:r.defaultValue,"defaultValue")}function El(n,e,t){let r=n.key,i=n.variations.length;if(i<2)return{result:Ae(t,n,-1,!1,e)};if(t.global.enabled===!1||t.user.enabled===!1)return{result:Ae(t,n,-1,!1,e)};if(n=QC(n,t),n.urlPatterns&&!dl(t.user.url||"",n.urlPatterns))return{result:Ae(t,n,-1,!1,e)};let s=Uy(r,t.user.url||"",i);if(s!==null)return{result:Ae(t,n,s,!1,e)};let o=YC(t);if(r in o){let m=o[r];return{result:Ae(t,n,m,!1,e)}}if(n.status==="draft"||n.active===!1)return{result:Ae(t,n,-1,!1,e)};let{hashAttribute:a,hashValue:l}=Lr(t,n.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!n.disableStickyBucketing?n.fallbackAttribute:void 0);if(!l)return{result:Ae(t,n,-1,!1,e)};let c=-1,u=!1,d=!1;if(t.user.saveStickyBucketAssignmentDoc&&!n.disableStickyBucketing){let{variation:m,versionIsBlocked:y}=nA({ctx:t,expKey:n.key,expBucketVersion:n.bucketVersion,expHashAttribute:n.hashAttribute,expFallbackAttribute:n.fallbackAttribute,expMinBucketVersion:n.minBucketVersion,expMeta:n.meta});u=m>=0,c=m,d=!!y}if(!u){if(n.filters){if(yb(n.filters,t))return{result:Ae(t,n,-1,!1,e)}}else if(n.namespace&&!Vy(l,n.namespace))return{result:Ae(t,n,-1,!1,e)};if(n.include&&!zy(n.include))return{result:Ae(t,n,-1,!1,e)};if(n.condition&&!vb(n.condition,t))return{result:Ae(t,n,-1,!1,e)};if(n.parentConditions){let m=new Set(t.stack.evaluatedFeatures);for(let y of n.parentConditions){t.stack.evaluatedFeatures=new Set(m);let k=Sl(y.id,t);if(k.source==="cyclicPrerequisite")return{result:Ae(t,n,-1,!1,e)};let _={value:k.value};if(!Hn(_,y.condition||{}))return{result:Ae(t,n,-1,!1,e)}}}if(n.groups&&!tA(n.groups,t))return{result:Ae(t,n,-1,!1,e)}}if(n.url&&!eA(n.url,t))return{result:Ae(t,n,-1,!1,e)};let h=so(n.seed||r,l,n.hashVersion||1);if(h===null)return{result:Ae(t,n,-1,!1,e)};if(!u){let m=n.ranges||jy(i,n.coverage===void 0?1:n.coverage,n.weights);c=Wy(h,m)}if(d)return{result:Ae(t,n,-1,!1,e,void 0,!0)};if(c<0)return{result:Ae(t,n,-1,!1,e)};if("force"in n)return{result:Ae(t,n,n.force===void 0?-1:n.force,!1,e)};if(t.global.qaMode||t.user.qaMode)return{result:Ae(t,n,-1,!1,e)};if(n.status==="stopped")return{result:Ae(t,n,-1,!1,e)};let g=Ae(t,n,c,!0,e,h,u);if(t.user.saveStickyBucketAssignmentDoc&&!n.disableStickyBucketing){let{changed:m,key:y,doc:k}=iA(t,a,oo(l),{[qd(n.key,n.bucketVersion)]:g.key});m&&(t.user.stickyBucketAssignmentDocs=t.user.stickyBucketAssignmentDocs||{},t.user.stickyBucketAssignmentDocs[y]=k,t.user.saveStickyBucketAssignmentDoc(k))}let v=gb(t,n,g);v.length===0&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:n,result:g});let f=v.length?v.length===1?v[0]:Promise.all(v).then(()=>{}):void 0;return"changeId"in n&&n.changeId&&t.global.recordChangeId&&t.global.recordChangeId(n.changeId),{result:g,trackingCall:f}}function Bn(n,e,t,r,i,s,o){let a={value:t,on:!!t,off:!t,source:r,ruleId:i||""};return s&&(a.experiment=s),o&&(a.experimentResult=o),r!=="override"&&XC(n,e,a),a}function mb(n){return{...n.user.attributes,...n.user.attributeOverrides}}function vb(n,e){return Hn(mb(e),n,e.global.savedGroups||{})}function yb(n,e){return n.some(t=>{let{hashValue:r}=Lr(e,t.attribute);if(!r)return!0;let i=so(t.seed,r,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>ul(i,s))})}function JC(n,e,t,r,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;let{hashValue:a}=Lr(n,t,r);if(!a)return!1;let l=so(e,a,o||1);return l===null?!1:i?ul(l,i):s!==void 0?l<=s:!0}function Ae(n,e,t,r,i,s,o){let a=!0;(t<0||t>=e.variations.length)&&(t=0,a=!1);let{hashAttribute:l,hashValue:c}=Lr(n,e.hashAttribute,n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),u=e.meta?e.meta[t]:{},d={key:u.key||""+t,featureId:i,inExperiment:a,hashUsed:r,variationId:t,value:e.variations[t],hashAttribute:l,hashValue:c,stickyBucketUsed:!!o};return u.name&&(d.name=u.name),s!==void 0&&(d.bucket=s),u.passthrough&&(d.passthrough=u.passthrough),d}function QC(n,e){let t=n.key,r=e.global.overrides;return r&&r[t]&&(n=Object.assign({},n,r[t]),typeof n.url=="string"&&(n.url=Od(n.url))),n}function Lr(n,e,t){let r=e||"id",i="",s=mb(n);return s[r]&&(i=s[r]),!i&&t&&(s[t]&&(i=s[t]),i&&(r=t)),{hashAttribute:r,hashValue:i}}function eA(n,e){let t=e.user.url;if(!t)return!1;let r=t.replace(/^https?:\/\//,"").replace(/^[^/]*\//,"/");return!!(n.test(t)||n.test(r))}function tA(n,e){let t=e.global.groups||{};for(let r=0;r<n.length;r++)if(t[n[r]])return!0;return!1}function nA({ctx:n,expKey:e,expBucketVersion:t,expHashAttribute:r,expFallbackAttribute:i,expMinBucketVersion:s,expMeta:o}){t=t||0,s=s||0,r=r||"id",o=o||[];let a=qd(e,t),l=rA(n,r,i);if(s>0)for(let d=0;d<s;d++){let h=qd(e,d);if(l[h]!==void 0)return{variation:-1,versionIsBlocked:!0}}let c=l[a];if(c===void 0)return{variation:-1};let u=o.findIndex(d=>d.key===c);return u<0?{variation:-1}:{variation:u}}function qd(n,e){return e=e||0,`${n}__${e}`}function Zd(n,e){return`${n}||${e}`}function rA(n,e,t){if(!n.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:r,hashValue:i}=Lr(n,e),s=Zd(r,oo(i)),{hashAttribute:o,hashValue:a}=Lr(n,t),l=a?Zd(o,oo(a)):null,c={};return l&&n.user.stickyBucketAssignmentDocs[l]&&Object.assign(c,n.user.stickyBucketAssignmentDocs[l].assignments||{}),n.user.stickyBucketAssignmentDocs[s]&&Object.assign(c,n.user.stickyBucketAssignmentDocs[s].assignments||{}),c}function iA(n,e,t,r){let i=Zd(e,t),s=n.user.stickyBucketAssignmentDocs&&n.user.stickyBucketAssignmentDocs[i]?n.user.stickyBucketAssignmentDocs[i].assignments||{}:{},o={...s,...r},a=JSON.stringify(s)!==JSON.stringify(o);return{key:i,doc:{attributeName:e,attributeValue:t,assignments:o},changed:a}}function sA(n,e){let t=new Set,r=e&&e.features?e.features:n.global.features||{},i=e&&e.experiments?e.experiments:n.global.experiments||[];return Object.keys(r).forEach(s=>{let o=r[s];if(o.rules)for(let a of o.rules)a.variations&&(t.add(a.hashAttribute||"id"),a.fallbackAttribute&&t.add(a.fallbackAttribute))}),i.map(s=>{t.add(s.hashAttribute||"id"),s.fallbackAttribute&&t.add(s.fallbackAttribute)}),Array.from(t)}async function bb(n,e,t){let r=Gd(n,t);return e.getAllAssignments(r)}function Gd(n,e){let t={};return sA(n,e).forEach(i=>{let{hashValue:s}=Lr(n,i);t[i]=oo(s)}),t}async function _b(n,e,t){if(n={...n},n.encryptedFeatures){try{n.features=JSON.parse(await Nr(n.encryptedFeatures,e,t))}catch(r){console.error(r)}delete n.encryptedFeatures}if(n.encryptedExperiments){try{n.experiments=JSON.parse(await Nr(n.encryptedExperiments,e,t))}catch(r){console.error(r)}delete n.encryptedExperiments}if(n.encryptedSavedGroups){try{n.savedGroups=JSON.parse(await Nr(n.encryptedSavedGroups,e,t))}catch(r){console.error(r)}delete n.encryptedSavedGroups}return n}function xb(n){let e=n.apiHost||"https://cdn.growthbook.io";return{apiHost:e.replace(/\/*$/,""),streamingHost:(n.streamingHost||e).replace(/\/*$/,""),apiRequestHeaders:n.apiHostRequestHeaders,streamingHostRequestHeaders:n.streamingHostRequestHeaders}}function Cl(n,e){return e.hashAttribute+e.hashValue+n.key+e.variationId}var Ni=typeof window<"u"&&typeof document<"u",oA=qy(),uo=class{constructor(e){if(e=e||{},this.version=oA,this._options=this.context=e,this._renderer=e.renderer||null,this._trackedExperiments=new Set,this._completedChangeIds=new Set,this._trackedFeatures={},this.debug=!!e.debug,this._subscriptions=new Set,this.ready=!1,this._assigned=new Map,this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._initialized=!1,this._redirectedUrl="",this._deferredTrackingCalls=new Map,this._autoExperimentsAllowed=!e.disableExperimentsOnLoad,this._destroyCallbacks=[],this.logs=[],this.log=this.log.bind(this),this._saveDeferredTrack=this._saveDeferredTrack.bind(this),this._onExperimentEval=this._onExperimentEval.bind(this),this._fireSubscriptions=this._fireSubscriptions.bind(this),this._recordChangedId=this._recordChangedId.bind(this),e.remoteEval){if(e.decryptionKey)throw new Error("Encryption is not available for remoteEval");if(!e.clientKey)throw new Error("Missing clientKey");let t=!1;try{t=!!new URL(e.apiHost||"").hostname.match(/growthbook\.io$/i)}catch{}if(t)throw new Error("Cannot use remoteEval on GrowthBook Cloud")}else if(e.cacheKeyAttributes)throw new Error("cacheKeyAttributes are only used for remoteEval");if(e.stickyBucketService){let t=e.stickyBucketService;this._saveStickyBucketAssignmentDoc=r=>t.saveAssignments(r)}if(e.plugins)for(let t of e.plugins)t(this);if(e.features&&(this.ready=!0),Ni&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event("gbloaded"))),e.experiments&&(this.ready=!0,this._updateAllAutoExperiments()),this._options.stickyBucketService&&this._options.stickyBucketAssignmentDocs)for(let t in this._options.stickyBucketAssignmentDocs){let r=this._options.stickyBucketAssignmentDocs[t];r&&this._options.stickyBucketService.saveAssignments(r).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;let t=await _b(e,this._options.decryptionKey);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._options.features=t.features),t.savedGroups&&(this._options.savedGroups=t.savedGroups),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;let t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw new Error("initSync does not support encrypted payloads");return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,t)),this._payload=t,this._decryptedPayload=t,t.features&&(this._options.features=t.features),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,gl(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&Yy(e.cacheSettings),e.payload)return await this.setPayload(e.payload),gl(this,e),{success:!0,source:"init"};{let{data:t,...r}=await this._refresh({...e,allowStale:!0});return gl(this,e),await this.setPayload(t||{}),r}}async loadFeatures(e){e=e||{},await this.init({skipCache:e.skipCache,timeout:e.timeout,streaming:(this._options.backgroundSync??!0)&&(e.autoRefresh||this._options.subscribeToChanges)})}async refreshFeatures(e){let t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return xb(this._options)}getClientKey(){return this._options.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._options.remoteEval||!1}getCacheKeyAttributes(){return this._options.cacheKeyAttributes}async _refresh({timeout:e,skipCache:t,allowStale:r,streaming:i}){if(!this._options.clientKey)throw new Error("Missing clientKey");return Xy({instance:this,timeout:e,skipCache:t||this._options.disableCache,allowStale:r,backgroundSync:i??this._options.backgroundSync??!0})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error("Failed to render",e)}}setFeatures(e){this._options.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,r){let i=await Nr(e,t||this._options.decryptionKey,r);this.setFeatures(JSON.parse(i))}setExperiments(e){this._options.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,r){let i=await Nr(e,t||this._options.decryptionKey,r);this.setExperiments(JSON.parse(i))}async setAttributes(e){if(this._options.attributes=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async updateAttributes(e){return this.setAttributes({...this._options.attributes,...e})}async setAttributeOverrides(e){if(this._options.attributeOverrides=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async setForcedVariations(e){if(this._options.forcedVariations=e||{},this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}setForcedFeatures(e){this._options.forcedFeatureValues=e,this._render()}async setURL(e){if(e!==this._options.url){if(this._options.url=e,this._redirectedUrl="",this._options.remoteEval){await this._refreshForRemoteEval(),this._updateAllAutoExperiments(!0);return}this._updateAllAutoExperiments(!0)}}getAttributes(){return{...this._options.attributes,...this._options.attributeOverrides}}getForcedVariations(){return this._options.forcedVariations||{}}getForcedFeatures(){return this._options.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._options.stickyBucketAssignmentDocs||{}}getUrl(){return this._options.url||""}getFeatures(){return this._options.features||{}}getExperiments(){return this._options.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}async _refreshForRemoteEval(){if(!this._options.remoteEval||!this._initialized)return;let e=await this._refresh({allowStale:!1});e.data&&await this.setPayload(e.data)}getAllResults(){return new Map(this._assigned)}onDestroy(e){this._destroyCallbacks.push(e)}isDestroyed(){return!!this._destroyed}destroy(e){e=e||{},this._destroyed=!0,this._destroyCallbacks.forEach(t=>{try{t()}catch(r){console.error(r)}}),this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._destroyCallbacks=[],this._payload=void 0,this._saveStickyBucketAssignmentDoc=void 0,Jy(this),e.destroyAllStreams&&Bd(),this.logs=[],Ni&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach(t=>{t.undo()}),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){if(this._options.forcedVariations=this._options.forcedVariations||{},this._options.forcedVariations[e]=t,this._options.remoteEval){this._refreshForRemoteEval();return}this._updateAllAutoExperiments(),this._render()}run(e){let{result:t}=El(e,null,this._getEvalContext());return this._onExperimentEval(e,t),t}triggerExperiment(e){return this._triggeredExpKeys.add(e),this._options.experiments?this._options.experiments.filter(r=>r.key===e).map(r=>this._runAutoExperiment(r)).filter(r=>r!==null):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_getEvalContext(){return{user:this._getUserContext(),global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getUserContext(){return{attributes:this._options.user?{...this._options.user,...this._options.attributes}:this._options.attributes,enableDevMode:this._options.enableDevMode,blockedChangeIds:this._options.blockedChangeIds,stickyBucketAssignmentDocs:this._options.stickyBucketAssignmentDocs,url:this._getContextUrl(),forcedVariations:this._options.forcedVariations,forcedFeatureValues:this._options.forcedFeatureValues,attributeOverrides:this._options.attributeOverrides,saveStickyBucketAssignmentDoc:this._saveStickyBucketAssignmentDoc,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage,devLogs:this.logs,trackedExperiments:this._trackedExperiments,trackedFeatureUsage:this._trackedFeatures}}_getGlobalContext(){return{features:this._options.features,experiments:this._options.experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,groups:this._options.groups,overrides:this._options.overrides,onExperimentEval:this._onExperimentEval,recordChangeId:this._recordChangedId,saveDeferredTrack:this._saveDeferredTrack,eventLogger:this._options.eventLogger}}_runAutoExperiment(e,t){let r=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!r)return null;let i=this._isAutoExperimentBlockedByContext(e),s,o;i?s=Ae(this._getEvalContext(),e,-1,!1,""):({result:s,trackingCall:o}=El(e,null,this._getEvalContext()),this._onExperimentEval(e,s));let a=JSON.stringify(s.value);if(!t&&s.inExperiment&&r&&r.valueHash===a)return s;if(r&&this._undoActiveAutoExperiment(e),s.inExperiment){let l=pl(e);if(l==="redirect"&&s.value.urlRedirect&&e.urlPatterns){let c=e.persistQueryString?Zy(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(dl(c,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),s;this._redirectedUrl=c;let{navigate:u,delay:d}=this._getNavigateFunction();if(u)if(Ni)Promise.all([...o?[hl(o,this._options.maxNavigateDelay??1e3)]:[],new Promise(h=>window.setTimeout(h,this._options.navigateDelay??d))]).then(()=>{try{u(c)}catch(h){console.error(h)}});else try{u(c)}catch(h){console.error(h)}}else if(l==="visual"){let c=this._options.applyDomChangesCallback?this._options.applyDomChangesCallback(s.value):this._applyDOMChanges(s.value);c&&this._activeAutoExperiments.set(e,{undo:c,valueHash:a})}}return s}_undoActiveAutoExperiment(e){let t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;let t=this._options.experiments||[],r=new Set(t);this._activeAutoExperiments.forEach((i,s)=>{r.has(s)||(i.undo(),this._activeAutoExperiments.delete(s))});for(let i of t){let s=this._runAutoExperiment(i,e);if(s&&s.inExperiment&&pl(i)==="redirect")break}}_onExperimentEval(e,t){let r=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,r)}_fireSubscriptions(e,t,r){(!r||r.result.inExperiment!==t.inExperiment||r.result.variationId!==t.variationId)&&this._subscriptions.forEach(i=>{try{i(e,t)}catch(s){console.error(s)}})}_recordChangedId(e){this._completedChangeIds.add(e)}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){let r=this.evalFeature(e).value;return r===null?t:r}feature(e){return this.evalFeature(e)}evalFeature(e){return Sl(e,this._getEvalContext())}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(e){this._deferredTrackingCalls=new Map(e.filter(t=>t&&t.experiment&&t.result).map(t=>[Cl(t.experiment,t.result),t]))}async fireDeferredTrackingCalls(){if(!this._options.trackingCallback)return;let e=[];this._deferredTrackingCalls.forEach(t=>{!t||!t.experiment||!t.result?console.error("Invalid deferred tracking call",{call:t}):e.push(this._options.trackingCallback(t.experiment,t.result))}),this._deferredTrackingCalls.clear(),await Promise.all(e)}setTrackingCallback(e){this._options.trackingCallback=e,this.fireDeferredTrackingCalls()}setEventLogger(e){this._options.eventLogger=e}async logEvent(e,t){if(this._destroyed){console.error("Cannot log event to destroyed GrowthBook instance");return}if(this._options.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:"event"}),this._options.eventLogger)try{await this._options.eventLogger(e,t||{},this._getUserContext())}catch(r){console.error(r)}else console.error("No event logger configured")}_saveDeferredTrack(e){this._deferredTrackingCalls.set(Cl(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(Ni?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=pl(e);if(t==="visual"){if(this._options.disableVisualExperiments||this._options.disableJsInjection&&e.variations.some(r=>r.js))return!0}else if(t==="redirect"){if(this._options.disableUrlRedirectExperiments)return!0;try{let r=new URL(this._getContextUrl());for(let i of e.variations){if(!i||!i.urlRedirect)continue;let s=new URL(i.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments&&(s.protocol!==r.protocol||s.host!==r.host))return!0}}catch(r){return this.log("Error parsing current or redirect URL",{id:e.key,error:r}),!0}}else return!0;return!!(e.changeId&&(this._options.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:Ni?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!Ni)return;let t=[];if(e.css){let r=document.createElement("style");r.innerHTML=e.css,document.head.appendChild(r),t.push(()=>r.remove())}if(e.js){let r=document.createElement("script");r.innerHTML=e.js,this._options.jsInjectionNonce&&(r.nonce=this._options.jsInjectionNonce),document.head.appendChild(r),t.push(()=>r.remove())}return e.domMutations&&e.domMutations.forEach(r=>{t.push(ub.declarative(r).revert)}),()=>{t.forEach(r=>r())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),r=await bb(t,this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=r}}generateStickyBucketAssignmentDocsSync(e,t){if(!("getAllAssignmentsSync"in e)){console.error("generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync");return}let r=this._getEvalContext(),i=Gd(r,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}};var aA="https://experiment.syntrologie.com",Kd=class{constructor(e={}){this.featureListeners=new Set;if(e.client)this.gb=e.client;else{let t=e.onExperimentViewed?(r,i)=>{e.onExperimentViewed(r.key,i.variationId,typeof i.value=="string"?i.value:`variation_${i.variationId}`)}:void 0;this.gb=new uo({...e,apiHost:e.apiHost??aA,enableDevMode:e.enableDevMode??!0,trackingCallback:t}),e.autoInit&&this.gb.init({streaming:!0})}}get _internal(){return this.gb}async refreshFeatures(){await this.gb.loadFeatures()}setAttributes(e){this.gb.setAttributes({...this.gb.getAttributes(),...e})}setForcedVariations(e){this.gb.setForcedVariations(e)}getFeatureValue(e,t){return this.gb.getFeatureValue(e,t)}getAllFeatures(){let e=this.gb.getFeatures(),t={};for(let r of Object.keys(e))t[r]=this.gb.getFeatureValue(r,null);return t}shouldRenderRectangle(e){return!0}onFeaturesChanged(e){return this.featureListeners.add(e),this.featureListeners.size===1&&this.gb.setRenderer(()=>{for(let t of this.featureListeners)t()}),()=>{this.featureListeners.delete(e),this.featureListeners.size===0&&this.gb.setRenderer(null)}}};function Yd(n={}){return new Kd(n)}var wb={growthbook:n=>Yd({...n,autoInit:!0})};function kb(n,e){let t=wb[n];if(!t)throw new Error(`Unknown experiment provider: ${n}. Supported: ${Object.keys(wb).join(", ")}`);return t(e)}var lA=["cdn.syntrologie.com","localhost","127.0.0.1"];function cA(n){try{let e=new URL(n),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(console.warn("[SmartCanvas] CDN URL must use HTTPS:",n),!1):lA.some(i=>e.hostname===i)?!0:(console.warn("[SmartCanvas] CDN host not in allowlist:",e.hostname),!1)}catch{return console.warn("[SmartCanvas] Invalid CDN URL:",n),!1}}var Xd=class{constructor(e){this.name="cdn";if(this.url=`${e.baseUrl}/${e.configId}.json`,this.integrity=e.integrity,!cA(this.url))throw new Error(`[SmartCanvas] CDN URL not allowed: ${this.url}`)}async fetch(){let e=performance.now(),t=await fetch(this.url,{credentials:"omit",cache:"default"});if(!t.ok)throw new Error(`[SmartCanvas] Failed to fetch config from CDN (${t.status})`);let r=await t.text();if(this.integrity){let l=await uA(r),c=this.integrity.replace("sha384-","");if(l!==c)throw new Error(`[SmartCanvas] Config integrity check failed. Expected ${c}, got ${l}`)}let i=JSON.parse(r),s=performance.now()-e,o=t.headers.get("cache-control"),a=t.headers.get("age");return{config:i,meta:{source:"cdn",fetchTimeMs:s,cached:o?.includes("public")??!1,cacheAge:a?parseInt(a,10):void 0}}}};async function uA(n){let t=new TextEncoder().encode(n),r=await crypto.subtle.digest("SHA-384",t),i=new Uint8Array(r);return btoa(String.fromCharCode(...i))}function Sb(n){return new Xd(n)}var dA="syntro_exp",pA="syntro_var",Jd=class{constructor(e){this.name="experiments";this.client=e.client,this.featureKey=e.featureKey,this.manifestKey=e.manifestKey,this.variantFlagPrefix=e.variantFlagPrefix}async fetch(){let e=performance.now();if(typeof window<"u"){let i=new URLSearchParams(window.location.search),s=i.get(dA),o=i.get(pA);if(s&&o!==null&&this.client.setForcedVariations){let a=parseInt(o,10);Number.isNaN(a)||(console.log(`[SmartCanvas] Preview mode: forcing "${s}" to variation ${a}`),this.client.setForcedVariations({[s]:a}))}}if(this.manifestKey||this.variantFlagPrefix||this.client.getAllFeatures){let i=this.fetchMultiFlag();if(i){let s=performance.now()-e;return{config:i,meta:{source:"experiments",fetchTimeMs:s,cached:!0}}}}if(!this.featureKey)throw new Error("[SmartCanvas] No featureKey configured and no variant flags found. Ensure at least one config feature flag exists in your experiment platform.");let t=this.client.getFeatureValue?.(this.featureKey,null);if(!t||typeof t!="object")throw new Error(`[SmartCanvas] Feature "${this.featureKey}" not found or invalid. Ensure the feature is configured in your experiment platform.`);let r=performance.now()-e;return{config:t,meta:{source:"experiments",fetchTimeMs:r,cached:!0}}}fetchMultiFlag(){let e=this.getVariantFlagKeys();return!e||e.length===0?null:Ha(this.client,e)}getVariantFlagKeys(){if(this.manifestKey){let e=this.client.getFeatureValue?.(this.manifestKey,null);if(e&&typeof e=="object"){let t=e.variant_flags;if(t&&t.length>0)return t}}if(this.client.getAllFeatures){let e=this.client.getAllFeatures();return this.variantFlagPrefix?Object.keys(e).filter(t=>t.startsWith(this.variantFlagPrefix)):Object.keys(e)}return[]}};function Eb(n){return new Jd(n)}var hA="https://cdn.syntrologie.com/configs",Cb={cdn:n=>{if(!n.configId)throw new Error("CDN fetcher requires 'configId' option");return Sb({baseUrl:n.baseUrl??hA,configId:n.configId,integrity:n.integrity})},experiments:n=>{if(!n.featureKey)throw new Error("Experiments fetcher requires 'featureKey' option");return Eb({featureKey:n.featureKey})}};function Ab(n,e={}){let t=Cb[n];if(!t)throw new Error(`Unknown config fetcher type: ${n}. Supported: ${Object.keys(Cb).join(", ")}`);return t(e)}var Rb="syntro_session_metrics",Al=class{constructor(e={}){this.metrics=new Map;this.subscribers=new Set;this.experiments=e.experiments,this.attributePrefix=e.attributePrefix??"session_",this.onMetricChange=e.onMetricChange,this.loadFromStorage()}increment(e,t=1){let i=(this.metrics.get(e)??0)+t;return this.metrics.set(e,i),this.saveToStorage(),this.updateExperimentAttributes(e,i),this.onMetricChange?.(e,i),this.notifySubscribers(),i}set(e,t){this.metrics.set(e,t),this.saveToStorage(),this.updateExperimentAttributes(e,t),this.onMetricChange?.(e,t),this.notifySubscribers()}get(e){return this.metrics.get(e)??0}meetsThreshold(e,t){return this.get(e)>=t}getAll(){return Object.fromEntries(this.metrics)}reset(e){this.metrics.delete(e),this.saveToStorage(),this.updateExperimentAttributes(e,0),this.onMetricChange?.(e,0),this.notifySubscribers()}resetAll(){let e=Array.from(this.metrics.keys());this.metrics.clear(),this.saveToStorage();let t={};for(let r of e)t[`${this.attributePrefix}${r}`]=0,this.onMetricChange?.(r,0);this.experiments?.setAttributes?.(t),this.notifySubscribers()}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}destroy(){this.subscribers.clear()}setExperiments(e){this.experiments=e,this.syncAllToExperiments()}updateExperimentAttributes(e,t){if(!this.experiments?.setAttributes)return;let r=`${this.attributePrefix}${e}`;this.experiments.setAttributes({[r]:t})}syncAllToExperiments(){if(!this.experiments?.setAttributes)return;let e={};for(let[t,r]of this.metrics)e[`${this.attributePrefix}${t}`]=r;this.experiments.setAttributes(e)}notifySubscribers(){for(let e of this.subscribers)try{e()}catch{}}loadFromStorage(){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{let e=sessionStorage.getItem(Rb);if(e){let t=JSON.parse(e);for(let[r,i]of Object.entries(t))this.metrics.set(r,i.count)}}catch(e){console.warn("[SessionMetricTracker] Failed to load from sessionStorage:",e)}}saveToStorage(){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{let e={};for(let[t,r]of this.metrics)e[t]={count:r,lastUpdated:Date.now()};sessionStorage.setItem(Rb,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function Qd(n={}){return new Al(n)}var Rl=class{constructor(e){this.unsubUnload=null;this.unsubLoad=null;this.destroyed=!1;this.adapter=e}activate(){this.destroyed||(this.unsubUnload=this.adapter.onRegionWillUnload(e=>{this.hideContentInSection(e)}),this.unsubLoad=this.adapter.onRegionDidLoad(e=>{this.revealContentInSection(e)}))}destroy(){this.destroyed=!0,this.unsubUnload?.(),this.unsubLoad?.(),this.unsubUnload=null,this.unsubLoad=null}hideContentInSection(e){let t=this.sectionSelector(e),r=document.querySelectorAll(`${t} [data-syntro-action-id]`);for(let i of r)i.style.opacity="0",i.style.transition="none"}revealContentInSection(e){let t=this.sectionSelector(e);requestAnimationFrame(()=>{if(this.destroyed)return;let r=document.querySelectorAll(`${t} [data-syntro-action-id]`);for(let i of r)i.style.transition="opacity 120ms ease-in",i.style.opacity="1"})}sectionSelector(e){let t=typeof CSS<"u"?CSS.escape(e):e;return document.getElementById(`shopify-section-${e}`)?`#shopify-section-${t}`:`.shopify-section[id$="-${t}"]`}};var Tl=class{constructor(e){this.name="shopify";this.loadCallbacks=new Set;this.unloadCallbacks=new Set;this.abortController=null;this.antiFlicker=null;this.initTimeoutMs=e?.initTimeoutMs??3e3}detect(){return typeof window>"u"||typeof document>"u"?!1:!!("Shopify"in window&&window.Shopify!=null||document.querySelector('meta[name="shopify-checkout-api-token"]'))}async onInit(){this.abortController=new AbortController;let{signal:e}=this.abortController;this.attachSectionListeners(e),this.antiFlicker=new Rl(this),this.antiFlicker.activate(),await this.waitForInitialSections(this.initTimeoutMs,e)}onRegionDidLoad(e){return this.loadCallbacks.add(e),()=>{this.loadCallbacks.delete(e)}}onRegionWillUnload(e){return this.unloadCallbacks.add(e),()=>{this.unloadCallbacks.delete(e)}}onRegionMutated(e){}getAnchorScope(e){let t=e.closest(".shopify-section");return t?.id?`#${typeof CSS<"u"?CSS.escape(t.id):t.id} `:""}destroy(){this.antiFlicker?.destroy(),this.antiFlicker=null,this.abortController&&(this.abortController.abort(),this.abortController=null),this.loadCallbacks.clear(),this.unloadCallbacks.clear()}attachSectionListeners(e){document.addEventListener("shopify:section:load",t=>{let r=t.detail?.sectionId;if(r)for(let i of this.loadCallbacks)try{i(r)}catch{}},{signal:e}),document.addEventListener("shopify:section:unload",t=>{let r=t.detail?.sectionId;if(r)for(let i of this.unloadCallbacks)try{i(r)}catch{}},{signal:e})}waitForInitialSections(e,t){return new Promise(r=>{if(document.querySelector(".shopify-section")){r();return}let i=!1,s=()=>{i||(i=!0,r())};document.addEventListener("shopify:section:load",()=>s(),{once:!0,signal:t});let o=setTimeout(s,e);t.addEventListener("abort",()=>{clearTimeout(o),s()},{once:!0})})}};var fA=[()=>new Tl];function Tb(){for(let n of fA){let e=n();if(e.detect())return e}return null}var ep="syntro_experiments";var mA=720*60*60,Il=class{constructor(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie()}updateContext(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie()}destroy(){document.cookie=`${ep}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; SameSite=Lax`}writeCookie(){let e={version:1,distinct_id:this.context.distinctId,telemetry_host:this.context.telemetryHost,telemetry_key:this.context.telemetryKey},t=encodeURIComponent(JSON.stringify(e)),r=`${ep}=${t}; max-age=${mA}; path=/; SameSite=Lax`;document.cookie=r}};function vA(){let n=Date.now();return{page:{url:typeof window<"u"?window.location.href:"",title:typeof document<"u"?document.title:void 0},session:{sessionId:"",startTs:n,pageHistory:[]},viewport:{width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0}}}function tp(n,e){if(!e)return;let t;try{t=new URL(n).pathname}catch{t=n}if(e.exclude){for(let r of e.exclude)if(Ib(t,r))return}if(e.include){for(let r of e.include)if(Ib(t,r))return r;return}return t}function Ib(n,e){let t=n.replace(/\/$/,"")||"/",r=e.replace(/\/$/,"")||"/";if(t===r)return!0;let i=r.replace(/:[^/]+/g,"[^/]+").replace(/\*/g,".*");return new RegExp(`^${i}$`).test(t)}var $l=class{constructor(e){this.listeners=new Set;this.cleanupFns=[];if(this.telemetry=e.telemetry,this.routes=e.routes,this.navigation=e.navigation,this.context=vA(),this.previousContext={...this.context},e.telemetry?.getSessionId){let t=e.telemetry.getSessionId();t&&(this.context.session.sessionId=t)}e.initialPageHistory&&(this.context.session.pageHistory=e.initialPageHistory),this.context.page.routeId=tp(this.context.page.url,this.routes),this.addPageToHistory(this.context.page.url),typeof window<"u"&&this.setupBrowserListeners()}get(){return{...this.context}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setRoutes(e){this.routes=e;let t=tp(this.context.page.url,this.routes);t!==this.context.page.routeId&&this.updateContext({page:{...this.context.page,routeId:t}})}setAnchors(e){this.updateContext({anchors:e})}setSessionId(e){e!==this.context.session.sessionId&&this.updateContext({session:{...this.context.session,sessionId:e}})}destroy(){for(let e of this.cleanupFns)e();this.cleanupFns=[],this.listeners.clear()}setupBrowserListeners(){let e,t=()=>{clearTimeout(e),e=setTimeout(()=>{this.updateViewport()},100)};window.addEventListener("resize",t),this.cleanupFns.push(()=>window.removeEventListener("resize",t));let r=this.navigation.subscribe(()=>this.updatePage());this.cleanupFns.push(r)}updateViewport(){let e={width:window.innerWidth,height:window.innerHeight};(e.width!==this.context.viewport.width||e.height!==this.context.viewport.height)&&this.updateContext({viewport:e})}updatePage(){let e=window.location.href,{title:t}=document,r=tp(e,this.routes),i={url:e,title:t,routeId:r};(i.url!==this.context.page.url||i.title!==this.context.page.title||i.routeId!==this.context.page.routeId)&&(i.url!==this.context.page.url&&this.addPageToHistory(i.url),this.updateContext({page:i}))}addPageToHistory(e){let t={url:e,ts:Date.now()},r=[...this.context.session.pageHistory||[],t];r.length>50&&r.shift(),this.context.session.pageHistory=r}updateContext(e){this.previousContext={...this.context},this.context={...this.context,...e},this.notifyListeners()}notifyListeners(){for(let e of this.listeners)try{e(this.context,this.previousContext)}catch(t){console.error("[ContextManager] Listener error:",t)}}};function np(n){return new $l(n)}function $b(n,e){let{context:t,state:r,events:i}=e;switch(n.type){case"page_url":{let{url:s}=n,o=t.page.url.split("?")[0].split("#")[0],a=s.replace(/\*\*/g,"\0GLOBSTAR\0").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\0GLOBSTAR\0/g,".*");return new RegExp(`^${a}$`).test(o)}case"route":return t.page.routeId===n.routeId;case"anchor_visible":{let s=t.anchors?.find(o=>o.anchorId===n.anchorId);switch(n.state){case"visible":return s?.visible===!0;case"present":return s?.present===!0;case"absent":return!s?.present;default:return!1}}case"event_occurred":{if(!i)return!1;let s=n.withinMs??6e4;return i.hasRecentEvent(n.eventName,s)}case"state_equals":return r?.getValue?r.getValue(n.key)===n.value:!1;case"viewport":{let{width:s,height:o}=t.viewport;return!(n.minWidth!==void 0&&s<n.minWidth||n.maxWidth!==void 0&&s>n.maxWidth||n.minHeight!==void 0&&o<n.minHeight||n.maxHeight!==void 0&&o>n.maxHeight)}case"session_metric":{let s=e.sessionMetrics?e.sessionMetrics.get(n.key):r?.getSessionMetric(n.key);if(s===void 0)return!1;let{operator:o,threshold:a}=n;switch(o){case"gte":return s>=a;case"lte":return s<=a;case"eq":return s===a;case"gt":return s>a;case"lt":return s<a;default:return!1}}case"dismissed":{if(!r)return n.inverted??!1;let s=r.isDismissed(n.key);return n.inverted?!s:s}case"cooldown_active":{if(!r)return n.inverted??!1;let s=r.isCooldownActive(n.key);return n.inverted?!s:s}case"frequency_limit":{if(!r)return n.inverted??!1;let o=r.getFrequencyCount(n.key)>=n.limit;return n.inverted?!o:o}case"event_count":{if(!e.accumulator)return!1;let s=n,o=e.accumulator.getCount(s.key,s.withinMs);switch(s.operator){case"gte":return o>=s.count;case"lte":return o<=s.count;case"eq":return o===s.count;case"gt":return o>s.count;case"lt":return o<s.count;default:return!1}}default:return console.warn("[RuleStrategy] Unknown condition type:",n.type),!1}}function Mb(n,e){let t=[];for(let r of n.conditions){let i=$b(r,e);if(t.push({condition:r,result:i}),!i)return{matched:!1,conditionResults:t}}return{matched:!0,conditionResults:t}}function Ml(n,e){for(let t=0;t<n.rules.length;t++){let r=n.rules[t],{matched:i,conditionResults:s}=Mb(r,e);if(i)return{value:r.value,isFallback:!1,matchInfo:{strategyType:"rules",matchedRuleIndex:t,evaluatedConditions:s}}}return{value:n.default,isFallback:!0,matchInfo:{strategyType:"rules"}}}function Pl(n,e){let{context:t}=e,r=t.augmented?.[n.field];return r===void 0||typeof r!="number"?{value:n.below,isFallback:!0,matchInfo:{strategyType:"score"}}:{value:r>=n.threshold?n.above:n.below,isFallback:!1,matchInfo:{strategyType:"score"}}}function Pb(n,e){let{state:t,events:r,sessionMetrics:i,accumulator:s}=e;return{context:n,state:t?{isDismissed:o=>t.dismissals.isDismissed(o),isCooldownActive:o=>t.cooldowns.isActive(o),getFrequencyCount:o=>t.frequency.count(o),getSessionMetric:o=>i?.get(o)??0,getValue:o=>t.session.get(o)??t.user.get(o)}:void 0,sessionMetrics:i?{get:o=>i.get(o)??0}:void 0,events:r?{hasRecentEvent:(o,a)=>r.hasRecentEvent(o,a)}:void 0,accumulator:s?{getCount:(o,a)=>s.getCount(o,a)}:void 0}}async function Ob(n,e,t={}){let r=Pb(e,t);switch(n.type){case"rules":return Ml(n,r);case"score":return Pl(n,r);case"model":return{value:n.default,isFallback:!0,matchInfo:{strategyType:"model"}};case"external":return{value:n.default,isFallback:!0,matchInfo:{strategyType:"external"}};default:return console.warn("[DecisionEngine] Unknown strategy type:",n.type),{value:void 0,isFallback:!0,matchInfo:{strategyType:n.type}}}}function Nb(n,e,t={}){let r=Pb(e,t);switch(n.type){case"rules":return Ml(n,r);case"score":return Pl(n,r);case"model":case"external":return{value:n.default,isFallback:!0,matchInfo:{strategyType:n.type}};default:return{value:void 0,isFallback:!0,matchInfo:{strategyType:n.type}}}}function rp(n){return{evaluate:(e,t)=>Ob(e,t,n),evaluateSync:(e,t)=>Nb(e,t,n)}}function ip(n){let{eventBus:e,stateStore:t}=n,r=new Map,i=new Set,s=null,o=t.ns("accumulator");function a(c){let u=!1;for(let d of r.values()){if(!d.predicate(c))continue;let h=o.get(d.stateKey)||{count:0};h.count++,d.needsTimestamps&&(h.timestamps||(h.timestamps=[]),h.timestamps.push(c.ts),h.timestamps.length>200&&(h.timestamps=h.timestamps.slice(-200))),o.set(d.stateKey,h),u=!0}if(u)for(let d of i)try{d()}catch(h){console.error("[EventAccumulator] Subscriber error:",h)}}function l(){s||r.size===0||(s=e.subscribe(a))}return{register(c,u,d=!1){let h=`ev:${c}`,g=r.get(h);if(g){d&&!g.needsTimestamps&&(g.needsTimestamps=!0);return}r.set(h,{stateKey:h,needsTimestamps:d,predicate:u}),l()},getCount(c,u){let d=`ev:${c}`,h=o.get(d);if(!h)return 0;if(u===void 0||!h.timestamps)return h.count;let g=Date.now()-u;return h.timestamps.filter(v=>v>=g).length},subscribe(c){return i.add(c),()=>{i.delete(c)}},destroy(){s&&(s(),s=null),r.clear(),i.clear()}}}var po=class{constructor(){this.listeners=new Set;this.destroyed=!1;this.onPopState=()=>{this.notify(window.location.href,"popstate")};this.wasNative=this.isNativeFunction(history.pushState),this.capturedPushState=history.pushState,this.capturedReplaceState=history.replaceState,history.pushState=(...e)=>{this.capturedPushState.call(history,...e),queueMicrotask(()=>this.notify(window.location.href,"pushState"))},history.replaceState=(...e)=>{this.capturedReplaceState.call(history,...e),queueMicrotask(()=>this.notify(window.location.href,"replaceState"))},window.addEventListener("popstate",this.onPopState)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}diagnose(){return{isNative:this.wasNative,subscriberCount:this.listeners.size}}destroy(){this.destroyed||(this.destroyed=!0,history.pushState=this.capturedPushState,history.replaceState=this.capturedReplaceState,window.removeEventListener("popstate",this.onPopState),this.listeners.clear())}notify(e,t){if(!this.destroyed)for(let r of this.listeners)try{r(e,t)}catch{}}isNativeFunction(e){try{return Function.prototype.toString.call(e).includes("[native code]")}catch{return!1}}};var sp="cooldown:";function Lb(n){return{set(e,t){let r=sp+e,i=Date.now()+t;n.set(r,i)},isActive(e){return this.remaining(e)>0},remaining(e){let t=sp+e,r=n.get(t);if(r===void 0)return 0;let i=r-Date.now();return i<=0?(n.remove(t),0):i},clear(e){let t=sp+e;n.remove(t)}}}var ho="dismissed:";function Fb(n,e){return{mark(t,r=!1){let i=ho+t;(r?e:n).set(i,!0)},isDismissed(t){let r=ho+t;return n.has(r)||e.has(r)},clear(t){let r=ho+t;n.remove(r),e.remove(r)},clearAll(){for(let t of n.keys())t.startsWith(ho)&&n.remove(t);for(let t of e.keys())t.startsWith(ho)&&e.remove(t)}}}var op="freq:";function Db(n){function e(t){let r=op+t,i=n.get(r);if(i){if(i.resetAt&&Date.now()>=i.resetAt){n.remove(r);return}return i}}return{increment(t,r){let i=op+t,s=e(t),o=(s?.count??0)+1,a={count:o,resetAt:s?.resetAt??(r?Date.now()+r:void 0)};return n.set(i,a),o},count(t){return e(t)?.count??0},reset(t){let r=op+t;n.remove(r)},hasReachedLimit(t,r){return this.count(t)>=r}}}var yA="syntro";function ap(n,e){let t=`${e}:`;return{get(r){if(n)try{let i=n.getItem(t+r);if(!i)return;let s=JSON.parse(i);if(s.expiresAt&&Date.now()>=s.expiresAt){n.removeItem(t+r);return}return s.value}catch{return}},set(r,i,s){if(n)try{let o={value:i,expiresAt:s?Date.now()+s:void 0};n.setItem(t+r,JSON.stringify(o))}catch(o){console.warn("[StateStore] Failed to save:",o)}},remove(r){n&&n.removeItem(t+r)},has(r){return n?this.get(r)!==void 0:!1},keys(){if(!n)return[];let r=[];for(let i=0;i<n.length;i++){let s=n.key(i);s?.startsWith(t)&&r.push(s.slice(t.length))}return r},clear(){if(!n)return;let r=this.keys();for(let i of r)n.removeItem(t+i)}}}function fo(n){let e=new Map,t=`${n}:`;return{get(r){let i=e.get(t+r);if(i){if(i.expiresAt&&Date.now()>=i.expiresAt){e.delete(t+r);return}return i.value}},set(r,i,s){e.set(t+r,{value:i,expiresAt:s?Date.now()+s:void 0})},remove(r){e.delete(t+r)},has(r){return this.get(r)!==void 0},keys(){let r=[];for(let i of e.keys())i.startsWith(t)&&r.push(i.slice(t.length));return r},clear(){for(let r of e.keys())r.startsWith(t)&&e.delete(r)}}}var Ol=class{constructor(e={}){this.namespacedStorages=new Map;this.namespace=e.namespace??yA;let t=r=>typeof r=="object"&&r!==null&&typeof r.setItem=="function";typeof window<"u"?(this.session=t(window.sessionStorage)?ap(window.sessionStorage,this.namespace):fo(this.namespace),this.user=t(window.localStorage)?ap(window.localStorage,this.namespace):fo(this.namespace)):(this.session=fo(this.namespace),this.user=fo(this.namespace)),this.dismissals=Fb(this.session,this.user),this.cooldowns=Lb(this.user),this.frequency=Db(this.session)}ns(e){let t=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(t)){let r=typeof window<"u"&&typeof sessionStorage<"u"?ap(sessionStorage,t):fo(t);this.namespacedStorages.set(t,r)}return this.namespacedStorages.get(t)}};function lp(n={}){return new Ol(n)}function go(n){return n.startsWith("inline:")?"inline":n.startsWith("adjacent:")?"adjacent":"static"}function Nl(n){return n.startsWith("inline:")?n.slice(7):n.startsWith("adjacent:")?n.slice(9):null}var Hb={drawer_right:{position:"fixed",top:"0",right:"0",bottom:"0",width:"360px",maxWidth:"90vw"},drawer_left:{position:"fixed",top:"0",left:"0",bottom:"0",width:"360px",maxWidth:"90vw"},drawer_bottom:{position:"fixed",left:"0",right:"0",bottom:"0",maxHeight:"50vh"},overlay_center:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxWidth:"90vw",maxHeight:"90vh"},overlay_corner_br:{position:"fixed",bottom:"16px",right:"16px",maxWidth:"400px",maxHeight:"80vh"},overlay_corner_bl:{position:"fixed",bottom:"16px",left:"16px",maxWidth:"400px",maxHeight:"80vh"},toast_top:{position:"fixed",top:"16px",left:"50%",transform:"translateX(-50%)",maxWidth:"90vw"},toast_bottom:{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",maxWidth:"90vw"}},mo={fade:[{opacity:0},{opacity:1}],slide:[{opacity:0,transform:"translateY(10px)"},{opacity:1,transform:"translateY(0)"}],scale:[{opacity:0,transform:"scale(0.95)"},{opacity:1,transform:"scale(1)"}],none:[]},Bb={duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"};function cp(n,e,t){let r=Hb[e];Object.assign(n.style,r),t&&(t.maxWidth&&(n.style.maxWidth=t.maxWidth),t.maxHeight&&(n.style.maxHeight=t.maxHeight),t.minWidth&&(n.style.minWidth=t.minWidth),t.minHeight&&(n.style.minHeight=t.minHeight))}function up(n,e,t){let r=t.placement==="auto"?"bottom":t.placement,i=[Gr(t.offset?{mainAxis:t.offset.y,crossAxis:t.offset.x}:8)];return t.flip!==!1&&i.push(Yr()),t.shift!==!1&&i.push(Kr({padding:8})),n.style.position="absolute",n.style.zIndex="2147483646",Zr(e,n,async()=>{let{x:o,y:a,strategy:l}=await Xr(e,n,{placement:r,middleware:i});Object.assign(n.style,{position:l,left:`${o}px`,top:`${a}px`})})}function dp(n,e,t="append"){return n.style.position="relative",n.style.display="inline-block",t==="prepend"?e.insertBefore(n,e.firstChild):e.appendChild(n),()=>{n.remove()}}function pp(n,e){return e==="none"||mo[e].length===0?null:n.animate(mo[e],Bb)}function hp(n,e){if(e==="none"||mo[e].length===0)return Promise.resolve();let t=[...mo[e]].reverse(),r=n.animate(t,Bb);return new Promise(i=>{r.onfinish=()=>i(),r.oncancel=()=>i()})}function fp(n,e){let t=document.createElement("div");return t.setAttribute("data-syntro-surface",n),t.setAttribute("data-syntro-mount-id",e),t.className="syntro-surface",Object.assign(t.style,{pointerEvents:"auto",boxSizing:"border-box",overflow:"auto"}),t}function gp(n){switch(go(n)){case"static":return n.startsWith("drawer")?2147483640:n.startsWith("overlay")?2147483642:n.startsWith("toast")?2147483644:2147483640;case"inline":return 1;case"adjacent":return 2147483638;default:return 2147483640}}function Vb(n){if(typeof window.Sanitizer=="function")try{let l=new window.Sanitizer({}).sanitizeToFragment(n),c=document.createElement("div");return c.append(l),c.innerHTML}catch{}let t=document.createElement("template");t.innerHTML=n;let r=t.content,i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,null),s=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button"]),o=[];for(;i.nextNode();){let a=i.currentNode,l=a.tagName.toLowerCase();if(!s.has(l)){o.push(a);continue}for(let c of Array.from(a.attributes)){let u=c.name.toLowerCase(),d=c.value.trim().toLowerCase(),h=u.startsWith("on"),g=(u==="href"||u==="src")&&d.startsWith("javascript:");(h||g)&&a.removeAttribute(c.name)}}for(let a of o){for(;a.firstChild;)a.parentNode?.insertBefore(a.firstChild,a);a.remove()}return t.innerHTML=(r.firstChild,t.innerHTML)}var bA=0;function mp(n){let{overlayRoot:e,eventBus:t,anchorResolver:r,defaultAnimation:i="fade",widgetRegistry:s}=n,o=new Map,a=new Map,l=new Map;function c(){return`mount-${++bA}`}function u(b,x){t&&t.publish(b,x)}function d(b){let x=l.get(b);if(x){let R=m(b);for(let w of x)try{w(R)}catch(E){console.error("[Surfaces] State callback error:",E)}}}let h=new Map;function g(b,x,R){switch(x.type){case"html":b.innerHTML=Vb(x.content);return;case"widget":{if(s?.has(x.widgetId)){let w=s.mount(x.widgetId,b,x.config);return R&&h.set(R,w),()=>{w.unmount(),R&&h.delete(R)}}console.warn(`[Surfaces] Widget not found: ${x.widgetId}`),b.innerHTML=`<div data-widget-id="${x.widgetId}" data-widget-missing="true">Widget: ${x.widgetId}</div>`;return}case"custom":return x.mount(b);case"react":b.innerHTML="<div data-react-component>React Component</div>";return;default:console.warn("[Surfaces] Unknown content type");return}}function v(b,x,R){let w=c(),E=go(b),$=R?.priority??0,P=R?.animation??i,M=R?.exclusive??!0,G=o.get(b);if(G&&M){if(G.options.priority>$)throw new Error(`Slot ${b} is occupied by higher priority content (${G.options.priority} > ${$})`);f(G)}let L=fp(b,w);L.style.zIndex=String(gp(b));let N;if(E==="static")cp(L,b,R?.constraints),e.appendChild(L);else if(E==="inline"){let A=Nl(b);if(!A)throw new Error(`Invalid inline slot: ${b}`);if(!r)throw new Error("Anchor resolver required for inline slots");let F=r({selector:A,route:"**"});if(!F)throw new Error(`Anchor not found for inline slot: ${A}`);N=dp(L,F)}else if(E==="adjacent"){let A=Nl(b);if(!A)throw new Error(`Invalid adjacent slot: ${b}`);if(!r)throw new Error("Anchor resolver required for adjacent slots");let F=r({selector:A,route:"**"});if(!F)throw new Error(`Anchor not found for adjacent slot: ${A}`);e.appendChild(L),N=up(L,F,R?.position??{placement:"bottom"})}let z=g(L,x,w);pp(L,P);let H={id:w,slot:b,content:x,options:{priority:$,exclusive:M,animation:P,position:R?.position??{placement:"auto"},constraints:R?.constraints??{},adaptiveId:R?.adaptiveId,autoUnmountOnRouteChange:R?.autoUnmountOnRouteChange??!0},container:L,cleanup:()=>{N?.(),z?.()},mountedAt:Date.now()};return o.set(b,H),a.set(b,(a.get(b)??0)+1),u("surface.mounted",{slot:b,id:w,adaptiveId:R?.adaptiveId}),d(b),{id:w,update(A){let F=o.get(b);if(!F||F.id!==w)throw new Error("Mount no longer active");let X=h.get(w);if(X){if(A.type==="widget"){X.update(A.config),F.content=A;return}X.unmount(),h.delete(w)}F.container.innerHTML="";let fe=g(F.container,A,w);if(F.content=A,fe){let de=F.cleanup;F.cleanup=()=>{de?.(),fe()}}},setOptions(A){let F=o.get(b);if(!F||F.id!==w)throw new Error("Mount no longer active");A.priority!==void 0&&(F.options.priority=A.priority),A.animation!==void 0&&(F.options.animation=A.animation),A.constraints&&E==="static"&&(A.constraints.maxWidth&&(F.container.style.maxWidth=A.constraints.maxWidth),A.constraints.maxHeight&&(F.container.style.maxHeight=A.constraints.maxHeight),A.constraints.minWidth&&(F.container.style.minWidth=A.constraints.minWidth),A.constraints.minHeight&&(F.container.style.minHeight=A.constraints.minHeight)),d(b)},async unmount(){let A=o.get(b);!A||A.id!==w||await f(A)},isMounted(){return o.get(b)?.id===w},getContainer(){let A=o.get(b);return A?.id===w?A.container:null}}}async function f(b){b.container.isConnected&&await hp(b.container,b.options.animation);try{b.cleanup?.()}catch(x){console.warn("[Surfaces] Cleanup error during unmount, ignoring:",x)}try{b.container.remove()}catch{}o.delete(b.slot),u("surface.unmounted",{slot:b.slot,id:b.id}),d(b.slot)}function m(b){let x=o.get(b);return{slot:b,occupied:!!x,currentPriority:x?.options.priority,currentAdaptiveId:x?.options.adaptiveId,mountCount:a.get(b)??0,currentMountId:x?.id}}function y(b,x){let R=l.get(b);return R||(R=new Set,l.set(b,R)),R.add(x),()=>{R?.delete(x),R?.size===0&&l.delete(b)}}function k(b,x){let R=o.get(b);return R?x!==void 0?x>=R.options.priority:!1:!0}function _(){for(let b of o.values())try{b.cleanup?.(),b.container.remove()}catch(x){console.error("[Surfaces] Error during cleanup:",x)}o.clear(),l.clear()}return{mount:v,getState:m,onStateChange:y,canMount:k,destroy:_}}var Ll=class{constructor(){this.widgets=new Map;this.mountedWidgets=new Map;this.mountIdCounter=0;this.listeners=new Set}bindRuntime(e){this.runtimeRef=e}register(e,t,r="custom",i){if(this.widgets.has(e)){if(this.widgets.get(e).source==="built-in")throw new Error(`Cannot override built-in widget: ${e}`);console.warn(`[WidgetRegistry] Overriding widget: ${e}`)}this.widgets.set(e,{id:e,widget:t,source:r,metadata:i}),this.notify({type:"registered",widgetId:e})}unregister(e){let t=this.widgets.get(e);return t?t.source==="built-in"?(console.warn(`[WidgetRegistry] Cannot unregister built-in widget: ${e}`),!1):(this.widgets.delete(e),this.notify({type:"unregistered",widgetId:e}),!0):!1}unregisterBySource(e){for(let[t,r]of this.widgets.entries())r.source===e&&this.widgets.delete(t)}get(e){return this.widgets.get(e)?.widget}getRegistration(e){return this.widgets.get(e)}has(e){return this.widgets.has(e)}mount(e,t,r){let i=this.widgets.get(e);if(!i)throw new Error(`Widget not found: ${e}`);let s=`widget-mount-${++this.mountIdCounter}`;t.setAttribute("data-widget-mount-id",s),t.setAttribute("data-widget-id",e);let o={...r,runtime:this.runtimeRef},a=i.widget.mount(t,o);return this.mountedWidgets.set(s,{cleanup:a??void 0,container:t}),{widgetId:e,container:t,unmount:()=>{let c=this.mountedWidgets.get(s);c&&(t.isConnected&&c.cleanup?.(),this.mountedWidgets.delete(s),t.removeAttribute("data-widget-mount-id"),t.removeAttribute("data-widget-id"),t.innerHTML="")},update:c=>{if(i.widget.update)i.widget.update(t,c);else{let u=this.mountedWidgets.get(s);if(u){u.cleanup?.(),t.innerHTML="";let d={...c,runtime:this.runtimeRef},h=i.widget.mount(t,d);u.cleanup=h??void 0}}}}}list(){return Array.from(this.widgets.keys())}listRegistrations(){return Array.from(this.widgets.values())}getBySource(e){return Array.from(this.widgets.values()).filter(t=>t.source===e)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(e){for(let t of this.listeners)try{t(e)}catch(r){console.error("[WidgetRegistry] Listener error:",r)}}destroy(){for(let[e,t]of this.mountedWidgets.entries())t.cleanup?.(),t.container.innerHTML="";this.mountedWidgets.clear()}},vp=new Ll;var jb="2.0.0";function _A(n,e){if(!e)return!0;let t;try{t=new URL(n).pathname}catch{t=n}let r=t.replace(/\/$/,"")||"/";if(e.exclude){for(let i of e.exclude)if(yp(r,i))return!1}if(e.include&&e.include.length>0){for(let i of e.include)if(yp(r,i))return!0;return!1}return!0}function yp(n,e){let t=e.replace(/\/$/,"")||"/";if(n===t)return!0;let r=t.replace(/\*\*/g,"\0GLOBSTAR\0").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\0GLOBSTAR\0/g,".*").replace(/:[^/]+/g,"[^/]+");return new RegExp(`^${r}$`).test(n)}function Wb(n){let t=(typeof window<"u"?window.location.pathname:"/").replace(/\/$/,"")||"/";return(Array.isArray(n.route)?n.route:[n.route]).some(i=>{let s=i;if(/^https?:\/\//.test(s))try{s=new URL(s).pathname}catch{}return yp(t,s)})}function bp(n={}){let{telemetry:e,sessionMetrics:t,routes:r,mode:i="production",namespace:s}=n,o=n.widgets??vp,a=n.executors??rn,l=n.apps??ys,c=new po,u=np({telemetry:e,routes:r,navigation:c}),d=n.events??ro(),h=lp({namespace:s}),g=ip({eventBus:d,stateStore:h}),v=rp({state:h,events:d,sessionMetrics:t,accumulator:g}),f=Ty(),m=wd(),y=M=>Wb(M)?m.resolve(M.selector):null,k=async(M,G)=>{if(!Wb(M))return null;try{return await m.waitFor(M.selector,G)}catch{return null}},_=mp({overlayRoot:f,eventBus:d,anchorResolver:y,widgetRegistry:o}),b=id({overlayRoot:f,eventBus:d,surfaces:_,anchorResolver:y,waitForAnchor:k,executorRegistry:a,subscribeNavigation:M=>c.subscribe(M),runtime:{evaluateSync:M=>v.evaluateSync(M,u.get()),context:u,accumulator:g,sessionMetrics:t,events:d?{subscribe:M=>d.subscribe(()=>M())}:void 0}}),x;if(t){let M=t;M.increment("page_views");let G=typeof window<"u"?window.location.pathname:"/";x=c.subscribe((L,N)=>{if(N!=="replaceState")try{let z=new URL(L).pathname;z!==G&&(G=z,M.increment("page_views"),R=0,M.set("time_on_page",0),M.set("scroll_depth",0))}catch{}})}let R=0,w,E;if(t){let M=t;w=setInterval(()=>{R++},1e3),E=setInterval(()=>{M.set("time_on_page",R)},5e3)}let $;if(t&&d){let M=t;$=d.subscribe({names:["ui.scroll"]},G=>{let L=G.props?.scrollPercentage;typeof L=="number"&&L>M.get("scroll_depth")&&M.set("scroll_depth",L)})}let P={telemetry:e,context:u,events:d,state:h,sessionMetrics:t,actions:b,surfaces:_,widgets:o,executors:a,apps:l,accumulator:g,anchorResolver:m,navigation:c,version:jb,mode:i,async evaluate(M){return v.evaluate(M,u.get())},evaluateSync(M){return v.evaluateSync(M,u.get())},async filterTiles(M){let G=u.get().page.url,L=[];for(let N of M){let z=N.activation;if(!z){L.push(N);continue}if(_A(G,z.routes)){if(z.onlyIfPopulated){let H=N.props?.actions??[];if(H.length>0&&!H.some(A=>A.triggerWhen?v.evaluateSync(A.triggerWhen,u.get()).value:!0))continue}L.push(N)}}return L},setRoutes(M){u.setRoutes(M)},destroy(){l.unbind().catch(M=>{console.error("[Runtime] Error unbinding apps registry:",M)}),x?.(),$?.(),w&&clearInterval(w),E&&clearInterval(E),m.destroy(),g.destroy(),c.destroy(),u.destroy(),b.destroy(),_.destroy()}};return l.bind(P),o.bindRuntime(P),P}var vo=class{constructor(e,t){this.seenSet=new Set;this.triggeredSet=new Set;this.telemetry=e,this.variantId=t}trackServed(e,t){this.telemetry.track?.("syntro_config_served",{variant_id:this.variantId,tiles:e,actions:t})}trackSeen(e,t){this.seenSet.has(e)||(this.seenSet.add(e),this.telemetry.track?.("syntro_intervention_seen",{variant_id:this.variantId,intervention_id:e,intervention_kind:t}))}trackTriggered(e,t){this.triggeredSet.has(e)||(this.triggeredSet.add(e),this.telemetry.track?.("syntro_intervention_triggered",{variant_id:this.variantId,intervention_id:e,intervention_kind:t}))}trackInteracted(e,t,r){this.telemetry.track?.("syntro_intervention_interacted",{variant_id:this.variantId,intervention_id:e,intervention_kind:t,interaction_type:r})}resetPage(){this.seenSet.clear(),this.triggeredSet.clear()}};function xA(){let n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let t=0;t<16;t++)e+=n[Math.floor(Math.random()*n.length)];return e}var _p=class{constructor(){this.sessionId=xA(),console.log(`[Syntro Telemetry] Using noop adapter (no telemetry configured). sessionId=${this.sessionId}`)}trackCanvasOpened(e){}trackCanvasClosed(e){}trackRectangleViewed(e,t){}trackAction(e,t,r){}register(e){}getSessionId(){return this.sessionId}startSessionRecording(){}trackExperiment(e,t,r){}setPersonProperties(e){}setPersonPropertiesOnce(e){}getDistinctId(){return"demo-user"}getAllFeatureFlags(){return{}}getSegmentFlags(){return{}}track(e,t){}};function xp(){return new _p}var C=typeof window<"u"?window:void 0,qe=typeof globalThis<"u"?globalThis:C;typeof self>"u"&&(qe.self=qe),typeof File>"u"&&(qe.File=function(){});var H_=Array.prototype,Ub=H_.forEach,zb=H_.indexOf,pt=qe?.navigator,V=qe?.document,ze=qe?.location,Hp=qe?.fetch,Bp=qe!=null&&qe.XMLHttpRequest&&"withCredentials"in new qe.XMLHttpRequest?qe.XMLHttpRequest:void 0,qb=qe?.AbortController,ot=pt?.userAgent,Q=C??{},hn={DEBUG:!1,LIB_VERSION:"1.341.0"};function Zb(n,e,t,r,i,s,o){try{var a=n[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(r,i)}function Bi(n){return function(){var e=this,t=arguments;return new Promise((function(r,i){var s=n.apply(e,t);function o(l){Zb(s,r,i,o,a,"next",l)}function a(l){Zb(s,r,i,o,a,"throw",l)}o(void 0)}))}}function U(){return U=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},U.apply(null,arguments)}function B_(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var wA=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Gb=function(n,e){if(e===void 0&&(e=[]),!n)return!1;var t=n.toLowerCase();return wA.concat(e).some((r=>{var i=r.toLowerCase();return t.indexOf(i)!==-1}))},kA=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function ue(n,e){return n.indexOf(e)!==-1}var pc=function(n){return n.trim()},Vp=function(n){return n.replace(/^\$/,"")},SA=Array.isArray,V_=Object.prototype,W_=V_.hasOwnProperty,hc=V_.toString,me=SA||function(n){return hc.call(n)==="[object Array]"},qn=n=>typeof n=="function",Ne=n=>n===Object(n)&&!me(n),Vi=n=>{if(Ne(n)){for(var e in n)if(W_.call(n,e))return!1;return!0}return!1},W=n=>n===void 0,Le=n=>hc.call(n)=="[object String]",Wp=n=>Le(n)&&n.trim().length===0,Dt=n=>n===null,pe=n=>W(n)||Dt(n),bn=n=>hc.call(n)=="[object Number]"&&n==n,Di=n=>bn(n)&&n>0,yn=n=>hc.call(n)==="[object Boolean]",EA=n=>n instanceof FormData,CA=n=>ue(kA,n);function jp(n){return n===null||typeof n!="object"}function Ul(n,e){return Object.prototype.toString.call(n)==="[object "+e+"]"}function j_(n){return!W(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(n,Event)}var AA=[!0,"true",1,"1","yes"],wp=n=>ue(AA,n),RA=[!1,"false",0,"0","no"];function Kt(n,e,t,r,i){return e>t&&(r.warn("min cannot be greater than max."),e=t),bn(n)?n>t?(r.warn(" cannot be greater than max: "+t+". Using max value instead."),t):n<e?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):n:(r.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+i),Kt(i||t,e,t,r))}var Up=class{constructor(e){this.t={},this.i=e.i,this.o=Kt(e.bucketSize,0,100,e.h),this.m=Kt(e.refillRate,0,this.o,e.h),this.$=Kt(e.refillInterval,0,864e5,e.h)}S(e,t){var r=t-e.lastAccess,i=Math.floor(r/this.$);if(i>0){var s=i*this.m;e.tokens=Math.min(e.tokens+s,this.o),e.lastAccess=e.lastAccess+i*this.$}}consumeRateLimit(e){var t,r=Date.now(),i=String(e),s=this.t[i];return s?this.S(s,r):(s={tokens:this.o,lastAccess:r},this.t[i]=s),s.tokens===0||(s.tokens--,s.tokens===0&&((t=this.i)==null||t.call(this,e)),s.tokens===0)}stop(){this.t={}}},kt="Mobile",zl="iOS",vn="Android",Do="Tablet",U_=vn+" "+Do,z_="iPad",q_="Apple",Z_=q_+" Watch",Ho="Safari",zi="BlackBerry",G_="Samsung",K_=G_+"Browser",Y_=G_+" Internet",Br="Chrome",TA=Br+" OS",X_=Br+" "+zl,Jh="Internet Explorer",J_=Jh+" "+kt,Qh="Opera",IA=Qh+" Mini",ef="Edge",Q_="Microsoft "+ef,ji="Firefox",e0=ji+" "+zl,Bo="Nintendo",Vo="PlayStation",Ui="Xbox",t0=vn+" "+kt,n0=kt+" "+Ho,Ao="Windows",zp=Ao+" Phone",Kb="Nokia",qp="Ouya",r0="Generic",$A=r0+" "+kt.toLowerCase(),i0=r0+" "+Do.toLowerCase(),Zp="Konqueror",tt="(\\d+(\\.\\d+)?)",kp=new RegExp("Version/"+tt),MA=new RegExp(Ui,"i"),PA=new RegExp(Vo+" \\w+","i"),OA=new RegExp(Bo+" \\w+","i"),tf=new RegExp(zi+"|PlayBook|BB10","i"),NA={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Fl,Yb,Sp,LA=(n,e)=>e&&ue(e,q_)||(function(t){return ue(t,Ho)&&!ue(t,Br)&&!ue(t,vn)})(n),s0=function(n,e){return e=e||"",ue(n," OPR/")&&ue(n,"Mini")?IA:ue(n," OPR/")?Qh:tf.test(n)?zi:ue(n,"IE"+kt)||ue(n,"WPDesktop")?J_:ue(n,K_)?Y_:ue(n,ef)||ue(n,"Edg/")?Q_:ue(n,"FBIOS")?"Facebook "+kt:ue(n,"UCWEB")||ue(n,"UCBrowser")?"UC Browser":ue(n,"CriOS")?X_:ue(n,"CrMo")||ue(n,Br)?Br:ue(n,vn)&&ue(n,Ho)?t0:ue(n,"FxiOS")?e0:ue(n.toLowerCase(),Zp.toLowerCase())?Zp:LA(n,e)?ue(n,kt)?n0:Ho:ue(n,ji)?ji:ue(n,"MSIE")||ue(n,"Trident/")?Jh:ue(n,"Gecko")?ji:""},FA={[J_]:[new RegExp("rv:"+tt)],[Q_]:[new RegExp(ef+"?\\/"+tt)],[Br]:[new RegExp("("+Br+"|CrMo)\\/"+tt)],[X_]:[new RegExp("CriOS\\/"+tt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+tt)],[Ho]:[kp],[n0]:[kp],[Qh]:[new RegExp("(Opera|OPR)\\/"+tt)],[ji]:[new RegExp(ji+"\\/"+tt)],[e0]:[new RegExp("FxiOS\\/"+tt)],[Zp]:[new RegExp("Konqueror[:/]?"+tt,"i")],[zi]:[new RegExp(zi+" "+tt),kp],[t0]:[new RegExp("android\\s"+tt,"i")],[Y_]:[new RegExp(K_+"\\/"+tt)],[Jh]:[new RegExp("(rv:|MSIE )"+tt)],Mozilla:[new RegExp("rv:"+tt)]},DA=function(n,e){var t=s0(n,e),r=FA[t];if(W(r))return null;for(var i=0;i<r.length;i++){var s=r[i],o=n.match(s);if(o)return parseFloat(o[o.length-2])}return null},Xb=[[new RegExp(Ui+"; "+Ui+" (.*?)[);]","i"),n=>[Ui,n&&n[1]||""]],[new RegExp(Bo,"i"),[Bo,""]],[new RegExp(Vo,"i"),[Vo,""]],[tf,[zi,""]],[new RegExp(Ao,"i"),(n,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[zp,""];if(new RegExp(kt).test(e)&&!/IEMobile\b/.test(e))return[Ao+" "+kt,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var r=t[1],i=NA[r]||"";return/arm/i.test(e)&&(i="RT"),[Ao,i]}return[Ao,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,n=>{if(n&&n[3]){var e=[n[3],n[4],n[5]||"0"];return[zl,e.join(".")]}return[zl,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,n=>{var e="";return n&&n.length>=3&&(e=W(n[2])?n[3]:n[2]),["watchOS",e]}],[new RegExp("("+vn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+vn+")","i"),n=>{if(n&&n[2]){var e=[n[2],n[3],n[4]||"0"];return[vn,e.join(".")]}return[vn,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,n=>{var e=["Mac OS X",""];if(n&&n[1]){var t=[n[1],n[2],n[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[TA,""]],[/Linux|debian/i,["Linux",""]]],Jb=function(n){return OA.test(n)?Bo:PA.test(n)?Vo:MA.test(n)?Ui:new RegExp(qp,"i").test(n)?qp:new RegExp("("+zp+"|WPDesktop)","i").test(n)?zp:/iPad/.test(n)?z_:/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(n)?Z_:tf.test(n)?zi:/(kobo)\s(ereader|touch)/i.test(n)?"Kobo":new RegExp(Kb,"i").test(n)?Kb:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(n)||/(kf[a-z]+)( bui|\)).+silk\//i.test(n)?"Kindle Fire":/(Android|ZTE)/i.test(n)?new RegExp(kt).test(n)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(n)||/pixel[\daxl ]{1,6}/i.test(n)&&!/pixel c/i.test(n)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(n)||/lmy47v/i.test(n)&&!/QTAQZ3/i.test(n)?vn:U_:new RegExp("(pda|"+kt+")","i").test(n)?$A:new RegExp(Do,"i").test(n)&&!new RegExp(Do+" pc","i").test(n)?i0:""},HA=n=>n instanceof Error;function BA(n){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return Sp&&t.length===Yb||(Yb=t.length,Sp=t.reduce(((r,i)=>{Fl||(Fl={});var s=Fl[i];if(s)r[s[0]]=s[1];else for(var o=n(i),a=o.length-1;a>=0;a--){var l=o[a],c=l?.filename,u=e[i];if(c&&u){r[c]=u,Fl[i]=[c,u];break}}return r}),{})),Sp}}var Gp=class{constructor(e,t,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){t===void 0&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),s=this.buildParsingContext(),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var t=this;return Bi((function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&me(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r,i;return e.cause!=null&&(r=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),U({},e,{cause:r,stack:i})}applyChunkIds(e,t){return e.map((r=>(r.filename&&t&&(r.chunk_id=t[r.filename]),r)))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Bi((function*(){var r=e;for(var i of t.modifiers)r=yield i(r);return r}))()}convertToExceptionList(e,t){var r,i,s,o={type:e.type,value:e.value,mechanism:{type:(r=t.type)!==null&&r!==void 0?r:"generic",handled:(i=t.handled)===null||i===void 0||i,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,U({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:BA(this.stackParser)}}buildCoercingContext(e,t,r){r===void 0&&(r=0);var i=(s,o)=>{if(o<=4){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(s,a)}};return U({},t,{syntheticException:r==0?t.syntheticException:void 0,mechanism:e,apply:s=>i(s,r),next:s=>i(s,r+1)})}},qi="?";function Kp(n,e,t,r,i){var s={platform:n,filename:e,function:t==="<anonymous>"?qi:t,in_app:!0};return W(r)||(s.lineno=r),W(i)||(s.colno=i),s}var o0=(n,e)=>{var t=n.indexOf("safari-extension")!==-1,r=n.indexOf("safari-web-extension")!==-1;return t||r?[n.indexOf("@")!==-1?n.split("@")[0]:qi,t?"safari-extension:"+e:"safari-web-extension:"+e]:[n,e]},VA=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,WA=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,jA=/\((\S*)(?::(\d+))(?::(\d+))\)/,UA=(n,e)=>{var t=VA.exec(n);if(t){var[,r,i,s]=t;return Kp(e,r,qi,+i,+s)}var o=WA.exec(n);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=jA.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=o0(o[1]||qi,o[2]);return Kp(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},zA=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,qA=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ZA=(n,e)=>{var t=zA.exec(n);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var r=qA.exec(t[3]);r&&(t[1]=t[1]||"eval",t[3]=r[1],t[4]=r[2],t[5]="")}var i=t[3],s=t[1]||qi;return[s,i]=o0(s,i),Kp(e,i,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Qb=/\(error: (.*)\)/,e_=50;function GA(){return(function(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return function(i,s){s===void 0&&(s=0);for(var o=[],a=i.split(`
|
|
1160
|
+
`),l=s;l<a.length;l++){var c=a[l];if(!(c.length>1024)){var u=Qb.test(c)?c.replace(Qb,"$1"):c;if(!u.match(/\S*Error: /)){for(var d of t){var h=d(u,n);if(h){o.push(h);break}}if(o.length>=e_)break}}}return(function(g){if(!g.length)return[];var v=Array.from(g);return v.reverse(),v.slice(0,e_).map((f=>{return U({},f,{filename:f.filename||(m=v,m[m.length-1]||{}).filename,function:f.function||qi});var m}))})(o)}})("web:javascript",UA,ZA)}var Yp=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=Le(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Ul(e,"DOMException")}isDOMError(e){return Ul(e,"DOMError")}},Xp=class{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var r=e.message;return r.error&&typeof r.error.message=="string"?String(r.error.message):String(r)}getStack(e){return e.stacktrace||e.stack||void 0}},Jp=class{constructor(){}match(e){return Ul(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var r,i=t.apply(e.error);return i||{type:"ErrorEvent",value:e.message,stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},KA=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Qp=class{match(e){return typeof e=="string"}coerce(e,t){var r,[i,s]=this.getInfos(e);return{type:i??"Error",value:s??e,stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(KA);return i&&(t=i[1],r=i[2]),[t,r]}},YA=["fatal","error","warning","log","info","debug"];function a0(n,e){e===void 0&&(e=40);var t=Object.keys(n);if(t.sort(),!t.length)return"[object has no keys]";for(var r=t.length;r>0;r--){var i=t.slice(0,r).join(", ");if(!(i.length>e))return r===t.length||i.length<=e?i:i.slice(0,e)+"..."}return""}var eh=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var r,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(r=t.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return j_(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+a0(e)}isSeverityLevel(e){return Le(e)&&!Wp(e)&&YA.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];if(HA(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},th=class{match(e){return j_(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+a0(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},nh=class{match(e){return jp(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},rh=class{match(e){return Ul(e,"PromiseRejectionEvent")}coerce(e,t){var r,i=this.getUnhandledRejectionReason(e);return jp(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){if(jp(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}},l0=function(n,e){var{debugEnabled:t}=e===void 0?{}:e,r={k:function(i){if(C&&(hn.DEBUG||Q.POSTHOG_DEBUG||t)&&!W(C.console)&&C.console){for(var s=("__rrweb_original__"in C.console[i])?C.console[i].__rrweb_original__:C.console[i],o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];s(n,...a)}},info:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];r.k("log",...s)},warn:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];r.k("warn",...s)},error:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];r.k("error",...s)},critical:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];console.error(n,...s)},uninitializedWarning:i=>{r.error("You must initialize PostHog before calling "+i)},createLogger:(i,s)=>l0(n+" "+i,s)};return r},j=l0("[PostHog.js]"),Ie=j.createLogger,XA=Ie("[ExternalScriptsLoader]"),t_=(n,e,t)=>{if(n.config.disable_external_dependency_loading)return XA.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var r=V?.querySelectorAll("script");if(r){for(var i,s=function(){if(r[o].src===e){var l=r[o];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)})),l.onerror=c=>t(c),{v:void 0})}},o=0;o<r.length;o++)if(i=s())return i.v}var a=()=>{if(!V)return t("document not found");var l=V.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=d=>{l.__posthog_loading_callback_fired=!0,t(void 0,d)},l.onerror=d=>t(d),n.config.prepare_external_dependency_script&&(l=n.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(n.config.external_scripts_inject_target==="head")V.head.appendChild(l);else{var c,u=V.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):V.body.appendChild(l)}};V!=null&&V.body?a():V?.addEventListener("DOMContentLoaded",a)};Q.__PosthogExtensions__=Q.__PosthogExtensions__||{},Q.__PosthogExtensions__.loadExternalDependency=(n,e,t)=>{var r="/static/"+e+".js?v="+n.version;if(e==="remote-config"&&(r="/array/"+n.config.token+"/config.js"),e==="toolbar"){var i=3e5;r=r+"&t="+Math.floor(Date.now()/i)*i}var s=n.requestRouter.endpointFor("assets",r);t_(n,s,t)},Q.__PosthogExtensions__.loadSiteApp=(n,e,t)=>{var r=n.requestRouter.endpointFor("api",e);t_(n,r,t)};var ql={};function Zn(n,e,t){if(me(n)){if(Ub&&n.forEach===Ub)n.forEach(e,t);else if("length"in n&&n.length===+n.length){for(var r=0,i=n.length;r<i;r++)if(r in n&&e.call(t,n[r],r)===ql)return}}}function ke(n,e,t){if(!pe(n)){if(me(n))return Zn(n,e,t);if(EA(n)){for(var r of n.entries())if(e.call(t,r[1],r[0])===ql)return}else for(var i in n)if(W_.call(n,i)&&e.call(t,n[i],i)===ql)return}}var Me=function(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return Zn(t,(function(i){for(var s in i)i[s]!==void 0&&(n[s]=i[s])})),n},Gi=function(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return Zn(t,(function(i){Zn(i,(function(s){n.push(s)}))})),n};function Wl(n){for(var e=Object.keys(n),t=e.length,r=new Array(t);t--;)r[t]=[e[t],n[e[t]]];return r}var n_=function(n){try{return n()}catch{return}},JA=function(n){return function(){try{for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.apply(this,t)}catch(i){j.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),j.critical(i)}}},nf=function(n){var e={};return ke(n,(function(t,r){(Le(t)&&t.length>0||bn(t))&&(e[r]=t)})),e};function QA(n,e){return t=n,r=s=>Le(s)&&!Dt(e)?s.slice(0,e):s,i=new Set,(function s(o,a){return o!==Object(o)?r?r(o,a):o:i.has(o)?void 0:(i.add(o),me(o)?(l=[],Zn(o,(c=>{l.push(s(c))}))):(l={},ke(o,((c,u)=>{i.has(c)||(l[u]=s(c,u))}))),l);var l})(t);var t,r,i}var eR=["herokuapp.com","vercel.app","netlify.app"];function tR(n){var e=n?.hostname;if(!Le(e))return!1;var t=e.split(".").slice(-2).join(".");for(var r of eR)if(t===r)return!1;return!0}function c0(n,e){for(var t=0;t<n.length;t++)if(e(n[t]))return n[t]}function Oe(n,e,t,r){var{capture:i=!1,passive:s=!0}=r??{};n?.addEventListener(e,t,{capture:i,passive:s})}var u0="$people_distinct_id",Ro="__alias",To="__timers",r_="$autocapture_disabled_server_side",ih="$heatmaps_enabled_server_side",i_="$exception_capture_enabled_server_side",sh="$error_tracking_suppression_rules",s_="$error_tracking_capture_extension_exceptions",o_="$web_vitals_enabled_server_side",d0="$dead_clicks_enabled_server_side",a_="$product_tours_enabled_server_side",l_="$web_vitals_allowed_metrics",Ep="$session_recording_remote_config",Zl="$sesid",p0="$session_is_sampled",Wi="$enabled_feature_flags",Io="$early_access_features",oh="$feature_flag_details",$o="$stored_person_properties",Hr="$stored_group_properties",ah="$surveys",Gl="$flag_call_reported",fn="$user_state",lh="$client_session_props",ch="$capture_rate_limit",uh="$initial_campaign_params",dh="$initial_referrer_info",Kl="$initial_person_info",Yl="$epp",h0="__POSTHOG_TOOLBAR__",yo="$posthog_cookieless",nR=[u0,Ro,"__cmpns",To,"$session_recording_enabled_server_side",ih,Zl,Wi,sh,fn,Io,oh,Hr,$o,ah,Gl,lh,ch,uh,dh,Yl,Kl,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function c_(n){return n instanceof Element&&(n.id===h0||!(n.closest==null||!n.closest(".toolbar-global-fade-container")))}function fc(n){return!!n&&n.nodeType===1}function Gn(n,e){return!!n&&!!n.tagName&&n.tagName.toLowerCase()===e.toLowerCase()}function f0(n){return!!n&&n.nodeType===3}function g0(n){return!!n&&n.nodeType===11}function rf(n){return n?pc(n).split(/\s+/):[]}function u_(n){var e=C?.location.href;return!!(e&&n&&n.some((t=>e.match(t))))}function Xl(n){var e="";switch(typeof n.className){case"string":e=n.className;break;case"object":e=(n.className&&"baseVal"in n.className?n.className.baseVal:null)||n.getAttribute("class")||"";break;default:e=""}return rf(e)}function m0(n){return pe(n)?null:pc(n).split(/(\s+)/).filter((e=>Wo(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Uo(n){var e="";return ph(n)&&!x0(n)&&n.childNodes&&n.childNodes.length&&ke(n.childNodes,(function(t){var r;f0(t)&&t.textContent&&(e+=(r=m0(t.textContent))!==null&&r!==void 0?r:"")})),pc(e)}function v0(n){return W(n.target)?n.srcElement||null:(e=n.target)!=null&&e.shadowRoot?n.composedPath()[0]||null:n.target||null;var e}var sf=["a","button","form","input","select","textarea","label"];function y0(n,e){if(W(e))return!0;var t,r=function(s){if(e.some((o=>s.matches(o))))return{v:!0}};for(var i of n)if(t=r(i))return t.v;return!1}function b0(n){var e=n.parentNode;return!(!e||!fc(e))&&e}var rR=["next","previous","prev",">","<"],d_=10,p_=[".ph-no-rageclick",".ph-no-capture"];function iR(n,e){if(!C||of(n))return!1;var t,r,i;if(yn(e)?(t=!!e&&p_,r=void 0):(t=(i=e?.css_selector_ignorelist)!==null&&i!==void 0?i:p_,r=e?.content_ignorelist),t===!1)return!1;var{targetElementList:s}=_0(n,!1);return!(function(o,a){if(o===!1||W(o))return!1;var l;if(o===!0)l=rR;else{if(!me(o))return!1;if(o.length>d_)return j.error("[PostHog] content_ignorelist array cannot exceed "+d_+" items. Use css_selector_ignorelist for more complex matching."),!1;l=o.map((c=>c.toLowerCase()))}return a.some((c=>{var{safeText:u,ariaLabel:d}=c;return l.some((h=>u.includes(h)||d.includes(h)))}))})(r,s.map((o=>{var a;return{safeText:Uo(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!y0(s,t)}var of=n=>!n||Gn(n,"html")||!fc(n),_0=(n,e)=>{if(!C||of(n))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,r=[n],i=n;i.parentNode&&!Gn(i,"body");)if(g0(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var s=b0(i);if(!s)break;if(e||sf.indexOf(s.tagName.toLowerCase())>-1)t=!0;else{var o=C.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(t=!0)}r.push(s),i=s}return{parentIsUsefulElement:t,targetElementList:r}};function sR(n,e,t,r,i){var s,o,a,l;if(t===void 0&&(t=void 0),!C||of(n)||(s=t)!=null&&s.url_allowlist&&!u_(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&u_(t.url_ignorelist))return!1;if((a=t)!=null&&a.dom_event_allowlist){var c=t.dom_event_allowlist;if(c&&!c.some((v=>e.type===v)))return!1}var{parentIsUsefulElement:u,targetElementList:d}=_0(n,r);if(!(function(v,f){var m=f?.element_allowlist;if(W(m))return!0;var y,k=function(b){if(m.some((x=>b.tagName.toLowerCase()===x)))return{v:!0}};for(var _ of v)if(y=k(_))return y.v;return!1})(d,t)||!y0(d,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var h=C.getComputedStyle(n);if(h&&h.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var g=n.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(i||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(e.type)>=0;default:return u?(i||["click"]).indexOf(e.type)>=0:(i||["click"]).indexOf(e.type)>=0&&(sf.indexOf(g)>-1||n.getAttribute("contenteditable")==="true")}}function ph(n){for(var e=n;e.parentNode&&!Gn(e,"body");e=e.parentNode){var t=Xl(e);if(ue(t,"ph-sensitive")||ue(t,"ph-no-capture"))return!1}if(ue(Xl(n),"ph-include"))return!0;var r=n.type||"";if(Le(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=n.name||n.id||"";return!(Le(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function x0(n){return!!(Gn(n,"input")&&!["button","checkbox","submit","reset"].includes(n.type)||Gn(n,"select")||Gn(n,"textarea")||n.getAttribute("contenteditable")==="true")}var w0="(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})",oR=new RegExp("^(?:"+w0+")$"),aR=new RegExp(w0),k0="\\d{3}-?\\d{2}-?\\d{4}",lR=new RegExp("^("+k0+")$"),cR=new RegExp("("+k0+")");function Wo(n,e){return e===void 0&&(e=!0),!(pe(n)||Le(n)&&(n=pc(n),(e?oR:aR).test((n||"").replace(/[- ]/g,""))||(e?lR:cR).test(n)))}function S0(n){var e=Uo(n);return Wo(e=(e+" "+E0(n)).trim())?e:""}function E0(n){var e="";return n&&n.childNodes&&n.childNodes.length&&ke(n.childNodes,(function(t){var r;if(t&&((r=t.tagName)==null?void 0:r.toLowerCase())==="span")try{var i=Uo(t);e=(e+" "+i).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+E0(t)).trim())}catch(s){j.error("[AutoCapture]",s)}})),e}function uR(n){return(function(e){var t=e.map((r=>{var i,s,o="";if(r.tag_name&&(o+=r.tag_name),r.attr_class)for(var a of(r.attr_class.sort(),r.attr_class))o+="."+a.replace(/"/g,"");var l=U({},r.text?{text:r.text}:{},{"nth-child":(i=r.nth_child)!==null&&i!==void 0?i:0,"nth-of-type":(s=r.nth_of_type)!==null&&s!==void 0?s:0},r.href?{href:r.href}:{},r.attr_id?{attr_id:r.attr_id}:{},r.attributes),c={};return Wl(l).sort(((u,d)=>{var[h]=u,[g]=d;return h.localeCompare(g)})).forEach((u=>{var[d,h]=u;return c[h_(d.toString())]=h_(h.toString())})),o+=":",o+=Wl(c).map((u=>{var[d,h]=u;return d+'="'+h+'"'})).join("")}));return t.join(";")})((function(e){return e.map((t=>{var r,i,s={text:(r=t.$el_text)==null?void 0:r.slice(0,400),tag_name:t.tag_name,href:(i=t.attr__href)==null?void 0:i.slice(0,2048),attr_class:dR(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Wl(t).filter((o=>{var[a]=o;return a.indexOf("attr__")===0})).forEach((o=>{var[a,l]=o;return s.attributes[a]=l})),s}))})(n))}function h_(n){return n.replace(/"|\\"/g,'\\"')}function dR(n){var e=n.attr__class;return e?me(e)?e:rf(e):void 0}var Jl=class{constructor(e){this.disabled=e===!1;var t=Ne(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&r-i.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}},Ql=n=>{var e=V?.createElement("a");return W(e)?null:(e.href=n,e)},pR=function(n,e){var t,r;e===void 0&&(e="&");var i=[];return ke(n,(function(s,o){W(s)||W(o)||o==="undefined"||(t=encodeURIComponent((a=>a instanceof File)(s)?s.name:s.toString()),r=encodeURIComponent(o),i[i.length]=r+"="+t)})),i.join(e)},ec=function(n,e){for(var t,r=((n.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<r.length;i++){var s=r[i].split("=");if(s[0]===e){t=s;break}}if(!me(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{j.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},zo=function(n,e,t){if(!n||!e||!e.length)return n;for(var r=n.split("#"),i=r[0]||"",s=r[1],o=i.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),u=[],d=0;d<c.length;d++){var h=c[d].split("=");me(h)&&(e.includes(h[0])?u.push(h[0]+"="+t):u.push(c[d]))}var g=l;return a!=null&&(g+="?"+u.join("&")),s!=null&&(g+="#"+s),g},tc=function(n,e){var t=n.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Cp="$copy_autocapture",f_=Ie("[AutoCapture]");function Ap(n,e){return e.length>n?e.slice(0,n)+"...":e}function hR(n){if(n.previousElementSibling)return n.previousElementSibling;var e=n;do e=e.previousSibling;while(e&&!fc(e));return e}function fR(n,e,t,r){var i=n.tagName.toLowerCase(),s={tag_name:i};sf.indexOf(i)>-1&&!t&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=Ap(1024,S0(n)):s.$el_text=Ap(1024,Uo(n)));var o=Xl(n);o.length>0&&(s.classes=o.filter((function(u){return u!==""}))),ke(n.attributes,(function(u){var d;if((!x0(n)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(r==null||!r.includes(u.name))&&!e&&Wo(u.value)&&(d=u.name,!Le(d)||d.substring(0,10)!=="_ngcontent"&&d.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=rf(h).join(" ")),s["attr__"+u.name]=Ap(1024,h)}}));for(var a=1,l=1,c=n;c=hR(c);)a++,c.tagName===n.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function gR(n,e){for(var t,r,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[n],u=n;u.parentNode&&!Gn(u,"body");)g0(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var d,h=[],g={},v=!1,f=!1;if(ke(c,(b=>{var x=ph(b);b.tagName.toLowerCase()==="a"&&(v=b.getAttribute("href"),v=x&&v&&Wo(v)&&v),ue(Xl(b),"ph-no-capture")&&(f=!0),h.push(fR(b,s,o,a));var R=(function(w){if(!ph(w))return{};var E={};return ke(w.attributes,(function($){if($.name&&$.name.indexOf("data-ph-capture-attribute")===0){var P=$.name.replace("data-ph-capture-attribute-",""),M=$.value;P&&M&&Wo(M)&&(E[P]=M)}})),E})(b);Me(g,R)})),f)return{props:{},explicitNoCapture:f};if(o||(n.tagName.toLowerCase()==="a"||n.tagName.toLowerCase()==="button"?h[0].$el_text=S0(n):h[0].$el_text=Uo(n)),v){var m,y;h[0].attr__href=v;var k=(m=Ql(v))==null?void 0:m.host,_=C==null||(y=C.location)==null?void 0:y.host;k&&_&&k!==_&&(d=v)}return{props:Me({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:uR(h)},(t=h[0])!=null&&t.$el_text?{$el_text:(r=h[0])==null?void 0:r.$el_text}:{},d&&i.type==="click"?{$external_click_url:d}:{},g)}}var hh=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Jl(e.config.rageclick),this.C=null}get R(){var e,t,r=Ne(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(e=r.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),r.url_ignorelist=(t=r.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),r}F(){if(this.isBrowserSupported()){if(C&&V){var e=r=>{r=r||C?.event;try{this.O(r)}catch(i){f_.error("Failed to capture event",i)}};if(Oe(V,"submit",e,{capture:!0}),Oe(V,"change",e,{capture:!0}),Oe(V,"click",e,{capture:!0}),this.R.capture_copied_text){var t=r=>{r=r||C?.event,this.O(r,Cp)};Oe(V,"copy",t,{capture:!0}),Oe(V,"cut",t,{capture:!0})}}}else f_.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[r_]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,r=[];return(t=this.C)==null||t.forEach((i=>{var s=V?.querySelectorAll(i);s?.forEach((o=>{e===o&&r.push(i)}))})),r}get isEnabled(){var e,t,r=(e=this.instance.persistence)==null?void 0:e.props[r_],i=this.T;if(Dt(i)&&!yn(r)&&!this.instance.M())return!1;var s=(t=this.T)!==null&&t!==void 0?t:!!r;return!!this.instance.config.autocapture&&!s}O(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var r,i=v0(e);f0(i)&&(i=i.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&iR(i,this.instance.config.rageclick)&&this.O(e,"$rageclick");var s=t===Cp;if(i&&sR(i,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=gR(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(a)return!1;var l=this.getElementSelectors(i);if(l&&l.length>0&&(o.$element_selectors=l),t===Cp){var c,u=m0(C==null||(c=C.getSelection())==null?void 0:c.toString()),d=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=d}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return qn(V?.querySelectorAll)}};Math.trunc||(Math.trunc=function(n){return n<0?Math.ceil(n):Math.floor(n)}),Number.isInteger||(Number.isInteger=function(n){return bn(n)&&isFinite(n)&&Math.floor(n)===n});var g_="0123456789abcdef",fh=class n{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||e<0||t<0||r<0||i<0||e>0xffffffffffff||t>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new n(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+g_.charAt(this.bytes[t]>>>4)+g_.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new n(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var r=this.bytes[t]-e.bytes[t];if(r!==0)return Math.sign(r)}return 0}},gh=class{constructor(){this.A=0,this.j=0,this.D=new mh}generate(){var e=this.generateOrAbort();if(W(e)){this.A=0;var t=this.generateOrAbort();if(W(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.j++,this.j>4398046511103&&(this.A++,this.L())}return fh.fromFieldsV7(this.A,Math.trunc(this.j/Math.pow(2,30)),this.j&Math.pow(2,30)-1,this.D.nextUint32())}L(){this.j=1024*this.D.nextUint32()+(1023&this.D.nextUint32())}},m_,C0=n=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<n.length;e++)n[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return n};C&&!W(C.crypto)&&crypto.getRandomValues&&(C0=n=>crypto.getRandomValues(n));var mh=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(C0(this.N),this.U=0),this.N[this.U++]}},zn=()=>mR().toString(),mR=()=>(m_||(m_=new gh)).generate(),bo="",vR=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function yR(n,e){if(e){var t=(function(i,s){if(s===void 0&&(s=V),bo)return bo;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+zn();!bo&&a--;){var c=o.slice(a).join("."),u=l+"=1;domain=."+c+";path=/";s.cookie=u+";max-age=3",s.cookie.includes(l)&&(s.cookie=u+";max-age=0",bo=c)}return bo})(n);if(!t){var r=(i=>{var s=i.match(vR);return s?s[0]:""})(n);r!==t&&j.info("Warning: cookie subdomain discovery mismatch",r,t),t=r}return t?"; domain=."+t:""}return""}var Gt={H:()=>!!V,B:function(n){j.error("cookieStore error: "+n)},q:function(n){if(V){try{for(var e=n+"=",t=V.cookie.split(";").filter((s=>s.length)),r=0;r<t.length;r++){for(var i=t[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}},W:function(n){var e;try{e=JSON.parse(Gt.q(n))||{}}catch{}return e},G:function(n,e,t,r,i){if(V)try{var s="",o="",a=yR(V.location.hostname,r);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),s="; expires="+l.toUTCString()}i&&(o="; secure");var c=n+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&j.warn("cookieStore warning: large cookie, len="+c.length),V.cookie=c,c}catch{return}},V:function(n,e){if(V!=null&&V.cookie)try{Gt.G(n,"",-1,e)}catch{return}}},Rp=null,Re={H:function(){if(!Dt(Rp))return Rp;var n=!0;if(W(C))n=!1;else try{var e="__mplssupport__";Re.G(e,"xyz"),Re.q(e)!=='"xyz"'&&(n=!1),Re.V(e)}catch{n=!1}return n||j.error("localStorage unsupported; falling back to cookie store"),Rp=n,n},B:function(n){j.error("localStorage error: "+n)},q:function(n){try{return C?.localStorage.getItem(n)}catch(e){Re.B(e)}return null},W:function(n){try{return JSON.parse(Re.q(n))||{}}catch{}return null},G:function(n,e){try{C?.localStorage.setItem(n,JSON.stringify(e))}catch(t){Re.B(t)}},V:function(n){try{C?.localStorage.removeItem(n)}catch(e){Re.B(e)}}},bR=["$device_id","distinct_id",Zl,p0,Yl,Kl],Dl={},_R={H:function(){return!0},B:function(n){j.error("memoryStorage error: "+n)},q:function(n){return Dl[n]||null},W:function(n){return Dl[n]||null},G:function(n,e){Dl[n]=e},V:function(n){delete Dl[n]}},Fr=null,Ue={H:function(){if(!Dt(Fr))return Fr;if(Fr=!0,W(C))Fr=!1;else try{var n="__support__";Ue.G(n,"xyz"),Ue.q(n)!=='"xyz"'&&(Fr=!1),Ue.V(n)}catch{Fr=!1}return Fr},B:function(n){j.error("sessionStorage error: ",n)},q:function(n){try{return C?.sessionStorage.getItem(n)}catch(e){Ue.B(e)}return null},W:function(n){try{return JSON.parse(Ue.q(n))||null}catch{}return null},G:function(n,e){try{C?.sessionStorage.setItem(n,JSON.stringify(e))}catch(t){Ue.B(t)}},V:function(n){try{C?.sessionStorage.removeItem(n)}catch(e){Ue.B(e)}}},gn=(function(n){return n[n.PENDING=-1]="PENDING",n[n.DENIED=0]="DENIED",n[n.GRANTED=1]="GRANTED",n})({}),vh=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?gn.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===gn.DENIED||this.consent===gn.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===gn.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:r}=this._instance.config;return r||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return wp(e)?gn.GRANTED:ue(RA,e)?gn.DENIED:gn.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?Re:Gt;var t=e==="localStorage"?Gt:Re;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(wp(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!c0([pt?.doNotTrack,pt?.msDoNotTrack,Q.doNotTrack],(e=>wp(e)))}},Hl=Ie("[Dead Clicks]"),xR=()=>!0,wR=n=>{var e,t=!((e=n.instance.persistence)==null||!e.get_property(d0)),r=n.instance.config.capture_dead_clicks;return yn(r)?r:!!Ne(r)||t},nc=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[d0]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,r;(t=Q.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(r=Q.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Hl.error("failed to load script",i):e()}))}et(){var e;if(V){if(!this.tt&&(e=Q.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=Ne(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=Q.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(V),Hl.info("starting...")}}else Hl.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Hl.info("stopping..."))}},_o=Ie("[ExceptionAutocapture]"),yh=class{constructor(e){var t,r,i;this.rt=()=>{var s;if(C&&this.isEnabled&&(s=Q.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=Q.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Q.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=Q.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=o(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=a(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=l(this.captureException.bind(this)))}catch(c){_o.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[i_]),this.dt=new Up({refillRate:(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10,refillInterval:1e4,h:_o}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ne(e)?t=U({},t,e):(W(e)?this.ht:e)&&(t=U({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(_o.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,r;(t=Q.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(r=Q.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return _o.error("failed to load script",i);e()}))}ut(){var e,t,r;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(r=this.ot)==null||r.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[i_]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var t,r,i=(t=e==null||(r=e.$exception_list)==null||(r=r[0])==null?void 0:r.type)!==null&&t!==void 0?t:"Exception";this.dt.consumeRateLimit(i)?_o.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}};function v_(n,e,t){try{if(!(e in n))return()=>{};var r=n[e],i=t(r);return qn(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),n[e]=i,()=>{n[e]=r}}catch{return()=>{}}}var bh=class{constructor(e){var t;this._instance=e,this.ct=(C==null||(t=C.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(j.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,j.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(C&&C.history){var r=this;(e=C.history.pushState)!=null&&e.__posthog_wrapped__||v_(C.history,"pushState",(i=>function(s,o,a){i.call(this,s,o,a),r._t("pushState")})),(t=C.history.replaceState)!=null&&t.__posthog_wrapped__||v_(C.history,"replaceState",(i=>function(s,o,a){i.call(this,s,o,a),r._t("replaceState")})),this.bt()}}_t(e){try{var t,r=C==null||(t=C.location)==null?void 0:t.pathname;if(!r)return;r!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=r}catch(i){j.error("Error capturing "+e+" pageview",i)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};Oe(C,"popstate",e),this.ft=()=>{C&&C.removeEventListener("popstate",e)}}}},Tp=Ie("[SegmentIntegration]");function kR(n,e){var t=n.config.segment;if(!t)return e();(function(r,i){var s=r.config.segment;if(!s)return i();var o=l=>{var c=()=>l.anonymousId()||zn();r.config.get_device_id=c,l.id()&&(r.register({distinct_id:l.id(),$device_id:c()}),r.persistence.set_property(fn,"identified")),i()},a=s.user();"then"in a&&qn(a.then)?a.then(o):o(a)})(n,(()=>{t.register((r=>{Promise&&Promise.resolve||Tp.warn("This browser does not have Promise support, and can not use the segment integration");var i=(s,o)=>{if(!o)return s;s.event.userId||s.event.anonymousId===r.get_distinct_id()||(Tp.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(Tp.info("UserId set, identifying with PostHog"),r.identify(s.event.userId));var a=r.calculateEventProperties(o,s.event.properties);return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:s=>i(s,s.event.event),page:s=>i(s,"$pageview"),identify:s=>i(s,"$identify"),screen:s=>i(s,"$screen")}})(n)).then((()=>{e()}))}))}var A0="posthog-js";function R0(n,e){var{organization:t,projectId:r,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,u,d,h;if(!(s==="*"||s.includes(a.level))||!n.__loaded)return a;a.tags||(a.tags={});var g=n.requestRouter.endpointFor("ui","/project/"+n.config.token+"/person/"+n.get_distinct_id());a.tags["PostHog Person URL"]=g,n.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=n.get_session_replay_url({withTimestamp:!0}));var v=((l=a.exception)==null?void 0:l.values)||[],f=v.map((y=>U({},y,{stacktrace:y.stacktrace?U({},y.stacktrace,{type:"raw",frames:(y.stacktrace.frames||[]).map((k=>U({},k,{platform:"web:javascript"})))}):void 0}))),m={$exception_message:((c=v[0])==null?void 0:c.value)||a.message,$exception_type:(u=v[0])==null?void 0:u.type,$exception_level:a.level,$exception_list:f,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((d=v[0])==null?void 0:d.value)||a.message,$sentry_exception_type:(h=v[0])==null?void 0:h.type,$sentry_tags:a.tags};return t&&r&&(m.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),o&&n.exceptions.sendExceptionEvent(m),a}}var _h=class{constructor(e,t,r,i,s,o){this.name=A0,this.setupOnce=function(a){a(R0(e,{organization:t,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},SR=C!=null&&C.location?tc(C.location.hash,"__posthog")||tc(location.hash,"state"):null,y_="_postHogToolbarParams",b_=Ie("[Toolbar]"),Un=(function(n){return n[n.UNINITIALIZED=0]="UNINITIALIZED",n[n.LOADING=1]="LOADING",n[n.LOADED=2]="LOADED",n})(Un||{}),xh=class{constructor(e){this.instance=e}yt(e){Q.ph_toolbar_state=e}wt(){var e;return(e=Q.ph_toolbar_state)!==null&&e!==void 0?e:Un.UNINITIALIZED}maybeLoadToolbar(e,t,r){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),r===void 0&&(r=void 0),!C||!V)return!1;e=e??C.location,r=r??C.history;try{if(!t){try{C.localStorage.setItem("test","test"),C.localStorage.removeItem("test")}catch{return!1}t=C?.localStorage}var i,s=SR||tc(e.hash,"__posthog")||tc(e.hash,"state"),o=s?n_((()=>JSON.parse(atob(decodeURIComponent(s)))))||n_((()=>JSON.parse(decodeURIComponent(s)))):null;return o&&o.action==="ph_authorize"?((i=o).source="url",i&&Object.keys(i).length>0&&(o.desiredHash?e.hash=o.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(y_)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}xt(e){var t=Q.ph_load_toolbar||Q.ph_load_editor;!pe(t)&&qn(t)?t(e,this.instance):b_.warn("No toolbar load function found")}loadToolbar(e){var t=!(V==null||!V.getElementById(h0));if(!C||t)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=U({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(C.localStorage.setItem(y_,JSON.stringify(U({},i,{source:void 0}))),this.wt()===Un.LOADED)this.xt(i);else if(this.wt()===Un.UNINITIALIZED){var s;this.yt(Un.LOADING),(s=Q.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return b_.error("[Toolbar] Failed to load",o),void this.yt(Un.UNINITIALIZED);this.yt(Un.LOADED),this.xt(i)})),Oe(C,"turbolinks:load",(()=>{this.yt(Un.UNINITIALIZED),this.loadToolbar(i)}))}return!0}Et(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(e,t,r)}},ER=Ie("[TracingHeaders]"),wh=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,r;W(this.$t)&&((t=Q.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),W(this.St)&&((r=Q.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null||r._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,r;(t=Q.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(r=Q.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return ER.error("failed to load script",i);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.$t)==null||e.call(this),(t=this.St)==null||t.call(this),this.$t=void 0,this.St=void 0)}},Bl="https?://(.*)",Ki=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],CR=Gi(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Ki),qo="<masked>",AR=["li_fat_id"];function T0(n,e,t){if(!V)return{};var r,i=e?Gi([],Ki,t||[]):[],s=I0(zo(V.URL,i,qo),n),o=(r={},ke(AR,(function(a){var l=Gt.q(a);r[a]=l||null})),r);return Me(o,s)}function I0(n,e){var t=CR.concat(e||[]),r={};return ke(t,(function(i){var s=ec(n,i);r[i]=s||null})),r}function $0(n){var e=(function(s){return s?s.search(Bl+"google.([^/?]*)")===0?"google":s.search(Bl+"bing.com")===0?"bing":s.search(Bl+"yahoo.com")===0?"yahoo":s.search(Bl+"duckduckgo.com")===0?"duckduckgo":null:null})(n),t=e!="yahoo"?"q":"p",r={};if(!Dt(e)){r.$search_engine=e;var i=V?ec(V.referrer,t):"";i.length&&(r.ph_keyword=i)}return r}function __(){return navigator.language||navigator.userLanguage}function M0(){return V?.referrer||"$direct"}function P0(n,e){var t=n?Gi([],Ki,e||[]):[],r=ze?.href.substring(0,1e3);return{r:M0().substring(0,1e3),u:r?zo(r,t,qo):void 0}}function O0(n){var e,{r:t,u:r}=n,i={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Ql(t))==null?void 0:e.host};if(r){i.$current_url=r;var s=Ql(r);i.$host=s?.host,i.$pathname=s?.pathname;var o=I0(r);Me(i,o)}if(t){var a=$0(t);Me(i,a)}return i}function N0(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function RR(){try{return new Date().getTimezoneOffset()}catch{return}}function TR(n,e){if(!ot)return{};var t,r,i,s=n?Gi([],Ki,e||[]):[],[o,a]=(function(l){for(var c=0;c<Xb.length;c++){var[u,d]=Xb[c],h=u.exec(l),g=h&&(qn(d)?d(h,l):d);if(g)return g}return["",""]})(ot);return Me(nf({$os:o,$os_version:a,$browser:s0(ot,navigator.vendor),$device:Jb(ot),$device_type:(r=ot,i=Jb(r),i===z_||i===U_||i==="Kobo"||i==="Kindle Fire"||i===i0?Do:i===Bo||i===Ui||i===Vo||i===qp?"Console":i===Z_?"Wearable":i?kt:"Desktop"),$timezone:N0(),$timezone_offset:RR()}),{$current_url:zo(ze?.href,s,qo),$host:ze?.host,$pathname:ze?.pathname,$raw_user_agent:ot.length>1e3?ot.substring(0,997)+"...":ot,$browser_version:DA(ot,navigator.vendor),$browser_language:__(),$browser_language_prefix:(t=__(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:C?.screen.height,$screen_width:C?.screen.width,$viewport_height:C?.innerHeight,$viewport_width:C?.innerWidth,$lib:"web",$lib_version:hn.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Vn=Ie("[Web Vitals]"),x_=9e5,kh=class{constructor(e){var t;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((r,i)=>U({},r,{["$web_vitals_"+i.name+"_event"]:U({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=r=>{var i,s=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0);if(W(s))Vn.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ct();W(o)||(pe(r?.name)||pe(r?.value)?Vn.error("Invalid metric received",r):this.Rt&&r.value>=this.Rt?Vn.error("Ignoring metric with value >= "+this.Rt,r):(this.N.url!==o&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),W(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=W(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.N.metrics.push(U({},r,{$current_url:o,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{if(!this.P){var r,i,s,o,a=Q.__PosthogExtensions__;W(a)||W(a.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:i,onFCP:s,onINP:o}=a.postHogWebVitalsCallbacks),r&&i&&s&&o?(this.allowedMetrics.indexOf("LCP")>-1&&r(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.It.bind(this)),this.P=!0):Vn.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[o_]),this.startIfEnabled()}get allowedMetrics(){var e,t,r=Ne(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return pe(r)?((t=this._instance.persistence)==null?void 0:t.props[l_])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Ne(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Ne(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=Ne(this._instance.config.capture_performance)&&bn(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:x_;return 0<e&&e<=6e4?x_:e}get isEnabled(){var e=ze?.protocol;if(e!=="http:"&&e!=="https:")return Vn.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Ne(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:yn(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return yn(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Vn.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=Ne(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=Ne(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[o_]:t}),this._instance.persistence.register({[l_]:r})),this.kt=t,this.startIfEnabled()}it(e){var t,r;if((t=Q.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var i=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(r=Q.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,i,(s=>{s?Vn.error("failed to load script",s):e()}))}}Ct(){var e=C?C.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties,i=t?Gi([],Ki,r||[]):[];return zo(e,i,qo)}Vn.error("Could not determine current URL")}},IR=Ie("[Heatmaps]");function w_(n){return Ne(n)&&"clientX"in n&&"clientY"in n&&bn(n.clientX)&&bn(n.clientY)}var Sh=class{constructor(e){var t;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!((t=this.instance.persistence)==null||!t.props[ih]),this.rageclicks=new Jl(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return Ne(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return pe(this.instance.config.capture_heatmaps)?pe(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;IR.info("starting..."),this.Ot(),this.Mt()}else{var e;clearInterval((e=this.Ft)!==null&&e!==void 0?e:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ih]:t}),this.kt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}jt(e){this.Dt(e.originalEvent,"deadclick")}Mt(){this.Ft&&clearInterval(this.Ft),this.Ft=(function(e){return e?.visibilityState==="visible"})(V)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){C&&V&&(this.Nt=this.Lt.bind(this),Oe(C,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||C?.event),Oe(V,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||C?.event),Oe(V,"mousemove",this.zt,{capture:!0}),this.Bt=new nc(this.instance,xR,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),Oe(V,"visibilitychange",this.qt),this.P=!0)}At(){var e;C&&V&&(this.Nt&&C.removeEventListener("beforeunload",this.Nt),this.Ut&&V.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&V.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&V.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),(e=this.Bt)==null||e.stop(),this.P=!1)}Gt(e,t){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=(function(a,l,c){for(var u=a;u&&fc(u)&&!Gn(u,"body");){if(u===c)return!1;if(ue(l,C?.getComputedStyle(u).position))return!0;u=b0(u)}return!1})(v0(e),["fixed","sticky"],s);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:r),target_fixed:o,type:t}}Dt(e,t){var r;if(t===void 0&&(t="click"),!c_(e.target)&&w_(e)){var i=this.Gt(e,t);(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(U({},i,{type:"rageclick"})),this.Vt(i)}}Ht(e){!c_(e.target)&&w_(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>{this.Vt(this.Gt(e,"mousemove"))}),500))}Vt(e){if(C){var t=C.location.href,r=this.instance.config.mask_personal_data_properties,i=this.instance.config.custom_personal_data_properties,s=r?Gi([],Ki,i||[]):[],o=zo(t,s,qo);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!Vi(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},rc=class{constructor(e){this.Jt=(t,r,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(j.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Yt()}Yt(){var e;this.Xt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Jt)}destroy(){var e;(e=this.Xt)==null||e.call(this),this.Xt=void 0}doPageView(e,t){var r,i=this.Qt(e,t);return this.Kt={pathname:(r=C?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this.Qt(e,(t=this.Kt)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Kt)==null?void 0:e.pageViewId}}Qt(e,t){var r=this.Kt;if(!r)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:d}=s;if(!(W(o)||W(a)||W(l)||W(c)||W(u)||W(d))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d);var h=o<=1?1:Kt(a/o,0,1,j),g=o<=1?1:Kt(l/o,0,1,j),v=c<=1?1:Kt(u/c,0,1,j),f=c<=1?1:Kt(d/c,0,1,j);i=Me(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:g,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:f})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}};var mn=(function(n){return n.GZipJS="gzip-js",n.Base64="base64",n})({}),St=Uint8Array,nt=Uint16Array,Zi=Uint32Array,af=new St([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),lf=new St([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),k_=new St([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),L0=function(n,e){for(var t=new nt(31),r=0;r<31;++r)t[r]=e+=1<<n[r-1];var i=new Zi(t[30]);for(r=1;r<30;++r)for(var s=t[r];s<t[r+1];++s)i[s]=s-t[r]<<5|r;return[t,i]},F0=L0(af,2),$R=F0[0],Eh=F0[1];$R[28]=258,Eh[258]=28;for(Ch=L0(lf,0)[1],ic=new nt(32768),Se=0;Se<32768;++Se)Wn=(43690&Se)>>>1|(21845&Se)<<1,Wn=(61680&(Wn=(52428&Wn)>>>2|(13107&Wn)<<2))>>>4|(3855&Wn)<<4,ic[Se]=((65280&Wn)>>>8|(255&Wn)<<8)>>>1;var Wn,Ch,ic,Se,No=function(n,e,t){for(var r=n.length,i=0,s=new nt(e);i<r;++i)++s[n[i]-1];var o,a=new nt(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;if(t){o=new nt(1<<e);var l=15-e;for(i=0;i<r;++i)if(n[i])for(var c=i<<4|n[i],u=e-n[i],d=a[n[i]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)o[ic[d]>>>l]=c}else for(o=new nt(r),i=0;i<r;++i)o[i]=ic[a[n[i]-1]++]>>>15-n[i];return o},Vr=new St(288);for(Se=0;Se<144;++Se)Vr[Se]=8;for(Se=144;Se<256;++Se)Vr[Se]=9;for(Se=256;Se<280;++Se)Vr[Se]=7;for(Se=280;Se<288;++Se)Vr[Se]=8;var sc=new St(32);for(Se=0;Se<32;++Se)sc[Se]=5;var MR=No(Vr,9,0),PR=No(sc,5,0),D0=function(n){return(n/8>>0)+(7&n&&1)},H0=function(n,e,t){(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof nt?nt:n instanceof Zi?Zi:St)(t-e);return r.set(n.subarray(e,t)),r},dn=function(n,e,t){t<<=7&e;var r=e/8>>0;n[r]|=t,n[r+1]|=t>>>8},xo=function(n,e,t){t<<=7&e;var r=e/8>>0;n[r]|=t,n[r+1]|=t>>>8,n[r+2]|=t>>>16},Ip=function(n,e){for(var t=[],r=0;r<n.length;++r)n[r]&&t.push({s:r,f:n[r]});var i=t.length,s=t.slice();if(!i)return[new St(0),0];if(i==1){var o=new St(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(x,R){return x.f-R.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,u=1,d=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=t[t[c].f<t[d].f?c++:d++],l=t[c!=u&&t[c].f<t[d].f?c++:d++],t[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=s[0].s;for(r=1;r<i;++r)s[r].s>h&&(h=s[r].s);var g=new nt(h+1),v=Ah(t[u-1],g,0);if(v>e){r=0;var f=0,m=v-e,y=1<<m;for(s.sort((function(x,R){return g[R.s]-g[x.s]||x.f-R.f}));r<i;++r){var k=s[r].s;if(!(g[k]>e))break;f+=y-(1<<v-g[k]),g[k]=e}for(f>>>=m;f>0;){var _=s[r].s;g[_]<e?f-=1<<e-g[_]++-1:++r}for(;r>=0&&f;--r){var b=s[r].s;g[b]==e&&(--g[b],++f)}v=e}return[new St(g),v]},Ah=function(n,e,t){return n.s==-1?Math.max(Ah(n.l,e,t+1),Ah(n.r,e,t+1)):e[n.s]=t},S_=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new nt(++e),r=0,i=n[0],s=1,o=function(l){t[r++]=l},a=1;a<=e;++a)if(n[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=n[a]}return[t.subarray(0,r),e]},wo=function(n,e){for(var t=0,r=0;r<e.length;++r)t+=n[r]*e[r];return t},Rh=function(n,e,t){var r=t.length,i=D0(e+2);n[i]=255&r,n[i+1]=r>>>8,n[i+2]=255^n[i],n[i+3]=255^n[i+1];for(var s=0;s<r;++s)n[i+s+4]=t[s];return 8*(i+4+r)},E_=function(n,e,t,r,i,s,o,a,l,c,u){dn(e,u++,t),++i[256];for(var d=Ip(i,15),h=d[0],g=d[1],v=Ip(s,15),f=v[0],m=v[1],y=S_(h),k=y[0],_=y[1],b=S_(f),x=b[0],R=b[1],w=new nt(19),E=0;E<k.length;++E)w[31&k[E]]++;for(E=0;E<x.length;++E)w[31&x[E]]++;for(var $=Ip(w,7),P=$[0],M=$[1],G=19;G>4&&!P[k_[G-1]];--G);var L,N,z,H,oe=c+5<<3,A=wo(i,Vr)+wo(s,sc)+o,F=wo(i,h)+wo(s,f)+o+14+3*G+wo(w,P)+(2*w[16]+3*w[17]+7*w[18]);if(oe<=A&&oe<=F)return Rh(e,u,n.subarray(l,l+c));if(dn(e,u,1+(F<A)),u+=2,F<A){L=No(h,g,0),N=h,z=No(f,m,0),H=f;var X=No(P,M,0);for(dn(e,u,_-257),dn(e,u+5,R-1),dn(e,u+10,G-4),u+=14,E=0;E<G;++E)dn(e,u+3*E,P[k_[E]]);u+=3*G;for(var fe=[k,x],de=0;de<2;++de){var He=fe[de];for(E=0;E<He.length;++E){var Ce=31&He[E];dn(e,u,X[Ce]),u+=P[Ce],Ce>15&&(dn(e,u,He[E]>>>5&127),u+=He[E]>>>12)}}}else L=MR,N=Vr,z=PR,H=sc;for(E=0;E<a;++E)if(r[E]>255){Ce=r[E]>>>18&31,xo(e,u,L[Ce+257]),u+=N[Ce+257],Ce>7&&(dn(e,u,r[E]>>>23&31),u+=af[Ce]);var Et=31&r[E];xo(e,u,z[Et]),u+=H[Et],Et>3&&(xo(e,u,r[E]>>>5&8191),u+=lf[Et])}else xo(e,u,L[r[E]]),u+=N[r[E]];return xo(e,u,L[256]),u+N[256]},OR=new Zi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),NR=(function(){for(var n=new Zi(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(1&t&&3988292384)^t>>>1;n[e]=t}return n})(),LR=function(n,e,t,r,i){return(function(s,o,a,l,c,u){var d=s.length,h=new St(l+d+5*(1+Math.floor(d/7e3))+c),g=h.subarray(l,h.length-c),v=0;if(!o||d<8)for(var f=0;f<=d;f+=65535){var m=f+65535;m<d?v=Rh(g,v,s.subarray(f,m)):(g[f]=u,v=Rh(g,v,s.subarray(f,d)))}else{for(var y=OR[o-1],k=y>>>13,_=8191&y,b=(1<<a)-1,x=new nt(32768),R=new nt(b+1),w=Math.ceil(a/3),E=2*w,$=function(vc){return(s[vc]^s[vc+1]<<w^s[vc+2]<<E)&b},P=new Zi(25e3),M=new nt(288),G=new nt(32),L=0,N=0,z=(f=0,0),H=0,oe=0;f<d;++f){var A=$(f),F=32767&f,X=R[A];if(x[F]=X,R[A]=F,H<=f){var fe=d-f;if((L>7e3||z>24576)&&fe>423){v=E_(s,g,0,P,M,G,N,z,oe,f-oe,v),z=L=N=0,oe=f;for(var de=0;de<286;++de)M[de]=0;for(de=0;de<30;++de)G[de]=0}var He=2,Ce=0,Et=_,Ct=F-X&32767;if(fe>2&&A==$(f-Ct))for(var gc=Math.min(k,fe)-1,Yi=Math.min(32767,f),Pe=Math.min(258,fe);Ct<=Yi&&--Et&&F!=X;){if(s[f+He]==s[f+He-Ct]){for(var Ht=0;Ht<Pe&&s[f+Ht]==s[f+Ht-Ct];++Ht);if(Ht>He){if(He=Ht,Ce=Ct,Ht>gc)break;var Q0=Math.min(Ct,Ht-2),gf=0;for(de=0;de<Q0;++de){var mc=f-Ct+de+32768&32767,mf=mc-x[mc]+32768&32767;mf>gf&&(gf=mf,X=mc)}}}Ct+=(F=X)-(X=x[F])+32768&32767}if(Ce){P[z++]=268435456|Eh[He]<<18|Ch[Ce];var vf=31&Eh[He],yf=31&Ch[Ce];N+=af[vf]+lf[yf],++M[257+vf],++G[yf],H=f+He,++L}else P[z++]=s[f],++M[s[f]]}}v=E_(s,g,u,P,M,G,N,z,oe,f-oe,v)}return H0(h,0,l+D0(v)+c)})(n,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+e.mem,t,r,!0)},$p=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8};function FR(n,e){e===void 0&&(e={});var t=(function(){var a=4294967295;return{p:function(l){for(var c=a,u=0;u<l.length;++u)c=NR[255&c^l[u]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),r=n.length;t.p(n);var i,s=LR(n,e,10+((i=e).filename&&i.filename.length+1||0),8),o=s.length;return(function(a,l){var c=l.filename;if(a[0]=31,a[1]=139,a[2]=8,a[8]=l.level<2?4:l.level==9?2:0,a[9]=3,l.mtime!=0&&$p(a,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),c){a[3]=8;for(var u=0;u<=c.length;++u)a[u+10]=c.charCodeAt(u)}})(s,e),$p(s,o-8,t.d()),$p(s,o-4,r),s}var DR=function(n){var e,t,r,i,s="";for(e=t=0,r=(n=(n+"").replace(/\r\n/g,`
|
|
1161
1161
|
`).replace(/\r/g,`
|
|
1162
|
-
`)).length,i=0;i<r;i++){var o=n.charCodeAt(i),a=null;o<128?t++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),Ft(a)||(t>e&&(s+=n.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=n.substring(e,n.length)),s},$R=!!Np||!!Op,__="text/plain",nc=function(n,e,t){var r;t===void 0&&(t=!0);var[i,s]=n.split("?"),o=z({},e),a=(r=s?.split("&").map((c=>{var u,[d,h]=c.split("="),g=t&&(u=o[d])!==null&&u!==void 0?u:h;return delete o[d],d+"="+g})))!==null&&r!==void 0?r:[],l=iR(o);return l&&a.push(l),i+"?"+a.join("&")},$o=(n,e)=>JSON.stringify(n,((t,r)=>typeof r=="bigint"?r.toString():r),e),Ap=n=>{var{data:e,compression:t}=n;if(e){if(t===fn.GZipJS){var r=TR((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var d=new Et(l.length+(l.length>>>1)),h=0,g=function(y){d[h++]=y},v=0;v<u;++v){if(h+5>d.length){var f=new Et(h+8+(u-v<<1));f.set(d),d=f}var m=l.charCodeAt(v);m<128||c?g(m):m<2048?(g(192|m>>>6),g(128|63&m)):m>55295&&m<57344?(g(240|(m=65536+(1047552&m)|1023&l.charCodeAt(++v))>>>18),g(128|m>>>12&63),g(128|m>>>6&63),g(128|63&m)):(g(224|m>>>12),g(128|m>>>6&63),g(128|63&m))}return P0(d,0,h)})($o(e)),{mtime:0}),i=new Blob([r],{type:__});return{contentType:__,body:i,estimatedSize:i.size}}if(t===fn.Base64){var s=(function(l){var c,u,d,h,g,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=0,m=0,y="",k=[];if(!l)return l;l=IR(l);do c=(g=l.charCodeAt(f++)<<16|l.charCodeAt(f++)<<8|l.charCodeAt(f++))>>18&63,u=g>>12&63,d=g>>6&63,h=63&g,k[m++]=v.charAt(c)+v.charAt(u)+v.charAt(d)+v.charAt(h);while(f<l.length);switch(y=k.join(""),l.length%3){case 1:y=y.slice(0,-2)+"==";break;case 2:y=y.slice(0,-1)+"="}return y})($o(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:$o(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=$o(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Hl=[];Op&&Hl.push({transport:"fetch",method:n=>{var e,t,{contentType:r,body:i,estimatedSize:s}=(e=Ap(n))!==null&&e!==void 0?e:{},o=new Headers;we(n.headers,(function(u,d){o.append(d,u)})),r&&o.append("Content-Type",r);var a=n.url,l=null;if(Bb){var c=new Bb;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),n.timeout)}}Op(a,z({method:n?.method||"GET",headers:o,keepalive:n.method==="POST"&&(s||0)<52428.8,body:i,signal:(t=l)==null?void 0:t.signal},n.fetchOptions)).then((u=>u.text().then((d=>{var h={statusCode:u.status,text:d};if(u.status===200)try{h.json=JSON.parse(d)}catch(g){U.error(g)}n.callback==null||n.callback(h)})))).catch((u=>{U.error(u),n.callback==null||n.callback({statusCode:0,text:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Np&&Hl.push({transport:"XHR",method:n=>{var e,t=new Np;t.open(n.method||"GET",n.url,!0);var{contentType:r,body:i}=(e=Ap(n))!==null&&e!==void 0?e:{};we(n.headers,(function(s,o){t.setRequestHeader(o,s)})),r&&t.setRequestHeader("Content-Type",r),n.timeout&&(t.timeout=n.timeout),n.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var s={statusCode:t.status,text:t.responseText};if(t.status===200)try{s.json=JSON.parse(t.responseText)}catch{}n.callback==null||n.callback(s)}},t.send(i)}}),pt!=null&&pt.sendBeacon&&Hl.push({transport:"sendBeacon",method:n=>{var e=nc(n.url,{beacon:"1"});try{var t,{contentType:r,body:i}=(t=Ap(n))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:r}):i;pt.sendBeacon(e,s)}catch{}}});var rc=function(n,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(n)}catch{return!1}};function x_(n,e,t){return $o({distinct_id:n,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var O0={exact:(n,e)=>e.some((t=>n.some((r=>t===r)))),is_not:(n,e)=>e.every((t=>n.every((r=>t!==r)))),regex:(n,e)=>e.some((t=>n.some((r=>rc(t,r))))),not_regex:(n,e)=>e.every((t=>n.every((r=>!rc(t,r))))),icontains:(n,e)=>e.map(Fl).some((t=>n.map(Fl).some((r=>t.includes(r))))),not_icontains:(n,e)=>e.map(Fl).every((t=>n.map(Fl).every((r=>!t.includes(r))))),gt:(n,e)=>e.some((t=>{var r=parseFloat(t);return!isNaN(r)&&n.some((i=>r>parseFloat(i)))})),lt:(n,e)=>e.some((t=>{var r=parseFloat(t);return!isNaN(r)&&n.some((i=>r<parseFloat(i)))}))},Fl=n=>n.toLowerCase();function N0(n,e){return!n||Object.entries(n).every((t=>{var[r,i]=t,s=e?.[r];if(j(s)||Ft(s))return!1;var o=[String(s)],a=O0[i.operator];return!!a&&a(i.values,o)}))}var Rp=Re("[Error tracking]"),Sh=class{constructor(e){var t,r;this.Zt=[],this.ti=new jp([new zp,new Qp,new Zp,new qp,new Yp,new Kp,new Gp,new Xp],BA()),this._instance=e,this.Zt=(t=(r=this._instance.persistence)==null?void 0:r.get_property(eh))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,r,i,s=(t=(r=e.errorTracking)==null?void 0:r.suppressionRules)!==null&&t!==void 0?t:[],o=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this.Zt=s,this._instance.persistence&&this._instance.persistence.register({[eh]:this.Zt,[Jb]:o})}get ii(){var e,t=!!this._instance.get_property(Jb),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void Rp.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void Rp.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void Rp.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(e){if(e.length===0)return!1;var t=e.reduce(((r,i)=>{var{type:s,value:o}=i;return Oe(s)&&s.length>0&&r.$exception_types.push(s),Oe(o)&&o.length>0&&r.$exception_values.push(o),r}),{$exception_types:[],$exception_values:[]});return this.Zt.some((r=>{var i=r.values.map((s=>{var o,a=O0[s.operator],l=fe(s.value)?s.value:[s.value],c=(o=t[s.key])!==null&&o!==void 0?o:[];return l.length>0&&a(l,c)}));return r.type==="OR"?i.some(Boolean):i.every(Boolean)}))}si(e){return e.flatMap((t=>{var r,i;return(r=(i=t.stacktrace)==null?void 0:i.frames)!==null&&r!==void 0?r:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ni(e){if(e.length>0){var t,r,i,s,o=(t=(r=e[0].stacktrace)==null?void 0:r.frames)!==null&&t!==void 0?t:[],a=o[o.length-1];return(i=a==null||(s=a.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}ei(e){return!ue(e)&&fe(e)}},dt=Re("[FeatureFlags]"),wo=Re("[FeatureFlags]",{debugEnabled:!0}),Tp="$active_feature_flags",Li="$override_feature_flags",w_="$feature_flag_payloads",ko="$override_feature_flag_payloads",k_="$feature_flag_request_id",S_="$feature_flag_evaluated_at",E_=n=>{var e={};for(var[t,r]of Dl(n||{}))r&&(e[t]=r);return e},MR=n=>{var e=n.flags;return e?(n.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var r;return[t,(r=e[t].variant)!==null&&r!==void 0?r:e[t].enabled]}))),n.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var r;return(r=e[t].metadata)==null?void 0:r.payload})).map((t=>{var r;return[t,(r=e[t].metadata)==null?void 0:r.payload]})))):dt.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),n},PR=(function(n){return n.FeatureFlags="feature_flags",n.Recordings="recordings",n})({}),Eh=class{constructor(e){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.ci=!1,this._instance=e,this.featureFlagEventHandlers=[]}fi(){var e,t=(e=this._instance.config.evaluation_contexts)!==null&&e!==void 0?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ci||(dt.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ci=!0),t!=null&&t.length?t.filter((r=>{var i=r&&typeof r=="string"&&r.trim().length>0;return i||dt.error("Invalid evaluation context found:",r,"Expected non-empty string"),i})):[]}pi(){return this.fi().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var e=!this.gi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.mi({disableFlags:e})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(th),t=this._instance.get_property(Li),r=this._instance.get_property(ko);if(!r&&!t)return e||{};var i=Ie({},e||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(var o of s){var a,l,c=i[o],u=t?.[o],d=j(u)?(a=c?.enabled)!==null&&a!==void 0&&a:!!u,h=j(u)?c.variant:typeof u=="string"?u:void 0,g=r?.[o],v=z({},c,{enabled:d,variant:d?h??c?.variant:void 0});d!==c?.enabled&&(v.original_enabled=c?.enabled),h!==c?.variant&&(v.original_variant=c?.variant),g&&(v.metadata=z({},c?.metadata,{payload:g,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),i[o]=v}return this.oi||(dt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(Wi),t=this._instance.get_property(Li);if(!t)return e||{};for(var r=Ie({},e),i=Object.keys(t),s=0;s<i.length;s++)r[i[s]]=t[i[s]];return this.oi||(dt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this.oi=!0),r}getFlagPayloads(){var e=this._instance.get_property(w_),t=this._instance.get_property(ko);if(!t)return e||{};for(var r=Ie({},e||{}),i=Object.keys(t),s=0;s<i.length;s++)r[i[s]]=t[i[s]];return this.oi||(dt.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this.oi=!0),r}reloadFeatureFlags(){this.ui||this._instance.config.advanced_disable_feature_flags||this.gi||(this.gi=setTimeout((()=>{this.mi()}),5))}bi(){clearTimeout(this.gi),this.gi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.gi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ui=e}mi(e){var t;if(this.bi(),!this._instance.M())if(this.li)this.hi=!0;else{var r=this._instance.config.token,i=this._instance.get_property("$device_id"),s={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:z({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(Io)||{}),group_properties:this._instance.get_property(Hr)};Ft(i)||j(i)||(s.$device_id=i),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.pi()&&(s.evaluation_contexts=this.fi());var o=this._instance.config.__preview_remote_config,a=o?"/flags/?v=2":"/flags/?v=2&config=true",l=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",c=this._instance.requestRouter.endpointFor("flags",a+l);o&&(s.timezone=T0()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:fn.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:u=>{var d,h,g=!0;if(u.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),g=!1),this.li=!1,this.di||(this.di=!0,this._instance.yi((h=u.json)!==null&&h!==void 0?h:{})),!s.disable_flags||this.hi)if(this.vi=!g,u.json&&(d=u.json.quotaLimited)!=null&&d.includes(PR.FeatureFlags))dt.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var v;s.disable_flags||this.receivedFeatureFlags((v=u.json)!==null&&v!==void 0?v:{},g),this.hi&&(this.hi=!1,this.mi())}}})}}getFeatureFlag(e,t){var r;if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlagResult(e,t);return(r=i?.variant)!==null&&r!==void 0?r:i?.enabled}dt.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants(),i=e in r,s=r[e],o=this.getFlagPayloads()[e],a=String(s),l=this._instance.get_property(k_)||void 0,c=this._instance.get_property(S_)||void 0,u=this._instance.get_property(Ul)||{};if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){var d,h,g,v,f,m,y,k,_;fe(u[e])?u[e].push(a):u[e]=[a],(d=this._instance.persistence)==null||d.register({[Ul]:u});var b=this.getFeatureFlagDetails(e),w={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:o||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((h=this._instance.config.bootstrap)==null||(h=h.featureFlags)==null?void 0:h[e])||null,$feature_flag_bootstrapped_payload:((g=this._instance.config.bootstrap)==null||(g=g.featureFlagPayloads)==null?void 0:g[e])||null,$used_bootstrap_value:!this.vi};j(b==null||(v=b.metadata)==null?void 0:v.version)||(w.$feature_flag_version=b.metadata.version);var E,x=(f=b==null||(m=b.reason)==null?void 0:m.description)!==null&&f!==void 0?f:b==null||(y=b.reason)==null?void 0:y.code;x&&(w.$feature_flag_reason=x),b!=null&&(k=b.metadata)!=null&&k.id&&(w.$feature_flag_id=b.metadata.id),j(b?.original_variant)&&j(b?.original_enabled)||(w.$feature_flag_original_response=j(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(_=b.metadata)!=null&&_.original_payload&&(w.$feature_flag_original_payload=b==null||(E=b.metadata)==null?void 0:E.original_payload),this._instance.capture("$feature_flag_called",w)}if(i){var R=o;if(!j(o))try{R=JSON.parse(o)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:R}}}else dt.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var r=this._instance.config.token,i={distinct_id:this._instance.get_distinct_id(),token:r};this.pi()&&(i.evaluation_contexts=this.fi()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:i,compression:this._instance.config.disable_compression?void 0:fn.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;t(a?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,t);return j(r)?void 0:!!r}dt.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ai=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,l,c,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var d=MR(o),h=d.flags,g=d.featureFlags,v=d.featureFlagPayloads;if(g){var f=o.requestId,m=o.evaluatedAt;if(fe(g)){dt.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var y={};if(g)for(var k=0;k<g.length;k++)y[g[k]]=!0;a&&a.register({[Tp]:g,[Wi]:y})}else{var _=g,b=v,w=h;if(o.errorsWhileComputingFlags)if(h){var E=new Set(Object.keys(h).filter((x=>{var R;return!((R=h[x])!=null&&R.failed)})));_=z({},l,Object.fromEntries(Object.entries(_).filter((x=>{var[R]=x;return E.has(R)})))),b=z({},c,Object.fromEntries(Object.entries(b||{}).filter((x=>{var[R]=x;return E.has(R)})))),w=z({},u,Object.fromEntries(Object.entries(w||{}).filter((x=>{var[R]=x;return E.has(R)}))))}else _=z({},l,_),b=z({},c,b),w=z({},u,w);a&&a.register(z({[Tp]:Object.keys(E_(_)),[Wi]:_||{},[w_]:b||{},[th]:w||{}},f?{[k_]:f}:{},m?{[S_]:m}:{}))}}})(e,this._instance.persistence,r,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),dt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return dt.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Li),this._instance.persistence.unregister(ko),this.wi(),wo.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,r=e;if(this.oi=!!((t=r.suppressWarning)!==null&&t!==void 0&&t),"flags"in r){if(r.flags===!1)this._instance.persistence.unregister(Li),wo.info("Flag overrides cleared");else if(r.flags){if(fe(r.flags)){for(var i={},s=0;s<r.flags.length;s++)i[r.flags[s]]=!0;this._instance.persistence.register({[Li]:i})}else this._instance.persistence.register({[Li]:r.flags});wo.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this._instance.persistence.unregister(ko),wo.info("Payload overrides cleared")):r.payloads&&(this._instance.persistence.register({[ko]:r.payloads}),wo.info("Payload overrides set",{payloads:r.payloads}))),void this.wi()}this.wi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:r}=this.xi();e(t,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var i,s=(this._instance.get_property(To)||[]).find((c=>c.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};s&&(a.$early_access_feature_name=s.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=z({},this.getFlagVariants(),{[e]:t});(i=this._instance.persistence)==null||i.register({[Tp]:Object.keys(E_(l)),[Wi]:l}),this.wi()}getEarlyAccessFeatures(e,t,r){t===void 0&&(t=!1);var i=this._instance.get_property(To),s=r?"&"+r.map((o=>"stage="+o)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:o=>{var a,l;if(o.json){var c=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(To),(l=this._instance.persistence)==null||l.register({[To]:c}),e(c)}}})}xi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((r=>t[r])),flagVariants:Object.keys(t).filter((r=>t[r])).reduce(((r,i)=>(r[i]=t[i],r)),{})}}wi(e){var{flags:t,flagVariants:r}=this.xi();this.featureFlagEventHandlers.forEach((i=>i(t,r,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var r=this._instance.get_property(Io)||{};this._instance.register({[Io]:z({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Io)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var r=this._instance.get_property(Hr)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((i=>{r[i]=z({},r[i],e[i]),delete e[i]})),this._instance.register({[Hr]:z({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Hr)||{};this._instance.register({[Hr]:z({},t,{[e]:{}})})}else this._instance.unregister(Hr)}reset(){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.bi(),this.oi=!1}},OR=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],No=class{constructor(e,t){this.R=e,this.props={},this.Ei=!1,this.$i=(r=>{var i="";return r.token&&(i=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+i+"_posthog"})(e),this.Y=this.Si(e),this.load(),e.debug&&U.info("Persistence loaded",e.persistence,z({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){OR.indexOf(e.persistence.toLowerCase())===-1&&(U.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(i){i===void 0&&(i=[]);var s=[...dR,...i];return z({},Ce,{W:function(o){try{var a={};try{a=qt.W(o)||{}}catch{}var l=Ie(a,JSON.parse(Ce.q(o)||"{}"));return Ce.G(o,l),l}catch{}return null},G:function(o,a,l,c,u,d){try{Ce.G(o,a,void 0,void 0,d);var h={};s.forEach((g=>{a[g]&&(h[g]=a[g])})),Object.keys(h).length&&qt.G(o,h,l,c,u,d)}catch(g){Ce.B(g)}},V:function(o,a){try{C?.localStorage.removeItem(o),qt.V(o,a)}catch(l){Ce.B(l)}}})})(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return r==="localstorage"&&Ce.H()?Ce:r==="localstorage+cookie"&&t.H()?t:r==="sessionstorage"&&We.H()?We:r==="memory"?pR:r==="cookie"?qt:t.H()?t:qt}properties(){var e={};return we(this.props,(function(t,r){if(r===Wi&&Pe(t))for(var i=Object.keys(t),s=0;s<i.length;s++)e["$feature/"+i[s]]=t[i[s]];else a=r,l=!1,(Ft(o=GA)?l:Hb&&o.indexOf===Hb?o.indexOf(a)!=-1:(we(o,(function(c){if(l||(l=c===a))return Wl})),l))||(e[r]=t);var o,a,l})),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=Ie({},e))}}save(){this.ki||this.Y.G(this.$i,this.props,this.Pi,this.Ti,this.Ii,this.R.debug)}remove(){this.Y.V(this.$i,!1),this.Y.V(this.$i,!0)}clear(){this.remove(),this.props={}}register_once(e,t,r){if(Pe(e)){j(t)&&(t="None"),this.Pi=j(r)?this.Ci:r;var i=!1;if(we(e,((s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=s,i=!0)})),i)return this.save(),!0}return!1}register(e,t){if(Pe(e)){this.Pi=j(t)?this.Ci:t;var r=!1;if(we(e,((i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,r=!0)})),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Ei){var e=k0(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);Vi(Xh(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=W?.referrer)?E0(e):{})}update_referrer_info(){var e;this.register_once({$referrer:C0(),$referring_domain:W!=null&&W.referrer&&((e=Kl(W.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[sh]||this.props[oh]||this.register_once({[zl]:A0(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};we([oh,sh],(o=>{var a=this.props[o];a&&we(a,(function(l,c){e["$initial_"+Lp(c)]=l}))}));var t,r,i=this.props[zl];if(i){var s=(t=R0(i),r={},we(t,(function(o,a){r["$initial_"+Lp(a)]=o})),r);Ie(e,s)}return e}safe_merge(e){return we(this.props,(function(t,r){r in e||(e[r]=t)})),e}update_config(e,t,r){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),c=[...a].sort();return l.every(((u,d)=>u===c[d]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var i=this.Si(e),s=this.props;this.clear(),this.Y=i,this.props=s,this.save()}}set_disabled(e){this.ki=e,this.ki?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ti&&(this.Ti=e,this.remove(),this.save())}set_secure(e){e!==this.Ii&&(this.Ii=e,this.remove(),this.save())}set_event_timer(e,t){var r=this.props[Ro]||{};r[e]=t,this.props[Ro]=r,this.save()}remove_event_timer(e){var t=(this.props[Ro]||{})[e];return j(t)||(delete this.props[Ro][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},C_=Re("[Product Tours]"),Ip="ph_product_tours",Ch=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[t_]:!(e==null||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Ri||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(t_)||this.it((()=>this.Oi()))}it(e){var t,r;(t=J.__PosthogExtensions__)!=null&&t.generateProductTours?e():(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"product-tours",(i=>{i?C_.error("Could not load product tours script",i):e()}))}Oi(){var e;!this.Ri&&(e=J.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=J.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!fe(this.Fi)||t){var r=this._instance.persistence;if(r){var i=r.props[Ip];if(fe(i)&&!t)return this.Fi=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var o=s.statusCode;if(o!==200||!s.json){var a="Product Tours API could not be loaded, status: "+o;return C_.error(a),void e([],{isLoaded:!1,error:a})}var l=fe(s.json.product_tours)?s.json.product_tours:[];this.Fi=l,r&&r.register({[Ip]:l}),e(l,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){ue(this.Ri)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ri.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ri)==null||t.showTourById(e)}previewTour(e){this.Ri?this.Ri.previewTour(e):this.it((()=>{var t;this.Oi(),(t=this.Ri)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Ri)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Ri)==null||e.nextStep()}previousStep(){var e;(e=this.Ri)==null||e.previousStep()}clearCache(){var e;this.Fi=null,(e=this._instance.persistence)==null||e.unregister(Ip)}resetTour(e){var t;(t=this.Ri)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Ri)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ri)==null||t.cancelPendingTour(e)}},So=(function(n){return n.Activation="events",n.Cancellation="cancelEvents",n})({}),jF=(function(n){return n.Button="button",n.Tab="tab",n.Selector="selector",n})({}),UF=(function(n){return n.TopLeft="top_left",n.TopRight="top_right",n.TopCenter="top_center",n.MiddleLeft="middle_left",n.MiddleRight="middle_right",n.MiddleCenter="middle_center",n.Left="left",n.Center="center",n.Right="right",n.NextToTrigger="next_to_trigger",n})({}),zF=(function(n){return n.Top="top",n.Left="left",n.Right="right",n.Bottom="bottom",n})({}),$p=(function(n){return n.Popover="popover",n.API="api",n.Widget="widget",n.ExternalSurvey="external_survey",n})({}),qF=(function(n){return n.Open="open",n.MultipleChoice="multiple_choice",n.SingleChoice="single_choice",n.Rating="rating",n.Link="link",n})({}),ZF=(function(n){return n.NextQuestion="next_question",n.End="end",n.ResponseBased="response_based",n.SpecificQuestion="specific_question",n})({}),GF=(function(n){return n.Once="once",n.Recurring="recurring",n.Always="always",n})({}),Mo=(function(n){return n.SHOWN="survey shown",n.DISMISSED="survey dismissed",n.SENT="survey sent",n.ABANDONED="survey abandoned",n})({}),Mp=(function(n){return n.SURVEY_ID="$survey_id",n.SURVEY_NAME="$survey_name",n.SURVEY_RESPONSE="$survey_response",n.SURVEY_ITERATION="$survey_iteration",n.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",n.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",n.SURVEY_SUBMISSION_ID="$survey_submission_id",n.SURVEY_QUESTIONS="$survey_questions",n.SURVEY_COMPLETED="$survey_completed",n.PRODUCT_TOUR_ID="$product_tour_id",n.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",n})({}),Ah=(function(n){return n.Popover="popover",n.Inline="inline",n})({}),xe=Re("[Surveys]"),L0="seenSurvey_",NR=(n,e)=>{var t="$survey_"+e+"/"+n.id;return n.current_iteration&&n.current_iteration>0&&(t="$survey_"+e+"/"+n.id+"/"+n.current_iteration),t},A_=n=>((e,t)=>{var r=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(r=""+e+t.id+"_"+t.current_iteration),r})(L0,n),LR=[$p.Popover,$p.Widget,$p.API],FR={ignoreConditions:!1,ignoreDelay:!1,displayType:Ah.Popover},Wo=class{constructor(){this.Mi={},this.Mi={}}on(e,t){return this.Mi[e]||(this.Mi[e]=[]),this.Mi[e].push(t),()=>{this.Mi[e]=this.Mi[e].filter((r=>r!==t))}}emit(e,t){for(var r of this.Mi[e]||[])r(t);for(var i of this.Mi["*"]||[])i(e,t)}};function Fi(n,e,t){if(ue(n))return!1;switch(t){case"exact":return n===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(n);case"regex":try{return new RegExp(e).test(n)}catch{return!1}default:return!1}}var Rh=class{constructor(e){this.Ai=new Wo,this.ji=(t,r)=>this.Di(t,r)&&this.Li(t,r)&&this.Ni(t,r)&&this.Ui(t,r),this.Di=(t,r)=>r==null||!r.event||t?.event===r?.event,this._instance=e,this.zi=new Set,this.Hi=new Set}init(){var e;if(!j((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((r,i)=>{this.on(r,i)}))}}register(e){var t,r;if(!j((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((o=>{var a,l;(a=this.Hi)==null||a.add(o),(l=o.steps)==null||l.forEach((c=>{var u;(u=this.zi)==null||u.add(c?.event||"")}))})),(r=this._instance)!=null&&r.autocapture)){var i,s=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((l=>{l!=null&&l.selector&&s.add(l?.selector)}))})),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,t){var r;t!=null&&e.length!=0&&(this.zi.has(e)||this.zi.has(t?.event))&&this.Hi&&((r=this.Hi)==null?void 0:r.size)>0&&this.Hi.forEach((i=>{this.Bi(t,i)&&this.Ai.emit("actionCaptured",i.name)}))}qi(e){this.onAction("actionCaptured",(t=>e(t)))}Bi(e,t){if(t?.steps==null)return!1;for(var r of t.steps)if(this.ji(e,r))return!0;return!1}onAction(e,t){return this.Ai.on(e,t)}Li(e,t){if(t!=null&&t.url){var r,i=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!i||typeof i!="string"||!Fi(i,t.url,t.url_matching||"contains"))return!1}return!0}Ni(e,t){return!!this.Wi(e,t)&&!!this.Gi(e,t)&&!!this.Vi(e,t)}Wi(e,t){var r;if(t==null||!t.href)return!0;var i=this.Ji(e);if(i.length>0)return i.some((a=>Fi(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&Fi((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}Gi(e,t){var r;if(t==null||!t.text)return!0;var i=this.Ji(e);if(i.length>0)return i.some((c=>Fi(c.text,t.text,t.text_matching||"exact")||Fi(c.$el_text,t.text,t.text_matching||"exact")));var s,o,a,l=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!l&&(s=(function(c){for(var u,d=[],h=/(?::|")text="(.*?)"/g;!ue(u=h.exec(c));)d.includes(u[1])||d.push(u[1]);return d})(l),o=t.text,a=t.text_matching||"exact",s.some((c=>Fi(c,o,a))))}Vi(e,t){var r,i;if(t==null||!t.selector)return!0;var s=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(s!=null&&s.includes(t.selector))return!0;var o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}Ji(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Ui(e,t){return t==null||!t.properties||t.properties.length===0||N0(t.properties.reduce(((r,i)=>{var s=fe(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return r[i.key]={values:s,operator:i.operator||"exact"},r}),{}),e?.properties)}},Th=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&N0(e.propertyFilters,t?.properties)}Zi(e,t){var r=new Map;return e.forEach((i=>{var s;(s=i.conditions)==null||(s=s[t])==null||(s=s.values)==null||s.forEach((o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(i.id),r.set(o.name,a)}}))})),r}te(e,t,r){var i=(r===So.Activation?this.Ki:this.Yi).get(e),s=[];return this.ie((o=>{s=o.filter((a=>i?.includes(a.id)))})),s.filter((o=>{var a,l=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find((c=>c.name===e));return this.Qi(l,t)}))}register(e){var t;j((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ee(e),this.re(e))}re(e){var t=e.filter((r=>{var i,s;return((i=r.conditions)==null?void 0:i.actions)&&((s=r.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));t.length!==0&&(this.se==null&&(this.se=new Rh(this._instance),this.se.init(),this.se.qi((r=>{this.onAction(r)}))),t.forEach((r=>{var i,s,o,a,l;r.conditions&&(i=r.conditions)!=null&&i.actions&&(s=r.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.se)==null||a.register(r.conditions.actions.values),(l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((c=>{if(c&&c.name){var u=this.Xi.get(c.name);u&&u.push(r.id),this.Xi.set(c.name,u||[r.id])}})))})))}ee(e){var t,r=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),i=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));(r.length!==0||i.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((s,o)=>{this.onEvent(s,o)})),this.Ki=this.Zi(e,So.Activation),this.Yi=this.Zi(e,So.Cancellation))}onEvent(e,t){var r,i=this.ne(),s=this.oe(),o=this.ae(),a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[s])||[];if(o===e&&t&&a.length>0){var l,c;i.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var u=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(u){var d=a.indexOf(u);d>=0&&(a.splice(d,1),this.le(a))}}else{if(this.Yi.has(e)){var h=this.te(e,t,So.Cancellation);h.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map((v=>v.id))}),h.forEach((v=>{var f=a.indexOf(v.id);f>=0&&a.splice(f,1),this.ue(v.id)})),this.le(a))}if(this.Ki.has(e)){i.info("event name matched",{event:e,eventPayload:t,items:this.Ki.get(e)});var g=this.te(e,t,So.Activation);this.le(a.concat(g.map((v=>v.id))||[]))}}}onAction(e){var t,r=this.oe(),i=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[r])||[];this.Xi.has(e)&&this.le(i.concat(this.Xi.get(e)||[]))}le(e){var t,r=this.ne(),i=this.oe(),s=[...new Set(e)].filter((o=>!this.he(o)));r.info("updating activated items",{activatedItems:s}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[i]:s})}getActivatedIds(){var e,t=this.oe(),r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return r||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}},Ih=class extends Th{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return Mo.SHOWN}ie(e){var t;(t=this._instance)==null||t.getSurveys(e)}ue(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}ne(){return xe}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},$h=class{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(ue(t))return xe.warn("Flags not loaded yet. Not loading surveys.");var r=fe(t);this.ve=r?t.length>0:t,xe.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var r=localStorage.key(t);(r!=null&&r.startsWith(L0)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)xe.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)xe.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())xe.info("Not loading surveys in cookieless mode without consent.");else{var e=J?.__PosthogExtensions__;if(e){if(!j(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var r=e.generateSurveys;if(r)return void this.ge(r,t);var i=e.loadExternalDependency;if(!i)return void this._e("PostHog loadExternalDependency extension not found.");i(this._instance,"surveys",(s=>{s||!e.generateSurveys?this._e("Could not load surveys script",s):this.ge(e.generateSurveys,t)}))}catch(s){throw this._e("Error initializing surveys",s),s}finally{this.ce=!1}}}else xe.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Ih(this._instance),xe.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){xe.error(e,t),this.me({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.fe.push(e),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return xe.info("Disabled. Not loading surveys."),e([]);var r,i=this._instance.get_property(nh);if(i&&!t)return e(i,{isLoaded:!0});typeof Promise<"u"&&this.pe?this.pe.then((s=>{var{surveys:o,context:a}=s;return e(o,a)})):(typeof Promise<"u"&&(this.pe=new Promise((s=>{r=s}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var o;this.pe=null;var a=s.statusCode;if(a!==200||!s.json){var l="Surveys API could not be loaded, status: "+a;xe.error(l);var c={isLoaded:!1,error:l};return e([],c),void(r==null||r({surveys:[],context:c}))}var u,d=s.json.surveys||[],h=d.filter((v=>(function(f){return!(!f.start_date||f.end_date)})(v)&&((function(f){var m;return!((m=f.conditions)==null||(m=m.events)==null||(m=m.values)==null||!m.length)})(v)||(function(f){var m;return!((m=f.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)})(v))));h.length>0&&((u=this._surveyEventReceiver)==null||u.register(h)),(o=this._instance.persistence)==null||o.register({[nh]:d});var g={isLoaded:!0};e(d,g),r?.({surveys:d,context:g})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(r){xe.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ue(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);xe.warn("init was not called")}be(e){var t=null;return this.getSurveys((r=>{var i;t=(i=r.find((s=>s.id===e)))!==null&&i!==void 0?i:null})),t}ye(e){if(ue(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.be(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ue(this._surveyManager))return xe.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.ye(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return ue(this._surveyManager)?(xe.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((r=>{this.getSurveys((i=>{var s,o=(s=i.find((l=>l.id===e)))!==null&&s!==void 0?s:null;if(o){var a=this.ye(o);r({visible:a.eligible,disabledReason:a.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,r){var i;if(ue(this._surveyManager))xe.warn("init was not called");else{var s=typeof e=="string"?this.be(e):e;if(s!=null&&s.id)if(LR.includes(s.type)){var o=W?.querySelector(t);if(o)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(xe.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;xe.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(s,o,r),xe.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,r);xe.warn("Survey element not found")}else xe.warn("Surveys of type "+s.type+" cannot be rendered in the app");else xe.warn("Survey not found")}}displaySurvey(e,t){var r;if(ue(this._surveyManager))xe.warn("init was not called");else{var i=this.be(e);if(i){var s=i;if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=z({},i,{appearance:z({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Ah.Popover&&t.initialResponses&&xe.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.canRenderSurvey(i);if(!o.visible)return void xe.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Ah.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else xe.warn("Survey not found")}}cancelPendingSurvey(e){ue(this._surveyManager)?xe.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},un=Re("[Conversations]"),Mh=class{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.Ee=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;ue(t)||(mn(t)?this.we=t:(this.we=t.enabled,this.Ee=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.we=void 0,this.Ee=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=J?.__PosthogExtensions__;if(e&&!j(this.we)&&this.we)if(this.Ee&&this.Ee.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.$e(t),void(this.xe=!1);var r=e.loadExternalDependency;if(!r)return void this.Se("PostHog loadExternalDependency extension not found.");r(this._instance,"conversations",(i=>{i||!e.initConversations?this.Se("Could not load conversations script",i):this.$e(e.initConversations),this.xe=!1}))}catch(i){this.Se("Error initializing conversations",i),this.xe=!1}}else un.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),un.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else un.error("Cannot complete initialization: remote config is null")}Se(e,t){un.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():un.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!Ft(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,r){var i=this;return Bi((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(un.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var r=this;return Bi((function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(un.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return Bi((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(un.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return Bi((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(un.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}},Ph=class{constructor(e){var t;this.ke=!1,this.Pe=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ke=!0)}onRemoteConfig(e){var t,r=(t=e.logs)==null?void 0:t.captureConsoleLogs;!ue(r)&&r&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=Re("[logs]"),t=J?.__PosthogExtensions__;if(t){var r=t.loadExternalDependency;r?r(this._instance,"logs",(i=>{var s;i||(s=t.logs)==null||!s.initializeLogs?e.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.Pe=!0)})):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}},R_=Re("[RateLimiter]"),Oh=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var r=t.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((i=>{R_.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void R_.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,r,i;e===void 0&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(r=this.instance.persistence)==null?void 0:r.get_property(ih))!==null&&t!==void 0?t:{tokens:s,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>s&&(l.tokens=s);var c=l.tokens<1;return c||e||(l.tokens=Math.max(0,l.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(i=this.instance.persistence)==null||i.set_property(ih,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Dr=Re("[RemoteConfig]"),Nh=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=J._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,r;(t=J.__PosthogExtensions__)!=null&&t.loadExternalDependency?(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(Dr.error("PostHog Extensions not found. Cannot load remote config."),e())}Ie(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return Dr.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void Dr.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return Dr.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ie((t=>{this.yi(t)}));this.yi(e)}))}catch(e){Dr.error("Error loading remote config",e)}}yi(e){e?this._instance.config.__preview_remote_config?(this._instance.yi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Dr.info("__preview_remote_config is disabled. Logging config instead",e):Dr.error("Failed to fetch remote config from PostHog.")}},Lh=3e3,Fh=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=Zt(t?.flush_interval_ms||Lh,250,5e3,U.createLogger("flush interval"),Lh),this.Oe=e}enqueue(e){this.Re.push(e),this.Me||this.Ae()}unload(){this.je();var e=this.Re.length>0?this.De():{},t=Object.values(e);[...t.filter((r=>r.url.indexOf("/e")===0)),...t.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.Oe(z({},r,{transport:"sendBeacon"}))}))}enable(){this.Ce=!1,this.Ae()}Ae(){var e=this;this.Ce||(this.Me=setTimeout((()=>{if(this.je(),this.Re.length>0){var t=this.De(),r=function(){var s=t[i],o=new Date().getTime();s.data&&fe(s.data)&&we(s.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Oe(s)};for(var i in t)r()}}),this.Fe))}je(){clearTimeout(this.Me),this.Me=void 0}De(){var e={};return we(this.Re,(t=>{var r,i=t,s=(i?i.batchKey:null)||i.url;j(e[s])&&(e[s]=z({},i,{data:[]})),(r=e[s].data)==null||r.push(i.data)})),this.Re=[],e}},DR=["retriesPerformedSoFar"],Dh=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!j(C)&&"onLine"in C.navigator&&(this.Ue=C.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},Me(C,"online",this.ze),Me(C,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=O_(e,DR);Di(t)&&(r.url=nc(r.url,{retry_count:t})),this._instance._send_request(z({},r,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(t??0)<10?this.Be(z({retriesPerformedSoFar:t},r)):r.callback==null||r.callback(i)}}))}Be(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=(function(o){var a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)})(t),i=Date.now()+r;this.Re.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),U.warn(s),this.Le||(this.Le=!0,this.qe())}qe(){if(this.We&&clearTimeout(this.We),this.Re.length===0)return this.Le=!1,void(this.We=void 0);this.We=setTimeout((()=>{this.Ue&&this.Re.length>0&&this.Lt(),this.qe()}),this.Ne)}Lt(){var e=Date.now(),t=[],r=this.Re.filter((s=>s.retryAt<e||(t.push(s),!1)));if(this.Re=t,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.We&&(clearTimeout(this.We),this.We=void 0),this.Le=!1,j(C)||(this.ze&&(C.removeEventListener("online",this.ze),this.ze=void 0),this.He&&(C.removeEventListener("offline",this.He),this.He=void 0)),this.Re))try{this._instance._send_request(z({},e,{transport:"sendBeacon"}))}catch(t){U.error(t)}this.Re=[]}},Hh=class{constructor(e){this.Ge=()=>{var t,r,i,s;this.Ve||(this.Ve={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+(o?.clientHeight||0),u=o?.scrollHeight||0;this.Ve.lastScrollY=Math.ceil(a),this.Ve.maxScrollY=Math.max(a,(t=this.Ve.maxScrollY)!==null&&t!==void 0?t:0),this.Ve.maxScrollHeight=Math.max(l,(r=this.Ve.maxScrollHeight)!==null&&r!==void 0?r:0),this.Ve.lastContentY=c,this.Ve.maxContentY=Math.max(c,(i=this.Ve.maxContentY)!==null&&i!==void 0?i:0),this.Ve.maxContentHeight=Math.max(u,(s=this.Ve.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}getContext(){return this.Ve}resetContext(){var e=this.Ve;return setTimeout(this.Ge,0),e}startMeasuringScrollPosition(){Me(C,"scroll",this.Ge,{capture:!0}),Me(C,"scrollend",this.Ge,{capture:!0}),Me(C,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return C?.document.documentElement;var e=fe(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var r=C?.document.querySelector(t);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return C&&(C.scrollY||C.pageYOffset||C.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return C&&(C.scrollX||C.pageXOffset||C.document.documentElement.scrollLeft)||0}},HR=n=>A0(n?.config.mask_personal_data_properties,n?.config.custom_personal_data_properties),ic=class{constructor(e,t,r,i){this.Je=s=>{var o=this.Ke();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.Ye(this._instance)};this.Xe.register({[rh]:a})}},this._instance=e,this.Qe=t,this.Xe=r,this.Ye=i||HR,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[rh]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?R0(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return we(Xh(this.getSetOnceProps()),((t,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Lp(r)]=t})),e}},Pp=Re("[SessionId]"),sc=class{on(e,t){return this.Ze.on(e,t)}constructor(e,t,r){var i;if(this.tr=[],this.ir=void 0,this.Ze=new Wo,this.er=(u,d)=>!(!Di(u)||!Di(d))&&Math.abs(u-d)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=e.config,this.Xe=e.persistence,this.rr=void 0,this.sr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.nr=t||zn,this.ar=r||zn;var s=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Zt(o,60,36e3,Pp.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+s+"_window_id",this.hr="ph_"+s+"_primary_window_exists",this.dr()){var a=We.W(this.ur),l=We.W(this.hr);a&&!l?this.rr=a:We.V(this.ur),We.G(this.hr,!0)}if((i=this.R.bootstrap)!=null&&i.sessionID)try{var c=(u=>{var d=u.replace(/-/g,"");if(d.length!==32)throw new Error("Not a valid UUID");if(d[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(d.substring(0,12),16)})(this.R.bootstrap.sessionID);this.vr(this.R.bootstrap.sessionID,new Date().getTime(),c)}catch(u){Pp.error("Invalid sessionID in bootstrap",u)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return j(this.tr)&&(this.tr=[]),this.tr.push(e),this.sr&&e(this.sr,this.rr),()=>{this.tr=this.tr.filter((t=>t!==e))}}dr(){return this.R.persistence!=="memory"&&!this.Xe.ki&&We.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&We.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?We.W(this.ur):null}vr(e,t,r){e===this.sr&&t===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this.sr=e,this.Xe.register({[jl]:[t,e,r]}))}_r(){var e=this.Xe.props[jl];return fe(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.vr(null,null,null)}destroy(){clearTimeout(this.mr),this.mr=void 0,this.ir&&C&&(C.removeEventListener("beforeunload",this.ir,{capture:!1}),this.ir=void 0),this.tr=[]}cr(){this.ir=()=>{this.dr()&&We.V(this.hr)},Me(C,"beforeunload",this.ir,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.R.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||new Date().getTime(),[i,s,o]=this._r(),a=this.gr(),l=Di(o)&&Math.abs(r-o)>864e5,c=!1,u=!s,d=!u&&!e&&this.er(r,i);u||d||l?(s=this.nr(),a=this.ar(),Pp.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}}),o=r,c=!0):a||(a=this.ar(),c=!0);var h=Di(i)&&e&&!l?i:r,g=Di(o)?o:new Date().getTime();return this.pr(a),this.vr(s,h,g),e||this.lr(),c&&this.tr.forEach((v=>v(s,a,c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0))),{sessionId:s,windowId:a,sessionStartTimestamp:g,changeReason:c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:i}}lr(){clearTimeout(this.mr),this.mr=setTimeout((()=>{var[e]=this._r();if(this.er(new Date().getTime(),e)){var t=this.sr;this.resetSessionId(),this.Ze.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},BR=["$set_once","$set"],jn=Re("[SiteApps]"),Bh=class{constructor(e){this._instance=e,this.br=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}yr(e,t){if(t){var r=this.globalsForEvent(t);this.br.push(r),this.br.length>1e3&&(this.br=this.br.slice(10))}}get siteAppLoaders(){var e;return(e=J._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.yr.bind(this));this.wr=()=>{e(),this.br=[],this.wr=void 0}}}globalsForEvent(e){var t,r,i,s,o,a,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var[h,g]of Object.entries(d))c[h]={id:u[h],type:h,properties:g};var{$set_once:v,$set:f}=e;return{event:z({},O_(e,BR),{properties:z({},e.properties,f?{$set:z({},(t=(r=e.properties)==null?void 0:r.$set)!==null&&t!==void 0?t:{},f)}:{},v?{$set_once:z({},(i=(s=e.properties)==null?void 0:s.$set_once)!==null&&i!==void 0?i:{},v)}:{}),elements_chain:(o=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],r=()=>{var a;!t.errored&&this.br.length&&(jn.info("Processing "+this.br.length+" events for site app with id "+e.id),this.br.forEach((l=>t.processEvent==null?void 0:t.processEvent(l))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((a=this.wr)==null||a.call(this))},i=!1,s=a=>{t.errored=!a,t.loaded=!0,jn.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),i&&r()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{s(a)}});o&&(t.processEvent=o),i=!0}catch(a){jn.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&t.loaded)try{r()}catch(a){jn.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}Er(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}$r(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{r.processEvent==null||r.processEvent(t)}catch(i){jn.error("Error while processing event "+e.event+" for site app "+r.id,i)}}}onRemoteConfig(e){var t,r,i,s=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Er(),void this._instance.on("eventCaptured",(c=>this.$r(c)))):void jn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.wr)==null||r.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var o=function(c){var u;J["__$$ph_site_app_"+c]=s._instance,(u=J.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,l,(d=>{if(d)return jn.error("Error while initializing PostHog app with config id "+c,d)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else jn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},F0=function(n,e){if(!n)return!1;var t=n.userAgent;if(t&&Wb(t,e))return!0;try{var r=n?.userAgentData;if(r!=null&&r.brands&&r.brands.some((i=>Wb(i?.brand,e))))return!0}catch{}return!!n.webdriver},Po=(function(n){return n.US="us",n.EU="eu",n.CUSTOM="custom",n})({}),T_="i.posthog.com",Vh=class{constructor(e){this.Sr={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+T_,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Sr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=Po.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=Po.EU:this.Sr[this.apiHost]=Po.CUSTOM),this.Sr[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(this.region===Po.CUSTOM)return this.apiHost+t;var r=T_+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}},VR={icontains:(n,e)=>!!C&&e.href.toLowerCase().indexOf(n.toLowerCase())>-1,not_icontains:(n,e)=>!!C&&e.href.toLowerCase().indexOf(n.toLowerCase())===-1,regex:(n,e)=>!!C&&rc(e.href,n),not_regex:(n,e)=>!!C&&!rc(e.href,n),exact:(n,e)=>e.href===n,is_not:(n,e)=>e.href!==n},Wh=class n{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),t.getWebExperiments((i=>{n.kr("retrieved web experiments from the server"),t.Pr=new Map,i.forEach((s=>{if(s.feature_flag_key){var o;t.Pr&&(n.kr("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=t.Pr)==null||o.set(s.feature_flag_key,s));var a=t._instance.getFeatureFlag(s.feature_flag_key);Oe(a)&&s.variants[a]&&t.Tr(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var c=s.variants[l];n.Ir(c)&&t.Tr(s.name,l,c.transforms)}}))}),r)},this._instance=e,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}onFeatureFlags(e){if(this._is_bot())n.kr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(ue(this.Pr))return this.Pr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();n.kr("applying feature flags",e),e.forEach((t=>{var r;if(this.Pr&&(r=this.Pr)!=null&&r.has(t)){var i,s=this._instance.getFeatureFlag(t),o=(i=this.Pr)==null?void 0:i.get(t);s&&o!=null&&o.variants[s]&&this.Tr(o.name,s,o.variants[s].transforms)}}))}}previewWebExperiment(){var e=n.getWindowLocation();if(e!=null&&e.search){var t=Yl(e?.search,"__experiment_id"),r=Yl(e?.search,"__experiment_variant");t&&r&&(n.kr("previewing web experiments "+t+" && "+r),this.getWebExperiments((i=>{this.Cr(parseInt(t),r,i)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this._instance.config.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}Cr(e,t,r){var i=r.filter((s=>s.id===e));i&&i.length>0&&(n.kr("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this.Tr(i[0].name,t,i[0].variants[t].transforms))}static Ir(e){return!ue(e.conditions)&&n.Rr(e)&&n.Fr(e)}static Rr(e){var t;if(ue(e.conditions)||ue((t=e.conditions)==null?void 0:t.url))return!0;var r,i,s,o=n.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||VR[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return C?.location}static Fr(e){var t;if(ue(e.conditions)||ue((t=e.conditions)==null?void 0:t.utm))return!0;var r=k0();if(r.utm_source){var i,s,o,a,l,c,u,d,h=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,g=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==r.utm_medium,f=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==r.utm_term;return h&&v&&f&&g}return!1}static kr(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];U.info("[WebExperiments] "+e,r)}Tr(e,t,r){this._is_bot()?n.kr("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?r.forEach((i=>{if(i.selector){var s;n.kr("applying transform of variant "+t+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o?.forEach((a=>{var l=a;i.html&&(l.innerHTML=i.html),i.css&&l.setAttribute("style",i.css)}))}})):n.kr("Control variants leave the page unmodified.")}_is_bot(){return pt&&this._instance?F0(pt,this._instance.config.custom_blocked_useragents):void 0}},WR=Re("[PostHog ExternalIntegrations]"),jR={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},jh=class{constructor(e){this._instance=e}it(e,t){var r;(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,(i=>{if(i)return WR.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!i||(a=J.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(jR[o],(()=>{var u;(u=J.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!i&&(l=J.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=J.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[r,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;t(r)}}},Uh="[SessionRecording]",Eo=Re(Uh),oc=class{get started(){var e;return!((e=this.Or)==null||!e.isStarted)}get status(){return this.Or?this.Or.status:this.Mr&&!this.Ar?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Mr=!1,this.jr=void 0,this._instance=e,!this._instance.sessionManager)throw Eo.error("started without valid sessionManager"),new Error(Uh+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Uh+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(_p))==null||!e.enabled),r=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return C&&t&&r&&!i}startIfEnabledOrStop(e){var t;if(!this.Ar||(t=this.Or)==null||!t.isStarted){var r=!j(Object.assign)&&!j(Array.from);this.Ar&&r?(this.Dr(e),Eo.info("starting")):this.stopRecording()}}Dr(e){var t,r,i;this.Ar&&(J!=null&&(t=J.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(r=J.__PosthogExtensions__)!=null&&r.initSessionRecording?this.Lr(e):(i=J.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Nr,(s=>{if(s)return Eo.error("could not load recorder",s);this.Lr(e)})))}stopRecording(){var e,t;(e=this.jr)==null||e.call(this),this.jr=void 0,(t=this.Or)==null||t.stop()}Ur(){var e;(e=this._instance.persistence)==null||e.unregister(o0)}zr(e){if(this._instance.persistence){var t,r,i=this._instance.persistence,s=()=>{var o=e.sessionRecording===!1?void 0:e.sessionRecording,a=o?.sampleRate,l=ue(a)?null:parseFloat(a);ue(l)&&this.Ur();var c=o?.minimumDurationMilliseconds;i.register({[_p]:z({enabled:!!o},o,{networkPayloadCapture:z({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:j(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers})})};s(),(t=this.jr)==null||t.call(this),this.jr=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.zr(e),this.Mr=!0,this.startIfEnabledOrStop()):this.Mr=!0:Eo.info("skipping remote config with no sessionRecording",e)}log(e,t){var r;t===void 0&&(t="log"),(r=this.Or)!=null&&r.log?this.Or.log(e,t):Eo.warn("log called before recorder was ready")}get Nr(){var e,t,r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(_p);return(r==null||(t=r.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,r;if((t=J.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(r=J.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.Or._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Or.start(e)}onRRwebEmit(e){var t;(t=this.Or)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Or||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Or)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Or||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.Or)==null||e.overrideSampling()}overrideTrigger(e){var t,r;this.Or||(r=this._instance.persistence)==null||r.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Or)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Or)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!((r=this.Or)==null||!r.tryAddCustomEvent(e,t))}},Lo={},zh=()=>{},Hi="posthog",D0=!$R&&st?.indexOf("MSIE")===-1&&st?.indexOf("Mozilla")===-1,I_=n=>{var e;return z({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ZA(W?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:zh,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:n??"unset",__preview_deferred_init_extensions:!1,debug:je&&Oe(je?.search)&&je.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(C==null||(e=C.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var r="Bad HTTP status: "+t.statusCode+" "+t.text;U.error(r)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Lh},error_tracking:{},_onCapture:zh,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(n))},$_=n=>{var e={};j(n.process_person)||(e.person_profiles=n.process_person),j(n.xhr_headers)||(e.request_headers=n.xhr_headers),j(n.cookie_name)||(e.persistence_name=n.cookie_name),j(n.disable_cookie)||(e.disable_persistence=n.disable_cookie),j(n.store_google)||(e.save_campaign_params=n.store_google),j(n.verbose)||(e.debug=n.verbose);var t=Ie({},e,n);return fe(n.property_blacklist)&&(j(n.property_denylist)?t.property_denylist=n.property_blacklist:fe(n.property_denylist)?t.property_denylist=[...n.property_blacklist,...n.property_denylist]:U.error("Invalid value for property_denylist config: "+n.property_denylist)),t},qh=class{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){U.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},ac=class n{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new qh,this.Br=!1,this.version=dn.LIB_VERSION,this.qr=new Wo,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=I_(),this.SentryIntegration=gh,this.sentryIntegration=e=>(function(t,r){var i=w0(t,r);return{name:x0,processEvent:s=>i(s)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Wr=!1,this.Gr=null,this.Vr=null,this.Jr=null,this.featureFlags=new Eh(this),this.toolbar=new mh(this),this.scrollManager=new Hh(this),this.pageViewManager=new Jl(this),this.surveys=new $h(this),this.conversations=new Mh(this),this.logs=new Ph(this),this.experiments=new Wh(this),this.exceptions=new Sh(this),this.rateLimiter=new Oh(this),this.requestRouter=new Vh(this),this.consent=new ph(this),this.externalIntegrations=new jh(this),this.people={set:(e,t,r)=>{var i=Oe(e)?{[e]:t}:e;this.setPersonProperties(i),r?.({})},set_once:(e,t,r)=>{var i=Oe(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),r?.({})}},this.on("eventCaptured",(e=>U.info('send "'+e?.event+'"',e)))}init(e,t,r){if(r&&r!==Hi){var i,s=(i=Lo[r])!==null&&i!==void 0?i:new n;return s._init(e,t,r),Lo[r]=s,Lo[Hi][r]=s,s}return this._init(e,t,r)}_init(e,t,r){var i;if(t===void 0&&(t={}),j(e)||Fp(e))return U.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Kr(t.debug),this.Yr=t,this.Xr=[],t.person_profiles&&(this.Vr=t.person_profiles),this.set_config(Ie({},I_(t.defaults),$_(t),{name:r,token:e})),this.config.on_xhr_error&&U.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:fn.GZipJS;var s=this.Qr();this.persistence=new No(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new No(z({},this.config,{persistence:"sessionStorage"}),s);var o=z({},this.persistence.props),a=z({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new Fh((k=>this.ts(k)),this.config.request_queue_config),this.es=new Dh(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new sc(this),this.sessionPropsManager=new ic(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(U.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(U.info("Initializing extensions synchronously"),this.rs(l)),dn.DEBUG=dn.DEBUG||this.config.debug,dn.DEBUG&&U.info("Starting in debug mode",{this:this,config:t,thisC:z({},this.config),p:o,s:a}),((i=t.bootstrap)==null?void 0:i.distinctID)!==void 0){var c,u,d=this.config.get_device_id(zn()),h=(c=t.bootstrap)!=null&&c.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(pn,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this.ss()){var g,v,f=Object.keys(((g=t.bootstrap)==null?void 0:g.featureFlags)||{}).filter((k=>{var _;return!((_=t.bootstrap)==null||(_=_.featureFlags)==null||!_[k])})).reduce(((k,_)=>{var b;return k[_]=((b=t.bootstrap)==null||(b=b.featureFlags)==null?void 0:b[_])||!1,k}),{}),m=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((k=>f[k])).reduce(((k,_)=>{var b,w;return(b=t.bootstrap)!=null&&(b=b.featureFlagPayloads)!=null&&b[_]&&(k[_]=(w=t.bootstrap)==null||(w=w.featureFlagPayloads)==null?void 0:w[_]),k}),{});this.featureFlags.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:vo,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(zn());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(pn,"anonymous")}return Me(C,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?gR(this,(()=>this.ns())):this.ns(),qn(this.config._onCapture)&&this.config._onCapture!==zh&&(U.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&U.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}rs(e){var t=performance.now();this.historyAutocapture=new fh(this),this.historyAutocapture.startIfEnabled();var r=[];r.push((()=>{new vh(this).startIfEnabledOrStop()})),r.push((()=>{var i;this.siteApps=new Bh(this),(i=this.siteApps)==null||i.init()})),e||r.push((()=>{this.sessionRecording=new oc(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||r.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),r.push((()=>{this.autocapture=new lh(this),this.autocapture.startIfEnabled()})),r.push((()=>{this.surveys.loadIfEnabled()})),r.push((()=>{this.logs.loadIfEnabled()})),r.push((()=>{this.conversations.loadIfEnabled()})),r.push((()=>{this.productTours=new Ch(this),this.productTours.loadIfEnabled()})),r.push((()=>{this.heatmaps=new bh(this),this.heatmaps.startIfEnabled()})),r.push((()=>{this.webVitalsAutocapture=new yh(this)})),r.push((()=>{this.exceptionObserver=new hh(this),this.exceptionObserver.startIfEnabledOrStop()})),r.push((()=>{this.deadClicksAutocapture=new Ql(this,fR),this.deadClicksAutocapture.startIfEnabled()})),r.push((()=>{if(this.os){var i=this.os;this.os=void 0,this.yi(i)}})),this.ls(r,t)}ls(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.ls(e,t)}),0);var r=e.shift();if(r)try{r()}catch(s){U.error("Error initializing extension:",s)}}var i=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:i}),this.config.__preview_deferred_init_extensions&&U.info("PostHog extensions initialized ("+i+"ms)")}yi(e){var t,r,i,s,o,a,l,c,u;if(!W||!W.body)return U.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.yi(e)}),500);this.config.__preview_deferred_init_extensions&&(this.os=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ce(e.supportedCompression,fn.GZipJS)?fn.GZipJS:ce(e.supportedCompression,fn.Base64)?fn.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Vr?this.Vr:"identified_only"}),(r=this.siteApps)==null||r.onRemoteConfig(e),(i=this.sessionRecording)==null||i.onRemoteConfig(e),(s=this.autocapture)==null||s.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(a=this.productTours)==null||a.onRemoteConfig(e),(l=this.webVitalsAutocapture)==null||l.onRemoteConfig(e),(c=this.exceptionObserver)==null||c.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}ns(){try{this.config.loaded(this)}catch(r){U.critical("`loaded` function failed",r)}if(this.us(),this.config.internal_or_test_user_hostname&&je!=null&&je.hostname){var e=je.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.hs()}),1),new Nh(this).load(),this.featureFlags.flags()}us(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Zr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Zn(this.__request_queue,(e=>this.ts(e))),this.__request_queue=[],this.us()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.ds()&&this.capture("$pageleave"),(e=this.Zr)==null||e.unload(),(t=this.es)==null||t.unload()):this.ds()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(D0?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=nc(e.url,{ip:this.config.ip?1:0}),e.headers=z({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var r,i,s,o=z({},t);o.timeout=o.timeout||6e4,o.url=nc(o.url,{_:new Date().getTime().toString(),ver:dn.LIB_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=Hl.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(i=(s=r0(l,(u=>u.transport===a)))==null?void 0:s.method)!==null&&i!==void 0?i:l[0].method;if(!c)throw new Error("No available transport method");c(o)})(z({},e,{callback:t=>{var r,i;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((r=(i=this.config).on_request_error)==null||r.call(i,t)),e.callback==null||e.callback(t)}}))))}ts(e){this.es?this.es.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,r=[],i=[],s=[];Zn(e,(a=>{a&&(t=a[0],fe(t)?s.push(a):qn(a)?a.call(this):fe(a)&&t==="alias"?r.push(a):fe(a)&&t.indexOf("capture")!==-1&&qn(this[t])?s.push(a):i.push(a))}));var o=function(a,l){Zn(a,(function(c){if(fe(c[0])){var u=l;we(c,(function(d){u=u[d[0]].apply(u,d.slice(1))}))}else this[c[0]].apply(this,c.slice(1))}),l)};o(r,this),o(i,this),o(s,this)}ss(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,r){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zr){if(this.is_capturing())if(!j(e)&&Oe(e)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var o=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!Oe(t?.$current_url)&&(U.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,l=r?.timestamp||a,c=zn(),u={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},l,c)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),o&&(u.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),r?.$set&&(u.$set=r?.$set);var d,h=e!=="$groupidentify",g=this.vs(r?.$set_once,h);if(g&&(u.$set_once=g),(u=zA(u,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,j(r?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===Mo.DISMISSED||e===Mo.SENT){var v=t?.[Mp.SURVEY_ID],f=t?.[Mp.SURVEY_ITERATION];d={id:v,current_iteration:f},localStorage.getItem(A_(d))||localStorage.setItem(A_(d),"true"),u.$set=z({},u.$set,{[NR({id:v,current_iteration:f},e===Mo.SENT?"responded":"dismissed")]:!0})}else e===Mo.SHOWN&&(u.$set=z({},u.$set,{[Mp.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=z({},u.properties.$set,u.$set);if(Vi(m)||this.setPersonPropertiesForFlags(m),!ue(this.config.before_send)){var y=this.cs(u);if(!y)return;u=y}this.qr.emit("eventCaptured",u);var k={method:"POST",url:(i=r?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.ts(k):this.Zr.enqueue(k),u}U.critical("This capture call is ignored due to client rate limiting.")}}else U.error("No event name provided to posthog.capture")}else U.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var o=s?void 0:this.persistence.remove_event_timer(e),a=z({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=z({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!Oe(a.distinct_id)&&!vn(a.distinct_id)||Fp(a.distinct_id))&&U.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=xR(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());a.$session_id=d,a.$window_id=h}this.sessionPropsManager&&Ie(a,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&Ie(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(g=this.es)==null?void 0:g.length}catch(y){a.$sdk_debug_error_capturing_properties=String(y)}if(this.requestRouter.region===Po.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||s?e!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=Ie(a,c),e==="$pageview"&&W&&(a.title=W.title),!j(o)){var v=r.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}st&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ie({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),fe(this.config.property_denylist)?we(this.config.property_denylist,(function(y){delete a[y]})):U.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var f=this.config.sanitize_properties;f&&(U.error("sanitize_properties is deprecated. Use before_send instead"),a=f(a,e));var m=this.fs();return a.$process_person_profile=m,m&&!s&&this.ps("_calculate_event_properties"),a}vs(e,t){var r;if(t===void 0&&(t=!0),!this.persistence||!this.fs()||this.Br)return e;var i=this.persistence.get_initial_props(),s=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=Ie({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(U.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.Br=!0),Vi(o)?void 0:o}register(e,t){var r;(r=this.persistence)==null||r.register(e,t)}register_once(e,t,r){var i;(i=this.persistence)==null||i.register_once(e,t,r)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}gs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,r){var i=r!=null&&r.merge?this.featureFlags.getFlagVariants():{},s=r!=null&&r.merge?this.featureFlags.getFlagPayloads():{},o=z({},i,e),a=z({},s,t),l={};for(var[c,u]of Object.entries(o)){var d=typeof u=="string";l[c]={key:c,enabled:!!d||!!u,variant:d?u:void 0,reason:void 0,metadata:j(a?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:a[c]}}}this.featureFlags.receivedFeatureFlags({flags:l})}updateEarlyAccessFeatureEnrollment(e,t,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,r)}on(e,t){return this.qr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,r;return(t=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=FR),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,r){if(!this.__loaded||!this.persistence)return U.uninitializedWarning("posthog.identify");if(vn(e)&&(e=e.toString(),U.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))U.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==vo){if(this.ps("posthog.identify")){var i=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==i&&e!==this.get_property(Ao)&&(this.unregister(Ao),this.register({distinct_id:e}));var o=(this.persistence.get_property(pn)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(pn,"identified"),this.setPersonPropertiesForFlags(z({},r||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:r||{}}),this.Jr=x_(e,t,r),this.featureFlags.setAnonymousDistinctId(i)):(t||r)&&this.setPersonProperties(t,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(Ul))}}else U.critical('The string "'+vo+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else U.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var r=x_(this.get_distinct_id(),e,t);this.Jr!==r?(this.setPersonPropertiesForFlags(z({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=r):U.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,r){if(e&&t){var i=this.getGroups();i[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:z({},i,{[e]:t})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),i[e]===t||r||this.reloadFeatureFlags()}else U.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.ps("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,r,i,s;if(U.info("reset"),!this.__loaded)return U.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(r=this.sessionPersistence)==null||r.clear(),this.surveys.reset(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(pn,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:vo,$device_id:null},"");else{var a=this.config.get_device_id(zn());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&r){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return i}alias(e,t){return e===this.get_property(i0)?(U.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(j(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(Ao,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(U.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=z({},this.config);if(Pe(e)){var r,i,s,o,a,l,c;Ie(this.config,$_(e));var u=this.Qr();(r=this.persistence)==null||r.update_config(this.config,t,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new No(z({},this.config,{persistence:"sessionStorage"}),u);var d=this.Kr(this.config.debug);mn(d)&&(this.config.debug=d),mn(this.config.debug)&&(this.config.debug?(dn.DEBUG=!0,Ce.H()&&Ce.G("ph_debug","true"),U.info("set_config",{config:e,oldConfig:t,newConfig:z({},this.config)})):(dn.DEBUG=!1,Ce.H()&&Ce.V("ph_debug"))),(i=this.exceptionObserver)==null||i.onConfigChange(),(s=this.sessionRecording)==null||s.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this._s(),(c=this.externalIntegrations)==null||c.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,r={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(r).some(Boolean)){var i,s,o,a,l;(i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),r.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),r.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),r.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),r.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(z({},i,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Hi;return t!==Hi&&(t=Hi+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(pn))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(pn))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Vi(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Ao])&&((t=this.persistence)==null||(t=t.props)==null||!t[ql]))}ds(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.fs()||this.ps("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ps("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ps(e){return this.config.person_profiles==="never"?(U.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(ql,!0),!0)}Qr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}_s(){var e,t,r,i,s=this.Qr();return((e=this.persistence)==null?void 0:e.ki)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((t=this.sessionPersistence)==null?void 0:t.ki)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){var t;if(this.config.cookieless_mode!=="always"){var r,i,s;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new sc(this),this.pageViewManager=new Jl(this),this.persistence&&(this.sessionPropsManager=new ic(this,this.sessionManager,this.persistence)),this.sessionRecording=new oc(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this._s(),this.us(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(j(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((s=e?.captureEventName)!==null&&s!==void 0?s:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hs()}else U.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._s(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:vo,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.hs())):U.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===hn.GRANTED?"granted":e===hn.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._s()}_is_bot(){return pt?F0(pt,this.config.custom_blocked_useragents):void 0}hs(){W&&(W.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:W.title},{send_instantly:!0}),this.Gr&&(W.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),Me(W,"visibilitychange",this.Gr)))}debug(e){e===!1?(C?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(C?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}M(){var e,t,r,i,s,o,a,l=this.Yr||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(U.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",i=!1,s=U,o=(t="advanced_disable_flags")in(e=l)&&!ue(e[t]),a=r in e&&!ue(e[r]),o?e[t]:a?(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r]):i)}cs(e){if(ue(this.config.before_send))return e;var t=fe(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of t){if(r=i(r),ue(r)){var s="Event '"+e.event+"' was rejected in beforeSend function";return yA(e.event)?U.warn(s+". This can cause unexpected behavior."):U.info(s),null}r.properties&&!Vi(r.properties)||U.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.Kt)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}Kr(e){var t=mn(e)&&!e,r=Ce.H()&&Ce.q("ph_debug")==="true";return!t&&(!!r||e)}};(function(n,e){for(var t=0;t<e.length;t++)n.prototype[e[t]]=UA(n.prototype[e[t]])})(ac,["identify"]);var M_;var H0=(M_=Lo[Hi]=new ac,(function(){function n(){n.done||(n.done=!0,D0=!1,we(Lo,(function(e){e._dom_loaded()})))}W!=null&&W.addEventListener?W.readyState==="complete"?n():Me(W,"DOMContentLoaded",n,{capture:!1}):C&&U.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),M_);var rf=class{constructor(e={}){this.options=e;if(this.client=e.client,this.featureFlagsCallback=e.onFeatureFlagsLoaded,this.captureCallback=e.onCapture,this.rrwebCallback=e.onRRWebEvent,!this.client&&e.consent&&e.requireExplicitConsent&&typeof window<"u"&&e.apiKey){let t=e.consent;t.getStatus()==="granted"&&this.initPostHog(),t.subscribe(i=>{i==="granted"?this.client?this.client.opt_in_capturing():this.initPostHog():i==="denied"&&this.client&&this.client.opt_out_capturing()});return}!this.client&&typeof window<"u"&&e.apiKey&&this.initPostHog()}initPostHog(){let e=this.options;if(!e.apiKey)return;let t=e.enableFeatureFlags??!0,r=`syntro_${e.apiKey.slice(-6)||"sdk"}`,o={api_host:`${(e.apiHost??"https://telemetry.syntrologie.com").replace(/\/$/,"")}/t/${e.apiKey}`,advanced_disable_feature_flags:!t,advanced_disable_feature_flags_on_first_load:!t,autocapture:e.autocapture??!0,capture_pageview:e.capturePageview??"history_change",capture_pageleave:e.capturePageleave??!0,disable_session_recording:!(e.sessionRecording??!0),opt_out_useragent_filter:!0,session_recording:{recordCrossDomainIFrames:!0},capture_performance:!0,enable_recording_console_log:!0},a=H0.init(e.apiKey,o,r);if(a&&(this.client=a),this.captureCallback&&this.client&&this.client.on("eventCaptured",(...l)=>{let c=l[0],u=typeof c=="string"?c:c?.event,d=typeof c=="string"?void 0:c?.properties;typeof u=="string"&&this.captureCallback?.(u,d)}),t&&this.featureFlagsCallback&&this.client){this.client.onFeatureFlags(()=>{let c=this.getAllFeatureFlags();c&&this.featureFlagsCallback&&this.featureFlagsCallback(c)});let l=this.getAllFeatureFlags();l&&Object.keys(l).length>0&&this.featureFlagsCallback(l)}this.rrwebCallback&&this.client&&this.setupRRWebIntercept()}setupRRWebIntercept(e=30){let t=this.client?.sessionRecording;if(!t){e>0&&setTimeout(()=>this.setupRRWebIntercept(e-1),500);return}let r=null,i=t;for(let o of Object.getOwnPropertyNames(i)){let a=i[o];if(a&&typeof a=="object"&&typeof a.onRRwebEmit=="function"&&typeof a.start=="function"&&a!==t){r=a;break}}if(!r){e>0&&setTimeout(()=>this.setupRRWebIntercept(e-1),500);return}let s=r.onRRwebEmit.bind(r);r.onRRwebEmit=o=>{this.rrwebCallback?.({kind:"rrweb",...o}),s(o)},typeof window<"u"&&(window.__RRWEB_INTERCEPT_READY__=!0)}getAllFeatureFlags(){return this.client?.featureFlags?.getFlagVariants()}getSegmentFlags(){let e=this.getAllFeatureFlags();if(!e)return{};let t={};for(let[r,i]of Object.entries(e))r.startsWith("in_segment_")&&(t[r]=i===!0);return t}identify(e,t){this.client?.identify(e,t)}alias(e,t){this.client?.alias(e,t)}track(e,t){this.client?.capture(e,t)}trackCanvasOpened(e){this.track("shadow_canvas_opened",{surface:e})}trackCanvasClosed(e){this.track("shadow_canvas_closed",{surface:e})}trackRectangleViewed(e,t){this.track("shadow_canvas_rectangle_viewed",{rectangleId:e,surface:t})}trackAction(e,t,r){this.track("shadow_canvas_action",{action:e,rectangleId:t,surface:r})}register(e){this.client?.register?.(e)}getSessionId(){return this.client?.get_session_id?.()}startSessionRecording(){this.client?.startSessionRecording?.()}trackExperiment(e,t,r){let i=`$experiment_${e}`;this.register({[i]:r??`variation_${t}`,[`${i}_id`]:t}),this.track("$experiment_started",{$experiment_key:e,$experiment_variation_id:t,$experiment_variation_name:r??`variation_${t}`})}setPersonProperties(e){this.client?.capture("$set",{$set:e})}setPersonPropertiesOnce(e){this.client?.capture("$set",{$set_once:e})}getDistinctId(){return this.client?.get_distinct_id?.()}};function sf(n={}){return new rf(n)}var B0={posthog:n=>sf(n),noop:()=>mp()};function V0(n,e){let t=B0[n];if(!t)throw new Error(`Unknown telemetry provider: ${n}. Supported: ${Object.keys(B0).join(", ")}`);return t(e)}async function W0(n){Su(),X("Syntro Bootstrap","====== INIT ======"),X("Syntro Bootstrap","Options:",{hasToken:!!n.token,tokenPrefix:`${n.token?.slice(0,15)}...`,hasCanvasOptions:!!n.canvas});let e=ol();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",eo()),console.log("[DIAG] editorConf:",sl()),X("Syntro Bootstrap","SDK mode:",e??"normal"),!e&&typeof window<"u"){let A=!!window.__SYNTRO_EDITOR_PARAMS__,H=!!window.__SYNTRO_AUDIT_LEGEND__,M=!!window.__SYNTRO_REVIEW_DATA__;if(A||H||M){let V=[A&&"__SYNTRO_EDITOR_PARAMS__",H&&"__SYNTRO_AUDIT_LEGEND__",M&&"__SYNTRO_REVIEW_DATA__"].filter(Boolean);console.warn(`[Syntro Bootstrap] \u26A0 Mode detection returned null but mode-specific globals found: ${V.join(", ")}. This suggests URL params were lost (redirect?) but the service worker injected mode data. Check if replaceState failed or if page JS changed the URL before init().`)}}console.log(`[DIAG] Token resolution: options.token=${n.token?n.token.slice(0,15)+"...":"null"}`);let t=n.token;if(!t&&e){let H=sl()?.syntro_token;H?.startsWith("syn_")&&(t=H,X("Syntro Bootstrap",`\u2713 Using syntro_token from editor_conf (${e} mode)`))}let r;if(t)if(t.startsWith("syn_"))X("Syntro Bootstrap","Token starts with syn_, decoding..."),r=to(t),Su(r.d);else if(e)X("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw Ha("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),Ha("Syntro Bootstrap","Token received:",t),new Error("Invalid Syntro token: must start with 'syn_'");else if(e)X("Syntro Bootstrap",`\u2713 No token, but ${e} mode - proceeding`);else throw Ha("Syntro Bootstrap","\u274C No token provided and NOT in editor/audit/review mode!"),new Error("Syntro token is required (unless in editor, audit, or review mode)");let i=kt("NEXT_PUBLIC_SYNTRO_EXPERIMENT_HOST")||kt("VITE_SYNTRO_EXPERIMENT_HOST")||r?.eh,s=kt("NEXT_PUBLIC_SYNTRO_TELEMETRY_HOST")||kt("VITE_SYNTRO_TELEMETRY_HOST")||r?.th,o=kt("NEXT_PUBLIC_SYNTRO_EDITOR_URL")||kt("VITE_SYNTRO_EDITOR_URL")||n.canvas?.editorUrl,a=r?.g||kt("NEXT_PUBLIC_SYNTRO_GEO_HOST")||kt("VITE_SYNTRO_GEO_HOST")||Iy,l=Ay(),c=Sd(),u=n.appSignalsInit??{},d={...c,...l,...u};X("Syntro Bootstrap","Phase 1: Browser metadata:",c),X("Syntro Bootstrap","Phase 1: Cached segment attributes:",l),Object.keys(u).length>0&&X("Syntro Bootstrap","Phase 1: App signals:",u);let h=Ed(a),g=(()=>{try{if(typeof window>"u"||window.self===window.top)return Promise.resolve(null)}catch{}return new Promise(A=>{let H=setTimeout(()=>{window.removeEventListener("message",M),A(null)},500);function M(V){let de=V.data;de?.jsonrpc==="2.0"&&de?.id===1&&de?.result?.hostInfo&&(clearTimeout(H),window.removeEventListener("message",M),A(de.result.hostInfo))}window.addEventListener("message",M);try{window.parent.postMessage({jsonrpc:"2.0",id:1,method:"ui/initialize",params:{capabilities:{}}},"*")}catch{clearTimeout(H),window.removeEventListener("message",M),A(null)}})})(),v,f=n.debug||n.testMode,m=no({debug:n.debug,history:f?new ro(n.testMode?0:100):void 0,testMode:n.testMode});console.log("[Syntro Bootstrap] EventBus created");let y=bu({elementResolver:typeof window<"u"?(A,H)=>{let M=document.elementFromPoint(A,H);if(!M)return null;let V={tag_name:M.tagName.toLowerCase()};M.id&&(V.attr__id=M.id),M.className&&typeof M.className=="string"&&(V.classes=M.className.split(" ").filter(Boolean));for(let de of M.attributes)de.name.startsWith("data-")&&(V[`attr__${de.name}`]=de.value);return V}:void 0});y.onEvent(A=>m.publishEvent(A)),typeof window<"u"&&(setInterval(()=>y.tick(Date.now()),1e3),document.addEventListener("click",A=>{let H=[],M=A.target;for(;M&&M!==document.body;){let V={tag_name:M.tagName.toLowerCase()};for(let de of M.attributes)(de.name.startsWith("data-")||de.name==="id"||de.name==="class"||de.name==="aria-label")&&(V[`attr__${de.name}`]=de.value);H.push(V),M=M.parentElement}y.enrichClickAttributes(Date.now(),H)},!0));let k=A=>{X("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let H=Ty(A);if(X("Syntro Bootstrap","Segment flags from PostHog:",H),Ry(H),v){let M=b?.getAll?.()??{},V={...c,...M,...H,...u};X("Syntro Bootstrap","Updating GrowthBook with attributes:",V),v.setAttributes?.(V)}},_;if(r?.t){let A=r.t==="noop"?"noop":"posthog";_=V0(A,{apiKey:r.t,apiHost:s,enableFeatureFlags:!0,sessionRecording:!0,onFeatureFlagsLoaded:k,onCapture:(M,V)=>{y.ingest({kind:"posthog",event:M,properties:V,timestamp:Date.now()})},onRRWebEvent:M=>{y.ingest(M)}}),console.log(`[Syntro Bootstrap] Telemetry client created (${A}) with EventBus wiring`),Object.keys(u).length>0&&(_.track?.("app_signals_init",u),X("Syntro Bootstrap","Tracked app signals event:",u));let H=_;m.setPosthogCapture((M,V)=>{H.track?.(M,V)})}let b;r?.e&&(v=yb("growthbook",{clientKey:r.e,apiHost:i,attributes:d,onExperimentViewed:_?.trackExperiment?(A,H,M)=>{_.trackExperiment(A,H,M)}:void 0})),b=Kd({experiments:v,onMetricChange:(A,H)=>{X("Syntro Bootstrap",`Session metric changed: ${A} = ${H}`)}}),X("Syntro Bootstrap","SessionMetricTracker created");let w="production";e==="editor"?w="editor":e==="audit"?w="audit":kt("NODE_ENV")==="development"&&(w="development");let E=fp({telemetry:_,sessionMetrics:b,mode:w,events:m});X("Syntro Bootstrap","Runtime created:",{version:E.version,mode:E.mode,hasContext:!!E.context,hasEvents:!!E.events,hasState:!!E.state}),X("Syntro Bootstrap","Core app executors already registered");let x=n.cdnBase||kt("NEXT_PUBLIC_SYNTRO_CDN_BASE")||kt("VITE_SYNTRO_CDN_BASE")||"https://cdn.syntrologie.com",R=Zc({cdnBase:x,registry:E.apps,onLoadStart:A=>{X("Syntro Bootstrap",`Loading app from CDN: ${A}`)},onLoadEnd:(A,H,M)=>{H?X("Syntro Bootstrap",`App loaded successfully: ${A}`):ct("Syntro Bootstrap",`Failed to load app: ${A}`,M)}});typeof window<"u"&&(window.SynOS={...window.SynOS,appRegistry:E.apps,runtime:E,version:E.version},X("Syntro Bootstrap","Global SynOS object exposed"));let I=E.apps.list?.()??[];console.log(`[DIAG] Activation loop: ${I.length} apps in registry:`,I.map(A=>`${A.manifest.id}(${A.state})`).join(", "));for(let A of I)if(A.state==="registered")try{await E.apps.activate(A.manifest.id),console.log(`[DIAG] Activated: ${A.manifest.id} \u2192 widgets: [${E.widgets.list().join(", ")}]`)}catch(H){console.error(`[DIAG] FAILED to activate: ${A.manifest.id}`,H),ct("Syntro Bootstrap",`Failed to auto-activate built-in app: ${A.manifest.id}`,H)}if(console.log(`[DIAG] Activation complete. Total widgets: [${E.widgets.list().join(", ")}]`),v?.refreshFeatures)try{await v.refreshFeatures(),X("Syntro Bootstrap","GrowthBook features loaded")}catch(A){ct("Syntro Bootstrap","Failed to load GrowthBook features:",A)}let O=await h;if(v&&Object.keys(O).length>0){let A={...c,...O,...u};X("Syntro Bootstrap","Merging geo data into GrowthBook attributes:",O),v.setAttributes?.(A)}let P=await g;P&&v&&(c.surface_type="mcp-app",c.surface_host=P.name,v.setAttributes?.({...c,...O}),X("Syntro Bootstrap","MCP App detected:",P.name));let G;if(n.fetcher)G=n.fetcher;else if(r?.f){let A=wb(r.f,r.o??{});G=async()=>{let H=await A.fetch();return{...H.config,tiles:H.config.tiles??[]}}}else v&&(G=hi({experiments:v}));let L=new Set,F=G?async()=>{let A=await G(),H=A.tiles?.length??0,M=A.actions?.length??0,V=A.meta?.variant_id;if((H>0||M>0)&&(V||console.warn("[Syntro] Config has content but no meta.variant_id \u2014 intervention tracking disabled")),_&&V){let ge=new mo(_,V);ge.trackServed(H,M),typeof window<"u"&&(window.SynOS.interventionTracker=ge),E.navigation.subscribe(()=>{ge.resetPage()})}console.log("[Syntro Bootstrap] Config fetched:",`tiles=${A.tiles?.length??0},`,`actions=${A.actions?.length??0},`,`theme=${A.theme?.name??"none"}`),A.actions?.length>0&&console.log("[Syntro Bootstrap] Actions in config:",A.actions.map((ge,Fe)=>`[${Fe}] ${ge.kind}${ge.anchorId?` anchor="${ge.anchorId.selector}"`:""}${ge.label?` "${ge.label}"`:""}`).join(", "));let de=A,tt=R.getRequiredApps(de);return tt.length>0?console.log("[Syntro Bootstrap] Required external apps:",tt.join(", ")):X("Syntro Bootstrap","No external apps required (all executors are built-in)"),tt.length>0&&await R.loadAppsForConfig(de).then(async Fe=>{let ze=Fe.filter($e=>$e.success),yn=Fe.filter($e=>!$e.success);ze.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${ze.map($e=>$e.appId).join(", ")}`);let ht=yn.filter($e=>!L.has($e.appId));ht.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",ht.map($e=>`${$e.appId} (${$e.error})`).join(", ")),ht.forEach($e=>L.add($e.appId)));for(let $e of tt)if(E.apps.has($e))try{await E.apps.activate($e),console.log(`[Syntro Bootstrap] App activated: ${$e}`)}catch(dc){console.error(`[Syntro Bootstrap] Failed to activate app: ${$e}`,dc)}else console.error(`[Syntro Bootstrap] App "${$e}" required by config but NOT registered.`,`Available apps: [${Array.from(E.apps.list?.()??[]).join(", ")}]`)}),A}:void 0;return{canvas:await xd({...n.canvas,fetcher:F,integrations:{experiments:v,telemetry:_},editorUrl:o,runtime:E}),runtime:E,experiments:v,telemetry:_,sessionMetrics:b,appLoader:R}}async function UR(n){try{return await W0(n)}catch(e){let t=e instanceof Error?e.message:String(e);console.warn("[Syntrologie] SDK initialization failed:",t),typeof document<"u"&&document.getElementById("syntrologie-anti-flicker")?.remove();return}}function zR(n,e={}){if(typeof window>"u")return;let t=window.SynOS?.runtime;t?.events?.publish&&t.events.publish({name:n,source:"custom",props:e})}var j0={init:UR,encodeToken:kd,decodeToken:to,events:{emit:zR}};typeof window<"u"&&(window.Syntro=j0);function qo(n){let e=n.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function k4(n){let e=[],t=[];if(!n||typeof n!="object")return{valid:!1,errors:["Config must be an object"],warnings:e};let r=n;if(r.tiles||t.push("Config missing required field: tiles"),r.actions||t.push("Config missing required field: actions"),r.fetchedAt||t.push("Config missing required field: fetchedAt"),t.length>0)return{valid:!1,errors:t,warnings:e};let i=r.schemaVersion||"1.0",s=qo(i),o=qo(En);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${En}. Some features may not work. Update SDK to latest version.`),s.major<o.major||!r.schemaVersion?(e.push(`Config schema v${i} is older than SDK v${En}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:qR(r,i)}):{valid:!0,warnings:e,errors:t}}function qR(n,e){let t={...n};return qo(e).major===1&&(t=ZR(t)),t.schemaVersion=En,t}function ZR(n){let e={schemaVersion:"2.0",tiles:[],actions:n.actions||[],fetchedAt:n.fetchedAt||new Date().toISOString()};return n.tiles&&Array.isArray(n.tiles)&&(e.tiles=n.tiles.map(t=>{let r={...t};return t.experiment&&delete r.experiment,r})),n.configVersion&&(e.configVersion=n.configVersion),n.canvasTitle&&(e.canvasTitle=n.canvasTitle),n.theme&&(e.theme=n.theme),n.launcher&&(e.launcher=n.launcher),e}function S4(n){if(!n||typeof n!="object")return!1;let e=n,t=e.schemaVersion||"1.0",r=qo(t),i=qo(En);return r.major<i.major||!e.schemaVersion}var GR=p.object({url:p.string(),routeId:p.string().optional(),title:p.string().optional(),locale:p.string().optional()}),KR=p.object({url:p.string(),ts:p.number()}),YR=p.object({sessionId:p.string(),startTs:p.number(),pageHistory:p.array(KR).optional()}),XR=p.object({width:p.number(),height:p.number()}),QR=p.object({x:p.number(),y:p.number(),w:p.number(),h:p.number()}),JR=p.object({anchorId:p.string(),present:p.boolean(),visible:p.boolean().optional(),boundingBox:QR.optional()}),eT=p.record(p.string(),p.union([p.number(),p.string(),p.boolean(),p.undefined()])),tT=p.object({page:GR,session:YR,viewport:XR,anchors:p.array(JR).optional(),augmented:eT.optional()});function A4(n){return tT.safeParse(n)}var of=class{constructor(e,t,r,i){this._isFallback=!0;this._isLoading=!0;this._cancelled=!1;this._host=e,this._runtime=t,this._strategy=r,this._defaultValue=i,this._value=i,e.addController(this)}get value(){return this._value}get isFallback(){return this._isFallback}get isLoading(){return this._isLoading}hostConnected(){this._evaluate()}hostDisconnected(){this._cancelled=!0}setStrategy(e){this._strategy=e,this._evaluate()}_evaluate(){if(this._cancelled=!1,!this._runtime||!this._strategy){this._value=this._defaultValue,this._isFallback=!0,this._isLoading=!1,this._host.requestUpdate();return}this._isLoading=!0,this._host.requestUpdate();let e=this._strategy;this._runtime.evaluate(e).then(t=>{this._cancelled||(this._value=t.value,this._isFallback=t.isFallback,this._isLoading=!1,this._host.requestUpdate())})}};var af=class{constructor(e,t){this._unsubscribe=null;this.host=e,this._runtime=t,this._context=t.context.get(),e.addController(this)}hostConnected(){this._context=this._runtime.context.get(),this._unsubscribe=this._runtime.context.subscribe(e=>{this._context=e,this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}get runtime(){return this._runtime}get context(){return this._context}get page(){return this._context?.page??null}get session(){return this._context?.session??null}get viewport(){return this._context?.viewport??null}};var lf=class{constructor(e,t,r,i){this._host=e,this._runtime=t,this._filter=r,this._callback=i,e.addController(this)}hostConnected(){this._subscribe()}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=void 0}setFilter(e){this._filter=e,this._unsubscribe!==void 0&&(this._unsubscribe(),this._unsubscribe=void 0,this._subscribe())}setCallback(e){this._callback=e,this._unsubscribe!==void 0&&(this._unsubscribe(),this._unsubscribe=void 0,this._subscribe())}_subscribe(){this._runtime&&(this._unsubscribe=this._filter?this._runtime.events.subscribe(this._filter,this._callback):this._runtime.events.subscribe(this._callback))}};var U0=p.enum(["posthog","canvas","derived"]),nT=p.object({ts:p.number(),name:p.string(),source:U0,props:p.record(p.string(),p.unknown()).optional(),schemaVersion:p.string()}),rT=p.object({names:p.array(p.string()).optional(),patterns:p.array(p.string()).optional(),sources:p.array(U0).optional()});function X4(n){return nT.safeParse(n)}function Q4(n){return rT.safeParse(n)}var z0=p.union([p.object({type:p.literal("data"),key:p.string(),value:p.string().optional()}),p.object({type:p.literal("css"),value:p.string()}),p.object({type:p.literal("aria"),role:p.string().optional(),label:p.string().optional()}),p.object({type:p.literal("shadow-css"),value:p.string()}),p.object({type:p.literal("ref"),el:p.any()})]),iT=p.object({kind:p.literal("tooltip"),id:p.string(),anchor:z0,content:p.object({title:p.string().optional(),body:p.string()}),placement:p.enum(["top","bottom","left","right","auto"]).optional(),offsetPx:p.number().optional(),blocking:p.boolean().optional(),trigger:p.enum(["immediate","hover","click"]).optional(),dismiss:p.object({onEsc:p.boolean().optional(),closeButton:p.boolean().optional(),timeoutMs:p.number().optional()}).optional()}),sT=p.object({kind:p.literal("highlight"),id:p.string(),anchor:z0,copy:p.string().optional(),ring:p.object({paddingPx:p.number().optional(),radiusPx:p.number().optional()}).optional(),scrim:p.object({opacity:p.number().optional()}).optional(),ringColor:p.string().optional(),blocking:p.boolean().optional(),dismiss:p.object({onClickOutside:p.boolean().optional(),onEsc:p.boolean().optional(),timeoutMs:p.number().optional()}).optional()}),cf=p.object({id:p.string(),version:p.number(),routes:p.array(p.string()).optional(),steps:p.array(p.union([iT,sT]))});function hD(n){return cf.parse(n)}var vD=({configUri:n,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:r="include"}={})=>async()=>{let i=Cu({configUri:n,experiments:e,featureKey:t});if(!i)throw new Error("SmartCanvas overlays: recipe URI missing (env + feature unset).");let s=await fetch(i,{credentials:r});if(!s.ok)throw new Error(`SmartCanvas overlays: failed to fetch recipe (${s.status})`);let o=await s.json();return cf.parse(o)};var oT=p.object({value:p.unknown(),expiresAt:p.number().optional()}),aT=p.object({count:p.number(),resetAt:p.number().optional()});function _D(n){return oT.safeParse(n)}function xD(n){return aT.safeParse(n)}var q0="2026-04-23T15:26:01.916Z (9d88186d214)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${q0} (Lit)`);let n=window.SynOS,e=n?.appRegistry||vs;window.SynOS={...n,appRegistry:e,_runtimeBuild:q0,_renderer:"lit"},ja(),Ym(e)}export{go as ANIMATION_KEYFRAMES,rl as ActivationConfigZ,ty as AddClassZ,wt as AnchorIdZ,JR as AnchorStateZ,od as AnchorVisibleConditionZ,ms as AppRegistry,eT as AugmentationZ,Uv as BadgePositionZ,ay as BadgeZ,QR as BoundingBoxZ,Ps as CanvasEvents,cf as CanvasRecipeZ,Ln as ConditionZ,Al as ContextManager,pd as CooldownActiveConditionZ,qs as CounterDefZ,vd as CtaButtonZ,xu as DEFAULT_COOLDOWN,of as DecisionController,Qs as DecisionStrategyZ,dd as DismissedConditionZ,Te as EVENT_SCHEMA_VERSION,ll as EventBus,fd as EventCountConditionZ,rT as EventFilterZ,ro as EventHistory,ad as EventOccurredConditionZ,U0 as EventSourceZ,Za as ExecutorRegistry,Xs as ExternalStrategyZ,aT as FrequencyEntryZ,hd as FrequencyLimitConditionZ,sT as HighlightStepZ,jv as HighlightStyleZ,sy as HighlightZ,iy as InsertHtmlZ,Gv as InsertPositionZ,mo as InterventionTracker,_u as MAX_VISIBLE_TOASTS,zs as MatchOpZ,Zv as ModalContentZ,cy as ModalZ,Ys as ModelStrategyZ,py as MountWidgetZ,dy as NavigateZ,uo as NavigationMonitor,nT as NormalizedEventZ,Ms as NotificationsController,GR as PageContextZ,KR as PageHistoryEntryZ,id as PageUrlConditionZ,gy as ParallelZ,zv as PlacementZ,oy as PulseZ,q0 as RUNTIME_SDK_BUILD,Fb as RUNTIME_VERSION,ny as RemoveClassZ,sd as RouteConditionZ,Wv as RouteFilterZ,Gs as RuleStrategyZ,Zs as RuleZ,tT as RuntimeContextZ,af as RuntimeController,lf as RuntimeEventsController,En as SDK_SCHEMA_VERSION,Eu as SDK_VERSION,Pb as STATIC_SLOT_STYLES,Ks as ScoreStrategyZ,Qv as ScrollBehaviorZ,md as ScrollLogicalPositionZ,uy as ScrollToZ,z0 as SelectorZ,fy as SequenceZ,YR as SessionContextZ,ud as SessionMetricConditionZ,Cl as SessionMetricTracker,ey as SetAttrZ,ry as SetStyleZ,Jv as SetTextZ,Au as SmartCanvasController,mi as SmartCanvasElementLit,Be as StandardEvents,ld as StateEqualsConditionZ,Il as StateStore,oT as StoredValueZ,j0 as Syntro,Os as ThemeController,qv as TooltipContentZ,iT as TooltipStepZ,Kv as TooltipTriggerZ,ly as TooltipZ,Xv as TourStepForSchemaZ,my as TourZ,nl as TriggerWhenZ,cd as ViewportConditionZ,XR as ViewportContextZ,hy as WaitZ,Yv as WidgetConfigZ,Ml as WidgetRegistry,ip as applyStaticSlotStyles,q1 as coreActionStepSchemas,ed as createActionEngine,yd as createAnchorResolver,hi as createCanvasConfigFetcher,Xd as createContextManager,Qd as createDecisionEngine,Jd as createEventAccumulator,no as createEventBus,qd as createGrowthBookClient,mp as createNoopClient,vD as createOverlayRecipeFetcher,sf as createPostHogClient,ev as createPostHogNormalizer,Kd as createSessionMetricTracker,xd as createSmartCanvas,ov as createSmartCanvasController,fp as createSmartCanvasRuntime,rp as createStateStore,cp as createSurfaceContainer,dp as createSurfaces,LN as decisionSchemas,to as decodeToken,kd as encodeToken,Rb as evaluate,Eb as evaluateCondition,Cb as evaluateRule,Rl as evaluateRuleStrategy,Tl as evaluateScoreStrategy,Tb as evaluateSync,tn as executorRegistry,Z1 as getAntiFlickerSnippet,xE as getExecutor,$l as getSlotAnchorId,fo as getSlotType,up as getSlotZIndex,Du as hasExecutor,S4 as needsMigration,Is as normalizePostHogEvent,qo as parseVersion,ap as playEnterAnimation,lp as playExitAnimation,fi as registerConfigPredicates,ja as registerSmartCanvasElement,Cu as resolveConfigUri,pE as runtimeContext,sp as setupAdjacentPositioning,op as setupInlinePositioning,$s as shouldNormalizeEvent,Bt as validateAction,Ya as validateActions,NN as validateActivationConfig,PN as validateCondition,k4 as validateConfig,Q4 as validateEventFilter,Cd as validateEventName,xD as validateFrequencyEntry,X4 as validateNormalizedEvent,Ad as validateProps,hD as validateRecipe,A4 as validateRuntimeContext,_D as validateStoredValue,ON as validateStrategy,pp as widgetRegistry};
|
|
1162
|
+
`)).length,i=0;i<r;i++){var o=n.charCodeAt(i),a=null;o<128?t++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),Dt(a)||(t>e&&(s+=n.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=n.substring(e,n.length)),s},HR=!!Bp||!!Hp,C_="text/plain",oc=function(n,e,t){var r;t===void 0&&(t=!0);var[i,s]=n.split("?"),o=U({},e),a=(r=s?.split("&").map((c=>{var u,[d,h]=c.split("="),g=t&&(u=o[d])!==null&&u!==void 0?u:h;return delete o[d],d+"="+g})))!==null&&r!==void 0?r:[],l=pR(o);return l&&a.push(l),i+"?"+a.join("&")},Mo=(n,e)=>JSON.stringify(n,((t,r)=>typeof r=="bigint"?r.toString():r),e),Mp=n=>{var{data:e,compression:t}=n;if(e){if(t===mn.GZipJS){var r=FR((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var d=new St(l.length+(l.length>>>1)),h=0,g=function(y){d[h++]=y},v=0;v<u;++v){if(h+5>d.length){var f=new St(h+8+(u-v<<1));f.set(d),d=f}var m=l.charCodeAt(v);m<128||c?g(m):m<2048?(g(192|m>>>6),g(128|63&m)):m>55295&&m<57344?(g(240|(m=65536+(1047552&m)|1023&l.charCodeAt(++v))>>>18),g(128|m>>>12&63),g(128|m>>>6&63),g(128|63&m)):(g(224|m>>>12),g(128|m>>>6&63),g(128|63&m))}return H0(d,0,h)})(Mo(e)),{mtime:0}),i=new Blob([r],{type:C_});return{contentType:C_,body:i,estimatedSize:i.size}}if(t===mn.Base64){var s=(function(l){var c,u,d,h,g,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=0,m=0,y="",k=[];if(!l)return l;l=DR(l);do c=(g=l.charCodeAt(f++)<<16|l.charCodeAt(f++)<<8|l.charCodeAt(f++))>>18&63,u=g>>12&63,d=g>>6&63,h=63&g,k[m++]=v.charAt(c)+v.charAt(u)+v.charAt(d)+v.charAt(h);while(f<l.length);switch(y=k.join(""),l.length%3){case 1:y=y.slice(0,-2)+"==";break;case 2:y=y.slice(0,-1)+"="}return y})(Mo(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Mo(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Mo(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},jl=[];Hp&&jl.push({transport:"fetch",method:n=>{var e,t,{contentType:r,body:i,estimatedSize:s}=(e=Mp(n))!==null&&e!==void 0?e:{},o=new Headers;ke(n.headers,(function(u,d){o.append(d,u)})),r&&o.append("Content-Type",r);var a=n.url,l=null;if(qb){var c=new qb;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),n.timeout)}}Hp(a,U({method:n?.method||"GET",headers:o,keepalive:n.method==="POST"&&(s||0)<52428.8,body:i,signal:(t=l)==null?void 0:t.signal},n.fetchOptions)).then((u=>u.text().then((d=>{var h={statusCode:u.status,text:d};if(u.status===200)try{h.json=JSON.parse(d)}catch(g){j.error(g)}n.callback==null||n.callback(h)})))).catch((u=>{j.error(u),n.callback==null||n.callback({statusCode:0,text:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Bp&&jl.push({transport:"XHR",method:n=>{var e,t=new Bp;t.open(n.method||"GET",n.url,!0);var{contentType:r,body:i}=(e=Mp(n))!==null&&e!==void 0?e:{};ke(n.headers,(function(s,o){t.setRequestHeader(o,s)})),r&&t.setRequestHeader("Content-Type",r),n.timeout&&(t.timeout=n.timeout),n.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var s={statusCode:t.status,text:t.responseText};if(t.status===200)try{s.json=JSON.parse(t.responseText)}catch{}n.callback==null||n.callback(s)}},t.send(i)}}),pt!=null&&pt.sendBeacon&&jl.push({transport:"sendBeacon",method:n=>{var e=oc(n.url,{beacon:"1"});try{var t,{contentType:r,body:i}=(t=Mp(n))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:r}):i;pt.sendBeacon(e,s)}catch{}}});var ac=function(n,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(n)}catch{return!1}};function A_(n,e,t){return Mo({distinct_id:n,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var B0={exact:(n,e)=>e.some((t=>n.some((r=>t===r)))),is_not:(n,e)=>e.every((t=>n.every((r=>t!==r)))),regex:(n,e)=>e.some((t=>n.some((r=>ac(t,r))))),not_regex:(n,e)=>e.every((t=>n.every((r=>!ac(t,r))))),icontains:(n,e)=>e.map(Vl).some((t=>n.map(Vl).some((r=>t.includes(r))))),not_icontains:(n,e)=>e.map(Vl).every((t=>n.map(Vl).every((r=>!t.includes(r))))),gt:(n,e)=>e.some((t=>{var r=parseFloat(t);return!isNaN(r)&&n.some((i=>r>parseFloat(i)))})),lt:(n,e)=>e.some((t=>{var r=parseFloat(t);return!isNaN(r)&&n.some((i=>r<parseFloat(i)))}))},Vl=n=>n.toLowerCase();function V0(n,e){return!n||Object.entries(n).every((t=>{var[r,i]=t,s=e?.[r];if(W(s)||Dt(s))return!1;var o=[String(s)],a=B0[i.operator];return!!a&&a(i.values,o)}))}var Pp=Ie("[Error tracking]"),Th=class{constructor(e){var t,r;this.Zt=[],this.ti=new Gp([new Yp,new rh,new Jp,new Xp,new th,new eh,new Qp,new nh],GA()),this._instance=e,this.Zt=(t=(r=this._instance.persistence)==null?void 0:r.get_property(sh))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,r,i,s=(t=(r=e.errorTracking)==null?void 0:r.suppressionRules)!==null&&t!==void 0?t:[],o=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this.Zt=s,this._instance.persistence&&this._instance.persistence.register({[sh]:this.Zt,[s_]:o})}get ii(){var e,t=!!this._instance.get_property(s_),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void Pp.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void Pp.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void Pp.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(e){if(e.length===0)return!1;var t=e.reduce(((r,i)=>{var{type:s,value:o}=i;return Le(s)&&s.length>0&&r.$exception_types.push(s),Le(o)&&o.length>0&&r.$exception_values.push(o),r}),{$exception_types:[],$exception_values:[]});return this.Zt.some((r=>{var i=r.values.map((s=>{var o,a=B0[s.operator],l=me(s.value)?s.value:[s.value],c=(o=t[s.key])!==null&&o!==void 0?o:[];return l.length>0&&a(l,c)}));return r.type==="OR"?i.some(Boolean):i.every(Boolean)}))}si(e){return e.flatMap((t=>{var r,i;return(r=(i=t.stacktrace)==null?void 0:i.frames)!==null&&r!==void 0?r:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ni(e){if(e.length>0){var t,r,i,s,o=(t=(r=e[0].stacktrace)==null?void 0:r.frames)!==null&&t!==void 0?t:[],a=o[o.length-1];return(i=a==null||(s=a.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}ei(e){return!pe(e)&&me(e)}},dt=Ie("[FeatureFlags]"),ko=Ie("[FeatureFlags]",{debugEnabled:!0}),Op="$active_feature_flags",Li="$override_feature_flags",R_="$feature_flag_payloads",So="$override_feature_flag_payloads",T_="$feature_flag_request_id",I_="$feature_flag_evaluated_at",$_=n=>{var e={};for(var[t,r]of Wl(n||{}))r&&(e[t]=r);return e},BR=n=>{var e=n.flags;return e?(n.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var r;return[t,(r=e[t].variant)!==null&&r!==void 0?r:e[t].enabled]}))),n.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var r;return(r=e[t].metadata)==null?void 0:r.payload})).map((t=>{var r;return[t,(r=e[t].metadata)==null?void 0:r.payload]})))):dt.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),n},VR=(function(n){return n.FeatureFlags="feature_flags",n.Recordings="recordings",n})({}),Ih=class{constructor(e){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.ci=!1,this._instance=e,this.featureFlagEventHandlers=[]}fi(){var e,t=(e=this._instance.config.evaluation_contexts)!==null&&e!==void 0?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ci||(dt.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ci=!0),t!=null&&t.length?t.filter((r=>{var i=r&&typeof r=="string"&&r.trim().length>0;return i||dt.error("Invalid evaluation context found:",r,"Expected non-empty string"),i})):[]}pi(){return this.fi().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var e=!this.gi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.mi({disableFlags:e})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(oh),t=this._instance.get_property(Li),r=this._instance.get_property(So);if(!r&&!t)return e||{};var i=Me({},e||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(var o of s){var a,l,c=i[o],u=t?.[o],d=W(u)?(a=c?.enabled)!==null&&a!==void 0&&a:!!u,h=W(u)?c.variant:typeof u=="string"?u:void 0,g=r?.[o],v=U({},c,{enabled:d,variant:d?h??c?.variant:void 0});d!==c?.enabled&&(v.original_enabled=c?.enabled),h!==c?.variant&&(v.original_variant=c?.variant),g&&(v.metadata=U({},c?.metadata,{payload:g,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),i[o]=v}return this.oi||(dt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(Wi),t=this._instance.get_property(Li);if(!t)return e||{};for(var r=Me({},e),i=Object.keys(t),s=0;s<i.length;s++)r[i[s]]=t[i[s]];return this.oi||(dt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this.oi=!0),r}getFlagPayloads(){var e=this._instance.get_property(R_),t=this._instance.get_property(So);if(!t)return e||{};for(var r=Me({},e||{}),i=Object.keys(t),s=0;s<i.length;s++)r[i[s]]=t[i[s]];return this.oi||(dt.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this.oi=!0),r}reloadFeatureFlags(){this.ui||this._instance.config.advanced_disable_feature_flags||this.gi||(this.gi=setTimeout((()=>{this.mi()}),5))}bi(){clearTimeout(this.gi),this.gi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.gi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ui=e}mi(e){var t;if(this.bi(),!this._instance.M())if(this.li)this.hi=!0;else{var r=this._instance.config.token,i=this._instance.get_property("$device_id"),s={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:U({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property($o)||{}),group_properties:this._instance.get_property(Hr)};Dt(i)||W(i)||(s.$device_id=i),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.pi()&&(s.evaluation_contexts=this.fi());var o=this._instance.config.__preview_remote_config,a=o?"/flags/?v=2":"/flags/?v=2&config=true",l=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",c=this._instance.requestRouter.endpointFor("flags",a+l);o&&(s.timezone=N0()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:mn.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:u=>{var d,h,g=!0;if(u.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),g=!1),this.li=!1,this.di||(this.di=!0,this._instance.yi((h=u.json)!==null&&h!==void 0?h:{})),!s.disable_flags||this.hi)if(this.vi=!g,u.json&&(d=u.json.quotaLimited)!=null&&d.includes(VR.FeatureFlags))dt.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var v;s.disable_flags||this.receivedFeatureFlags((v=u.json)!==null&&v!==void 0?v:{},g),this.hi&&(this.hi=!1,this.mi())}}})}}getFeatureFlag(e,t){var r;if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlagResult(e,t);return(r=i?.variant)!==null&&r!==void 0?r:i?.enabled}dt.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants(),i=e in r,s=r[e],o=this.getFlagPayloads()[e],a=String(s),l=this._instance.get_property(T_)||void 0,c=this._instance.get_property(I_)||void 0,u=this._instance.get_property(Gl)||{};if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){var d,h,g,v,f,m,y,k,_;me(u[e])?u[e].push(a):u[e]=[a],(d=this._instance.persistence)==null||d.register({[Gl]:u});var b=this.getFeatureFlagDetails(e),x={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:o||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((h=this._instance.config.bootstrap)==null||(h=h.featureFlags)==null?void 0:h[e])||null,$feature_flag_bootstrapped_payload:((g=this._instance.config.bootstrap)==null||(g=g.featureFlagPayloads)==null?void 0:g[e])||null,$used_bootstrap_value:!this.vi};W(b==null||(v=b.metadata)==null?void 0:v.version)||(x.$feature_flag_version=b.metadata.version);var R,w=(f=b==null||(m=b.reason)==null?void 0:m.description)!==null&&f!==void 0?f:b==null||(y=b.reason)==null?void 0:y.code;w&&(x.$feature_flag_reason=w),b!=null&&(k=b.metadata)!=null&&k.id&&(x.$feature_flag_id=b.metadata.id),W(b?.original_variant)&&W(b?.original_enabled)||(x.$feature_flag_original_response=W(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(_=b.metadata)!=null&&_.original_payload&&(x.$feature_flag_original_payload=b==null||(R=b.metadata)==null?void 0:R.original_payload),this._instance.capture("$feature_flag_called",x)}if(i){var E=o;if(!W(o))try{E=JSON.parse(o)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:E}}}else dt.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var r=this._instance.config.token,i={distinct_id:this._instance.get_distinct_id(),token:r};this.pi()&&(i.evaluation_contexts=this.fi()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:i,compression:this._instance.config.disable_compression?void 0:mn.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;t(a?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,t);return W(r)?void 0:!!r}dt.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ai=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,l,c,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var d=BR(o),h=d.flags,g=d.featureFlags,v=d.featureFlagPayloads;if(g){var f=o.requestId,m=o.evaluatedAt;if(me(g)){dt.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var y={};if(g)for(var k=0;k<g.length;k++)y[g[k]]=!0;a&&a.register({[Op]:g,[Wi]:y})}else{var _=g,b=v,x=h;if(o.errorsWhileComputingFlags)if(h){var R=new Set(Object.keys(h).filter((w=>{var E;return!((E=h[w])!=null&&E.failed)})));_=U({},l,Object.fromEntries(Object.entries(_).filter((w=>{var[E]=w;return R.has(E)})))),b=U({},c,Object.fromEntries(Object.entries(b||{}).filter((w=>{var[E]=w;return R.has(E)})))),x=U({},u,Object.fromEntries(Object.entries(x||{}).filter((w=>{var[E]=w;return R.has(E)}))))}else _=U({},l,_),b=U({},c,b),x=U({},u,x);a&&a.register(U({[Op]:Object.keys($_(_)),[Wi]:_||{},[R_]:b||{},[oh]:x||{}},f?{[T_]:f}:{},m?{[I_]:m}:{}))}}})(e,this._instance.persistence,r,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),dt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return dt.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Li),this._instance.persistence.unregister(So),this.wi(),ko.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,r=e;if(this.oi=!!((t=r.suppressWarning)!==null&&t!==void 0&&t),"flags"in r){if(r.flags===!1)this._instance.persistence.unregister(Li),ko.info("Flag overrides cleared");else if(r.flags){if(me(r.flags)){for(var i={},s=0;s<r.flags.length;s++)i[r.flags[s]]=!0;this._instance.persistence.register({[Li]:i})}else this._instance.persistence.register({[Li]:r.flags});ko.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this._instance.persistence.unregister(So),ko.info("Payload overrides cleared")):r.payloads&&(this._instance.persistence.register({[So]:r.payloads}),ko.info("Payload overrides set",{payloads:r.payloads}))),void this.wi()}this.wi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:r}=this.xi();e(t,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var i,s=(this._instance.get_property(Io)||[]).find((c=>c.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};s&&(a.$early_access_feature_name=s.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=U({},this.getFlagVariants(),{[e]:t});(i=this._instance.persistence)==null||i.register({[Op]:Object.keys($_(l)),[Wi]:l}),this.wi()}getEarlyAccessFeatures(e,t,r){t===void 0&&(t=!1);var i=this._instance.get_property(Io),s=r?"&"+r.map((o=>"stage="+o)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:o=>{var a,l;if(o.json){var c=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(Io),(l=this._instance.persistence)==null||l.register({[Io]:c}),e(c)}}})}xi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((r=>t[r])),flagVariants:Object.keys(t).filter((r=>t[r])).reduce(((r,i)=>(r[i]=t[i],r)),{})}}wi(e){var{flags:t,flagVariants:r}=this.xi();this.featureFlagEventHandlers.forEach((i=>i(t,r,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var r=this._instance.get_property($o)||{};this._instance.register({[$o]:U({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister($o)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var r=this._instance.get_property(Hr)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((i=>{r[i]=U({},r[i],e[i]),delete e[i]})),this._instance.register({[Hr]:U({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Hr)||{};this._instance.register({[Hr]:U({},t,{[e]:{}})})}else this._instance.unregister(Hr)}reset(){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.bi(),this.oi=!1}},WR=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Lo=class{constructor(e,t){this.R=e,this.props={},this.Ei=!1,this.$i=(r=>{var i="";return r.token&&(i=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+i+"_posthog"})(e),this.Y=this.Si(e),this.load(),e.debug&&j.info("Persistence loaded",e.persistence,U({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){WR.indexOf(e.persistence.toLowerCase())===-1&&(j.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(i){i===void 0&&(i=[]);var s=[...bR,...i];return U({},Re,{W:function(o){try{var a={};try{a=Gt.W(o)||{}}catch{}var l=Me(a,JSON.parse(Re.q(o)||"{}"));return Re.G(o,l),l}catch{}return null},G:function(o,a,l,c,u,d){try{Re.G(o,a,void 0,void 0,d);var h={};s.forEach((g=>{a[g]&&(h[g]=a[g])})),Object.keys(h).length&&Gt.G(o,h,l,c,u,d)}catch(g){Re.B(g)}},V:function(o,a){try{C?.localStorage.removeItem(o),Gt.V(o,a)}catch(l){Re.B(l)}}})})(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return r==="localstorage"&&Re.H()?Re:r==="localstorage+cookie"&&t.H()?t:r==="sessionstorage"&&Ue.H()?Ue:r==="memory"?_R:r==="cookie"?Gt:t.H()?t:Gt}properties(){var e={};return ke(this.props,(function(t,r){if(r===Wi&&Ne(t))for(var i=Object.keys(t),s=0;s<i.length;s++)e["$feature/"+i[s]]=t[i[s]];else a=r,l=!1,(Dt(o=nR)?l:zb&&o.indexOf===zb?o.indexOf(a)!=-1:(ke(o,(function(c){if(l||(l=c===a))return ql})),l))||(e[r]=t);var o,a,l})),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=Me({},e))}}save(){this.ki||this.Y.G(this.$i,this.props,this.Pi,this.Ti,this.Ii,this.R.debug)}remove(){this.Y.V(this.$i,!1),this.Y.V(this.$i,!0)}clear(){this.remove(),this.props={}}register_once(e,t,r){if(Ne(e)){W(t)&&(t="None"),this.Pi=W(r)?this.Ci:r;var i=!1;if(ke(e,((s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=s,i=!0)})),i)return this.save(),!0}return!1}register(e,t){if(Ne(e)){this.Pi=W(t)?this.Ci:t;var r=!1;if(ke(e,((i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,r=!0)})),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Ei){var e=T0(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);Vi(nf(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=V?.referrer)?$0(e):{})}update_referrer_info(){var e;this.register_once({$referrer:M0(),$referring_domain:V!=null&&V.referrer&&((e=Ql(V.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[uh]||this.props[dh]||this.register_once({[Kl]:P0(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};ke([dh,uh],(o=>{var a=this.props[o];a&&ke(a,(function(l,c){e["$initial_"+Vp(c)]=l}))}));var t,r,i=this.props[Kl];if(i){var s=(t=O0(i),r={},ke(t,(function(o,a){r["$initial_"+Vp(a)]=o})),r);Me(e,s)}return e}safe_merge(e){return ke(this.props,(function(t,r){r in e||(e[r]=t)})),e}update_config(e,t,r){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),c=[...a].sort();return l.every(((u,d)=>u===c[d]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var i=this.Si(e),s=this.props;this.clear(),this.Y=i,this.props=s,this.save()}}set_disabled(e){this.ki=e,this.ki?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ti&&(this.Ti=e,this.remove(),this.save())}set_secure(e){e!==this.Ii&&(this.Ii=e,this.remove(),this.save())}set_event_timer(e,t){var r=this.props[To]||{};r[e]=t,this.props[To]=r,this.save()}remove_event_timer(e){var t=(this.props[To]||{})[e];return W(t)||(delete this.props[To][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},M_=Ie("[Product Tours]"),Np="ph_product_tours",$h=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[a_]:!(e==null||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Ri||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(a_)||this.it((()=>this.Oi()))}it(e){var t,r;(t=Q.__PosthogExtensions__)!=null&&t.generateProductTours?e():(r=Q.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"product-tours",(i=>{i?M_.error("Could not load product tours script",i):e()}))}Oi(){var e;!this.Ri&&(e=Q.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=Q.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!me(this.Fi)||t){var r=this._instance.persistence;if(r){var i=r.props[Np];if(me(i)&&!t)return this.Fi=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var o=s.statusCode;if(o!==200||!s.json){var a="Product Tours API could not be loaded, status: "+o;return M_.error(a),void e([],{isLoaded:!1,error:a})}var l=me(s.json.product_tours)?s.json.product_tours:[];this.Fi=l,r&&r.register({[Np]:l}),e(l,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){pe(this.Ri)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ri.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ri)==null||t.showTourById(e)}previewTour(e){this.Ri?this.Ri.previewTour(e):this.it((()=>{var t;this.Oi(),(t=this.Ri)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Ri)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Ri)==null||e.nextStep()}previousStep(){var e;(e=this.Ri)==null||e.previousStep()}clearCache(){var e;this.Fi=null,(e=this._instance.persistence)==null||e.unregister(Np)}resetTour(e){var t;(t=this.Ri)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Ri)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ri)==null||t.cancelPendingTour(e)}},Eo=(function(n){return n.Activation="events",n.Cancellation="cancelEvents",n})({}),sD=(function(n){return n.Button="button",n.Tab="tab",n.Selector="selector",n})({}),oD=(function(n){return n.TopLeft="top_left",n.TopRight="top_right",n.TopCenter="top_center",n.MiddleLeft="middle_left",n.MiddleRight="middle_right",n.MiddleCenter="middle_center",n.Left="left",n.Center="center",n.Right="right",n.NextToTrigger="next_to_trigger",n})({}),aD=(function(n){return n.Top="top",n.Left="left",n.Right="right",n.Bottom="bottom",n})({}),Lp=(function(n){return n.Popover="popover",n.API="api",n.Widget="widget",n.ExternalSurvey="external_survey",n})({}),lD=(function(n){return n.Open="open",n.MultipleChoice="multiple_choice",n.SingleChoice="single_choice",n.Rating="rating",n.Link="link",n})({}),cD=(function(n){return n.NextQuestion="next_question",n.End="end",n.ResponseBased="response_based",n.SpecificQuestion="specific_question",n})({}),uD=(function(n){return n.Once="once",n.Recurring="recurring",n.Always="always",n})({}),Po=(function(n){return n.SHOWN="survey shown",n.DISMISSED="survey dismissed",n.SENT="survey sent",n.ABANDONED="survey abandoned",n})({}),Fp=(function(n){return n.SURVEY_ID="$survey_id",n.SURVEY_NAME="$survey_name",n.SURVEY_RESPONSE="$survey_response",n.SURVEY_ITERATION="$survey_iteration",n.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",n.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",n.SURVEY_SUBMISSION_ID="$survey_submission_id",n.SURVEY_QUESTIONS="$survey_questions",n.SURVEY_COMPLETED="$survey_completed",n.PRODUCT_TOUR_ID="$product_tour_id",n.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",n})({}),Mh=(function(n){return n.Popover="popover",n.Inline="inline",n})({}),we=Ie("[Surveys]"),W0="seenSurvey_",jR=(n,e)=>{var t="$survey_"+e+"/"+n.id;return n.current_iteration&&n.current_iteration>0&&(t="$survey_"+e+"/"+n.id+"/"+n.current_iteration),t},P_=n=>((e,t)=>{var r=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(r=""+e+t.id+"_"+t.current_iteration),r})(W0,n),UR=[Lp.Popover,Lp.Widget,Lp.API],zR={ignoreConditions:!1,ignoreDelay:!1,displayType:Mh.Popover},jo=class{constructor(){this.Mi={},this.Mi={}}on(e,t){return this.Mi[e]||(this.Mi[e]=[]),this.Mi[e].push(t),()=>{this.Mi[e]=this.Mi[e].filter((r=>r!==t))}}emit(e,t){for(var r of this.Mi[e]||[])r(t);for(var i of this.Mi["*"]||[])i(e,t)}};function Fi(n,e,t){if(pe(n))return!1;switch(t){case"exact":return n===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(n);case"regex":try{return new RegExp(e).test(n)}catch{return!1}default:return!1}}var Ph=class{constructor(e){this.Ai=new jo,this.ji=(t,r)=>this.Di(t,r)&&this.Li(t,r)&&this.Ni(t,r)&&this.Ui(t,r),this.Di=(t,r)=>r==null||!r.event||t?.event===r?.event,this._instance=e,this.zi=new Set,this.Hi=new Set}init(){var e;if(!W((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((r,i)=>{this.on(r,i)}))}}register(e){var t,r;if(!W((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((o=>{var a,l;(a=this.Hi)==null||a.add(o),(l=o.steps)==null||l.forEach((c=>{var u;(u=this.zi)==null||u.add(c?.event||"")}))})),(r=this._instance)!=null&&r.autocapture)){var i,s=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((l=>{l!=null&&l.selector&&s.add(l?.selector)}))})),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,t){var r;t!=null&&e.length!=0&&(this.zi.has(e)||this.zi.has(t?.event))&&this.Hi&&((r=this.Hi)==null?void 0:r.size)>0&&this.Hi.forEach((i=>{this.Bi(t,i)&&this.Ai.emit("actionCaptured",i.name)}))}qi(e){this.onAction("actionCaptured",(t=>e(t)))}Bi(e,t){if(t?.steps==null)return!1;for(var r of t.steps)if(this.ji(e,r))return!0;return!1}onAction(e,t){return this.Ai.on(e,t)}Li(e,t){if(t!=null&&t.url){var r,i=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!i||typeof i!="string"||!Fi(i,t.url,t.url_matching||"contains"))return!1}return!0}Ni(e,t){return!!this.Wi(e,t)&&!!this.Gi(e,t)&&!!this.Vi(e,t)}Wi(e,t){var r;if(t==null||!t.href)return!0;var i=this.Ji(e);if(i.length>0)return i.some((a=>Fi(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&Fi((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}Gi(e,t){var r;if(t==null||!t.text)return!0;var i=this.Ji(e);if(i.length>0)return i.some((c=>Fi(c.text,t.text,t.text_matching||"exact")||Fi(c.$el_text,t.text,t.text_matching||"exact")));var s,o,a,l=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!l&&(s=(function(c){for(var u,d=[],h=/(?::|")text="(.*?)"/g;!pe(u=h.exec(c));)d.includes(u[1])||d.push(u[1]);return d})(l),o=t.text,a=t.text_matching||"exact",s.some((c=>Fi(c,o,a))))}Vi(e,t){var r,i;if(t==null||!t.selector)return!0;var s=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(s!=null&&s.includes(t.selector))return!0;var o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}Ji(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Ui(e,t){return t==null||!t.properties||t.properties.length===0||V0(t.properties.reduce(((r,i)=>{var s=me(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return r[i.key]={values:s,operator:i.operator||"exact"},r}),{}),e?.properties)}},Oh=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&V0(e.propertyFilters,t?.properties)}Zi(e,t){var r=new Map;return e.forEach((i=>{var s;(s=i.conditions)==null||(s=s[t])==null||(s=s.values)==null||s.forEach((o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(i.id),r.set(o.name,a)}}))})),r}te(e,t,r){var i=(r===Eo.Activation?this.Ki:this.Yi).get(e),s=[];return this.ie((o=>{s=o.filter((a=>i?.includes(a.id)))})),s.filter((o=>{var a,l=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find((c=>c.name===e));return this.Qi(l,t)}))}register(e){var t;W((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ee(e),this.re(e))}re(e){var t=e.filter((r=>{var i,s;return((i=r.conditions)==null?void 0:i.actions)&&((s=r.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));t.length!==0&&(this.se==null&&(this.se=new Ph(this._instance),this.se.init(),this.se.qi((r=>{this.onAction(r)}))),t.forEach((r=>{var i,s,o,a,l;r.conditions&&(i=r.conditions)!=null&&i.actions&&(s=r.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.se)==null||a.register(r.conditions.actions.values),(l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((c=>{if(c&&c.name){var u=this.Xi.get(c.name);u&&u.push(r.id),this.Xi.set(c.name,u||[r.id])}})))})))}ee(e){var t,r=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),i=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));(r.length!==0||i.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((s,o)=>{this.onEvent(s,o)})),this.Ki=this.Zi(e,Eo.Activation),this.Yi=this.Zi(e,Eo.Cancellation))}onEvent(e,t){var r,i=this.ne(),s=this.oe(),o=this.ae(),a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[s])||[];if(o===e&&t&&a.length>0){var l,c;i.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var u=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(u){var d=a.indexOf(u);d>=0&&(a.splice(d,1),this.le(a))}}else{if(this.Yi.has(e)){var h=this.te(e,t,Eo.Cancellation);h.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map((v=>v.id))}),h.forEach((v=>{var f=a.indexOf(v.id);f>=0&&a.splice(f,1),this.ue(v.id)})),this.le(a))}if(this.Ki.has(e)){i.info("event name matched",{event:e,eventPayload:t,items:this.Ki.get(e)});var g=this.te(e,t,Eo.Activation);this.le(a.concat(g.map((v=>v.id))||[]))}}}onAction(e){var t,r=this.oe(),i=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[r])||[];this.Xi.has(e)&&this.le(i.concat(this.Xi.get(e)||[]))}le(e){var t,r=this.ne(),i=this.oe(),s=[...new Set(e)].filter((o=>!this.he(o)));r.info("updating activated items",{activatedItems:s}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[i]:s})}getActivatedIds(){var e,t=this.oe(),r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return r||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}},Nh=class extends Oh{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return Po.SHOWN}ie(e){var t;(t=this._instance)==null||t.getSurveys(e)}ue(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}ne(){return we}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Lh=class{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(pe(t))return we.warn("Flags not loaded yet. Not loading surveys.");var r=me(t);this.ve=r?t.length>0:t,we.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var r=localStorage.key(t);(r!=null&&r.startsWith(W0)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)we.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)we.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())we.info("Not loading surveys in cookieless mode without consent.");else{var e=Q?.__PosthogExtensions__;if(e){if(!W(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var r=e.generateSurveys;if(r)return void this.ge(r,t);var i=e.loadExternalDependency;if(!i)return void this._e("PostHog loadExternalDependency extension not found.");i(this._instance,"surveys",(s=>{s||!e.generateSurveys?this._e("Could not load surveys script",s):this.ge(e.generateSurveys,t)}))}catch(s){throw this._e("Error initializing surveys",s),s}finally{this.ce=!1}}}else we.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Nh(this._instance),we.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){we.error(e,t),this.me({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.fe.push(e),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return we.info("Disabled. Not loading surveys."),e([]);var r,i=this._instance.get_property(ah);if(i&&!t)return e(i,{isLoaded:!0});typeof Promise<"u"&&this.pe?this.pe.then((s=>{var{surveys:o,context:a}=s;return e(o,a)})):(typeof Promise<"u"&&(this.pe=new Promise((s=>{r=s}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var o;this.pe=null;var a=s.statusCode;if(a!==200||!s.json){var l="Surveys API could not be loaded, status: "+a;we.error(l);var c={isLoaded:!1,error:l};return e([],c),void(r==null||r({surveys:[],context:c}))}var u,d=s.json.surveys||[],h=d.filter((v=>(function(f){return!(!f.start_date||f.end_date)})(v)&&((function(f){var m;return!((m=f.conditions)==null||(m=m.events)==null||(m=m.values)==null||!m.length)})(v)||(function(f){var m;return!((m=f.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)})(v))));h.length>0&&((u=this._surveyEventReceiver)==null||u.register(h)),(o=this._instance.persistence)==null||o.register({[ah]:d});var g={isLoaded:!0};e(d,g),r?.({surveys:d,context:g})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(r){we.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!pe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);we.warn("init was not called")}be(e){var t=null;return this.getSurveys((r=>{var i;t=(i=r.find((s=>s.id===e)))!==null&&i!==void 0?i:null})),t}ye(e){if(pe(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.be(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(pe(this._surveyManager))return we.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.ye(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return pe(this._surveyManager)?(we.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((r=>{this.getSurveys((i=>{var s,o=(s=i.find((l=>l.id===e)))!==null&&s!==void 0?s:null;if(o){var a=this.ye(o);r({visible:a.eligible,disabledReason:a.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,r){var i;if(pe(this._surveyManager))we.warn("init was not called");else{var s=typeof e=="string"?this.be(e):e;if(s!=null&&s.id)if(UR.includes(s.type)){var o=V?.querySelector(t);if(o)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(we.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;we.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(s,o,r),we.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,r);we.warn("Survey element not found")}else we.warn("Surveys of type "+s.type+" cannot be rendered in the app");else we.warn("Survey not found")}}displaySurvey(e,t){var r;if(pe(this._surveyManager))we.warn("init was not called");else{var i=this.be(e);if(i){var s=i;if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=U({},i,{appearance:U({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Mh.Popover&&t.initialResponses&&we.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.canRenderSurvey(i);if(!o.visible)return void we.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Mh.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else we.warn("Survey not found")}}cancelPendingSurvey(e){pe(this._surveyManager)?we.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},pn=Ie("[Conversations]"),Fh=class{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.Ee=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;pe(t)||(yn(t)?this.we=t:(this.we=t.enabled,this.Ee=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.we=void 0,this.Ee=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Q?.__PosthogExtensions__;if(e&&!W(this.we)&&this.we)if(this.Ee&&this.Ee.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.$e(t),void(this.xe=!1);var r=e.loadExternalDependency;if(!r)return void this.Se("PostHog loadExternalDependency extension not found.");r(this._instance,"conversations",(i=>{i||!e.initConversations?this.Se("Could not load conversations script",i):this.$e(e.initConversations),this.xe=!1}))}catch(i){this.Se("Error initializing conversations",i),this.xe=!1}}else pn.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),pn.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else pn.error("Cannot complete initialization: remote config is null")}Se(e,t){pn.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():pn.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!Dt(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,r){var i=this;return Bi((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(pn.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var r=this;return Bi((function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(pn.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return Bi((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(pn.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return Bi((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(pn.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}},Dh=class{constructor(e){var t;this.ke=!1,this.Pe=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ke=!0)}onRemoteConfig(e){var t,r=(t=e.logs)==null?void 0:t.captureConsoleLogs;!pe(r)&&r&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=Ie("[logs]"),t=Q?.__PosthogExtensions__;if(t){var r=t.loadExternalDependency;r?r(this._instance,"logs",(i=>{var s;i||(s=t.logs)==null||!s.initializeLogs?e.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.Pe=!0)})):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}},O_=Ie("[RateLimiter]"),Hh=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var r=t.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((i=>{O_.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void O_.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,r,i;e===void 0&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(r=this.instance.persistence)==null?void 0:r.get_property(ch))!==null&&t!==void 0?t:{tokens:s,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>s&&(l.tokens=s);var c=l.tokens<1;return c||e||(l.tokens=Math.max(0,l.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(i=this.instance.persistence)==null||i.set_property(ch,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Dr=Ie("[RemoteConfig]"),Bh=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Q._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,r;(t=Q.__PosthogExtensions__)!=null&&t.loadExternalDependency?(r=Q.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(Dr.error("PostHog Extensions not found. Cannot load remote config."),e())}Ie(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return Dr.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void Dr.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return Dr.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ie((t=>{this.yi(t)}));this.yi(e)}))}catch(e){Dr.error("Error loading remote config",e)}}yi(e){e?this._instance.config.__preview_remote_config?(this._instance.yi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Dr.info("__preview_remote_config is disabled. Logging config instead",e):Dr.error("Failed to fetch remote config from PostHog.")}},Vh=3e3,Wh=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=Kt(t?.flush_interval_ms||Vh,250,5e3,j.createLogger("flush interval"),Vh),this.Oe=e}enqueue(e){this.Re.push(e),this.Me||this.Ae()}unload(){this.je();var e=this.Re.length>0?this.De():{},t=Object.values(e);[...t.filter((r=>r.url.indexOf("/e")===0)),...t.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.Oe(U({},r,{transport:"sendBeacon"}))}))}enable(){this.Ce=!1,this.Ae()}Ae(){var e=this;this.Ce||(this.Me=setTimeout((()=>{if(this.je(),this.Re.length>0){var t=this.De(),r=function(){var s=t[i],o=new Date().getTime();s.data&&me(s.data)&&ke(s.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Oe(s)};for(var i in t)r()}}),this.Fe))}je(){clearTimeout(this.Me),this.Me=void 0}De(){var e={};return ke(this.Re,(t=>{var r,i=t,s=(i?i.batchKey:null)||i.url;W(e[s])&&(e[s]=U({},i,{data:[]})),(r=e[s].data)==null||r.push(i.data)})),this.Re=[],e}},qR=["retriesPerformedSoFar"],jh=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!W(C)&&"onLine"in C.navigator&&(this.Ue=C.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},Oe(C,"online",this.ze),Oe(C,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=B_(e,qR);Di(t)&&(r.url=oc(r.url,{retry_count:t})),this._instance._send_request(U({},r,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(t??0)<10?this.Be(U({retriesPerformedSoFar:t},r)):r.callback==null||r.callback(i)}}))}Be(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=(function(o){var a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)})(t),i=Date.now()+r;this.Re.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),j.warn(s),this.Le||(this.Le=!0,this.qe())}qe(){if(this.We&&clearTimeout(this.We),this.Re.length===0)return this.Le=!1,void(this.We=void 0);this.We=setTimeout((()=>{this.Ue&&this.Re.length>0&&this.Lt(),this.qe()}),this.Ne)}Lt(){var e=Date.now(),t=[],r=this.Re.filter((s=>s.retryAt<e||(t.push(s),!1)));if(this.Re=t,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.We&&(clearTimeout(this.We),this.We=void 0),this.Le=!1,W(C)||(this.ze&&(C.removeEventListener("online",this.ze),this.ze=void 0),this.He&&(C.removeEventListener("offline",this.He),this.He=void 0)),this.Re))try{this._instance._send_request(U({},e,{transport:"sendBeacon"}))}catch(t){j.error(t)}this.Re=[]}},Uh=class{constructor(e){this.Ge=()=>{var t,r,i,s;this.Ve||(this.Ve={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+(o?.clientHeight||0),u=o?.scrollHeight||0;this.Ve.lastScrollY=Math.ceil(a),this.Ve.maxScrollY=Math.max(a,(t=this.Ve.maxScrollY)!==null&&t!==void 0?t:0),this.Ve.maxScrollHeight=Math.max(l,(r=this.Ve.maxScrollHeight)!==null&&r!==void 0?r:0),this.Ve.lastContentY=c,this.Ve.maxContentY=Math.max(c,(i=this.Ve.maxContentY)!==null&&i!==void 0?i:0),this.Ve.maxContentHeight=Math.max(u,(s=this.Ve.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}getContext(){return this.Ve}resetContext(){var e=this.Ve;return setTimeout(this.Ge,0),e}startMeasuringScrollPosition(){Oe(C,"scroll",this.Ge,{capture:!0}),Oe(C,"scrollend",this.Ge,{capture:!0}),Oe(C,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return C?.document.documentElement;var e=me(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var r=C?.document.querySelector(t);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return C&&(C.scrollY||C.pageYOffset||C.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return C&&(C.scrollX||C.pageXOffset||C.document.documentElement.scrollLeft)||0}},ZR=n=>P0(n?.config.mask_personal_data_properties,n?.config.custom_personal_data_properties),lc=class{constructor(e,t,r,i){this.Je=s=>{var o=this.Ke();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.Ye(this._instance)};this.Xe.register({[lh]:a})}},this._instance=e,this.Qe=t,this.Xe=r,this.Ye=i||ZR,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[lh]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?O0(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return ke(nf(this.getSetOnceProps()),((t,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Vp(r)]=t})),e}},Dp=Ie("[SessionId]"),cc=class{on(e,t){return this.Ze.on(e,t)}constructor(e,t,r){var i;if(this.tr=[],this.ir=void 0,this.Ze=new jo,this.er=(u,d)=>!(!Di(u)||!Di(d))&&Math.abs(u-d)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=e.config,this.Xe=e.persistence,this.rr=void 0,this.sr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.nr=t||zn,this.ar=r||zn;var s=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Kt(o,60,36e3,Dp.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+s+"_window_id",this.hr="ph_"+s+"_primary_window_exists",this.dr()){var a=Ue.W(this.ur),l=Ue.W(this.hr);a&&!l?this.rr=a:Ue.V(this.ur),Ue.G(this.hr,!0)}if((i=this.R.bootstrap)!=null&&i.sessionID)try{var c=(u=>{var d=u.replace(/-/g,"");if(d.length!==32)throw new Error("Not a valid UUID");if(d[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(d.substring(0,12),16)})(this.R.bootstrap.sessionID);this.vr(this.R.bootstrap.sessionID,new Date().getTime(),c)}catch(u){Dp.error("Invalid sessionID in bootstrap",u)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return W(this.tr)&&(this.tr=[]),this.tr.push(e),this.sr&&e(this.sr,this.rr),()=>{this.tr=this.tr.filter((t=>t!==e))}}dr(){return this.R.persistence!=="memory"&&!this.Xe.ki&&Ue.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&Ue.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?Ue.W(this.ur):null}vr(e,t,r){e===this.sr&&t===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this.sr=e,this.Xe.register({[Zl]:[t,e,r]}))}_r(){var e=this.Xe.props[Zl];return me(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.vr(null,null,null)}destroy(){clearTimeout(this.mr),this.mr=void 0,this.ir&&C&&(C.removeEventListener("beforeunload",this.ir,{capture:!1}),this.ir=void 0),this.tr=[]}cr(){this.ir=()=>{this.dr()&&Ue.V(this.hr)},Oe(C,"beforeunload",this.ir,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.R.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||new Date().getTime(),[i,s,o]=this._r(),a=this.gr(),l=Di(o)&&Math.abs(r-o)>864e5,c=!1,u=!s,d=!u&&!e&&this.er(r,i);u||d||l?(s=this.nr(),a=this.ar(),Dp.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}}),o=r,c=!0):a||(a=this.ar(),c=!0);var h=Di(i)&&e&&!l?i:r,g=Di(o)?o:new Date().getTime();return this.pr(a),this.vr(s,h,g),e||this.lr(),c&&this.tr.forEach((v=>v(s,a,c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0))),{sessionId:s,windowId:a,sessionStartTimestamp:g,changeReason:c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:i}}lr(){clearTimeout(this.mr),this.mr=setTimeout((()=>{var[e]=this._r();if(this.er(new Date().getTime(),e)){var t=this.sr;this.resetSessionId(),this.Ze.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},GR=["$set_once","$set"],jn=Ie("[SiteApps]"),zh=class{constructor(e){this._instance=e,this.br=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}yr(e,t){if(t){var r=this.globalsForEvent(t);this.br.push(r),this.br.length>1e3&&(this.br=this.br.slice(10))}}get siteAppLoaders(){var e;return(e=Q._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.yr.bind(this));this.wr=()=>{e(),this.br=[],this.wr=void 0}}}globalsForEvent(e){var t,r,i,s,o,a,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var[h,g]of Object.entries(d))c[h]={id:u[h],type:h,properties:g};var{$set_once:v,$set:f}=e;return{event:U({},B_(e,GR),{properties:U({},e.properties,f?{$set:U({},(t=(r=e.properties)==null?void 0:r.$set)!==null&&t!==void 0?t:{},f)}:{},v?{$set_once:U({},(i=(s=e.properties)==null?void 0:s.$set_once)!==null&&i!==void 0?i:{},v)}:{}),elements_chain:(o=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],r=()=>{var a;!t.errored&&this.br.length&&(jn.info("Processing "+this.br.length+" events for site app with id "+e.id),this.br.forEach((l=>t.processEvent==null?void 0:t.processEvent(l))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((a=this.wr)==null||a.call(this))},i=!1,s=a=>{t.errored=!a,t.loaded=!0,jn.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),i&&r()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{s(a)}});o&&(t.processEvent=o),i=!0}catch(a){jn.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&t.loaded)try{r()}catch(a){jn.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}Er(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}$r(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{r.processEvent==null||r.processEvent(t)}catch(i){jn.error("Error while processing event "+e.event+" for site app "+r.id,i)}}}onRemoteConfig(e){var t,r,i,s=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Er(),void this._instance.on("eventCaptured",(c=>this.$r(c)))):void jn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.wr)==null||r.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var o=function(c){var u;Q["__$$ph_site_app_"+c]=s._instance,(u=Q.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,l,(d=>{if(d)return jn.error("Error while initializing PostHog app with config id "+c,d)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else jn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},j0=function(n,e){if(!n)return!1;var t=n.userAgent;if(t&&Gb(t,e))return!0;try{var r=n?.userAgentData;if(r!=null&&r.brands&&r.brands.some((i=>Gb(i?.brand,e))))return!0}catch{}return!!n.webdriver},Oo=(function(n){return n.US="us",n.EU="eu",n.CUSTOM="custom",n})({}),N_="i.posthog.com",qh=class{constructor(e){this.Sr={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+N_,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Sr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=Oo.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=Oo.EU:this.Sr[this.apiHost]=Oo.CUSTOM),this.Sr[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(this.region===Oo.CUSTOM)return this.apiHost+t;var r=N_+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}},KR={icontains:(n,e)=>!!C&&e.href.toLowerCase().indexOf(n.toLowerCase())>-1,not_icontains:(n,e)=>!!C&&e.href.toLowerCase().indexOf(n.toLowerCase())===-1,regex:(n,e)=>!!C&&ac(e.href,n),not_regex:(n,e)=>!!C&&!ac(e.href,n),exact:(n,e)=>e.href===n,is_not:(n,e)=>e.href!==n},Zh=class n{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),t.getWebExperiments((i=>{n.kr("retrieved web experiments from the server"),t.Pr=new Map,i.forEach((s=>{if(s.feature_flag_key){var o;t.Pr&&(n.kr("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=t.Pr)==null||o.set(s.feature_flag_key,s));var a=t._instance.getFeatureFlag(s.feature_flag_key);Le(a)&&s.variants[a]&&t.Tr(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var c=s.variants[l];n.Ir(c)&&t.Tr(s.name,l,c.transforms)}}))}),r)},this._instance=e,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}onFeatureFlags(e){if(this._is_bot())n.kr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(pe(this.Pr))return this.Pr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();n.kr("applying feature flags",e),e.forEach((t=>{var r;if(this.Pr&&(r=this.Pr)!=null&&r.has(t)){var i,s=this._instance.getFeatureFlag(t),o=(i=this.Pr)==null?void 0:i.get(t);s&&o!=null&&o.variants[s]&&this.Tr(o.name,s,o.variants[s].transforms)}}))}}previewWebExperiment(){var e=n.getWindowLocation();if(e!=null&&e.search){var t=ec(e?.search,"__experiment_id"),r=ec(e?.search,"__experiment_variant");t&&r&&(n.kr("previewing web experiments "+t+" && "+r),this.getWebExperiments((i=>{this.Cr(parseInt(t),r,i)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this._instance.config.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}Cr(e,t,r){var i=r.filter((s=>s.id===e));i&&i.length>0&&(n.kr("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this.Tr(i[0].name,t,i[0].variants[t].transforms))}static Ir(e){return!pe(e.conditions)&&n.Rr(e)&&n.Fr(e)}static Rr(e){var t;if(pe(e.conditions)||pe((t=e.conditions)==null?void 0:t.url))return!0;var r,i,s,o=n.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||KR[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return C?.location}static Fr(e){var t;if(pe(e.conditions)||pe((t=e.conditions)==null?void 0:t.utm))return!0;var r=T0();if(r.utm_source){var i,s,o,a,l,c,u,d,h=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,g=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==r.utm_medium,f=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==r.utm_term;return h&&v&&f&&g}return!1}static kr(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];j.info("[WebExperiments] "+e,r)}Tr(e,t,r){this._is_bot()?n.kr("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?r.forEach((i=>{if(i.selector){var s;n.kr("applying transform of variant "+t+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o?.forEach((a=>{var l=a;i.html&&(l.innerHTML=i.html),i.css&&l.setAttribute("style",i.css)}))}})):n.kr("Control variants leave the page unmodified.")}_is_bot(){return pt&&this._instance?j0(pt,this._instance.config.custom_blocked_useragents):void 0}},YR=Ie("[PostHog ExternalIntegrations]"),XR={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Gh=class{constructor(e){this._instance=e}it(e,t){var r;(r=Q.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,(i=>{if(i)return YR.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!i||(a=Q.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(XR[o],(()=>{var u;(u=Q.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!i&&(l=Q.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=Q.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[r,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;t(r)}}},Kh="[SessionRecording]",Co=Ie(Kh),uc=class{get started(){var e;return!((e=this.Or)==null||!e.isStarted)}get status(){return this.Or?this.Or.status:this.Mr&&!this.Ar?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Mr=!1,this.jr=void 0,this._instance=e,!this._instance.sessionManager)throw Co.error("started without valid sessionManager"),new Error(Kh+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Kh+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(Ep))==null||!e.enabled),r=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return C&&t&&r&&!i}startIfEnabledOrStop(e){var t;if(!this.Ar||(t=this.Or)==null||!t.isStarted){var r=!W(Object.assign)&&!W(Array.from);this.Ar&&r?(this.Dr(e),Co.info("starting")):this.stopRecording()}}Dr(e){var t,r,i;this.Ar&&(Q!=null&&(t=Q.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(r=Q.__PosthogExtensions__)!=null&&r.initSessionRecording?this.Lr(e):(i=Q.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Nr,(s=>{if(s)return Co.error("could not load recorder",s);this.Lr(e)})))}stopRecording(){var e,t;(e=this.jr)==null||e.call(this),this.jr=void 0,(t=this.Or)==null||t.stop()}Ur(){var e;(e=this._instance.persistence)==null||e.unregister(p0)}zr(e){if(this._instance.persistence){var t,r,i=this._instance.persistence,s=()=>{var o=e.sessionRecording===!1?void 0:e.sessionRecording,a=o?.sampleRate,l=pe(a)?null:parseFloat(a);pe(l)&&this.Ur();var c=o?.minimumDurationMilliseconds;i.register({[Ep]:U({enabled:!!o},o,{networkPayloadCapture:U({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:W(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers})})};s(),(t=this.jr)==null||t.call(this),this.jr=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.zr(e),this.Mr=!0,this.startIfEnabledOrStop()):this.Mr=!0:Co.info("skipping remote config with no sessionRecording",e)}log(e,t){var r;t===void 0&&(t="log"),(r=this.Or)!=null&&r.log?this.Or.log(e,t):Co.warn("log called before recorder was ready")}get Nr(){var e,t,r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Ep);return(r==null||(t=r.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,r;if((t=Q.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(r=Q.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.Or._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Or.start(e)}onRRwebEmit(e){var t;(t=this.Or)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Or||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Or)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Or||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.Or)==null||e.overrideSampling()}overrideTrigger(e){var t,r;this.Or||(r=this._instance.persistence)==null||r.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Or)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Or)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!((r=this.Or)==null||!r.tryAddCustomEvent(e,t))}},Fo={},Yh=()=>{},Hi="posthog",U0=!HR&&ot?.indexOf("MSIE")===-1&&ot?.indexOf("Mozilla")===-1,L_=n=>{var e;return U({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:tR(V?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Yh,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:n??"unset",__preview_deferred_init_extensions:!1,debug:ze&&Le(ze?.search)&&ze.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(C==null||(e=C.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var r="Bad HTTP status: "+t.statusCode+" "+t.text;j.error(r)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Vh},error_tracking:{},_onCapture:Yh,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(n))},F_=n=>{var e={};W(n.process_person)||(e.person_profiles=n.process_person),W(n.xhr_headers)||(e.request_headers=n.xhr_headers),W(n.cookie_name)||(e.persistence_name=n.cookie_name),W(n.disable_cookie)||(e.disable_persistence=n.disable_cookie),W(n.store_google)||(e.save_campaign_params=n.store_google),W(n.verbose)||(e.debug=n.verbose);var t=Me({},e,n);return me(n.property_blacklist)&&(W(n.property_denylist)?t.property_denylist=n.property_blacklist:me(n.property_denylist)?t.property_denylist=[...n.property_blacklist,...n.property_denylist]:j.error("Invalid value for property_denylist config: "+n.property_denylist)),t},Xh=class{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){j.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},dc=class n{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new Xh,this.Br=!1,this.version=hn.LIB_VERSION,this.qr=new jo,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=L_(),this.SentryIntegration=_h,this.sentryIntegration=e=>(function(t,r){var i=R0(t,r);return{name:A0,processEvent:s=>i(s)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Wr=!1,this.Gr=null,this.Vr=null,this.Jr=null,this.featureFlags=new Ih(this),this.toolbar=new xh(this),this.scrollManager=new Uh(this),this.pageViewManager=new rc(this),this.surveys=new Lh(this),this.conversations=new Fh(this),this.logs=new Dh(this),this.experiments=new Zh(this),this.exceptions=new Th(this),this.rateLimiter=new Hh(this),this.requestRouter=new qh(this),this.consent=new vh(this),this.externalIntegrations=new Gh(this),this.people={set:(e,t,r)=>{var i=Le(e)?{[e]:t}:e;this.setPersonProperties(i),r?.({})},set_once:(e,t,r)=>{var i=Le(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),r?.({})}},this.on("eventCaptured",(e=>j.info('send "'+e?.event+'"',e)))}init(e,t,r){if(r&&r!==Hi){var i,s=(i=Fo[r])!==null&&i!==void 0?i:new n;return s._init(e,t,r),Fo[r]=s,Fo[Hi][r]=s,s}return this._init(e,t,r)}_init(e,t,r){var i;if(t===void 0&&(t={}),W(e)||Wp(e))return j.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Kr(t.debug),this.Yr=t,this.Xr=[],t.person_profiles&&(this.Vr=t.person_profiles),this.set_config(Me({},L_(t.defaults),F_(t),{name:r,token:e})),this.config.on_xhr_error&&j.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:mn.GZipJS;var s=this.Qr();this.persistence=new Lo(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Lo(U({},this.config,{persistence:"sessionStorage"}),s);var o=U({},this.persistence.props),a=U({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new Wh((k=>this.ts(k)),this.config.request_queue_config),this.es=new jh(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new cc(this),this.sessionPropsManager=new lc(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(j.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(j.info("Initializing extensions synchronously"),this.rs(l)),hn.DEBUG=hn.DEBUG||this.config.debug,hn.DEBUG&&j.info("Starting in debug mode",{this:this,config:t,thisC:U({},this.config),p:o,s:a}),((i=t.bootstrap)==null?void 0:i.distinctID)!==void 0){var c,u,d=this.config.get_device_id(zn()),h=(c=t.bootstrap)!=null&&c.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(fn,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this.ss()){var g,v,f=Object.keys(((g=t.bootstrap)==null?void 0:g.featureFlags)||{}).filter((k=>{var _;return!((_=t.bootstrap)==null||(_=_.featureFlags)==null||!_[k])})).reduce(((k,_)=>{var b;return k[_]=((b=t.bootstrap)==null||(b=b.featureFlags)==null?void 0:b[_])||!1,k}),{}),m=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((k=>f[k])).reduce(((k,_)=>{var b,x;return(b=t.bootstrap)!=null&&(b=b.featureFlagPayloads)!=null&&b[_]&&(k[_]=(x=t.bootstrap)==null||(x=x.featureFlagPayloads)==null?void 0:x[_]),k}),{});this.featureFlags.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:yo,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(zn());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(fn,"anonymous")}return Oe(C,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?kR(this,(()=>this.ns())):this.ns(),qn(this.config._onCapture)&&this.config._onCapture!==Yh&&(j.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&j.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}rs(e){var t=performance.now();this.historyAutocapture=new bh(this),this.historyAutocapture.startIfEnabled();var r=[];r.push((()=>{new wh(this).startIfEnabledOrStop()})),r.push((()=>{var i;this.siteApps=new zh(this),(i=this.siteApps)==null||i.init()})),e||r.push((()=>{this.sessionRecording=new uc(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||r.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),r.push((()=>{this.autocapture=new hh(this),this.autocapture.startIfEnabled()})),r.push((()=>{this.surveys.loadIfEnabled()})),r.push((()=>{this.logs.loadIfEnabled()})),r.push((()=>{this.conversations.loadIfEnabled()})),r.push((()=>{this.productTours=new $h(this),this.productTours.loadIfEnabled()})),r.push((()=>{this.heatmaps=new Sh(this),this.heatmaps.startIfEnabled()})),r.push((()=>{this.webVitalsAutocapture=new kh(this)})),r.push((()=>{this.exceptionObserver=new yh(this),this.exceptionObserver.startIfEnabledOrStop()})),r.push((()=>{this.deadClicksAutocapture=new nc(this,wR),this.deadClicksAutocapture.startIfEnabled()})),r.push((()=>{if(this.os){var i=this.os;this.os=void 0,this.yi(i)}})),this.ls(r,t)}ls(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.ls(e,t)}),0);var r=e.shift();if(r)try{r()}catch(s){j.error("Error initializing extension:",s)}}var i=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:i}),this.config.__preview_deferred_init_extensions&&j.info("PostHog extensions initialized ("+i+"ms)")}yi(e){var t,r,i,s,o,a,l,c,u;if(!V||!V.body)return j.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.yi(e)}),500);this.config.__preview_deferred_init_extensions&&(this.os=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ue(e.supportedCompression,mn.GZipJS)?mn.GZipJS:ue(e.supportedCompression,mn.Base64)?mn.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Vr?this.Vr:"identified_only"}),(r=this.siteApps)==null||r.onRemoteConfig(e),(i=this.sessionRecording)==null||i.onRemoteConfig(e),(s=this.autocapture)==null||s.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(a=this.productTours)==null||a.onRemoteConfig(e),(l=this.webVitalsAutocapture)==null||l.onRemoteConfig(e),(c=this.exceptionObserver)==null||c.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}ns(){try{this.config.loaded(this)}catch(r){j.critical("`loaded` function failed",r)}if(this.us(),this.config.internal_or_test_user_hostname&&ze!=null&&ze.hostname){var e=ze.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.hs()}),1),new Bh(this).load(),this.featureFlags.flags()}us(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Zr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Zn(this.__request_queue,(e=>this.ts(e))),this.__request_queue=[],this.us()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.ds()&&this.capture("$pageleave"),(e=this.Zr)==null||e.unload(),(t=this.es)==null||t.unload()):this.ds()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(U0?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=oc(e.url,{ip:this.config.ip?1:0}),e.headers=U({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var r,i,s,o=U({},t);o.timeout=o.timeout||6e4,o.url=oc(o.url,{_:new Date().getTime().toString(),ver:hn.LIB_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=jl.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(i=(s=c0(l,(u=>u.transport===a)))==null?void 0:s.method)!==null&&i!==void 0?i:l[0].method;if(!c)throw new Error("No available transport method");c(o)})(U({},e,{callback:t=>{var r,i;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((r=(i=this.config).on_request_error)==null||r.call(i,t)),e.callback==null||e.callback(t)}}))))}ts(e){this.es?this.es.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,r=[],i=[],s=[];Zn(e,(a=>{a&&(t=a[0],me(t)?s.push(a):qn(a)?a.call(this):me(a)&&t==="alias"?r.push(a):me(a)&&t.indexOf("capture")!==-1&&qn(this[t])?s.push(a):i.push(a))}));var o=function(a,l){Zn(a,(function(c){if(me(c[0])){var u=l;ke(c,(function(d){u=u[d[0]].apply(u,d.slice(1))}))}else this[c[0]].apply(this,c.slice(1))}),l)};o(r,this),o(i,this),o(s,this)}ss(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,r){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zr){if(this.is_capturing())if(!W(e)&&Le(e)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var o=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!Le(t?.$current_url)&&(j.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,l=r?.timestamp||a,c=zn(),u={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},l,c)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),o&&(u.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),r?.$set&&(u.$set=r?.$set);var d,h=e!=="$groupidentify",g=this.vs(r?.$set_once,h);if(g&&(u.$set_once=g),(u=QA(u,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,W(r?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===Po.DISMISSED||e===Po.SENT){var v=t?.[Fp.SURVEY_ID],f=t?.[Fp.SURVEY_ITERATION];d={id:v,current_iteration:f},localStorage.getItem(P_(d))||localStorage.setItem(P_(d),"true"),u.$set=U({},u.$set,{[jR({id:v,current_iteration:f},e===Po.SENT?"responded":"dismissed")]:!0})}else e===Po.SHOWN&&(u.$set=U({},u.$set,{[Fp.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=U({},u.properties.$set,u.$set);if(Vi(m)||this.setPersonPropertiesForFlags(m),!pe(this.config.before_send)){var y=this.cs(u);if(!y)return;u=y}this.qr.emit("eventCaptured",u);var k={method:"POST",url:(i=r?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.ts(k):this.Zr.enqueue(k),u}j.critical("This capture call is ignored due to client rate limiting.")}}else j.error("No event name provided to posthog.capture")}else j.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var o=s?void 0:this.persistence.remove_event_timer(e),a=U({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=U({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!Le(a.distinct_id)&&!bn(a.distinct_id)||Wp(a.distinct_id))&&j.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=TR(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());a.$session_id=d,a.$window_id=h}this.sessionPropsManager&&Me(a,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&Me(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(g=this.es)==null?void 0:g.length}catch(y){a.$sdk_debug_error_capturing_properties=String(y)}if(this.requestRouter.region===Oo.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||s?e!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=Me(a,c),e==="$pageview"&&V&&(a.title=V.title),!W(o)){var v=r.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}ot&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Me({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),me(this.config.property_denylist)?ke(this.config.property_denylist,(function(y){delete a[y]})):j.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var f=this.config.sanitize_properties;f&&(j.error("sanitize_properties is deprecated. Use before_send instead"),a=f(a,e));var m=this.fs();return a.$process_person_profile=m,m&&!s&&this.ps("_calculate_event_properties"),a}vs(e,t){var r;if(t===void 0&&(t=!0),!this.persistence||!this.fs()||this.Br)return e;var i=this.persistence.get_initial_props(),s=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=Me({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(j.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.Br=!0),Vi(o)?void 0:o}register(e,t){var r;(r=this.persistence)==null||r.register(e,t)}register_once(e,t,r){var i;(i=this.persistence)==null||i.register_once(e,t,r)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}gs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,r){var i=r!=null&&r.merge?this.featureFlags.getFlagVariants():{},s=r!=null&&r.merge?this.featureFlags.getFlagPayloads():{},o=U({},i,e),a=U({},s,t),l={};for(var[c,u]of Object.entries(o)){var d=typeof u=="string";l[c]={key:c,enabled:!!d||!!u,variant:d?u:void 0,reason:void 0,metadata:W(a?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:a[c]}}}this.featureFlags.receivedFeatureFlags({flags:l})}updateEarlyAccessFeatureEnrollment(e,t,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,r)}on(e,t){return this.qr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,r;return(t=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=zR),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,r){if(!this.__loaded||!this.persistence)return j.uninitializedWarning("posthog.identify");if(bn(e)&&(e=e.toString(),j.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))j.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==yo){if(this.ps("posthog.identify")){var i=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==i&&e!==this.get_property(Ro)&&(this.unregister(Ro),this.register({distinct_id:e}));var o=(this.persistence.get_property(fn)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(fn,"identified"),this.setPersonPropertiesForFlags(U({},r||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:r||{}}),this.Jr=A_(e,t,r),this.featureFlags.setAnonymousDistinctId(i)):(t||r)&&this.setPersonProperties(t,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(Gl))}}else j.critical('The string "'+yo+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else j.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var r=A_(this.get_distinct_id(),e,t);this.Jr!==r?(this.setPersonPropertiesForFlags(U({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=r):j.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,r){if(e&&t){var i=this.getGroups();i[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:U({},i,{[e]:t})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),i[e]===t||r||this.reloadFeatureFlags()}else j.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.ps("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,r,i,s;if(j.info("reset"),!this.__loaded)return j.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(r=this.sessionPersistence)==null||r.clear(),this.surveys.reset(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(fn,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:yo,$device_id:null},"");else{var a=this.config.get_device_id(zn());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&r){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return i}alias(e,t){return e===this.get_property(u0)?(j.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(W(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(Ro,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(j.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=U({},this.config);if(Ne(e)){var r,i,s,o,a,l,c;Me(this.config,F_(e));var u=this.Qr();(r=this.persistence)==null||r.update_config(this.config,t,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Lo(U({},this.config,{persistence:"sessionStorage"}),u);var d=this.Kr(this.config.debug);yn(d)&&(this.config.debug=d),yn(this.config.debug)&&(this.config.debug?(hn.DEBUG=!0,Re.H()&&Re.G("ph_debug","true"),j.info("set_config",{config:e,oldConfig:t,newConfig:U({},this.config)})):(hn.DEBUG=!1,Re.H()&&Re.V("ph_debug"))),(i=this.exceptionObserver)==null||i.onConfigChange(),(s=this.sessionRecording)==null||s.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this._s(),(c=this.externalIntegrations)==null||c.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,r={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(r).some(Boolean)){var i,s,o,a,l;(i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),r.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),r.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),r.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),r.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(U({},i,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Hi;return t!==Hi&&(t=Hi+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(fn))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(fn))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Vi(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Ro])&&((t=this.persistence)==null||(t=t.props)==null||!t[Yl]))}ds(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.fs()||this.ps("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ps("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ps(e){return this.config.person_profiles==="never"?(j.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(Yl,!0),!0)}Qr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}_s(){var e,t,r,i,s=this.Qr();return((e=this.persistence)==null?void 0:e.ki)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((t=this.sessionPersistence)==null?void 0:t.ki)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){var t;if(this.config.cookieless_mode!=="always"){var r,i,s;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new cc(this),this.pageViewManager=new rc(this),this.persistence&&(this.sessionPropsManager=new lc(this,this.sessionManager,this.persistence)),this.sessionRecording=new uc(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this._s(),this.us(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(W(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((s=e?.captureEventName)!==null&&s!==void 0?s:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hs()}else j.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._s(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:yo,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.hs())):j.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===gn.GRANTED?"granted":e===gn.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._s()}_is_bot(){return pt?j0(pt,this.config.custom_blocked_useragents):void 0}hs(){V&&(V.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:V.title},{send_instantly:!0}),this.Gr&&(V.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),Oe(V,"visibilitychange",this.Gr)))}debug(e){e===!1?(C?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(C?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}M(){var e,t,r,i,s,o,a,l=this.Yr||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(j.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",i=!1,s=j,o=(t="advanced_disable_flags")in(e=l)&&!pe(e[t]),a=r in e&&!pe(e[r]),o?e[t]:a?(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r]):i)}cs(e){if(pe(this.config.before_send))return e;var t=me(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of t){if(r=i(r),pe(r)){var s="Event '"+e.event+"' was rejected in beforeSend function";return CA(e.event)?j.warn(s+". This can cause unexpected behavior."):j.info(s),null}r.properties&&!Vi(r.properties)||j.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.Kt)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}Kr(e){var t=yn(e)&&!e,r=Re.H()&&Re.q("ph_debug")==="true";return!t&&(!!r||e)}};(function(n,e){for(var t=0;t<e.length;t++)n.prototype[e[t]]=JA(n.prototype[e[t]])})(dc,["identify"]);var D_;var z0=(D_=Fo[Hi]=new dc,(function(){function n(){n.done||(n.done=!0,U0=!1,ke(Fo,(function(e){e._dom_loaded()})))}V!=null&&V.addEventListener?V.readyState==="complete"?n():Oe(V,"DOMContentLoaded",n,{capture:!1}):C&&j.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),D_);var cf=class{constructor(e={}){this.options=e;if(this.client=e.client,this.featureFlagsCallback=e.onFeatureFlagsLoaded,this.captureCallback=e.onCapture,this.rrwebCallback=e.onRRWebEvent,!this.client&&e.consent&&e.requireExplicitConsent&&typeof window<"u"&&e.apiKey){let t=e.consent;t.getStatus()==="granted"&&this.initPostHog(),t.subscribe(i=>{i==="granted"?this.client?this.client.opt_in_capturing():this.initPostHog():i==="denied"&&this.client&&this.client.opt_out_capturing()});return}!this.client&&typeof window<"u"&&e.apiKey&&this.initPostHog()}initPostHog(){let e=this.options;if(!e.apiKey)return;let t=e.enableFeatureFlags??!0,r=`syntro_${e.apiKey.slice(-6)||"sdk"}`,o={api_host:`${(e.apiHost??"https://telemetry.syntrologie.com").replace(/\/$/,"")}/t/${e.apiKey}`,advanced_disable_feature_flags:!t,advanced_disable_feature_flags_on_first_load:!t,autocapture:e.autocapture??!0,capture_pageview:e.capturePageview??"history_change",capture_pageleave:e.capturePageleave??!0,disable_session_recording:!(e.sessionRecording??!0),opt_out_useragent_filter:!0,session_recording:{recordCrossDomainIFrames:!0},capture_performance:!0,enable_recording_console_log:!0},a=z0.init(e.apiKey,o,r);if(a&&(this.client=a),this.captureCallback&&this.client&&this.client.on("eventCaptured",(...l)=>{let c=l[0],u=typeof c=="string"?c:c?.event,d=typeof c=="string"?void 0:c?.properties;typeof u=="string"&&this.captureCallback?.(u,d)}),t&&this.featureFlagsCallback&&this.client){this.client.onFeatureFlags(()=>{let c=this.getAllFeatureFlags();c&&this.featureFlagsCallback&&this.featureFlagsCallback(c)});let l=this.getAllFeatureFlags();l&&Object.keys(l).length>0&&this.featureFlagsCallback(l)}this.rrwebCallback&&this.client&&this.setupRRWebIntercept()}setupRRWebIntercept(e=30){let t=this.client?.sessionRecording;if(!t){e>0&&setTimeout(()=>this.setupRRWebIntercept(e-1),500);return}let r=null,i=t;for(let o of Object.getOwnPropertyNames(i)){let a=i[o];if(a&&typeof a=="object"&&typeof a.onRRwebEmit=="function"&&typeof a.start=="function"&&a!==t){r=a;break}}if(!r){e>0&&setTimeout(()=>this.setupRRWebIntercept(e-1),500);return}let s=r.onRRwebEmit.bind(r);r.onRRwebEmit=o=>{this.rrwebCallback?.({kind:"rrweb",...o}),s(o)},typeof window<"u"&&(window.__RRWEB_INTERCEPT_READY__=!0)}getAllFeatureFlags(){return this.client?.featureFlags?.getFlagVariants()}getSegmentFlags(){let e=this.getAllFeatureFlags();if(!e)return{};let t={};for(let[r,i]of Object.entries(e))r.startsWith("in_segment_")&&(t[r]=i===!0);return t}identify(e,t){this.client?.identify(e,t)}alias(e,t){this.client?.alias(e,t)}track(e,t){this.client?.capture(e,t)}trackCanvasOpened(e){this.track("shadow_canvas_opened",{surface:e})}trackCanvasClosed(e){this.track("shadow_canvas_closed",{surface:e})}trackRectangleViewed(e,t){this.track("shadow_canvas_rectangle_viewed",{rectangleId:e,surface:t})}trackAction(e,t,r){this.track("shadow_canvas_action",{action:e,rectangleId:t,surface:r})}register(e){this.client?.register?.(e)}getSessionId(){return this.client?.get_session_id?.()}startSessionRecording(){this.client?.startSessionRecording?.()}trackExperiment(e,t,r){let i=`$experiment_${e}`;this.register({[i]:r??`variation_${t}`,[`${i}_id`]:t}),this.track("$experiment_started",{$experiment_key:e,$experiment_variation_id:t,$experiment_variation_name:r??`variation_${t}`})}setPersonProperties(e){this.client?.capture("$set",{$set:e})}setPersonPropertiesOnce(e){this.client?.capture("$set",{$set_once:e})}getDistinctId(){return this.client?.get_distinct_id?.()}};function uf(n={}){return new cf(n)}var q0={posthog:n=>uf(n),noop:()=>xp()};function Z0(n,e){let t=q0[n];if(!t)throw new Error(`Unknown telemetry provider: ${n}. Supported: ${Object.keys(q0).join(", ")}`);return t(e)}async function G0(n){Ru(),K("Syntro Bootstrap","====== INIT ======"),K("Syntro Bootstrap","Options:",{hasToken:!!n.token,tokenPrefix:`${n.token?.slice(0,15)}...`,hasCanvasOptions:!!n.canvas});let e=al();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",to()),console.log("[DIAG] editorConf:",ol()),K("Syntro Bootstrap","SDK mode:",e??"normal"),!e&&typeof window<"u"){let A=!!window.__SYNTRO_EDITOR_PARAMS__,F=!!window.__SYNTRO_AUDIT_LEGEND__,X=!!window.__SYNTRO_REVIEW_DATA__;if(A||F||X){let fe=[A&&"__SYNTRO_EDITOR_PARAMS__",F&&"__SYNTRO_AUDIT_LEGEND__",X&&"__SYNTRO_REVIEW_DATA__"].filter(Boolean);console.warn(`[Syntro Bootstrap] \u26A0 Mode detection returned null but mode-specific globals found: ${fe.join(", ")}. This suggests URL params were lost (redirect?) but the service worker injected mode data. Check if replaceState failed or if page JS changed the URL before init().`)}}console.log(`[DIAG] Token resolution: options.token=${n.token?n.token.slice(0,15)+"...":"null"}`);let t=n.token;if(!t&&e){let F=ol()?.syntro_token;F?.startsWith("syn_")&&(t=F,K("Syntro Bootstrap",`\u2713 Using syntro_token from editor_conf (${e} mode)`))}let r;if(t)if(t.startsWith("syn_"))K("Syntro Bootstrap","Token starts with syn_, decoding..."),r=no(t),Ru(r.d);else if(e)K("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw Ba("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),Ba("Syntro Bootstrap","Token received:",t),new Error("Invalid Syntro token: must start with 'syn_'");else if(e)K("Syntro Bootstrap",`\u2713 No token, but ${e} mode - proceeding`);else throw Ba("Syntro Bootstrap","\u274C No token provided and NOT in editor/audit/review mode!"),new Error("Syntro token is required (unless in editor, audit, or review mode)");let i=wt("NEXT_PUBLIC_SYNTRO_EXPERIMENT_HOST")||wt("VITE_SYNTRO_EXPERIMENT_HOST")||r?.eh,s=wt("NEXT_PUBLIC_SYNTRO_TELEMETRY_HOST")||wt("VITE_SYNTRO_TELEMETRY_HOST")||r?.th,o=wt("NEXT_PUBLIC_SYNTRO_EDITOR_URL")||wt("VITE_SYNTRO_EDITOR_URL")||n.canvas?.editorUrl,a=r?.g||wt("NEXT_PUBLIC_SYNTRO_GEO_HOST")||wt("VITE_SYNTRO_GEO_HOST")||Ny,l=My(),c=Rd(),u=n.appSignalsInit??{},d={...c,...l,...u};K("Syntro Bootstrap","Phase 1: Browser metadata:",c),K("Syntro Bootstrap","Phase 1: Cached segment attributes:",l),Object.keys(u).length>0&&K("Syntro Bootstrap","Phase 1: App signals:",u);let h=Td(a),g=(()=>{try{if(typeof window>"u"||window.self===window.top)return Promise.resolve(null)}catch{}return new Promise(A=>{let F=setTimeout(()=>{window.removeEventListener("message",X),A(null)},500);function X(fe){let de=fe.data;de?.jsonrpc==="2.0"&&de?.id===1&&de?.result?.hostInfo&&(clearTimeout(F),window.removeEventListener("message",X),A(de.result.hostInfo))}window.addEventListener("message",X);try{window.parent.postMessage({jsonrpc:"2.0",id:1,method:"ui/initialize",params:{capabilities:{}}},"*")}catch{clearTimeout(F),window.removeEventListener("message",X),A(null)}})})(),v,f=n.debug||n.testMode,m=ro({debug:n.debug,history:f?new io(n.testMode?0:100):void 0,testMode:n.testMode});console.log("[Syntro Bootstrap] EventBus created");let y=ku({elementResolver:typeof window<"u"?(A,F)=>{let X=document.elementFromPoint(A,F);if(!X)return null;let fe={tag_name:X.tagName.toLowerCase()};X.id&&(fe.attr__id=X.id),X.className&&typeof X.className=="string"&&(fe.classes=X.className.split(" ").filter(Boolean));for(let de of X.attributes)de.name.startsWith("data-")&&(fe[`attr__${de.name}`]=de.value);return fe}:void 0});y.onEvent(A=>m.publishEvent(A)),typeof window<"u"&&(setInterval(()=>y.tick(Date.now()),1e3),document.addEventListener("click",A=>{let F=[],X=A.target;for(;X&&X!==document.body;){let fe={tag_name:X.tagName.toLowerCase()};for(let de of X.attributes)(de.name.startsWith("data-")||de.name==="id"||de.name==="class"||de.name==="aria-label")&&(fe[`attr__${de.name}`]=de.value);F.push(fe),X=X.parentElement}y.enrichClickAttributes(Date.now(),F)},!0));let k=Tb(),_,b=A=>{K("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let F=Oy(A);if(K("Syntro Bootstrap","Segment flags from PostHog:",F),Py(F),v){let X=R?.getAll?.()??{},fe={...c,...X,...F,...u};K("Syntro Bootstrap","Updating GrowthBook with attributes:",fe),v.setAttributes?.(fe)}if(_&&x?.getDistinctId){let X=x.getDistinctId();X&&s&&r?.t&&_.updateContext({distinctId:X,telemetryHost:s,telemetryKey:r.t})}},x;if(r?.t){let A=r.t==="noop"?"noop":"posthog";x=Z0(A,{apiKey:r.t,apiHost:s,enableFeatureFlags:!0,sessionRecording:!0,onFeatureFlagsLoaded:b,onCapture:(X,fe)=>{y.ingest({kind:"posthog",event:X,properties:fe,timestamp:Date.now()})},onRRWebEvent:X=>{y.ingest(X)}}),console.log(`[Syntro Bootstrap] Telemetry client created (${A}) with EventBus wiring`),Object.keys(u).length>0&&(x.track?.("app_signals_init",u),K("Syntro Bootstrap","Tracked app signals event:",u));let F=x;if(m.setPosthogCapture((X,fe)=>{F.track?.(X,fe)}),k?.name==="shopify"&&s)try{_=new Il({distinctId:x.getDistinctId?.()??"",telemetryHost:s,telemetryKey:r.t}),K("Syntro Bootstrap","ShopifyPixelBridge initialized for checkout attribution")}catch(X){Qe("Syntro Bootstrap","ShopifyPixelBridge init failed",X)}}let R;r?.e&&(v=kb("growthbook",{clientKey:r.e,apiHost:i,attributes:d,onExperimentViewed:x?.trackExperiment?(A,F,X)=>{x.trackExperiment(A,F,X)}:void 0})),R=Qd({experiments:v,onMetricChange:(A,F)=>{K("Syntro Bootstrap",`Session metric changed: ${A} = ${F}`)}}),K("Syntro Bootstrap","SessionMetricTracker created");let w="production";e==="editor"?w="editor":e==="audit"?w="audit":wt("NODE_ENV")==="development"&&(w="development");let E=bp({telemetry:x,sessionMetrics:R,mode:w,events:m});K("Syntro Bootstrap","Runtime created:",{version:E.version,mode:E.mode,hasContext:!!E.context,hasEvents:!!E.events,hasState:!!E.state}),K("Syntro Bootstrap","Core app executors already registered");let $=n.cdnBase||wt("NEXT_PUBLIC_SYNTRO_CDN_BASE")||wt("VITE_SYNTRO_CDN_BASE")||"https://cdn.syntrologie.com",P=Xc({cdnBase:$,registry:E.apps,onLoadStart:A=>{K("Syntro Bootstrap",`Loading app from CDN: ${A}`)},onLoadEnd:(A,F,X)=>{F?K("Syntro Bootstrap",`App loaded successfully: ${A}`):Qe("Syntro Bootstrap",`Failed to load app: ${A}`,X)}});typeof window<"u"&&(window.SynOS={...window.SynOS,appRegistry:E.apps,runtime:E,version:E.version},K("Syntro Bootstrap","Global SynOS object exposed"));let M=E.apps.list?.()??[];console.log(`[DIAG] Activation loop: ${M.length} apps in registry:`,M.map(A=>`${A.manifest.id}(${A.state})`).join(", "));for(let A of M)if(A.state==="registered")try{await E.apps.activate(A.manifest.id),console.log(`[DIAG] Activated: ${A.manifest.id} \u2192 widgets: [${E.widgets.list().join(", ")}]`)}catch(F){console.error(`[DIAG] FAILED to activate: ${A.manifest.id}`,F),Qe("Syntro Bootstrap",`Failed to auto-activate built-in app: ${A.manifest.id}`,F)}if(console.log(`[DIAG] Activation complete. Total widgets: [${E.widgets.list().join(", ")}]`),v?.refreshFeatures)try{await v.refreshFeatures(),K("Syntro Bootstrap","GrowthBook features loaded")}catch(A){Qe("Syntro Bootstrap","Failed to load GrowthBook features:",A)}let G=await h;if(v&&Object.keys(G).length>0){let A={...c,...G,...u};K("Syntro Bootstrap","Merging geo data into GrowthBook attributes:",G),v.setAttributes?.(A)}let L=await g;L&&v&&(c.surface_type="mcp-app",c.surface_host=L.name,v.setAttributes?.({...c,...G}),K("Syntro Bootstrap","MCP App detected:",L.name));let N;if(n.fetcher)N=n.fetcher;else if(r?.f){let A=Ab(r.f,r.o??{});N=async()=>{let F=await A.fetch();return{...F.config,tiles:F.config.tiles??[]}}}else v&&(N=hi({experiments:v}));let z=new Set,H=N?async()=>{let A=await N(),F=A.tiles?.length??0,X=A.actions?.length??0,fe=A.meta?.variant_id;if((F>0||X>0)&&(fe||console.warn("[Syntro] Config has content but no meta.variant_id \u2014 intervention tracking disabled")),x&&fe){let Ce=new vo(x,fe);Ce.trackServed(F,X),typeof window<"u"&&(window.SynOS.interventionTracker=Ce),E.navigation.subscribe(()=>{Ce.resetPage()})}console.log("[Syntro Bootstrap] Config fetched:",`tiles=${A.tiles?.length??0},`,`actions=${A.actions?.length??0},`,`theme=${A.theme?.name??"none"}`),A.actions?.length>0&&console.log("[Syntro Bootstrap] Actions in config:",A.actions.map((Ce,Et)=>`[${Et}] ${Ce.kind}${Ce.anchorId?` anchor="${Ce.anchorId.selector}"`:""}${Ce.label?` "${Ce.label}"`:""}`).join(", "));let de=A,He=P.getRequiredApps(de);return He.length>0?console.log("[Syntro Bootstrap] Required external apps:",He.join(", ")):K("Syntro Bootstrap","No external apps required (all executors are built-in)"),He.length>0&&await P.loadAppsForConfig(de).then(async Et=>{let Ct=Et.filter(Pe=>Pe.success),gc=Et.filter(Pe=>!Pe.success);Ct.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${Ct.map(Pe=>Pe.appId).join(", ")}`);let Yi=gc.filter(Pe=>!z.has(Pe.appId));Yi.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",Yi.map(Pe=>`${Pe.appId} (${Pe.error})`).join(", ")),Yi.forEach(Pe=>z.add(Pe.appId)));for(let Pe of He)if(E.apps.has(Pe))try{await E.apps.activate(Pe),console.log(`[Syntro Bootstrap] App activated: ${Pe}`)}catch(Ht){console.error(`[Syntro Bootstrap] Failed to activate app: ${Pe}`,Ht)}else console.error(`[Syntro Bootstrap] App "${Pe}" required by config but NOT registered.`,`Available apps: [${Array.from(E.apps.list?.()??[]).join(", ")}]`)}),A}:void 0;if(k){K("Syntro Bootstrap",`Detected platform: ${k.name}`);try{await k.onInit(),K("Syntro Bootstrap",`Platform adapter initialized: ${k.name}`)}catch(A){Qe("Syntro Bootstrap",`Platform adapter init failed: ${k.name}`,A)}}return{canvas:await Ed({...n.canvas,fetcher:H,integrations:{experiments:v,telemetry:x},editorUrl:o,runtime:E,platformAdapter:k??void 0}),runtime:E,experiments:v,telemetry:x,sessionMetrics:R,appLoader:P}}async function JR(n){try{return await G0(n)}catch(e){let t=e instanceof Error?e.message:String(e);console.warn("[Syntrologie] SDK initialization failed:",t),typeof document<"u"&&document.getElementById("syntrologie-anti-flicker")?.remove();return}}function QR(n,e={}){if(typeof window>"u")return;let t=window.SynOS?.runtime;t?.events?.publish&&t.events.publish({name:n,source:"custom",props:e})}var K0={init:JR,encodeToken:Ad,decodeToken:no,events:{emit:QR}};typeof window<"u"&&(window.Syntro=K0);function Zo(n){let e=n.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function VD(n){let e=[],t=[];if(!n||typeof n!="object")return{valid:!1,errors:["Config must be an object"],warnings:e};let r=n;if(r.tiles||t.push("Config missing required field: tiles"),r.actions||t.push("Config missing required field: actions"),r.fetchedAt||t.push("Config missing required field: fetchedAt"),t.length>0)return{valid:!1,errors:t,warnings:e};let i=r.schemaVersion||"1.0",s=Zo(i),o=Zo(En);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${En}. Some features may not work. Update SDK to latest version.`),s.major<o.major||!r.schemaVersion?(e.push(`Config schema v${i} is older than SDK v${En}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:eT(r,i)}):{valid:!0,warnings:e,errors:t}}function eT(n,e){let t={...n};return Zo(e).major===1&&(t=tT(t)),t.schemaVersion=En,t}function tT(n){let e={schemaVersion:"2.0",tiles:[],actions:n.actions||[],fetchedAt:n.fetchedAt||new Date().toISOString()};return n.tiles&&Array.isArray(n.tiles)&&(e.tiles=n.tiles.map(t=>{let r={...t};return t.experiment&&delete r.experiment,r})),n.configVersion&&(e.configVersion=n.configVersion),n.canvasTitle&&(e.canvasTitle=n.canvasTitle),n.theme&&(e.theme=n.theme),n.launcher&&(e.launcher=n.launcher),e}function WD(n){if(!n||typeof n!="object")return!1;let e=n,t=e.schemaVersion||"1.0",r=Zo(t),i=Zo(En);return r.major<i.major||!e.schemaVersion}var nT=p.object({url:p.string(),routeId:p.string().optional(),title:p.string().optional(),locale:p.string().optional()}),rT=p.object({url:p.string(),ts:p.number()}),iT=p.object({sessionId:p.string(),startTs:p.number(),pageHistory:p.array(rT).optional()}),sT=p.object({width:p.number(),height:p.number()}),oT=p.object({x:p.number(),y:p.number(),w:p.number(),h:p.number()}),aT=p.object({anchorId:p.string(),present:p.boolean(),visible:p.boolean().optional(),boundingBox:oT.optional()}),lT=p.record(p.string(),p.union([p.number(),p.string(),p.boolean(),p.undefined()])),cT=p.object({page:nT,session:iT,viewport:sT,anchors:p.array(aT).optional(),augmented:lT.optional()});function zD(n){return cT.safeParse(n)}var df=class{constructor(e,t,r,i){this._isFallback=!0;this._isLoading=!0;this._cancelled=!1;this._host=e,this._runtime=t,this._strategy=r,this._defaultValue=i,this._value=i,e.addController(this)}get value(){return this._value}get isFallback(){return this._isFallback}get isLoading(){return this._isLoading}hostConnected(){this._evaluate()}hostDisconnected(){this._cancelled=!0}setStrategy(e){this._strategy=e,this._evaluate()}_evaluate(){if(this._cancelled=!1,!this._runtime||!this._strategy){this._value=this._defaultValue,this._isFallback=!0,this._isLoading=!1,this._host.requestUpdate();return}this._isLoading=!0,this._host.requestUpdate();let e=this._strategy;this._runtime.evaluate(e).then(t=>{this._cancelled||(this._value=t.value,this._isFallback=t.isFallback,this._isLoading=!1,this._host.requestUpdate())})}};var pf=class{constructor(e,t){this._unsubscribe=null;this.host=e,this._runtime=t,this._context=t.context.get(),e.addController(this)}hostConnected(){this._context=this._runtime.context.get(),this._unsubscribe=this._runtime.context.subscribe(e=>{this._context=e,this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}get runtime(){return this._runtime}get context(){return this._context}get page(){return this._context?.page??null}get session(){return this._context?.session??null}get viewport(){return this._context?.viewport??null}};var hf=class{constructor(e,t,r,i){this._host=e,this._runtime=t,this._filter=r,this._callback=i,e.addController(this)}hostConnected(){this._subscribe()}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=void 0}setFilter(e){this._filter=e,this._unsubscribe!==void 0&&(this._unsubscribe(),this._unsubscribe=void 0,this._subscribe())}setCallback(e){this._callback=e,this._unsubscribe!==void 0&&(this._unsubscribe(),this._unsubscribe=void 0,this._subscribe())}_subscribe(){this._runtime&&(this._unsubscribe=this._filter?this._runtime.events.subscribe(this._filter,this._callback):this._runtime.events.subscribe(this._callback))}};var Y0=p.enum(["posthog","canvas","derived"]),uT=p.object({ts:p.number(),name:p.string(),source:Y0,props:p.record(p.string(),p.unknown()).optional(),schemaVersion:p.string()}),dT=p.object({names:p.array(p.string()).optional(),patterns:p.array(p.string()).optional(),sources:p.array(Y0).optional()});function g4(n){return uT.safeParse(n)}function m4(n){return dT.safeParse(n)}var X0=p.union([p.object({type:p.literal("data"),key:p.string(),value:p.string().optional()}),p.object({type:p.literal("css"),value:p.string()}),p.object({type:p.literal("aria"),role:p.string().optional(),label:p.string().optional()}),p.object({type:p.literal("shadow-css"),value:p.string()}),p.object({type:p.literal("ref"),el:p.any()})]),pT=p.object({kind:p.literal("tooltip"),id:p.string(),anchor:X0,content:p.object({title:p.string().optional(),body:p.string()}),placement:p.enum(["top","bottom","left","right","auto"]).optional(),offsetPx:p.number().optional(),blocking:p.boolean().optional(),trigger:p.enum(["immediate","hover","click"]).optional(),dismiss:p.object({onEsc:p.boolean().optional(),closeButton:p.boolean().optional(),timeoutMs:p.number().optional()}).optional()}),hT=p.object({kind:p.literal("highlight"),id:p.string(),anchor:X0,copy:p.string().optional(),ring:p.object({paddingPx:p.number().optional(),radiusPx:p.number().optional()}).optional(),scrim:p.object({opacity:p.number().optional()}).optional(),ringColor:p.string().optional(),blocking:p.boolean().optional(),dismiss:p.object({onClickOutside:p.boolean().optional(),onEsc:p.boolean().optional(),timeoutMs:p.number().optional()}).optional()}),ff=p.object({id:p.string(),version:p.number(),routes:p.array(p.string()).optional(),steps:p.array(p.union([pT,hT]))});function $4(n){return ff.parse(n)}var N4=({configUri:n,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:r="include"}={})=>async()=>{let i=Iu({configUri:n,experiments:e,featureKey:t});if(!i)throw new Error("SmartCanvas overlays: recipe URI missing (env + feature unset).");let s=await fetch(i,{credentials:r});if(!s.ok)throw new Error(`SmartCanvas overlays: failed to fetch recipe (${s.status})`);let o=await s.json();return ff.parse(o)};var fT=p.object({value:p.unknown(),expiresAt:p.number().optional()}),gT=p.object({count:p.number(),resetAt:p.number().optional()});function D4(n){return fT.safeParse(n)}function H4(n){return gT.safeParse(n)}var J0="2026-04-24T22:49:55.034Z (617ec713a54)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${J0} (Lit)`);let n=window.SynOS,e=n?.appRegistry||ys;window.SynOS={...n,appRegistry:e,_runtimeBuild:J0,_renderer:"lit"},Ua(),tv(e)}export{mo as ANIMATION_KEYFRAMES,il as ActivationConfigZ,oy as AddClassZ,xt as AnchorIdZ,aT as AnchorStateZ,ud as AnchorVisibleConditionZ,vs as AppRegistry,lT as AugmentationZ,Kv as BadgePositionZ,py as BadgeZ,oT as BoundingBoxZ,Os as CanvasEvents,ff as CanvasRecipeZ,Ln as ConditionZ,$l as ContextManager,md as CooldownActiveConditionZ,Zs as CounterDefZ,xd as CtaButtonZ,Eu as DEFAULT_COOLDOWN,df as DecisionController,Qs as DecisionStrategyZ,gd as DismissedConditionZ,$e as EVENT_SCHEMA_VERSION,cl as EventBus,yd as EventCountConditionZ,dT as EventFilterZ,io as EventHistory,dd as EventOccurredConditionZ,Y0 as EventSourceZ,Ga as ExecutorRegistry,Js as ExternalStrategyZ,gT as FrequencyEntryZ,vd as FrequencyLimitConditionZ,hT as HighlightStepZ,Gv as HighlightStyleZ,uy as HighlightZ,cy as InsertHtmlZ,Qv as InsertPositionZ,vo as InterventionTracker,Su as MAX_VISIBLE_TOASTS,qs as MatchOpZ,Jv as ModalContentZ,fy as ModalZ,Xs as ModelStrategyZ,vy as MountWidgetZ,my as NavigateZ,po as NavigationMonitor,uT as NormalizedEventZ,Ps as NotificationsController,nT as PageContextZ,rT as PageHistoryEntryZ,ld as PageUrlConditionZ,_y as ParallelZ,Yv as PlacementZ,dy as PulseZ,J0 as RUNTIME_SDK_BUILD,jb as RUNTIME_VERSION,ay as RemoveClassZ,cd as RouteConditionZ,Zv as RouteFilterZ,Ks as RuleStrategyZ,Gs as RuleZ,cT as RuntimeContextZ,pf as RuntimeController,hf as RuntimeEventsController,En as SDK_SCHEMA_VERSION,Tu as SDK_VERSION,Hb as STATIC_SLOT_STYLES,Ys as ScoreStrategyZ,ry as ScrollBehaviorZ,_d as ScrollLogicalPositionZ,gy as ScrollToZ,X0 as SelectorZ,by as SequenceZ,iT as SessionContextZ,fd as SessionMetricConditionZ,Al as SessionMetricTracker,sy as SetAttrZ,ly as SetStyleZ,iy as SetTextZ,$u as SmartCanvasController,mi as SmartCanvasElementLit,We as StandardEvents,pd as StateEqualsConditionZ,Ol as StateStore,fT as StoredValueZ,K0 as Syntro,Ns as ThemeController,Xv as TooltipContentZ,pT as TooltipStepZ,ey as TooltipTriggerZ,hy as TooltipZ,ny as TourStepForSchemaZ,xy as TourZ,rl as TriggerWhenZ,hd as ViewportConditionZ,sT as ViewportContextZ,yy as WaitZ,ty as WidgetConfigZ,Ll as WidgetRegistry,cp as applyStaticSlotStyles,X1 as coreActionStepSchemas,id as createActionEngine,wd as createAnchorResolver,hi as createCanvasConfigFetcher,np as createContextManager,rp as createDecisionEngine,ip as createEventAccumulator,ro as createEventBus,Yd as createGrowthBookClient,xp as createNoopClient,N4 as createOverlayRecipeFetcher,uf as createPostHogClient,sv as createPostHogNormalizer,Qd as createSessionMetricTracker,Ed as createSmartCanvas,dv as createSmartCanvasController,bp as createSmartCanvasRuntime,lp as createStateStore,fp as createSurfaceContainer,mp as createSurfaces,UN as decisionSchemas,no as decodeToken,Ad as encodeToken,Ob as evaluate,$b as evaluateCondition,Mb as evaluateRule,Ml as evaluateRuleStrategy,Pl as evaluateScoreStrategy,Nb as evaluateSync,rn as executorRegistry,J1 as getAntiFlickerSnippet,CE as getExecutor,Nl as getSlotAnchorId,go as getSlotType,gp as getSlotZIndex,Wu as hasExecutor,WD as needsMigration,$s as normalizePostHogEvent,Zo as parseVersion,pp as playEnterAnimation,hp as playExitAnimation,fi as registerConfigPredicates,Ua as registerSmartCanvasElement,Iu as resolveConfigUri,vE as runtimeContext,up as setupAdjacentPositioning,dp as setupInlinePositioning,Ms as shouldNormalizeEvent,Wt as validateAction,Xa as validateActions,jN as validateActivationConfig,VN as validateCondition,VD as validateConfig,m4 as validateEventFilter,Id as validateEventName,H4 as validateFrequencyEntry,g4 as validateNormalizedEvent,$d as validateProps,$4 as validateRecipe,zD as validateRuntimeContext,D4 as validateStoredValue,WN as validateStrategy,vp as widgetRegistry};
|
|
1163
1163
|
/*! Bundled license information:
|
|
1164
1164
|
|
|
1165
1165
|
@lit/reactive-element/css-tag.js:
|