@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.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var SyntrologieSDK=(()=>{var gx=Object.create;var ys=Object.defineProperty;var mx=Object.getOwnPropertyDescriptor;var vx=Object.getOwnPropertyNames;var yx=Object.getPrototypeOf,bx=Object.prototype.hasOwnProperty;var tg=n=>{throw TypeError(n)};var _x=(n,e,t)=>e in n?ys(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var au=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),ng=(n,e)=>{for(var t in e)ys(n,t,{get:e[t],enumerable:!0})},rg=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vx(e))!bx.call(n,i)&&i!==t&&ys(n,i,{get:()=>e[i],enumerable:!(r=mx(e,i))||r.enumerable});return n};var zr=(n,e,t)=>(t=n!=null?gx(yx(n)):{},rg(e||!n||!n.__esModule?ys(t,"default",{value:n,enumerable:!0}):t,n)),xx=n=>rg(ys({},"__esModule",{value:!0}),n);var me=(n,e,t)=>_x(n,typeof e!="symbol"?e+"":e,t),lu=(n,e,t)=>e.has(n)||tg("Cannot "+t);var $=(n,e,t)=>(lu(n,e,"read from private field"),t?t.call(n):e.get(n)),ee=(n,e,t)=>e.has(n)?tg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),K=(n,e,t,r)=>(lu(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),te=(n,e,t)=>(lu(n,e,"access private method"),t);var cu=(n,e,t,r)=>({set _(i){K(n,e,i,t)},get _(){return $(n,e,r)}});var wu=au((z2,Xg)=>{var mw=function(){return null},vw={get:function(n,e){return mw}};Xg.exports=new Proxy({__esModule:!0,default:{}},vw)});var ku=au((q2,Qg)=>{var yw=function(){return null},bw={get:function(n,e){return yw}};Qg.exports=new Proxy({__esModule:!0,default:{}},bw)});var Su=au((Z2,Jg)=>{var _w=function(){return null},xw={get:function(n,e){return _w}};Jg.exports=new Proxy({__esModule:!0,default:{}},xw)});var wT={};ng(wT,{ANIMATION_KEYFRAMES:()=>ts,ActivationConfigZ:()=>ho,AddClassZ:()=>op,AnchorIdZ:()=>ut,AnchorStateZ:()=>ix,AnchorVisibleConditionZ:()=>xl,AppRegistry:()=>ai,AugmentationZ:()=>sx,BadgePositionZ:()=>Kd,BadgeZ:()=>pp,BoundingBoxZ:()=>rx,CanvasEvents:()=>_i,CanvasRecipeZ:()=>ru,ConditionZ:()=>cn,ContextManager:()=>So,CooldownActiveConditionZ:()=>Al,CounterDefZ:()=>Li,CtaButtonZ:()=>$l,DEFAULT_COOLDOWN:()=>Xa,DecisionController:()=>eu,DecisionStrategyZ:()=>Wi,DismissedConditionZ:()=>Cl,EVENT_SCHEMA_VERSION:()=>Re,EventBus:()=>mo,EventCountConditionZ:()=>Tl,EventFilterZ:()=>lx,EventHistory:()=>zi,EventOccurredConditionZ:()=>wl,EventSourceZ:()=>Gf,ExecutorRegistry:()=>oo,ExternalStrategyZ:()=>Vi,FrequencyEntryZ:()=>px,FrequencyLimitConditionZ:()=>Rl,HighlightStepZ:()=>ux,HighlightStyleZ:()=>Gd,HighlightZ:()=>up,InsertHtmlZ:()=>cp,InsertPositionZ:()=>Jd,InterventionTracker:()=>ns,MAX_VISIBLE_TOASTS:()=>Ya,MatchOpZ:()=>Ni,ModalContentZ:()=>Qd,ModalZ:()=>fp,ModelStrategyZ:()=>Bi,MountWidgetZ:()=>vp,NavigateZ:()=>mp,NavigationMonitor:()=>Ji,NormalizedEventZ:()=>ax,NotificationsController:()=>bi,PageContextZ:()=>J0,PageHistoryEntryZ:()=>ex,PageUrlConditionZ:()=>bl,ParallelZ:()=>_p,PlacementZ:()=>Yd,PulseZ:()=>dp,RUNTIME_SDK_BUILD:()=>Yf,RUNTIME_VERSION:()=>rh,RemoveClassZ:()=>ap,RouteConditionZ:()=>_l,RouteFilterZ:()=>qd,RuleStrategyZ:()=>Di,RuleZ:()=>Fi,RuntimeContextZ:()=>ox,RuntimeController:()=>tu,RuntimeEventsController:()=>nu,SDK_SCHEMA_VERSION:()=>en,SDK_VERSION:()=>tl,STATIC_SLOT_STYLES:()=>th,ScoreStrategyZ:()=>Hi,ScrollBehaviorZ:()=>rp,ScrollLogicalPositionZ:()=>Il,ScrollToZ:()=>gp,SelectorZ:()=>Kf,SequenceZ:()=>bp,SessionContextZ:()=>tx,SessionMetricConditionZ:()=>El,SessionMetricTracker:()=>ko,SetAttrZ:()=>sp,SetStyleZ:()=>lp,SetTextZ:()=>ip,SmartCanvasController:()=>rl,SmartCanvasElementLit:()=>vr,StandardEvents:()=>Le,StateEqualsConditionZ:()=>kl,StateStore:()=>To,StoredValueZ:()=>dx,Syntro:()=>Zf,ThemeController:()=>xi,TooltipContentZ:()=>Xd,TooltipStepZ:()=>cx,TooltipTriggerZ:()=>ep,TooltipZ:()=>hp,TourStepForSchemaZ:()=>np,TourZ:()=>xp,TriggerWhenZ:()=>po,ViewportConditionZ:()=>Sl,ViewportContextZ:()=>nx,WaitZ:()=>yp,WidgetConfigZ:()=>tp,WidgetRegistry:()=>$o,applyStaticSlotStyles:()=>uc,coreActionStepSchemas:()=>$y,createActionEngine:()=>hl,createAnchorResolver:()=>Ml,createCanvasConfigFetcher:()=>hr,createContextManager:()=>oc,createDecisionEngine:()=>ac,createEventAccumulator:()=>lc,createEventBus:()=>Ui,createGrowthBookClient:()=>ic,createNoopClient:()=>_c,createOverlayRecipeFetcher:()=>bT,createPostHogClient:()=>Jc,createPostHogNormalizer:()=>pd,createSessionMetricTracker:()=>sc,createSmartCanvas:()=>Ll,createSmartCanvasController:()=>vd,createSmartCanvasRuntime:()=>bc,createStateStore:()=>cc,createSurfaceContainer:()=>gc,createSurfaces:()=>vc,decisionSchemas:()=>nC,decodeToken:()=>ji,encodeToken:()=>Fl,evaluate:()=>Yp,evaluateCondition:()=>Gp,evaluateRule:()=>Kp,evaluateRuleStrategy:()=>Eo,evaluateScoreStrategy:()=>Co,evaluateSync:()=>Xp,executorRegistry:()=>Vt,getAntiFlickerSnippet:()=>Oy,getExecutor:()=>gy,getSlotAnchorId:()=>Io,getSlotType:()=>es,getSlotZIndex:()=>mc,hasExecutor:()=>ul,needsMigration:()=>fT,normalizePostHogEvent:()=>vi,parseVersion:()=>vs,playEnterAnimation:()=>hc,playExitAnimation:()=>fc,registerConfigPredicates:()=>mr,registerSmartCanvasElement:()=>ro,resolveConfigUri:()=>nl,runtimeContext:()=>iy,setupAdjacentPositioning:()=>dc,setupInlinePositioning:()=>pc,shouldNormalizeEvent:()=>yi,validateAction:()=>Lt,validateActions:()=>ao,validateActivationConfig:()=>tC,validateCondition:()=>J1,validateConfig:()=>dT,validateEventFilter:()=>vT,validateEventName:()=>Dl,validateFrequencyEntry:()=>xT,validateNormalizedEvent:()=>mT,validateProps:()=>Hl,validateRecipe:()=>yT,validateRuntimeContext:()=>gT,validateStoredValue:()=>_T,validateStrategy:()=>eC,widgetRegistry:()=>yc});function ig(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 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 uu(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(!wx.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 sg=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=uu(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=ig(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=uu(d.html))}}};function og(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 og(t)}return n}var ag=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=og(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)}}},lg=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)}}},cg=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))}}},ug=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)}}},dg=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)}}},du=[{kind:"content:insertHtml",executor:sg},{kind:"content:setText",executor:ag},{kind:"content:setAttr",executor:lg},{kind:"content:addClass",executor:cg},{kind:"content:removeClass",executor:ug},{kind:"content:setStyle",executor:dg}],pu={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:du};var kx={light:50,medium:100,heavy:200},Sx=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],pg={init(n,e,t){let r=kx[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 Ex={light:20,medium:40,heavy:80},Cx="\u{1F389}",hg={init(n,e,t){let r=Ex[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:Cx,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 Ax={light:20,medium:40,heavy:80},Rx={light:3,medium:4,heavy:5},fg={init(n,e,t){let r=Ax[t.intensity],i=Rx[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 Tx={light:30,medium:60,heavy:120},gg={init(n,e,t){let r=Tx[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 aa=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 Ix=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function $x(n,e){return[n,e,`${n}cc`,`${e}cc`,"#ffffff",`${n}80`]}function Mx(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 $x(t,r||t)}catch{}return null}var mg=new Map([["confetti",pg],["fireworks",fg],["sparkles",gg],["emoji-rain",hg]]),vg=async(n,e)=>{let t=mg.get(n.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${n.effect}". Available: ${[...mg.keys()].join(", ")}`),{cleanup:()=>{}};let r=n.colors??Mx(e.overlayRoot)??Ix,i={duration:n.duration??3e3,intensity:n.intensity??"medium",colors:r,props:n.props},s=new aa;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:n.effect}),{cleanup:()=>{s.stop()}}};var fu="syntro_active_tour",la=new Map;function Px(n){try{let e=localStorage.getItem(fu);if(!e)return null;let t=JSON.parse(e);return t.tourId!==n?null:t}catch{return null}}function hu(n){try{localStorage.setItem(fu,JSON.stringify(n))}catch{}}function Ox(){try{localStorage.removeItem(fu)}catch{}}function bs(){return window.location.pathname}function Nx(n){if(!n.route)return!0;let e=bs();return n.route.includes("*")?new RegExp(`^${n.route.replace(/\*/g,".*")}$`).test(e):e===n.route}var gu=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(la.has(t))return{cleanup:async()=>{let _=la.get(t);_&&await _.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=Px(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||r[0].id,startedAt:Date.now()},hu(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,hu(o)}let c=r[l];if(!Nx(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:bs()}),{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"){Ox(),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=_,hu(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:_}),b.route&&b.route!==bs()){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 _=bs(),b=()=>{let x=bs();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,la.delete(t),await v(),g&&g(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return la.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"},He={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"},_s={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"},xs={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]},VT={primary:S[2],secondary:S[0]},mu={primary:S[4],secondary:S[3]},ca={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]}},WT={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:He[8],pillOutline:He[4],borderPrimary:He[2],borderSecondary:He[2],background:He[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:_s[8],pillOutline:_s[4],borderPrimary:_s[2],borderSecondary:_s[2],background:_s[0]},pink:{content:xs[8],pillOutline:xs[4],borderPrimary:xs[2],borderSecondary:xs[2],background:xs[0]}},jT={green:{content:ye[8],border:ye[2],background:ye[0]},yellow:{content:He[8],border:He[2],background:He[0]},red:{content:Ae[8],border:Ae[2],background:Ae[0]}},UT={green:{content:ye[1],background:ye[9]},yellow:{content:He[1],background:He[9]},red:{content:Ae[1],background:Ae[9]}},zT={content:S[10],border:S[4],background:S[3]},qT={backgroundDefault:S[2],backgroundHover:S[1],selected:S[3]},ZT={background:S[2],icon:S[10],borderDefault:S[4],borderSelected:ie[3],textLabel:S[9],textPlaceholder:S[8],textHint:S[8]},GT={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]},KT={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]}},YT={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]}},XT={content:S[10],background:S[4]},QT={background:S[4],active:ye[3]},JT={background:S[1],content:S[9],border:S[4]},e2={backgroundDefault:S[1],backgroundHover:S[3],backgroundActive:S[4],border:S[4],contentPrimary:S[10],contentSecondary:S[9],contentTertiary:S[8]},t2={background:S[1],content:S[9],border:S[4]},n2={activeBackground:S[3],activeContent:ie[5],inactiveContent:S[9],border:S[4]},r2={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]}},i2={textPrimaryDefault:S[10],textPrimaryHover:S[10],textSecondaryDefault:S[8],textSecondaryHover:S[9],iconPrimary:S[10],iconSecondary:S[8]},s2={background:ye[1],active:ye[5]},o2={textDefault:S[10],textSelected:Ct.white,textDisabled:S[7],backgroundDefault:S[2],backgroundMiddle:S[3],backgroundSelected:ie[3],border:S[4]},a2=S[9];var d2={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 yg=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function bg(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(!yg)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`}),yg){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 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 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(!Lx.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)"},vu=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 SyntrologieSDK=(()=>{var _x=Object.create;var bs=Object.defineProperty;var xx=Object.getOwnPropertyDescriptor;var wx=Object.getOwnPropertyNames;var kx=Object.getPrototypeOf,Sx=Object.prototype.hasOwnProperty;var og=n=>{throw TypeError(n)};var Ex=(n,e,t)=>e in n?bs(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var du=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),ag=(n,e)=>{for(var t in e)bs(n,t,{get:e[t],enumerable:!0})},lg=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of wx(e))!Sx.call(n,i)&&i!==t&&bs(n,i,{get:()=>e[i],enumerable:!(r=xx(e,i))||r.enumerable});return n};var zr=(n,e,t)=>(t=n!=null?_x(kx(n)):{},lg(e||!n||!n.__esModule?bs(t,"default",{value:n,enumerable:!0}):t,n)),Cx=n=>lg(bs({},"__esModule",{value:!0}),n);var ve=(n,e,t)=>Ex(n,typeof e!="symbol"?e+"":e,t),pu=(n,e,t)=>e.has(n)||og("Cannot "+t);var I=(n,e,t)=>(pu(n,e,"read from private field"),t?t.call(n):e.get(n)),ee=(n,e,t)=>e.has(n)?og("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Z=(n,e,t,r)=>(pu(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),te=(n,e,t)=>(pu(n,e,"access private method"),t);var hu=(n,e,t,r)=>({set _(i){Z(n,e,i,t)},get _(){return I(n,e,r)}});var Cu=du((QI,nm)=>{var xw=function(){return null},ww={get:function(n,e){return xw}};nm.exports=new Proxy({__esModule:!0,default:{}},ww)});var Au=du((e2,rm)=>{var kw=function(){return null},Sw={get:function(n,e){return kw}};rm.exports=new Proxy({__esModule:!0,default:{}},Sw)});var Ru=du((t2,im)=>{var Ew=function(){return null},Cw={get:function(n,e){return Ew}};im.exports=new Proxy({__esModule:!0,default:{}},Cw)});var IT={};ag(IT,{ANIMATION_KEYFRAMES:()=>ts,ActivationConfigZ:()=>fo,AddClassZ:()=>up,AnchorIdZ:()=>ut,AnchorStateZ:()=>ux,AnchorVisibleConditionZ:()=>wl,AppRegistry:()=>ai,AugmentationZ:()=>dx,BadgePositionZ:()=>Qd,BadgeZ:()=>mp,BoundingBoxZ:()=>cx,CanvasEvents:()=>_i,CanvasRecipeZ:()=>au,ConditionZ:()=>dn,ContextManager:()=>Eo,CooldownActiveConditionZ:()=>Rl,CounterDefZ:()=>Li,CtaButtonZ:()=>Ml,DEFAULT_COOLDOWN:()=>Ja,DecisionController:()=>iu,DecisionStrategyZ:()=>Wi,DismissedConditionZ:()=>Al,EVENT_SCHEMA_VERSION:()=>Ie,EventBus:()=>vo,EventCountConditionZ:()=>Il,EventFilterZ:()=>fx,EventHistory:()=>zi,EventOccurredConditionZ:()=>kl,EventSourceZ:()=>Qf,ExecutorRegistry:()=>ao,ExternalStrategyZ:()=>Vi,FrequencyEntryZ:()=>yx,FrequencyLimitConditionZ:()=>Tl,HighlightStepZ:()=>mx,HighlightStyleZ:()=>Jd,HighlightZ:()=>fp,InsertHtmlZ:()=>hp,InsertPositionZ:()=>rp,InterventionTracker:()=>ns,MAX_VISIBLE_TOASTS:()=>Xa,MatchOpZ:()=>Ni,ModalContentZ:()=>np,ModalZ:()=>yp,ModelStrategyZ:()=>Bi,MountWidgetZ:()=>xp,NavigateZ:()=>_p,NavigationMonitor:()=>Qi,NormalizedEventZ:()=>hx,NotificationsController:()=>bi,PageContextZ:()=>sx,PageHistoryEntryZ:()=>ox,PageUrlConditionZ:()=>_l,ParallelZ:()=>Sp,PlacementZ:()=>ep,PulseZ:()=>gp,RUNTIME_SDK_BUILD:()=>tg,RUNTIME_VERSION:()=>lh,RemoveClassZ:()=>dp,RouteConditionZ:()=>xl,RouteFilterZ:()=>Yd,RuleStrategyZ:()=>Di,RuleZ:()=>Fi,RuntimeContextZ:()=>px,RuntimeController:()=>su,RuntimeEventsController:()=>ou,SDK_SCHEMA_VERSION:()=>nn,SDK_VERSION:()=>nl,STATIC_SLOT_STYLES:()=>oh,ScoreStrategyZ:()=>Hi,ScrollBehaviorZ:()=>ap,ScrollLogicalPositionZ:()=>$l,ScrollToZ:()=>bp,SelectorZ:()=>eg,SequenceZ:()=>kp,SessionContextZ:()=>ax,SessionMetricConditionZ:()=>Cl,SessionMetricTracker:()=>So,SetAttrZ:()=>cp,SetStyleZ:()=>pp,SetTextZ:()=>lp,SmartCanvasController:()=>il,SmartCanvasElementLit:()=>vr,StandardEvents:()=>De,StateEqualsConditionZ:()=>Sl,StateStore:()=>Io,StoredValueZ:()=>vx,Syntro:()=>Jf,ThemeController:()=>xi,TooltipContentZ:()=>tp,TooltipStepZ:()=>gx,TooltipTriggerZ:()=>ip,TooltipZ:()=>vp,TourStepForSchemaZ:()=>op,TourZ:()=>Ep,TriggerWhenZ:()=>ho,ViewportConditionZ:()=>El,ViewportContextZ:()=>lx,WaitZ:()=>wp,WidgetConfigZ:()=>sp,WidgetRegistry:()=>Mo,applyStaticSlotStyles:()=>fc,coreActionStepSchemas:()=>Ly,createActionEngine:()=>fl,createAnchorResolver:()=>Pl,createCanvasConfigFetcher:()=>hr,createContextManager:()=>uc,createDecisionEngine:()=>dc,createEventAccumulator:()=>pc,createEventBus:()=>Ui,createGrowthBookClient:()=>sc,createNoopClient:()=>Sc,createOverlayRecipeFetcher:()=>AT,createPostHogClient:()=>ru,createPostHogNormalizer:()=>md,createSessionMetricTracker:()=>oc,createSmartCanvas:()=>Fl,createSmartCanvasController:()=>xd,createSmartCanvasRuntime:()=>kc,createStateStore:()=>hc,createSurfaceContainer:()=>bc,createSurfaces:()=>xc,decisionSchemas:()=>aC,decodeToken:()=>ji,encodeToken:()=>Dl,evaluate:()=>th,evaluateCondition:()=>Qp,evaluateRule:()=>eh,evaluateRuleStrategy:()=>Co,evaluateScoreStrategy:()=>Ao,evaluateSync:()=>nh,executorRegistry:()=>jt,getAntiFlickerSnippet:()=>Hy,getExecutor:()=>_y,getSlotAnchorId:()=>$o,getSlotType:()=>es,getSlotZIndex:()=>_c,hasExecutor:()=>dl,needsMigration:()=>wT,normalizePostHogEvent:()=>vi,parseVersion:()=>vs,playEnterAnimation:()=>vc,playExitAnimation:()=>yc,registerConfigPredicates:()=>mr,registerSmartCanvasElement:()=>io,resolveConfigUri:()=>rl,runtimeContext:()=>cy,setupAdjacentPositioning:()=>gc,setupInlinePositioning:()=>mc,shouldNormalizeEvent:()=>yi,validateAction:()=>Ft,validateActions:()=>lo,validateActivationConfig:()=>oC,validateCondition:()=>iC,validateConfig:()=>bT,validateEventFilter:()=>ET,validateEventName:()=>Hl,validateFrequencyEntry:()=>TT,validateNormalizedEvent:()=>ST,validateProps:()=>Bl,validateRecipe:()=>CT,validateRuntimeContext:()=>kT,validateStoredValue:()=>RT,validateStrategy:()=>sC,widgetRegistry:()=>wc});function cg(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 Ax=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 fu(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(!Ax.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 ug=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=fu(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=cg(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=fu(d.html))}}};function dg(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 dg(t)}return n}var pg=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=dg(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)}}},hg=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)}}},fg=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))}}},gg=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)}}},mg=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)}}},gu=[{kind:"content:insertHtml",executor:ug},{kind:"content:setText",executor:pg},{kind:"content:setAttr",executor:hg},{kind:"content:addClass",executor:fg},{kind:"content:removeClass",executor:gg},{kind:"content:setStyle",executor:mg}],mu={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:gu};var Rx={light:50,medium:100,heavy:200},Tx=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],vg={init(n,e,t){let r=Rx[t.intensity],i=t.colors.length>0?t.colors:Tx,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 Ix={light:20,medium:40,heavy:80},$x="\u{1F389}",yg={init(n,e,t){let r=Ix[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:$x,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 Mx={light:20,medium:40,heavy:80},Px={light:3,medium:4,heavy:5},bg={init(n,e,t){let r=Mx[t.intensity],i=Px[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 Ox={light:30,medium:60,heavy:120},_g={init(n,e,t){let r=Ox[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 la=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 Nx=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function Lx(n,e){return[n,e,`${n}cc`,`${e}cc`,"#ffffff",`${n}80`]}function Fx(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 Lx(t,r||t)}catch{}return null}var xg=new Map([["confetti",vg],["fireworks",bg],["sparkles",_g],["emoji-rain",yg]]),wg=async(n,e)=>{let t=xg.get(n.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${n.effect}". Available: ${[...xg.keys()].join(", ")}`),{cleanup:()=>{}};let r=n.colors??Fx(e.overlayRoot)??Nx,i={duration:n.duration??3e3,intensity:n.intensity??"medium",colors:r,props:n.props},s=new la;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:n.effect}),{cleanup:()=>{s.stop()}}};var yu="syntro_active_tour",ca=new Map;function Dx(n){try{let e=localStorage.getItem(yu);if(!e)return null;let t=JSON.parse(e);return t.tourId!==n?null:t}catch{return null}}function vu(n){try{localStorage.setItem(yu,JSON.stringify(n))}catch{}}function Hx(){try{localStorage.removeItem(yu)}catch{}}function _s(){return window.location.pathname}function Bx(n){if(!n.route)return!0;let e=_s();return n.route.includes("*")?new RegExp(`^${n.route.replace(/\*/g,".*")}$`).test(e):e===n.route}var bu=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(ca.has(t))return{cleanup:async()=>{let _=ca.get(t);_&&await _.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=Dx(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||r[0].id,startedAt:Date.now()},vu(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,vu(o)}let c=r[l];if(!Bx(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:_s()}),{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"){Hx(),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=_,vu(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:_}),b.route&&b.route!==_s()){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 _=_s(),b=()=>{let w=_s();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,ca.delete(t),await v(),g&&g(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return ca.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"},Ve={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"},xs={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"},ws={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]},KT={primary:S[2],secondary:S[0]},_u={primary:S[4],secondary:S[3]},ua={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]}},YT={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:Ve[8],pillOutline:Ve[4],borderPrimary:Ve[2],borderSecondary:Ve[2],background:Ve[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:xs[8],pillOutline:xs[4],borderPrimary:xs[2],borderSecondary:xs[2],background:xs[0]},pink:{content:ws[8],pillOutline:ws[4],borderPrimary:ws[2],borderSecondary:ws[2],background:ws[0]}},XT={green:{content:be[8],border:be[2],background:be[0]},yellow:{content:Ve[8],border:Ve[2],background:Ve[0]},red:{content:Te[8],border:Te[2],background:Te[0]}},JT={green:{content:be[1],background:be[9]},yellow:{content:Ve[1],background:Ve[9]},red:{content:Te[1],background:Te[9]}},QT={content:S[10],border:S[4],background:S[3]},eI={backgroundDefault:S[2],backgroundHover:S[1],selected:S[3]},tI={background:S[2],icon:S[10],borderDefault:S[4],borderSelected:ie[3],textLabel:S[9],textPlaceholder:S[8],textHint:S[8]},nI={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]},rI={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]}},iI={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]}},sI={content:S[10],background:S[4]},oI={background:S[4],active:be[3]},aI={background:S[1],content:S[9],border:S[4]},lI={backgroundDefault:S[1],backgroundHover:S[3],backgroundActive:S[4],border:S[4],contentPrimary:S[10],contentSecondary:S[9],contentTertiary:S[8]},cI={background:S[1],content:S[9],border:S[4]},uI={activeBackground:S[3],activeContent:ie[5],inactiveContent:S[9],border:S[4]},dI={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]}},pI={textPrimaryDefault:S[10],textPrimaryHover:S[10],textSecondaryDefault:S[8],textSecondaryHover:S[9],iconPrimary:S[10],iconSecondary:S[8]},hI={background:be[1],active:be[5]},fI={textDefault:S[10],textSelected:At.white,textDisabled:S[7],backgroundDefault:S[2],backgroundMiddle:S[3],backgroundSelected:ie[3],border:S[4]},gI=S[9];var bI={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 kg=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function Sg(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(!kg)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`}),kg){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 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 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(!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)"},xu=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 SyntrologieSDK=(()=>{var gx=Object.create;var ys=Object.defineProperty;var m
|
|
|
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 SyntrologieSDK=(()=>{var gx=Object.create;var ys=Object.defineProperty;var m
|
|
|
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 SyntrologieSDK=(()=>{var gx=Object.create;var ys=Object.defineProperty;var m
|
|
|
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 wg=["top","right","bottom","left"];var wn=Math.min,Kt=Math.max,ks=Math.round,Ss=Math.floor,At=n=>({x:n,y:n}),Fx={left:"right",right:"left",bottom:"top",top:"bottom"},Dx={start:"end",end:"start"};function da(n,e,t){return Kt(n,wn(e,t))}function Yn(n,e){return typeof n=="function"?n(e):n}function kn(n){return n.split("-")[0]}function qr(n){return n.split("-")[1]}function yu(n){return n==="x"?"y":"x"}function pa(n){return n==="y"?"height":"width"}var Hx=new Set(["top","bottom"]);function Yt(n){return Hx.has(kn(n))?"y":"x"}function ha(n){return yu(Yt(n))}function kg(n,e,t){t===void 0&&(t=!1);let r=qr(n),i=ha(n),s=pa(i),o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=ws(o)),[o,ws(o)]}function Sg(n){let e=ws(n);return[ua(n),e,ua(e)]}function ua(n){return n.replace(/start|end/g,e=>Dx[e])}var _g=["left","right"],xg=["right","left"],Bx=["top","bottom"],Vx=["bottom","top"];function Wx(n,e,t){switch(n){case"top":case"bottom":return t?e?xg:_g:e?_g:xg;case"left":case"right":return e?Bx:Vx;default:return[]}}function Eg(n,e,t,r){let i=qr(n),s=Wx(kn(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(ua)))),s}function ws(n){return n.replace(/left|right|bottom|top/g,e=>Fx[e])}function jx(n){return{top:0,right:0,bottom:0,left:0,...n}}function bu(n){return typeof n!="number"?jx(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 Cg(n,e,t){let{reference:r,floating:i}=n,s=Yt(e),o=ha(e),a=pa(o),l=kn(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(qr(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 Tg(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=bu(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 Ig=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}=Cg(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:Tg},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}=Cg(c,h,l)),m=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:g}},$g=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=bu(u),h={x:t,y:r},g=ha(i),v=pa(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=wn(d[y],I),P=wn(d[k],I),G=O,L=x-f[v]-P,F=x/2-f[v]/2+R,Z=da(G,F,L),A=!l.arrow&&qr(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 Mg=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=kn(i),k=Yt(a),_=kn(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(_||!f?[ws(a)]:Sg(a)),E=v!=="none";!h&&E&&w.push(...Eg(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=kg(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!==Yt(Z):!1)||O.every(M=>Yt(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=Yt(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 Ag(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function Rg(n){return wg.some(e=>n[e]>=0)}var Pg=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=Ag(o,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Rg(a)}}}case"escaped":{let o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=Ag(o,t.floating);return{data:{escapedOffsets:a,escaped:Rg(a)}}}default:return{}}}}};var Ux=new Set(["left","top"]);async function zx(n,e){let{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=kn(t),a=qr(t),l=Yt(t)==="y",c=Ux.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 Og=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 zx(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}}}}},Ng=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=Yt(kn(i)),g=yu(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=da(_,v,b)}if(a){let y=h==="y"?"top":"left",k=h==="y"?"bottom":"right",_=f+d[y],b=f-d[k];f=da(_,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 fa(){return typeof window<"u"}function Qn(n){return Fg(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=(Fg(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Fg(n){return fa()?n instanceof Node||n instanceof nt(n).Node:!1}function gt(n){return fa()?n instanceof Element||n instanceof nt(n).Element:!1}function Tt(n){return fa()?n instanceof HTMLElement||n instanceof nt(n).HTMLElement:!1}function Lg(n){return!fa()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof nt(n).ShadowRoot}var qx=new Set(["inline","contents"]);function Gr(n){let{overflow:e,overflowX:t,overflowY:r,display:i}=mt(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!qx.has(i)}var Zx=new Set(["table","td","th"]);function Dg(n){return Zx.has(Qn(n))}var Gx=[":popover-open",":modal"];function Es(n){return Gx.some(e=>{try{return n.matches(e)}catch{return!1}})}var Kx=["transform","translate","scale","rotate","perspective"],Yx=["transform","translate","scale","rotate","perspective","filter"],Xx=["paint","layout","strict","content"];function ga(n){let e=ma(),t=gt(n)?mt(n):n;return Kx.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)||Yx.some(r=>(t.willChange||"").includes(r))||Xx.some(r=>(t.contain||"").includes(r))}function Hg(n){let e=Xt(n);for(;Tt(e)&&!Jn(e);){if(ga(e))return e;if(Es(e))return null;e=Xt(e)}return null}function ma(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var Qx=new Set(["html","body","#document"]);function Jn(n){return Qx.has(Qn(n))}function mt(n){return nt(n).getComputedStyle(n)}function Cs(n){return gt(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Xt(n){if(Qn(n)==="html")return n;let e=n.assignedSlot||n.parentNode||Lg(n)&&n.host||Rt(n);return Lg(e)?e.host:e}function Bg(n){let e=Xt(n);return Jn(e)?n.ownerDocument?n.ownerDocument.body:n.body:Tt(e)&&Gr(e)?e:Bg(e)}function Zr(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);let i=Bg(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=nt(i);if(s){let a=va(o);return e.concat(o,o.visualViewport||[],Gr(i)?i:[],a&&t?Zr(a):[])}return e.concat(i,Zr(i,[],t))}function va(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Ug(n){let e=mt(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=ks(t)!==s||ks(r)!==o;return a&&(t=s,r=o),{width:t,height:r,$:a}}function xu(n){return gt(n)?n:n.contextElement}function Kr(n){let e=xu(n);if(!Tt(e))return At(1);let t=e.getBoundingClientRect(),{width:r,height:i,$:s}=Ug(e),o=(s?ks(t.width):t.width)/r,a=(s?ks(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var Jx=At(0);function zg(n){let e=nt(n);return!ma()||!e.visualViewport?Jx:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ew(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=xu(n),o=At(1);e&&(r?gt(r)&&(o=Kr(r)):o=Kr(n));let a=ew(s,t,r)?zg(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&>(r)?nt(r):r,v=h,f=va(v);for(;f&&r&&g!==v;){let m=Kr(f),y=f.getBoundingClientRect(),k=mt(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=va(v)}}return Xn({width:u,height:d,x:l,y:c})}function ya(n,e){let t=Cs(n).scrollLeft;return e?e.left+t:er(Rt(n)).left+t}function qg(n,e){let t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-ya(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function tw(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n,s=i==="fixed",o=Rt(r),a=e?Es(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"||Gr(o))&&(l=Cs(r)),Tt(r))){let g=er(r);c=Kr(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}let h=o&&!d&&!s?qg(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 nw(n){return Array.from(n.getClientRects())}function rw(n){let e=Rt(n),t=Cs(n),r=n.ownerDocument.body,i=Kt(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Kt(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),o=-t.scrollLeft+ya(n),a=-t.scrollTop;return mt(r).direction==="rtl"&&(o+=Kt(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}var Vg=25;function iw(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=ma();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=ya(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<=Vg&&(s-=v)}else c<=Vg&&(s+=c);return{width:s,height:o,x:a,y:l}}var sw=new Set(["absolute","fixed"]);function ow(n,e){let t=er(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=Tt(n)?Kr(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 Wg(n,e,t){let r;if(e==="viewport")r=iw(n,t);else if(e==="document")r=rw(Rt(n));else if(gt(e))r=ow(e,t);else{let i=zg(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Xn(r)}function Zg(n,e){let t=Xt(n);return t===e||!gt(t)||Jn(t)?!1:mt(t).position==="fixed"||Zg(t,e)}function aw(n,e){let t=e.get(n);if(t)return t;let r=Zr(n,[],!1).filter(a=>gt(a)&&Qn(a)!=="body"),i=null,s=mt(n).position==="fixed",o=s?Xt(n):n;for(;gt(o)&&!Jn(o);){let a=mt(o),l=ga(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&sw.has(i.position)||Gr(o)&&!l&&Zg(n,o))?r=r.filter(u=>u!==o):i=a,o=Xt(o)}return e.set(n,r),r}function lw(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n,o=[...t==="clippingAncestors"?Es(e)?[]:aw(e,this._c):[].concat(t),r],a=o[0],l=o.reduce((c,u)=>{let d=Wg(e,u,i);return c.top=Kt(d.top,c.top),c.right=wn(d.right,c.right),c.bottom=wn(d.bottom,c.bottom),c.left=Kt(d.left,c.left),c},Wg(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function cw(n){let{width:e,height:t}=Ug(n);return{width:e,height:t}}function uw(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=ya(i)}if(r||!r&&!s)if((Qn(e)!=="body"||Gr(i))&&(a=Cs(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?qg(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 _u(n){return mt(n).position==="static"}function jg(n,e){if(!Tt(n)||mt(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Rt(n)===t&&(t=t.ownerDocument.body),t}function Gg(n,e){let t=nt(n);if(Es(n))return t;if(!Tt(n)){let i=Xt(n);for(;i&&!Jn(i);){if(gt(i)&&!_u(i))return i;i=Xt(i)}return t}let r=jg(n,e);for(;r&&Dg(r)&&_u(r);)r=jg(r,e);return r&&Jn(r)&&_u(r)&&!ga(r)?t:r||Hg(n)||t}var dw=async function(n){let e=this.getOffsetParent||Gg,t=this.getDimensions,r=await t(n.floating);return{reference:uw(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function pw(n){return mt(n).direction==="rtl"}var hw={convertOffsetParentRelativeRectToViewportRelativeRect:tw,getDocumentElement:Rt,getClippingRect:lw,getOffsetParent:Gg,getElementRects:dw,getClientRects:nw,getDimensions:cw,getScale:Kr,isElement:gt,isRTL:pw};function Kg(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function fw(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=Ss(d),f=Ss(i.clientWidth-(u+h)),m=Ss(i.clientHeight-(d+g)),y=Ss(u),_={rootMargin:-v+"px "+-f+"px "+-m+"px "+-y+"px",threshold:Kt(0,wn(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&&!Kg(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 Yr(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=xu(n),u=i||s?[...c?Zr(c):[],...Zr(e)]:[];u.forEach(y=>{i&&y.addEventListener("scroll",t,{passive:!0}),s&&y.addEventListener("resize",t)});let d=c&&a?fw(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&&!Kg(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 Xr=Og;var Qr=Ng,Jr=Mg;var ba=Pg,_a=$g;var ei=(n,e,t)=>{let r=new Map,i={platform:hw,...t},s={...i.platform,_c:r};return Ig(n,e,{...i,platform:s})};function gw(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 Yg(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=[Xr(t.offsetPx??8),Jr(),Qr({padding:8}),ba(),_a({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=Yr(n,r,async()=>{if(!n.isConnected){v.destroy();return}let f=gw(n),m=await ei(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 ww=zr(wu(),1),ti=zr(ku(),1),kw=zr(Su(),1);var em=zr(wu(),1);var xa=globalThis,wa=xa.ShadowRoot&&(xa.ShadyCSS===void 0||xa.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Eu=Symbol(),tm=new WeakMap,As=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Eu)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(wa&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=tm.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&tm.set(t,e))}return e}toString(){return this.cssText}},nm=n=>new As(typeof n=="string"?n:n+"",void 0,Eu),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 As(t,n,Eu)},rm=(n,e)=>{if(wa)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=xa.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},Cu=wa?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return nm(t)})(n):n;var{is:Sw,defineProperty:Ew,getOwnPropertyDescriptor:Cw,getOwnPropertyNames:Aw,getOwnPropertySymbols:Rw,getPrototypeOf:Tw}=Object,Sn=globalThis,im=Sn.trustedTypes,Iw=im?im.emptyScript:"",$w=Sn.reactiveElementPolyfillSupport,Rs=(n,e)=>n,Au={toAttribute(n,e){switch(e){case Boolean:n=n?Iw: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}},om=(n,e)=>!Sw(n,e),sm={attribute:!0,type:String,converter:Au,reflect:!1,useDefault:!1,hasChanged:om};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Sn.litPropertyMetadata??(Sn.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=sm){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&&Ew(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:s}=Cw(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)??sm}static _$Ei(){if(this.hasOwnProperty(Rs("elementProperties")))return;let e=Tw(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Rs("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Rs("properties"))){let t=this.properties,r=[...Aw(t),...Rw(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(Cu(i))}else e!==void 0&&t.push(Cu(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 rm(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:Au).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:Au;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??om)(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[Rs("elementProperties")]=new Map,Qt[Rs("finalized")]=new Map,$w?.({ReactiveElement:Qt}),(Sn.reactiveElementVersions??(Sn.reactiveElementVersions=[])).push("2.1.2");var Is=globalThis,am=n=>n,ka=Is.trustedTypes,lm=ka?ka.createPolicy("lit-html",{createHTML:n=>n}):void 0,fm="$lit$",En=`lit$${Math.random().toFixed(9).slice(2)}$`,gm="?"+En,Mw=`<${gm}>`,ir=document,$s=()=>ir.createComment(""),Ms=n=>n===null||typeof n!="object"&&typeof n!="function",Ou=Array.isArray,Pw=n=>Ou(n)||typeof n?.[Symbol.iterator]=="function",Ru=`[
|
|
55
|
-
\f\r]`,
|
|
56
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),dm=/'/g,pm=/"/g,mm=/^(?:script|style|textarea|title)$/i,Nu=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),D=Nu(1),nI=Nu(2),rI=Nu(3),It=Symbol.for("lit-noChange"),Q=Symbol.for("lit-nothing"),hm=new WeakMap,rr=ir.createTreeWalker(ir,129);function vm(n,e){if(!Ou(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return lm!==void 0?lm.createHTML(e):e}var Ow=(n,e)=>{let t=n.length-1,r=[],i,s=e===2?"<svg>":e===3?"<math>":"",o=Ts;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===Ts?u[1]==="!--"?o=cm:u[1]!==void 0?o=um:u[2]!==void 0?(mm.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=nr):u[3]!==void 0&&(o=nr):o===nr?u[0]===">"?(o=i??Ts,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]==='"'?pm:dm):o===pm||o===dm?o=nr:o===cm||o===um?o=Ts:(o=nr,i=void 0);let g=o===nr&&n[a+1].startsWith("/>")?" ":"";s+=o===Ts?l+Mw:d>=0?(r.push(c),l.slice(0,d)+fm+l.slice(d)+En+g):l+En+(d===-2?a:g)}return[vm(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},Ps=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]=Ow(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(fm)){let h=u[o++],g=i.getAttribute(d).split(En),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:v[2],strings:g,ctor:v[1]==="."?Iu:v[1]==="?"?$u:v[1]==="@"?Mu:ri}),i.removeAttribute(d)}else d.startsWith(En)&&(l.push({type:6,index:s}),i.removeAttribute(d));if(mm.test(i.tagName)){let d=i.textContent.split(En),h=d.length-1;if(h>0){i.textContent=ka?ka.emptyScript:"";for(let g=0;g<h;g++)i.append(d[g],$s()),rr.nextNode(),l.push({type:2,index:++s});i.append(d[h],$s())}}}else if(i.nodeType===8)if(i.data===gm)l.push({type:2,index:s});else{let d=-1;for(;(d=i.data.indexOf(En,d+1))!==-1;)l.push({type:7,index:s}),d+=En.length-1}s++}}static createElement(e,t){let r=ir.createElement("template");return r.innerHTML=e,r}};function ni(n,e,t=n,r){if(e===It)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,s=Ms(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=ni(n,i._$AS(n,e.values),i,r)),e}var Tu=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 Os(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new Pu(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++}},Os=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=ni(this,e,t),Ms(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):Pw(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&&Ms(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=Ps.createElement(vm(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let s=new Tu(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=hm.get(e.strings);return t===void 0&&hm.set(e.strings,t=new Ps(e)),t}k(e){Ou(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($s()),this.O($s()),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=am(e).nextSibling;am(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ri=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=ni(this,e,t,0),o=!Ms(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=ni(this,a[r+l],t,l),c===It&&(c=this._$AH[l]),o||(o=!Ms(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??"")}},Iu=class extends ri{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Q?void 0:e}},$u=class extends ri{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Q)}},Mu=class extends ri{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=ni(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)}},Pu=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){ni(this,e)}};var Nw=Is.litHtmlPolyfillSupport;Nw?.(Ps,Os),(Is.litHtmlVersions??(Is.litHtmlVersions=[])).push("3.3.2");var ym=(n,e,t)=>{let r=t?.renderBefore??e,i=r._$litPart$;if(i===void 0){let s=t?.renderBefore??null;r._$litPart$=i=new Os(e.insertBefore($s(),s),s,void 0,t??{})}return i._$AI(n),i};var Ns=globalThis,he=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=ym(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,Ns.litElementHydrateSupport?.({LitElement:he});var Lw=Ns.litElementPolyfillSupport;Lw?.({LitElement:he});(Ns.litElementVersions??(Ns.litElementVersions=[])).push("4.2.2");var Sa={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ea=n=>(...e)=>({_$litDirective$:n,values:e}),ii=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 bm="important",Fw=" !"+bm,T=Ea(class extends ii{constructor(n){if(super(n),n.type!==Sa.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(Fw);r.includes("-")||s?t.setProperty(r,s?i.slice(0,-11):i,s?bm:""):t[r]=i}}return It}});var Cn=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)},Ls,Fs,si,Jt,Ds,Ca,oi,_m="#1969fe",Dw="#24ad32",Hw="#0e1114",Lu="#677384",Bw="#a8afba",xm="#f6f7f9",Vw="#ffffff";function wm(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, ${Vw})`,color:`var(--se-color-text-primary, ${Hw})`,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 Ww(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 km="syntro-workflow-tracker",Aa=class extends he{constructor(){super(...arguments),this.runtimeRef=null,this._workflowEntries=[],this._actionVersion=0,Ls.set(this,null),Fs.set(this,null),si.set(this,[]),Jt.set(this,new Set),Ds.set(this,{}),Ca.set(this,!1),oi.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=Ww(e);if(Cn(this,oi,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,Jt,"f").has(o)&&a.notification&&!l.includes(o)&&!c[o]){Ne(this,Jt,"f").add(o),r?.set("notified",[...Ne(this,Jt,"f")]);let u=wm(a.notification);Ne(this,si,"f").push(u)}}}connectedCallback(){super.connectedCallback(),this._initSubscriptions()}disconnectedCallback(){super.disconnectedCallback(),this._teardownSubscriptions();for(let e of Ne(this,si,"f"))e();Cn(this,si,[],"f")}updated(e){e.has("runtimeRef")&&(this._teardownSubscriptions(),this._initSubscriptions()),e.has("_actionVersion")&&this._rescanWorkflows()}_initSubscriptions(){if(this.runtimeRef?.events?.subscribe){if(!Ne(this,Ca,"f")&&this._stateNs){let e=this._stateNs.get("notified")??[];for(let r of e)Ne(this,Jt,"f").add(r);let t=this._stateNs.get("completed")??{};Cn(this,Ds,{...t},"f"),Cn(this,Ca,!0,"f")}Cn(this,Ls,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1}),"f"),Cn(this,Fs,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},e=>{this._handleTourEvent(e)}),"f"),this._rescanWorkflows()}}_teardownSubscriptions(){Ne(this,Ls,"f")?.call(this),Cn(this,Ls,null,"f"),Ne(this,Fs,"f")?.call(this),Cn(this,Fs,null,"f")}_handleTourEvent(e){let t=e.props?.tourId;if(!t)return;if(!Ne(this,oi,"f").has(t)&&e.name==="tour.started"){this._actionVersion+=1;return}if(!Ne(this,oi,"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,Jt,"f").has(t)){Ne(this,Jt,"f").add(t),r?.set("notified",[...Ne(this,Jt,"f")]);let a=Ne(this,oi,"f").get(t);if(a?.meta.notification){let l=wm(a.meta.notification);Ne(this,si,"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,Ds,"f")[t]=s,r?.set("completed",{...Ne(this,Ds,"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, ${_m})`,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 Ag=["top","right","bottom","left"];var wn=Math.min,Xt=Math.max,Ss=Math.round,Es=Math.floor,Rt=n=>({x:n,y:n}),Wx={left:"right",right:"left",bottom:"top",top:"bottom"},jx={start:"end",end:"start"};function pa(n,e,t){return Xt(n,wn(e,t))}function Yn(n,e){return typeof n=="function"?n(e):n}function kn(n){return n.split("-")[0]}function qr(n){return n.split("-")[1]}function wu(n){return n==="x"?"y":"x"}function ha(n){return n==="y"?"height":"width"}var Ux=new Set(["top","bottom"]);function Jt(n){return Ux.has(kn(n))?"y":"x"}function fa(n){return wu(Jt(n))}function Rg(n,e,t){t===void 0&&(t=!1);let r=qr(n),i=fa(n),s=ha(i),o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=ks(o)),[o,ks(o)]}function Tg(n){let e=ks(n);return[da(n),e,da(e)]}function da(n){return n.replace(/start|end/g,e=>jx[e])}var Eg=["left","right"],Cg=["right","left"],zx=["top","bottom"],qx=["bottom","top"];function Zx(n,e,t){switch(n){case"top":case"bottom":return t?e?Cg:Eg:e?Eg:Cg;case"left":case"right":return e?zx:qx;default:return[]}}function Ig(n,e,t,r){let i=qr(n),s=Zx(kn(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(da)))),s}function ks(n){return n.replace(/left|right|bottom|top/g,e=>Wx[e])}function Gx(n){return{top:0,right:0,bottom:0,left:0,...n}}function ku(n){return typeof n!="number"?Gx(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 $g(n,e,t){let{reference:r,floating:i}=n,s=Jt(e),o=fa(e),a=ha(o),l=kn(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(qr(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 Og(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=ku(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 Ng=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}=$g(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:Og},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}=$g(c,h,l)),m=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:g}},Lg=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=ku(u),h={x:t,y:r},g=fa(i),v=ha(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=wn(d[y],$),M=wn(d[k],$),G=P,L=w-f[v]-M,N=w/2-f[v]/2+E,z=pa(G,N,L),H=!l.arrow&&qr(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 Fg=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=kn(i),k=Jt(a),_=kn(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),x=h||(_||!f?[ks(a)]:Tg(a)),R=v!=="none";!h&&R&&x.push(...Ig(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=Rg(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!==Jt(z):!1)||P.every(A=>Jt(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=Jt(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 Mg(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function Pg(n){return Ag.some(e=>n[e]>=0)}var Dg=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=Mg(o,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Pg(a)}}}case"escaped":{let o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=Mg(o,t.floating);return{data:{escapedOffsets:a,escaped:Pg(a)}}}default:return{}}}}};var Kx=new Set(["left","top"]);async function Yx(n,e){let{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=kn(t),a=qr(t),l=Jt(t)==="y",c=Kx.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 Hg=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 Yx(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}}}}},Bg=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=Jt(kn(i)),g=wu(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=pa(_,v,b)}if(a){let y=h==="y"?"top":"left",k=h==="y"?"bottom":"right",_=f+d[y],b=f-d[k];f=pa(_,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 ga(){return typeof window<"u"}function Jn(n){return Wg(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=(Wg(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Wg(n){return ga()?n instanceof Node||n instanceof rt(n).Node:!1}function ft(n){return ga()?n instanceof Element||n instanceof rt(n).Element:!1}function It(n){return ga()?n instanceof HTMLElement||n instanceof rt(n).HTMLElement:!1}function Vg(n){return!ga()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof rt(n).ShadowRoot}var Xx=new Set(["inline","contents"]);function Gr(n){let{overflow:e,overflowX:t,overflowY:r,display:i}=gt(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!Xx.has(i)}var Jx=new Set(["table","td","th"]);function jg(n){return Jx.has(Jn(n))}var Qx=[":popover-open",":modal"];function Cs(n){return Qx.some(e=>{try{return n.matches(e)}catch{return!1}})}var ew=["transform","translate","scale","rotate","perspective"],tw=["transform","translate","scale","rotate","perspective","filter"],nw=["paint","layout","strict","content"];function ma(n){let e=va(),t=ft(n)?gt(n):n;return ew.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)||tw.some(r=>(t.willChange||"").includes(r))||nw.some(r=>(t.contain||"").includes(r))}function Ug(n){let e=Qt(n);for(;It(e)&&!Qn(e);){if(ma(e))return e;if(Cs(e))return null;e=Qt(e)}return null}function va(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var rw=new Set(["html","body","#document"]);function Qn(n){return rw.has(Jn(n))}function gt(n){return rt(n).getComputedStyle(n)}function As(n){return ft(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Qt(n){if(Jn(n)==="html")return n;let e=n.assignedSlot||n.parentNode||Vg(n)&&n.host||Tt(n);return Vg(e)?e.host:e}function zg(n){let e=Qt(n);return Qn(e)?n.ownerDocument?n.ownerDocument.body:n.body:It(e)&&Gr(e)?e:zg(e)}function Zr(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);let i=zg(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=rt(i);if(s){let a=ya(o);return e.concat(o,o.visualViewport||[],Gr(i)?i:[],a&&t?Zr(a):[])}return e.concat(i,Zr(i,[],t))}function ya(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Kg(n){let e=gt(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=Ss(t)!==s||Ss(r)!==o;return a&&(t=s,r=o),{width:t,height:r,$:a}}function Eu(n){return ft(n)?n:n.contextElement}function Kr(n){let e=Eu(n);if(!It(e))return Rt(1);let t=e.getBoundingClientRect(),{width:r,height:i,$:s}=Kg(e),o=(s?Ss(t.width):t.width)/r,a=(s?Ss(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var iw=Rt(0);function Yg(n){let e=rt(n);return!va()||!e.visualViewport?iw:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function sw(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=Eu(n),o=Rt(1);e&&(r?ft(r)&&(o=Kr(r)):o=Kr(n));let a=sw(s,t,r)?Yg(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&&ft(r)?rt(r):r,v=h,f=ya(v);for(;f&&r&&g!==v;){let m=Kr(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=rt(f),f=ya(v)}}return Xn({width:u,height:d,x:l,y:c})}function ba(n,e){let t=As(n).scrollLeft;return e?e.left+t:er(Tt(n)).left+t}function Xg(n,e){let t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-ba(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function ow(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n,s=i==="fixed",o=Tt(r),a=e?Cs(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"||Gr(o))&&(l=As(r)),It(r))){let g=er(r);c=Kr(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}let h=o&&!d&&!s?Xg(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 aw(n){return Array.from(n.getClientRects())}function lw(n){let e=Tt(n),t=As(n),r=n.ownerDocument.body,i=Xt(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Xt(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),o=-t.scrollLeft+ba(n),a=-t.scrollTop;return gt(r).direction==="rtl"&&(o+=Xt(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}var qg=25;function cw(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=va();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=ba(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<=qg&&(s-=v)}else c<=qg&&(s+=c);return{width:s,height:o,x:a,y:l}}var uw=new Set(["absolute","fixed"]);function dw(n,e){let t=er(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=It(n)?Kr(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 Zg(n,e,t){let r;if(e==="viewport")r=cw(n,t);else if(e==="document")r=lw(Tt(n));else if(ft(e))r=dw(e,t);else{let i=Yg(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Xn(r)}function Jg(n,e){let t=Qt(n);return t===e||!ft(t)||Qn(t)?!1:gt(t).position==="fixed"||Jg(t,e)}function pw(n,e){let t=e.get(n);if(t)return t;let r=Zr(n,[],!1).filter(a=>ft(a)&&Jn(a)!=="body"),i=null,s=gt(n).position==="fixed",o=s?Qt(n):n;for(;ft(o)&&!Qn(o);){let a=gt(o),l=ma(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&uw.has(i.position)||Gr(o)&&!l&&Jg(n,o))?r=r.filter(u=>u!==o):i=a,o=Qt(o)}return e.set(n,r),r}function hw(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n,o=[...t==="clippingAncestors"?Cs(e)?[]:pw(e,this._c):[].concat(t),r],a=o[0],l=o.reduce((c,u)=>{let d=Zg(e,u,i);return c.top=Xt(d.top,c.top),c.right=wn(d.right,c.right),c.bottom=wn(d.bottom,c.bottom),c.left=Xt(d.left,c.left),c},Zg(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function fw(n){let{width:e,height:t}=Kg(n);return{width:e,height:t}}function gw(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=ba(i)}if(r||!r&&!s)if((Jn(e)!=="body"||Gr(i))&&(a=As(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?Xg(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 Su(n){return gt(n).position==="static"}function Gg(n,e){if(!It(n)||gt(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Tt(n)===t&&(t=t.ownerDocument.body),t}function Qg(n,e){let t=rt(n);if(Cs(n))return t;if(!It(n)){let i=Qt(n);for(;i&&!Qn(i);){if(ft(i)&&!Su(i))return i;i=Qt(i)}return t}let r=Gg(n,e);for(;r&&jg(r)&&Su(r);)r=Gg(r,e);return r&&Qn(r)&&Su(r)&&!ma(r)?t:r||Ug(n)||t}var mw=async function(n){let e=this.getOffsetParent||Qg,t=this.getDimensions,r=await t(n.floating);return{reference:gw(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vw(n){return gt(n).direction==="rtl"}var yw={convertOffsetParentRelativeRectToViewportRelativeRect:ow,getDocumentElement:Tt,getClippingRect:hw,getOffsetParent:Qg,getElementRects:mw,getClientRects:aw,getDimensions:fw,getScale:Kr,isElement:ft,isRTL:vw};function em(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function bw(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=Es(d),f=Es(i.clientWidth-(u+h)),m=Es(i.clientHeight-(d+g)),y=Es(u),_={rootMargin:-v+"px "+-f+"px "+-m+"px "+-y+"px",threshold:Xt(0,wn(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&&!em(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 Yr(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=Eu(n),u=i||s?[...c?Zr(c):[],...Zr(e)]:[];u.forEach(y=>{i&&y.addEventListener("scroll",t,{passive:!0}),s&&y.addEventListener("resize",t)});let d=c&&a?bw(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&&!em(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 Xr=Hg;var Jr=Bg,Qr=Fg;var _a=Dg,xa=Lg;var ei=(n,e,t)=>{let r=new Map,i={platform:yw,...t},s={...i.platform,_c:r};return Ng(n,e,{...i,platform:s})};function _w(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 tm(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=[Xr(t.offsetPx??8),Qr(),Jr({padding:8}),_a(),xa({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=Yr(n,r,async()=>{if(!n.isConnected){v.destroy();return}let f=_w(n),m=await ei(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 Aw=zr(Cu(),1),ti=zr(Au(),1),Rw=zr(Ru(),1);var sm=zr(Cu(),1);var wa=globalThis,ka=wa.ShadowRoot&&(wa.ShadyCSS===void 0||wa.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Tu=Symbol(),om=new WeakMap,Rs=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Tu)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(ka&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=om.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&om.set(t,e))}return e}toString(){return this.cssText}},am=n=>new Rs(typeof n=="string"?n:n+"",void 0,Tu),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 Rs(t,n,Tu)},lm=(n,e)=>{if(ka)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=wa.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},Iu=ka?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return am(t)})(n):n;var{is:Tw,defineProperty:Iw,getOwnPropertyDescriptor:$w,getOwnPropertyNames:Mw,getOwnPropertySymbols:Pw,getPrototypeOf:Ow}=Object,Sn=globalThis,cm=Sn.trustedTypes,Nw=cm?cm.emptyScript:"",Lw=Sn.reactiveElementPolyfillSupport,Ts=(n,e)=>n,$u={toAttribute(n,e){switch(e){case Boolean:n=n?Nw: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}},dm=(n,e)=>!Tw(n,e),um={attribute:!0,type:String,converter:$u,reflect:!1,useDefault:!1,hasChanged:dm};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Sn.litPropertyMetadata??(Sn.litPropertyMetadata=new WeakMap);var en=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=um){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&&Iw(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:s}=$w(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)??um}static _$Ei(){if(this.hasOwnProperty(Ts("elementProperties")))return;let e=Ow(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ts("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ts("properties"))){let t=this.properties,r=[...Mw(t),...Pw(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(Iu(i))}else e!==void 0&&t.push(Iu(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 lm(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:$u).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:$u;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??dm)(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){}};en.elementStyles=[],en.shadowRootOptions={mode:"open"},en[Ts("elementProperties")]=new Map,en[Ts("finalized")]=new Map,Lw?.({ReactiveElement:en}),(Sn.reactiveElementVersions??(Sn.reactiveElementVersions=[])).push("2.1.2");var $s=globalThis,pm=n=>n,Sa=$s.trustedTypes,hm=Sa?Sa.createPolicy("lit-html",{createHTML:n=>n}):void 0,bm="$lit$",En=`lit$${Math.random().toFixed(9).slice(2)}$`,_m="?"+En,Fw=`<${_m}>`,ir=document,Ms=()=>ir.createComment(""),Ps=n=>n===null||typeof n!="object"&&typeof n!="function",Du=Array.isArray,Dw=n=>Du(n)||typeof n?.[Symbol.iterator]=="function",Mu=`[
|
|
55
|
+
\f\r]`,Is=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,fm=/-->/g,gm=/>/g,nr=RegExp(`>|${Mu}(?:([^\\s"'>=/]+)(${Mu}*=${Mu}*(?:[^
|
|
56
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),mm=/'/g,vm=/"/g,xm=/^(?:script|style|textarea|title)$/i,Hu=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),D=Hu(1),u2=Hu(2),d2=Hu(3),$t=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),ym=new WeakMap,rr=ir.createTreeWalker(ir,129);function wm(n,e){if(!Du(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return hm!==void 0?hm.createHTML(e):e}var Hw=(n,e)=>{let t=n.length-1,r=[],i,s=e===2?"<svg>":e===3?"<math>":"",o=Is;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===Is?u[1]==="!--"?o=fm:u[1]!==void 0?o=gm:u[2]!==void 0?(xm.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=nr):u[3]!==void 0&&(o=nr):o===nr?u[0]===">"?(o=i??Is,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]==='"'?vm:mm):o===vm||o===mm?o=nr:o===fm||o===gm?o=Is:(o=nr,i=void 0);let g=o===nr&&n[a+1].startsWith("/>")?" ":"";s+=o===Is?l+Fw:d>=0?(r.push(c),l.slice(0,d)+bm+l.slice(d)+En+g):l+En+(d===-2?a:g)}return[wm(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},Os=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]=Hw(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(bm)){let h=u[o++],g=i.getAttribute(d).split(En),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:v[2],strings:g,ctor:v[1]==="."?Ou:v[1]==="?"?Nu:v[1]==="@"?Lu:ri}),i.removeAttribute(d)}else d.startsWith(En)&&(l.push({type:6,index:s}),i.removeAttribute(d));if(xm.test(i.tagName)){let d=i.textContent.split(En),h=d.length-1;if(h>0){i.textContent=Sa?Sa.emptyScript:"";for(let g=0;g<h;g++)i.append(d[g],Ms()),rr.nextNode(),l.push({type:2,index:++s});i.append(d[h],Ms())}}}else if(i.nodeType===8)if(i.data===_m)l.push({type:2,index:s});else{let d=-1;for(;(d=i.data.indexOf(En,d+1))!==-1;)l.push({type:7,index:s}),d+=En.length-1}s++}}static createElement(e,t){let r=ir.createElement("template");return r.innerHTML=e,r}};function ni(n,e,t=n,r){if(e===$t)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,s=Ps(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=ni(n,i._$AS(n,e.values),i,r)),e}var Pu=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 Ns(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new Fu(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++}},Ns=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=ni(this,e,t),Ps(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):Dw(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&&Ps(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=Os.createElement(wm(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let s=new Pu(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=ym.get(e.strings);return t===void 0&&ym.set(e.strings,t=new Os(e)),t}k(e){Du(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(Ms()),this.O(Ms()),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=pm(e).nextSibling;pm(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ri=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=ni(this,e,t,0),o=!Ps(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=ni(this,a[r+l],t,l),c===$t&&(c=this._$AH[l]),o||(o=!Ps(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??"")}},Ou=class extends ri{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===J?void 0:e}},Nu=class extends ri{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==J)}},Lu=class extends ri{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=ni(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)}},Fu=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){ni(this,e)}};var Bw=$s.litHtmlPolyfillSupport;Bw?.(Os,Ns),($s.litHtmlVersions??($s.litHtmlVersions=[])).push("3.3.2");var km=(n,e,t)=>{let r=t?.renderBefore??e,i=r._$litPart$;if(i===void 0){let s=t?.renderBefore??null;r._$litPart$=i=new Ns(e.insertBefore(Ms(),s),s,void 0,t??{})}return i._$AI(n),i};var Ls=globalThis,ge=class extends en{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=km(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,Ls.litElementHydrateSupport?.({LitElement:ge});var Vw=Ls.litElementPolyfillSupport;Vw?.({LitElement:ge});(Ls.litElementVersions??(Ls.litElementVersions=[])).push("4.2.2");var Ea={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ca=n=>(...e)=>({_$litDirective$:n,values:e}),ii=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 Sm="important",Ww=" !"+Sm,T=Ca(class extends ii{constructor(n){if(super(n),n.type!==Ea.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(Ww);r.includes("-")||s?t.setProperty(r,s?i.slice(0,-11):i,s?Sm:""):t[r]=i}}return $t}});var Cn=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,Ds,si,tn,Hs,Aa,oi,Em="#1969fe",jw="#24ad32",Uw="#0e1114",Bu="#677384",zw="#a8afba",Cm="#f6f7f9",qw="#ffffff";function Am(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, ${qw})`,color:`var(--se-color-text-primary, ${Uw})`,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 Zw(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 Rm="syntro-workflow-tracker",Ra=class extends ge{constructor(){super(...arguments),this.runtimeRef=null,this._workflowEntries=[],this._actionVersion=0,Fs.set(this,null),Ds.set(this,null),si.set(this,[]),tn.set(this,new Set),Hs.set(this,{}),Aa.set(this,!1),oi.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=Zw(e);if(Cn(this,oi,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,tn,"f").has(o)&&a.notification&&!l.includes(o)&&!c[o]){Fe(this,tn,"f").add(o),r?.set("notified",[...Fe(this,tn,"f")]);let u=Am(a.notification);Fe(this,si,"f").push(u)}}}connectedCallback(){super.connectedCallback(),this._initSubscriptions()}disconnectedCallback(){super.disconnectedCallback(),this._teardownSubscriptions();for(let e of Fe(this,si,"f"))e();Cn(this,si,[],"f")}updated(e){e.has("runtimeRef")&&(this._teardownSubscriptions(),this._initSubscriptions()),e.has("_actionVersion")&&this._rescanWorkflows()}_initSubscriptions(){if(this.runtimeRef?.events?.subscribe){if(!Fe(this,Aa,"f")&&this._stateNs){let e=this._stateNs.get("notified")??[];for(let r of e)Fe(this,tn,"f").add(r);let t=this._stateNs.get("completed")??{};Cn(this,Hs,{...t},"f"),Cn(this,Aa,!0,"f")}Cn(this,Fs,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1}),"f"),Cn(this,Ds,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},e=>{this._handleTourEvent(e)}),"f"),this._rescanWorkflows()}}_teardownSubscriptions(){Fe(this,Fs,"f")?.call(this),Cn(this,Fs,null,"f"),Fe(this,Ds,"f")?.call(this),Cn(this,Ds,null,"f")}_handleTourEvent(e){let t=e.props?.tourId;if(!t)return;if(!Fe(this,oi,"f").has(t)&&e.name==="tour.started"){this._actionVersion+=1;return}if(!Fe(this,oi,"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,tn,"f").has(t)){Fe(this,tn,"f").add(t),r?.set("notified",[...Fe(this,tn,"f")]);let a=Fe(this,oi,"f").get(t);if(a?.meta.notification){let l=Am(a.meta.notification);Fe(this,si,"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,Hs,"f")[t]=s,r?.set("completed",{...Fe(this,Hs,"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, ${Em})`,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 SyntrologieSDK=(()=>{var gx=Object.create;var ys=Object.defineProperty;var m
|
|
|
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, ${Cm})`:`var(--se-color-text-secondary, ${zw})`,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, ${Em})`:"rgba(255,255,255,0.12)"},l={color:`var(--se-color-success, ${jw})`},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, ${Cm})`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},a={flexShrink:"0",padding:"2px 6px",border:"none",borderRadius:"4px",background:"transparent",color:`var(--se-color-text-tertiary, ${Bu})`,fontSize:"12px",cursor:"pointer",lineHeight:"1"},l={marginBottom:"8px"},c={fontSize:"10px",color:`var(--se-color-text-tertiary, ${Bu})`,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 SyntrologieSDK=(()=>{var gx=Object.create;var ys=Object.defineProperty;var m
|
|
|
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, ${Bu})`};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,Ds=new WeakMap,si=new WeakMap,tn=new WeakMap,Hs=new WeakMap,Aa=new WeakMap,oi=new WeakMap;Ra.properties={runtimeRef:{attribute:!1},_workflowEntries:{state:!0},_actionVersion:{state:!0}};typeof window<"u"&&!customElements.get(Rm)&&customElements.define(Rm,Ra);var Tm=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=Sg(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")}}},Im=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 SyntrologieSDK=(()=>{var gx=Object.create;var ys=Object.defineProperty;var m
|
|
|
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"))}}},$m=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)}}},Mm=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=tm(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()}}},Pm=[{kind:"overlays:highlight",executor:Tm},{kind:"overlays:pulse",executor:Im},{kind:"overlays:badge",executor:$m},{kind:"overlays:tooltip",executor:Mm},{kind:"overlays:modal",executor:xu},{kind:"overlays:tour",executor:bu},{kind:"overlays:celebrate",executor:wg}];function Vu(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 Wu(n,e){e.executors.unregisterBySource(n),e.widgets.unregisterBySource(n)}var Gw=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"]),Kw=new Set(["adaptive-chatbot","adaptive-content","adaptive-faq","adaptive-gamification","adaptive-nav","adaptive-overlays"]),Yw={faq:"adaptive-faq",nav:"adaptive-nav",gamification:"adaptive-gamification",chatbot:"adaptive-chatbot",overlays:"adaptive-overlays",content:"adaptive-content"};function Om(n){return Yw[n]??n}function Nm(n){return Gw.has(n)}function Lm(n){if(Nm(n))return null;let e=n.indexOf(":");return e===-1?null:Om(n.slice(0,e))}function ju(n){let e=n.indexOf(":");return e===-1?null:Om(n.slice(0,e))}function Uu(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=Lm(y.kind);if(k&&m.add(k),y.kind==="core:mountWidget"){let _=y.widget?.widgetId;if(_){let b=ju(_);b&&m.add(b)}}}if(f.tiles){for(let y of f.tiles)if(y.widget){let k=ju(y.widget);k&&m.add(k)}}for(let y of Kw)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 ai=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=Vu({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)}Wu(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()}},Bs=new ai;var Fm=/```json\s*\n([\s\S]*?)```/g;function Dm(n){let e=[],t=n,r=[],i;for(Fm.lastIndex=0;(i=Fm.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 Vs=class extends Error{constructor(e){super(e),this.name="AuthError"}};function Xw(){let n=document.cookie.match(/stytch_session_jwt=([^;]*)/);if(!n||!n[1])throw new Vs("No authentication token found");let e=localStorage.getItem("syntrologie_workspace_id");if(!e)throw new Vs("No workspace ID found");return{Authorization:`Bearer ${n[1]}`,"X-Workspace-Id":e}}async function Hm(n,e){let t=Xw(),r=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",...t},body:JSON.stringify(e)});if(!r.ok)throw r.status===401?new Vs("Session expired or unauthorized"):new Error(`Chat request failed: ${r.status} ${r.statusText}`);return r.json()}var jm="#6a59ce",Um="#ffffff",Jw="#cbd0d7",Qw="#f6f7f9",zm="#87919f",ek="#ff2524",tk=0;function zu(){return`msg-${Date.now()}-${++tk}`}var nk={display:"flex",flexDirection:"column",height:"100%",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px",touchAction:"none"},rk={flex:"1",overflowY:"auto",padding:"12px",display:"flex",flexDirection:"column",gap:"8px"},Bm={maxWidth:"85%",padding:"8px 12px",borderRadius:"12px",lineHeight:"1.5",wordBreak:"break-word"},ik={alignSelf:"flex-end",backgroundColor:`var(--sc-color-primary, ${jm})`,color:`var(--sc-color-primary-text, ${Um})`,borderBottomRightRadius:"4px"},sk={alignSelf:"flex-start",backgroundColor:"var(--sc-chat-assistant-bubble-bg, rgba(255, 255, 255, 0.08))",color:`var(--sc-content-text-color, ${Jw})`,borderBottomLeftRadius:"4px"},ok={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, ${zm})`,fontSize:"13px"},ak={padding:"8px 12px",backgroundColor:"var(--sc-color-error-bg, rgba(239, 68, 68, 0.1))",color:`var(--sc-color-error, ${ek})`,fontSize:"13px",borderRadius:"8px",margin:"0 12px"},lk={display:"flex",gap:"8px",padding:"12px",borderTop:"1px solid var(--sc-content-border-color, rgba(255, 255, 255, 0.06))"},ck={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, ${Qw})`,fontSize:"14px",outline:"none",fontFamily:"inherit"},Vm={padding:"8px 16px",borderRadius:"8px",border:"none",backgroundColor:`var(--sc-color-primary, ${jm})`,color:`var(--sc-color-primary-text, ${Um})`,fontWeight:"600",fontSize:"13px",cursor:"pointer",whiteSpace:"nowrap"},uk={opacity:"0.5",cursor:"not-allowed"},mt,Ws,sr,li,qm,Ia,Zm,Ta=class extends ge{constructor(){super(...arguments);ee(this,li);this.config=void 0;this.runtime=void 0;this.tileId="chatbot-widget";this._messages=[];this._isLoading=!1;this._error=null;ee(this,mt,null);ee(this,Ws,null);ee(this,sr,null);ee(this,Ia,t=>{t.preventDefault();let r=I(this,Ws)??this.querySelector("[data-chat-input]");if(!r||!r.value.trim()||this._isLoading)return;let i=r.value;r.value="",te(this,li,Zm).call(this,i)})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),I(this,mt)?.isApplied()&&(I(this,mt).revertAll().catch(t=>{console.error("[ChatAssistantElement] Failed to revert actions on disconnect:",t)}),Z(this,mt,null))}firstUpdated(){Z(this,Ws,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:zu(),role:"assistant",text:this.config.greeting,timestamp:Date.now()}])}render(){return D`
|
|
149
|
+
<div style=${T(nk)} data-testid="chat-assistant">
|
|
150
150
|
<!-- Message list -->
|
|
151
|
-
<div style=${T(
|
|
152
|
-
${this._messages.map(t=>te(this,li,
|
|
153
|
-
${this._isLoading?D`<div style=${T(
|
|
151
|
+
<div style=${T(rk)} data-message-list>
|
|
152
|
+
${this._messages.map(t=>te(this,li,qm).call(this,t))}
|
|
153
|
+
${this._isLoading?D`<div style=${T(ok)}>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(ak)}>${this._error}</div>`:J}
|
|
158
158
|
|
|
159
159
|
<!-- Composer -->
|
|
160
160
|
<form
|
|
161
|
-
style=${T(
|
|
162
|
-
@submit=${
|
|
161
|
+
style=${T(lk)}
|
|
162
|
+
@submit=${I(this,Ia)}
|
|
163
163
|
>
|
|
164
164
|
<input
|
|
165
165
|
data-chat-input
|
|
166
|
-
style=${T(
|
|
166
|
+
style=${T(ck)}
|
|
167
167
|
placeholder="Ask anything..."
|
|
168
168
|
?disabled=${this._isLoading}
|
|
169
169
|
data-testid="chat-input"
|
|
@@ -171,19 +171,19 @@ var SyntrologieSDK=(()=>{var gx=Object.create;var ys=Object.defineProperty;var m
|
|
|
171
171
|
<button
|
|
172
172
|
type="submit"
|
|
173
173
|
?disabled=${this._isLoading}
|
|
174
|
-
style=${T(this._isLoading?{...
|
|
174
|
+
style=${T(this._isLoading?{...Vm,...uk}:Vm)}
|
|
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,vt)?.isApplied()&&($(this,vt).revertAll().catch(t=>{console.error("[ChatAssistantElement] Failed to revert actions on clear:",t)}),K(this,vt,null)),sessionStorage.removeItem(`syntro:chatbot:history:${this.tileId}`)}};vt=new WeakMap,Vs=new WeakMap,sr=new WeakMap,li=new WeakSet,Vm=function(t){let i=t.role==="user"?{...Nm,...Jw}:{...Nm,...ek};return D`<div style=${T(i)}>${t.text}</div>`},Ta=new WeakMap,Wm=async function(t){let r=t.trim();if(!r||!this.config||!this.runtime)return;this._error=null;let i={id:Vu(),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 Om(this.config.backendUrl,{message:r,history:o,mlflow_run_id:this.config.mlflowRunId}),{displayText:l,actions:c}=Pm(a.response),u={id:Vu(),role:"assistant",text:l,timestamp:Date.now()};this._messages=[...this._messages,u],c.length>0&&($(this,vt)?.isApplied()&&await $(this,vt).revertAll(),K(this,vt,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}},Ra.properties={config:{attribute:!1},runtime:{attribute:!1},tileId:{type:String},_messages:{state:!0},_isLoading:{state:!0},_error:{state:!0}};var Fm="syntro-chat-assistant",ok=()=>{typeof window>"u"||customElements.get(Fm)||customElements.define(Fm,Ra)},jm={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, ${Bm});">Chat widget requires config and runtime.</div>`,()=>{n.innerHTML=""};ok();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 Um={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:jm,metadata:{name:"Chat Assistant",description:"AI-powered chat assistant that can execute DOM actions",icon:"\u{1F4AC}"}}]};function zm(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 ak(n,e,t){let r=zm(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 lk(n,e,t){let r=zm(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 ck(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 qm=[{kind:"faq:scroll_to",executor:ak},{kind:"faq:toggle_item",executor:lk},{kind:"faq:update",executor:ck}];var Ws=class extends ii{constructor(e){if(super(e),this.it=Q,e.type!==Sa.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:[]}}};Ws.directiveName="unsafeHTML",Ws.resultType=1;var Ia=Ea(Ws);function zu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var lr=zu();function Jm(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 uk=(()=>{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)}}>`)},dk=/^(?:[ \t]*(?:\n|$))+/,pk=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,hk=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,qs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,fk=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,qu=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ev=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,tv=pe(ev).replace(/bull/g,qu).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(),gk=pe(ev).replace(/bull/g,qu).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(),Zu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,mk=/^[^\n]+/,Gu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,vk=pe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Gu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),yk=pe(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,qu).getRegex(),La="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",Ku=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,bk=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",Ku).replace("tag",La).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),nv=pe(Zu).replace("hr",qs).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",La).getRegex(),_k=pe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",nv).getRegex(),Yu={blockquote:_k,code:pk,def:vk,fences:hk,heading:fk,hr:qs,html:bk,lheading:tv,list:yk,newline:dk,paragraph:nv,table:or,text:mk},Zm=pe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",qs).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",La).getRegex(),xk={...Yu,lheading:gk,table:Zm,paragraph:pe(Zu).replace("hr",qs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Zm).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",La).getRegex()},wk={...Yu,html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ku).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(Zu).replace("hr",qs).replace("heading",` *#{1,6} *[^
|
|
182
|
-
]`).replace("lheading",
|
|
181
|
+
`}clearMessages(){this._messages=[],this._error=null,I(this,mt)?.isApplied()&&(I(this,mt).revertAll().catch(t=>{console.error("[ChatAssistantElement] Failed to revert actions on clear:",t)}),Z(this,mt,null)),sessionStorage.removeItem(`syntro:chatbot:history:${this.tileId}`)}};mt=new WeakMap,Ws=new WeakMap,sr=new WeakMap,li=new WeakSet,qm=function(t){let i=t.role==="user"?{...Bm,...ik}:{...Bm,...sk};return D`<div style=${T(i)}>${t.text}</div>`},Ia=new WeakMap,Zm=async function(t){let r=t.trim();if(!r||!this.config||!this.runtime)return;this._error=null;let i={id:zu(),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 Hm(this.config.backendUrl,{message:r,history:o,mlflow_run_id:this.config.mlflowRunId}),{displayText:l,actions:c}=Dm(a.response),u={id:zu(),role:"assistant",text:l,timestamp:Date.now()};this._messages=[...this._messages,u],c.length>0&&(I(this,mt)?.isApplied()&&await I(this,mt).revertAll(),Z(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}},Ta.properties={config:{attribute:!1},runtime:{attribute:!1},tileId:{type:String},_messages:{state:!0},_isLoading:{state:!0},_error:{state:!0}};var Wm="syntro-chat-assistant",dk=()=>{typeof window>"u"||customElements.get(Wm)||customElements.define(Wm,Ta)},Gm={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, ${zm});">Chat widget requires config and runtime.</div>`,()=>{n.innerHTML=""};dk();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 Km={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:Gm,metadata:{name:"Chat Assistant",description:"AI-powered chat assistant that can execute DOM actions",icon:"\u{1F4AC}"}}]};function Ym(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 pk(n,e,t){let r=Ym(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 hk(n,e,t){let r=Ym(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 fk(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 Xm=[{kind:"faq:scroll_to",executor:pk},{kind:"faq:toggle_item",executor:hk},{kind:"faq:update",executor:fk}];var js=class extends ii{constructor(e){if(super(e),this.it=J,e.type!==Ea.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:[]}}};js.directiveName="unsafeHTML",js.resultType=1;var $a=Ca(js);function Ku(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var lr=Ku();function iv(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 gk=(()=>{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)}}>`)},mk=/^(?:[ \t]*(?:\n|$))+/,vk=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,yk=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Zs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,bk=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Yu=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,sv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ov=he(sv).replace(/bull/g,Yu).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(),_k=he(sv).replace(/bull/g,Yu).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(),Xu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,xk=/^[^\n]+/,Ju=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,wk=he(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ju).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),kk=he(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Yu).getRegex(),Fa="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",Qu=/<!--(?:-?>|[\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",Qu).replace("tag",Fa).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),av=he(Xu).replace("hr",Zs).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",Fa).getRegex(),Ek=he(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",av).getRegex(),ed={blockquote:Ek,code:vk,def:wk,fences:yk,heading:bk,hr:Zs,html:Sk,lheading:ov,list:kk,newline:mk,paragraph:av,table:or,text:xk},Jm=he("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Zs).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",Fa).getRegex(),Ck={...ed,lheading:_k,table:Jm,paragraph:he(Xu).replace("hr",Zs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jm).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",Fa).getRegex()},Ak={...ed,html:he(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Qu).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(Xu).replace("hr",Zs).replace("heading",` *#{1,6} *[^
|
|
182
|
+
]`).replace("lheading",ov).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Rk=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Tk=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,lv=/^( {2,}|\\)\n(?!\s*$)/,Ik=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Da=/[\p{P}\p{S}]/u,td=/[\s\p{P}\p{S}]/u,cv=/[^\s\p{P}\p{S}]/u,$k=he(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,td).getRegex(),uv=/(?!~)[\p{P}\p{S}]/u,Mk=/(?!~)[\s\p{P}\p{S}]/u,Pk=/(?:[^\s\p{P}\p{S}]|~)/u,dv=/(?![*_])[\p{P}\p{S}]/u,Ok=/(?![*_])[\s\p{P}\p{S}]/u,Nk=/(?:[^\s\p{P}\p{S}]|[*_])/u,Lk=he(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",gk?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),pv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Fk=he(pv,"u").replace(/punct/g,Da).getRegex(),Dk=he(pv,"u").replace(/punct/g,uv).getRegex(),hv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Hk=he(hv,"gu").replace(/notPunctSpace/g,cv).replace(/punctSpace/g,td).replace(/punct/g,Da).getRegex(),Bk=he(hv,"gu").replace(/notPunctSpace/g,Pk).replace(/punctSpace/g,Mk).replace(/punct/g,uv).getRegex(),Vk=he("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,cv).replace(/punctSpace/g,td).replace(/punct/g,Da).getRegex(),Wk=he(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,dv).getRegex(),jk="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Uk=he(jk,"gu").replace(/notPunctSpace/g,Nk).replace(/punctSpace/g,Ok).replace(/punct/g,dv).getRegex(),zk=he(/\\(punct)/,"gu").replace(/punct/g,Da).getRegex(),qk=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(),Zk=he(Qu).replace("(?:-->|$)","-->").getRegex(),Gk=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",Zk).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Oa=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Kk=he(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Oa).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fv=he(/^!?\[(label)\]\[(ref)\]/).replace("label",Oa).replace("ref",Ju).getRegex(),gv=he(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ju).getRegex(),Yk=he("reflink|nolink(?!\\()","g").replace("reflink",fv).replace("nolink",gv).getRegex(),Qm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,nd={_backpedal:or,anyPunctuation:zk,autolink:qk,blockSkip:Lk,br:lv,code:Tk,del:or,delLDelim:or,delRDelim:or,emStrongLDelim:Fk,emStrongRDelimAst:Hk,emStrongRDelimUnd:Vk,escape:Rk,link:Kk,nolink:gv,punctuation:$k,reflink:fv,reflinkSearch:Yk,tag:Gk,text:Ik,url:or},Xk={...nd,link:he(/^!?\[(label)\]\((.*?)\)/).replace("label",Oa).getRegex(),reflink:he(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Oa).getRegex()},qu={...nd,emStrongRDelimAst:Bk,emStrongLDelim:Dk,delLDelim:Wk,delRDelim:Uk,url:he(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Qm).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",Qm).getRegex()},Jk={...qu,br:he(lv).replace("{2,}","*").getRegex(),text:he(qu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ma={normal:ed,gfm:Ck,pedantic:Ak},Us={normal:nd,gfm:qu,breaks:Jk,pedantic:Xk},Qk={"&":"&","<":"<",">":">",'"':""","'":"'"},ev=n=>Qk[n];function Vt(n,e){if(e){if(Xe.escapeTest.test(n))return n.replace(Xe.escapeReplace,ev)}else if(Xe.escapeTestNoEncode.test(n))return n.replace(Xe.escapeReplaceNoEncode,ev);return n}function tv(n){try{n=encodeURI(n).replace(Xe.percentDecode,"%")}catch{return null}return n}function nv(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 zs(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 eS(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 tS(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 rv(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 nS(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 Na=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:zs(t,`
|
|
185
|
+
`)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=nS(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=zs(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:zs(e[0],`
|
|
186
|
+
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=zs(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=tS(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=nv(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(nv(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=zs(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=eS(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)),rv(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 rv(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 Zu{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 Na,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:Ma.normal,inline:Us.normal};this.options.pedantic?(t.block=Ma.pedantic,t.inline=Us.pedantic):this.options.gfm&&(t.block=Ma.gfm,this.options.breaks?t.inline=Us.breaks:t.inline=Us.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ma,inline:Us}}static lex(e,t){return new Zu(t).lex(e)}static lexInline(e,t){return new Zu(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}},La=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-'+Vt(r)+'">'+(t?i:Vt(i,!0))+`</code></pre>
|
|
222
|
+
`:"<pre><code>"+(t?i:Vt(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>${Vt(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=tv(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return e&&(s+=' title="'+Vt(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=tv(n);if(i===null)return Vt(t);n=i;let s=`<img src="${n}" alt="${Vt(t)}"`;return e&&(s+=` title="${Vt(e)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Vt(n.text)}},rd=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 Gu{constructor(e){ve(this,"options");ve(this,"renderer");ve(this,"textRenderer");this.options=e||lr,this.options.renderer=this.options.renderer||new La,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new rd}static parse(e,t){return new Gu(t).parse(e)}static parseInline(e,t){return new Gu(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}},Pa,qs=(Pa=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(Pa,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ve(Pa,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Pa),id=class{constructor(...n){ve(this,"defaults",Ku());ve(this,"options",this.setOptions);ve(this,"parse",this.parseMarkdown(!0));ve(this,"parseInline",this.parseMarkdown(!1));ve(this,"Parser",Pt);ve(this,"Renderer",La);ve(this,"TextRenderer",rd);ve(this,"Lexer",Mt);ve(this,"Tokenizer",Na);ve(this,"Hooks",qs);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 La(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 Na(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 qs;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];qs.passThroughHooks.has(s)?i[o]=c=>{if(this.defaults.async&&qs.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>"+Vt(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},ar=new id;function ye(n,e){return ar.parse(n,e)}ye.options=ye.setOptions=function(n){return ar.setOptions(n),ye.defaults=ar.defaults,iv(ye.defaults),ye};ye.getDefaults=Ku;ye.defaults=lr;ye.use=function(...n){return ar.use(...n),ye.defaults=ar.defaults,iv(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=La;ye.TextRenderer=rd;ye.Lexer=Mt;ye.lexer=Mt.lex;ye.Tokenizer=Na;ye.Hooks=qs;ye.parse=ye;var y$=ye.options,b$=ye.setOptions,_$=ye.use,x$=ye.walkTokens,w$=ye.parseInline;var k$=Pt.parse,S$=Mt.lex;var We={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"}},Ha={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 mv=new id({async:!1,gfm:!0,breaks:!0});function rS(n){return typeof n=="string"?n:n.type==="rich"?n.html:n.content}function iS(n){return typeof n=="string"?mv.parse(n):n.type==="rich"?n.html:mv.parse(n.content)}function sS(n){return n?n===!0?{style:"thumbs"}:n:null}function oS(n){return n.prompt??"Was this helpful?"}function aS(n){return n&&n!=="auto"?n:typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var Ba=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)||rS(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=iS(t);return D`<div style="margin:0" data-faq-markdown="">${$a(r)}</div>`}_renderFeedback(t,r,i,s){let o=Ha[s],a={...We.feedback,...o.feedbackPrompt};return D`
|
|
240
240
|
<div style=${T(a)}>
|
|
241
|
-
<span>${
|
|
241
|
+
<span>${oS(r)}</span>
|
|
242
242
|
<button
|
|
243
243
|
type="button"
|
|
244
|
-
style=${T({...
|
|
244
|
+
style=${T({...We.feedbackButton,...i==="up"?We.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({...We.feedbackButton,...i==="down"?We.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=Ha[i],a=this._expandedIds.has(t.config.id),l=this._highlightId===t.config.id,c=this._hoveredId===t.config.id,u={...We.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={...We.question,...o.question,...c?o.questionHover:{}},h={...We.chevron,transform:a?"rotate(90deg)":"rotate(0deg)"},g={...We.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=aS(this.faqConfig.theme),r=Ha[t],i=sS(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={...We.container,...r.container},d={...We.emptyState,...r.emptyState},h={...We.categoryHeader,...r.categoryHeader},g={...We.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(We.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(We.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({...We.noResults,...r.emptyState})}
|
|
332
332
|
>
|
|
333
333
|
No questions found matching "${this._searchQuery}"
|
|
334
334
|
</div>
|
|
335
|
-
`:
|
|
335
|
+
`:J}
|
|
336
336
|
</div>
|
|
337
|
-
`}};
|
|
337
|
+
`}};Ba.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",Ba);var lS={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()}},vv={id:"adaptive-faq",version:"2.0.0",name:"FAQ Accordion",description:"Collapsible Q&A accordion with actions, rich content, feedback, and personalization",executors:Xm,widgets:[{id:"adaptive-faq:accordion",component:lS,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 cS=async(n,e)=>{let{badgeId:t}=n;return e.publishEvent("gamification.badge_awarded",{badgeId:t,awardedAt:Date.now()}),{cleanup:()=>{}}},uS=async(n,e)=>{let{points:t,reason:r}=n;return e.publishEvent("gamification.points_added",{points:t,reason:r,timestamp:Date.now()}),{cleanup:()=>{}}},dS={names:["page_view","button_click"],handler:(n,e)=>{console.log("[Gamification] Event received for badge trigger check")}},pS=[{kind:"gamification:awardBadge",executor:cS},{kind:"gamification:addPoints",executor:uS}],hS=[dS],yv={id:"adaptive-gamification",version:"1.0.0",name:"Gamification",description:"Badges, rewards, points, and engagement mechanics",executors:pS,eventHandlers:hS};var ci=zr(Au(),1),fS=zr(Ru(),1);var G$={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 sd(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 gS="#6a59ce",bv="#677384",_v="#87919f",mS={"\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 vS(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function yS(n){return mS[n]??vS(n)}function xv(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 bS(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 _S(n){return n==="dark"?"dark":n==="light"?"light":typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var ui,di,_e,ad,ld,kv,cd,Sv,Ev,Cv,Gs,ud,Va=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,ui,null);ee(this,di,null)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),te(this,_e,ad).call(this)}disconnectedCallback(){super.disconnectedCallback(),te(this,_e,ld).call(this)}updated(t){t.has("runtime")&&(te(this,_e,ld).call(this),te(this,_e,ad).call(this))}render(){let t=te(this,_e,kv).call(this),r=te(this,_e,cd).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"?_v:bv}),a=T({fontSize:"13px",padding:"16px",textAlign:"center",color:r==="dark"?bv:_v});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,ud).call(this,h,g,d.length))}
|
|
358
|
+
`):t.map((u,d)=>te(this,_e,ud).call(this,u,d,t.length))}
|
|
359
359
|
</div>
|
|
360
360
|
</div>
|
|
361
|
-
`}};ui=new WeakMap,di=new WeakMap,
|
|
361
|
+
`}};ui=new WeakMap,di=new WeakMap,_e=new WeakSet,ad=function(){this.runtime&&(Z(this,ui,this.runtime.context.subscribe(()=>{this._renderTick+=1})),this.runtime.accumulator?.subscribe&&Z(this,di,this.runtime.accumulator.subscribe(()=>{this._renderTick+=1})))},ld=function(){var t,r;(t=I(this,ui))==null||t.call(this),Z(this,ui,null),(r=I(this,di))==null||r.call(this),Z(this,di,null)},kv=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},cd=function(){return _S(this.config.theme)},Sv=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,Gs).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,Gs).call(this,"nav:toggled",{tipId:t,expanded:!r}),this._expandedIds=i},Ev=function(t,r){let i=t.trim().toLowerCase();if(!(i.startsWith("javascript:")||i.startsWith("data:")))if(te(this,_e,Gs).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,sd(s.toString())||(window.history.pushState(null,"",s.toString()),window.dispatchEvent(new PopStateEvent("popstate")))}},Cv=function(t){let r=document.querySelector(t.selector);r instanceof HTMLElement&&(te(this,_e,Gs).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"}),bS(r),setTimeout(()=>r.focus(),400))},Gs=function(t,r){this.runtime?.events.publish(t,{instanceId:this.instanceId,timestamp:Date.now(),...r})},ud=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,cd).call(this),y=d?Array.isArray(d.route)?d.route[0]:d.route:l,k=d?xv(Array.isArray(d.route)?d.route:[d.route]):y?xv([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, ${gS})`,color:"#ffffff"}),L=T({fontSize:"16px",flexShrink:"0"}),N=z=>{z.preventDefault(),z.stopPropagation(),b&&d?te(this,_e,Cv).call(this,d):y&&te(this,_e,Ev).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,Sv).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}>${$a(yS(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
|
-
`},Ba.properties={config:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_renderTick:{state:!0},_hoveredId:{state:!0}};var vv="syntro-nav-tips";function nd(){typeof window>"u"||customElements.get(vv)||customElements.define(vv,Ba)}var mS=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 vS(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 yS(n){try{return new URL(n,window.location.origin).origin===window.location.origin}catch{return!1}}var bS=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&&yS(t)?vS(t)||(window.history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate"))):window.location.href=t,{cleanup:()=>{}}},_S={mount(n,e){nd();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()}},xS=[{kind:"navigation:scrollTo",executor:mS},{kind:"navigation:navigate",executor:bS}],wv={id:"adaptive-nav",version:"2.0.0",name:"Navigation Tips",description:"Navigation actions and accordion-based tips with per-item conditional visibility",executors:xS,widgets:[{id:"adaptive-nav:tips",component:_S,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 wS={light:50,medium:100,heavy:200},kS=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],kv={init(n,e,t){let r=wS[t.intensity],i=t.colors.length>0?t.colors:kS,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},ES="\u{1F389}",Sv={init(n,e,t){let r=SS[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:ES,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 CS={light:20,medium:40,heavy:80},AS={light:3,medium:4,heavy:5},Ev={init(n,e,t){let r=CS[t.intensity],i=AS[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 RS={light:30,medium:60,heavy:120},Cv={init(n,e,t){let r=RS[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 Va=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 TS=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function IS(n,e){return[n,e,`${n}cc`,`${e}cc`,"#ffffff",`${n}80`]}function $S(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 IS(t,r||t)}catch{}return null}var Av=new Map([["confetti",kv],["fireworks",Ev],["sparkles",Cv],["emoji-rain",Sv]]),Rv=async(n,e)=>{let t=Av.get(n.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${n.effect}". Available: ${[...Av.keys()].join(", ")}`),{cleanup:()=>{}};let r=n.colors??$S(e.overlayRoot)??TS,i={duration:n.duration??3e3,intensity:n.intensity??"medium",colors:r,props:n.props},s=new Va;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:n.effect}),{cleanup:()=>{s.stop()}}};var ld="syntro_active_tour",Wa=new Map;function MS(n){try{let e=localStorage.getItem(ld);if(!e)return null;let t=JSON.parse(e);return t.tourId!==n?null:t}catch{return null}}function ad(n){try{localStorage.setItem(ld,JSON.stringify(n))}catch{}}function PS(){try{localStorage.removeItem(ld)}catch{}}function Gs(){return window.location.pathname}function OS(n){if(!n.route)return!0;let e=Gs();return n.route.includes("*")?new RegExp(`^${n.route.replace(/\*/g,".*")}$`).test(e):e===n.route}var Tv=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(Wa.has(t))return{cleanup:async()=>{let _=Wa.get(t);_&&await _.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=MS(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||r[0].id,startedAt:Date.now()},ad(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,ad(o)}let c=r[l];if(!OS(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:Gs()}),{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"){PS(),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=_,ad(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:_}),b.route&&b.route!==Gs()){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 _=Gs(),b=()=>{let x=Gs();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,Wa.delete(t),await v(),g&&g(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return Wa.set(t,{cleanup:k}),{cleanup:k}};var Iv=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function $v(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(!Iv)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`}),Iv){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 NS=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(!NS.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)"},Mv=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
|
+
`},Va.properties={config:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_renderTick:{state:!0},_hoveredId:{state:!0}};var wv="syntro-nav-tips";function od(){typeof window>"u"||customElements.get(wv)||customElements.define(wv,Va)}var xS=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 wS(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 kS(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&&kS(t)?wS(t)||(window.history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate"))):window.location.href=t,{cleanup:()=>{}}},ES={mount(n,e){od();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()}},CS=[{kind:"navigation:scrollTo",executor:xS},{kind:"navigation:navigate",executor:SS}],Av={id:"adaptive-nav",version:"2.0.0",name:"Navigation Tips",description:"Navigation actions and accordion-based tips with per-item conditional visibility",executors:CS,widgets:[{id:"adaptive-nav:tips",component:ES,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 AS={light:50,medium:100,heavy:200},RS=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],Rv={init(n,e,t){let r=AS[t.intensity],i=t.colors.length>0?t.colors:RS,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 TS={light:20,medium:40,heavy:80},IS="\u{1F389}",Tv={init(n,e,t){let r=TS[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:IS,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 $S={light:20,medium:40,heavy:80},MS={light:3,medium:4,heavy:5},Iv={init(n,e,t){let r=$S[t.intensity],i=MS[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 PS={light:30,medium:60,heavy:120},$v={init(n,e,t){let r=PS[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 Wa=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 OS=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function NS(n,e){return[n,e,`${n}cc`,`${e}cc`,"#ffffff",`${n}80`]}function LS(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 NS(t,r||t)}catch{}return null}var Mv=new Map([["confetti",Rv],["fireworks",Iv],["sparkles",$v],["emoji-rain",Tv]]),Pv=async(n,e)=>{let t=Mv.get(n.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${n.effect}". Available: ${[...Mv.keys()].join(", ")}`),{cleanup:()=>{}};let r=n.colors??LS(e.overlayRoot)??OS,i={duration:n.duration??3e3,intensity:n.intensity??"medium",colors:r,props:n.props},s=new Wa;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:n.effect}),{cleanup:()=>{s.stop()}}};var pd="syntro_active_tour",ja=new Map;function FS(n){try{let e=localStorage.getItem(pd);if(!e)return null;let t=JSON.parse(e);return t.tourId!==n?null:t}catch{return null}}function dd(n){try{localStorage.setItem(pd,JSON.stringify(n))}catch{}}function DS(){try{localStorage.removeItem(pd)}catch{}}function Ks(){return window.location.pathname}function HS(n){if(!n.route)return!0;let e=Ks();return n.route.includes("*")?new RegExp(`^${n.route.replace(/\*/g,".*")}$`).test(e):e===n.route}var Ov=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(ja.has(t))return{cleanup:async()=>{let _=ja.get(t);_&&await _.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=FS(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||r[0].id,startedAt:Date.now()},dd(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,dd(o)}let c=r[l];if(!HS(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:Ks()}),{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"){DS(),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=_,dd(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:_}),b.route&&b.route!==Ks()){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 _=Ks(),b=()=>{let w=Ks();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,ja.delete(t),await v(),g&&g(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return ja.set(t,{cleanup:k}),{cleanup:k}};var Nv=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function Lv(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(!Nv)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`}),Nv){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 BS=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(!BS.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)"},Fv=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 LS(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 Pv(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=[Xr(t.offsetPx??8),Jr(),Qr({padding:8}),ba(),_a({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=Yr(n,r,async()=>{if(!n.isConnected){v.destroy();return}let f=LS(n),m=await ei(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 Ov="#1969fe",FS="#24ad32",DS="#0e1114",cd="#677384",HS="#a8afba",Nv="#f6f7f9",BS="#ffffff";function Lv(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, ${BS})`,color:`var(--se-color-text-primary, ${DS})`,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 VS(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 pi="syntro-workflow-tracker",hi,fi,ur,Bt,gi,Ys,dr,Ks=class extends he{constructor(){super(...arguments);this.runtimeRef=null;this._workflowEntries=[];this._actionVersion=0;ee(this,hi,null);ee(this,fi,null);ee(this,ur,[]);ee(this,Bt,new Set);ee(this,gi,{});ee(this,Ys,!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=VS(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,Bt).has(a)&&l.notification&&!c.includes(a)&&!u[a]){$(this,Bt).add(a),i?.set("notified",[...$(this,Bt)]);let d=Lv(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,Ys)&&this._stateNs){let t=this._stateNs.get("notified")??[];for(let i of t)$(this,Bt).add(i);let r=this._stateNs.get("completed")??{};K(this,gi,{...r}),K(this,Ys,!0)}K(this,hi,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1})),K(this,fi,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},t=>{this._handleTourEvent(t)})),this._rescanWorkflows()}}_teardownSubscriptions(){var t,r;(t=$(this,hi))==null||t.call(this),K(this,hi,null),(r=$(this,fi))==null||r.call(this),K(this,fi,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,Bt).has(r)){$(this,Bt).add(r),i?.set("notified",[...$(this,Bt)]);let l=$(this,dr).get(r);if(l?.meta.notification){let c=Lv(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,gi)[r]=o,i?.set("completed",{...$(this,gi)}),{...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, ${Ov})`,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 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 Dv(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=[Xr(t.offsetPx??8),Qr(),Jr({padding:8}),_a(),xa({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=Yr(n,r,async()=>{if(!n.isConnected){v.destroy();return}let f=VS(n),m=await ei(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 Hv="#1969fe",WS="#24ad32",jS="#0e1114",hd="#677384",US="#a8afba",Bv="#f6f7f9",zS="#ffffff";function Vv(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, ${zS})`,color:`var(--se-color-text-primary, ${jS})`,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 qS(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 pi="syntro-workflow-tracker",hi,fi,ur,Wt,gi,Xs,dr,Ys=class extends ge{constructor(){super(...arguments);this.runtimeRef=null;this._workflowEntries=[];this._actionVersion=0;ee(this,hi,null);ee(this,fi,null);ee(this,ur,[]);ee(this,Wt,new Set);ee(this,gi,{});ee(this,Xs,!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=qS(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,Wt).has(a)&&l.notification&&!c.includes(a)&&!u[a]){I(this,Wt).add(a),i?.set("notified",[...I(this,Wt)]);let d=Vv(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,Xs)&&this._stateNs){let t=this._stateNs.get("notified")??[];for(let i of t)I(this,Wt).add(i);let r=this._stateNs.get("completed")??{};Z(this,gi,{...r}),Z(this,Xs,!0)}Z(this,hi,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1})),Z(this,fi,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},t=>{this._handleTourEvent(t)})),this._rescanWorkflows()}}_teardownSubscriptions(){var t,r;(t=I(this,hi))==null||t.call(this),Z(this,hi,null),(r=I(this,fi))==null||r.call(this),Z(this,fi,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,Wt).has(r)){I(this,Wt).add(r),i?.set("notified",[...I(this,Wt)]);let l=I(this,dr).get(r);if(l?.meta.notification){let c=Vv(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,gi)[r]=o,i?.set("completed",{...I(this,gi)}),{...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, ${Hv})`,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, ${Bv})`:`var(--se-color-text-secondary, ${US})`,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, ${Hv})`:"rgba(255,255,255,0.12)"},c={color:`var(--se-color-success, ${WS})`},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, ${Bv})`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},l={flexShrink:"0",padding:"2px 6px",border:"none",borderRadius:"4px",background:"transparent",color:`var(--se-color-text-tertiary, ${hd})`,fontSize:"12px",cursor:"pointer",lineHeight:"1"},c={marginBottom:"8px"},u={fontSize:"10px",color:`var(--se-color-text-tertiary, ${hd})`,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, ${hd})`};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
|
-
`}};hi=new WeakMap,fi=new WeakMap,ur=new WeakMap,
|
|
499
|
+
`}};hi=new WeakMap,fi=new WeakMap,ur=new WeakMap,Wt=new WeakMap,gi=new WeakMap,Xs=new WeakMap,dr=new WeakMap,Ys.properties={runtimeRef:{attribute:!1},_workflowEntries:{state:!0},_actionVersion:{state:!0}};typeof window<"u"&&!customElements.get(pi)&&customElements.define(pi,Ys);var Wv={mount(n,e){let t=e?.runtime??null;typeof window<"u"&&!customElements.get(pi)&&customElements.define(pi,Ys);let r=document.createElement(pi);return r.runtimeRef=t,n.appendChild(r),()=>{r.remove()}},update(n,e){let t=n.querySelector(pi);if(!t)return;let r=e?.runtime??null;t.runtimeRef=r}};var ZS=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=Lv(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")}}},GS=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"))}}},KS=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)}}},YS=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=Pv(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()}}},qS=[{kind:"overlays:highlight",executor:WS},{kind:"overlays:pulse",executor:jS},{kind:"overlays:badge",executor:US},{kind:"overlays:tooltip",executor:zS},{kind:"overlays:modal",executor:Mv},{kind:"overlays:tour",executor:Tv},{kind:"overlays:celebrate",executor:Rv}],Dv={id:"adaptive-overlays",version:"1.0.0",name:"Overlays",description:"Tooltips, highlights, badges, modals, celebrations, visual overlays, and workflow tracking",executors:qS,widgets:[{id:"adaptive-overlays:workflow-tracker",component:Fv,metadata:{name:"Workflow Tracker",icon:"\u{1F4CB}",description:"Tracks multi-step workflow progress across tours"}}]};var ZS=[Um,pu,pv,hv,wv,Dv],GS=ZS.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 Hv(n){let e=0;for(let t of GS)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 ja=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 ud=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},mi=class extends ja{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 ud(this.context,this.host))}};var Re="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},Xs={MouseUp:0,MouseDown:1,Click:2,ContextMenu:3,DblClick:4,Focus:5,Blur:6,TouchStart:7,TouchEnd:9},dd={hesitationMs:3e3,hesitationRadiusPx:10,rageClickCount:3,rageClickWindowMs:1e3,rageClickRadiusPx:30,scrollThrashReversals:3,scrollThrashWindowMs:2e3,focusBounceMaxInputs:0,idleMs:5e3,hoverSampleMs:100};var Ua=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===Xs.Focus)this.focused.set(r,{id:r,focusTs:t,inputCount:0});else if(e.data.type===Xs.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:Re,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 za=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:Re,props:{x:this.anchorX,y:this.anchorY,duration_ms:t}}),this.emitted=!0)}};var qa=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?Bv(t):null,i=this.currentElement?Bv(this.currentElement):null;r!==i&&(this.currentElement&&this.hoverStartTs!==null&&this.emit({ts:e,name:Se.UI_HOVER,source:"rrweb",schemaVersion:Re,props:{x:this.lastX,y:this.lastY,duration_ms:e-this.hoverStartTs,element:this.currentElement}}),this.currentElement=t,this.hoverStartTs=e)}};function Bv(n){return`${n.tag_name??""}|${n.attr__id??""}|${(n.classes??[]).join(",")}`}var Za=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:Re,props:{idle_ms:e-this.lastActivityTs}}),this.emitted=!0)}};var Ga=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!==Xs.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:Re,props:{x:t,y:r,clickCount:o.length,duration_ms:i-o[0].ts}}),this.clicks=[])}};var Ka=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:Re,props:{reversals:this.reversals.length,duration_ms:r-this.reversals[0]}}),this.reversals=[])}this.lastDirection=i}this.lastY=t}};var Vv={$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 XS(n){let e=n.event;if(typeof e!="string")return"posthog.unknown";if(Vv[e])return Vv[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 Wv=new Set(["a","button","input","select","textarea"]);function QS(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 JS(n,e){if(e&&Wv.has(e)||!n)return e;for(let t of n){let r=t.tag_name;if(r&&Wv.has(r))return r}return e}function eE(n){let e={},t=n.properties||{},r=t.$elements??(typeof t.$elements_chain=="string"?QS(t.$elements_chain):void 0),i=t.$tag_name??r?.[0]?.tag_name,s=n.event==="$autocapture"||n.event==="$click";return e.tagName=s?JS(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 vi(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:XS(n),source:"posthog",props:eE(n),schemaVersion:Re}}function yi(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 pd(n){return(e,t)=>{if(typeof e!="string")return;let r={event:e,properties:t,timestamp:Date.now()};if(yi(r)){let i=vi(r);n(i)}}}function hd(n){let e={...dd,...n?.config},t=[];function r(d){for(let h of t)h(d)}let i=new za(e,r),s=new Ga(e,r),o=new Ka(e,r),a=new Ua(e,r),l=new Za(e,r),c=new qa(e,r,n?.elementResolver),u=[];return{ingest(d){if(d.kind==="posthog"){let{kind:h,...g}=d;yi(g)&&r(vi(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 Le={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 Ya=3;var Xa=3e4;var nE=0;function fd(n,e){return n.replace(/\{\{props\.(\w+)\}\}/g,(t,r)=>!e||!(r in e)?t:String(e[r]))}function rE(n,e){if(n===e)return!0;try{return new RegExp(e).test(n)}catch{return!1}}function jv(n,e){for(let t of e){let r=t.notifications;if(!(!r||r.length===0))for(let i of r){if(!rE(n.name,i.on))continue;let s=Date.now(),o=i.ttl??8e3;return{notification:{id:`notif-${++nE}-${s}`,title:fd(i.title,n.props),body:i.body?fd(i.body,n.props):void 0,icon:i.icon,tileId:t.id,itemId:i.deepLink?.itemId?fd(i.deepLink.itemId,n.props):void 0,expiresAt:s+o,createdAt:s,ttl:o},rule:i}}}return null}var bi=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=jv(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(Le.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(Le.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:Re}}function iE(n){return Pt(Le.CANVAS_OPENED,{surface:n})}function sE(n){return Pt(Le.CANVAS_CLOSED,{surface:n})}function oE(n,e){return Pt(Le.TILE_VIEWED,{tileId:n,surface:e})}function aE(n,e){return Pt(Le.TILE_EXPANDED,{tileId:n,surface:e})}function lE(n,e){return Pt(Le.TILE_COLLAPSED,{tileId:n,surface:e})}function cE(n,e,t){return Pt(Le.TILE_ACTION,{tileId:n,actionId:e,surface:t})}function uE(n,e){return Pt(Le.OVERLAY_STARTED,{recipeId:n,recipeName:e})}function dE(n,e){return Pt(Le.OVERLAY_COMPLETED,{recipeId:n,recipeName:e})}function pE(n,e,t){return Pt(Le.OVERLAY_DISMISSED,{recipeId:n,recipeName:e,stepIndex:t})}function hE(n,e,t){return Pt(Le.OVERLAY_STEP_VIEWED,{recipeId:n,stepIndex:e,stepTitle:t})}function fE(n,e){let t=n.startsWith("canvas.")?n:`canvas.${n}`;return Pt(t,e)}var _i={canvasOpened:iE,canvasClosed:sE,tileViewed:oE,tileExpanded:aE,tileCollapsed:lE,tileAction:cE,overlayStarted:uE,overlayCompleted:dE,overlayDismissed:pE,overlayStepViewed:hE,custom:fE};function gE(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 Qa=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 bi(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=gE(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=_i.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?_i.canvasOpened("overlay"):_i.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(Le.NOTIFICATION_CLICKED,{notificationId:r.id,tileId:r.tileId,itemId:r.itemId}),this.isOpen||this._toggle(),this.runtimeRef&&r.tileId&&this.runtimeRef.events.publish(Le.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=Dv(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()}}},XS=[{kind:"overlays:highlight",executor:ZS},{kind:"overlays:pulse",executor:GS},{kind:"overlays:badge",executor:KS},{kind:"overlays:tooltip",executor:YS},{kind:"overlays:modal",executor:Fv},{kind:"overlays:tour",executor:Ov},{kind:"overlays:celebrate",executor:Pv}],jv={id:"adaptive-overlays",version:"1.0.0",name:"Overlays",description:"Tooltips, highlights, badges, modals, celebrations, visual overlays, and workflow tracking",executors:XS,widgets:[{id:"adaptive-overlays:workflow-tracker",component:Wv,metadata:{name:"Workflow Tracker",icon:"\u{1F4CB}",description:"Tracks multi-step workflow progress across tours"}}]};var JS=[Km,mu,vv,yv,Av,jv],QS=JS.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 Uv(n){let e=0;for(let t of QS)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 Ua=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 fd=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},mi=class extends Ua{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 fd(this.context,this.host))}};var Ie="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},Js={MouseUp:0,MouseDown:1,Click:2,ContextMenu:3,DblClick:4,Focus:5,Blur:6,TouchStart:7,TouchEnd:9},gd={hesitationMs:3e3,hesitationRadiusPx:10,rageClickCount:3,rageClickWindowMs:1e3,rageClickRadiusPx:30,scrollThrashReversals:3,scrollThrashWindowMs:2e3,focusBounceMaxInputs:0,idleMs:5e3,hoverSampleMs:100};var za=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===Js.Focus)this.focused.set(r,{id:r,focusTs:t,inputCount:0});else if(e.data.type===Js.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:Ie,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 qa=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:Ie,props:{x:this.anchorX,y:this.anchorY,duration_ms:t}}),this.emitted=!0)}};var Za=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?zv(t):null,i=this.currentElement?zv(this.currentElement):null;r!==i&&(this.currentElement&&this.hoverStartTs!==null&&this.emit({ts:e,name:Ee.UI_HOVER,source:"rrweb",schemaVersion:Ie,props:{x:this.lastX,y:this.lastY,duration_ms:e-this.hoverStartTs,element:this.currentElement}}),this.currentElement=t,this.hoverStartTs=e)}};function zv(n){return`${n.tag_name??""}|${n.attr__id??""}|${(n.classes??[]).join(",")}`}var Ga=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:Ie,props:{idle_ms:e-this.lastActivityTs}}),this.emitted=!0)}};var Ka=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!==Js.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:Ie,props:{x:t,y:r,clickCount:o.length,duration_ms:i-o[0].ts}}),this.clicks=[])}};var Ya=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:Ie,props:{reversals:this.reversals.length,duration_ms:r-this.reversals[0]}}),this.reversals=[])}this.lastDirection=i}this.lastY=t}};var qv={$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 nE(n){let e=n.event;if(typeof e!="string")return"posthog.unknown";if(qv[e])return qv[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 Zv=new Set(["a","button","input","select","textarea"]);function rE(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 iE(n,e){if(e&&Zv.has(e)||!n)return e;for(let t of n){let r=t.tag_name;if(r&&Zv.has(r))return r}return e}function sE(n){let e={},t=n.properties||{},r=t.$elements??(typeof t.$elements_chain=="string"?rE(t.$elements_chain):void 0),i=t.$tag_name??r?.[0]?.tag_name,s=n.event==="$autocapture"||n.event==="$click";return e.tagName=s?iE(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 vi(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:nE(n),source:"posthog",props:sE(n),schemaVersion:Ie}}function yi(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 md(n){return(e,t)=>{if(typeof e!="string")return;let r={event:e,properties:t,timestamp:Date.now()};if(yi(r)){let i=vi(r);n(i)}}}function vd(n){let e={...gd,...n?.config},t=[];function r(d){for(let h of t)h(d)}let i=new qa(e,r),s=new Ka(e,r),o=new Ya(e,r),a=new za(e,r),l=new Ga(e,r),c=new Za(e,r,n?.elementResolver),u=[];return{ingest(d){if(d.kind==="posthog"){let{kind:h,...g}=d;yi(g)&&r(vi(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 De={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 Xa=3;var Ja=3e4;var aE=0;function yd(n,e){return n.replace(/\{\{props\.(\w+)\}\}/g,(t,r)=>!e||!(r in e)?t:String(e[r]))}function lE(n,e){if(n===e)return!0;try{return new RegExp(e).test(n)}catch{return!1}}function Gv(n,e){for(let t of e){let r=t.notifications;if(!(!r||r.length===0))for(let i of r){if(!lE(n.name,i.on))continue;let s=Date.now(),o=i.ttl??8e3;return{notification:{id:`notif-${++aE}-${s}`,title:yd(i.title,n.props),body:i.body?yd(i.body,n.props):void 0,icon:i.icon,tileId:t.id,itemId:i.deepLink?.itemId?yd(i.deepLink.itemId,n.props):void 0,expiresAt:s+o,createdAt:s,ttl:o},rule:i}}}return null}var bi=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=Gv(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(De.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(De.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:Ie}}function cE(n){return Ot(De.CANVAS_OPENED,{surface:n})}function uE(n){return Ot(De.CANVAS_CLOSED,{surface:n})}function dE(n,e){return Ot(De.TILE_VIEWED,{tileId:n,surface:e})}function pE(n,e){return Ot(De.TILE_EXPANDED,{tileId:n,surface:e})}function hE(n,e){return Ot(De.TILE_COLLAPSED,{tileId:n,surface:e})}function fE(n,e,t){return Ot(De.TILE_ACTION,{tileId:n,actionId:e,surface:t})}function gE(n,e){return Ot(De.OVERLAY_STARTED,{recipeId:n,recipeName:e})}function mE(n,e){return Ot(De.OVERLAY_COMPLETED,{recipeId:n,recipeName:e})}function vE(n,e,t){return Ot(De.OVERLAY_DISMISSED,{recipeId:n,recipeName:e,stepIndex:t})}function yE(n,e,t){return Ot(De.OVERLAY_STEP_VIEWED,{recipeId:n,stepIndex:e,stepTitle:t})}function bE(n,e){let t=n.startsWith("canvas.")?n:`canvas.${n}`;return Ot(t,e)}var _i={canvasOpened:cE,canvasClosed:uE,tileViewed:dE,tileExpanded:pE,tileCollapsed:hE,tileAction:fE,overlayStarted:gE,overlayCompleted:mE,overlayDismissed:vE,overlayStepViewed:yE,custom:bE};function _E(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 Qa=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 bi(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=_E(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=_i.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?_i.canvasOpened("overlay"):_i.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(De.NOTIFICATION_CLICKED,{notificationId:r.id,tileId:r.tileId,itemId:r.itemId}),this.isOpen||this._toggle(),this.runtimeRef&&r.tileId&&this.runtimeRef.events.publish(De.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
|
-
`}};Qa.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",Qa);function Ja(n,e,t="merge"){return t==="first-match"?mE(n,e):vE(n,e)}function mE(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 Uv([i])}return null}function vE(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:Uv(t)}function Uv(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 gd=!1;function zv(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function md(n){if(zv()){gd=!0;return}gd=n??!1}function yE(){return zv()?!0:gd}function X(n,e,t){yE()&&(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 el(n,e,t){t!==void 0?console.error(`[${n}]`,e,t):console.error(`[${n}]`,e)}var tl="2.15.0";var en="2.0";var bE=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function _E(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):bE.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 xE(n){if(typeof window>"u")return!1;try{return new URL(n).origin===window.location.origin}catch{return!1}}var qv="syntro_config_cache",wE=1440*60*1e3;function Zv(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function kE(n,e){if(Zv())try{let t={config:n,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(qv,JSON.stringify(t))}catch{}}function SE(n){if(!Zv())return null;try{let e=localStorage.getItem(qv);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>wE?null:t.config}catch{return null}}var nl=({configUri:n,experiments:e,featureKey:t})=>{if(n)return n;if(e&&t){let r=e.getFeatureValue?.(t,null);if(r)return r}};function EE(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 hr=({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=EE(e,s,o);if(u.length>0){let d=Ja(e,u);if(d)return X("SmartCanvas Config","Resolved config from variant flags",d),d}}let l=nl({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(!_E(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=r??(xE(l)?"include":"omit");try{let u=await fetch(l,{credentials:c,headers:{"X-SDK-Version":tl,"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&&kE(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 rl=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)}},vd=n=>new rl(n);function se(n,e){return`${n}${Math.round(e*255).toString(16).padStart(2,"0")}`}var dO={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:mu.primary,colorBorderSubtle:mu.secondary,colorSuccess:ye[4],colorSuccessMuted:ye[0],colorWarning:He[4],colorWarningMuted:He[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"},pO={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:He[4],colorWarningMuted:se(He[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 CE(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var Gv={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:ca.primary.backgroundDefault,backgroundHover:ca.primary.backgroundHover,color:ca.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:He[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"}},Kv={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:He[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 Yv(n){let e=n.mode==="light"?Kv:Gv;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 Xv(n,e){let t=e.mode??n.mode??"dark",r=t==="light"?Kv:Gv;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 AE=["canvas","launcher","tile","overlay","notification","content"];function Qv(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 AE){let r=n[t];if(r)for(let[i,s]of Object.entries(r))s!==void 0&&(e[`--sc-${t}-${CE(i)}`]=s)}return e}var An,fr,gr,tn,nn,yd,il,xi=class{constructor(e,t,r){ee(this,nn);ee(this,An);ee(this,fr);ee(this,gr);ee(this,tn);K(this,An,e),K(this,fr,t??{}),K(this,gr,r),K(this,tn,te(this,nn,yd).call(this)),e.addController(this)}get config(){return $(this,tn).config}get mode(){return $(this,tn).mode}get cssVariables(){return $(this,tn).cssVariables}hostConnected(){te(this,nn,il).call(this)}hostDisconnected(){}hostUpdated(){te(this,nn,il).call(this)}setThemeConfig(e,t){K(this,fr,e),K(this,gr,t),K(this,tn,te(this,nn,yd).call(this)),te(this,nn,il).call(this),$(this,An).requestUpdate()}};An=new WeakMap,fr=new WeakMap,gr=new WeakMap,tn=new WeakMap,nn=new WeakSet,yd=function(){let e=$(this,gr)?Xv($(this,gr),$(this,fr)):Yv($(this,fr)),t=Qv(e);return{config:e,mode:e.mode,cssVariables:t}},il=function(){let e=$(this,An).shadowRoot??("renderRoot"in $(this,An)?$(this,An).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,tn).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
|
|
564
|
+
`}};Qa.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",Qa);function el(n,e,t="merge"){return t==="first-match"?xE(n,e):wE(n,e)}function xE(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 Kv([i])}return null}function wE(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:Kv(t)}function Kv(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 bd=!1;function Yv(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function _d(n){if(Yv()){bd=!0;return}bd=n??!1}function kE(){return Yv()?!0:bd}function K(n,e,t){kE()&&(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 tl(n,e,t){t!==void 0?console.error(`[${n}]`,e,t):console.error(`[${n}]`,e)}var nl="2.16.0";var nn="2.0";var SE=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function EE(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 CE(n){if(typeof window>"u")return!1;try{return new URL(n).origin===window.location.origin}catch{return!1}}var Xv="syntro_config_cache",AE=1440*60*1e3;function Jv(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function RE(n,e){if(Jv())try{let t={config:n,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(Xv,JSON.stringify(t))}catch{}}function TE(n){if(!Jv())return null;try{let e=localStorage.getItem(Xv);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>AE?null:t.config}catch{return null}}var rl=({configUri:n,experiments:e,featureKey:t})=>{if(n)return n;if(e&&t){let r=e.getFeatureValue?.(t,null);if(r)return r}};function IE(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 hr=({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=IE(e,s,o);if(u.length>0){let d=el(e,u);if(d)return K("SmartCanvas Config","Resolved config from variant flags",d),d}}let l=rl({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(!EE(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=r??(CE(l)?"include":"omit");try{let u=await fetch(l,{credentials:c,headers:{"X-SDK-Version":nl,"X-SDK-Schema-Version":nn}});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&&RE(d,a),d}catch(u){if(a){let d=TE(a);if(d)return K("SmartCanvas Config","Serving config from offline cache"),d}throw u}};var il=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)}},xd=n=>new il(n);function se(n,e){return`${n}${Math.round(e*255).toString(16).padStart(2,"0")}`}var bO={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:_u.primary,colorBorderSubtle:_u.secondary,colorSuccess:be[4],colorSuccessMuted:be[0],colorWarning:Ve[4],colorWarningMuted:Ve[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"},_O={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:Ve[4],colorWarningMuted:se(Ve[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 $E(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var Qv={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:ua.primary.backgroundDefault,backgroundHover:ua.primary.backgroundHover,color:ua.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:Ve[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"}},ey={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:Ve[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 ty(n){let e=n.mode==="light"?ey:Qv;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 ny(n,e){let t=e.mode??n.mode??"dark",r=t==="light"?ey:Qv;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 ME=["canvas","launcher","tile","overlay","notification","content"];function ry(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 ME){let r=n[t];if(r)for(let[i,s]of Object.entries(r))s!==void 0&&(e[`--sc-${t}-${$E(i)}`]=s)}return e}var An,fr,gr,rn,sn,wd,sl,xi=class{constructor(e,t,r){ee(this,sn);ee(this,An);ee(this,fr);ee(this,gr);ee(this,rn);Z(this,An,e),Z(this,fr,t??{}),Z(this,gr,r),Z(this,rn,te(this,sn,wd).call(this)),e.addController(this)}get config(){return I(this,rn).config}get mode(){return I(this,rn).mode}get cssVariables(){return I(this,rn).cssVariables}hostConnected(){te(this,sn,sl).call(this)}hostDisconnected(){}hostUpdated(){te(this,sn,sl).call(this)}setThemeConfig(e,t){Z(this,fr,e),Z(this,gr,t),Z(this,rn,te(this,sn,wd).call(this)),te(this,sn,sl).call(this),I(this,An).requestUpdate()}};An=new WeakMap,fr=new WeakMap,gr=new WeakMap,rn=new WeakMap,sn=new WeakSet,wd=function(){let e=I(this,gr)?ny(I(this,gr),I(this,fr)):ty(I(this,fr)),t=ry(e);return{config:e,mode:e.mode,cssVariables:t}},sl=function(){let e=I(this,An).shadowRoot??("renderRoot"in I(this,An)?I(this,An).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,rn).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
|
|
565
565
|
`);t.textContent=`:host {
|
|
566
566
|
${r}
|
|
567
|
-
}`};var
|
|
567
|
+
}`};var PE=new Set(["tag_name","$el_text"]);function OE(n){return PE.has(n)||n.startsWith("attr__")}function iy(n,e){return n.equals!==void 0?e===n.equals:n.contains!==void 0?typeof e=="string"&&e.includes(n.contains):!1}function NE(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(OE(i)){let o=r.props?.elements;if(!o||!o.some(l=>iy(s,l[i])))return!1}else if(!iy(s,r.props?.[i]))return!1}return!0}}function sy(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?NE(i):()=>!0,o=typeof r.withinMs=="number";e.register(r.key,s,o)}}function mr(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"&&sy(o.triggerWhen,e)}if(t)for(let r of t){let i=r;i.triggerWhen?.type==="rules"&&sy(i.triggerWhen,e)}}var Rn,wi,Qs,kd,ol=class extends ge{constructor(){super(...arguments);ee(this,Qs);this.component=null;this.props={};ee(this,Rn,null);ee(this,wi,null)}createRenderRoot(){return this}render(){return D`<div></div>`}firstUpdated(){Z(this,wi,this.querySelector("div")),te(this,Qs,kd).call(this)}updated(t){te(this,Qs,kd).call(this)}disconnectedCallback(){super.disconnectedCallback(),I(this,Rn)?.unmount(),Z(this,Rn,null)}};Rn=new WeakMap,wi=new WeakMap,Qs=new WeakSet,kd=function(){if(!I(this,wi)||!this.component)return;let t=window.SynOS;if(!t?.React||!t?.ReactDOM?.createRoot)return;let r=t.React,{createRoot:i}=t.ReactDOM;I(this,Rn)||Z(this,Rn,i(I(this,wi))),I(this,Rn).render(r.createElement(this.component,this.props))},ol.properties={component:{attribute:!1},props:{attribute:!1}};customElements.define("react-bridge",ol);var cy="syntro-runtime",oy="smart-canvas",ay=n=>[...n].sort((e,t)=>(t.priority??0)-(e.priority??0));function ly(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,ki,Nt,vt,Lt,yr,eo,to,no,br,_r,Tn,In,$n,xr,Mn,Si,Ei,ro,xe,uy,dy,Ci,Sd,py,Ed,Cd,Ad,hy,Rd,al,fy,vr=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,ki,null);ee(this,Nt,null);ee(this,vt,null);ee(this,Lt,null);ee(this,yr);ee(this,eo,0);ee(this,to,null);ee(this,no,"[]");ee(this,br,null);ee(this,_r,null);ee(this,Tn,null);ee(this,In,null);ee(this,$n,null);ee(this,xr,()=>{this._pageUrl=window.location.href});ee(this,Mn,null);ee(this,Si,null);ee(this,Ei);ee(this,ro);ee(this,Ci,0);ee(this,al,t=>{I(this,et).toggle()});Z(this,et,xd()),Z(this,yr,!1),Z(this,Ei,new xi(this)),Z(this,ro,new mi(this,{context:cy,initialValue:null}))}connectedCallback(){super.connectedCallback(),this.style.setProperty("font-family","inherit"),Z(this,ki,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,vt,document.createElement("div")),I(this,vt).id="portalRoot",this.shadowRoot.appendChild(I(this,vt)),te(this,xe,Ed).call(this),te(this,xe,Rd).call(this),te(this,xe,Ad).call(this)}disconnectedCallback(){var t,r,i,s,o;super.disconnectedCallback(),(t=I(this,ki))==null||t.call(this),Z(this,ki,null),(r=I(this,_r))==null||r.call(this),Z(this,_r,null),(i=I(this,Tn))==null||i.call(this),Z(this,Tn,null),(s=I(this,In))==null||s.call(this),Z(this,In,null),(o=I(this,$n))==null||o.call(this),Z(this,$n,null),te(this,xe,Cd).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,Mn)?.unmount(),Z(this,Mn,null),I(this,Nt)?.remove(),Z(this,Nt,null),I(this,vt)?.remove(),Z(this,vt,null)}updated(t){var i;t.has("runtime")&&(I(this,ro).setValue(this.runtime??null),te(this,xe,hy).call(this),te(this,xe,Ad).call(this),te(this,xe,Rd).call(this),te(this,xe,Cd).call(this),te(this,xe,Ed).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,uy).call(this),(i=I(this,_r))==null||i.call(this),this.experiments?.onFeaturesChanged&&Z(this,_r,this.experiments.onFeaturesChanged(()=>this._loadConfig()))),(r||t.has("_pageUrl"))&&this._loadConfig(),(t.has("_theme")||t.has("workspaceTheme"))&&I(this,Ei).setThemeConfig(this._theme??{},this.workspaceTheme),(t.has("_configActions")||t.has("_pageUrl"))&&te(this,xe,py).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,yr,!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,Ei).config}
|
|
578
578
|
?launcherAnimate=${!!this._launcher?.animate}
|
|
579
|
-
@canvas-toggle=${
|
|
579
|
+
@canvas-toggle=${I(this,al)}
|
|
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,vt)}getOverlayContainer(){return I(this,Nt)}getShadowRoot(){return this.shadowRoot}mountReactApp(t){Z(this,Si,t),te(this,xe,fy).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,br))return;let t=++hu(this,Ci)._;try{this._isLoading=!0,this._error=void 0;let r=await I(this,br).call(this);if(t!==I(this,Ci))return;K("SmartCanvas Config","Raw config response",r),Z(this,to,r);let i=r.tiles||[];if(i.length>0&&this.runtime?.accumulator&&mr(i,this.runtime.accumulator,r.actions),this.runtime){if(i=await this.runtime.filterTiles(i),t!==I(this,Ci))return;this.experiments&&(i=i.filter(l=>this.experiments.shouldRenderRectangle(l)))}else this.experiments&&(i=i.filter(l=>this.experiments.shouldRenderRectangle(l)));ly(i),K("SmartCanvas Config",`Tile count after filtering: ${i.length}`);let s=r.actions||[],o=JSON.stringify(s),a=o!==I(this,no);a&&Z(this,no,o),this._tiles=ay(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,ki=new WeakMap,Nt=new WeakMap,vt=new WeakMap,Lt=new WeakMap,yr=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakMap,br=new WeakMap,_r=new WeakMap,Tn=new WeakMap,In=new WeakMap,$n=new WeakMap,xr=new WeakMap,Mn=new WeakMap,Si=new WeakMap,Ei=new WeakMap,ro=new WeakMap,xe=new WeakSet,uy=function(){if(this.fetcher)Z(this,br,this.fetcher);else{let t=te(this,xe,dy).call(this);Z(this,br,hr(t))}},dy=function(){return{configUri:this.configUri,experiments:this.experiments,featureKey:this.configUriFeatureKey,configFeatureKey:this.configFeatureKey,credentials:this.fetchCredentials}},Ci=new WeakMap,Sd=async function(){let t=I(this,to);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))),ly(r),this._tiles=ay(r)},py=async function(){if(!this.runtime?.actions)return;if(I(this,yr)){this._configActions.length>0&&Z(this,yr,!1);return}let t=++hu(this,eo)._,r=()=>t!==I(this,eo);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)}},Ed=function(){this.runtime||typeof window>"u"||(window.addEventListener("popstate",I(this,xr)),window.addEventListener("hashchange",I(this,xr)))},Cd=function(){typeof window>"u"||(window.removeEventListener("popstate",I(this,xr)),window.removeEventListener("hashchange",I(this,xr)))},Ad=function(){this.runtime&&(this.runtime.accumulator&&Z(this,Tn,this.runtime.accumulator.subscribe(()=>{te(this,xe,Sd).call(this)})),this.runtime.context&&Z(this,In,this.runtime.context.subscribe(t=>{let r=t.page?.url;r&&r!==this._pageUrl&&(this._pageUrl=r),te(this,xe,Sd).call(this)})))},hy=function(){var t,r;(t=I(this,Tn))==null||t.call(this),Z(this,Tn,null),(r=I(this,In))==null||r.call(this),Z(this,In,null)},Rd=function(){var t;(t=I(this,$n))==null||t.call(this),Z(this,$n,null),this.runtime&&Z(this,$n,this.runtime.events.subscribe({names:["canvas.requestOpen"]},()=>I(this,et).setOpen(!0)))},al=new WeakMap,fy=function(){if(!this.isConnected||!I(this,Si)||!I(this,vt))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,Mn)||Z(this,Mn,i(I(this,vt)));let s=t.SmartCanvasApp,o=t.ShadowRootProvider;if(s&&o){let a={shadowRoot:this.shadowRoot,portalRoot:I(this,vt),overlayContainer:I(this,Nt)},l={...I(this,Si),controller:I(this,et),canvasHost:this};I(this,Mn).render(r.createElement(o,a,r.createElement(s,l)))}},vr.shadowRootOptions={mode:"open",delegatesFocus:!0},vr.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
|
-
`,vr.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
|
+
`,vr.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 io=()=>{typeof window>"u"||customElements.get(oy)||customElements.define(oy,vr)};var ll=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
|
+
`}};ll.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",ll);var LE="#6a59ce",FE="#887ad8",DE="#ffffff",cl=class extends ge{constructor(){super(...arguments);this.isOpen=!1;this.launcherAnimate=!1;this.notificationCount=0;this.position="right";this.launcherIcon=null;this.colorPrimary=LE;this.colorPrimaryHover=FE;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:DE,fontSize:"11px",fontWeight:"700"})}
|
|
729
729
|
>${r}</span>
|
|
730
730
|
</div>
|
|
731
|
-
`}};
|
|
731
|
+
`}};cl.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",cl);var HE={"\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 BE(n,e,t="currentColor"){let r=HE[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 VE=[":toggled",":clicked",":feedback",":navigate",":expanded",":collapsed",":dismissed",":submitted",":interacted",":tip_clicked",":tip_focused"],ul=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=>{VE.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
|
+
${BE(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
|
+
`}};ul.properties={config:{attribute:!1},surface:{type:String},runtimeRef:{attribute:!1},_hovered:{state:!0}};customElements.define("syntro-tile-card",ul);var so=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
|
+
`}};so.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
|
+
`,so.properties={tiles:{type:Array},intervalMs:{type:Number},telemetry:{type:Object},runtimeRef:{type:Object},_index:{type:Number,state:!0}};customElements.define("syntro-tile-wheel",so);var WE={"\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 jE(n,e){let t=WE[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 yt,gy,my,vy,yy,by,oo=class extends ge{constructor(){super(...arguments);ee(this,yt);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,yt,by).call(this,r))}
|
|
834
834
|
</div>
|
|
835
|
-
`}};
|
|
835
|
+
`}};yt=new WeakSet,gy=function(t,r){r.stopPropagation(),this.dispatchEvent(new CustomEvent("notification-dismiss",{detail:{id:t},bubbles:!0,composed:!0}))},my=function(t){this.dispatchEvent(new CustomEvent("notification-click",{detail:{notification:t},bubbles:!0,composed:!0}))},vy=function(t){let r=t.currentTarget;r.style.transform="translateY(-1px)";let i=r.querySelector(".syntro-toast-progress");i&&i.classList.add("paused")},yy=function(t){let r=t.currentTarget;r.style.transform="translateY(0)";let i=r.querySelector(".syntro-toast-progress");i&&i.classList.remove("paused")},by=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=jE(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,yt,vy)}
|
|
840
|
+
@mouseleave=${te(this,yt,yy)}
|
|
841
841
|
>
|
|
842
842
|
<div
|
|
843
843
|
style=${i}
|
|
844
|
-
@click=${()=>te(this,
|
|
844
|
+
@click=${()=>te(this,yt,my).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,yt,gy).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
|
+
`},oo.properties={notifications:{attribute:!1},position:{type:String}},oo.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",so);var Ed=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{}}}},Cd=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{}}}},Ad=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 oo=class{constructor(){this.executors=new Map;for(let{kind:e,executor:t}of du)this.registerCore(e,t);for(let{kind:e,executor:t}of Rm)this.registerCore(e,t);this.registerCore("core:mountWidget",async()=>{throw new Error("core:mountWidget must be handled by ActionEngine")}),this.registerCore("core:sequence",Ed),this.registerCore("core:parallel",Cd),this.registerCore("core:wait",Ad)}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)}},Vt=new oo;function gy(n){return Vt.get(n)}function ul(n){return Vt.has(n)}function Rd(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 Td(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 Id(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>dl&&e.push({code:"HTML_TOO_LONG",message:`HTML content exceeds maximum length of ${dl}`,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 $d(n,e,t){(n.text===void 0||n.text===null)&&e.push({code:"MISSING_TEXT",message:"setText action requires 'text' property",field:"text"})}function Md(n,e,t){!n.attr||typeof n.attr!="string"?e.push({code:"MISSING_ATTR",message:"setAttr action requires 'attr' property",field:"attr"}):(Wd.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 Pd(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 Od(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>pl&&e.push({code:"TOO_MANY_STYLES",message:`Too many styles (${r}). Maximum is ${pl}`,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 Nd(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 Ld(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 Fd(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=Lt(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 Dd(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=Lt(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 Hd(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 Bd(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 Vd(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=Lt(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 Wd=new Set(["onclick","onerror","onload","onmouseover","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"]),dl=5e4,pl=50;function Lt(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(!ul(r)&&r!=="core:mountWidget"){let i=Vt.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":rn(n,e,t);break;case"overlays:badge":rn(n,e,t),Rd(n,e,t);break;case"overlays:tooltip":rn(n,e,t),Td(n,e,t);break;case"overlays:modal":Bd(n,e,t);break;case"content:insertHtml":rn(n,e,t),Id(n,e,t);break;case"content:setText":rn(n,e,t),$d(n,e,t);break;case"content:setAttr":rn(n,e,t),Md(n,e,t);break;case"content:addClass":case"content:removeClass":rn(n,e,t),Pd(n,e,t);break;case"content:setStyle":rn(n,e,t),Od(n,e,t);break;case"core:mountWidget":Nd(n,e,t);break;case"core:wait":Ld(n,e,t);break;case"core:sequence":Fd(n,e,t);break;case"core:parallel":Dd(n,e,t);break;case"overlays:tour":Vd(n,e,t);break;case"navigation:navigate":Hd(n,e,t);break}return{valid:e.length===0,errors:e,warnings:t}}function rn(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 ao(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=Lt(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 HE=0;function hl(n){let{overlayRoot:e,eventBus:t,surfaces:r,anchorResolver:i,waitForAnchor:s,adaptiveId:o,executorRegistry:a=Vt,subscribeNavigation:l,runtime:c}=n,u=new Map,d=new Map;function h(){return`action-${++HE}`}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=Lt(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=ao(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 Lt(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={};ng(p,{BRAND:()=>d1,DIRTY:()=>wr,EMPTY_PATH:()=>jE,INVALID:()=>ne,NEVER:()=>K1,OK:()=>Ze,ParseStatus:()=>Ve,Schema:()=>ae,ZodAny:()=>Nn,ZodArray:()=>ln,ZodBigInt:()=>Sr,ZodBoolean:()=>Er,ZodBranded:()=>co,ZodCatch:()=>Lr,ZodDate:()=>Cr,ZodDefault:()=>Nr,ZodDiscriminatedUnion:()=>ml,ZodEffects:()=>wt,ZodEnum:()=>Pr,ZodError:()=>rt,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>yl,ZodIntersection:()=>Ir,ZodIssueCode:()=>N,ZodLazy:()=>$r,ZodLiteral:()=>Mr,ZodMap:()=>Mi,ZodNaN:()=>Oi,ZodNativeEnum:()=>Or,ZodNever:()=>Ft,ZodNull:()=>Rr,ZodNullable:()=>Ut,ZodNumber:()=>kr,ZodObject:()=>it,ZodOptional:()=>_t,ZodParsedType:()=>q,ZodPipeline:()=>uo,ZodPromise:()=>Ln,ZodReadonly:()=>Fr,ZodRecord:()=>vl,ZodSchema:()=>ae,ZodSet:()=>Pi,ZodString:()=>On,ZodSymbol:()=>Ii,ZodTransformer:()=>wt,ZodTuple:()=>jt,ZodType:()=>ae,ZodUndefined:()=>Ar,ZodUnion:()=>Tr,ZodUnknown:()=>an,ZodVoid:()=>$i,addIssueToContext:()=>B,any:()=>_1,array:()=>S1,bigint:()=>g1,boolean:()=>Cy,coerce:()=>G1,custom:()=>ky,date:()=>m1,datetimeRegex:()=>xy,defaultErrorMap:()=>sn,discriminatedUnion:()=>R1,effect:()=>B1,enum:()=>F1,function:()=>O1,getErrorMap:()=>Ai,getParsedType:()=>Wt,instanceof:()=>h1,intersection:()=>T1,isAborted:()=>fl,isAsync:()=>Ri,isDirty:()=>gl,isValid:()=>Pn,late:()=>p1,lazy:()=>N1,literal:()=>L1,makeIssue:()=>lo,map:()=>M1,nan:()=>f1,nativeEnum:()=>D1,never:()=>w1,null:()=>b1,nullable:()=>W1,number:()=>Ey,object:()=>E1,objectUtil:()=>jd,oboolean:()=>Z1,onumber:()=>q1,optional:()=>V1,ostring:()=>z1,pipeline:()=>U1,preprocess:()=>j1,promise:()=>H1,quotelessJson:()=>BE,record:()=>$1,set:()=>P1,setErrorMap:()=>WE,strictObject:()=>C1,string:()=>Sy,symbol:()=>v1,transformer:()=>B1,tuple:()=>I1,undefined:()=>y1,union:()=>A1,unknown:()=>x1,util:()=>le,void:()=>k1});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 jd;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(jd||(jd={}));var q=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Wt=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"]),BE=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 VE=(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}},sn=VE;var my=sn;function WE(n){my=n}function Ai(){return my}var lo=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}},jE=[];function B(n,e){let t=Ai(),r=lo({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===sn?void 0:sn].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"}),wr=n=>({status:"dirty",value:n}),Ze=n=>({status:"valid",value:n}),fl=n=>n.status==="aborted",gl=n=>n.status==="dirty",Pn=n=>n.status==="valid",Ri=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 xt=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}},vy=(n,e)=>{if(Pn(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 Wt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Wt(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:Wt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ri(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:Wt(e)},i=this._parseSync({data:e,path:r.path,parent:r});return vy(r,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wt(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Pn(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=>Pn(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:Wt(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Ri(i)?i:Promise.resolve(i));return vy(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 wt({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 _t.create(this,this._def)}nullable(){return Ut.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ln.create(this)}promise(){return Ln.create(this,this._def)}or(e){return Tr.create([this,e],this._def)}and(e){return Ir.create(this,e,this._def)}transform(e){return new wt({...oe(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Nr({...oe(this._def),innerType:this,defaultValue:t,typeName:re.ZodDefault})}brand(){return new co({typeName:re.ZodBranded,type:this,...oe(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Lr({...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 uo.create(this,e)}readonly(){return Fr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},UE=/^c[^\s-]{8,}$/i,zE=/^[0-9a-z]+$/,qE=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ZE=/^[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,GE=/^[a-z0-9_-]{21}$/i,KE=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,YE=/^[-+]?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)?)??$/,XE=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,QE="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ud,JE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,e1=/^(?:(?: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])$/,t1=/^(([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]))$/,n1=/^(([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])$/,r1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,i1=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,by="((\\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])))",s1=new RegExp(`^${by}$`);function _y(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 o1(n){return new RegExp(`^${_y(n)}$`)}function xy(n){let e=`${by}T${_y(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 a1(n,e){return!!((e==="v4"||!e)&&JE.test(n)||(e==="v6"||!e)&&t1.test(n))}function l1(n,e){if(!KE.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 c1(n,e){return!!((e==="v4"||!e)&&e1.test(n)||(e==="v6"||!e)&&n1.test(n))}var On=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")XE.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")Ud||(Ud=new RegExp(QE,"u")),Ud.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")ZE.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")GE.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")UE.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")zE.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")qE.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"?xy(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"?s1.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:N.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?o1(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"?YE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"duration",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?a1(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"?l1(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"?c1(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"?r1.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"base64",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?i1.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}};On.create=n=>new On({checks:[],typeName:re.ZodString,coerce:n?.coerce??!1,...oe(n)});function u1(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 kr=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"?u1(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)}};kr.create=n=>new kr({checks:[],typeName:re.ZodNumber,coerce:n?.coerce||!1,...oe(n)});var Sr=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}};Sr.create=n=>new Sr({checks:[],typeName:re.ZodBigInt,coerce:n?.coerce??!1,...oe(n)});var Er=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)}};Er.create=n=>new Er({typeName:re.ZodBoolean,coerce:n?.coerce||!1,...oe(n)});var Cr=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}};Cr.create=n=>new Cr({checks:[],coerce:n?.coerce||!1,typeName:re.ZodDate,...oe(n)});var Ii=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)}};Ii.create=n=>new Ii({typeName:re.ZodSymbol,...oe(n)});var Ar=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)}};Ar.create=n=>new Ar({typeName:re.ZodUndefined,...oe(n)});var Rr=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)}};Rr.create=n=>new Rr({typeName:re.ZodNull,...oe(n)});var Nn=class extends ae{constructor(){super(...arguments),this._any=!0}_parse(e){return Ze(e.data)}};Nn.create=n=>new Nn({typeName:re.ZodAny,...oe(n)});var an=class extends ae{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ze(e.data)}};an.create=n=>new an({typeName:re.ZodUnknown,...oe(n)});var Ft=class extends ae{_parse(e){let t=this._getOrReturnCtx(e);return B(t,{code:N.invalid_type,expected:q.never,received:t.parsedType}),ne}};Ft.create=n=>new Ft({typeName:re.ZodNever,...oe(n)});var $i=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)}};$i.create=n=>new $i({typeName:re.ZodVoid,...oe(n)});var ln=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 xt(t,o,t.path,a)))).then(o=>Ve.mergeArray(r,o));let s=[...t.data].map((o,a)=>i.type._parseSync(new xt(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)}};ln.create=(n,e)=>new ln({type:n,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...oe(e)});function Ti(n){if(n instanceof it){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=_t.create(Ti(r))}return new it({...n._def,shape:()=>e})}else return n instanceof ln?new ln({...n._def,type:Ti(n.element)}):n instanceof _t?_t.create(Ti(n.unwrap())):n instanceof Ut?Ut.create(Ti(n.unwrap())):n instanceof jt?jt.create(n.items.map(e=>Ti(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 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 xt(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: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 xt(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 Ti(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 _t;)s=s._def.innerType;t[r]=s}return new n({...this._def,shape:()=>t})}keyof(){return wy(le.objectKeys(this.shape))}};it.create=(n,e)=>new it({shape:()=>n,unknownKeys:"strip",catchall:Ft.create(),typeName:re.ZodObject,...oe(e)});it.strictCreate=(n,e)=>new it({shape:()=>n,unknownKeys:"strict",catchall:Ft.create(),typeName:re.ZodObject,...oe(e)});it.lazycreate=(n,e)=>new it({shape:n,unknownKeys:"strip",catchall:Ft.create(),typeName:re.ZodObject,...oe(e)});var Tr=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}};Tr.create=(n,e)=>new Tr({options:n,typeName:re.ZodUnion,...oe(e)});var on=n=>n instanceof $r?on(n.schema):n instanceof wt?on(n.innerType()):n instanceof Mr?[n.value]:n instanceof Pr?n.options:n instanceof Or?le.objectValues(n.enum):n instanceof Nr?on(n._def.innerType):n instanceof Ar?[void 0]:n instanceof Rr?[null]:n instanceof _t?[void 0,...on(n.unwrap())]:n instanceof Ut?[null,...on(n.unwrap())]:n instanceof co||n instanceof Fr?on(n.unwrap()):n instanceof Lr?on(n._def.innerType):[],ml=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=on(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 zd(n,e){let t=Wt(n),r=Wt(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=zd(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=zd(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 Ir=class extends ae{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(s,o)=>{if(fl(s)||fl(o))return ne;let a=zd(s.value,o.value);return a.valid?((gl(s)||gl(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}))}};Ir.create=(n,e,t)=>new Ir({left:n,right:e,typeName:re.ZodIntersection,...oe(t)});var jt=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 xt(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})}};jt.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jt({items:n,typeName:re.ZodTuple,rest:null,...oe(e)})};var vl=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 xt(r,a,r.path,a)),value:o._parse(new xt(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:On.create(),valueType:e,typeName:re.ZodRecord,...oe(t)})}},Mi=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 xt(r,a,r.path,[c,"key"])),value:s._parse(new xt(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}}}};Mi.create=(n,e,t)=>new Mi({valueType:e,keyType:n,typeName:re.ZodMap,...oe(t)});var Pi=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 xt(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)}};Pi.create=(n,e)=>new Pi({valueType:n,minSize:null,maxSize:null,typeName:re.ZodSet,...oe(e)});var yl=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 lo({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ai(),sn].filter(c=>!!c),issueData:{code:N.invalid_arguments,argumentsError:l}})}function i(a,l){return lo({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ai(),sn].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 Ln){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:jt.create(e).rest(an.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||jt.create([]).rest(an.create()),returns:t||an.create(),typeName:re.ZodFunction,...oe(r)})}},$r=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})}};$r.create=(n,e)=>new $r({getter:n,typeName:re.ZodLazy,...oe(e)});var Mr=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}};Mr.create=(n,e)=>new Mr({value:n,typeName:re.ZodLiteral,...oe(e)});function wy(n,e){return new Pr({values:n,typeName:re.ZodEnum,...oe(e)})}var Pr=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})}};Pr.create=wy;var Or=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}};Or.create=(n,e)=>new Or({values:n,typeName:re.ZodNativeEnum,...oe(e)});var Ln=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})))}};Ln.create=(n,e)=>new Ln({type:n,typeName:re.ZodPromise,...oe(e)});var wt=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"?wr(l.value):t.value==="dirty"?wr(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"?wr(a.value):t.value==="dirty"?wr(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(!Pn(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=>Pn(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):ne);le.assertNever(i)}};wt.create=(n,e,t)=>new wt({schema:n,typeName:re.ZodEffects,effect:e,...oe(t)});wt.createWithPreprocess=(n,e,t)=>new wt({schema:e,effect:{type:"preprocess",transform:n},typeName:re.ZodEffects,...oe(t)});var _t=class extends ae{_parse(e){return this._getType(e)===q.undefined?Ze(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_t.create=(n,e)=>new _t({innerType:n,typeName:re.ZodOptional,...oe(e)});var Ut=class extends ae{_parse(e){return this._getType(e)===q.null?Ze(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ut.create=(n,e)=>new Ut({innerType:n,typeName:re.ZodNullable,...oe(e)});var Nr=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}};Nr.create=(n,e)=>new Nr({innerType:n,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...oe(e)});var Lr=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 Ri(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}};Lr.create=(n,e)=>new Lr({innerType:n,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...oe(e)});var Oi=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}}};Oi.create=n=>new Oi({typeName:re.ZodNaN,...oe(n)});var d1=Symbol("zod_brand"),co=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}},uo=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(),wr(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})}},Fr=class extends ae{_parse(e){let t=this._def.innerType._parse(e),r=i=>(Pn(i)&&(i.value=Object.freeze(i.value)),i);return Ri(t)?t.then(i=>r(i)):r(t)}unwrap(){return this._def.innerType}};Fr.create=(n,e)=>new Fr({innerType:n,typeName:re.ZodReadonly,...oe(e)});function yy(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function ky(n,e={},t){return n?Nn.create().superRefine((r,i)=>{let s=n(r);if(s instanceof Promise)return s.then(o=>{if(!o){let a=yy(e,r),l=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!s){let o=yy(e,r),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):Nn.create()}var p1={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 h1=(n,e={message:`Input not instance of ${n.name}`})=>ky(t=>t instanceof n,e),Sy=On.create,Ey=kr.create,f1=Oi.create,g1=Sr.create,Cy=Er.create,m1=Cr.create,v1=Ii.create,y1=Ar.create,b1=Rr.create,_1=Nn.create,x1=an.create,w1=Ft.create,k1=$i.create,S1=ln.create,E1=it.create,C1=it.strictCreate,A1=Tr.create,R1=ml.create,T1=Ir.create,I1=jt.create,$1=vl.create,M1=Mi.create,P1=Pi.create,O1=yl.create,N1=$r.create,L1=Mr.create,F1=Pr.create,D1=Or.create,H1=Ln.create,B1=wt.create,V1=_t.create,W1=Ut.create,j1=wt.createWithPreprocess,U1=uo.create,z1=()=>Sy().optional(),q1=()=>Ey().optional(),Z1=()=>Cy().optional(),G1={string:(n=>On.create({...n,coerce:!0})),number:(n=>kr.create({...n,coerce:!0})),boolean:(n=>Er.create({...n,coerce:!0})),bigint:(n=>Sr.create({...n,coerce:!0})),date:(n=>Cr.create({...n,coerce:!0}))};var K1=ne;var Y1=p.object({selector:p.string(),route:p.union([p.string(),p.array(p.string())])}).strict(),Ay=["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"],Ry=p.enum(Ay).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),Ty=["time_on_page","page_views","scroll_depth"],Iy=p.enum(Ty).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");var bl=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"}'),_l=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."),xl=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"}`),wl=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}'),kl=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."),Sl=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.'),El=p.object({type:p.literal("session_metric"),key:Iy,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}'),Cl=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."),Al=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."),Rl=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."),Ni=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."),Li=p.object({events:p.array(Ry).min(1).describe("Event names to count. Use values from the countable events enum."),match:p.record(p.string(),Ni).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."),Tl=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:Li.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"}}}}'),cn=p.discriminatedUnion("type",[bl,_l,xl,wl,kl,Sl,El,Cl,Al,Rl,Tl]),Fi=p.object({conditions:p.array(cn).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."),Di=p.object({type:p.literal("rules"),rules:p.array(Fi).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."),Hi=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."),Bi=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."),Vi=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."),Wi=p.discriminatedUnion("type",[Di,Hi,Bi,Vi]),po=Wi.nullable().optional();var X1=p.object({events:p.array(p.string()),urlContains:p.string().optional(),props:p.record(p.union([p.string(),p.number(),p.boolean()])).optional()}),Q1=p.object({title:p.string().optional(),body:p.string().optional(),icon:p.string().optional()}).nullable().optional();var qd=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.")}),ho=p.object({routes:qd,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 J1(n){return cn.safeParse(n)}function eC(n){return Wi.safeParse(n)}function tC(n){return ho.safeParse(n)}var nC=[{defName:"matchOp",schema:Ni},{defName:"counterDef",schema:Li},{defName:"activationConfig",schema:ho},{defName:"routeFilter",schema:qd},{defName:"ruleStrategy",schema:Di},{defName:"scoreStrategy",schema:Hi},{defName:"modelStrategy",schema:Bi},{defName:"externalStrategy",schema:Vi},{defName:"rule",schema:Fi},{defName:"condition",schema:cn}];var Zd=p.object({tileId:p.string(),itemId:p.string().optional()}).strict(),rC=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:Zd.optional()}).strict(),iC=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:ho.optional(),notifications:p.array(rC).optional()}).strict(),sC=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()}),oC=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()}),aC=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()}),lC=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()}),cC=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()}),uC=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()}),dC=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:sC.optional(),launcher:oC.optional(),tile:aC.optional(),overlay:lC.optional(),notification:cC.optional(),content:uC.optional()}).strict(),pC=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(),QN=p.object({schemaVersion:p.string().optional(),fetchedAt:p.string().datetime(),configVersion:p.string().optional(),canvasTitle:p.string().optional(),tiles:p.array(iC),actions:p.array(p.any()),theme:dC.optional(),launcher:pC.optional(),meta:p.object({verificationSteps:p.array(p.union([p.string(),p.object({text:p.string(),check:cn.optional()})])).optional()}).passthrough().optional()}).strict();var Fe={triggerWhen:po},ut=p.object({selector:p.string(),route:p.union([p.string(),p.array(p.string())])}).strict(),Gd=p.object({color:p.string().optional(),scrimOpacity:p.number().min(0).max(1).optional(),paddingPx:p.number().optional(),radiusPx:p.number().optional()}).strict(),Kd=p.enum(["top-left","top-right","bottom-left","bottom-right"]),Yd=p.enum(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"]),$l=p.object({label:p.string(),actionId:p.string(),primary:p.boolean().optional()}).strict(),Xd=p.object({title:p.string().optional(),body:p.string(),ctaButtons:p.array($l).optional()}).strict(),Qd=p.object({title:p.string().optional(),body:p.string()}).strict(),Jd=p.enum(["before","after","prepend","append","replace"]),ep=p.enum(["immediate","hover","click"]),tp=p.object({widgetId:p.string(),props:p.record(p.unknown()).optional(),priority:p.number().optional()}).strict(),np=p.object({id:p.string(),action:p.any(),route:p.string().optional(),onAction:p.record(p.string()).optional()}).passthrough(),rp=p.enum(["auto","smooth","instant"]),Il=p.enum(["start","center","end","nearest"]),ip=p.object({kind:p.literal("content:setText"),anchorId:ut,text:p.string(),label:p.string().optional()}).extend(Fe).strict(),sp=p.object({kind:p.literal("content:setAttr"),anchorId:ut,attr:p.string(),value:p.string(),label:p.string().optional()}).extend(Fe).strict(),op=p.object({kind:p.literal("content:addClass"),anchorId:ut,className:p.string(),label:p.string().optional()}).extend(Fe).strict(),ap=p.object({kind:p.literal("content:removeClass"),anchorId:ut,className:p.string(),label:p.string().optional()}).extend(Fe).strict(),lp=p.object({kind:p.literal("content:setStyle"),anchorId:ut,styles:p.record(p.string()),label:p.string().optional()}).extend(Fe).strict(),cp=p.object({kind:p.literal("content:insertHtml"),anchorId:ut,html:p.string(),position:Jd,deepLink:Zd.optional(),label:p.string().optional()}).extend(Fe).strict(),up=p.object({kind:p.literal("overlays:highlight"),anchorId:ut,style:Gd.optional(),duration:p.number().optional(),label:p.string().optional()}).extend(Fe).strict(),dp=p.object({kind:p.literal("overlays:pulse"),anchorId:ut,duration:p.number().optional(),label:p.string().optional()}).extend(Fe).strict(),pp=p.object({kind:p.literal("overlays:badge"),anchorId:ut,content:p.string(),position:Kd.optional(),label:p.string().optional()}).extend(Fe).strict(),hp=p.object({kind:p.literal("overlays:tooltip"),anchorId:ut,content:Xd,trigger:ep.optional(),placement:Yd.optional(),waitFor:p.string().optional(),label:p.string().optional()}).extend(Fe).strict(),fp=p.object({kind:p.literal("overlays:modal"),content:Qd,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($l).optional(),waitFor:p.string().optional(),label:p.string().optional()}).extend(Fe).strict(),gp=p.object({kind:p.literal("navigation:scrollTo"),anchorId:ut,behavior:rp.optional(),block:Il.optional(),inline:Il.optional(),label:p.string().optional()}).extend(Fe).strict(),mp=p.object({kind:p.literal("navigation:navigate"),url:p.string(),target:p.enum(["_self","_blank"]).optional(),label:p.string().optional()}).extend(Fe).strict(),vp=p.object({kind:p.literal("core:mountWidget"),slot:p.string(),widget:tp,label:p.string().optional()}).extend(Fe).strict(),yp=p.object({kind:p.literal("core:wait"),durationMs:p.number().min(0).optional(),event:p.string().optional(),label:p.string().optional()}).extend(Fe).strict(),bp=p.object({kind:p.literal("core:sequence"),actions:p.array(p.any()),label:p.string().optional()}).extend(Fe).strict(),_p=p.object({kind:p.literal("core:parallel"),actions:p.array(p.any()),waitFor:p.enum(["all","any"]).optional(),label:p.string().optional()}).extend(Fe).strict(),xp=p.object({kind:p.literal("overlays:tour"),tourId:p.string(),steps:p.array(np).min(1),startStep:p.string().optional(),autoStart:p.boolean().optional(),label:p.string().optional()}).extend(Fe).passthrough(),$y=[{defName:"setText",schema:ip},{defName:"setAttr",schema:sp},{defName:"addClass",schema:op},{defName:"removeClass",schema:ap},{defName:"setStyle",schema:lp},{defName:"insertHtml",schema:cp},{defName:"highlight",schema:up},{defName:"pulse",schema:dp},{defName:"badge",schema:pp},{defName:"tooltip",schema:hp},{defName:"modal",schema:fp},{defName:"scrollTo",schema:gp},{defName:"navigate",schema:mp},{defName:"mountWidget",schema:vp},{defName:"wait",schema:yp},{defName:"sequence",schema:bp},{defName:"parallel",schema:_p},{defName:"tour",schema:xp}];function Ml(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 My={timeout:300,className:"sc-anti-flicker",style:"opacity: 0 !important",hostLoadingSelector:"",waitForHostReady:""};function Py(n={}){let{timeout:e,className:t,style:r,hostLoadingSelector:i,waitForHostReady:s}={...My,...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 Oy(n={}){let{className:e,style:t}={...My,...n};return`
|
|
889
|
+
`;customElements.define("syntro-toast-stack",oo);var Td=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{}}}},Id=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{}}}},$d=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 ao=class{constructor(){this.executors=new Map;for(let{kind:e,executor:t}of gu)this.registerCore(e,t);for(let{kind:e,executor:t}of Pm)this.registerCore(e,t);this.registerCore("core:mountWidget",async()=>{throw new Error("core:mountWidget must be handled by ActionEngine")}),this.registerCore("core:sequence",Td),this.registerCore("core:parallel",Id),this.registerCore("core:wait",$d)}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)}},jt=new ao;function _y(n){return jt.get(n)}function dl(n){return jt.has(n)}function Md(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 Pd(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 Od(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>pl&&e.push({code:"HTML_TOO_LONG",message:`HTML content exceeds maximum length of ${pl}`,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 Nd(n,e,t){(n.text===void 0||n.text===null)&&e.push({code:"MISSING_TEXT",message:"setText action requires 'text' property",field:"text"})}function Ld(n,e,t){!n.attr||typeof n.attr!="string"?e.push({code:"MISSING_ATTR",message:"setAttr action requires 'attr' property",field:"attr"}):(qd.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 Fd(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 Dd(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>hl&&e.push({code:"TOO_MANY_STYLES",message:`Too many styles (${r}). Maximum is ${hl}`,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 Hd(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 Bd(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 Vd(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=Ft(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 Wd(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=Ft(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 jd(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 Ud(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 zd(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=Ft(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 qd=new Set(["onclick","onerror","onload","onmouseover","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"]),pl=5e4,hl=50;function Ft(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(!dl(r)&&r!=="core:mountWidget"){let i=jt.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":on(n,e,t);break;case"overlays:badge":on(n,e,t),Md(n,e,t);break;case"overlays:tooltip":on(n,e,t),Pd(n,e,t);break;case"overlays:modal":Ud(n,e,t);break;case"content:insertHtml":on(n,e,t),Od(n,e,t);break;case"content:setText":on(n,e,t),Nd(n,e,t);break;case"content:setAttr":on(n,e,t),Ld(n,e,t);break;case"content:addClass":case"content:removeClass":on(n,e,t),Fd(n,e,t);break;case"content:setStyle":on(n,e,t),Dd(n,e,t);break;case"core:mountWidget":Hd(n,e,t);break;case"core:wait":Bd(n,e,t);break;case"core:sequence":Vd(n,e,t);break;case"core:parallel":Wd(n,e,t);break;case"overlays:tour":zd(n,e,t);break;case"navigation:navigate":jd(n,e,t);break}return{valid:e.length===0,errors:e,warnings:t}}function on(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 lo(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=Ft(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 UE=0;function fl(n){let{overlayRoot:e,eventBus:t,surfaces:r,anchorResolver:i,waitForAnchor:s,adaptiveId:o,executorRegistry:a=jt,subscribeNavigation:l,runtime:c}=n,u=new Map,d=new Map;function h(){return`action-${++UE}`}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=Ft(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=lo(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 Ft(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={};ag(p,{BRAND:()=>m1,DIRTY:()=>wr,EMPTY_PATH:()=>GE,INVALID:()=>ne,NEVER:()=>eC,OK:()=>Ge,ParseStatus:()=>je,Schema:()=>le,ZodAny:()=>Nn,ZodArray:()=>un,ZodBigInt:()=>Sr,ZodBoolean:()=>Er,ZodBranded:()=>uo,ZodCatch:()=>Lr,ZodDate:()=>Cr,ZodDefault:()=>Nr,ZodDiscriminatedUnion:()=>vl,ZodEffects:()=>xt,ZodEnum:()=>Pr,ZodError:()=>it,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>bl,ZodIntersection:()=>Ir,ZodIssueCode:()=>O,ZodLazy:()=>$r,ZodLiteral:()=>Mr,ZodMap:()=>Mi,ZodNaN:()=>Oi,ZodNativeEnum:()=>Or,ZodNever:()=>Dt,ZodNull:()=>Rr,ZodNullable:()=>qt,ZodNumber:()=>kr,ZodObject:()=>st,ZodOptional:()=>bt,ZodParsedType:()=>q,ZodPipeline:()=>po,ZodPromise:()=>Ln,ZodReadonly:()=>Fr,ZodRecord:()=>yl,ZodSchema:()=>le,ZodSet:()=>Pi,ZodString:()=>On,ZodSymbol:()=>Ii,ZodTransformer:()=>xt,ZodTuple:()=>zt,ZodType:()=>le,ZodUndefined:()=>Ar,ZodUnion:()=>Tr,ZodUnknown:()=>cn,ZodVoid:()=>$i,addIssueToContext:()=>B,any:()=>E1,array:()=>T1,bigint:()=>_1,boolean:()=>$y,coerce:()=>Q1,custom:()=>Ry,date:()=>x1,datetimeRegex:()=>Cy,defaultErrorMap:()=>an,discriminatedUnion:()=>P1,effect:()=>z1,enum:()=>W1,function:()=>H1,getErrorMap:()=>Ai,getParsedType:()=>Ut,instanceof:()=>y1,intersection:()=>O1,isAborted:()=>gl,isAsync:()=>Ri,isDirty:()=>ml,isValid:()=>Pn,late:()=>v1,lazy:()=>B1,literal:()=>V1,makeIssue:()=>co,map:()=>F1,nan:()=>b1,nativeEnum:()=>j1,never:()=>A1,null:()=>S1,nullable:()=>Z1,number:()=>Iy,object:()=>I1,objectUtil:()=>Zd,oboolean:()=>J1,onumber:()=>X1,optional:()=>q1,ostring:()=>Y1,pipeline:()=>K1,preprocess:()=>G1,promise:()=>U1,quotelessJson:()=>zE,record:()=>L1,set:()=>D1,setErrorMap:()=>ZE,strictObject:()=>$1,string:()=>Ty,symbol:()=>w1,transformer:()=>z1,tuple:()=>N1,undefined:()=>k1,union:()=>M1,unknown:()=>C1,util:()=>ce,void:()=>R1});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 Zd;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Zd||(Zd={}));var q=ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ut=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"]),zE=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 qE=(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}},an=qE;var xy=an;function ZE(n){xy=n}function Ai(){return xy}var co=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}},GE=[];function B(n,e){let t=Ai(),r=co({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===an?void 0:an].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"}),wr=n=>({status:"dirty",value:n}),Ge=n=>({status:"valid",value:n}),gl=n=>n.status==="aborted",ml=n=>n.status==="dirty",Pn=n=>n.status==="valid",Ri=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}},wy=(n,e)=>{if(Pn(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 Ut(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ut(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:Ut(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ri(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:Ut(e)},i=this._parseSync({data:e,path:r.path,parent:r});return wy(r,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ut(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Pn(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=>Pn(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:Ut(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Ri(i)?i:Promise.resolve(i));return wy(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 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 qt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return un.create(this)}promise(){return Ln.create(this,this._def)}or(e){return Tr.create([this,e],this._def)}and(e){return Ir.create(this,e,this._def)}transform(e){return new xt({...ae(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Nr({...ae(this._def),innerType:this,defaultValue:t,typeName:re.ZodDefault})}brand(){return new uo({typeName:re.ZodBranded,type:this,...ae(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Lr({...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 po.create(this,e)}readonly(){return Fr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},KE=/^c[^\s-]{8,}$/i,YE=/^[0-9a-z]+$/,XE=/^[0-9A-HJKMNP-TV-Z]{26}$/i,JE=/^[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,QE=/^[a-z0-9_-]{21}$/i,e1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,t1=/^[-+]?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)?)??$/,n1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,r1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Gd,i1=/^(?:(?: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])$/,s1=/^(?:(?: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])$/,o1=/^(([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]))$/,a1=/^(([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])$/,l1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,c1=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Sy="((\\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])))",u1=new RegExp(`^${Sy}$`);function Ey(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 d1(n){return new RegExp(`^${Ey(n)}$`)}function Cy(n){let e=`${Sy}T${Ey(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 p1(n,e){return!!((e==="v4"||!e)&&i1.test(n)||(e==="v6"||!e)&&o1.test(n))}function h1(n,e){if(!e1.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 f1(n,e){return!!((e==="v4"||!e)&&s1.test(n)||(e==="v6"||!e)&&a1.test(n))}var On=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")n1.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")Gd||(Gd=new RegExp(r1,"u")),Gd.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")JE.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")QE.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")KE.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")YE.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")XE.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"?Cy(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"?u1.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:O.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?d1(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"?t1.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"duration",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?p1(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"?h1(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"?f1(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"?l1.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"base64",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?c1.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}};On.create=n=>new On({checks:[],typeName:re.ZodString,coerce:n?.coerce??!1,...ae(n)});function g1(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 kr=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"?g1(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)}};kr.create=n=>new kr({checks:[],typeName:re.ZodNumber,coerce:n?.coerce||!1,...ae(n)});var Sr=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}};Sr.create=n=>new Sr({checks:[],typeName:re.ZodBigInt,coerce:n?.coerce??!1,...ae(n)});var Er=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)}};Er.create=n=>new Er({typeName:re.ZodBoolean,coerce:n?.coerce||!1,...ae(n)});var Cr=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}};Cr.create=n=>new Cr({checks:[],coerce:n?.coerce||!1,typeName:re.ZodDate,...ae(n)});var Ii=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)}};Ii.create=n=>new Ii({typeName:re.ZodSymbol,...ae(n)});var Ar=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)}};Ar.create=n=>new Ar({typeName:re.ZodUndefined,...ae(n)});var Rr=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)}};Rr.create=n=>new Rr({typeName:re.ZodNull,...ae(n)});var Nn=class extends le{constructor(){super(...arguments),this._any=!0}_parse(e){return Ge(e.data)}};Nn.create=n=>new Nn({typeName:re.ZodAny,...ae(n)});var cn=class extends le{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ge(e.data)}};cn.create=n=>new cn({typeName:re.ZodUnknown,...ae(n)});var Dt=class extends le{_parse(e){let t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:q.never,received:t.parsedType}),ne}};Dt.create=n=>new Dt({typeName:re.ZodNever,...ae(n)});var $i=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)}};$i.create=n=>new $i({typeName:re.ZodVoid,...ae(n)});var un=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 _t(t,o,t.path,a)))).then(o=>je.mergeArray(r,o));let s=[...t.data].map((o,a)=>i.type._parseSync(new _t(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)}};un.create=(n,e)=>new un({type:n,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...ae(e)});function Ti(n){if(n instanceof st){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=bt.create(Ti(r))}return new st({...n._def,shape:()=>e})}else return n instanceof un?new un({...n._def,type:Ti(n.element)}):n instanceof bt?bt.create(Ti(n.unwrap())):n instanceof qt?qt.create(Ti(n.unwrap())):n instanceof zt?zt.create(n.items.map(e=>Ti(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 Dt&&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 Dt){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 _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=>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 Ti(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 bt;)s=s._def.innerType;t[r]=s}return new n({...this._def,shape:()=>t})}keyof(){return Ay(ce.objectKeys(this.shape))}};st.create=(n,e)=>new st({shape:()=>n,unknownKeys:"strip",catchall:Dt.create(),typeName:re.ZodObject,...ae(e)});st.strictCreate=(n,e)=>new st({shape:()=>n,unknownKeys:"strict",catchall:Dt.create(),typeName:re.ZodObject,...ae(e)});st.lazycreate=(n,e)=>new st({shape:n,unknownKeys:"strip",catchall:Dt.create(),typeName:re.ZodObject,...ae(e)});var Tr=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}};Tr.create=(n,e)=>new Tr({options:n,typeName:re.ZodUnion,...ae(e)});var ln=n=>n instanceof $r?ln(n.schema):n instanceof xt?ln(n.innerType()):n instanceof Mr?[n.value]:n instanceof Pr?n.options:n instanceof Or?ce.objectValues(n.enum):n instanceof Nr?ln(n._def.innerType):n instanceof Ar?[void 0]:n instanceof Rr?[null]:n instanceof bt?[void 0,...ln(n.unwrap())]:n instanceof qt?[null,...ln(n.unwrap())]:n instanceof uo||n instanceof Fr?ln(n.unwrap()):n instanceof Lr?ln(n._def.innerType):[],vl=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=ln(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 Kd(n,e){let t=Ut(n),r=Ut(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=Kd(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=Kd(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 Ir=class extends le{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(s,o)=>{if(gl(s)||gl(o))return ne;let a=Kd(s.value,o.value);return a.valid?((ml(s)||ml(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}))}};Ir.create=(n,e,t)=>new Ir({left:n,right:e,typeName:re.ZodIntersection,...ae(t)});var zt=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 _t(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})}};zt.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zt({items:n,typeName:re.ZodTuple,rest:null,...ae(e)})};var yl=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 _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?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:On.create(),valueType:e,typeName:re.ZodRecord,...ae(t)})}},Mi=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 _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}}}};Mi.create=(n,e,t)=>new Mi({valueType:e,keyType:n,typeName:re.ZodMap,...ae(t)});var Pi=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 _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)}};Pi.create=(n,e)=>new Pi({valueType:n,minSize:null,maxSize:null,typeName:re.ZodSet,...ae(e)});var bl=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 co({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ai(),an].filter(c=>!!c),issueData:{code:O.invalid_arguments,argumentsError:l}})}function i(a,l){return co({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ai(),an].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 Ln){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:zt.create(e).rest(cn.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||zt.create([]).rest(cn.create()),returns:t||cn.create(),typeName:re.ZodFunction,...ae(r)})}},$r=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})}};$r.create=(n,e)=>new $r({getter:n,typeName:re.ZodLazy,...ae(e)});var Mr=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}};Mr.create=(n,e)=>new Mr({value:n,typeName:re.ZodLiteral,...ae(e)});function Ay(n,e){return new Pr({values:n,typeName:re.ZodEnum,...ae(e)})}var Pr=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})}};Pr.create=Ay;var Or=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}};Or.create=(n,e)=>new Or({values:n,typeName:re.ZodNativeEnum,...ae(e)});var Ln=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})))}};Ln.create=(n,e)=>new Ln({type:n,typeName:re.ZodPromise,...ae(e)});var xt=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"?wr(l.value):t.value==="dirty"?wr(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"?wr(a.value):t.value==="dirty"?wr(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(!Pn(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=>Pn(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):ne);ce.assertNever(i)}};xt.create=(n,e,t)=>new xt({schema:n,typeName:re.ZodEffects,effect:e,...ae(t)});xt.createWithPreprocess=(n,e,t)=>new xt({schema:e,effect:{type:"preprocess",transform:n},typeName:re.ZodEffects,...ae(t)});var bt=class extends le{_parse(e){return this._getType(e)===q.undefined?Ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};bt.create=(n,e)=>new bt({innerType:n,typeName:re.ZodOptional,...ae(e)});var qt=class extends le{_parse(e){return this._getType(e)===q.null?Ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};qt.create=(n,e)=>new qt({innerType:n,typeName:re.ZodNullable,...ae(e)});var Nr=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}};Nr.create=(n,e)=>new Nr({innerType:n,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ae(e)});var Lr=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 Ri(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}};Lr.create=(n,e)=>new Lr({innerType:n,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ae(e)});var Oi=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}}};Oi.create=n=>new Oi({typeName:re.ZodNaN,...ae(n)});var m1=Symbol("zod_brand"),uo=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}},po=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(),wr(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})}},Fr=class extends le{_parse(e){let t=this._def.innerType._parse(e),r=i=>(Pn(i)&&(i.value=Object.freeze(i.value)),i);return Ri(t)?t.then(i=>r(i)):r(t)}unwrap(){return this._def.innerType}};Fr.create=(n,e)=>new Fr({innerType:n,typeName:re.ZodReadonly,...ae(e)});function ky(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Ry(n,e={},t){return n?Nn.create().superRefine((r,i)=>{let s=n(r);if(s instanceof Promise)return s.then(o=>{if(!o){let a=ky(e,r),l=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!s){let o=ky(e,r),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):Nn.create()}var v1={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 y1=(n,e={message:`Input not instance of ${n.name}`})=>Ry(t=>t instanceof n,e),Ty=On.create,Iy=kr.create,b1=Oi.create,_1=Sr.create,$y=Er.create,x1=Cr.create,w1=Ii.create,k1=Ar.create,S1=Rr.create,E1=Nn.create,C1=cn.create,A1=Dt.create,R1=$i.create,T1=un.create,I1=st.create,$1=st.strictCreate,M1=Tr.create,P1=vl.create,O1=Ir.create,N1=zt.create,L1=yl.create,F1=Mi.create,D1=Pi.create,H1=bl.create,B1=$r.create,V1=Mr.create,W1=Pr.create,j1=Or.create,U1=Ln.create,z1=xt.create,q1=bt.create,Z1=qt.create,G1=xt.createWithPreprocess,K1=po.create,Y1=()=>Ty().optional(),X1=()=>Iy().optional(),J1=()=>$y().optional(),Q1={string:(n=>On.create({...n,coerce:!0})),number:(n=>kr.create({...n,coerce:!0})),boolean:(n=>Er.create({...n,coerce:!0})),bigint:(n=>Sr.create({...n,coerce:!0})),date:(n=>Cr.create({...n,coerce:!0}))};var eC=ne;var tC=p.object({selector:p.string(),route:p.union([p.string(),p.array(p.string())])}).strict(),My=["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"],Py=p.enum(My).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),Oy=["time_on_page","page_views","scroll_depth"],Ny=p.enum(Oy).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");var _l=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"}'),xl=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."),wl=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"}`),kl=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}'),Sl=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."),El=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.'),Cl=p.object({type:p.literal("session_metric"),key:Ny,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}'),Al=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."),Rl=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."),Tl=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."),Ni=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."),Li=p.object({events:p.array(Py).min(1).describe("Event names to count. Use values from the countable events enum."),match:p.record(p.string(),Ni).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."),Il=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:Li.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"}}}}'),dn=p.discriminatedUnion("type",[_l,xl,wl,kl,Sl,El,Cl,Al,Rl,Tl,Il]),Fi=p.object({conditions:p.array(dn).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."),Di=p.object({type:p.literal("rules"),rules:p.array(Fi).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."),Hi=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."),Bi=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."),Vi=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."),Wi=p.discriminatedUnion("type",[Di,Hi,Bi,Vi]),ho=Wi.nullable().optional();var nC=p.object({events:p.array(p.string()),urlContains:p.string().optional(),props:p.record(p.union([p.string(),p.number(),p.boolean()])).optional()}),rC=p.object({title:p.string().optional(),body:p.string().optional(),icon:p.string().optional()}).nullable().optional();var Yd=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.")}),fo=p.object({routes:Yd,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 iC(n){return dn.safeParse(n)}function sC(n){return Wi.safeParse(n)}function oC(n){return fo.safeParse(n)}var aC=[{defName:"matchOp",schema:Ni},{defName:"counterDef",schema:Li},{defName:"activationConfig",schema:fo},{defName:"routeFilter",schema:Yd},{defName:"ruleStrategy",schema:Di},{defName:"scoreStrategy",schema:Hi},{defName:"modelStrategy",schema:Bi},{defName:"externalStrategy",schema:Vi},{defName:"rule",schema:Fi},{defName:"condition",schema:dn}];var Xd=p.object({tileId:p.string(),itemId:p.string().optional()}).strict(),lC=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:Xd.optional()}).strict(),cC=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:fo.optional(),notifications:p.array(lC).optional()}).strict(),uC=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()}),dC=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()}),pC=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()}),hC=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()}),fC=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()}),gC=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()}),mC=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:uC.optional(),launcher:dC.optional(),tile:pC.optional(),overlay:hC.optional(),notification:fC.optional(),content:gC.optional()}).strict(),vC=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(),oL=p.object({schemaVersion:p.string().optional(),fetchedAt:p.string().datetime(),configVersion:p.string().optional(),canvasTitle:p.string().optional(),tiles:p.array(cC),actions:p.array(p.any()),theme:mC.optional(),launcher:vC.optional(),meta:p.object({verificationSteps:p.array(p.union([p.string(),p.object({text:p.string(),check:dn.optional()})])).optional()}).passthrough().optional()}).strict();var He={triggerWhen:ho},ut=p.object({selector:p.string(),route:p.union([p.string(),p.array(p.string())])}).strict(),Jd=p.object({color:p.string().optional(),scrimOpacity:p.number().min(0).max(1).optional(),paddingPx:p.number().optional(),radiusPx:p.number().optional()}).strict(),Qd=p.enum(["top-left","top-right","bottom-left","bottom-right"]),ep=p.enum(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"]),Ml=p.object({label:p.string(),actionId:p.string(),primary:p.boolean().optional()}).strict(),tp=p.object({title:p.string().optional(),body:p.string(),ctaButtons:p.array(Ml).optional()}).strict(),np=p.object({title:p.string().optional(),body:p.string()}).strict(),rp=p.enum(["before","after","prepend","append","replace"]),ip=p.enum(["immediate","hover","click"]),sp=p.object({widgetId:p.string(),props:p.record(p.unknown()).optional(),priority:p.number().optional()}).strict(),op=p.object({id:p.string(),action:p.any(),route:p.string().optional(),onAction:p.record(p.string()).optional()}).passthrough(),ap=p.enum(["auto","smooth","instant"]),$l=p.enum(["start","center","end","nearest"]),lp=p.object({kind:p.literal("content:setText"),anchorId:ut,text:p.string(),label:p.string().optional()}).extend(He).strict(),cp=p.object({kind:p.literal("content:setAttr"),anchorId:ut,attr:p.string(),value:p.string(),label:p.string().optional()}).extend(He).strict(),up=p.object({kind:p.literal("content:addClass"),anchorId:ut,className:p.string(),label:p.string().optional()}).extend(He).strict(),dp=p.object({kind:p.literal("content:removeClass"),anchorId:ut,className:p.string(),label:p.string().optional()}).extend(He).strict(),pp=p.object({kind:p.literal("content:setStyle"),anchorId:ut,styles:p.record(p.string()),label:p.string().optional()}).extend(He).strict(),hp=p.object({kind:p.literal("content:insertHtml"),anchorId:ut,html:p.string(),position:rp,deepLink:Xd.optional(),label:p.string().optional()}).extend(He).strict(),fp=p.object({kind:p.literal("overlays:highlight"),anchorId:ut,style:Jd.optional(),duration:p.number().optional(),label:p.string().optional()}).extend(He).strict(),gp=p.object({kind:p.literal("overlays:pulse"),anchorId:ut,duration:p.number().optional(),label:p.string().optional()}).extend(He).strict(),mp=p.object({kind:p.literal("overlays:badge"),anchorId:ut,content:p.string(),position:Qd.optional(),label:p.string().optional()}).extend(He).strict(),vp=p.object({kind:p.literal("overlays:tooltip"),anchorId:ut,content:tp,trigger:ip.optional(),placement:ep.optional(),waitFor:p.string().optional(),label:p.string().optional()}).extend(He).strict(),yp=p.object({kind:p.literal("overlays:modal"),content:np,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(Ml).optional(),waitFor:p.string().optional(),label:p.string().optional()}).extend(He).strict(),bp=p.object({kind:p.literal("navigation:scrollTo"),anchorId:ut,behavior:ap.optional(),block:$l.optional(),inline:$l.optional(),label:p.string().optional()}).extend(He).strict(),_p=p.object({kind:p.literal("navigation:navigate"),url:p.string(),target:p.enum(["_self","_blank"]).optional(),label:p.string().optional()}).extend(He).strict(),xp=p.object({kind:p.literal("core:mountWidget"),slot:p.string(),widget:sp,label:p.string().optional()}).extend(He).strict(),wp=p.object({kind:p.literal("core:wait"),durationMs:p.number().min(0).optional(),event:p.string().optional(),label:p.string().optional()}).extend(He).strict(),kp=p.object({kind:p.literal("core:sequence"),actions:p.array(p.any()),label:p.string().optional()}).extend(He).strict(),Sp=p.object({kind:p.literal("core:parallel"),actions:p.array(p.any()),waitFor:p.enum(["all","any"]).optional(),label:p.string().optional()}).extend(He).strict(),Ep=p.object({kind:p.literal("overlays:tour"),tourId:p.string(),steps:p.array(op).min(1),startStep:p.string().optional(),autoStart:p.boolean().optional(),label:p.string().optional()}).extend(He).passthrough(),Ly=[{defName:"setText",schema:lp},{defName:"setAttr",schema:cp},{defName:"addClass",schema:up},{defName:"removeClass",schema:dp},{defName:"setStyle",schema:pp},{defName:"insertHtml",schema:hp},{defName:"highlight",schema:fp},{defName:"pulse",schema:gp},{defName:"badge",schema:mp},{defName:"tooltip",schema:vp},{defName:"modal",schema:yp},{defName:"scrollTo",schema:bp},{defName:"navigate",schema:_p},{defName:"mountWidget",schema:xp},{defName:"wait",schema:wp},{defName:"sequence",schema:kp},{defName:"parallel",schema:Sp},{defName:"tour",schema:Ep}];function Pl(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 Fy={timeout:300,className:"sc-anti-flicker",style:"opacity: 0 !important",hostLoadingSelector:"",waitForHostReady:""};function Dy(n={}){let{timeout:e,className:t,style:r,hostLoadingSelector:i,waitForHostReady:s}={...Fy,...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 Hy(n={}){let{className:e,style:t}={...Fy,...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 yC=["cdn.syntrologie.com","api.syntrologie.com","dev-api.syntrologie.com","localhost","127.0.0.1",".syntrologie.com"];function By(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 Cp="__syntro_rt_editor_source",Ap="__syntro_rt_editor_conf";function Ol(n,e){try{sessionStorage.setItem(n,JSON.stringify(e))}catch{}}function Vy(n){try{let e=sessionStorage.getItem(n);return e?JSON.parse(e):null}catch{return null}}var Fn,Dn;function mo(){if(Fn==null){let n=typeof window<"u"?window.__SYNTRO_EDITOR_PARAMS__:null;if(n?.token)Fn={token:n.token,api_base:n.apiBase||""},Ol(Cp,Fn),console.log(`[DIAG] getEditorSource: from __SYNTRO_EDITOR_PARAMS__ (token=${Fn.token.slice(0,15)}...)`);else{let e=By("editor_source");if(e)Fn=e,Ol(Cp,e);else{let t=Vy(Cp);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 Nl(){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},Ol(Ap,Dn),console.log(`[DIAG] getEditorConf: from __SYNTRO_EDITOR_PARAMS__ (mode=${Dn.mode})`);else{let e=By("editor_conf");if(e)Dn=e,Ol(Ap,e);else{let t=Vy(Ap);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 bC(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):yC.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 Ll=()=>{let n=Nl();return!mo()?.token||!n?.mode?null:n.mode};function _C(){return mo()?.token??null}function xC(){return mo()?.api_base??null}var go=null,Wy=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(go)return K("Syntro Runtime","Editor SDK load already in progress, waiting..."),go;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=xC(),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=_C(),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"}),!bC(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..."),go=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","================================"),go=null,l(u)},document.head.appendChild(c),K("Syntro Runtime","Script tag appended to <head>")}),go};var Zt=null;function Uy(n){Zt&&Zt!==n?n.appendChild(Zt):Zt=n;let e=n.getRootNode();e instanceof ShadowRoot&&wC(e)}function zy(){return Zt||(Zt=document.createElement("div"),Zt.id="syntro-overlays",Object.assign(Zt.style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),document.body.appendChild(Zt)),Zt}var jy=!1;function wC(n){if(jy)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),Dy=!0}var Ll=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=Py(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&&mr(m.tiles,s.accumulator,m.actions)}catch(m){console.error("[SmartCanvas] Error fetching/applying initial config:",m)}e&&e();let l=Nl();ro();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??hr({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&&Hy(y)}};document.body?v():document.addEventListener("DOMContentLoaded",v,{once:!0}),(l||n.editorUrl)&&(console.log(`[SmartCanvas] Loading editor SDK for ${l??"config"} mode`),Fy(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&&mr(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 Ll(n)}});var Sp="syn_";function ji(n){if(!n.startsWith(Sp))throw new Error("Invalid Syntro token: must start with 'syn_'");let t=n.slice(Sp.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 Fl(n){let e=JSON.stringify(n),t=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return Sp+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 Wy="syntro_segment_attributes";function jy(){if(typeof window>"u")return{};try{let n=localStorage.getItem(Wy);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 Uy(n){if(!(typeof window>"u"))try{localStorage.setItem(Wy,JSON.stringify(n)),X("Syntro Bootstrap","Cached segment attributes:",n)}catch(e){ct("Syntro Bootstrap","Failed to cache segment attributes:",e)}}function zy(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 Ep(){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 Vy="syntro_geo",qy="https://geo.syntrologie.com";async function Cp(n){if(typeof window>"u")return{};try{let e=localStorage.getItem(Vy);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(Vy,JSON.stringify(r))}catch{}return X("Syntro Bootstrap","Geo: fetched from worker:",r),r}}catch{}return{}}var Zy="app:",yC="syntro:",bC=/^[a-z][a-z0-9_]*$/;function Dl(n){if(!n)return{valid:!1,reason:"Event name cannot be empty"};if(n.startsWith(yC))return{valid:!1,reason:'"syntro:" prefix is reserved for internal SDK events'};if(!n.startsWith(Zy))return{valid:!1,reason:`Custom events must start with "app:" prefix. Got: "${n}"`};let e=n.slice(Zy.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(!bC.test(t))return{valid:!1,reason:`Segment "${t}" must be lowercase alphanumeric + underscores. Got: "${n}"`};return{valid:!0}}function _C(n){return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||n===null}function Gy(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)&&!Gy(r,e,t+1))return!1;return!0}function Hl(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(!Gy(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"||_C(r)||e.push(t);return e.length>0?{valid:!0,stripped:e}:{valid:!0}}function Bl(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 mo=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:Re};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let t of this.subscriptions)if(Bl(e,t.filter))try{t.callback(e)}catch(r){console.error("[EventBus] Subscriber error:",r)}}emit(e,t){let r=Dl(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=Hl(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:Re};this.history.push(s),this.history.length>this.maxHistorySize&&this.history.shift();let o=0;for(let l of this.subscriptions)if(Bl(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=>Bl(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=>Bl(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 Ui(n={}){return new mo(n)}var zi=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 Yy={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function Xy(){return Yy}function Ap(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 vo(n,e,t){return t===2?Ap(Ap(n+e)+"")%1e4/1e4:t===1?Ap(e+n)%1e3/1e3:null}function xC(n){return n<=0?[]:new Array(n).fill(1/n)}function Vl(n,e){return n>=e[0]&&n<e[1]}function Qy(n,e){let t=vo("__"+e[0],n,1);return t===null?!1:t>=e[1]&&t<e[2]}function Jy(n,e){for(let t=0;t<e.length;t++)if(Vl(n,e[t]))return t;return-1}function Tp(n){try{let e=n.replace(/([^\\])\//g,"$1\\/");return new RegExp(e)}catch(e){console.error(e);return}}function Wl(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 wC(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 kC(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=>!wC(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=Tp(t);return i?i.test(r.href)||i.test(r.href.substring(r.origin.length)):!1}else if(e==="simple")return kC(r,t);return!1}catch{return!1}}function eb(n,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);let r=xC(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 tb(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 nb(n){try{return n()}catch(e){return console.error(e),!1}}var Rp=n=>Uint8Array.from(atob(n),e=>e.charCodeAt(0));async function Dr(n,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||Yy.SubtleCrypto,!t)throw new Error("No SubtleCrypto implementation found");try{let r=await t.importKey("raw",Rp(e),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=n.split("."),o=await t.decrypt({name:"AES-CBC",iv:Rp(i)},r,Rp(s));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function yo(n){return typeof n=="string"?n:JSON.stringify(n)}function dt(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 rb(){let n;try{n="1.6.4"}catch{n=""}return n}function ib(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 Ky(n){return typeof n=="object"&&n!==null}function jl(n){return n.urlPatterns&&n.variations.some(e=>Ky(e)&&"urlRedirect"in e)?"redirect":n.variations.some(e=>Ky(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function Ul(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},qt=Xy(),qi={fetchFeaturesCall:({host:n,clientKey:e,headers:t})=>qt.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 qt.fetch(`${n}/api/eval/${e}`,i)},eventSourceCall:({host:n,clientKey:e,headers:t})=>t?new qt.EventSource(`${n}/sub/${e}`,{headers:t}):new qt.EventSource(`${n}/sub/${e}`),startIdleListener:()=>{let n;if(!(typeof window<"u"&&typeof document<"u"))return;let t=()=>{document.visibilityState==="visible"?(window.clearTimeout(n),AC()):document.visibilityState==="hidden"&&(n=window.setTimeout(CC,Ge.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(qt.localStorage=globalThis.localStorage)}catch{}var Zi=new Map,sb=!1,un=new Map,zl=new Map,Gi=new Map,Ki=new Set;function ab(n){Object.assign(Ge,n),Ge.backgroundSync||Np()}async function lb({instance:n,timeout:e,skipCache:t,allowStale:r,backgroundSync:i}){return i||(Ge.backgroundSync=!1),RC({instance:n,allowStale:r,timeout:e,skipCache:t})}function EC(n){let e=bo(n),t=Zi.get(e)||new Set;t.add(n),Zi.set(e,t)}function cb(n){Zi.forEach(e=>e.delete(n))}function CC(){Gi.forEach(n=>{n&&(n.state="idle",Pp(n))})}function AC(){Gi.forEach(n=>{n&&n.state==="idle"&&Op(n)})}async function ob(){try{if(!qt.localStorage)return;await qt.localStorage.setItem(Ge.cacheKey,JSON.stringify(Array.from(un.entries())))}catch{}}async function RC({instance:n,allowStale:e,timeout:t,skipCache:r}){let i=bo(n),s=$p(n),o=new Date,a=new Date(o.getTime()-Ge.maxAge+Ge.staleTTL);await TC();let l=!Ge.disableCache&&!r?un.get(s):void 0;return l&&(e||l.staleAt>o)&&l.staleAt>a?(l.sse&&Ki.add(i),l.staleAt<o?Ip(n):Mp(n),{data:l.data,success:!0,source:"cache"}):await Ul(Ip(n),t)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function bo(n){let[e,t]=n.getApiInfo();return`${e}||${t}`}function $p(n){let e=bo(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 TC(){if(!sb){sb=!0;try{if(qt.localStorage){let n=await qt.localStorage.getItem(Ge.cacheKey);if(!Ge.disableCache&&n){let e=JSON.parse(n);e&&Array.isArray(e)&&e.forEach(([t,r])=>{un.set(t,{...r,staleAt:new Date(r.staleAt)})}),ub()}}}catch{}if(!Ge.disableIdleStreams){let n=qi.startIdleListener();n&&(qi.stopIdleListener=n)}}}function ub(){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-Ge.maxEntries),un.size);for(let t=0;t<e;t++)un.delete(n[t].key)}function db(n,e,t){let r=t.dateUpdated||"",i=new Date(Date.now()+Ge.staleTTL),s=Ge.disableCache?void 0:un.get(e);if(s&&r&&s.version===r){s.staleAt=i,ob();return}Ge.disableCache||(un.set(e,{data:t,version:r,staleAt:i,sse:Ki.has(n)}),ub()),ob();let o=Zi.get(n);o&&o.forEach(a=>IC(a,t))}async function IC(n,e){await n.setPayload(e||n.getPayload())}async function Ip(n){let{apiHost:e,apiRequestHeaders:t}=n.getApiHosts(),r=n.getClientKey(),i="isRemoteEval"in n&&n.isRemoteEval(),s=bo(n),o=$p(n),a=zl.get(o);return a||(a=(i?qi.fetchRemoteEvalCall({host:e,clientKey:r,payload:{attributes:n.getAttributes(),forcedVariations:n.getForcedVariations(),forcedFeatures:Array.from(n.getForcedFeatures().entries()),url:n.getUrl()},headers:t}):qi.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"&&Ki.add(s),c.json()}).then(c=>(db(s,o,c),Mp(n),zl.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(zl.delete(o),{data:null,source:"error",success:!1,error:c})),zl.set(o,a)),a}function Mp(n,e=!1){let t=bo(n),r=$p(n),{streamingHost:i,streamingHostRequestHeaders:s}=n.getApiHosts(),o=n.getClientKey();if(e&&Ki.add(t),Ge.backgroundSync&&Ki.has(t)&&qt.EventSource){if(Gi.has(t))return;let a={src:null,host:i,clientKey:o,headers:s,cb:l=>{try{if(l.type==="features-updated"){let c=Zi.get(t);c&&c.forEach(u=>{Ip(u)})}else if(l.type==="features"){let c=JSON.parse(l.data);db(t,r,c)}a.errors=0}catch{pb(a)}},errors:0,state:"active"};Gi.set(t,a),Op(a)}}function pb(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);Pp(n),setTimeout(()=>{["idle","active"].includes(n.state)||Op(n)},Math.min(e,3e5))}}function Pp(n){n.src&&(n.src.onopen=null,n.src.onerror=null,n.src.close(),n.src=null,n.state==="active"&&(n.state="disabled"))}function Op(n){n.src=qi.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=()=>pb(n),n.src.onopen=()=>{n.errors=0}}function $C(n,e){Pp(n),Gi.delete(e)}function Np(){Ki.clear(),Gi.forEach($C),Zi.clear(),qi.stopIdleListener()}function ql(n,e){if(e.streaming){if(!n.getClientKey())throw new Error("Must specify clientKey to enable streaming");e.payload&&Mp(n,!0),EC(n)}}var MC=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,Dp={revert:function(){}},Yl=new Map,Hp=new Set;function PC(n){return n==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[n]}}function Xl(n){var e=Yl.get(n);return e||(e={element:n,attributes:{}},Yl.set(n,e)),e}function Ql(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,PC(e)),o}function Jl(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,hb()):n!==t&&(e.isDirty=!0,hb())}function OC(n){var e=n.originalValue;n.mutations.forEach(function(t){return e=t.mutate(e)}),Jl(GC(e),n)}function NC(n){var e=new Set(n.originalValue.split(/\s+/).filter(Boolean));n.mutations.forEach(function(t){return t.mutate(e)}),Jl(Array.from(e).filter(Boolean).join(" "),n)}function LC(n){var e=n.originalValue;n.mutations.forEach(function(t){return e=t.mutate(e)}),Jl(e,n)}function FC(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 DC(n){var e=n.originalValue;n.mutations.forEach(function(t){var r=t.mutate(),i=FC(r);e=i||e}),Jl(e,n)}var HC=function(e){return e.innerHTML},BC=function(e,t){return e.innerHTML=t};function gb(n){var e=Xl(n);return e.html||(e.html=Ql(n,"html",HC,BC,OC)),e.html}var VC=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},WC=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function mb(n){var e=Xl(n);return e.position||(e.position=Ql(n,"position",VC,WC,DC)),e.position}var jC=function(e,t){return t?e.className=t:e.removeAttribute("class")},UC=function(e){return e.className};function vb(n){var e=Xl(n);return e.classes||(e.classes=Ql(n,"class",UC,jC,NC)),e.classes}var zC=function(e){return function(t){var r;return(r=t.getAttribute(e))!=null?r:null}},qC=function(e){return function(t,r){return r!==null?t.setAttribute(e,r):t.removeAttribute(e)}};function yb(n,e){var t=Xl(n);return t.attributes[e]||(t.attributes[e]=Ql(n,e,zC(e),qC(e),LC)),t.attributes[e]}function ZC(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 Zl;function GC(n){return Zl||(Zl=document.createElement("div")),Zl.innerHTML=n,Zl.innerHTML}function Gl(n,e,t){if(t.isDirty){t.isDirty=!1;var r=t.virtualValue;t.mutations.length||ZC(n,e),t.setValue(n,r)}}function KC(n,e){n.html&&Gl(e,"html",n.html),n.classes&&Gl(e,"class",n.classes),n.position&&Gl(e,"position",n.position),Object.keys(n.attributes).forEach(function(t){Gl(e,t,n.attributes[t])})}function hb(){Yl.forEach(KC)}function YC(n,e){var t=null;n.kind==="html"?t=gb(e):n.kind==="class"?t=vb(e):n.kind==="attribute"?t=yb(e,n.attribute):n.kind==="position"&&(t=mb(e)),t&&(t.mutations.push(n),t.mutationRunner(t))}function XC(n,e){var t=null;if(n.kind==="html"?t=gb(e):n.kind==="class"?t=vb(e):n.kind==="attribute"?t=yb(e,n.attribute):n.kind==="position"&&(t=mb(e)),!!t){var r=t.mutations.indexOf(n);r!==-1&&t.mutations.splice(r,1),t.mutationRunner(t)}}function bb(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),YC(n,r))})}}function QC(n){n.elements.forEach(function(e){return XC(n,e)}),n.elements.clear(),Hp.delete(n)}function fb(){Hp.forEach(bb)}var Lp;function JC(){typeof document>"u"||(Lp||(Lp=new MutationObserver(function(){fb()})),fb(),Lp.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}JC();function ec(n){return typeof document>"u"?Dp:(Hp.add(n),bb(n),{revert:function(){QC(n)}})}function Fp(n,e){return ec({kind:"html",elements:new Set,mutate:e,selector:n})}function _b(n,e){return ec({kind:"position",elements:new Set,mutate:e,selector:n})}function _o(n,e){return ec({kind:"class",elements:new Set,mutate:e,selector:n})}function Kl(n,e,t){return MC.test(e)?e==="class"||e==="className"?_o(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)})}):ec({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:n}):Dp}function eA(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 Fp(e,function(a){return a+(r??"")});if(t==="set")return Fp(e,function(){return r??""})}else if(i==="class"){if(t==="append")return _o(e,function(a){r&&a.add(r)});if(t==="remove")return _o(e,function(a){r&&a.delete(r)});if(t==="set")return _o(e,function(a){a.clear(),r&&a.add(r)})}else if(i==="position"){if(t==="set"&&s)return _b(e,function(){return{insertBeforeSelector:o,parentSelector:s}})}else{if(t==="append")return Kl(e,i,function(a){return a!==null?a+(r??""):r??""});if(t==="set")return Kl(e,i,function(){return r??""});if(t==="remove")return Kl(e,i,function(){return null})}return Dp}var tA={html:Fp,classes:_o,attribute:Kl,position:_b,declarative:eA},xb=tA;var Bp={};function Hn(n,e,t){t=t||{};for(let[r,i]of Object.entries(e))switch(r){case"$or":if(!Sb(n,i,t))return!1;break;case"$nor":if(Sb(n,i,t))return!1;break;case"$and":if(!oA(n,i,t))return!1;break;case"$not":if(Hn(n,i,t))return!1;break;default:if(!xo(i,nA(n,r),t))return!1}return!0}function nA(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 wb(n,e=!1){let t=`${n}${e?"/i":""}`;return Bp[t]||(Bp[t]=new RegExp(n.replace(/([^\\])\//g,"$1\\/"),e?"i":void 0)),Bp[t]}function xo(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)||!Eb(n))return JSON.stringify(e)===JSON.stringify(n);for(let i in n)if(!sA(i,e,n[i],t))return!1;return!0}function Eb(n){let e=Object.keys(n);return e.length>0&&e.filter(t=>t[0]==="$").length===e.length}function rA(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 iA(n,e,t){if(!Array.isArray(n))return!1;let r=Eb(e)?i=>xo(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 Yi(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 kb(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(xo(e[i],n[o],t,r)){s=!0;break}if(!s)return!1}return!0}function sA(n,e,t,r){switch(n){case"$veq":return dt(e)===dt(t);case"$vne":return dt(e)!==dt(t);case"$vgt":return dt(e)>dt(t);case"$vgte":return dt(e)>=dt(t);case"$vlt":return dt(e)<dt(t);case"$vlte":return dt(e)<=dt(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)?Yi(e,t):!1;case"$ini":return Array.isArray(t)?Yi(e,t,!0):!1;case"$inGroup":return Yi(e,r[t]||[]);case"$notInGroup":return!Yi(e,r[t]||[]);case"$nin":return Array.isArray(t)?!Yi(e,t):!1;case"$nini":return Array.isArray(t)?!Yi(e,t,!0):!1;case"$not":return!xo(t,e,r);case"$size":return Array.isArray(e)?xo(t,e.length,r):!1;case"$elemMatch":return iA(e,t,r);case"$all":return Array.isArray(t)?kb(e,t,r):!1;case"$alli":return Array.isArray(t)?kb(e,t,r,!0):!1;case"$regex":try{return wb(t).test(e)}catch{return!1}case"$regexi":try{return wb(t,!0).test(e)}catch{return!1}case"$type":return rA(e)===t;default:return console.error("Unknown operator: "+n),!1}}function Sb(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 oA(n,e,t){for(let r=0;r<e.length;r++)if(!Hn(n,e[r],t))return!1;return!0}var aA="Feature Evaluated",lA="Experiment Viewed";function cA(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 uA(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 Xi(n){try{await n()}catch{}}function Cb(n,e,t){if(n.user.trackedExperiments){let i=rc(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(Xi(()=>i(e,t,n.user)))}if(n.user.trackingCallback){let i=n.user.trackingCallback;r.push(Xi(()=>i(e,t)))}if(n.global.eventLogger){let i=n.global.eventLogger;r.push(Xi(()=>i(lA,{experimentId:e.key,variationId:t.key,hashAttribute:t.hashAttribute,hashValue:t.hashValue},n.user)))}return r}function dA(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;Xi(()=>r(e,t,n.user))}if(n.user.onFeatureUsage){let r=n.user.onFeatureUsage;Xi(()=>r(e,t))}if(n.global.eventLogger){let r=n.global.eventLogger;Xi(()=>r(aA,{feature:e,source:t.source,value:t.value,ruleId:t.source==="defaultValue"?"$default":t.ruleId||"",variationId:t.experimentResult?t.experimentResult.key:""},n.user))}}function tc(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=cA(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=tc(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&&Tb(s.filters,e))continue;if("force"in s){if(s.condition&&!Rb(s.condition,e)||!pA(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=>{!Cb(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}=nc(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 nc(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=hA(n,t),n.urlPatterns&&!Wl(t.user.url||"",n.urlPatterns))return{result:Ee(t,n,-1,!1,e)};let s=tb(r,t.user.url||"",i);if(s!==null)return{result:Ee(t,n,s,!1,e)};let o=uA(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}=Hr(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}=mA({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(Tb(n.filters,t))return{result:Ee(t,n,-1,!1,e)}}else if(n.namespace&&!Qy(l,n.namespace))return{result:Ee(t,n,-1,!1,e)};if(n.include&&!nb(n.include))return{result:Ee(t,n,-1,!1,e)};if(n.condition&&!Rb(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=tc(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&&!gA(n.groups,t))return{result:Ee(t,n,-1,!1,e)}}if(n.url&&!fA(n.url,t))return{result:Ee(t,n,-1,!1,e)};let h=vo(n.seed||r,l,n.hashVersion||1);if(h===null)return{result:Ee(t,n,-1,!1,e)};if(!u){let m=n.ranges||eb(i,n.coverage===void 0?1:n.coverage,n.weights);c=Jy(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}=yA(t,a,yo(l),{[Vp(n.key,n.bucketVersion)]:g.key});m&&(t.user.stickyBucketAssignmentDocs=t.user.stickyBucketAssignmentDocs||{},t.user.stickyBucketAssignmentDocs[y]=k,t.user.saveStickyBucketAssignmentDoc(k))}let v=Cb(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"&&dA(n,e,a),a}function Ab(n){return{...n.user.attributes,...n.user.attributeOverrides}}function Rb(n,e){return Hn(Ab(e),n,e.global.savedGroups||{})}function Tb(n,e){return n.some(t=>{let{hashValue:r}=Hr(e,t.attribute);if(!r)return!0;let i=vo(t.seed,r,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>Vl(i,s))})}function pA(n,e,t,r,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;let{hashValue:a}=Hr(n,t,r);if(!a)return!1;let l=vo(e,a,o||1);return l===null?!1:i?Vl(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}=Hr(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 hA(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=Tp(n.url))),n}function Hr(n,e,t){let r=e||"id",i="",s=Ab(n);return s[r]&&(i=s[r]),!i&&t&&(s[t]&&(i=s[t]),i&&(r=t)),{hashAttribute:r,hashValue:i}}function fA(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 gA(n,e){let t=e.global.groups||{};for(let r=0;r<n.length;r++)if(t[n[r]])return!0;return!1}function mA({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=Vp(e,t),l=vA(n,r,i);if(s>0)for(let d=0;d<s;d++){let h=Vp(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 Vp(n,e){return e=e||0,`${n}__${e}`}function Wp(n,e){return`${n}||${e}`}function vA(n,e,t){if(!n.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:r,hashValue:i}=Hr(n,e),s=Wp(r,yo(i)),{hashAttribute:o,hashValue:a}=Hr(n,t),l=a?Wp(o,yo(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 yA(n,e,t,r){let i=Wp(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 bA(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 Ib(n,e,t){let r=jp(n,t);return e.getAllAssignments(r)}function jp(n,e){let t={};return bA(n,e).forEach(i=>{let{hashValue:s}=Hr(n,i);t[i]=yo(s)}),t}async function $b(n,e,t){if(n={...n},n.encryptedFeatures){try{n.features=JSON.parse(await Dr(n.encryptedFeatures,e,t))}catch(r){console.error(r)}delete n.encryptedFeatures}if(n.encryptedExperiments){try{n.experiments=JSON.parse(await Dr(n.encryptedExperiments,e,t))}catch(r){console.error(r)}delete n.encryptedExperiments}if(n.encryptedSavedGroups){try{n.savedGroups=JSON.parse(await Dr(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 rc(n,e){return e.hashAttribute+e.hashValue+n.key+e.variationId}var Qi=typeof window<"u"&&typeof document<"u",_A=rb(),wo=class{constructor(e){if(e=e||{},this.version=_A,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),Qi&&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,ql(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&ab(e.cacheSettings),e.payload)return await this.setPayload(e.payload),ql(this,e),{success:!0,source:"init"};{let{data:t,...r}=await this._refresh({...e,allowStale:!0});return ql(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 lb({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 Dr(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 Dr(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,cb(this),e.destroyAllStreams&&Np(),this.logs=[],Qi&&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}=nc(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}=nc(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=jl(e);if(l==="redirect"&&s.value.urlRedirect&&e.urlPatterns){let c=e.persistQueryString?ib(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(Wl(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(Qi)Promise.all([...o?[Ul(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&&jl(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 tc(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=>[rc(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(rc(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(Qi?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=jl(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}:Qi?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!Qi)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(xb.declarative(r).revert)}),()=>{t.forEach(r=>r())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),r=await Ib(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=jp(r,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}};var xA="https://experiment.syntrologie.com",Up=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 wo({...e,apiHost:e.apiHost??xA,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 ic(n={}){return new Up(n)}var Pb={growthbook:n=>ic({...n,autoInit:!0})};function Ob(n,e){let t=Pb[n];if(!t)throw new Error(`Unknown experiment provider: ${n}. Supported: ${Object.keys(Pb).join(", ")}`);return t(e)}var wA=["cdn.syntrologie.com","localhost","127.0.0.1"];function kA(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):wA.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 zp=class{constructor(e){this.name="cdn";if(this.url=`${e.baseUrl}/${e.configId}.json`,this.integrity=e.integrity,!kA(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 Nb(n){return new zp(n)}var EA="syntro_exp",CA="syntro_var",qp=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(EA),o=i.get(CA);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:Ja(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 Lb(n){return new qp(n)}var AA="https://cdn.syntrologie.com/configs",Fb={cdn:n=>{if(!n.configId)throw new Error("CDN fetcher requires 'configId' option");return Nb({baseUrl:n.baseUrl??AA,configId:n.configId,integrity:n.integrity})},experiments:n=>{if(!n.featureKey)throw new Error("Experiments fetcher requires 'featureKey' option");return Lb({featureKey:n.featureKey})}};function Db(n,e={}){let t=Fb[n];if(!t)throw new Error(`Unknown config fetcher type: ${n}. Supported: ${Object.keys(Fb).join(", ")}`);return t(e)}var Hb="syntro_session_metrics",ko=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(Hb);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(Hb,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function sc(n={}){return new ko(n)}function RA(){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 Zp(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(Bb(t,r))return}if(e.include){for(let r of e.include)if(Bb(t,r))return r;return}return t}function Bb(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 So=class{constructor(e){this.listeners=new Set;this.cleanupFns=[];if(this.telemetry=e.telemetry,this.routes=e.routes,this.navigation=e.navigation,this.context=RA(),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=Zp(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=Zp(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=Zp(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 oc(n){return new So(n)}function Gp(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 Kp(n,e){let t=[];for(let r of n.conditions){let i=Gp(r,e);if(t.push({condition:r,result:i}),!i)return{matched:!1,conditionResults:t}}return{matched:!0,conditionResults:t}}function Eo(n,e){for(let t=0;t<n.rules.length;t++){let r=n.rules[t],{matched:i,conditionResults:s}=Kp(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 Co(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 Vb(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 Yp(n,e,t={}){let r=Vb(e,t);switch(n.type){case"rules":return Eo(n,r);case"score":return Co(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 Xp(n,e,t={}){let r=Vb(e,t);switch(n.type){case"rules":return Eo(n,r);case"score":return Co(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 ac(n){return{evaluate:(e,t)=>Yp(e,t,n),evaluateSync:(e,t)=>Xp(e,t,n)}}function lc(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 Ji=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 Qp="cooldown:";function Wb(n){return{set(e,t){let r=Qp+e,i=Date.now()+t;n.set(r,i)},isActive(e){return this.remaining(e)>0},remaining(e){let t=Qp+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=Qp+e;n.remove(t)}}}var Ao="dismissed:";function jb(n,e){return{mark(t,r=!1){let i=Ao+t;(r?e:n).set(i,!0)},isDismissed(t){let r=Ao+t;return n.has(r)||e.has(r)},clear(t){let r=Ao+t;n.remove(r),e.remove(r)},clearAll(){for(let t of n.keys())t.startsWith(Ao)&&n.remove(t);for(let t of e.keys())t.startsWith(Ao)&&e.remove(t)}}}var Jp="freq:";function Ub(n){function e(t){let r=Jp+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=Jp+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=Jp+t;n.remove(r)},hasReachedLimit(t,r){return this.count(t)>=r}}}var TA="syntro";function eh(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 Ro(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 To=class{constructor(e={}){this.namespacedStorages=new Map;this.namespace=e.namespace??TA;let t=r=>typeof r=="object"&&r!==null&&typeof r.setItem=="function";typeof window<"u"?(this.session=t(window.sessionStorage)?eh(window.sessionStorage,this.namespace):Ro(this.namespace),this.user=t(window.localStorage)?eh(window.localStorage,this.namespace):Ro(this.namespace)):(this.session=Ro(this.namespace),this.user=Ro(this.namespace)),this.dismissals=jb(this.session,this.user),this.cooldowns=Wb(this.user),this.frequency=Ub(this.session)}ns(e){let t=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(t)){let r=typeof window<"u"&&typeof sessionStorage<"u"?eh(sessionStorage,t):Ro(t);this.namespacedStorages.set(t,r)}return this.namespacedStorages.get(t)}};function cc(n={}){return new To(n)}function es(n){return n.startsWith("inline:")?"inline":n.startsWith("adjacent:")?"adjacent":"static"}function Io(n){return n.startsWith("inline:")?n.slice(7):n.startsWith("adjacent:")?n.slice(9):null}var th={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"}},ts={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:[]},zb={duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"};function uc(n,e,t){let r=th[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 dc(n,e,t){let r=t.placement==="auto"?"bottom":t.placement,i=[Xr(t.offset?{mainAxis:t.offset.y,crossAxis:t.offset.x}:8)];return t.flip!==!1&&i.push(Jr()),t.shift!==!1&&i.push(Qr({padding:8})),n.style.position="absolute",n.style.zIndex="2147483646",Yr(e,n,async()=>{let{x:o,y:a,strategy:l}=await ei(e,n,{placement:r,middleware:i});Object.assign(n.style,{position:l,left:`${o}px`,top:`${a}px`})})}function pc(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 hc(n,e){return e==="none"||ts[e].length===0?null:n.animate(ts[e],zb)}function fc(n,e){if(e==="none"||ts[e].length===0)return Promise.resolve();let t=[...ts[e]].reverse(),r=n.animate(t,zb);return new Promise(i=>{r.onfinish=()=>i(),r.oncancel=()=>i()})}function gc(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 mc(n){switch(es(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 qb(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 IA=0;function vc(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-${++IA}`}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=qb(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=es(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=gc(b,x);L.style.zIndex=String(mc(b));let F;if(R==="static")uc(L,b,E?.constraints),e.appendChild(L);else if(R==="inline"){let M=Io(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=pc(L,V)}else if(R==="adjacent"){let M=Io(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=dc(L,V,E?.position??{placement:"bottom"})}let Z=g(L,w,x);hc(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 fc(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 $o=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()}},yc=new $o;var rh="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(nh(r,i))return!1}if(e.include&&e.include.length>0){for(let i of e.include)if(nh(r,i))return!0;return!1}return!0}function nh(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 Zb(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 nh(t,s)})}function bc(n={}){let{telemetry:e,sessionMetrics:t,routes:r,mode:i="production",namespace:s}=n,o=n.widgets??yc,a=n.executors??Vt,l=n.apps??Hs,c=new Ji,u=oc({telemetry:e,routes:r,navigation:c}),d=n.events??Ui(),h=cc({namespace:s}),g=lc({eventBus:d,stateStore:h}),v=ac({state:h,events:d,sessionMetrics:t,accumulator:g}),f=By(),m=Ml(),y=P=>Zb(P)?m.resolve(P.selector):null,k=async(P,G)=>{if(!Zb(P))return null;try{return await m.waitFor(P.selector,G)}catch{return null}},_=vc({overlayRoot:f,eventBus:d,anchorResolver:y,widgetRegistry:o}),b=hl({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:rh,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($A(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 ns=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 MA(){let n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let t=0;t<16;t++)e+=n[Math.floor(Math.random()*n.length)];return e}var ih=class{constructor(){this.sessionId=MA(),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 _c(){return new ih}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 j_=Array.prototype,Gb=j_.forEach,Kb=j_.indexOf,ht=Ue?.navigator,W=Ue?.document,je=Ue?.location,wh=Ue?.fetch,kh=Ue!=null&&Ue.XMLHttpRequest&&"withCredentials"in new Ue.XMLHttpRequest?Ue.XMLHttpRequest:void 0,Yb=Ue?.AbortController,st=ht?.userAgent,J=C??{},hn={DEBUG:!1,LIB_VERSION:"1.341.0"};function Xb(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 as(n){return function(){var e=this,t=arguments;return new Promise((function(r,i){var s=n.apply(e,t);function o(l){Xb(s,r,i,o,a,"next",l)}function a(l){Xb(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 U_(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 PA=["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"],Qb=function(n,e){if(e===void 0&&(e=[]),!n)return!1;var t=n.toLowerCase();return PA.concat(e).some((r=>{var i=r.toLowerCase();return t.indexOf(i)!==-1}))},OA=["$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 Yc=function(n){return n.trim()},Sh=function(n){return n.replace(/^\$/,"")},NA=Array.isArray,z_=Object.prototype,q_=z_.hasOwnProperty,Xc=z_.toString,fe=NA||function(n){return Xc.call(n)==="[object Array]"},qn=n=>typeof n=="function",Pe=n=>n===Object(n)&&!fe(n),ls=n=>{if(Pe(n)){for(var e in n)if(q_.call(n,e))return!1;return!0}return!1},j=n=>n===void 0,Oe=n=>Xc.call(n)=="[object String]",Eh=n=>Oe(n)&&n.trim().length===0,Dt=n=>n===null,ue=n=>j(n)||Dt(n),bn=n=>Xc.call(n)=="[object Number]"&&n==n,ss=n=>bn(n)&&n>0,yn=n=>Xc.call(n)==="[object Boolean]",LA=n=>n instanceof FormData,FA=n=>ce(OA,n);function Ch(n){return n===null||typeof n!="object"}function Rc(n,e){return Object.prototype.toString.call(n)==="[object "+e+"]"}function Z_(n){return!j(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(n,Event)}var DA=[!0,"true",1,"1","yes"],sh=n=>ce(DA,n),HA=[!1,"false",0,"0","no"];function Gt(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),Gt(i||t,e,t,r))}var Ah=class{constructor(e){this.t={},this.i=e.i,this.o=Gt(e.bucketSize,0,100,e.h),this.m=Gt(e.refillRate,0,this.o,e.h),this.$=Gt(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",Tc="iOS",vn="Android",Qo="Tablet",G_=vn+" "+Qo,K_="iPad",Y_="Apple",X_=Y_+" Watch",Jo="Safari",ps="BlackBerry",Q_="Samsung",J_=Q_+"Browser",e0=Q_+" Internet",jr="Chrome",BA=jr+" OS",t0=jr+" "+Tc,Lf="Internet Explorer",n0=Lf+" "+St,Ff="Opera",VA=Ff+" Mini",Df="Edge",r0="Microsoft "+Df,us="Firefox",i0=us+" "+Tc,ea="Nintendo",ta="PlayStation",ds="Xbox",s0=vn+" "+St,o0=St+" "+Jo,Vo="Windows",Rh=Vo+" Phone",Jb="Nokia",Th="Ouya",a0="Generic",WA=a0+" "+St.toLowerCase(),l0=a0+" "+Qo.toLowerCase(),Ih="Konqueror",Je="(\\d+(\\.\\d+)?)",oh=new RegExp("Version/"+Je),jA=new RegExp(ds,"i"),UA=new RegExp(ta+" \\w+","i"),zA=new RegExp(ea+" \\w+","i"),Hf=new RegExp(ps+"|PlayBook|BB10","i"),qA={"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"},xc,e_,ah,ZA=(n,e)=>e&&ce(e,Y_)||(function(t){return ce(t,Jo)&&!ce(t,jr)&&!ce(t,vn)})(n),c0=function(n,e){return e=e||"",ce(n," OPR/")&&ce(n,"Mini")?VA:ce(n," OPR/")?Ff:Hf.test(n)?ps:ce(n,"IE"+St)||ce(n,"WPDesktop")?n0:ce(n,J_)?e0:ce(n,Df)||ce(n,"Edg/")?r0:ce(n,"FBIOS")?"Facebook "+St:ce(n,"UCWEB")||ce(n,"UCBrowser")?"UC Browser":ce(n,"CriOS")?t0:ce(n,"CrMo")||ce(n,jr)?jr:ce(n,vn)&&ce(n,Jo)?s0:ce(n,"FxiOS")?i0:ce(n.toLowerCase(),Ih.toLowerCase())?Ih:ZA(n,e)?ce(n,St)?o0:Jo:ce(n,us)?us:ce(n,"MSIE")||ce(n,"Trident/")?Lf:ce(n,"Gecko")?us:""},GA={[n0]:[new RegExp("rv:"+Je)],[r0]:[new RegExp(Df+"?\\/"+Je)],[jr]:[new RegExp("("+jr+"|CrMo)\\/"+Je)],[t0]:[new RegExp("CriOS\\/"+Je)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Je)],[Jo]:[oh],[o0]:[oh],[Ff]:[new RegExp("(Opera|OPR)\\/"+Je)],[us]:[new RegExp(us+"\\/"+Je)],[i0]:[new RegExp("FxiOS\\/"+Je)],[Ih]:[new RegExp("Konqueror[:/]?"+Je,"i")],[ps]:[new RegExp(ps+" "+Je),oh],[s0]:[new RegExp("android\\s"+Je,"i")],[e0]:[new RegExp(J_+"\\/"+Je)],[Lf]:[new RegExp("(rv:|MSIE )"+Je)],Mozilla:[new RegExp("rv:"+Je)]},KA=function(n,e){var t=c0(n,e),r=GA[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},t_=[[new RegExp(ds+"; "+ds+" (.*?)[);]","i"),n=>[ds,n&&n[1]||""]],[new RegExp(ea,"i"),[ea,""]],[new RegExp(ta,"i"),[ta,""]],[Hf,[ps,""]],[new RegExp(Vo,"i"),(n,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Rh,""];if(new RegExp(St).test(e)&&!/IEMobile\b/.test(e))return[Vo+" "+St,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var r=t[1],i=qA[r]||"";return/arm/i.test(e)&&(i="RT"),[Vo,i]}return[Vo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,n=>{if(n&&n[3]){var e=[n[3],n[4],n[5]||"0"];return[Tc,e.join(".")]}return[Tc,""]}],[/(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("("+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/,[BA,""]],[/Linux|debian/i,["Linux",""]]],n_=function(n){return zA.test(n)?ea:UA.test(n)?ta:jA.test(n)?ds:new RegExp(Th,"i").test(n)?Th:new RegExp("("+Rh+"|WPDesktop)","i").test(n)?Rh:/iPad/.test(n)?K_:/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(n)?X_:Hf.test(n)?ps:/(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)?vn:G_:new RegExp("(pda|"+St+")","i").test(n)?WA:new RegExp(Qo,"i").test(n)&&!new RegExp(Qo+" pc","i").test(n)?l0:""},YA=n=>n instanceof Error;function XA(n){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return ah&&t.length===e_||(e_=t.length,ah=t.reduce(((r,i)=>{xc||(xc={});var s=xc[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,xc[i]=[c,u];break}}return r}),{})),ah}}var $h=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 as((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 as((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:XA(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)})}},hs="?";function Mh(n,e,t,r,i){var s={platform:n,filename:e,function:t==="<anonymous>"?hs:t,in_app:!0};return j(r)||(s.lineno=r),j(i)||(s.colno=i),s}var u0=(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]:hs,t?"safari-extension:"+e:"safari-web-extension:"+e]:[n,e]},QA=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,JA=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,eR=/\((\S*)(?::(\d+))(?::(\d+))\)/,tR=(n,e)=>{var t=QA.exec(n);if(t){var[,r,i,s]=t;return Mh(e,r,hs,+i,+s)}var o=JA.exec(n);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=eR.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=u0(o[1]||hs,o[2]);return Mh(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},nR=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,rR=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,iR=(n,e)=>{var t=nR.exec(n);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var r=rR.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]||hs;return[s,i]=u0(s,i),Mh(e,i,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},r_=/\(error: (.*)\)/,i_=50;function sR(){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=r_.test(c)?c.replace(r_,"$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>=i_)break}}}return(function(g){if(!g.length)return[];var v=Array.from(g);return v.reverse(),v.slice(0,i_).map((f=>{return z({},f,{filename:f.filename||(m=v,m[m.length-1]||{}).filename,function:f.function||hs});var m}))})(o)}})("web:javascript",tR,iR)}var Ph=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 Rc(e,"DOMException")}isDOMError(e){return Rc(e,"DOMError")}},Oh=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}},Nh=class{constructor(){}match(e){return Rc(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}}},oR=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Lh=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(oR);return i&&(t=i[1],r=i[2]),[t,r]}},aR=["fatal","error","warning","log","info","debug"];function d0(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 Fh=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 Z_(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: "+d0(e)}isSeverityLevel(e){return Oe(e)&&!Eh(e)&&aR.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];if(YA(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Dh=class{match(e){return Z_(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+d0(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},Hh=class{match(e){return Ch(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}}},Bh=class{match(e){return Rc(e,"PromiseRejectionEvent")}coerce(e,t){var r,i=this.getUnhandledRejectionReason(e);return Ch(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(Ch(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}},p0=function(n,e){var{debugEnabled:t}=e===void 0?{}:e,r={k:function(i){if(C&&(hn.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)=>p0(n+" "+i,s)};return r},U=p0("[PostHog.js]"),Te=U.createLogger,lR=Te("[ExternalScriptsLoader]"),s_=(n,e,t)=>{if(n.config.disable_external_dependency_loading)return lR.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);s_(n,s,t)},J.__PosthogExtensions__.loadSiteApp=(n,e,t)=>{var r=n.requestRouter.endpointFor("api",e);s_(n,r,t)};var Ic={};function Zn(n,e,t){if(fe(n)){if(Gb&&n.forEach===Gb)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)===Ic)return}}}function we(n,e,t){if(!ue(n)){if(fe(n))return Zn(n,e,t);if(LA(n)){for(var r of n.entries())if(e.call(t,r[1],r[0])===Ic)return}else for(var i in n)if(q_.call(n,i)&&e.call(t,n[i],i)===Ic)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},gs=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 Cc(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 o_=function(n){try{return n()}catch{return}},cR=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)}}},Bf=function(n){var e={};return we(n,(function(t,r){(Oe(t)&&t.length>0||bn(t))&&(e[r]=t)})),e};function uR(n,e){return t=n,r=s=>Oe(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),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 dR=["herokuapp.com","vercel.app","netlify.app"];function pR(n){var e=n?.hostname;if(!Oe(e))return!1;var t=e.split(".").slice(-2).join(".");for(var r of dR)if(t===r)return!1;return!0}function h0(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 f0="$people_distinct_id",Wo="__alias",jo="__timers",a_="$autocapture_disabled_server_side",Vh="$heatmaps_enabled_server_side",l_="$exception_capture_enabled_server_side",Wh="$error_tracking_suppression_rules",c_="$error_tracking_capture_extension_exceptions",u_="$web_vitals_enabled_server_side",g0="$dead_clicks_enabled_server_side",d_="$product_tours_enabled_server_side",p_="$web_vitals_allowed_metrics",lh="$session_recording_remote_config",$c="$sesid",m0="$session_is_sampled",cs="$enabled_feature_flags",Uo="$early_access_features",jh="$feature_flag_details",zo="$stored_person_properties",Wr="$stored_group_properties",Uh="$surveys",Mc="$flag_call_reported",fn="$user_state",zh="$client_session_props",qh="$capture_rate_limit",Zh="$initial_campaign_params",Gh="$initial_referrer_info",Pc="$initial_person_info",Oc="$epp",v0="__POSTHOG_TOOLBAR__",Mo="$posthog_cookieless",hR=[f0,Wo,"__cmpns",jo,"$session_recording_enabled_server_side",Vh,$c,cs,Wh,fn,Uo,jh,Wr,zo,Uh,Mc,zh,qh,Zh,Gh,Oc,Pc,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function h_(n){return n instanceof Element&&(n.id===v0||!(n.closest==null||!n.closest(".toolbar-global-fade-container")))}function Qc(n){return!!n&&n.nodeType===1}function Gn(n,e){return!!n&&!!n.tagName&&n.tagName.toLowerCase()===e.toLowerCase()}function y0(n){return!!n&&n.nodeType===3}function b0(n){return!!n&&n.nodeType===11}function Vf(n){return n?Yc(n).split(/\s+/):[]}function f_(n){var e=C?.location.href;return!!(e&&n&&n.some((t=>e.match(t))))}function Nc(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 Vf(e)}function _0(n){return ue(n)?null:Yc(n).split(/(\s+)/).filter((e=>na(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ia(n){var e="";return Kh(n)&&!E0(n)&&n.childNodes&&n.childNodes.length&&we(n.childNodes,(function(t){var r;y0(t)&&t.textContent&&(e+=(r=_0(t.textContent))!==null&&r!==void 0?r:"")})),Yc(e)}function x0(n){return j(n.target)?n.srcElement||null:(e=n.target)!=null&&e.shadowRoot?n.composedPath()[0]||null:n.target||null;var e}var Wf=["a","button","form","input","select","textarea","label"];function w0(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 k0(n){var e=n.parentNode;return!(!e||!Qc(e))&&e}var fR=["next","previous","prev",">","<"],g_=10,m_=[".ph-no-rageclick",".ph-no-capture"];function gR(n,e){if(!C||jf(n))return!1;var t,r,i;if(yn(e)?(t=!!e&&m_,r=void 0):(t=(i=e?.css_selector_ignorelist)!==null&&i!==void 0?i:m_,r=e?.content_ignorelist),t===!1)return!1;var{targetElementList:s}=S0(n,!1);return!(function(o,a){if(o===!1||j(o))return!1;var l;if(o===!0)l=fR;else{if(!fe(o))return!1;if(o.length>g_)return U.error("[PostHog] content_ignorelist array cannot exceed "+g_+" 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:ia(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!w0(s,t)}var jf=n=>!n||Gn(n,"html")||!Qc(n),S0=(n,e)=>{if(!C||jf(n))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,r=[n],i=n;i.parentNode&&!Gn(i,"body");)if(b0(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var s=k0(i);if(!s)break;if(e||Wf.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 mR(n,e,t,r,i){var s,o,a,l;if(t===void 0&&(t=void 0),!C||jf(n)||(s=t)!=null&&s.url_allowlist&&!f_(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&f_(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}=S0(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)||!w0(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&&(Wf.indexOf(g)>-1||n.getAttribute("contenteditable")==="true")}}function Kh(n){for(var e=n;e.parentNode&&!Gn(e,"body");e=e.parentNode){var t=Nc(e);if(ce(t,"ph-sensitive")||ce(t,"ph-no-capture"))return!1}if(ce(Nc(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 E0(n){return!!(Gn(n,"input")&&!["button","checkbox","submit","reset"].includes(n.type)||Gn(n,"select")||Gn(n,"textarea")||n.getAttribute("contenteditable")==="true")}var C0="(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})",vR=new RegExp("^(?:"+C0+")$"),yR=new RegExp(C0),A0="\\d{3}-?\\d{2}-?\\d{4}",bR=new RegExp("^("+A0+")$"),_R=new RegExp("("+A0+")");function na(n,e){return e===void 0&&(e=!0),!(ue(n)||Oe(n)&&(n=Yc(n),(e?vR:yR).test((n||"").replace(/[- ]/g,""))||(e?bR:_R).test(n)))}function R0(n){var e=ia(n);return na(e=(e+" "+T0(n)).trim())?e:""}function T0(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=ia(t);e=(e+" "+i).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+T0(t)).trim())}catch(s){U.error("[AutoCapture]",s)}})),e}function xR(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 Cc(l).sort(((u,d)=>{var[h]=u,[g]=d;return h.localeCompare(g)})).forEach((u=>{var[d,h]=u;return c[v_(d.toString())]=v_(h.toString())})),o+=":",o+=Cc(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:wR(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Cc(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 v_(n){return n.replace(/"|\\"/g,'\\"')}function wR(n){var e=n.attr__class;return e?fe(e)?e:Vf(e):void 0}var Lc=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}},Fc=n=>{var e=W?.createElement("a");return j(e)?null:(e.href=n,e)},kR=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)},Dc=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," ")},sa=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},Hc=function(n,e){var t=n.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},ch="$copy_autocapture",y_=Te("[AutoCapture]");function uh(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&&!Qc(e));return e}function ER(n,e,t,r){var i=n.tagName.toLowerCase(),s={tag_name:i};Wf.indexOf(i)>-1&&!t&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=uh(1024,R0(n)):s.$el_text=uh(1024,ia(n)));var o=Nc(n);o.length>0&&(s.classes=o.filter((function(u){return u!==""}))),we(n.attributes,(function(u){var d;if((!E0(n)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(r==null||!r.includes(u.name))&&!e&&na(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=Vf(h).join(" ")),s["attr__"+u.name]=uh(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 CR(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");)b0(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=Kh(b);b.tagName.toLowerCase()==="a"&&(v=b.getAttribute("href"),v=w&&v&&na(v)&&v),ce(Nc(b),"ph-no-capture")&&(f=!0),h.push(ER(b,s,o,a));var E=(function(x){if(!Kh(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&&na(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=R0(n):h[0].$el_text=ia(n)),v){var m,y;h[0].attr__href=v;var k=(m=Fc(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:xR(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 Yh=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Lc(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){y_.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,ch)};Me(W,"copy",t,{capture:!0}),Me(W,"cut",t,{capture:!0})}}}else y_.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({[a_]:!!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[a_],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=x0(e);y0(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())&&gR(i,this.instance.config.rageclick)&&this.O(e,"$rageclick");var s=t===ch;if(i&&mR(i,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=CR(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===ch){var c,u=_0(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 bn(n)&&isFinite(n)&&Math.floor(n)===n});var b_="0123456789abcdef",Xh=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+b_.charAt(this.bytes[t]>>>4)+b_.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}},Qh=class{constructor(){this.A=0,this.j=0,this.D=new Jh}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 Xh.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())}},__,I0=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&&(I0=n=>crypto.getRandomValues(n));var Jh=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(I0(this.N),this.U=0),this.N[this.U++]}},zn=()=>AR().toString(),AR=()=>(__||(__=new Qh)).generate(),Po="",RR=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function TR(n,e){if(e){var t=(function(i,s){if(s===void 0&&(s=W),Po)return Po;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();!Po&&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",Po=c)}return Po})(n);if(!t){var r=(i=>{var s=i.match(RR);return s?s[0]:""})(n);r!==t&&U.info("Warning: cookie subdomain discovery mismatch",r,t),t=r}return t?"; domain=."+t:""}return""}var Zt={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(Zt.q(n))||{}}catch{}return e},G:function(n,e,t,r,i){if(W)try{var s="",o="",a=TR(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{Zt.G(n,"",-1,e)}catch{return}}},dh=null,Ce={H:function(){if(!Dt(dh))return dh;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"),dh=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)}}},IR=["$device_id","distinct_id",$c,m0,Oc,Pc],wc={},$R={H:function(){return!0},B:function(n){U.error("memoryStorage error: "+n)},q:function(n){return wc[n]||null},W:function(n){return wc[n]||null},G:function(n,e){wc[n]=e},V:function(n){delete wc[n]}},Br=null,We={H:function(){if(!Dt(Br))return Br;if(Br=!0,j(C))Br=!1;else try{var n="__support__";We.G(n,"xyz"),We.q(n)!=='"xyz"'&&(Br=!1),We.V(n)}catch{Br=!1}return Br},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)}}},gn=(function(n){return n[n.PENDING=-1]="PENDING",n[n.DENIED=0]="DENIED",n[n.GRANTED=1]="GRANTED",n})({}),ef=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 sh(e)?gn.GRANTED:ce(HA,e)?gn.DENIED:gn.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?Ce:Zt;var t=e==="localStorage"?Zt:Ce;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(sh(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!h0([ht?.doNotTrack,ht?.msDoNotTrack,J.doNotTrack],(e=>sh(e)))}},kc=Te("[Dead Clicks]"),MR=()=>!0,PR=n=>{var e,t=!((e=n.instance.persistence)==null||!e.get_property(g0)),r=n.instance.config.capture_dead_clicks;return yn(r)?r:!!Pe(r)||t},Bc=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({[g0]: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?kc.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),kc.info("starting...")}}else kc.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,kc.info("stopping..."))}},Oo=Te("[ExceptionAutocapture]"),tf=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){Oo.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[l_]),this.dt=new Ah({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:Oo}),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?(Oo.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 Oo.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({[l_]: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)?Oo.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}};function x_(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 nf=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__||x_(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__||x_(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)}}}},ph=Te("[SegmentIntegration]");function OR(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||ph.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()||(ph.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(ph.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 $0="posthog-js";function M0(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 rf=class{constructor(e,t,r,i,s,o){this.name=$0,this.setupOnce=function(a){a(M0(e,{organization:t,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},NR=C!=null&&C.location?Hc(C.location.hash,"__posthog")||Hc(location.hash,"state"):null,w_="_postHogToolbarParams",k_=Te("[Toolbar]"),Un=(function(n){return n[n.UNINITIALIZED=0]="UNINITIALIZED",n[n.LOADING=1]="LOADING",n[n.LOADED=2]="LOADED",n})(Un||{}),sf=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=NR||Hc(e.hash,"__posthog")||Hc(e.hash,"state"),o=s?o_((()=>JSON.parse(atob(decodeURIComponent(s)))))||o_((()=>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(w_)||"{}")).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):k_.warn("No toolbar load function found")}loadToolbar(e){var t=!(W==null||!W.getElementById(v0));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(w_,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 k_.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)}},LR=Te("[TracingHeaders]"),of=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 LR.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)}},Sc="https?://(.*)",ms=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],FR=gs(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ms),oa="<masked>",DR=["li_fat_id"];function P0(n,e,t){if(!W)return{};var r,i=e?gs([],ms,t||[]):[],s=O0(sa(W.URL,i,oa),n),o=(r={},we(DR,(function(a){var l=Zt.q(a);r[a]=l||null})),r);return Ie(o,s)}function O0(n,e){var t=FR.concat(e||[]),r={};return we(t,(function(i){var s=Dc(n,i);r[i]=s||null})),r}function N0(n){var e=(function(s){return s?s.search(Sc+"google.([^/?]*)")===0?"google":s.search(Sc+"bing.com")===0?"bing":s.search(Sc+"yahoo.com")===0?"yahoo":s.search(Sc+"duckduckgo.com")===0?"duckduckgo":null:null})(n),t=e!="yahoo"?"q":"p",r={};if(!Dt(e)){r.$search_engine=e;var i=W?Dc(W.referrer,t):"";i.length&&(r.ph_keyword=i)}return r}function S_(){return navigator.language||navigator.userLanguage}function L0(){return W?.referrer||"$direct"}function F0(n,e){var t=n?gs([],ms,e||[]):[],r=je?.href.substring(0,1e3);return{r:L0().substring(0,1e3),u:r?sa(r,t,oa):void 0}}function D0(n){var e,{r:t,u:r}=n,i={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Fc(t))==null?void 0:e.host};if(r){i.$current_url=r;var s=Fc(r);i.$host=s?.host,i.$pathname=s?.pathname;var o=O0(r);Ie(i,o)}if(t){var a=N0(t);Ie(i,a)}return i}function H0(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function HR(){try{return new Date().getTimezoneOffset()}catch{return}}function BR(n,e){if(!st)return{};var t,r,i,s=n?gs([],ms,e||[]):[],[o,a]=(function(l){for(var c=0;c<t_.length;c++){var[u,d]=t_[c],h=u.exec(l),g=h&&(qn(d)?d(h,l):d);if(g)return g}return["",""]})(st);return Ie(Bf({$os:o,$os_version:a,$browser:c0(st,navigator.vendor),$device:n_(st),$device_type:(r=st,i=n_(r),i===K_||i===G_||i==="Kobo"||i==="Kindle Fire"||i===l0?Qo:i===ea||i===ds||i===ta||i===Th?"Console":i===X_?"Wearable":i?St:"Desktop"),$timezone:H0(),$timezone_offset:HR()}),{$current_url:sa(je?.href,s,oa),$host:je?.host,$pathname:je?.pathname,$raw_user_agent:st.length>1e3?st.substring(0,997)+"...":st,$browser_version:KA(st,navigator.vendor),$browser_language:S_(),$browser_language_prefix:(t=S_(),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=Te("[Web Vitals]"),E_=9e5,af=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[u_]),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[p_])||["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)&&bn(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:E_;return 0<e&&e<=6e4?E_: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: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=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({[u_]:t}),this._instance.persistence.register({[p_]: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?gs([],ms,r||[]):[];return sa(e,i,oa)}Vn.error("Could not determine current URL")}},VR=Te("[Heatmaps]");function C_(n){return Pe(n)&&"clientX"in n&&"clientY"in n&&bn(n.clientX)&&bn(n.clientY)}var lf=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[Vh]),this.rageclicks=new Lc(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;VR.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({[Vh]: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 Bc(this.instance,MR,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&&Qc(u)&&!Gn(u,"body");){if(u===c)return!1;if(ce(l,C?.getComputedStyle(u).position))return!0;u=k0(u)}return!1})(x0(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"),!h_(e.target)&&C_(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){!h_(e.target)&&C_(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?gs([],ms,i||[]):[],o=sa(t,s,oa);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!ls(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},Vc=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:Gt(a/o,0,1,U),g=o<=1?1:Gt(l/o,0,1,U),v=c<=1?1:Gt(u/c,0,1,U),f=c<=1?1:Gt(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 mn=(function(n){return n.GZipJS="gzip-js",n.Base64="base64",n})({}),Et=Uint8Array,et=Uint16Array,fs=Uint32Array,Uf=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]),zf=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]),A_=new Et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),B0=function(n,e){for(var t=new et(31),r=0;r<31;++r)t[r]=e+=1<<n[r-1];var i=new fs(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]},V0=B0(Uf,2),WR=V0[0],cf=V0[1];WR[28]=258,cf[258]=28;for(uf=B0(zf,0)[1],Wc=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,Wc[ke]=((65280&Wn)>>>8|(255&Wn)<<8)>>>1;var Wn,uf,Wc,ke,Ko=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[Wc[d]>>>l]=c}else for(o=new et(r),i=0;i<r;++i)o[i]=Wc[a[n[i]-1]++]>>>15-n[i];return o},Ur=new Et(288);for(ke=0;ke<144;++ke)Ur[ke]=8;for(ke=144;ke<256;++ke)Ur[ke]=9;for(ke=256;ke<280;++ke)Ur[ke]=7;for(ke=280;ke<288;++ke)Ur[ke]=8;var jc=new Et(32);for(ke=0;ke<32;++ke)jc[ke]=5;var jR=Ko(Ur,9,0),UR=Ko(jc,5,0),W0=function(n){return(n/8>>0)+(7&n&&1)},j0=function(n,e,t){(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof et?et:n instanceof fs?fs:Et)(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},No=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},hh=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=df(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]},df=function(n,e,t){return n.s==-1?Math.max(df(n.l,e,t+1),df(n.r,e,t+1)):e[n.s]=t},R_=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]},Lo=function(n,e){for(var t=0,r=0;r<e.length;++r)t+=n[r]*e[r];return t},pf=function(n,e,t){var r=t.length,i=W0(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)},T_=function(n,e,t,r,i,s,o,a,l,c,u){dn(e,u++,t),++i[256];for(var d=hh(i,15),h=d[0],g=d[1],v=hh(s,15),f=v[0],m=v[1],y=R_(h),k=y[0],_=y[1],b=R_(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=hh(x,7),O=I[0],P=I[1],G=19;G>4&&!O[A_[G-1]];--G);var L,F,Z,A,H=c+5<<3,M=Lo(i,Ur)+Lo(s,jc)+o,V=Lo(i,h)+Lo(s,f)+o+14+3*G+Lo(x,O)+(2*x[16]+3*x[17]+7*x[18]);if(H<=M&&H<=V)return pf(e,u,n.subarray(l,l+c));if(dn(e,u,1+(V<M)),u+=2,V<M){L=Ko(h,g,0),F=h,Z=Ko(f,m,0),A=f;var de=Ko(O,P,0);for(dn(e,u,_-257),dn(e,u+5,E-1),dn(e,u+10,G-4),u+=14,R=0;R<G;++R)dn(e,u+3*R,O[A_[R]]);u+=3*G;for(var tt=[k,w],ge=0;ge<2;++ge){var De=tt[ge];for(R=0;R<De.length;++R){var ze=31&De[R];dn(e,u,de[ze]),u+=O[ze],ze>15&&(dn(e,u,De[R]>>>5&127),u+=De[R]>>>12)}}}else L=jR,F=Ur,Z=UR,A=jc;for(R=0;R<a;++R)if(r[R]>255){ze=r[R]>>>18&31,No(e,u,L[ze+257]),u+=F[ze+257],ze>7&&(dn(e,u,r[R]>>>23&31),u+=Uf[ze]);var _n=31&r[R];No(e,u,Z[_n]),u+=A[_n],_n>3&&(No(e,u,r[R]>>>5&8191),u+=zf[_n])}else No(e,u,L[r[R]]),u+=F[r[R]];return No(e,u,L[256]),u+F[256]},zR=new fs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qR=(function(){for(var n=new fs(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(1&t&&3988292384)^t>>>1;n[e]=t}return n})(),ZR=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=pf(g,v,s.subarray(f,m)):(g[f]=u,v=pf(g,v,s.subarray(f,d)))}else{for(var y=zR[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(ou){return(s[ou]^s[ou+1]<<x^s[ou+2]<<R)&b},O=new fs(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=T_(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 De=2,ze=0,_n=_,ft=V-de&32767;if(tt>2&&M==I(f-ft))for(var $e=Math.min(k,tt)-1,iu=Math.min(32767,f),hx=Math.min(258,tt);ft<=iu&&--_n&&V!=de;){if(s[f+De]==s[f+De-ft]){for(var xn=0;xn<hx&&s[f+xn]==s[f+xn-ft];++xn);if(xn>De){if(De=xn,ze=ft,xn>$e)break;var fx=Math.min(ft,xn-2),Xf=0;for(ge=0;ge<fx;++ge){var su=f-ft+ge+32768&32767,Qf=su-w[su]+32768&32767;Qf>Xf&&(Xf=Qf,de=su)}}}ft+=(V=de)-(de=w[V])+32768&32767}if(ze){O[Z++]=268435456|cf[De]<<18|uf[ze];var Jf=31&cf[De],eg=31&uf[ze];F+=Uf[Jf]+zf[eg],++P[257+Jf],++G[eg],A=f+De,++L}else O[Z++]=s[f],++P[s[f]]}}v=T_(s,g,u,O,P,G,F,Z,H,f-H,v)}return j0(h,0,l+W0(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)},fh=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8};function GR(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=qR[255&c^l[u]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),r=n.length;t.p(n);var i,s=ZR(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&&fh(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),fh(s,o-8,t.d()),fh(s,o-4,r),s}var KR=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),jy=!0}var Fl=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=Dy(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&&mr(m.tiles,s.accumulator,m.actions)}catch(m){console.error("[SmartCanvas] Error fetching/applying initial config:",m)}e&&e();let l=Ll();io();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??hr({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&&Uy(y)}};document.body?v():document.addEventListener("DOMContentLoaded",v,{once:!0}),(l||n.editorUrl)&&(console.log(`[SmartCanvas] Loading editor SDK for ${l??"config"} mode`),Wy(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&&mr(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 Fl(n)}});var Rp="syn_";function ji(n){if(!n.startsWith(Rp))throw new Error("Invalid Syntro token: must start with 'syn_'");let t=n.slice(Rp.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 Dl(n){let e=JSON.stringify(n),t=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return Rp+t}function wt(n){if(typeof process<"u"&&process.env)return process.env[n]}var Zy="syntro_segment_attributes";function Gy(){if(typeof window>"u")return{};try{let n=localStorage.getItem(Zy);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 Ky(n){if(!(typeof window>"u"))try{localStorage.setItem(Zy,JSON.stringify(n)),K("Syntro Bootstrap","Cached segment attributes:",n)}catch(e){Qe("Syntro Bootstrap","Failed to cache segment attributes:",e)}}function Yy(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 Tp(){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 qy="syntro_geo",Xy="https://geo.syntrologie.com";async function Ip(n){if(typeof window>"u")return{};try{let e=localStorage.getItem(qy);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(qy,JSON.stringify(r))}catch{}return K("Syntro Bootstrap","Geo: fetched from worker:",r),r}}catch{}return{}}var Jy="app:",kC="syntro:",SC=/^[a-z][a-z0-9_]*$/;function Hl(n){if(!n)return{valid:!1,reason:"Event name cannot be empty"};if(n.startsWith(kC))return{valid:!1,reason:'"syntro:" prefix is reserved for internal SDK events'};if(!n.startsWith(Jy))return{valid:!1,reason:`Custom events must start with "app:" prefix. Got: "${n}"`};let e=n.slice(Jy.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 EC(n){return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||n===null}function Qy(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)&&!Qy(r,e,t+1))return!1;return!0}function Bl(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(!Qy(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"||EC(r)||e.push(t);return e.length>0?{valid:!0,stripped:e}:{valid:!0}}function Vl(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 vo=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:Ie};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let t of this.subscriptions)if(Vl(e,t.filter))try{t.callback(e)}catch(r){console.error("[EventBus] Subscriber error:",r)}}emit(e,t){let r=Hl(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=Bl(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:Ie};this.history.push(s),this.history.length>this.maxHistorySize&&this.history.shift();let o=0;for(let l of this.subscriptions)if(Vl(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=>Vl(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=>Vl(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 Ui(n={}){return new vo(n)}var zi=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 tb={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function nb(){return tb}function $p(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 yo(n,e,t){return t===2?$p($p(n+e)+"")%1e4/1e4:t===1?$p(e+n)%1e3/1e3:null}function CC(n){return n<=0?[]:new Array(n).fill(1/n)}function Wl(n,e){return n>=e[0]&&n<e[1]}function rb(n,e){let t=yo("__"+e[0],n,1);return t===null?!1:t>=e[1]&&t<e[2]}function ib(n,e){for(let t=0;t<e.length;t++)if(Wl(n,e[t]))return t;return-1}function Pp(n){try{let e=n.replace(/([^\\])\//g,"$1\\/");return new RegExp(e)}catch(e){console.error(e);return}}function jl(n,e){if(!e.length)return!1;let t=!1,r=!1;for(let i=0;i<e.length;i++){let s=TC(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 AC(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 RC(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=>!AC(i[0],i[1],i[2]))}catch{return!1}}function TC(n,e,t){try{let r=new URL(n,"https://_");if(e==="regex"){let i=Pp(t);return i?i.test(r.href)||i.test(r.href.substring(r.origin.length)):!1}else if(e==="simple")return RC(r,t);return!1}catch{return!1}}function sb(n,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);let r=CC(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 ob(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 ab(n){try{return n()}catch(e){return console.error(e),!1}}var Mp=n=>Uint8Array.from(atob(n),e=>e.charCodeAt(0));async function Dr(n,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||tb.SubtleCrypto,!t)throw new Error("No SubtleCrypto implementation found");try{let r=await t.importKey("raw",Mp(e),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=n.split("."),o=await t.decrypt({name:"AES-CBC",iv:Mp(i)},r,Mp(s));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function bo(n){return typeof n=="string"?n:JSON.stringify(n)}function dt(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 lb(){let n;try{n="1.6.4"}catch{n=""}return n}function cb(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 eb(n){return typeof n=="object"&&n!==null}function Ul(n){return n.urlPatterns&&n.variations.some(e=>eb(e)&&"urlRedirect"in e)?"redirect":n.variations.some(e=>eb(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function zl(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},Gt=nb(),qi={fetchFeaturesCall:({host:n,clientKey:e,headers:t})=>Gt.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 Gt.fetch(`${n}/api/eval/${e}`,i)},eventSourceCall:({host:n,clientKey:e,headers:t})=>t?new Gt.EventSource(`${n}/sub/${e}`,{headers:t}):new Gt.EventSource(`${n}/sub/${e}`),startIdleListener:()=>{let n;if(!(typeof window<"u"&&typeof document<"u"))return;let t=()=>{document.visibilityState==="visible"?(window.clearTimeout(n),MC()):document.visibilityState==="hidden"&&(n=window.setTimeout($C,Ke.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(Gt.localStorage=globalThis.localStorage)}catch{}var Zi=new Map,ub=!1,pn=new Map,ql=new Map,Gi=new Map,Ki=new Set;function pb(n){Object.assign(Ke,n),Ke.backgroundSync||Hp()}async function hb({instance:n,timeout:e,skipCache:t,allowStale:r,backgroundSync:i}){return i||(Ke.backgroundSync=!1),PC({instance:n,allowStale:r,timeout:e,skipCache:t})}function IC(n){let e=_o(n),t=Zi.get(e)||new Set;t.add(n),Zi.set(e,t)}function fb(n){Zi.forEach(e=>e.delete(n))}function $C(){Gi.forEach(n=>{n&&(n.state="idle",Fp(n))})}function MC(){Gi.forEach(n=>{n&&n.state==="idle"&&Dp(n)})}async function db(){try{if(!Gt.localStorage)return;await Gt.localStorage.setItem(Ke.cacheKey,JSON.stringify(Array.from(pn.entries())))}catch{}}async function PC({instance:n,allowStale:e,timeout:t,skipCache:r}){let i=_o(n),s=Np(n),o=new Date,a=new Date(o.getTime()-Ke.maxAge+Ke.staleTTL);await OC();let l=!Ke.disableCache&&!r?pn.get(s):void 0;return l&&(e||l.staleAt>o)&&l.staleAt>a?(l.sse&&Ki.add(i),l.staleAt<o?Op(n):Lp(n),{data:l.data,success:!0,source:"cache"}):await zl(Op(n),t)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function _o(n){let[e,t]=n.getApiInfo();return`${e}||${t}`}function Np(n){let e=_o(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 OC(){if(!ub){ub=!0;try{if(Gt.localStorage){let n=await Gt.localStorage.getItem(Ke.cacheKey);if(!Ke.disableCache&&n){let e=JSON.parse(n);e&&Array.isArray(e)&&e.forEach(([t,r])=>{pn.set(t,{...r,staleAt:new Date(r.staleAt)})}),gb()}}}catch{}if(!Ke.disableIdleStreams){let n=qi.startIdleListener();n&&(qi.stopIdleListener=n)}}}function gb(){let n=Array.from(pn.entries()).map(([t,r])=>({key:t,staleAt:r.staleAt.getTime()})).sort((t,r)=>t.staleAt-r.staleAt),e=Math.min(Math.max(0,pn.size-Ke.maxEntries),pn.size);for(let t=0;t<e;t++)pn.delete(n[t].key)}function mb(n,e,t){let r=t.dateUpdated||"",i=new Date(Date.now()+Ke.staleTTL),s=Ke.disableCache?void 0:pn.get(e);if(s&&r&&s.version===r){s.staleAt=i,db();return}Ke.disableCache||(pn.set(e,{data:t,version:r,staleAt:i,sse:Ki.has(n)}),gb()),db();let o=Zi.get(n);o&&o.forEach(a=>NC(a,t))}async function NC(n,e){await n.setPayload(e||n.getPayload())}async function Op(n){let{apiHost:e,apiRequestHeaders:t}=n.getApiHosts(),r=n.getClientKey(),i="isRemoteEval"in n&&n.isRemoteEval(),s=_o(n),o=Np(n),a=ql.get(o);return a||(a=(i?qi.fetchRemoteEvalCall({host:e,clientKey:r,payload:{attributes:n.getAttributes(),forcedVariations:n.getForcedVariations(),forcedFeatures:Array.from(n.getForcedFeatures().entries()),url:n.getUrl()},headers:t}):qi.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"&&Ki.add(s),c.json()}).then(c=>(mb(s,o,c),Lp(n),ql.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(ql.delete(o),{data:null,source:"error",success:!1,error:c})),ql.set(o,a)),a}function Lp(n,e=!1){let t=_o(n),r=Np(n),{streamingHost:i,streamingHostRequestHeaders:s}=n.getApiHosts(),o=n.getClientKey();if(e&&Ki.add(t),Ke.backgroundSync&&Ki.has(t)&&Gt.EventSource){if(Gi.has(t))return;let a={src:null,host:i,clientKey:o,headers:s,cb:l=>{try{if(l.type==="features-updated"){let c=Zi.get(t);c&&c.forEach(u=>{Op(u)})}else if(l.type==="features"){let c=JSON.parse(l.data);mb(t,r,c)}a.errors=0}catch{vb(a)}},errors:0,state:"active"};Gi.set(t,a),Dp(a)}}function vb(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);Fp(n),setTimeout(()=>{["idle","active"].includes(n.state)||Dp(n)},Math.min(e,3e5))}}function Fp(n){n.src&&(n.src.onopen=null,n.src.onerror=null,n.src.close(),n.src=null,n.state==="active"&&(n.state="disabled"))}function Dp(n){n.src=qi.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=()=>vb(n),n.src.onopen=()=>{n.errors=0}}function LC(n,e){Fp(n),Gi.delete(e)}function Hp(){Ki.clear(),Gi.forEach(LC),Zi.clear(),qi.stopIdleListener()}function Zl(n,e){if(e.streaming){if(!n.getClientKey())throw new Error("Must specify clientKey to enable streaming");e.payload&&Lp(n,!0),IC(n)}}var FC=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,Wp={revert:function(){}},Xl=new Map,jp=new Set;function DC(n){return n==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[n]}}function Jl(n){var e=Xl.get(n);return e||(e={element:n,attributes:{}},Xl.set(n,e)),e}function Ql(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,DC(e)),o}function ec(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,yb()):n!==t&&(e.isDirty=!0,yb())}function HC(n){var e=n.originalValue;n.mutations.forEach(function(t){return e=t.mutate(e)}),ec(QC(e),n)}function BC(n){var e=new Set(n.originalValue.split(/\s+/).filter(Boolean));n.mutations.forEach(function(t){return t.mutate(e)}),ec(Array.from(e).filter(Boolean).join(" "),n)}function VC(n){var e=n.originalValue;n.mutations.forEach(function(t){return e=t.mutate(e)}),ec(e,n)}function WC(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 jC(n){var e=n.originalValue;n.mutations.forEach(function(t){var r=t.mutate(),i=WC(r);e=i||e}),ec(e,n)}var UC=function(e){return e.innerHTML},zC=function(e,t){return e.innerHTML=t};function _b(n){var e=Jl(n);return e.html||(e.html=Ql(n,"html",UC,zC,HC)),e.html}var qC=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},ZC=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function xb(n){var e=Jl(n);return e.position||(e.position=Ql(n,"position",qC,ZC,jC)),e.position}var GC=function(e,t){return t?e.className=t:e.removeAttribute("class")},KC=function(e){return e.className};function wb(n){var e=Jl(n);return e.classes||(e.classes=Ql(n,"class",KC,GC,BC)),e.classes}var YC=function(e){return function(t){var r;return(r=t.getAttribute(e))!=null?r:null}},XC=function(e){return function(t,r){return r!==null?t.setAttribute(e,r):t.removeAttribute(e)}};function kb(n,e){var t=Jl(n);return t.attributes[e]||(t.attributes[e]=Ql(n,e,YC(e),XC(e),VC)),t.attributes[e]}function JC(n,e){var t=Xl.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 QC(n){return Gl||(Gl=document.createElement("div")),Gl.innerHTML=n,Gl.innerHTML}function Kl(n,e,t){if(t.isDirty){t.isDirty=!1;var r=t.virtualValue;t.mutations.length||JC(n,e),t.setValue(n,r)}}function eA(n,e){n.html&&Kl(e,"html",n.html),n.classes&&Kl(e,"class",n.classes),n.position&&Kl(e,"position",n.position),Object.keys(n.attributes).forEach(function(t){Kl(e,t,n.attributes[t])})}function yb(){Xl.forEach(eA)}function tA(n,e){var t=null;n.kind==="html"?t=_b(e):n.kind==="class"?t=wb(e):n.kind==="attribute"?t=kb(e,n.attribute):n.kind==="position"&&(t=xb(e)),t&&(t.mutations.push(n),t.mutationRunner(t))}function nA(n,e){var t=null;if(n.kind==="html"?t=_b(e):n.kind==="class"?t=wb(e):n.kind==="attribute"?t=kb(e,n.attribute):n.kind==="position"&&(t=xb(e)),!!t){var r=t.mutations.indexOf(n);r!==-1&&t.mutations.splice(r,1),t.mutationRunner(t)}}function Sb(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),tA(n,r))})}}function rA(n){n.elements.forEach(function(e){return nA(n,e)}),n.elements.clear(),jp.delete(n)}function bb(){jp.forEach(Sb)}var Bp;function iA(){typeof document>"u"||(Bp||(Bp=new MutationObserver(function(){bb()})),bb(),Bp.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}iA();function tc(n){return typeof document>"u"?Wp:(jp.add(n),Sb(n),{revert:function(){rA(n)}})}function Vp(n,e){return tc({kind:"html",elements:new Set,mutate:e,selector:n})}function Eb(n,e){return tc({kind:"position",elements:new Set,mutate:e,selector:n})}function xo(n,e){return tc({kind:"class",elements:new Set,mutate:e,selector:n})}function Yl(n,e,t){return FC.test(e)?e==="class"||e==="className"?xo(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)})}):tc({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:n}):Wp}function sA(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 Vp(e,function(a){return a+(r??"")});if(t==="set")return Vp(e,function(){return r??""})}else if(i==="class"){if(t==="append")return xo(e,function(a){r&&a.add(r)});if(t==="remove")return xo(e,function(a){r&&a.delete(r)});if(t==="set")return xo(e,function(a){a.clear(),r&&a.add(r)})}else if(i==="position"){if(t==="set"&&s)return Eb(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 Wp}var oA={html:Vp,classes:xo,attribute:Yl,position:Eb,declarative:sA},Cb=oA;var Up={};function Hn(n,e,t){t=t||{};for(let[r,i]of Object.entries(e))switch(r){case"$or":if(!Tb(n,i,t))return!1;break;case"$nor":if(Tb(n,i,t))return!1;break;case"$and":if(!dA(n,i,t))return!1;break;case"$not":if(Hn(n,i,t))return!1;break;default:if(!wo(i,aA(n,r),t))return!1}return!0}function aA(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 Ab(n,e=!1){let t=`${n}${e?"/i":""}`;return Up[t]||(Up[t]=new RegExp(n.replace(/([^\\])\//g,"$1\\/"),e?"i":void 0)),Up[t]}function wo(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)||!Ib(n))return JSON.stringify(e)===JSON.stringify(n);for(let i in n)if(!uA(i,e,n[i],t))return!1;return!0}function Ib(n){let e=Object.keys(n);return e.length>0&&e.filter(t=>t[0]==="$").length===e.length}function lA(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 cA(n,e,t){if(!Array.isArray(n))return!1;let r=Ib(e)?i=>wo(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 Yi(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 Rb(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(wo(e[i],n[o],t,r)){s=!0;break}if(!s)return!1}return!0}function uA(n,e,t,r){switch(n){case"$veq":return dt(e)===dt(t);case"$vne":return dt(e)!==dt(t);case"$vgt":return dt(e)>dt(t);case"$vgte":return dt(e)>=dt(t);case"$vlt":return dt(e)<dt(t);case"$vlte":return dt(e)<=dt(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)?Yi(e,t):!1;case"$ini":return Array.isArray(t)?Yi(e,t,!0):!1;case"$inGroup":return Yi(e,r[t]||[]);case"$notInGroup":return!Yi(e,r[t]||[]);case"$nin":return Array.isArray(t)?!Yi(e,t):!1;case"$nini":return Array.isArray(t)?!Yi(e,t,!0):!1;case"$not":return!wo(t,e,r);case"$size":return Array.isArray(e)?wo(t,e.length,r):!1;case"$elemMatch":return cA(e,t,r);case"$all":return Array.isArray(t)?Rb(e,t,r):!1;case"$alli":return Array.isArray(t)?Rb(e,t,r,!0):!1;case"$regex":try{return Ab(t).test(e)}catch{return!1}case"$regexi":try{return Ab(t,!0).test(e)}catch{return!1}case"$type":return lA(e)===t;default:return console.error("Unknown operator: "+n),!1}}function Tb(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 dA(n,e,t){for(let r=0;r<e.length;r++)if(!Hn(n,e[r],t))return!1;return!0}var pA="Feature Evaluated",hA="Experiment Viewed";function fA(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 gA(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 Xi(n){try{await n()}catch{}}function $b(n,e,t){if(n.user.trackedExperiments){let i=ic(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(Xi(()=>i(e,t,n.user)))}if(n.user.trackingCallback){let i=n.user.trackingCallback;r.push(Xi(()=>i(e,t)))}if(n.global.eventLogger){let i=n.global.eventLogger;r.push(Xi(()=>i(hA,{experimentId:e.key,variationId:t.key,hashAttribute:t.hashAttribute,hashValue:t.hashValue},n.user)))}return r}function mA(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;Xi(()=>r(e,t,n.user))}if(n.user.onFeatureUsage){let r=n.user.onFeatureUsage;Xi(()=>r(e,t))}if(n.global.eventLogger){let r=n.global.eventLogger;Xi(()=>r(pA,{feature:e,source:t.source,value:t.value,ruleId:t.source==="defaultValue"?"$default":t.ruleId||"",variationId:t.experimentResult?t.experimentResult.key:""},n.user))}}function nc(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=fA(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=nc(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&&Ob(s.filters,e))continue;if("force"in s){if(s.condition&&!Pb(s.condition,e)||!vA(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=>{!$b(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}=rc(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 rc(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=yA(n,t),n.urlPatterns&&!jl(t.user.url||"",n.urlPatterns))return{result:Ae(t,n,-1,!1,e)};let s=ob(r,t.user.url||"",i);if(s!==null)return{result:Ae(t,n,s,!1,e)};let o=gA(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}=Hr(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}=xA({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(Ob(n.filters,t))return{result:Ae(t,n,-1,!1,e)}}else if(n.namespace&&!rb(l,n.namespace))return{result:Ae(t,n,-1,!1,e)};if(n.include&&!ab(n.include))return{result:Ae(t,n,-1,!1,e)};if(n.condition&&!Pb(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=nc(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&&!_A(n.groups,t))return{result:Ae(t,n,-1,!1,e)}}if(n.url&&!bA(n.url,t))return{result:Ae(t,n,-1,!1,e)};let h=yo(n.seed||r,l,n.hashVersion||1);if(h===null)return{result:Ae(t,n,-1,!1,e)};if(!u){let m=n.ranges||sb(i,n.coverage===void 0?1:n.coverage,n.weights);c=ib(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}=kA(t,a,bo(l),{[zp(n.key,n.bucketVersion)]:g.key});m&&(t.user.stickyBucketAssignmentDocs=t.user.stickyBucketAssignmentDocs||{},t.user.stickyBucketAssignmentDocs[y]=k,t.user.saveStickyBucketAssignmentDoc(k))}let v=$b(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"&&mA(n,e,a),a}function Mb(n){return{...n.user.attributes,...n.user.attributeOverrides}}function Pb(n,e){return Hn(Mb(e),n,e.global.savedGroups||{})}function Ob(n,e){return n.some(t=>{let{hashValue:r}=Hr(e,t.attribute);if(!r)return!0;let i=yo(t.seed,r,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>Wl(i,s))})}function vA(n,e,t,r,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;let{hashValue:a}=Hr(n,t,r);if(!a)return!1;let l=yo(e,a,o||1);return l===null?!1:i?Wl(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}=Hr(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 yA(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=Pp(n.url))),n}function Hr(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 bA(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 _A(n,e){let t=e.global.groups||{};for(let r=0;r<n.length;r++)if(t[n[r]])return!0;return!1}function xA({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=zp(e,t),l=wA(n,r,i);if(s>0)for(let d=0;d<s;d++){let h=zp(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 zp(n,e){return e=e||0,`${n}__${e}`}function qp(n,e){return`${n}||${e}`}function wA(n,e,t){if(!n.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:r,hashValue:i}=Hr(n,e),s=qp(r,bo(i)),{hashAttribute:o,hashValue:a}=Hr(n,t),l=a?qp(o,bo(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 kA(n,e,t,r){let i=qp(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 Nb(n,e,t){let r=Zp(n,t);return e.getAllAssignments(r)}function Zp(n,e){let t={};return SA(n,e).forEach(i=>{let{hashValue:s}=Hr(n,i);t[i]=bo(s)}),t}async function Lb(n,e,t){if(n={...n},n.encryptedFeatures){try{n.features=JSON.parse(await Dr(n.encryptedFeatures,e,t))}catch(r){console.error(r)}delete n.encryptedFeatures}if(n.encryptedExperiments){try{n.experiments=JSON.parse(await Dr(n.encryptedExperiments,e,t))}catch(r){console.error(r)}delete n.encryptedExperiments}if(n.encryptedSavedGroups){try{n.savedGroups=JSON.parse(await Dr(n.encryptedSavedGroups,e,t))}catch(r){console.error(r)}delete n.encryptedSavedGroups}return n}function Fb(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 ic(n,e){return e.hashAttribute+e.hashValue+n.key+e.variationId}var Ji=typeof window<"u"&&typeof document<"u",EA=lb(),ko=class{constructor(e){if(e=e||{},this.version=EA,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),Ji&&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 Lb(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,Zl(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&pb(e.cacheSettings),e.payload)return await this.setPayload(e.payload),Zl(this,e),{success:!0,source:"init"};{let{data:t,...r}=await this._refresh({...e,allowStale:!0});return Zl(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 Fb(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 hb({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 Dr(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 Dr(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,fb(this),e.destroyAllStreams&&Hp(),this.logs=[],Ji&&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}=rc(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}=rc(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=Ul(e);if(l==="redirect"&&s.value.urlRedirect&&e.urlPatterns){let c=e.persistQueryString?cb(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(jl(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(Ji)Promise.all([...o?[zl(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&&Ul(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 nc(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=>[ic(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(ic(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(Ji?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=Ul(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}:Ji?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!Ji)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(Cb.declarative(r).revert)}),()=>{t.forEach(r=>r())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),r=await Nb(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=Zp(r,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}};var CA="https://experiment.syntrologie.com",Gp=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 ko({...e,apiHost:e.apiHost??CA,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 sc(n={}){return new Gp(n)}var Db={growthbook:n=>sc({...n,autoInit:!0})};function Hb(n,e){let t=Db[n];if(!t)throw new Error(`Unknown experiment provider: ${n}. Supported: ${Object.keys(Db).join(", ")}`);return t(e)}var AA=["cdn.syntrologie.com","localhost","127.0.0.1"];function RA(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):AA.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 Kp=class{constructor(e){this.name="cdn";if(this.url=`${e.baseUrl}/${e.configId}.json`,this.integrity=e.integrity,!RA(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 TA(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 TA(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 Kp(n)}var IA="syntro_exp",$A="syntro_var",Yp=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(IA),o=i.get($A);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:el(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 Vb(n){return new Yp(n)}var MA="https://cdn.syntrologie.com/configs",Wb={cdn:n=>{if(!n.configId)throw new Error("CDN fetcher requires 'configId' option");return Bb({baseUrl:n.baseUrl??MA,configId:n.configId,integrity:n.integrity})},experiments:n=>{if(!n.featureKey)throw new Error("Experiments fetcher requires 'featureKey' option");return Vb({featureKey:n.featureKey})}};function jb(n,e={}){let t=Wb[n];if(!t)throw new Error(`Unknown config fetcher type: ${n}. Supported: ${Object.keys(Wb).join(", ")}`);return t(e)}var Ub="syntro_session_metrics",So=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(Ub);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(Ub,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function oc(n={}){return new So(n)}var ac=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 lc=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 ac(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 PA=[()=>new lc];function zb(){for(let n of PA){let e=n();if(e.detect())return e}return null}var Xp="syntro_experiments";var NA=720*60*60,cc=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=`${Xp}=; 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=`${Xp}=${t}; max-age=${NA}; path=/; SameSite=Lax`;document.cookie=r}};function LA(){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 Jp(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(qb(t,r))return}if(e.include){for(let r of e.include)if(qb(t,r))return r;return}return t}function qb(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 Eo=class{constructor(e){this.listeners=new Set;this.cleanupFns=[];if(this.telemetry=e.telemetry,this.routes=e.routes,this.navigation=e.navigation,this.context=LA(),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=Jp(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=Jp(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=Jp(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 uc(n){return new Eo(n)}function Qp(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 eh(n,e){let t=[];for(let r of n.conditions){let i=Qp(r,e);if(t.push({condition:r,result:i}),!i)return{matched:!1,conditionResults:t}}return{matched:!0,conditionResults:t}}function Co(n,e){for(let t=0;t<n.rules.length;t++){let r=n.rules[t],{matched:i,conditionResults:s}=eh(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 Ao(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 Zb(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 th(n,e,t={}){let r=Zb(e,t);switch(n.type){case"rules":return Co(n,r);case"score":return Ao(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 nh(n,e,t={}){let r=Zb(e,t);switch(n.type){case"rules":return Co(n,r);case"score":return Ao(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 dc(n){return{evaluate:(e,t)=>th(e,t,n),evaluateSync:(e,t)=>nh(e,t,n)}}function pc(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 Qi=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 rh="cooldown:";function Gb(n){return{set(e,t){let r=rh+e,i=Date.now()+t;n.set(r,i)},isActive(e){return this.remaining(e)>0},remaining(e){let t=rh+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=rh+e;n.remove(t)}}}var Ro="dismissed:";function Kb(n,e){return{mark(t,r=!1){let i=Ro+t;(r?e:n).set(i,!0)},isDismissed(t){let r=Ro+t;return n.has(r)||e.has(r)},clear(t){let r=Ro+t;n.remove(r),e.remove(r)},clearAll(){for(let t of n.keys())t.startsWith(Ro)&&n.remove(t);for(let t of e.keys())t.startsWith(Ro)&&e.remove(t)}}}var ih="freq:";function Yb(n){function e(t){let r=ih+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=ih+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=ih+t;n.remove(r)},hasReachedLimit(t,r){return this.count(t)>=r}}}var FA="syntro";function sh(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 To(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 Io=class{constructor(e={}){this.namespacedStorages=new Map;this.namespace=e.namespace??FA;let t=r=>typeof r=="object"&&r!==null&&typeof r.setItem=="function";typeof window<"u"?(this.session=t(window.sessionStorage)?sh(window.sessionStorage,this.namespace):To(this.namespace),this.user=t(window.localStorage)?sh(window.localStorage,this.namespace):To(this.namespace)):(this.session=To(this.namespace),this.user=To(this.namespace)),this.dismissals=Kb(this.session,this.user),this.cooldowns=Gb(this.user),this.frequency=Yb(this.session)}ns(e){let t=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(t)){let r=typeof window<"u"&&typeof sessionStorage<"u"?sh(sessionStorage,t):To(t);this.namespacedStorages.set(t,r)}return this.namespacedStorages.get(t)}};function hc(n={}){return new Io(n)}function es(n){return n.startsWith("inline:")?"inline":n.startsWith("adjacent:")?"adjacent":"static"}function $o(n){return n.startsWith("inline:")?n.slice(7):n.startsWith("adjacent:")?n.slice(9):null}var oh={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"}},ts={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:[]},Xb={duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"};function fc(n,e,t){let r=oh[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 gc(n,e,t){let r=t.placement==="auto"?"bottom":t.placement,i=[Xr(t.offset?{mainAxis:t.offset.y,crossAxis:t.offset.x}:8)];return t.flip!==!1&&i.push(Qr()),t.shift!==!1&&i.push(Jr({padding:8})),n.style.position="absolute",n.style.zIndex="2147483646",Yr(e,n,async()=>{let{x:o,y:a,strategy:l}=await ei(e,n,{placement:r,middleware:i});Object.assign(n.style,{position:l,left:`${o}px`,top:`${a}px`})})}function mc(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 vc(n,e){return e==="none"||ts[e].length===0?null:n.animate(ts[e],Xb)}function yc(n,e){if(e==="none"||ts[e].length===0)return Promise.resolve();let t=[...ts[e]].reverse(),r=n.animate(t,Xb);return new Promise(i=>{r.onfinish=()=>i(),r.oncancel=()=>i()})}function bc(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 _c(n){switch(es(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 Jb(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 xc(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,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=Jb(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=es(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=bc(b,w);L.style.zIndex=String(_c(b));let N;if(E==="static")fc(L,b,R?.constraints),e.appendChild(L);else if(E==="inline"){let A=$o(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=mc(L,F)}else if(E==="adjacent"){let A=$o(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=gc(L,F,R?.position??{placement:"bottom"})}let z=g(L,x,w);vc(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 yc(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 Mo=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()}},wc=new Mo;var lh="2.0.0";function HA(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(ah(r,i))return!1}if(e.include&&e.include.length>0){for(let i of e.include)if(ah(r,i))return!0;return!1}return!0}function ah(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 Qb(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 ah(t,s)})}function kc(n={}){let{telemetry:e,sessionMetrics:t,routes:r,mode:i="production",namespace:s}=n,o=n.widgets??wc,a=n.executors??jt,l=n.apps??Bs,c=new Qi,u=uc({telemetry:e,routes:r,navigation:c}),d=n.events??Ui(),h=hc({namespace:s}),g=pc({eventBus:d,stateStore:h}),v=dc({state:h,events:d,sessionMetrics:t,accumulator:g}),f=zy(),m=Pl(),y=M=>Qb(M)?m.resolve(M.selector):null,k=async(M,G)=>{if(!Qb(M))return null;try{return await m.waitFor(M.selector,G)}catch{return null}},_=xc({overlayRoot:f,eventBus:d,anchorResolver:y,widgetRegistry:o}),b=fl({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:lh,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(HA(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 ns=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 BA(){let n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let t=0;t<16;t++)e+=n[Math.floor(Math.random()*n.length)];return e}var ch=class{constructor(){this.sessionId=BA(),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 Sc(){return new ch}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 K_=Array.prototype,e_=K_.forEach,t_=K_.indexOf,ht=qe?.navigator,V=qe?.document,ze=qe?.location,Ah=qe?.fetch,Rh=qe!=null&&qe.XMLHttpRequest&&"withCredentials"in new qe.XMLHttpRequest?qe.XMLHttpRequest:void 0,n_=qe?.AbortController,ot=ht?.userAgent,Q=C??{},gn={DEBUG:!1,LIB_VERSION:"1.341.0"};function r_(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 as(n){return function(){var e=this,t=arguments;return new Promise((function(r,i){var s=n.apply(e,t);function o(l){r_(s,r,i,o,a,"next",l)}function a(l){r_(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 Y_(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 VA=["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"],i_=function(n,e){if(e===void 0&&(e=[]),!n)return!1;var t=n.toLowerCase();return VA.concat(e).some((r=>{var i=r.toLowerCase();return t.indexOf(i)!==-1}))},WA=["$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 eu=function(n){return n.trim()},Th=function(n){return n.replace(/^\$/,"")},jA=Array.isArray,X_=Object.prototype,J_=X_.hasOwnProperty,tu=X_.toString,me=jA||function(n){return tu.call(n)==="[object Array]"},qn=n=>typeof n=="function",Ne=n=>n===Object(n)&&!me(n),ls=n=>{if(Ne(n)){for(var e in n)if(J_.call(n,e))return!1;return!0}return!1},W=n=>n===void 0,Le=n=>tu.call(n)=="[object String]",Ih=n=>Le(n)&&n.trim().length===0,Ht=n=>n===null,pe=n=>W(n)||Ht(n),xn=n=>tu.call(n)=="[object Number]"&&n==n,ss=n=>xn(n)&&n>0,_n=n=>tu.call(n)==="[object Boolean]",UA=n=>n instanceof FormData,zA=n=>ue(WA,n);function $h(n){return n===null||typeof n!="object"}function Mc(n,e){return Object.prototype.toString.call(n)==="[object "+e+"]"}function Q_(n){return!W(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(n,Event)}var qA=[!0,"true",1,"1","yes"],uh=n=>ue(qA,n),ZA=[!1,"false",0,"0","no"];function Yt(n,e,t,r,i){return e>t&&(r.warn("min cannot be greater than max."),e=t),xn(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),Yt(i||t,e,t,r))}var Mh=class{constructor(e){this.t={},this.i=e.i,this.o=Yt(e.bucketSize,0,100,e.h),this.m=Yt(e.refillRate,0,this.o,e.h),this.$=Yt(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",Pc="iOS",bn="Android",Qo="Tablet",e0=bn+" "+Qo,t0="iPad",n0="Apple",r0=n0+" Watch",ea="Safari",ps="BlackBerry",i0="Samsung",s0=i0+"Browser",o0=i0+" Internet",jr="Chrome",GA=jr+" OS",a0=jr+" "+Pc,Vf="Internet Explorer",l0=Vf+" "+kt,Wf="Opera",KA=Wf+" Mini",jf="Edge",c0="Microsoft "+jf,us="Firefox",u0=us+" "+Pc,ta="Nintendo",na="PlayStation",ds="Xbox",d0=bn+" "+kt,p0=kt+" "+ea,Wo="Windows",Ph=Wo+" Phone",s_="Nokia",Oh="Ouya",h0="Generic",YA=h0+" "+kt.toLowerCase(),f0=h0+" "+Qo.toLowerCase(),Nh="Konqueror",tt="(\\d+(\\.\\d+)?)",dh=new RegExp("Version/"+tt),XA=new RegExp(ds,"i"),JA=new RegExp(na+" \\w+","i"),QA=new RegExp(ta+" \\w+","i"),Uf=new RegExp(ps+"|PlayBook|BB10","i"),eR={"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"},Ec,o_,ph,tR=(n,e)=>e&&ue(e,n0)||(function(t){return ue(t,ea)&&!ue(t,jr)&&!ue(t,bn)})(n),g0=function(n,e){return e=e||"",ue(n," OPR/")&&ue(n,"Mini")?KA:ue(n," OPR/")?Wf:Uf.test(n)?ps:ue(n,"IE"+kt)||ue(n,"WPDesktop")?l0:ue(n,s0)?o0:ue(n,jf)||ue(n,"Edg/")?c0:ue(n,"FBIOS")?"Facebook "+kt:ue(n,"UCWEB")||ue(n,"UCBrowser")?"UC Browser":ue(n,"CriOS")?a0:ue(n,"CrMo")||ue(n,jr)?jr:ue(n,bn)&&ue(n,ea)?d0:ue(n,"FxiOS")?u0:ue(n.toLowerCase(),Nh.toLowerCase())?Nh:tR(n,e)?ue(n,kt)?p0:ea:ue(n,us)?us:ue(n,"MSIE")||ue(n,"Trident/")?Vf:ue(n,"Gecko")?us:""},nR={[l0]:[new RegExp("rv:"+tt)],[c0]:[new RegExp(jf+"?\\/"+tt)],[jr]:[new RegExp("("+jr+"|CrMo)\\/"+tt)],[a0]:[new RegExp("CriOS\\/"+tt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+tt)],[ea]:[dh],[p0]:[dh],[Wf]:[new RegExp("(Opera|OPR)\\/"+tt)],[us]:[new RegExp(us+"\\/"+tt)],[u0]:[new RegExp("FxiOS\\/"+tt)],[Nh]:[new RegExp("Konqueror[:/]?"+tt,"i")],[ps]:[new RegExp(ps+" "+tt),dh],[d0]:[new RegExp("android\\s"+tt,"i")],[o0]:[new RegExp(s0+"\\/"+tt)],[Vf]:[new RegExp("(rv:|MSIE )"+tt)],Mozilla:[new RegExp("rv:"+tt)]},rR=function(n,e){var t=g0(n,e),r=nR[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},a_=[[new RegExp(ds+"; "+ds+" (.*?)[);]","i"),n=>[ds,n&&n[1]||""]],[new RegExp(ta,"i"),[ta,""]],[new RegExp(na,"i"),[na,""]],[Uf,[ps,""]],[new RegExp(Wo,"i"),(n,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ph,""];if(new RegExp(kt).test(e)&&!/IEMobile\b/.test(e))return[Wo+" "+kt,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var r=t[1],i=eR[r]||"";return/arm/i.test(e)&&(i="RT"),[Wo,i]}return[Wo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,n=>{if(n&&n[3]){var e=[n[3],n[4],n[5]||"0"];return[Pc,e.join(".")]}return[Pc,""]}],[/(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("("+bn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+bn+")","i"),n=>{if(n&&n[2]){var e=[n[2],n[3],n[4]||"0"];return[bn,e.join(".")]}return[bn,""]}],[/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/,[GA,""]],[/Linux|debian/i,["Linux",""]]],l_=function(n){return QA.test(n)?ta:JA.test(n)?na:XA.test(n)?ds:new RegExp(Oh,"i").test(n)?Oh:new RegExp("("+Ph+"|WPDesktop)","i").test(n)?Ph:/iPad/.test(n)?t0:/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(n)?r0:Uf.test(n)?ps:/(kobo)\s(ereader|touch)/i.test(n)?"Kobo":new RegExp(s_,"i").test(n)?s_:/(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)?bn:e0:new RegExp("(pda|"+kt+")","i").test(n)?YA:new RegExp(Qo,"i").test(n)&&!new RegExp(Qo+" pc","i").test(n)?f0:""},iR=n=>n instanceof Error;function sR(n){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return ph&&t.length===o_||(o_=t.length,ph=t.reduce(((r,i)=>{Ec||(Ec={});var s=Ec[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,Ec[i]=[c,u];break}}return r}),{})),ph}}var Lh=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 as((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 as((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:sR(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)})}},hs="?";function Fh(n,e,t,r,i){var s={platform:n,filename:e,function:t==="<anonymous>"?hs:t,in_app:!0};return W(r)||(s.lineno=r),W(i)||(s.colno=i),s}var m0=(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]:hs,t?"safari-extension:"+e:"safari-web-extension:"+e]:[n,e]},oR=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,aR=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,lR=/\((\S*)(?::(\d+))(?::(\d+))\)/,cR=(n,e)=>{var t=oR.exec(n);if(t){var[,r,i,s]=t;return Fh(e,r,hs,+i,+s)}var o=aR.exec(n);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=lR.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=m0(o[1]||hs,o[2]);return Fh(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},uR=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,dR=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,pR=(n,e)=>{var t=uR.exec(n);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var r=dR.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]||hs;return[s,i]=m0(s,i),Fh(e,i,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},c_=/\(error: (.*)\)/,u_=50;function hR(){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=c_.test(c)?c.replace(c_,"$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>=u_)break}}}return(function(g){if(!g.length)return[];var v=Array.from(g);return v.reverse(),v.slice(0,u_).map((f=>{return U({},f,{filename:f.filename||(m=v,m[m.length-1]||{}).filename,function:f.function||hs});var m}))})(o)}})("web:javascript",cR,pR)}var Dh=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 Mc(e,"DOMException")}isDOMError(e){return Mc(e,"DOMError")}},Hh=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}},Bh=class{constructor(){}match(e){return Mc(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}}},fR=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Vh=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(fR);return i&&(t=i[1],r=i[2]),[t,r]}},gR=["fatal","error","warning","log","info","debug"];function v0(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 Wh=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 Q_(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: "+v0(e)}isSeverityLevel(e){return Le(e)&&!Ih(e)&&gR.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];if(iR(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},jh=class{match(e){return Q_(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+v0(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},Uh=class{match(e){return $h(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}}},zh=class{match(e){return Mc(e,"PromiseRejectionEvent")}coerce(e,t){var r,i=this.getUnhandledRejectionReason(e);return $h(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($h(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}},y0=function(n,e){var{debugEnabled:t}=e===void 0?{}:e,r={k:function(i){if(C&&(gn.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)=>y0(n+" "+i,s)};return r},j=y0("[PostHog.js]"),$e=j.createLogger,mR=$e("[ExternalScriptsLoader]"),d_=(n,e,t)=>{if(n.config.disable_external_dependency_loading)return mR.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);d_(n,s,t)},Q.__PosthogExtensions__.loadSiteApp=(n,e,t)=>{var r=n.requestRouter.endpointFor("api",e);d_(n,r,t)};var Oc={};function Zn(n,e,t){if(me(n)){if(e_&&n.forEach===e_)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)===Oc)return}}}function ke(n,e,t){if(!pe(n)){if(me(n))return Zn(n,e,t);if(UA(n)){for(var r of n.entries())if(e.call(t,r[1],r[0])===Oc)return}else for(var i in n)if(J_.call(n,i)&&e.call(t,n[i],i)===Oc)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},gs=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 Ic(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 p_=function(n){try{return n()}catch{return}},vR=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)}}},zf=function(n){var e={};return ke(n,(function(t,r){(Le(t)&&t.length>0||xn(t))&&(e[r]=t)})),e};function yR(n,e){return t=n,r=s=>Le(s)&&!Ht(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 bR=["herokuapp.com","vercel.app","netlify.app"];function _R(n){var e=n?.hostname;if(!Le(e))return!1;var t=e.split(".").slice(-2).join(".");for(var r of bR)if(t===r)return!1;return!0}function b0(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 _0="$people_distinct_id",jo="__alias",Uo="__timers",h_="$autocapture_disabled_server_side",qh="$heatmaps_enabled_server_side",f_="$exception_capture_enabled_server_side",Zh="$error_tracking_suppression_rules",g_="$error_tracking_capture_extension_exceptions",m_="$web_vitals_enabled_server_side",x0="$dead_clicks_enabled_server_side",v_="$product_tours_enabled_server_side",y_="$web_vitals_allowed_metrics",hh="$session_recording_remote_config",Nc="$sesid",w0="$session_is_sampled",cs="$enabled_feature_flags",zo="$early_access_features",Gh="$feature_flag_details",qo="$stored_person_properties",Wr="$stored_group_properties",Kh="$surveys",Lc="$flag_call_reported",mn="$user_state",Yh="$client_session_props",Xh="$capture_rate_limit",Jh="$initial_campaign_params",Qh="$initial_referrer_info",Fc="$initial_person_info",Dc="$epp",k0="__POSTHOG_TOOLBAR__",Po="$posthog_cookieless",xR=[_0,jo,"__cmpns",Uo,"$session_recording_enabled_server_side",qh,Nc,cs,Zh,mn,zo,Gh,Wr,qo,Kh,Lc,Yh,Xh,Jh,Qh,Dc,Fc,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function b_(n){return n instanceof Element&&(n.id===k0||!(n.closest==null||!n.closest(".toolbar-global-fade-container")))}function nu(n){return!!n&&n.nodeType===1}function Gn(n,e){return!!n&&!!n.tagName&&n.tagName.toLowerCase()===e.toLowerCase()}function S0(n){return!!n&&n.nodeType===3}function E0(n){return!!n&&n.nodeType===11}function qf(n){return n?eu(n).split(/\s+/):[]}function __(n){var e=C?.location.href;return!!(e&&n&&n.some((t=>e.match(t))))}function Hc(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 qf(e)}function C0(n){return pe(n)?null:eu(n).split(/(\s+)/).filter((e=>ra(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function sa(n){var e="";return ef(n)&&!$0(n)&&n.childNodes&&n.childNodes.length&&ke(n.childNodes,(function(t){var r;S0(t)&&t.textContent&&(e+=(r=C0(t.textContent))!==null&&r!==void 0?r:"")})),eu(e)}function A0(n){return W(n.target)?n.srcElement||null:(e=n.target)!=null&&e.shadowRoot?n.composedPath()[0]||null:n.target||null;var e}var Zf=["a","button","form","input","select","textarea","label"];function R0(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 T0(n){var e=n.parentNode;return!(!e||!nu(e))&&e}var wR=["next","previous","prev",">","<"],x_=10,w_=[".ph-no-rageclick",".ph-no-capture"];function kR(n,e){if(!C||Gf(n))return!1;var t,r,i;if(_n(e)?(t=!!e&&w_,r=void 0):(t=(i=e?.css_selector_ignorelist)!==null&&i!==void 0?i:w_,r=e?.content_ignorelist),t===!1)return!1;var{targetElementList:s}=I0(n,!1);return!(function(o,a){if(o===!1||W(o))return!1;var l;if(o===!0)l=wR;else{if(!me(o))return!1;if(o.length>x_)return j.error("[PostHog] content_ignorelist array cannot exceed "+x_+" 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:sa(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!R0(s,t)}var Gf=n=>!n||Gn(n,"html")||!nu(n),I0=(n,e)=>{if(!C||Gf(n))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,r=[n],i=n;i.parentNode&&!Gn(i,"body");)if(E0(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var s=T0(i);if(!s)break;if(e||Zf.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||Gf(n)||(s=t)!=null&&s.url_allowlist&&!__(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&__(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}=I0(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)||!R0(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&&(Zf.indexOf(g)>-1||n.getAttribute("contenteditable")==="true")}}function ef(n){for(var e=n;e.parentNode&&!Gn(e,"body");e=e.parentNode){var t=Hc(e);if(ue(t,"ph-sensitive")||ue(t,"ph-no-capture"))return!1}if(ue(Hc(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 $0(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})",ER=new RegExp("^(?:"+M0+")$"),CR=new RegExp(M0),P0="\\d{3}-?\\d{2}-?\\d{4}",AR=new RegExp("^("+P0+")$"),RR=new RegExp("("+P0+")");function ra(n,e){return e===void 0&&(e=!0),!(pe(n)||Le(n)&&(n=eu(n),(e?ER:CR).test((n||"").replace(/[- ]/g,""))||(e?AR:RR).test(n)))}function O0(n){var e=sa(n);return ra(e=(e+" "+N0(n)).trim())?e:""}function N0(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=sa(t);e=(e+" "+i).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+N0(t)).trim())}catch(s){j.error("[AutoCapture]",s)}})),e}function TR(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 Ic(l).sort(((u,d)=>{var[h]=u,[g]=d;return h.localeCompare(g)})).forEach((u=>{var[d,h]=u;return c[k_(d.toString())]=k_(h.toString())})),o+=":",o+=Ic(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:IR(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Ic(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 k_(n){return n.replace(/"|\\"/g,'\\"')}function IR(n){var e=n.attr__class;return e?me(e)?e:qf(e):void 0}var Bc=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}},Vc=n=>{var e=V?.createElement("a");return W(e)?null:(e.href=n,e)},$R=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)},Wc=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," ")},oa=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},jc=function(n,e){var t=n.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},fh="$copy_autocapture",S_=$e("[AutoCapture]");function gh(n,e){return e.length>n?e.slice(0,n)+"...":e}function MR(n){if(n.previousElementSibling)return n.previousElementSibling;var e=n;do e=e.previousSibling;while(e&&!nu(e));return e}function PR(n,e,t,r){var i=n.tagName.toLowerCase(),s={tag_name:i};Zf.indexOf(i)>-1&&!t&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=gh(1024,O0(n)):s.$el_text=gh(1024,sa(n)));var o=Hc(n);o.length>0&&(s.classes=o.filter((function(u){return u!==""}))),ke(n.attributes,(function(u){var d;if((!$0(n)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(r==null||!r.includes(u.name))&&!e&&ra(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=qf(h).join(" ")),s["attr__"+u.name]=gh(1024,h)}}));for(var a=1,l=1,c=n;c=MR(c);)a++,c.tagName===n.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function OR(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");)E0(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=ef(b);b.tagName.toLowerCase()==="a"&&(v=b.getAttribute("href"),v=x&&v&&ra(v)&&v),ue(Hc(b),"ph-no-capture")&&(f=!0),h.push(PR(b,s,o,a));var R=(function(w){if(!ef(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&&ra(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=O0(n):h[0].$el_text=sa(n)),v){var m,y;h[0].attr__href=v;var k=(m=Vc(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:TR(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 tf=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Bc(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){S_.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,fh)};Oe(V,"copy",t,{capture:!0}),Oe(V,"cut",t,{capture:!0})}}}else S_.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({[h_]:!!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[h_],i=this.T;if(Ht(i)&&!_n(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=A0(e);S0(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())&&kR(i,this.instance.config.rageclick)&&this.O(e,"$rageclick");var s=t===fh;if(i&&SR(i,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=OR(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===fh){var c,u=C0(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 xn(n)&&isFinite(n)&&Math.floor(n)===n});var E_="0123456789abcdef",nf=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+E_.charAt(this.bytes[t]>>>4)+E_.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}},rf=class{constructor(){this.A=0,this.j=0,this.D=new sf}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 nf.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())}},C_,L0=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&&(L0=n=>crypto.getRandomValues(n));var sf=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(L0(this.N),this.U=0),this.N[this.U++]}},zn=()=>NR().toString(),NR=()=>(C_||(C_=new rf)).generate(),Oo="",LR=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function FR(n,e){if(e){var t=(function(i,s){if(s===void 0&&(s=V),Oo)return Oo;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();!Oo&&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",Oo=c)}return Oo})(n);if(!t){var r=(i=>{var s=i.match(LR);return s?s[0]:""})(n);r!==t&&j.info("Warning: cookie subdomain discovery mismatch",r,t),t=r}return t?"; domain=."+t:""}return""}var Kt={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(Kt.q(n))||{}}catch{}return e},G:function(n,e,t,r,i){if(V)try{var s="",o="",a=FR(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{Kt.G(n,"",-1,e)}catch{return}}},mh=null,Re={H:function(){if(!Ht(mh))return mh;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"),mh=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)}}},DR=["$device_id","distinct_id",Nc,w0,Dc,Fc],Cc={},HR={H:function(){return!0},B:function(n){j.error("memoryStorage error: "+n)},q:function(n){return Cc[n]||null},W:function(n){return Cc[n]||null},G:function(n,e){Cc[n]=e},V:function(n){delete Cc[n]}},Br=null,Ue={H:function(){if(!Ht(Br))return Br;if(Br=!0,W(C))Br=!1;else try{var n="__support__";Ue.G(n,"xyz"),Ue.q(n)!=='"xyz"'&&(Br=!1),Ue.V(n)}catch{Br=!1}return Br},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)}}},vn=(function(n){return n[n.PENDING=-1]="PENDING",n[n.DENIED=0]="DENIED",n[n.GRANTED=1]="GRANTED",n})({}),of=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?vn.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===vn.DENIED||this.consent===vn.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===vn.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 uh(e)?vn.GRANTED:ue(ZA,e)?vn.DENIED:vn.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?Re:Kt;var t=e==="localStorage"?Kt:Re;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(uh(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!b0([ht?.doNotTrack,ht?.msDoNotTrack,Q.doNotTrack],(e=>uh(e)))}},Ac=$e("[Dead Clicks]"),BR=()=>!0,VR=n=>{var e,t=!((e=n.instance.persistence)==null||!e.get_property(x0)),r=n.instance.config.capture_dead_clicks;return _n(r)?r:!!Ne(r)||t},Uc=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({[x0]: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?Ac.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),Ac.info("starting...")}}else Ac.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Ac.info("stopping..."))}},No=$e("[ExceptionAutocapture]"),af=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){No.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[f_]),this.dt=new Mh({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:No}),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?(No.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 No.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({[f_]: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)?No.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}};function A_(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 lf=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__||A_(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__||A_(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)}}}},vh=$e("[SegmentIntegration]");function WR(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(mn,"identified")),i()},a=s.user();"then"in a&&qn(a.then)?a.then(o):o(a)})(n,(()=>{t.register((r=>{Promise&&Promise.resolve||vh.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()||(vh.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(vh.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 F0="posthog-js";function D0(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 cf=class{constructor(e,t,r,i,s,o){this.name=F0,this.setupOnce=function(a){a(D0(e,{organization:t,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},jR=C!=null&&C.location?jc(C.location.hash,"__posthog")||jc(location.hash,"state"):null,R_="_postHogToolbarParams",T_=$e("[Toolbar]"),Un=(function(n){return n[n.UNINITIALIZED=0]="UNINITIALIZED",n[n.LOADING=1]="LOADING",n[n.LOADED=2]="LOADED",n})(Un||{}),uf=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=jR||jc(e.hash,"__posthog")||jc(e.hash,"state"),o=s?p_((()=>JSON.parse(atob(decodeURIComponent(s)))))||p_((()=>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(R_)||"{}")).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):T_.warn("No toolbar load function found")}loadToolbar(e){var t=!(V==null||!V.getElementById(k0));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(R_,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 T_.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)}},UR=$e("[TracingHeaders]"),df=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 UR.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)}},Rc="https?://(.*)",ms=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],zR=gs(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ms),aa="<masked>",qR=["li_fat_id"];function H0(n,e,t){if(!V)return{};var r,i=e?gs([],ms,t||[]):[],s=B0(oa(V.URL,i,aa),n),o=(r={},ke(qR,(function(a){var l=Kt.q(a);r[a]=l||null})),r);return Me(o,s)}function B0(n,e){var t=zR.concat(e||[]),r={};return ke(t,(function(i){var s=Wc(n,i);r[i]=s||null})),r}function V0(n){var e=(function(s){return s?s.search(Rc+"google.([^/?]*)")===0?"google":s.search(Rc+"bing.com")===0?"bing":s.search(Rc+"yahoo.com")===0?"yahoo":s.search(Rc+"duckduckgo.com")===0?"duckduckgo":null:null})(n),t=e!="yahoo"?"q":"p",r={};if(!Ht(e)){r.$search_engine=e;var i=V?Wc(V.referrer,t):"";i.length&&(r.ph_keyword=i)}return r}function I_(){return navigator.language||navigator.userLanguage}function W0(){return V?.referrer||"$direct"}function j0(n,e){var t=n?gs([],ms,e||[]):[],r=ze?.href.substring(0,1e3);return{r:W0().substring(0,1e3),u:r?oa(r,t,aa):void 0}}function U0(n){var e,{r:t,u:r}=n,i={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Vc(t))==null?void 0:e.host};if(r){i.$current_url=r;var s=Vc(r);i.$host=s?.host,i.$pathname=s?.pathname;var o=B0(r);Me(i,o)}if(t){var a=V0(t);Me(i,a)}return i}function z0(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function ZR(){try{return new Date().getTimezoneOffset()}catch{return}}function GR(n,e){if(!ot)return{};var t,r,i,s=n?gs([],ms,e||[]):[],[o,a]=(function(l){for(var c=0;c<a_.length;c++){var[u,d]=a_[c],h=u.exec(l),g=h&&(qn(d)?d(h,l):d);if(g)return g}return["",""]})(ot);return Me(zf({$os:o,$os_version:a,$browser:g0(ot,navigator.vendor),$device:l_(ot),$device_type:(r=ot,i=l_(r),i===t0||i===e0||i==="Kobo"||i==="Kindle Fire"||i===f0?Qo:i===ta||i===ds||i===na||i===Oh?"Console":i===r0?"Wearable":i?kt:"Desktop"),$timezone:z0(),$timezone_offset:ZR()}),{$current_url:oa(ze?.href,s,aa),$host:ze?.host,$pathname:ze?.pathname,$raw_user_agent:ot.length>1e3?ot.substring(0,997)+"...":ot,$browser_version:rR(ot,navigator.vendor),$browser_language:I_(),$browser_language_prefix:(t=I_(),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:gn.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Vn=$e("[Web Vitals]"),$_=9e5,pf=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[m_]),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[y_])||["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)&&xn(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:$_;return 0<e&&e<=6e4?$_: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:_n(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return _n(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({[m_]:t}),this._instance.persistence.register({[y_]: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?gs([],ms,r||[]):[];return oa(e,i,aa)}Vn.error("Could not determine current URL")}},KR=$e("[Heatmaps]");function M_(n){return Ne(n)&&"clientX"in n&&"clientY"in n&&xn(n.clientX)&&xn(n.clientY)}var hf=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[qh]),this.rageclicks=new Bc(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;KR.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({[qh]: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 Uc(this.instance,BR,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&&nu(u)&&!Gn(u,"body");){if(u===c)return!1;if(ue(l,C?.getComputedStyle(u).position))return!0;u=T0(u)}return!1})(A0(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"),!b_(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(U({},i,{type:"rageclick"})),this.Vt(i)}}Ht(e){!b_(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?gs([],ms,i||[]):[],o=oa(t,s,aa);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!ls(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},zc=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:Yt(a/o,0,1,j),g=o<=1?1:Yt(l/o,0,1,j),v=c<=1?1:Yt(u/c,0,1,j),f=c<=1?1:Yt(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 yn=(function(n){return n.GZipJS="gzip-js",n.Base64="base64",n})({}),St=Uint8Array,nt=Uint16Array,fs=Uint32Array,Kf=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]),Yf=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]),P_=new St([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),q0=function(n,e){for(var t=new nt(31),r=0;r<31;++r)t[r]=e+=1<<n[r-1];var i=new fs(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]},Z0=q0(Kf,2),YR=Z0[0],ff=Z0[1];YR[28]=258,ff[258]=28;for(gf=q0(Yf,0)[1],qc=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,qc[Se]=((65280&Wn)>>>8|(255&Wn)<<8)>>>1;var Wn,gf,qc,Se,Yo=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[qc[d]>>>l]=c}else for(o=new nt(r),i=0;i<r;++i)o[i]=qc[a[n[i]-1]++]>>>15-n[i];return o},Ur=new St(288);for(Se=0;Se<144;++Se)Ur[Se]=8;for(Se=144;Se<256;++Se)Ur[Se]=9;for(Se=256;Se<280;++Se)Ur[Se]=7;for(Se=280;Se<288;++Se)Ur[Se]=8;var Zc=new St(32);for(Se=0;Se<32;++Se)Zc[Se]=5;var XR=Yo(Ur,9,0),JR=Yo(Zc,5,0),G0=function(n){return(n/8>>0)+(7&n&&1)},K0=function(n,e,t){(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof nt?nt:n instanceof fs?fs:St)(t-e);return r.set(n.subarray(e,t)),r},hn=function(n,e,t){t<<=7&e;var r=e/8>>0;n[r]|=t,n[r+1]|=t>>>8},Lo=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},yh=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=mf(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]},mf=function(n,e,t){return n.s==-1?Math.max(mf(n.l,e,t+1),mf(n.r,e,t+1)):e[n.s]=t},O_=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]},Fo=function(n,e){for(var t=0,r=0;r<e.length;++r)t+=n[r]*e[r];return t},vf=function(n,e,t){var r=t.length,i=G0(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)},N_=function(n,e,t,r,i,s,o,a,l,c,u){hn(e,u++,t),++i[256];for(var d=yh(i,15),h=d[0],g=d[1],v=yh(s,15),f=v[0],m=v[1],y=O_(h),k=y[0],_=y[1],b=O_(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 $=yh(w,7),P=$[0],M=$[1],G=19;G>4&&!P[P_[G-1]];--G);var L,N,z,H,oe=c+5<<3,A=Fo(i,Ur)+Fo(s,Zc)+o,F=Fo(i,h)+Fo(s,f)+o+14+3*G+Fo(w,P)+(2*w[16]+3*w[17]+7*w[18]);if(oe<=A&&oe<=F)return vf(e,u,n.subarray(l,l+c));if(hn(e,u,1+(F<A)),u+=2,F<A){L=Yo(h,g,0),N=h,z=Yo(f,m,0),H=f;var X=Yo(P,M,0);for(hn(e,u,_-257),hn(e,u+5,R-1),hn(e,u+10,G-4),u+=14,E=0;E<G;++E)hn(e,u+3*E,P[P_[E]]);u+=3*G;for(var fe=[k,x],de=0;de<2;++de){var Be=fe[de];for(E=0;E<Be.length;++E){var Ce=31&Be[E];hn(e,u,X[Ce]),u+=P[Ce],Ce>15&&(hn(e,u,Be[E]>>>5&127),u+=Be[E]>>>12)}}}else L=XR,N=Ur,z=JR,H=Zc;for(E=0;E<a;++E)if(r[E]>255){Ce=r[E]>>>18&31,Lo(e,u,L[Ce+257]),u+=N[Ce+257],Ce>7&&(hn(e,u,r[E]>>>23&31),u+=Kf[Ce]);var Et=31&r[E];Lo(e,u,z[Et]),u+=H[Et],Et>3&&(Lo(e,u,r[E]>>>5&8191),u+=Yf[Et])}else Lo(e,u,L[r[E]]),u+=N[r[E]];return Lo(e,u,L[256]),u+N[256]},QR=new fs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),eT=(function(){for(var n=new fs(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(1&t&&3988292384)^t>>>1;n[e]=t}return n})(),tT=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=vf(g,v,s.subarray(f,m)):(g[f]=u,v=vf(g,v,s.subarray(f,d)))}else{for(var y=QR[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(uu){return(s[uu]^s[uu+1]<<w^s[uu+2]<<E)&b},P=new fs(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=N_(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 Be=2,Ce=0,Et=_,Ct=F-X&32767;if(fe>2&&A==$(f-Ct))for(var lu=Math.min(k,fe)-1,ys=Math.min(32767,f),Pe=Math.min(258,fe);Ct<=ys&&--Et&&F!=X;){if(s[f+Be]==s[f+Be-Ct]){for(var Bt=0;Bt<Pe&&s[f+Bt]==s[f+Bt-Ct];++Bt);if(Bt>Be){if(Be=Bt,Ce=Ct,Bt>lu)break;var bx=Math.min(Ct,Bt-2),ng=0;for(de=0;de<bx;++de){var cu=f-Ct+de+32768&32767,rg=cu-x[cu]+32768&32767;rg>ng&&(ng=rg,X=cu)}}}Ct+=(F=X)-(X=x[F])+32768&32767}if(Ce){P[z++]=268435456|ff[Be]<<18|gf[Ce];var ig=31&ff[Be],sg=31&gf[Ce];N+=Kf[ig]+Yf[sg],++M[257+ig],++G[sg],H=f+Be,++L}else P[z++]=s[f],++M[s[f]]}}v=N_(s,g,u,P,M,G,N,z,oe,f-oe,v)}return K0(h,0,l+G0(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)},bh=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8};function nT(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=eT[255&c^l[u]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),r=n.length;t.p(n);var i,s=tT(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&&bh(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),bh(s,o-8,t.d()),bh(s,o-4,r),s}var rT=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),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},YR=!!kh||!!wh,I_="text/plain",Uc=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=kR(o);return l&&a.push(l),i+"?"+a.join("&")},qo=(n,e)=>JSON.stringify(n,((t,r)=>typeof r=="bigint"?r.toString():r),e),gh=n=>{var{data:e,compression:t}=n;if(e){if(t===mn.GZipJS){var r=GR((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 j0(d,0,h)})(qo(e)),{mtime:0}),i=new Blob([r],{type:I_});return{contentType:I_,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=KR(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})(qo(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:qo(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=qo(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Ac=[];wh&&Ac.push({transport:"fetch",method:n=>{var e,t,{contentType:r,body:i,estimatedSize:s}=(e=gh(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(Yb){var c=new Yb;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),n.timeout)}}wh(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))}}),kh&&Ac.push({transport:"XHR",method:n=>{var e,t=new kh;t.open(n.method||"GET",n.url,!0);var{contentType:r,body:i}=(e=gh(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)}}),ht!=null&&ht.sendBeacon&&Ac.push({transport:"sendBeacon",method:n=>{var e=Uc(n.url,{beacon:"1"});try{var t,{contentType:r,body:i}=(t=gh(n))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:r}):i;ht.sendBeacon(e,s)}catch{}}});var zc=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 $_(n,e,t){return qo({distinct_id:n,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var U0={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=>zc(t,r))))),not_regex:(n,e)=>e.every((t=>n.every((r=>!zc(t,r))))),icontains:(n,e)=>e.map(Ec).some((t=>n.map(Ec).some((r=>t.includes(r))))),not_icontains:(n,e)=>e.map(Ec).every((t=>n.map(Ec).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)))}))},Ec=n=>n.toLowerCase();function z0(n,e){return!n||Object.entries(n).every((t=>{var[r,i]=t,s=e?.[r];if(j(s)||Dt(s))return!1;var o=[String(s)],a=U0[i.operator];return!!a&&a(i.values,o)}))}var mh=Te("[Error tracking]"),hf=class{constructor(e){var t,r;this.Zt=[],this.ti=new $h([new Ph,new Bh,new Nh,new Oh,new Dh,new Fh,new Lh,new Hh],sR()),this._instance=e,this.Zt=(t=(r=this._instance.persistence)==null?void 0:r.get_property(Wh))!==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({[Wh]:this.Zt,[c_]:o})}get ii(){var e,t=!!this._instance.get_property(c_),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 mh.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void mh.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void mh.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=U0[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)}},pt=Te("[FeatureFlags]"),Fo=Te("[FeatureFlags]",{debugEnabled:!0}),vh="$active_feature_flags",rs="$override_feature_flags",M_="$feature_flag_payloads",Do="$override_feature_flag_payloads",P_="$feature_flag_request_id",O_="$feature_flag_evaluated_at",N_=n=>{var e={};for(var[t,r]of Cc(n||{}))r&&(e[t]=r);return e},XR=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]})))):pt.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),n},QR=(function(n){return n.FeatureFlags="feature_flags",n.Recordings="recordings",n})({}),ff=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||(pt.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||pt.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(jh),t=this._instance.get_property(rs),r=this._instance.get_property(Do);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||(pt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(cs),t=this._instance.get_property(rs);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||(pt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this.oi=!0),r}getFlagPayloads(){var e=this._instance.get_property(M_),t=this._instance.get_property(Do);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||(pt.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(zo)||{}),group_properties:this._instance.get_property(Wr)};Dt(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=H0()),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(QR.FeatureFlags))pt.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}pt.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(P_)||void 0,c=this._instance.get_property(O_)||void 0,u=this._instance.get_property(Mc)||{};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({[Mc]: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 pt.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 j(r)?void 0:!!r}pt.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=XR(o),h=d.flags,g=d.featureFlags,v=d.featureFlagPayloads;if(g){var f=o.requestId,m=o.evaluatedAt;if(fe(g)){pt.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({[vh]:g,[cs]: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({[vh]:Object.keys(N_(_)),[cs]:_||{},[M_]:b||{},[jh]:w||{}},f?{[P_]:f}:{},m?{[O_]:m}:{}))}}})(e,this._instance.persistence,r,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),pt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return pt.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(rs),this._instance.persistence.unregister(Do),this.wi(),Fo.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(rs),Fo.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({[rs]:i})}else this._instance.persistence.register({[rs]:r.flags});Fo.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this._instance.persistence.unregister(Do),Fo.info("Payload overrides cleared")):r.payloads&&(this._instance.persistence.register({[Do]:r.payloads}),Fo.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(Uo)||[]).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({[vh]:Object.keys(N_(l)),[cs]:l}),this.wi()}getEarlyAccessFeatures(e,t,r){t===void 0&&(t=!1);var i=this._instance.get_property(Uo),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(Uo),(l=this._instance.persistence)==null||l.register({[Uo]: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(zo)||{};this._instance.register({[zo]:z({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(zo)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var r=this._instance.get_property(Wr)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((i=>{r[i]=z({},r[i],e[i]),delete e[i]})),this._instance.register({[Wr]:z({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Wr)||{};this._instance.register({[Wr]:z({},t,{[e]:{}})})}else this._instance.unregister(Wr)}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}},JR=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Yo=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){JR.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=[...IR,...i];return z({},Ce,{W:function(o){try{var a={};try{a=Zt.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&&Zt.G(o,h,l,c,u,d)}catch(g){Ce.B(g)}},V:function(o,a){try{C?.localStorage.removeItem(o),Zt.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"?$R:r==="cookie"?Zt:t.H()?t:Zt}properties(){var e={};return we(this.props,(function(t,r){if(r===cs&&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,(Dt(o=hR)?l:Kb&&o.indexOf===Kb?o.indexOf(a)!=-1:(we(o,(function(c){if(l||(l=c===a))return Ic})),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=P0(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);ls(Bf(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=W?.referrer)?N0(e):{})}update_referrer_info(){var e;this.register_once({$referrer:L0(),$referring_domain:W!=null&&W.referrer&&((e=Fc(W.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Zh]||this.props[Gh]||this.register_once({[Pc]:F0(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};we([Gh,Zh],(o=>{var a=this.props[o];a&&we(a,(function(l,c){e["$initial_"+Sh(c)]=l}))}));var t,r,i=this.props[Pc];if(i){var s=(t=D0(i),r={},we(t,(function(o,a){r["$initial_"+Sh(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[jo]||{};r[e]=t,this.props[jo]=r,this.save()}remove_event_timer(e){var t=(this.props[jo]||{})[e];return j(t)||(delete this.props[jo][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},L_=Te("[Product Tours]"),yh="ph_product_tours",gf=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[d_]:!(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(d_)||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?L_.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[yh];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 L_.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({[yh]: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(yh)}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)}},Ho=(function(n){return n.Activation="events",n.Cancellation="cancelEvents",n})({}),e4=(function(n){return n.Button="button",n.Tab="tab",n.Selector="selector",n})({}),t4=(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})({}),n4=(function(n){return n.Top="top",n.Left="left",n.Right="right",n.Bottom="bottom",n})({}),bh=(function(n){return n.Popover="popover",n.API="api",n.Widget="widget",n.ExternalSurvey="external_survey",n})({}),r4=(function(n){return n.Open="open",n.MultipleChoice="multiple_choice",n.SingleChoice="single_choice",n.Rating="rating",n.Link="link",n})({}),i4=(function(n){return n.NextQuestion="next_question",n.End="end",n.ResponseBased="response_based",n.SpecificQuestion="specific_question",n})({}),s4=(function(n){return n.Once="once",n.Recurring="recurring",n.Always="always",n})({}),Zo=(function(n){return n.SHOWN="survey shown",n.DISMISSED="survey dismissed",n.SENT="survey sent",n.ABANDONED="survey abandoned",n})({}),_h=(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})({}),mf=(function(n){return n.Popover="popover",n.Inline="inline",n})({}),xe=Te("[Surveys]"),q0="seenSurvey_",eT=(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},F_=n=>((e,t)=>{var r=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(r=""+e+t.id+"_"+t.current_iteration),r})(q0,n),tT=[bh.Popover,bh.Widget,bh.API],nT={ignoreConditions:!1,ignoreDelay:!1,displayType:mf.Popover},ra=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 is(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 vf=class{constructor(e){this.Ai=new ra,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"||!is(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=>is(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&is((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=>is(c.text,t.text,t.text_matching||"exact")||is(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=>is(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||z0(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)}},yf=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&z0(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===Ho.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 vf(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,Ho.Activation),this.Yi=this.Zi(e,Ho.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,Ho.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,Ho.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}},bf=class extends yf{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return Zo.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()}},_f=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(q0)||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 bf(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(Uh);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({[Uh]: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(tT.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!==mf.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!==mf.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()}},pn=Te("[Conversations]"),xf=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)||(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=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 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 as((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(pn.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var r=this;return as((function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(pn.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return as((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(pn.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return as((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}},wf=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=Te("[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.")}}},D_=Te("[RateLimiter]"),kf=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=>{D_.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void D_.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(qh))!==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(qh,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Vr=Te("[RemoteConfig]"),Sf=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))):(Vr.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 Vr.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void Vr.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return Vr.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){Vr.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()):Vr.info("__preview_remote_config is disabled. Logging config instead",e):Vr.error("Failed to fetch remote config from PostHog.")}},Ef=3e3,Cf=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=Gt(t?.flush_interval_ms||Ef,250,5e3,U.createLogger("flush interval"),Ef),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}},rT=["retriesPerformedSoFar"],Af=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=U_(e,rT);ss(t)&&(r.url=Uc(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=[]}},Rf=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}},iT=n=>F0(n?.config.mask_personal_data_properties,n?.config.custom_personal_data_properties),qc=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({[zh]:a})}},this._instance=e,this.Qe=t,this.Xe=r,this.Ye=i||iT,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[zh]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?D0(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(Bf(this.getSetOnceProps()),((t,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Sh(r)]=t})),e}},xh=Te("[SessionId]"),Zc=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 ra,this.er=(u,d)=>!(!ss(u)||!ss(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*Gt(o,60,36e3,xh.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){xh.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({[$c]:[t,e,r]}))}_r(){var e=this.Xe.props[$c];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=ss(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(),xh.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=ss(i)&&e&&!l?i:r,g=ss(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)}},sT=["$set_once","$set"],jn=Te("[SiteApps]"),Tf=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({},U_(e,sT),{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.')}},Z0=function(n,e){if(!n)return!1;var t=n.userAgent;if(t&&Qb(t,e))return!0;try{var r=n?.userAgentData;if(r!=null&&r.brands&&r.brands.some((i=>Qb(i?.brand,e))))return!0}catch{}return!!n.webdriver},Go=(function(n){return n.US="us",n.EU="eu",n.CUSTOM="custom",n})({}),H_="i.posthog.com",If=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("."+H_,".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]=Go.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=Go.EU:this.Sr[this.apiHost]=Go.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===Go.CUSTOM)return this.apiHost+t;var r=H_+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}},oT={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&&zc(e.href,n),not_regex:(n,e)=>!!C&&!zc(e.href,n),exact:(n,e)=>e.href===n,is_not:(n,e)=>e.href!==n},$f=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=Dc(e?.search,"__experiment_id"),r=Dc(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||oT[(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=P0();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 ht&&this._instance?Z0(ht,this._instance.config.custom_blocked_useragents):void 0}},aT=Te("[PostHog ExternalIntegrations]"),lT={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Mf=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 aT.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(lT[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)}}},Pf="[SessionRecording]",Bo=Te(Pf),Gc=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 Bo.error("started without valid sessionManager"),new Error(Pf+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Pf+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(lh))==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),Bo.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 Bo.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(m0)}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({[lh]: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:Bo.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):Bo.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(lh);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))}},Xo={},Of=()=>{},os="posthog",G0=!YR&&st?.indexOf("MSIE")===-1&&st?.indexOf("Mozilla")===-1,B_=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:pR(W?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Of,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:Ef},error_tracking:{},_onCapture:Of,__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))},V_=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},Nf=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}},Kc=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 Nf,this.Br=!1,this.version=hn.LIB_VERSION,this.qr=new ra,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=B_(),this.SentryIntegration=rf,this.sentryIntegration=e=>(function(t,r){var i=M0(t,r);return{name:$0,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 ff(this),this.toolbar=new sf(this),this.scrollManager=new Rf(this),this.pageViewManager=new Vc(this),this.surveys=new _f(this),this.conversations=new xf(this),this.logs=new wf(this),this.experiments=new $f(this),this.exceptions=new hf(this),this.rateLimiter=new kf(this),this.requestRouter=new If(this),this.consent=new ef(this),this.externalIntegrations=new Mf(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!==os){var i,s=(i=Xo[r])!==null&&i!==void 0?i:new n;return s._init(e,t,r),Xo[r]=s,Xo[os][r]=s,s}return this._init(e,t,r)}_init(e,t,r){var i;if(t===void 0&&(t={}),j(e)||Eh(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({},B_(t.defaults),V_(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:mn.GZipJS;var s=this.Qr();this.persistence=new Yo(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Yo(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 Cf((k=>this.ts(k)),this.config.request_queue_config),this.es=new Af(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 Zc(this),this.sessionPropsManager=new qc(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)),hn.DEBUG=hn.DEBUG||this.config.debug,hn.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(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,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:Mo,$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 Me(C,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?OR(this,(()=>this.ns())):this.ns(),qn(this.config._onCapture)&&this.config._onCapture!==Of&&(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 nf(this),this.historyAutocapture.startIfEnabled();var r=[];r.push((()=>{new of(this).startIfEnabledOrStop()})),r.push((()=>{var i;this.siteApps=new Tf(this),(i=this.siteApps)==null||i.init()})),e||r.push((()=>{this.sessionRecording=new Gc(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||r.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),r.push((()=>{this.autocapture=new Yh(this),this.autocapture.startIfEnabled()})),r.push((()=>{this.surveys.loadIfEnabled()})),r.push((()=>{this.logs.loadIfEnabled()})),r.push((()=>{this.conversations.loadIfEnabled()})),r.push((()=>{this.productTours=new gf(this),this.productTours.loadIfEnabled()})),r.push((()=>{this.heatmaps=new lf(this),this.heatmaps.startIfEnabled()})),r.push((()=>{this.webVitalsAutocapture=new af(this)})),r.push((()=>{this.exceptionObserver=new tf(this),this.exceptionObserver.startIfEnabledOrStop()})),r.push((()=>{this.deadClicksAutocapture=new Bc(this,PR),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,mn.GZipJS)?mn.GZipJS:ce(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){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 Sf(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&&(G0?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Uc(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=Uc(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=Ac.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(i=(s=h0(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=uR(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===Zo.DISMISSED||e===Zo.SENT){var v=t?.[_h.SURVEY_ID],f=t?.[_h.SURVEY_ITERATION];d={id:v,current_iteration:f},localStorage.getItem(F_(d))||localStorage.setItem(F_(d),"true"),u.$set=z({},u.$set,{[eT({id:v,current_iteration:f},e===Zo.SENT?"responded":"dismissed")]:!0})}else e===Zo.SHOWN&&(u.$set=z({},u.$set,{[_h.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=z({},u.properties.$set,u.$set);if(ls(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)&&!bn(a.distinct_id)||Eh(a.distinct_id))&&U.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=BR(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===Go.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),ls(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=nT),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(bn(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!==Mo){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(Wo)&&(this.unregister(Wo),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(z({},r||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:r||{}}),this.Jr=$_(e,t,r),this.featureFlags.setAnonymousDistinctId(i)):(t||r)&&this.setPersonProperties(t,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(Mc))}}else U.critical('The string "'+Mo+'" 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=$_(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(fn,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Mo,$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(f0)?(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(Wo,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,V_(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 Yo(z({},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,Ce.H()&&Ce.G("ph_debug","true"),U.info("set_config",{config:e,oldConfig:t,newConfig:z({},this.config)})):(hn.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:os;return t!==os&&(t=os+"."+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()&&ls(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Wo])&&((t=this.persistence)==null||(t=t.props)==null||!t[Oc]))}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(Oc,!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 Zc(this),this.pageViewManager=new Vc(this),this.persistence&&(this.sessionPropsManager=new qc(this,this.sessionManager,this.persistence)),this.sessionRecording=new Gc(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:Mo,$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===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 ht?Z0(ht,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 FA(e.event)?U.warn(s+". This can cause unexpected behavior."):U.info(s),null}r.properties&&!ls(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=yn(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]]=cR(n.prototype[e[t]])})(Kc,["identify"]);var W_;var K0=(W_=Xo[os]=new Kc,(function(){function n(){n.done||(n.done=!0,G0=!1,we(Xo,(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")})(),W_);var qf=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=K0.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 Jc(n={}){return new qf(n)}var Y0={posthog:n=>Jc(n),noop:()=>_c()};function X0(n,e){let t=Y0[n];if(!t)throw new Error(`Unknown telemetry provider: ${n}. Supported: ${Object.keys(Y0).join(", ")}`);return t(e)}async function Q0(n){md(),X("Syntro Bootstrap","====== INIT ======"),X("Syntro Bootstrap","Options:",{hasToken:!!n.token,tokenPrefix:`${n.token?.slice(0,15)}...`,hasCanvasOptions:!!n.canvas});let e=Nl();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",go()),console.log("[DIAG] editorConf:",Ol()),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=Ol()?.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=ji(t),md(r.d);else if(e)X("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw el("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),el("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 el("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")||qy,l=jy(),c=Ep(),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=Cp(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=Ui({debug:n.debug,history:f?new zi(n.testMode?0:100):void 0,testMode:n.testMode});console.log("[Syntro Bootstrap] EventBus created");let y=hd({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=zy(A);if(X("Syntro Bootstrap","Segment flags from PostHog:",H),Uy(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";_=X0(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=Ob("growthbook",{clientKey:r.e,apiHost:i,attributes:d,onExperimentViewed:_?.trackExperiment?(A,H,M)=>{_.trackExperiment(A,H,M)}:void 0})),b=sc({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=bc({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=Bu({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=Db(r.f,r.o??{});G=async()=>{let H=await A.fetch();return{...H.config,tiles:H.config.tiles??[]}}}else v&&(G=hr({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 ns(_,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,De)=>`[${De}] ${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 De=>{let ze=De.filter($e=>$e.success),_n=De.filter($e=>!$e.success);ze.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${ze.map($e=>$e.appId).join(", ")}`);let ft=_n.filter($e=>!L.has($e.appId));ft.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",ft.map($e=>`${$e.appId} (${$e.error})`).join(", ")),ft.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(iu){console.error(`[Syntro Bootstrap] Failed to activate app: ${$e}`,iu)}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 Ll({...n.canvas,fetcher:F,integrations:{experiments:v,telemetry:_},editorUrl:o,runtime:E}),runtime:E,experiments:v,telemetry:_,sessionMetrics:b,appLoader:R}}async function cT(n){try{return await Q0(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 uT(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 Zf={init:cT,encodeToken:Fl,decodeToken:ji,events:{emit:uT}};typeof window<"u"&&(window.Syntro=Zf);function vs(n){let e=n.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function dT(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=vs(i),o=vs(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:pT(r,i)}):{valid:!0,warnings:e,errors:t}}function pT(n,e){let t={...n};return vs(e).major===1&&(t=hT(t)),t.schemaVersion=en,t}function hT(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 fT(n){if(!n||typeof n!="object")return!1;let e=n,t=e.schemaVersion||"1.0",r=vs(t),i=vs(en);return r.major<i.major||!e.schemaVersion}var J0=p.object({url:p.string(),routeId:p.string().optional(),title:p.string().optional(),locale:p.string().optional()}),ex=p.object({url:p.string(),ts:p.number()}),tx=p.object({sessionId:p.string(),startTs:p.number(),pageHistory:p.array(ex).optional()}),nx=p.object({width:p.number(),height:p.number()}),rx=p.object({x:p.number(),y:p.number(),w:p.number(),h:p.number()}),ix=p.object({anchorId:p.string(),present:p.boolean(),visible:p.boolean().optional(),boundingBox:rx.optional()}),sx=p.record(p.string(),p.union([p.number(),p.string(),p.boolean(),p.undefined()])),ox=p.object({page:J0,session:tx,viewport:nx,anchors:p.array(ix).optional(),augmented:sx.optional()});function gT(n){return ox.safeParse(n)}var eu=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 tu=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 nu=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 Gf=p.enum(["posthog","canvas","derived"]),ax=p.object({ts:p.number(),name:p.string(),source:Gf,props:p.record(p.string(),p.unknown()).optional(),schemaVersion:p.string()}),lx=p.object({names:p.array(p.string()).optional(),patterns:p.array(p.string()).optional(),sources:p.array(Gf).optional()});function mT(n){return ax.safeParse(n)}function vT(n){return lx.safeParse(n)}var Kf=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()})]),cx=p.object({kind:p.literal("tooltip"),id:p.string(),anchor:Kf,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()}),ux=p.object({kind:p.literal("highlight"),id:p.string(),anchor:Kf,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()}),ru=p.object({id:p.string(),version:p.number(),routes:p.array(p.string()).optional(),steps:p.array(p.union([cx,ux]))});function yT(n){return ru.parse(n)}var bT=({configUri:n,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:r="include"}={})=>async()=>{let i=nl({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 ru.parse(o)};var dx=p.object({value:p.unknown(),expiresAt:p.number().optional()}),px=p.object({count:p.number(),resetAt:p.number().optional()});function _T(n){return dx.safeParse(n)}function xT(n){return px.safeParse(n)}var Yf="2026-04-23T15:26:01.916Z (9d88186d214)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${Yf} (Lit)`);let n=window.SynOS,e=n?.appRegistry||Hs;window.SynOS={...n,appRegistry:e,_runtimeBuild:Yf,_renderer:"lit"},ro(),Hv(e)}return xx(wT);})();
|
|
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),Ht(a)||(t>e&&(s+=n.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=n.substring(e,n.length)),s},iT=!!Rh||!!Ah,L_="text/plain",Gc=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=$R(o);return l&&a.push(l),i+"?"+a.join("&")},Zo=(n,e)=>JSON.stringify(n,((t,r)=>typeof r=="bigint"?r.toString():r),e),_h=n=>{var{data:e,compression:t}=n;if(e){if(t===yn.GZipJS){var r=nT((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 K0(d,0,h)})(Zo(e)),{mtime:0}),i=new Blob([r],{type:L_});return{contentType:L_,body:i,estimatedSize:i.size}}if(t===yn.Base64){var s=(function(l){var c,u,d,h,g,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=0,m=0,y="",k=[];if(!l)return l;l=rT(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})(Zo(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Zo(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Zo(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},$c=[];Ah&&$c.push({transport:"fetch",method:n=>{var e,t,{contentType:r,body:i,estimatedSize:s}=(e=_h(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(n_){var c=new n_;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),n.timeout)}}Ah(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))}}),Rh&&$c.push({transport:"XHR",method:n=>{var e,t=new Rh;t.open(n.method||"GET",n.url,!0);var{contentType:r,body:i}=(e=_h(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)}}),ht!=null&&ht.sendBeacon&&$c.push({transport:"sendBeacon",method:n=>{var e=Gc(n.url,{beacon:"1"});try{var t,{contentType:r,body:i}=(t=_h(n))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:r}):i;ht.sendBeacon(e,s)}catch{}}});var Kc=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 F_(n,e,t){return Zo({distinct_id:n,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Y0={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=>Kc(t,r))))),not_regex:(n,e)=>e.every((t=>n.every((r=>!Kc(t,r))))),icontains:(n,e)=>e.map(Tc).some((t=>n.map(Tc).some((r=>t.includes(r))))),not_icontains:(n,e)=>e.map(Tc).every((t=>n.map(Tc).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)))}))},Tc=n=>n.toLowerCase();function X0(n,e){return!n||Object.entries(n).every((t=>{var[r,i]=t,s=e?.[r];if(W(s)||Ht(s))return!1;var o=[String(s)],a=Y0[i.operator];return!!a&&a(i.values,o)}))}var xh=$e("[Error tracking]"),yf=class{constructor(e){var t,r;this.Zt=[],this.ti=new Lh([new Dh,new zh,new Bh,new Hh,new jh,new Wh,new Vh,new Uh],hR()),this._instance=e,this.Zt=(t=(r=this._instance.persistence)==null?void 0:r.get_property(Zh))!==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({[Zh]:this.Zt,[g_]:o})}get ii(){var e,t=!!this._instance.get_property(g_),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 xh.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void xh.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void xh.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=Y0[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)}},pt=$e("[FeatureFlags]"),Do=$e("[FeatureFlags]",{debugEnabled:!0}),wh="$active_feature_flags",rs="$override_feature_flags",D_="$feature_flag_payloads",Ho="$override_feature_flag_payloads",H_="$feature_flag_request_id",B_="$feature_flag_evaluated_at",V_=n=>{var e={};for(var[t,r]of Ic(n||{}))r&&(e[t]=r);return e},sT=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]})))):pt.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),n},oT=(function(n){return n.FeatureFlags="feature_flags",n.Recordings="recordings",n})({}),bf=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||(pt.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||pt.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(Gh),t=this._instance.get_property(rs),r=this._instance.get_property(Ho);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||(pt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(cs),t=this._instance.get_property(rs);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||(pt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this.oi=!0),r}getFlagPayloads(){var e=this._instance.get_property(D_),t=this._instance.get_property(Ho);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||(pt.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(qo)||{}),group_properties:this._instance.get_property(Wr)};Ht(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=z0()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:yn.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(oT.FeatureFlags))pt.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}pt.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(H_)||void 0,c=this._instance.get_property(B_)||void 0,u=this._instance.get_property(Lc)||{};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({[Lc]: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 pt.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:yn.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}pt.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=sT(o),h=d.flags,g=d.featureFlags,v=d.featureFlagPayloads;if(g){var f=o.requestId,m=o.evaluatedAt;if(me(g)){pt.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({[wh]:g,[cs]: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({[wh]:Object.keys(V_(_)),[cs]:_||{},[D_]:b||{},[Gh]:x||{}},f?{[H_]:f}:{},m?{[B_]:m}:{}))}}})(e,this._instance.persistence,r,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),pt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return pt.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(rs),this._instance.persistence.unregister(Ho),this.wi(),Do.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(rs),Do.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({[rs]:i})}else this._instance.persistence.register({[rs]:r.flags});Do.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this._instance.persistence.unregister(Ho),Do.info("Payload overrides cleared")):r.payloads&&(this._instance.persistence.register({[Ho]:r.payloads}),Do.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(zo)||[]).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({[wh]:Object.keys(V_(l)),[cs]:l}),this.wi()}getEarlyAccessFeatures(e,t,r){t===void 0&&(t=!1);var i=this._instance.get_property(zo),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(zo),(l=this._instance.persistence)==null||l.register({[zo]: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(qo)||{};this._instance.register({[qo]:U({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(qo)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var r=this._instance.get_property(Wr)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((i=>{r[i]=U({},r[i],e[i]),delete e[i]})),this._instance.register({[Wr]:U({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Wr)||{};this._instance.register({[Wr]:U({},t,{[e]:{}})})}else this._instance.unregister(Wr)}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}},aT=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Xo=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){aT.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=[...DR,...i];return U({},Re,{W:function(o){try{var a={};try{a=Kt.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&&Kt.G(o,h,l,c,u,d)}catch(g){Re.B(g)}},V:function(o,a){try{C?.localStorage.removeItem(o),Kt.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"?HR:r==="cookie"?Kt:t.H()?t:Kt}properties(){var e={};return ke(this.props,(function(t,r){if(r===cs&&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,(Ht(o=xR)?l:t_&&o.indexOf===t_?o.indexOf(a)!=-1:(ke(o,(function(c){if(l||(l=c===a))return Oc})),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=H0(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);ls(zf(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=V?.referrer)?V0(e):{})}update_referrer_info(){var e;this.register_once({$referrer:W0(),$referring_domain:V!=null&&V.referrer&&((e=Vc(V.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Jh]||this.props[Qh]||this.register_once({[Fc]:j0(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};ke([Qh,Jh],(o=>{var a=this.props[o];a&&ke(a,(function(l,c){e["$initial_"+Th(c)]=l}))}));var t,r,i=this.props[Fc];if(i){var s=(t=U0(i),r={},ke(t,(function(o,a){r["$initial_"+Th(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[Uo]||{};r[e]=t,this.props[Uo]=r,this.save()}remove_event_timer(e){var t=(this.props[Uo]||{})[e];return W(t)||(delete this.props[Uo][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},W_=$e("[Product Tours]"),kh="ph_product_tours",_f=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[v_]:!(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(v_)||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?W_.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[kh];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 W_.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({[kh]: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(kh)}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)}},Bo=(function(n){return n.Activation="events",n.Cancellation="cancelEvents",n})({}),mD=(function(n){return n.Button="button",n.Tab="tab",n.Selector="selector",n})({}),vD=(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})({}),yD=(function(n){return n.Top="top",n.Left="left",n.Right="right",n.Bottom="bottom",n})({}),Sh=(function(n){return n.Popover="popover",n.API="api",n.Widget="widget",n.ExternalSurvey="external_survey",n})({}),bD=(function(n){return n.Open="open",n.MultipleChoice="multiple_choice",n.SingleChoice="single_choice",n.Rating="rating",n.Link="link",n})({}),_D=(function(n){return n.NextQuestion="next_question",n.End="end",n.ResponseBased="response_based",n.SpecificQuestion="specific_question",n})({}),xD=(function(n){return n.Once="once",n.Recurring="recurring",n.Always="always",n})({}),Go=(function(n){return n.SHOWN="survey shown",n.DISMISSED="survey dismissed",n.SENT="survey sent",n.ABANDONED="survey abandoned",n})({}),Eh=(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})({}),xf=(function(n){return n.Popover="popover",n.Inline="inline",n})({}),we=$e("[Surveys]"),J0="seenSurvey_",lT=(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},j_=n=>((e,t)=>{var r=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(r=""+e+t.id+"_"+t.current_iteration),r})(J0,n),cT=[Sh.Popover,Sh.Widget,Sh.API],uT={ignoreConditions:!1,ignoreDelay:!1,displayType:xf.Popover},ia=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 is(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 wf=class{constructor(e){this.Ai=new ia,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"||!is(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=>is(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&is((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=>is(c.text,t.text,t.text_matching||"exact")||is(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=>is(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||X0(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)}},kf=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&X0(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===Bo.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 wf(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,Bo.Activation),this.Yi=this.Zi(e,Bo.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,Bo.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,Bo.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}},Sf=class extends kf{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return Go.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()}},Ef=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(J0)||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 Sf(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(Kh);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({[Kh]: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(cT.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!==xf.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!==xf.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()}},fn=$e("[Conversations]"),Cf=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)||(_n(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 fn.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),fn.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else fn.error("Cannot complete initialization: remote config is null")}Se(e,t){fn.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():fn.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!Ht(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 as((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(fn.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var r=this;return as((function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(fn.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return as((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(fn.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return as((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(fn.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}},Af=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=$e("[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.")}}},U_=$e("[RateLimiter]"),Rf=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=>{U_.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void U_.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(Xh))!==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(Xh,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Vr=$e("[RemoteConfig]"),Tf=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))):(Vr.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 Vr.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void Vr.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return Vr.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){Vr.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()):Vr.info("__preview_remote_config is disabled. Logging config instead",e):Vr.error("Failed to fetch remote config from PostHog.")}},If=3e3,$f=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=Yt(t?.flush_interval_ms||If,250,5e3,j.createLogger("flush interval"),If),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}},dT=["retriesPerformedSoFar"],Mf=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=Y_(e,dT);ss(t)&&(r.url=Gc(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=[]}},Pf=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}},pT=n=>j0(n?.config.mask_personal_data_properties,n?.config.custom_personal_data_properties),Yc=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({[Yh]:a})}},this._instance=e,this.Qe=t,this.Xe=r,this.Ye=i||pT,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[Yh]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?U0(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(zf(this.getSetOnceProps()),((t,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Th(r)]=t})),e}},Ch=$e("[SessionId]"),Xc=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 ia,this.er=(u,d)=>!(!ss(u)||!ss(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*Yt(o,60,36e3,Ch.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){Ch.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({[Nc]:[t,e,r]}))}_r(){var e=this.Xe.props[Nc];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=ss(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(),Ch.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=ss(i)&&e&&!l?i:r,g=ss(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)}},hT=["$set_once","$set"],jn=$e("[SiteApps]"),Of=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({},Y_(e,hT),{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.')}},Q0=function(n,e){if(!n)return!1;var t=n.userAgent;if(t&&i_(t,e))return!0;try{var r=n?.userAgentData;if(r!=null&&r.brands&&r.brands.some((i=>i_(i?.brand,e))))return!0}catch{}return!!n.webdriver},Ko=(function(n){return n.US="us",n.EU="eu",n.CUSTOM="custom",n})({}),z_="i.posthog.com",Nf=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("."+z_,".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]=Ko.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=Ko.EU:this.Sr[this.apiHost]=Ko.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===Ko.CUSTOM)return this.apiHost+t;var r=z_+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}},fT={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&&Kc(e.href,n),not_regex:(n,e)=>!!C&&!Kc(e.href,n),exact:(n,e)=>e.href===n,is_not:(n,e)=>e.href!==n},Lf=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=Wc(e?.search,"__experiment_id"),r=Wc(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||fT[(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=H0();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 ht&&this._instance?Q0(ht,this._instance.config.custom_blocked_useragents):void 0}},gT=$e("[PostHog ExternalIntegrations]"),mT={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Ff=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 gT.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(mT[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)}}},Df="[SessionRecording]",Vo=$e(Df),Jc=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 Vo.error("started without valid sessionManager"),new Error(Df+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Df+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(hh))==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),Vo.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 Vo.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(w0)}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({[hh]: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:Vo.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):Vo.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(hh);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))}},Jo={},Hf=()=>{},os="posthog",ex=!iT&&ot?.indexOf("MSIE")===-1&&ot?.indexOf("Mozilla")===-1,q_=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:_R(V?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Hf,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:If},error_tracking:{},_onCapture:Hf,__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))},Z_=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},Bf=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}},Qc=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 Bf,this.Br=!1,this.version=gn.LIB_VERSION,this.qr=new ia,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=q_(),this.SentryIntegration=cf,this.sentryIntegration=e=>(function(t,r){var i=D0(t,r);return{name:F0,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 bf(this),this.toolbar=new uf(this),this.scrollManager=new Pf(this),this.pageViewManager=new zc(this),this.surveys=new Ef(this),this.conversations=new Cf(this),this.logs=new Af(this),this.experiments=new Lf(this),this.exceptions=new yf(this),this.rateLimiter=new Rf(this),this.requestRouter=new Nf(this),this.consent=new of(this),this.externalIntegrations=new Ff(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!==os){var i,s=(i=Jo[r])!==null&&i!==void 0?i:new n;return s._init(e,t,r),Jo[r]=s,Jo[os][r]=s,s}return this._init(e,t,r)}_init(e,t,r){var i;if(t===void 0&&(t={}),W(e)||Ih(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({},q_(t.defaults),Z_(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:yn.GZipJS;var s=this.Qr();this.persistence=new Xo(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Xo(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 $f((k=>this.ts(k)),this.config.request_queue_config),this.es=new Mf(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 Xc(this),this.sessionPropsManager=new Yc(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)),gn.DEBUG=gn.DEBUG||this.config.debug,gn.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(mn,(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:Po,$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(mn,"anonymous")}return Oe(C,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?WR(this,(()=>this.ns())):this.ns(),qn(this.config._onCapture)&&this.config._onCapture!==Hf&&(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 lf(this),this.historyAutocapture.startIfEnabled();var r=[];r.push((()=>{new df(this).startIfEnabledOrStop()})),r.push((()=>{var i;this.siteApps=new Of(this),(i=this.siteApps)==null||i.init()})),e||r.push((()=>{this.sessionRecording=new Jc(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||r.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),r.push((()=>{this.autocapture=new tf(this),this.autocapture.startIfEnabled()})),r.push((()=>{this.surveys.loadIfEnabled()})),r.push((()=>{this.logs.loadIfEnabled()})),r.push((()=>{this.conversations.loadIfEnabled()})),r.push((()=>{this.productTours=new _f(this),this.productTours.loadIfEnabled()})),r.push((()=>{this.heatmaps=new hf(this),this.heatmaps.startIfEnabled()})),r.push((()=>{this.webVitalsAutocapture=new pf(this)})),r.push((()=>{this.exceptionObserver=new af(this),this.exceptionObserver.startIfEnabledOrStop()})),r.push((()=>{this.deadClicksAutocapture=new Uc(this,VR),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,yn.GZipJS)?yn.GZipJS:ue(e.supportedCompression,yn.Base64)?yn.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 Tf(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&&(ex?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Gc(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=Gc(o.url,{_:new Date().getTime().toString(),ver:gn.LIB_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=$c.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(i=(s=b0(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=yR(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===Go.DISMISSED||e===Go.SENT){var v=t?.[Eh.SURVEY_ID],f=t?.[Eh.SURVEY_ITERATION];d={id:v,current_iteration:f},localStorage.getItem(j_(d))||localStorage.setItem(j_(d),"true"),u.$set=U({},u.$set,{[lT({id:v,current_iteration:f},e===Go.SENT?"responded":"dismissed")]:!0})}else e===Go.SHOWN&&(u.$set=U({},u.$set,{[Eh.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=U({},u.properties.$set,u.$set);if(ls(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)&&!xn(a.distinct_id)||Ih(a.distinct_id))&&j.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=GR(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===Ko.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),ls(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=uT),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(xn(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!==Po){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(jo)&&(this.unregister(jo),this.register({distinct_id:e}));var o=(this.persistence.get_property(mn)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(mn,"identified"),this.setPersonPropertiesForFlags(U({},r||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:r||{}}),this.Jr=F_(e,t,r),this.featureFlags.setAnonymousDistinctId(i)):(t||r)&&this.setPersonProperties(t,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(Lc))}}else j.critical('The string "'+Po+'" 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=F_(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(mn,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Po,$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(_0)?(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(jo,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,Z_(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 Xo(U({},this.config,{persistence:"sessionStorage"}),u);var d=this.Kr(this.config.debug);_n(d)&&(this.config.debug=d),_n(this.config.debug)&&(this.config.debug?(gn.DEBUG=!0,Re.H()&&Re.G("ph_debug","true"),j.info("set_config",{config:e,oldConfig:t,newConfig:U({},this.config)})):(gn.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:os;return t!==os&&(t=os+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(mn))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(mn))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&ls(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[jo])&&((t=this.persistence)==null||(t=t.props)==null||!t[Dc]))}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(Dc,!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 Xc(this),this.pageViewManager=new zc(this),this.persistence&&(this.sessionPropsManager=new Yc(this,this.sessionManager,this.persistence)),this.sessionRecording=new Jc(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:Po,$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===vn.GRANTED?"granted":e===vn.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 ht?Q0(ht,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 zA(e.event)?j.warn(s+". This can cause unexpected behavior."):j.info(s),null}r.properties&&!ls(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=_n(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]]=vR(n.prototype[e[t]])})(Qc,["identify"]);var G_;var tx=(G_=Jo[os]=new Qc,(function(){function n(){n.done||(n.done=!0,ex=!1,ke(Jo,(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")})(),G_);var Xf=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=tx.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 ru(n={}){return new Xf(n)}var nx={posthog:n=>ru(n),noop:()=>Sc()};function rx(n,e){let t=nx[n];if(!t)throw new Error(`Unknown telemetry provider: ${n}. Supported: ${Object.keys(nx).join(", ")}`);return t(e)}async function ix(n){_d(),K("Syntro Bootstrap","====== INIT ======"),K("Syntro Bootstrap","Options:",{hasToken:!!n.token,tokenPrefix:`${n.token?.slice(0,15)}...`,hasCanvasOptions:!!n.canvas});let e=Ll();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",mo()),console.log("[DIAG] editorConf:",Nl()),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=Nl()?.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=ji(t),_d(r.d);else if(e)K("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw tl("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),tl("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 tl("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")||Xy,l=Gy(),c=Tp(),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=Ip(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=Ui({debug:n.debug,history:f?new zi(n.testMode?0:100):void 0,testMode:n.testMode});console.log("[Syntro Bootstrap] EventBus created");let y=vd({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=zb(),_,b=A=>{K("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let F=Yy(A);if(K("Syntro Bootstrap","Segment flags from PostHog:",F),Ky(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=rx(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 cc({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=Hb("growthbook",{clientKey:r.e,apiHost:i,attributes:d,onExperimentViewed:x?.trackExperiment?(A,F,X)=>{x.trackExperiment(A,F,X)}:void 0})),R=oc({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=kc({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=Uu({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=jb(r.f,r.o??{});N=async()=>{let F=await A.fetch();return{...F.config,tiles:F.config.tiles??[]}}}else v&&(N=hr({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 ns(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,Be=P.getRequiredApps(de);return Be.length>0?console.log("[Syntro Bootstrap] Required external apps:",Be.join(", ")):K("Syntro Bootstrap","No external apps required (all executors are built-in)"),Be.length>0&&await P.loadAppsForConfig(de).then(async Et=>{let Ct=Et.filter(Pe=>Pe.success),lu=Et.filter(Pe=>!Pe.success);Ct.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${Ct.map(Pe=>Pe.appId).join(", ")}`);let ys=lu.filter(Pe=>!z.has(Pe.appId));ys.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",ys.map(Pe=>`${Pe.appId} (${Pe.error})`).join(", ")),ys.forEach(Pe=>z.add(Pe.appId)));for(let Pe of Be)if(E.apps.has(Pe))try{await E.apps.activate(Pe),console.log(`[Syntro Bootstrap] App activated: ${Pe}`)}catch(Bt){console.error(`[Syntro Bootstrap] Failed to activate app: ${Pe}`,Bt)}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 Fl({...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 vT(n){try{return await ix(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 yT(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 Jf={init:vT,encodeToken:Dl,decodeToken:ji,events:{emit:yT}};typeof window<"u"&&(window.Syntro=Jf);function vs(n){let e=n.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function bT(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=vs(i),o=vs(nn);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${nn}. 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${nn}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:_T(r,i)}):{valid:!0,warnings:e,errors:t}}function _T(n,e){let t={...n};return vs(e).major===1&&(t=xT(t)),t.schemaVersion=nn,t}function xT(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 wT(n){if(!n||typeof n!="object")return!1;let e=n,t=e.schemaVersion||"1.0",r=vs(t),i=vs(nn);return r.major<i.major||!e.schemaVersion}var sx=p.object({url:p.string(),routeId:p.string().optional(),title:p.string().optional(),locale:p.string().optional()}),ox=p.object({url:p.string(),ts:p.number()}),ax=p.object({sessionId:p.string(),startTs:p.number(),pageHistory:p.array(ox).optional()}),lx=p.object({width:p.number(),height:p.number()}),cx=p.object({x:p.number(),y:p.number(),w:p.number(),h:p.number()}),ux=p.object({anchorId:p.string(),present:p.boolean(),visible:p.boolean().optional(),boundingBox:cx.optional()}),dx=p.record(p.string(),p.union([p.number(),p.string(),p.boolean(),p.undefined()])),px=p.object({page:sx,session:ax,viewport:lx,anchors:p.array(ux).optional(),augmented:dx.optional()});function kT(n){return px.safeParse(n)}var iu=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 su=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 ou=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 Qf=p.enum(["posthog","canvas","derived"]),hx=p.object({ts:p.number(),name:p.string(),source:Qf,props:p.record(p.string(),p.unknown()).optional(),schemaVersion:p.string()}),fx=p.object({names:p.array(p.string()).optional(),patterns:p.array(p.string()).optional(),sources:p.array(Qf).optional()});function ST(n){return hx.safeParse(n)}function ET(n){return fx.safeParse(n)}var eg=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()})]),gx=p.object({kind:p.literal("tooltip"),id:p.string(),anchor:eg,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()}),mx=p.object({kind:p.literal("highlight"),id:p.string(),anchor:eg,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()}),au=p.object({id:p.string(),version:p.number(),routes:p.array(p.string()).optional(),steps:p.array(p.union([gx,mx]))});function CT(n){return au.parse(n)}var AT=({configUri:n,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:r="include"}={})=>async()=>{let i=rl({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 au.parse(o)};var vx=p.object({value:p.unknown(),expiresAt:p.number().optional()}),yx=p.object({count:p.number(),resetAt:p.number().optional()});function RT(n){return vx.safeParse(n)}function TT(n){return yx.safeParse(n)}var tg="2026-04-24T22:49:55.034Z (617ec713a54)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${tg} (Lit)`);let n=window.SynOS,e=n?.appRegistry||Bs;window.SynOS={...n,appRegistry:e,_runtimeBuild:tg,_renderer:"lit"},io(),Uv(e)}return Cx(IT);})();
|
|
1163
1163
|
/*! Bundled license information:
|
|
1164
1164
|
|
|
1165
1165
|
@lit/reactive-element/css-tag.js:
|